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
This will actually build the result. It will return a filled Hash if successful, or raise an exception, An optional block passed can be used for error reporting
def call begin build rescue => error raise ParseParamsError, error.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_hash(&block); end", "def create_hash(&block); end", "def each_hash(result) # :nodoc:\n raise NotImplementedError\n end", "def to_h\n (@value || HashBuilder.new(&@block)).to_h\n end", "def initialize hash, results\n\t\t\tif results == nil or results.empty?\n\t\t\t\treturn\n\n\t\t\t# Take into consideration being passed an array of results.\n\t\t\t# For instance, rescan_file will return an array if more than\n\t\t\t# one sample is given. This ensures single results work.\n\t\t\telsif not results.is_a? Array\n\t\t\t\tresults = [ [ hash, results ] ]\n\t\t\tend\n\n\t\t\t@results = Array.new\n\n\t\t\t# Results will be an array of: [ [resource, result hash ] ]\n\t\t\tresults.each do |entry|\n\t\t\t\thash = entry.first # Grab the resource (checksum hash)\n\t\t\t\tresult = entry.last # Grab the query report\n\n\t\t\t\tif result['response_code'] == 0\n\t\t\t\t\tres = Hash.new\n\t\t\t\t\tRESULT_FIELDS.each{|field| res[field] = '-' }\n\t\t\t\t\tres[:hash] = hash\n\t\t\t\t\tres['result'] = result['verbose_msg']\n\t\t\t\t\t@results.push res\n\n\t\t\t\telsif result['response_code'] == 0\n\t\t\t\t\tabort \"[!] Invalid API KEY! Please correct this! Check ~/.uirusu\"\n\t\t\t\telse\n\t\t\t\t\tpermalink = result['permalink']\n\t\t\t\t\tdate = result['scan_date']\n\t\t\t\t\tmd5 = result['md5']\n\t\t\t\t\tsha1 = result['sha1']\n\t\t\t\t\tsha256 = result['sha256']\n\n\t\t\t\t\tresult['scans'].each do |scanner, value|\n\t\t\t\t\t\tif value != ''\n\t\t\t\t\t\t\tres = Hash.new\n\t\t\t\t\t\t\tres[:hash] = hash\n\t\t\t\t\t\t\tres[:md5] = md5\n\t\t\t\t\t\t\tres[:sha1] = sha1\n\t\t\t\t\t\t\tres[:sha256] = sha256\n\t\t\t\t\t\t\tres[:scanner] = scanner\n\t\t\t\t\t\t\tres[:detected] = value['detected']\n\t\t\t\t\t\t\tres[:version] = value['version']\n\n\t\t\t\t\t\t\tif value['result'] == nil\n\t\t\t\t\t\t\t\tres[:result] = \"Nothing detected\"\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tres[:result] = value['result']\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\tres[:update] = value['update']\n\t\t\t\t\t\t\tres[:permalink] = permalink unless permalink == nil\n\n\t\t\t\t\t\t\t@results.push res\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t#if we didn't have any results lets create a fake not found\n\t\t\tif @results.size == 0\n\t\t\t\tres = Hash.new\n\t\t\t\tRESULT_FIELDS.each{|field| res[field] = '-' }\n\t\t\t\tres[:hash] = hash\n\t\t\t\tres['result'] = result['verbose_msg']\n\t\t\t\t@results.push res\n\t\t\tend\n\t\tend", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.payload_hash\n\t\tdigest << self.proof.to_s\n\t\tdigest << self.previous_hash\n\t\t\n\t\treturn digest.hexdigest\n\tend", "def hash(block, stored_hash, hash_calc, block_check, line)\r\n return 'Block empty' if block.nil?\r\n\r\n # calculate hash value for line\r\n error = \"Line #{line}: Invalid hash set to #{stored_hash.strip}\"\r\n\r\n # if hash stored as with capital letters, return error\r\n stored_hash = stored_hash.strip # get rid of trailing white space\r\n int_hash = stored_hash.to_i(16) # get stored hash and convert to decimal\r\n # check lenght of stored hash(max4)...may be optiaml to place elsewhere\r\n return error + \"\\nHash length is too big\" if stored_hash.size >= 5\r\n\r\n # check hash for leading 0's\r\n return error + \"\\nHash contains leading zeros\" if stored_hash[0] == '0' && stored_hash.size > 1\r\n\r\n # check to make sure value is valid hex values\r\n return error + \"\\nInvalid hex value, must be lowercase and from 0-f\" unless block_check.check_hex(stored_hash)\r\n\r\n # see if calculated hash and stored has match\r\n hash = block_check.get_hash(block, hash_calc) # get hash value\r\n # removes last hash from string\r\n output_string = block_check.parse(block, '|' + stored_hash)\r\n error_two = \"Line #{line}: String '#{output_string[0]}' hash set to #{stored_hash.strip},\"\\\r\n \"should be #{hash.to_s(16)}\"\r\n return error_two unless block_check.check_hash(hash, int_hash)\r\n\r\n nil\r\n end", "def hash\n @hash || calculate_hash!\n end", "def initialize result_hash={}\n @result_hash = result_hash\n end", "def raw_hash\n @raw_hash ||= raw_hash_with_cycles[:block]\n end", "def check!(hash)\n build!(hash)\n return hash\n end", "def hash\n if @_hash.nil?\n @_hash = {}\n run\n end\n @_hash\n end", "def raw_hash_with_cycles\n @raw_hash_with_cycles ||= self.class.fetch_raw_hash_with_cycles block_hash\n end", "def results_hash\n hash = {:updated => [],\n :merged => [],\n :removed => [],\n :unresolved => []}\n\n class << hash\n def success?; self[:unresolved].empty?; end\n end\n hash\n end", "def calculate_hash!\n entry_hash = to_hash\n entry_hash['description']=nil\n @hash = entry_hash.hash\n end", "def result\n @result ||= build\n end", "def hash_builder(student)\n student_hash = { id: student.id, name: student.first_name + ' ' + student.s_last_name,\n other_interventions: student.num_other_programs,\n tutor: student.vol_name, first_attempt_average: @acumen_one,\n second_attempt_average: @acumen_two,\n hug_gain: (@acumen_two - @acumen_one).round(2),\n last_year_dra_gains: @last_year_dra_gains,\n fall_dra: @student_record[:fall_dra], winter_dra: @student_record[:winter_dra],\n mid_year_dra_gain: @student_record[:mid_year_dra_gain],\n spring_dra: @student_record[:spring_dra], end_year_dra_gain: @student_record[:end_year_dra_gain],\n fall_rit: @student_record[:fall_rit], winter_rit: @student_record[:winter_rit],\n mid_year_rit_gain: @student_record[:mid_year_rit_gain],\n spring_rit: @student_record[:spring_rit], end_year_rit_gain: @student_record[:end_year_rit_gain],\n fall_rank: @student_record[:fall_rank], winter_rank: @student_record[:winter_rank],\n mid_year_rank_gain: @student_record[:mid_year_rank_gain],\n spring_rank: @student_record[:spring_rank], end_year_rank_gain: @student_record[:end_year_rank_gain],\n fall_lexile: @student_record[:fall_lexile], winter_lexile: @student_record[:winter_lexile],\n spring_lexile: @student_record[:spring_lexile] }\n student_hash\n end", "def each_hash(the_query, with_table_names = false, &block)\n begin\n if with_table_names\n # We have to build the hash ourselves, if we want table names included\n query(the_query, { as: :array, cache_rows: false })\n if @result != nil\n fields = @result.fields\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n\n result = []\n @result.each do |row|\n hrow = {}\n (0...row.length).each do |i|\n field_name = tables[i].nil? ? fields[i] : \"#{tables[i]}.#{fields[i]}\"\n hrow[field_name] = row[i]\n end\n yield hrow\n result << hrow\n end\n return result\n end\n else\n query(the_query, { as: :hash, cache_rows: false })\n if @result != nil\n if block_given?\n @result.each(&block)\n else\n return @result.to_a\n end\n end\n end\n rescue Mysql2::Error => e\n # puts \"#{e.errno}: #{e.error}\"\n raise e\n ensure\n if block_given? && @result != nil\n @result.free\n end\n end\n end", "def initialize(result)\r\n\t\t@result = result\r\n\t\t@recipehash = {}\r\n\tend", "def get_broadhash\n blocks = self.blocks_get_status\n if blocks[\"success\"]\n return blocks[\"broadhash\"]\n else\n return nil\n end\n end", "def build_hash items\n result = {}\n items.each do |v|\n k = yield v\n if result.has_key? k\n raise \"Duplicate hash key: #{k} with values #{v} and #{result[k]}\"\n end\n result[k] = v\n end\n result\n end", "def block_by_hash(_hsh)\n raise NotImplementedError\n end", "def calculate_hash\n\t\toptions = {:firstname => firstname, :email => email, :phone => phone, :txnid => txnid, :surl => surl, :furl => furl, :productinfo => productinfo, :amount => amount}\n\t\tservice = PayuIndia::Helper.new(payment_gateway_key, payment_gateway_salt, options)\n\t\tself.hast = service.generate_checksum\n\tend", "def block(_hash)\n raise Sibit::NotSupportedError, 'block() doesn\\'t work here'\n end", "def find_returned_hashes(node, returning:)\n if node.is_a?(Array)\n *possible_returns, last_expression = *node\n return possible_returns.map { |c| find_returned_hashes(c, returning: false) }.flatten +\n # Check the last expression of a method body\n find_returned_hashes(last_expression, returning: returning)\n end\n\n case node.type\n when :hash\n if returning\n [node]\n else\n # This is some random hash literal\n []\n end\n when :begin\n # Check the last expression of a method body\n find_returned_hashes(node.children, returning: true)\n when :resbody\n _condition, _assign, body = *node\n find_returned_hashes(body, returning: returning)\n when :kwbegin\n find_returned_hashes(node.children, returning: returning)\n when :rescue\n try_body, rescue_body, _ensure_body = *node\n find_returned_hashes(try_body, returning: returning) + find_returned_hashes(rescue_body, returning: returning)\n when :block\n # Check methods with blocks for possible returns\n method_call, _args, *body = *node\n if method_call.type == :send\n find_returned_hashes(body, returning: returning)\n end\n when :if\n # Check each branch of a conditional\n _condition, *branches = *node\n branches.compact.map { |b| find_returned_hashes(b, returning: returning) }.flatten\n when :return\n find_returned_hashes(node.children.first, returning: true)\n else\n []\n end\n rescue\n p \"--- UnderscorizeMutationHashTransform crashed on node: ---\"\n p node\n raise\n end", "def build_block(transactions, prev_hash = hash)\n Block.new(transactions, prev_hash)\n end", "def block_with_rescue(result_hash = {:result => false, :errors => []})\n begin\n ActiveRecord::Base.transaction do\n yield(result_hash)\n raise Exception if result_hash[:errors].any?\n end\n rescue Exception => e\n Rails.logger.error('*'*100)\n Rails.logger.error(e.message)\n Rails.logger.error('*'*100)\n result_hash[:result] = false\n result_hash[:errors] << 'Произошла непредвиденная ошибка. Попробуйте позже'\n end\n\n result_hash\n end", "def execute_for_json(result = {}, &block)\n begin\n yield(result)\n rescue => e\n logger.error e.message + \"\\n \" + e.backtrace.join(\"\\n \")\n \n result[:error] = {\n :message => e.message,\n :description => e.backtrace[0]\n }\n end\n return result;\n end", "def to_hash(options={})\n case\n # 1. Create hash from the block\n when @block\n @hash = (@args && ! @args.empty?) ? { name => { @args => {} } } : { name => {} }\n call\n @hash[self.name.to_sym].update @options unless @options.empty?\n @hash\n # 2. Hash created with option methods\n when @hash[self.name.to_sym] && ! @args.is_a?(Hash) && @hash[self.name.to_sym][@args]\n @hash[self.name.to_sym].update @options unless @options.empty?\n @hash\n # 3. Hash passsed as @args\n when @hash[self.name.to_sym] && @args.respond_to?(:to_hash) && ! @args.empty?\n { name => @args.to_hash }\n # 4. Hash already built\n else\n @hash\n end\n end", "def call\n from_hash if hash_definition.any?\n\n instance_exec(&@block) unless @block.nil?\n end", "def to_hash(options={})\n case\n when (! @value || @value.empty?) && ! @block\n @hash = super\n when @block\n call\n @hash = { name.to_sym => @value.to_hash }\n end\n @hash\n end", "def calculate_values_hashes\n @values_hashes || recalculate_values_hashes\n end", "def generate_hash\n \n tmp_file = \"/tmp/zotero.xml\"\n \n File.open(tmp_file, \"w\") { |f| f << @datastreams[\"zotero\"] }\n \n # Check to make sure zotero.xml file has been written\n raise \"Couldn't write #{tmp_file}\" unless File.exist?(tmp_file) and File.file?(tmp_file)\n \n php_output = `/usr/bin/env php #{File.join(Rails.root, 'lib/stanford/zotero_to_json.php' )} /tmp/zotero.xml`\n # puts php_output.inspect\n \n json = JSON(php_output)\n # puts json.inspect\n json.is_a?(Array) ? json = json.first : json = json\n \n if json.nil? or json.is_a?(String)\n json = {}\n end\n\n # this is really stupid, but it's a quick fix to get the coverage data.\n xml = Nokogiri::XML(open(\"/tmp/zotero.xml\"))\n xml.search(\"//dc:coverage\").each do |cov| \n format_coverage(cov.content.strip).each do |key,vals|\n json[\"#{key}\"] ||= [] \n json[\"#{key}\"] << vals.first\n end\n end\n [\"druid\", \"title\", \"originator\", \"date\", \"document_type\", \"document_subtype\",\n \"containing_work\", \"corporate_entity\", \"extent\", \"language\", \"abstract\", \n \"EAF_hard_drive_file_name\", \"tags\", \"notes\", \"box\", \"folder\", \"subseries\"].each {|k| json[k] ||= \"\" }\n return json\n\n end", "def new_hash(*args, &block)\n if block\n r = hash_class.new\n r.default = block\n r\n elsif args.size == 1\n value = args.first\n if value.is_a?(Hash) or value.is_a?(hash_class)\n r = hash_class.new\n r.putAll(value)\n r\n else\n r = hash_class.new\n r.default = value\n r\n end\n else\n r = hash_class.new\n args.each_slice(2) {|key,val| r.put(key,val)}\n r\n end\n end", "def test_hash_valid_hash\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); true; end\r\n def block_checker.get_hash(block, hash_calc); 11000; end\r\n def block_checker.check_hash(actual, stored); true; end\r\n def block_checker.parse(block, char); ['0|abc|1234>1234(4)|1213.34123']; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: String '0|abc|1234>1234(4)|1213.34123' hash set to 1234,should be 2af8\"\r\n assert_nil @g.hash( block, '1234', hash_calc, block_checker, 0)\r\n end", "def test_hash_invalid_hash\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); true; end\r\n def block_checker.get_hash(block, hash_calc); 11000; end\r\n def block_checker.check_hash(actual, stored); false; end\r\n def block_checker.parse(block, char); ['0|abc|1234>1234(4)|1213.34123']; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: String '0|abc|1234>1234(4)|1213.34123' hash set to 1234,should be 2af8\"\r\n assert_equal output, @g.hash( block, '1234', hash_calc, block_checker, 0)\r\n end", "def load_cycloHash()\n @cycloHash = Hash.new\n @block.each do|key,value|\n @cycloHash[key]=value.each_cyclo()\n end\n end", "def to_result_hash\n if self.class.respond_to?(:returns) && self.class.returns.any?\n to_hash([:status] | self.class.returns)\n else\n to_hash\n end\n end", "def response_build_hash\n if @_config.json_root.present?\n begin\n fetch_from_body @_config.json_root\n rescue\n raise ResponseBuilderError, \"Could not find key #{@_config.json_root} in:\\n#{response_body}\"\n end\n else\n response_body\n end\n end", "def result\n if @validate && validation_errors.any?\n return { \"errors\" => validation_errors }\n end\n\n @result ||= Executor.new(self, @operation_name).result\n end", "def result\n @result = yield\n end", "def merchanthash\n if version.to_i == 1 \n return HashGenerator::generate(merchant_hash_key, merchant_id, order_id);\n else\n return Digest::SHA512.hexdigest(\"#{merchant_hash_key},#{merchant_id},01,#{order_id},#{gross_amount}\")\n end\n end", "def each_result(results = last_results, &block)\n results.each do |result|\n block.call(Hashie::Mash.new(result))\n end\nend", "def ResultHash(base_value)\n base_value.is_a?(::Saxinator::ResultHash) ? base_value : ::Saxinator::ResultHash.new(base_value)\nend", "def block_to_hash(default = {}, &block)\n default.merge((yield HashWithAccessors.new(default)).to_hash) if block_given?\n end", "def build(&block)\n if block\n @build = block\n else\n @build\n end\n end", "def create_result_hash\n beer_profiles\n {\n beer_1: {\n name: @names[0],\n brewery: @descriptions[0],\n style: @descriptions[1],\n url: @profiles[0]\n },\n beer_2: {\n name: @names[1],\n brewery: @descriptions[2],\n style: @descriptions[3],\n url: @profiles[1]\n },\n beer_3: {\n name: @names[2],\n brewery: @descriptions[4],\n style: @descriptions[5],\n url: @profiles[2]\n },\n beer_4: {\n name: @names[3],\n brewery: @descriptions[6],\n style: @descriptions[7],\n url: @profiles[3]\n },\n beer_5: {\n name: @names[4],\n brewery: @descriptions[8],\n style: @descriptions[9],\n url: @profiles[4]\n }\n }\n end", "def build(&block)\n instance_eval(&block)\n end", "def return(&block); end", "def result_with_hash(hash)\n b = new_toplevel(hash.keys)\n hash.each_pair do |key, value|\n b.local_variable_set(key, value)\n end\n result(b)\n end", "def checksum!\n # Get a deep copy of hash to compare with\n @_original_hash = Marshal.load(Marshal.dump(to_hash))\n # create a copy of basic elements\n base = self.reject { |k,_| ['_id', '_rev', 'couchrest-hash'].include? k.to_s }\n\n result = nil\n\n flatten =\n lambda {|r|\n (recurse = lambda {|v|\n if v.is_a?(Hash) || v.is_a?(CouchRest::Document)\n v.to_a.map{|v| recurse.call(v)}.flatten\n elsif v.is_a?(Array)\n v.flatten.map{|v| recurse.call(v)}\n else\n v.to_s\n end\n }).call(r)\n }\n self['couchrest-hash'] = Digest::MD5.hexdigest(flatten.call(base).sort.join(''))\n end", "def make_hash item_or_array_or_hash\n return {} if item_or_array_or_hash.nil? \n return strip_nil_keys(item_or_array_or_hash) if item_or_array_or_hash.kind_of?(Hash)\n hash = {}\n [item_or_array_or_hash].flatten.each do |element| \n unless element.nil?\n hash[element] = block_given? ? yield(element) : nil\n end\n end\n hash\n end", "def hash(*args, **_arg1, &block); end", "def output_hash; end", "def get_hash(*params); raise('Stub or mock required.') end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def build_self(build_once = true)\n @used = true\n surface_errors do\n if built? and build_once\n Namespace.root.context.instance_eval(&@update_block) if RootNamespace.root.context.options.present?\n elsif @block\n self.result = Namespace.root.context.instance_eval(&@block)\n end\n end\n end", "def results(&block)\n section(:top => 1, :bottom => 0) do\n say \"RESULT:\"\n yield\n end\n end", "def to_hash\n call\n @hash = @value\n @hash\n end", "def append_block(block)\n valid = block.transactions.all? do |tx|\n tx.coinbase? || verify_transaction?(tx)\n end\n\n unless valid\n puts \"Verify block failed!\"\n return\n end\n\n pow = ProofOfWork.new(block)\n catch :not_found do\n result = pow.run!\n nonce, hash = result.values_at(:nonce, :hash)\n puts \"Mining done - #{hash}\"\n block.hash = hash\n block.nonce = nonce\n save_block(block)\n\n self.hash = hash\n end\n end", "def check_for_results\n if @names[0] == \"You can also try results from Google...\"\n return {\n beer_1: {\n name: \"Sorry no results found on BA\",\n brewery: \"\",\n style: \"\",\n url: \"\"\n }\n }\n end\n create_result_hash\n end", "def mining_hash\n Utils.keccak(rlp_encode skip_keys: [:mix_hash, :nonce])\n end", "def hash(block)\n Digest::SHA256.hexdigest(block.to_s.encode)\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash(hash, &block)\n hash.inject({}) do |result, (key, value)|\n # Recursively deep-symbolize subhashes\n value = _recurse_(value, &block)\n\n # Pre-process the key with a block if it was given\n key = yield key if block_given?\n # Symbolize the key string if it responds to to_sym\n sym_key = key.to_sym rescue key\n\n # write it back into the result and return the updated hash\n result[sym_key] = value\n result\n end\n end", "def getblockhash(index)\n @api.request 'getblockhash', index\n end", "def hash\n return unless doc_value?\n result['doc']['hash']\n end", "def to_hash\n memoize(:to_hash) do\n _process_hashed(structures.inject({}) { |acc, elem| Utils.merge(acc, elem) })\n end\n end", "def result\n if not_already_loaded? && any_to_load?\n lazy_results.merge!(block_results)\n lazy_values.clear\n end\n lazy_results[value]\n end", "def parse_result!(h)\n @result = {}\n return unless h.is_a?(Hash)\n @code = h[CODE]\n @error = h[ERROR]\n if h[RESULTS].is_a?(Array)\n @result = h[RESULTS]\n @count = h[COUNT] || @result.count\n else\n @result = h\n @count = 1\n end\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def to_h(&block)\n if block_given?\n @properties.each_with_object({}) do |(key, val), acc|\n k, v = *block.(key, val)\n acc[k] = v\n end\n else\n DeepDup.deep_dup(@properties)\n end\n end", "def new_hash\nHash.new\nend", "def test_basic_builder\n block_ = proc do\n set_value(:a, 1)\n set_value_by_block(:b){ 2 }\n end\n hash_ = Hash.new\n Blockenspiel.invoke(block_) do\n add_method(:set_value) do |key_, value_|\n hash_[key_] = value_\n end\n add_method(:set_value_by_block, :receive_block => true) do |key_, bl_|\n hash_[key_] = bl_.call\n end\n end\n assert_equal(1, hash_[:a])\n assert_equal(2, hash_[:b])\n end", "def to_hash\r\n result = {}\r\n each do |elt|\r\n result[elt] = yield(elt)\r\n end\r\n result\r\n end", "def result\n @result ||=\n begin\n matching_ops = @orders_number / (@matching_finished_at - @matching_started_at)\n\n # TODO: Deal with calling iso8601(6) everywhere.\n { config: @config,\n matching: {\n started_at: @matching_started_at.iso8601(6),\n finished_at: @matching_finished_at.iso8601(6),\n operations: @orders_number,\n ops: matching_ops\n }\n }\n end\n end", "def hash\n [host_list, total_matching, total_returned].hash\n end", "def block(_hash)\n raise Sibit::NotSupportedError, 'Blockchair doesn\\'t implement block()'\n end", "def test_hash_zero\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n def block_checker.check_hex(string); false; end\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: Invalid hash set to 212g\\nInvalid hex value, must be lowercase and from 0-f\"\r\n assert_equal output, @g.hash( block, '212g', hash_calc, block_checker, 0)\r\n end", "def test_hash_long\r\n hash_calc = Minitest::Mock.new('test_hash_calculator')\r\n block_checker = Minitest::Mock.new('test_block_checker')\r\n block = '0|abc|1234>1234(4)|1213.34123|1234'\r\n output = \"Line 0: Invalid hash set to 12345\\nHash length is too big\"\r\n assert_equal output, @g.hash( block, '12345', hash_calc, block_checker, 0)\r\n end", "def with_host_result(host, &block)\n hr = self.find {|r| r.host.to_s == host.to_s }\n if !hr\n hr = HostResult.new(:host => host)\n self << hr\n end\n yield hr\n self\n end", "def create_data\n get_install_id do |install_id|\n get_client_count do |client_count|\n get_server_count do |server_count|\n identity_key = @options.fetch(:identity_key, \"\")\n flavour, version = get_version_info\n timestamp = Time.now.to_i\n data = {\n :tessen_identity_key => identity_key,\n :install => {\n :id => install_id,\n :sensu_flavour => flavour,\n :sensu_version => version\n },\n :metrics => {\n :points => [\n {\n :name => \"client_count\",\n :value => client_count,\n :timestamp => timestamp\n },\n {\n :name => \"server_count\",\n :value => server_count,\n :timestamp => timestamp\n }\n ]\n }\n }\n yield data\n end\n end\n end\n end", "def build_success_result\n result = {success: true, error_message: \"\"}\n end", "def build_row_hash(row)\n if(!row.cells[0].value) # skip empty rows\n return nil # Skip row if no name or header\n elsif(row.cells[0].datatype == \"s\" && row.cells[0].value.match(/name|item|\\A\\D*\\Z/i))\n @errors << { :part_number => \"N/A\", :condition => \"N/A\", :message => \"Found and skipped excel header\" }\n return nil # Skip row if header\n end\n\n product_name = row.cells[0].value.to_s\n\n # If name is mopar part number\n if product_name.match(/^\\d{7}/)\n product_name = product_name[0,7]\n end\n\n # handle date formatting from excel\n if row.cells[1].value.is_a?(DateTime)\n my_category = row.cells[1].value.strftime(\"%-m-%-d\")\n else\n my_category = row.cells[1].value.to_s\n end\n\n @product_row = {\n :name => product_name,\n :category => my_category,\n :description => (row.cells[2] ? row.cells[2].value.tr('***', '').chomp('-') : ''),\n :meta_keywords => (row.cells[3] ? row.cells[3].value : ''),\n :price => (row.cells[9] ? row.cells[9].value : 0),\n :core => (row.cells[10] ? row.cells[10].value : 0),\n :cost => (row.cells[15] ? row.cells[15].value : 0),\n :vendor => (row.cells[16] ? row.cells[16].value : ''),\n :vendor_price => (row.cells[17] ? row.cells[17].value : 0),\n :vendor_part_number => (row.cells[18] ? row.cells[18].value : ''),\n :length => (row.cells[19] ? row.cells[19].value : ''),\n :width => (row.cells[20] ? row.cells[20].value : ''),\n :height => (row.cells[21] ? row.cells[21].value : ''),\n :weight => (row.cells[22] ? row.cells[22].value : ''),\n :notes => (row.cells[12] ? row.cells[12].value : ''),\n :application => (row.cells[4] ? row.cells[4].value : ''),\n :location => (row.cells[5] ? row.cells[5].value : ''),\n :condition => (row.cells[6] ? row.cells[6].value : ''),\n :cross_ref => (row.cells[7] ? row.cells[7].value : ''),\n :cast_num => (row.cells[8] ? row.cells[8].value : ''),\n :available => (row.cells[13] ? row.cells[13].value : 'N'), # for sale? (count in inventory)\n :active => (row.cells[14] ? row.cells[14].value : 'FALSE'), # active (visible to users)\n :quantity => (row.cells[11] ? row.cells[11].value : 0),\n :package => (row.cells[23] ? row.cells[23].value : '')\n }\n\n end", "def select\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value if yield(key, value)\n end\n return hsh\n end", "def select\n hsh = ::Archetype::Hash.new\n self.each do |key, value|\n hsh[key] = value if yield(key, value)\n end\n return hsh\n end", "def get_db_as_hash()\n db = get_db()\n db.results_as_hash = true \n return db\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def each_hash(with_table=nil, &block)\n return enum_for(:each_hash, with_table) unless block\n while rec = fetch_hash(with_table)\n block.call rec\n end\n self\n end", "def build_and_save_imported_result(hash, raw, user, competition, is_start_time)\n ImportResult.create!(\n hash.merge(\n raw_data: convert_array_to_string(raw),\n user: user,\n competition: competition,\n is_start_time: is_start_time\n )\n )\n end", "def initialize\n @hashes = Hash.new\n bootstrap\n populate\n end", "def calculate_block_hash(block)\n Digest::SHA256.hexdigest(block.block_index.to_s + block.previous_block_hash + block.timestamp + block.data)\n end", "def block(hash)\n best_of('block') do |api|\n api.block(hash)\n end\n end", "def blocks_to_hash(blocks)\n blocks.each_with_object({}) do |block, hash|\n hash.merge!(block.to_hash)\n end\n end", "def yield\n wait\n case result\n when Exception\n raise result\n else\n result\n end\n end" ]
[ "0.681825", "0.681825", "0.6148317", "0.60465825", "0.59784293", "0.59296453", "0.5857065", "0.57886744", "0.57885987", "0.5660827", "0.56411403", "0.5636977", "0.5570832", "0.5535696", "0.5518773", "0.5517917", "0.5451451", "0.54295266", "0.5424815", "0.54083943", "0.5406842", "0.5395714", "0.53945726", "0.53833133", "0.5341286", "0.5340356", "0.53310645", "0.5327689", "0.5323748", "0.53056216", "0.52980214", "0.5289759", "0.5271953", "0.52701414", "0.5258809", "0.52501655", "0.52433443", "0.52378666", "0.52127814", "0.52078885", "0.5202672", "0.5199031", "0.5197307", "0.51961905", "0.5173204", "0.51500744", "0.514666", "0.51332396", "0.512693", "0.51254064", "0.51198286", "0.51182014", "0.5109398", "0.5096489", "0.5091949", "0.50843245", "0.50843245", "0.50843245", "0.50843245", "0.50843245", "0.50843245", "0.50843245", "0.5069028", "0.50651765", "0.5062696", "0.50591797", "0.5043255", "0.50325966", "0.5030938", "0.5022503", "0.5018377", "0.50088996", "0.5001379", "0.49884987", "0.49823937", "0.49820852", "0.49726108", "0.49672645", "0.49639118", "0.4963615", "0.4962879", "0.496036", "0.49592552", "0.49449688", "0.49399024", "0.4926983", "0.49229637", "0.49220058", "0.49194917", "0.49166968", "0.49166128", "0.49166128", "0.49158615", "0.4907667", "0.4907667", "0.49053666", "0.49048138", "0.4904444", "0.48984492", "0.4894769", "0.48946238" ]
0.0
-1
A private build method, which does the actual work
def build # use guard clauses to a) avoid nested ifs b) early identify invalid values raise ArgumentError, "`a` must be a Fixnum" unless dirty.fetch(:a).is_a? Fixnum # #tap will guarantee, that a hash is returned {}.tap do |h| h[:a] = dirty.fetch(:a) # a mandatory parameter, will raise a KeyError on violation h[:b] = dirty.fetch(:b, 2) # optional, with 2 as the default h[:c] = dirty.fetch(:c) if dirty.has_key? :c # optional, no default end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build; end", "def build\r\n end", "def build\r\n end", "def build\n end", "def build(params); end", "def build\n end", "def build\r\n raise \"Not implemented\"\r\n end", "def build!\n end", "def build\n yield self\n self\n end", "def build(**)\n raise NotImplementedError\n end", "def build=(_arg0); end", "def build\n builder_values = builder.build\n self.use_values(builder_values)\n end", "def process_and_build_components \n end", "def build(attrs)\n # Implement #build \n end", "def build()\n HP.logger.debug(\"~ Build Mode: #{build_mode}\")\n HP.logger.debug(\"~ Source Root: #{source_root}\")\n HP.logger.debug(\"~ Build Root: #{build_root}\")\n build_entries(entries())\n end", "def builder; end", "def builder; end", "def builder; end", "def build(*args)\n raise \"Method 'build' not implemented for #{self.class.name}\"\n end", "def build_everything\n puts 'building posts'\n build_posts\n puts 'building tags'\n build_tags\n puts 'building index'\n build_index\n puts 'building feed'\n build_feed\n end", "def build(file_name)\n end", "def build\n from_branches + from_tags + from_refs\n end", "def build\n deferred_defaults\n validate\n Builder.new(self).build\n end", "def build\n # Create the offsets, if they are not provided\n current_offset = 0\n fields.each do |field_def|\n field_def[2] ||= current_offset\n current_offset = field_def[2] + field_def[1].size\n end\n registry.do_create_compound(name, fields, size)\n end", "def build(file_prefix)\n end", "def builder\n\n add_breadcrumb \"SOGR Capital Project Analyzer\"\n\n # Select the asset seed that they are allowed to build\n\n @asset_seed = []\n asset_class_name = Rails.application.config.asset_base_class_name == 'TransamAsset' ? 'TransitAsset' : Rails.application.config.asset_base_class_name\n\n asset_class_name.constantize.asset_seed_class_name.constantize.active.each do |seed|\n assets = asset_class_name.constantize.where(seed.class.to_s.underscore => seed)\n if assets.where(organization: @organization_list).count > 0\n @asset_seed << {id: seed.id, name: seed.to_s, orgs: @organization_list.select{|o| assets.where(organization_id: o).count > 0}}\n else\n @asset_seed << {id: seed.id, name: seed.to_s, orgs: []}\n end\n end\n\n @fiscal_years = get_fiscal_years(Date.today)\n @range_fiscal_years = ((1..14).to_a + (3..10).to_a.map{|x| x * 5}).map{|x| [\"#{x} years\", x-1]}\n @scenarios = Scenario.where(organization: current_user.viewable_organizations)\n @builder_proxy = BuilderProxy.new\n\n @has_locked_sogr_this_fiscal_year = CapitalPlanModule.joins(:capital_plan_module_type, :capital_plan).where(capital_plan_module_types: {name: ['Unconstrained Plan', 'Constrained Plan']}, capital_plans: {organization_id: @organization_list, fy_year: current_planning_year_year}).where('capital_plan_modules.completed_at IS NOT NULL').pluck('capital_plans.organization_id')\n\n if @organization_list.count == 1\n if @has_locked_sogr_this_fiscal_year && (@has_locked_sogr_this_fiscal_year.include? @organization_list.first)\n @fiscal_years = @fiscal_years[(@fiscal_years.index{|x| x[1]==current_planning_year_year}+1)..-1]\n end\n @builder_proxy.start_fy = current_planning_year_year\n else\n @has_sogr_project_org_list = CapitalProject.joins(:organization).where(organization_id: @organization_list).sogr.group(:organization_id).count\n end\n\n @message = \"Creating SOGR capital projects. This process might take a while.\"\n\n end", "def build opts = nil, &blk\n builder.build opts, &blk\n end", "def build!\n build_to self[:build_path]\n end", "def build(&block)\n instance_eval(&block)\n end", "def build(&block)\n if block\n @build = block\n else\n @build\n end\n end", "def build_xml(builder)\n super(builder)\n builder.ValidNetwork {|b| segment_config_network.build_xml(b) } if segment_config_network\n asset_on_segment_historys.each do |aosh|\n builder.AssetOnSegmentHistory {|b| aosh.build_xml(b)} if aosh\n end\n meas_locations.each do |m|\n builder.MeasurementLocation do |b|\n m.build_xml(b)\n end\n end\n end", "def build\n { 'Shipper' => PartyBuilder.build(@model.shipper, :shipper => true),\n 'ShipTo' => PartyBuilder.build(@model.recipient),\n 'PaymentInformation' => build_payment_info,\n 'Service' => build_service,\n 'Package' => PackageBuilder.build(@model.package),\n :order! => ['Shipper', 'ShipTo', 'PaymentInformation', 'Service', 'Package'] }\n end", "def build()\n\t`rm -rf recordings/`\n\t`mkdir recordings`\n\t`rm -rf chapters/`\n\t`mkdir chapters`\n\t`rm -rf outputList.txt`\n\t`touch outputList.txt`\nend", "def build_wrapper\n @impl\n end", "def initialize b\n @build = b\n end", "def build_tokens\n build_count\n build_index\n build_pairs\n self\n end", "def build_vars\n\n end", "def build_method\nend", "def build_method\nend", "def build(building)\n @building = building\n end", "def build(&block)\n # provide access to 'this' in configuration block\n self.instance_exec(&block)\n end", "def build_with(builder)\n case from = method_source\n when Parfait::CallableMethod\n callable = builder.load_object(from)\n when Parfait::CacheEntry\n callable = builder.load_object(from)[:cached_method].to_reg\n when Integer\n callable = builder.message[ \"arg#{from}\".to_sym ].to_reg\n else\n raise \"unknown source #{method_source.class}:#{method_source}\"\n end\n build_message_data(builder , callable)\n return builder.built\n end", "def build(&build)\n @context.instance_exec(&build)\n end", "def begin_build\n build_stack.push(true)\n end", "def build\n attributes = { contains: build_file_sets }\n attributes[:hasMemberOrders] = [{ viewingDirection: reading_order }] if reading_order\n\n cocina_dro.structural.new(attributes)\n end", "def build\n # a counter to use when creating auto-labels for resources, with incremenets for each type\n resource_type_counters = Hash.new(0)\n\n # rubocop:disable Metrics/BlockLength\n cocina_filesets = filesets.map.with_index(1) do |fileset, sequence|\n resource_type_counters[fileset.resource_type_description] += 1 # each resource type description gets its own incrementing counter\n # create a generic resource label if needed\n default_label = \"#{fileset.resource_type_description.capitalize} #{resource_type_counters[fileset.resource_type_description]}\"\n # but if one of the files has a label, use it instead\n resource_label = fileset.label_from_file(default: default_label)\n contained_files = fileset.files.map do |fileset_file| # iterate over all the files in a resource\n file_id = fileset_file.relative_path\n file_attributes = {\n type: 'https://cocina.sul.stanford.edu/models/file',\n externalIdentifier: \"https://cocina.sul.stanford.edu/file/#{SecureRandom.uuid}\",\n version:,\n label: file_id,\n filename: file_id,\n hasMessageDigests: message_digests(fileset_file),\n hasMimeType: fileset_file.mimetype,\n administrative: administrative(fileset_file),\n access: file_access\n }\n Cocina::Models::File.new(file_attributes)\n end\n\n fs_attributes = {\n label: resource_label,\n version:,\n externalIdentifier: \"#{external_identifier.delete_prefix('druid:')}_#{sequence}\",\n type: file_set_type(fileset.resource_type_description),\n structural: { contains: contained_files }\n }\n\n Cocina::Models::FileSet.new(fs_attributes)\n end\n # rubocop:enable Metrics/BlockLength\n\n attributes = { contains: cocina_filesets }\n attributes[:hasMemberOrders] = [{ viewingDirection: reading_order }] if reading_order\n\n cocina_dro.structural.new(attributes)\n end", "def build\n clean_build_directory\n copy_templates\n copy_functions\n copy_includes\n build_assets\n end", "def build\n @values.fetch('ai.application.build') { \n @values['ai.application.build'] = nil\n }\n end", "def build\n {'ShipTimestamp' => ship_timestamp,\n 'DropoffType' => DROPOFF_TYPES[@opts[:dropoff_type]],\n 'ServiceType' => SERVICE_TYPES[@opts[:service_type]],\n 'PackagingType' => PACKAGING_TYPES[@model.package.packaging_type],\n 'Shipper' => PartyBuilder.build(@model.shipper),\n 'Recipient' => PartyBuilder.build(@model.recipient),\n 'ShippingChargesPayment' => shipping_charges_payment,\n 'LabelSpecification' => label_specification,\n 'RateRequestTypes' => RATE_REQUEST_TYPE,\n 'PackageCount' => PACKAGE_COUNT,\n 'RequestedPackageLineItems' => PackageBuilder.build(@model.package),\n :order! => ['ShipTimestamp' , 'DropoffType' , 'ServiceType' , 'PackagingType',\n 'Shipper' , 'Recipient' , 'ShippingChargesPayment', 'LabelSpecification',\n 'RateRequestTypes', 'PackageCount' , 'RequestedPackageLineItems']\n }\n end", "def build\n [ Sox::SOX_COMMAND,\n build_options(@options),\n build_input_files,\n build_file(@output_file),\n build_effects\n ].flatten.join(' ')\n end", "def build\n if @default_file\n internal_add_file(@default_file)\n end\n end", "def build\n reset\n visit(root, @root)\n end", "def build\n method_proxy(:build)\n\n true\n end", "def build\n raise \"Nodes must implement #build\"\n end", "def build_me\n # Download all softwares in parallel\n download\n build\n end", "def build()\n\t\t\treturn Alimento.new(@@nombre,@@proteinas,@@carbohidratos,@@lipidos,@@gei,@@terreno)\n\t\tend", "def initialize(build)\n @build = build\n @hash = {}\n @already_run = []\n end", "def build_all\n create_categories\n puts \"Built categories\"\n create_contacts\n puts \"Built contacts\"\n create_locations\n puts \"Built locations\"\n create_services\n puts \"Built services\"\n create_service_types\n puts \"Built service types\"\n create_comments\n puts \"Built comments\"\n create_costs\n puts \"Built costs\"\n create_service_locations\n puts \"Built service locations\"\n create_service_contacts\n puts \"Built service locations\" \n create_users\n puts \"Built users\" \n end", "def build builder\n builder.send tag, @attributes do |builder|\n objects.each do |object|\n object.build builder\n end\n end\n end", "def build\n site.process\n end", "def build\n \n puts \"[Cutlist.build] Building cutlist...\" if $cutlister_debug\n \n data = heading().to_s\n \n data += page_title().to_s\n \n # Show sheet goods section.\n if @options[\"show_sheets\"]\n \n if @parts.sheets != nil\n\n data += section_heading(\"Sheet Goods\").to_s\n data += rows(@parts.sheets).to_s\n data += section_footer(@parts.sheets).to_s\n \n end\n \n end\n \n # Show solid stock section.\n if @options[\"show_solids\"]\n \n if @parts.solids != nil\n \n data += section_heading(\"Solid Stock\").to_s\n data += rows(@parts.solids).to_s\n data += section_footer(@parts.solids).to_s\n \n end\n \n end\n \n # Show hardware section.\n if @options[\"show_hardware\"]\n \n if @parts.hardware != nil\n \n data += section_heading(\"Hardware\").to_s\n data += rows(@parts.hardware).to_s\n data += section_footer(@parts.hardware).to_s\n \n end\n \n end\n \n data += footer().to_s\n \n # Return the results.\n data\n \n end", "def build_xml(builder)\n super(builder)\n builder.ValidNetwork { |b| valid_network.build_xml(b) } if valid_network\n builder.Model { |b| model.build_xml(b) } if model\n builder.Manufacturer { |b| manufacturer.build_xml(b) } if manufacturer\n end", "def build\n klass = create_class(@class_name, @options)\n klass.new\n end", "def build\n @sim_data\n end", "def build\r\n self.ehtml, self.ecss, self.ejs = self.theme.page_layout.build_content() \r\n return self.ehtml, self.ecss, self.ejs\r\n end", "def build\n nodes << element_klass.new\n\n yield(nodes.last) if block_given?\n\n nodes.last\n end", "def build_gems; end", "def build #title, form_name, form_action, script='', append_body='')\n \n @disable = []\n \n xhtml = %Q{ \n <html> \n <head>\n <title>#{self.meta['title']}</title>\n }\n if self.meta['stylesheets']\n self.meta['stylesheets'].each { |css|\n xhtml += %Q{ <link type=\"text/css\" src=\"#{css}\" /> \\n }\n }\n end\n if self.meta['javascripts']\n self.meta['javascripts'].each { |js|\n xhtml += %Q{ <script langauge=\"javascript\" src=\"#{jc}\" /> \\n }\n }\n end\n #xhtml += %Q{\n # <style type=\"text/css\">\n # #{build_css(self.style)}\n # </style>\n #}\n xhtml += %Q{ </head> }\n xhtml += %Q{\n <body onload=\"javascript: loadScript();\">\n #{self.meta['prepend']}\n #{self.main.build}\n #{self.meta['append']}\n </body>\n </html>\n }\n return CGI::pretty(xhtml)\n #return PrettyXML.pretty(html, 2)\n end", "def incorporate\r\n Builder.new(self)\r\n end", "def build_merchant\n assign_wares\n # assign_merchant_image\n merchant_sayings\n end", "def build\n asdocs = scan(@src)\n\n if asdocs.empty?\n puts \"No .asdoc files found.\"\n else\n create_xml(asdocs)\n to_disk(xml)\n end\n end", "def build\n view\n self\n end", "def build(options = T.unsafe(nil)); end", "def build(document)\n build_simple_attributes(document)\n build_complex_attributes(document)\n end", "def build\n fail \"Please provide a value for key, currently: #{key}\" if key.nil?\n\n if in_key\n { in_key.to_sym => { key => data } }\n else\n process_data\n transform_to_hash\n end\n end", "def construct\n end", "def build_xml\n raise NotImplementedError, \"Override build_xml in subclass\"\n end", "def build\n type.size ||= current_size\n registry.register(type)\n end", "def build\n Automaton.new(@name, @dimensions, @type, @width, @rule)\n end", "def build()\n response = send_post_request(@xml_api_build_path, {:delay => '0sec'})\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def build(layer_name, data)\n Builder.new.run(self, data, layer_name)\n end", "def initialize(build)\n @build = build\n end", "def build \n configure_directories\n \n @spec['collision'] = 'destroy'\n \n \n jobs = []\n \n # Recon\n recon_options = {'rawdir' => @rawdir, 'epi_pattern' => /(Rest|Task)/i, }\n config_step_method(recon_options, 'recon') if @config['custom_methods']\n jobs << ReconJobGenerator.new(recon_options).build\n \n # Preproc\n preproc_options = {'scans' => jobs.first['scans']}\n config_step_method(preproc_options, 'preproc') if @config['custom_methods']\n jobs << PreprocJobGenerator.new(preproc_options).build\n \n # Stats\n stats_options = {\n 'scans' => jobs.first['scans'],\n 'conditions' => @config['conditions'],\n 'responses_dir' => @config['responses_dir'],\n 'subid' => @spec['subid']\n }\n config_step_method(stats_options, 'stats') if @config['custom_methods']\n jobs << StatsJobGenerator.new(stats_options).build\n \n @spec['jobs'] = jobs\n \n return @spec\n end", "def build(options = {})\n fail \"The #{self.class} driver does not support the build method!\"\n end", "def build_output(**config)\n raise NotImplementedError\n end", "def build(*args)\n # create the container they ask for with these args\n @container = @container_class.new *args\n # tack on the layout they wanted\n @container.layout = layout if layout\n\n # go through all the children, add them on and tack on the callbacks\n @children.each {|child|\n if @contents[child]\n # if this component answers the each call then go through all\n component = @contents[child]\n each_or_one(component) {|c| @container.add(c) }\n\n configure_interactions_for child, component\n end\n }\n\n # yield to the caller so that they can configure more before\n # we make it visible and pack it\n yield @container if block_given?\n\n # even though swing doesn't do this, we do\n @container.pack if @container.respond_to? :pack\n @container.visible = true if @container.respond_to? :visible\n\n # and now they can do whatever they want to the container\n @container\n end", "def build\n #super do |builder|\n # builder.tag!('TrackID', :ID => @track_id)\n #end\n super\n end", "def build_assets\n end", "def initialize(params)\n\t\tsuper\n\t\tbasename = requireParam(params, :name)\n\t\tmodpaths = requireParam(params, :modules)\n\t\t\n\t\tmodpaths.each {|path| addPrereq BuildEnv::src2build(System::mod2obj(path))}\n\t\taddTarget BuildEnv::src2build(System::mod2slib(basename))\n\t\t\t\n\t\t#symlink from the src tree to the build tree (even if our target is up-to-date, in case the symlink currently points to a file built with \n\t\t# different options, ie elsewhere in the build tree)\n\t\tSymlinkBuilder.new(:target => target(), :name => BuildEnv::build2src(target()))\n\t\t\n\t\t#flags for tasks that edit their own prereq lists before reinvoking themselves\n\t\t@cleanallRecurse = true #true before cleanall() is called from outside; false when it's called by itself\n\tend", "def build_script\n raise NotImplementedError\n end", "def build_work(w_hsh)\n title = Array(w_hsh[:title])\n creator = Array(w_hsh[:creator])\n rights = Array(w_hsh[:rights])\n desc = Array(w_hsh[:description])\n methodology = w_hsh[:methodology]\n subject = Array(w_hsh[:subject])\n contributor = Array(w_hsh[:contributor])\n date_created = Array(w_hsh[:date_created]) \n rtype = Array(w_hsh[:resource_type] || 'Dataset')\n\n gw = GenericWork.new( title: title, creator: creator, rights: rights,\n description: desc, resource_type: rtype,\n methodology: methodology, subject: subject,\n contributor: contributor, date_created: date_created ) \n paths_and_names = w_hsh[:files].zip w_hsh[:filenames]\n fsets = paths_and_names.map{|fp| build_file_set(fp[0], fp[1])}\n fsets.each{|fs| gw.ordered_members << fs}\n gw.apply_depositor_metadata(user_key)\n gw.owner=(user_key)\n gw.save!\n return gw\n end", "def build(dst_path)\n end", "def call\n begin\n build\n rescue => error\n raise ParseParamsError, error.message\n end\n end", "def build\n unpack_chars(Marshal.dump(@command))\n end", "def build\n set_action(:build)\n validate_account_type!\n new_account\n assign_params\n build_account_users\n set_affiliate\n set_created_by\n set_facility\n\n after_build\n account\n end", "def build\n raise ConfigurationError.new(\"Must specify working directory\") unless @working_dir\n raise ConfigurationError.new(\"Must specify which sources to wrap\") unless @parser\n\n Logger.info \"Beginning code generation\"\n\n @builder = Builders::ExtensionNode.new(@name, @node || @parser, @modules)\n @builder.add_includes @options[:includes]\n @builder.build\n @builder.sort\n\n Logger.info \"Code generation complete\"\n end", "def do_rule_builds\n @rule.execution_trigger_rules.build if @rule.execution_trigger_rules.size == 0\n @rule.actions.build if @rule.actions.size == 0\n @rule.criteria.build if @rule.criteria.size == 0\n end", "def make; end", "def build_gem; end", "def build_view \n \n return if skip_method(__method__)\n \n # build edit _form index new show\n \n ['_form','edit','new','index','show'].each do |file|\n \n \n template = File.read(template(\"rails/views/#{file}.html.erb\"))\n \n # need to use ERB for these templates\n text = ERB.new(template, nil, '-').result(binding)\n\n filename = \"#{file}.html.erb\"\n # #puts \"build Rails view\"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n # build the json views\n ['index','show'].each do |file|\n \n template = File.read(template(\"rails/views/#{file}.json.jbuilder\"))\n text = ERB.new(template, nil, '-').result(binding)\n \n filename = \"#{file}.json.jbuilder\"\n # #puts \"build Rails JSON view \"\n \n path = namespaced_path(\"app/views\",\"#{plural_table_name}/\"+filename)\n puts \"build Rails #{file} JSON view for #{model_name} in #{path}\"\n write_artifact(path,text)\n \n end\n \n end", "def build(attrs = {})\n choose_right_class(attrs).new(attrs)\n end" ]
[ "0.78997785", "0.78483844", "0.78483844", "0.7696243", "0.7609464", "0.7424413", "0.7407312", "0.7328072", "0.7122654", "0.70935875", "0.70397294", "0.6882323", "0.6811559", "0.66734093", "0.6671611", "0.6546134", "0.6546134", "0.6546134", "0.654368", "0.64612526", "0.64576936", "0.64452994", "0.63923705", "0.6364766", "0.63330764", "0.6250008", "0.62396866", "0.622745", "0.6064416", "0.60410005", "0.6022533", "0.6018128", "0.6008989", "0.59937125", "0.59929925", "0.5973797", "0.59492654", "0.5948663", "0.5948663", "0.5929407", "0.59209746", "0.5907896", "0.5905456", "0.5902867", "0.5873229", "0.5873135", "0.5859631", "0.5841547", "0.5827608", "0.58274686", "0.58264565", "0.5815016", "0.57953006", "0.5784655", "0.57838494", "0.57647943", "0.5758584", "0.5757987", "0.5753163", "0.57518214", "0.5748149", "0.5728647", "0.5711491", "0.5699538", "0.5697942", "0.56876796", "0.56850344", "0.5682382", "0.5669345", "0.56691873", "0.56691873", "0.5667901", "0.5658788", "0.5658161", "0.5657755", "0.5647928", "0.5633164", "0.56308687", "0.56237245", "0.5612938", "0.5611702", "0.56089175", "0.5608037", "0.5599145", "0.5590546", "0.5587741", "0.55811274", "0.55774856", "0.5572914", "0.5572308", "0.557059", "0.55668795", "0.55645853", "0.554696", "0.55454093", "0.55423707", "0.5532944", "0.5532105", "0.5525592", "0.5522408", "0.5520512" ]
0.0
-1
Mixes in test interface into the configurable module
def enable_test_interface extend Dry::Configurable::TestInterface end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_setup\r\n \r\n end", "def default_test\n end", "def default_test\n end", "def default_test; end", "def test_defaults\n end", "def default_test\r\n end", "def tests; end", "def tests; end", "def testing\n # ...\n end", "def test_frameworks; end", "def default_test\n end", "def default_test\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def test\n return\n # TODO\n # skips test framework, but we can probably just bastardize the options in the same way as with :skip_bundle\n # either make `test` build the actual directories etc., or use a script\n # either way, this method is stupid.\n end", "def my_tests\n end", "def before_test(test); end", "def before_test(test); end", "def tests\n config.tests(subject)\n end", "def setup_config\n # To be Extended\n end", "def test\n @commands_and_opts.push OPTIONAL_OPTS[:test]\n self\n end", "def default_testing_config\n CLAide::Plugins::Configuration.new('CLAideTesting',\n 'claidetest',\n 'https://github.com/cocoapods/claide-plugins/something.json',\n 'https://github.com/danger/danger-plugin-template')\nend", "def config(mod, *accessors); end", "def test_config\n PuppetServerExtensions.config\n end", "def configure; end", "def tests(controller_class); end", "def setup\n raise NotImplementedError\n end", "def integration_test()\n return [\"all\"]\n end", "def add_testing\n setup_rspec\n setup_rspec_generators\n setup_rails_helper\n setup_factories_file\nend", "def test_legacy\n # Set up legacy handlers\n setup_legacy_handling\n\n common_tests\n end", "def test_case; end", "def setup\n # override and do something appropriate\n end", "def setup\n #implement in subclass;\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def test\n @test_facade = test_facade\n end", "def self_test; end", "def self_test; end", "def setup\n # override this if needed\n end", "def configure!\n yield self\n setup\n end", "def test_it_loads_user_modules\n sm = StateMachine.new\n sm.include_module('TestModule')\n assert_equal(sm.test_method, 'Test String')\n end", "def test\n settings['TEST']\n end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup; end", "def setup\n @configure = Hatemile::Util::Configure.new\n end", "def test_configure\n Moodle.configure({\n :username => 'test_username',\n :password => 'test_password'\n })\n\n assert_equal 'test_username', Moodle.config[:username]\n assert_equal 'test_password', Moodle.config[:password]\n end", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def __dummy_test__\n end", "def spec; end", "def spec; end", "def configure_test_pack\n # Apply the required set of filters to the selected tests iteratively.\n @logger.debug('Applying test selection filters...')\n @test_filters.each_pair { |key, values| @test_names = @test_pack.filter_test_names(key, values, @test_names) }\n # Update the list of tests with implicit includes (due to dependencies).\n @logger.debug('Checking for dependencies...')\n implicit_includes = []\n @test_names.each { |test_name| implicit_includes << @test_pack.get_test_dependencies(test_name, true) }\n @test_names = [@test_names + implicit_includes].flatten.uniq\n # Validate if the list of selected tests are valid.\n validate_selected_tests\n # Configure the test pack with the new list of test names.\n super\n end", "def test_method\n end", "def default_test\n info \"self: #{self}\"\n end", "def test_config\n load_config\n assert(@config.key?('user'))\n assert(@config.key?('pass'))\n assert(@config.key?('port'))\n assert(@config.key?('uri'))\n assert(@config.key?('callback_host'))\n assert(@config.key?('autopwn_url'))\n end", "def test_entry\n raise 'Implement the method \"test_entry\" in your test class'\n end", "def make_test impl_mod, test_mod\n test_unit = <<-STRING\n module Test#{test_mod}\n include #{impl_mod}\n end\n class #{impl_mod}#{test_mod} < Test::Unit::TestCase\n include Test#{test_mod}\n end\n STRING\n eval test_unit\nend", "def tests=(_arg0); end", "def tests=(_arg0); end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def setup\n \n end", "def initialize_test\n self.multiruby_skip ||= []\n self.testlib ||= :minitest\n self.test_prelude ||= nil\n self.test_task = nil\n end", "def unit_test!\n Deimos.configure do |deimos_config|\n deimos_config.logger = Logger.new(STDOUT)\n deimos_config.consumers.reraise_errors = true\n deimos_config.kafka.seed_brokers ||= ['test_broker']\n deimos_config.schema.backend = Deimos.schema_backend_class.mock_backend\n deimos_config.producers.backend = :test\n end\n end", "def run_app_tests\n end", "def before_load(test_files); end", "def tests(options = {:activated => true, :rspec => false})\n @options[:tests] = options\n end", "def setup; end", "def should; super end", "def configure\n yield configurable\n self\n end", "def initialize(config)\n super\n # stupid, kinda, but wanted to test plugin-specific options\n @seed = config[\"seed\"].to_i # not even using it really\n @unit = \"randoms\"\n end", "def setup(options); end", "def setup(options); end", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def configure(settings = {})\n abstract_method\n end", "def test_entry\n raise \"Implement this method in your test class\"\n end", "def test\n self.test_session.test\n end", "def setup\n super\n @default_provider_id = register_default_provider\n @default_consumer_id = register_default_consumer\n\n # Define some dummy items\n @default_items = [\n { name: \"Item1\", price: 39.99, provider: @default_provider_id },\n { name: \"Item2\", price: 10, provider: @default_provider_id }\n ]\n\n # Check everything is empty\n assert_equal(0, get_registered_number(\"api/items\"),\n \"There are registered items at test setup\")\n\n assert_equal 0, count_orders, \"There are registered orders at test setup\"\n\n # TODO: Rename the files\n Item.db_filename = \"tests/test_files/test_items.json\"\n Order.db_filename = \"tests/test_files/test_orders.json\"\n end", "def test_case(target, &block)\n case target\n when Class\n $TEST_SUITE << Lemon::TestClass.new(:target=>target, &block)\n when Module\n $TEST_SUITE << Lemon::TestModule.new(:target=>target, &block)\n else\n if defined?(super)\n super(target, &block)\n else\n raise\n end\n end\n end", "def testing desc, &block\n cls = Class.new(self)\n \n cls.reset_tests!\n Object.const_set self.name + desc.to_s.split(/\\W+/).map { |s| s.capitalize }.join, cls\n cls.setup_chained = self.setup_chained\n cls.teardown_chained = self.teardown_chained\n cls.desc = self.desc + \" \" + desc\n cls.tests($1.constantize) if defined?(Rails) && \n self.name =~ /^(.*(Controller|Helper|Mailer))Test/ && \n self < ActiveSupport::TestCase\n cls.class_eval(&block)\n self.testcases << cls\n end", "def setup\r\n puts 'starting a new test: ' + self.name\r\n cfT1 = CustomField.new(\"testField\", \"kuku\")\r\n cfT2 = CustomField.new(\"tester\", \"new_tester\")\r\n @reportiumClient.testStart(self.name, TestContext.new(TestContext::TestContextBuilder\r\n\t .withCustomFields(cfT1, cfT2)\r\n .withTestExecutionTags('TagYW1', 'TagYW2', 'unittest')\r\n .build()))\r\n end" ]
[ "0.6991464", "0.66655016", "0.6605851", "0.65801233", "0.6562955", "0.6542284", "0.6536445", "0.6536445", "0.649413", "0.6437119", "0.6367477", "0.6367477", "0.6339698", "0.6339698", "0.63125294", "0.6263373", "0.6263373", "0.6234911", "0.6210463", "0.62079734", "0.61582726", "0.6121217", "0.61107284", "0.61007744", "0.60897225", "0.6083595", "0.6068907", "0.6067035", "0.6064836", "0.60338426", "0.6033651", "0.5955713", "0.5943025", "0.5943025", "0.5939523", "0.5933351", "0.5933351", "0.5928162", "0.5908246", "0.590482", "0.59039897", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5894369", "0.5891491", "0.5860716", "0.58523005", "0.5850557", "0.5849956", "0.5849956", "0.5849695", "0.58253413", "0.58132666", "0.5796907", "0.57959396", "0.5794148", "0.5782886", "0.5782886", "0.57650685", "0.57650685", "0.57650685", "0.57650685", "0.57650685", "0.57650685", "0.57650685", "0.57640815", "0.5760134", "0.5758577", "0.5752607", "0.5750023", "0.5748866", "0.5736649", "0.5735864", "0.57323664", "0.5729529", "0.5729529", "0.5723271", "0.572057", "0.5712232", "0.57117176", "0.57102317", "0.5705174", "0.5703522", "0.5696943" ]
0.7669683
0
to achieve the desired result. You should be able to run this file from your terminal with the command `ruby day_4/exercises/methods.rb` example: Write a method below that, when called will print your name
def print_name puts "Will Meighan" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name(name)\nputs \"Name: #{name}\"\nend", "def print_name\n p \"Alexander Mathieu\"\nend", "def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend", "def print_name\r\nputs \"Person called #{@name}\"\r\nend", "def print_name(name)\n puts name# YOUR CODE HERE\nend", "def print_name\n puts \"Bailey Diveley\"\nend", "def print_name(name)\n puts \"Hello #{name}.\"\nend", "def print_it(name)\n puts \"#{name}\"# YOUR CODE HERE\nend", "def print_name(name)\n # YOUR CODE HERE\n p name\nend", "def print_name(name)\n # YOUR CODE HERE\n p name\nend", "def print_name(name)\n puts (name) # YOUR CODE HERE\nend", "def print_name\n puts \"Person called #{@name}\" \n end", "def say_my_name(name) # created method called \"say_my_name\" that takes an\n # arguement called name. Arguements allow you to pass data into methods. Methods can accept multiple arguements which can simply be seperated by commas.\n\n puts name # prints name\n\nend", "def print_name(name)\n puts \"My name is #{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name\n p \"Chris\"\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()\n puts \"Sidarth Bagawandoss\"\nend", "def print_name(name)\n p \"#{name} is my name.\"\nend", "def print_name\n puts \"Person called #{@name}\"\n end", "def print_name(name)\n puts \"My name is #{name}.\"\nend", "def print_name(name)\n puts \"My name is #{name}.\"\nend", "def print_name\n p \"Jennica\"\nend", "def print_name\n puts \"Joshua Sherwood\"\nend", "def print_name(name)\n puts \"This is #{name}\"\nend", "def print_name\n p \"Elliott Stein\"\nend", "def print_name(name)\n p \"Name: #{name}\"\nend", "def print_name(name)\n puts \"my name is #{name}.\"\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name(name)\n puts name\nend", "def print_name()\n p \"Severus Snape\"\nend", "def print_name\n p \"Joshua Tukman\"\nend", "def say_name\n puts \"#{name}\"\n end", "def print_name\n puts \"Severus Snape\"\nend", "def print_name(name)\n puts \"Look there! It's #{name}!\"\nend", "def greeting(name)\n puts \"Good day \"+name.capitalize\nend", "def print_name(arg1)\n # YOUR CODE HERE\n puts \"arg1: #{arg1}\"\nend", "def introduction(name)\n puts \"Hi, my name is #{name}.\\n\"\nend", "def say_hello_personal(name)\n\tputs \"Hello \" + name\nend", "def print_name\n puts \"Person called #{@name}\"\n end", "def print_name(name)\n p \"Albus Dumbledore\"\nend", "def print_name(name)\n p \"Your name is #{name}\"\nend", "def greeting(name)\n \"Hello and welcome to Ruby methods \" + name + \"!\"\nend", "def print_name\n puts \"Name: #{@name}\"\n end", "def print_name(name)\n puts \"Albus Dumbledore\"\nend", "def helloPerson(name)\n puts \"hello #{name.capitalize}!\"\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", "def print_name\n p \"Severus Snape\"\nend", "def print_name\n p \"Severus Snape\"\nend" ]
[ "0.78771806", "0.7843837", "0.78232926", "0.7800404", "0.7784476", "0.7767753", "0.77617157", "0.7752038", "0.7751821", "0.7751821", "0.7747604", "0.7747398", "0.7746", "0.77340114", "0.77244216", "0.77244216", "0.77244216", "0.77132976", "0.77130747", "0.77130747", "0.77130747", "0.77130747", "0.77130747", "0.77122015", "0.7706029", "0.77002555", "0.76998943", "0.76998943", "0.76986384", "0.7692667", "0.768772", "0.76700413", "0.76656204", "0.7660915", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.7650787", "0.764445", "0.7635642", "0.76349324", "0.76276463", "0.76061374", "0.7555574", "0.75504464", "0.7544831", "0.7540772", "0.7529446", "0.75050294", "0.748757", "0.74807924", "0.7471641", "0.7471055", "0.7469953", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199", "0.7452199" ]
0.78658485
1
Write a method that takes an argument of your name and prints your name
def print_name(name) puts name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\n puts \"#{name}\"\nend", "def print_name(name)\nputs \"Name: #{name}\"\nend", "def print_name(name)\n puts \"Look there! It's #{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 p \"#{name}\"\nend", "def print_name(name)\n puts \"This is #{name}\"\nend", "def print_name(name)\n # YOUR CODE HERE\n p name\nend", "def print_name(name)\n # YOUR CODE HERE\n p name\nend", "def print_name(name)\n puts \"My name is #{name}\"\nend", "def print_name(name)\n puts \"My name is #{name}.\"\nend", "def print_name(name)\n puts \"My name is #{name}.\"\nend", "def print_name(name)\n puts (name) # YOUR CODE HERE\nend", "def print_name(name)\n puts \"my name is #{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 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 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 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 name# YOUR CODE HERE\nend", "def print_name(name)\n puts \"Hello #{name}.\"\nend", "def print_name(name)\n p \"Name: #{name}\"\nend", "def print_name(name)\n puts ('Rob')\nend", "def print_name(name)\n p \"#{name} is my name.\"\nend", "def print_name(arg1)\n puts \"#{arg1}\"\nend", "def print_name(name)\n puts \"Albus Dumbledore\"\nend", "def print_name(name)\n p \"Albus Dumbledore\"\nend", "def say_name(name)\n puts \"My name is #{name}\"\n end", "def print_it(name)\n puts \"#{name}\"# YOUR CODE HERE\nend", "def print_name(name)\n p \"Your name is #{name}\"\nend", "def print_name(arg1)\n # YOUR CODE HERE\n puts \"arg1: #{arg1}\"\nend", "def print_name\n puts \"Person called #{@name}\"\n end", "def print_name\n puts \"Person called #{@name}\" \n end", "def print_name(name)\n p \"My name is #{name}\"\nend", "def print_name\r\nputs \"Person called #{@name}\"\r\nend", "def print_name\n puts \"Person called #{@name}\"\n end", "def print_name(name)\n p \"Hello #{name}.\"# YOUR CODE HERE\nend", "def print_name\n puts \"Name: #{@name}\"\n end", "def print_name(name)\n p \"Get out of my house #{name}!\"\nend", "def print_name\n print \"Person called #{@name}\"\n end", "def say_name\n puts \"#{name}\"\n end", "def print_name\n puts ('Rob')\nend", "def print_name(name)\n p \"BILLY!!!!!\"# YOUR CODE HERE\nend", "def say_my_name(my_name)\n\t# the my_name variable now\n\t# corresponds to the argument\n\t# defined in the function\n\t# sometimes called 'parameter'\n\tputs my_name\nend", "def say_my_name(name) # created method called \"say_my_name\" that takes an\n # arguement called name. Arguements allow you to pass data into methods. Methods can accept multiple arguements which can simply be seperated by commas.\n\n puts name # prints name\n\nend", "def print_name\n puts \"Severus Snape\"\nend", "def print_name\n p \"Alexander Mathieu\"\nend", "def print_name()\n puts \"Sidarth Bagawandoss\"\nend", "def print_name\n puts \"Bailey Diveley\"\nend", "def prints_name(name=\"Anthony\")\n puts \"Hello #{name}, how are you?\"\nend", "def print_name\n puts \"Will Meighan\"\nend", "def print_name\n p \"Jennica\"\nend", "def say_name\n p name\n end", "def print_name\n p \"Chris\"\nend", "def print_name\n puts \"Joshua Sherwood\"\nend", "def print_name\n p \"Joshua Tukman\"\nend", "def say_name\n p \"#{name}\"\n end", "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.8934815", "0.8934815", "0.8934815", "0.8892572", "0.8863323", "0.8824366", "0.8824366", "0.8824366", "0.8824366", "0.8824366", "0.8823228", "0.8819393", "0.8819393", "0.8814572", "0.8813462", "0.8813462", "0.8811984", "0.87909883", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87722576", "0.87373006", "0.8733885", "0.87247986", "0.8682885", "0.85817385", "0.857414", "0.85398436", "0.8498192", "0.84831524", "0.8482182", "0.84743965", "0.84644634", "0.84493166", "0.8439205", "0.84387535", "0.8415724", "0.83692104", "0.8362606", "0.83485746", "0.83243716", "0.82930845", "0.8256989", "0.8216558", "0.81922907", "0.8190169", "0.81776863", "0.81700635", "0.8160675", "0.81473947", "0.8144666", "0.81420743", "0.8125485", "0.80897176", "0.807468", "0.80743647", "0.8050484", "0.80332994", "0.8023289", "0.8020888", "0.8019002", "0.8019002", "0.8019002", "0.8019002", "0.8019002", "0.8019002" ]
0.8997463
19
Write a method that takes in 2 numbers and prints their sum, then call that method.
def sum (a, b) puts a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_two_num(a, b)\n puts a + b\nend", "def calc_sum_two(first, second)\n\n puts \"the sum of #{first} and #{second} is #{first + second}\"\n\nend", "def print_sum(num1, num2)\n p num1 + num2\nend", "def add_two_numbers (x,y)\n puts x + y\nend", "def sum_two(num1, num2)\n p \"#{num1} + #{num2} = #{num1 + num2}\"\nend", "def sum(num1, num2)\n puts num1 + num2\nend", "def add_two_numbers( x, y )\n puts x + y\nend", "def add_two_numbers(x,y)\n puts x + y\nend", "def get_sum(num1, num2)\n puts num1 + num2\nend", "def sum_two_numbers(a, b)\n a + b\nend", "def sum_these_numbers(num1,num2)\n p num1 + num2\nend", "def sum_these_numbers (a, b)\n puts a + b\nend", "def sum_method(a, b)\n puts \"Adding #{a} + #{b}\"\n puts a + b\nend", "def total(num1, num2)\n puts num1 + num2\nend", "def numbers(num1, num2)\n puts \"#{num1} + #{num2}\"\n return num1 + num2\nend", "def sum_nums(num1, num2)\n puts num1 + num2\nend", "def sum_these_numbers(a, b)\n puts a + b\nend", "def sum2(n1, n2)\n puts n1+n2\nend", "def sum_these_numbers(a,b)\n puts a + b\nend", "def sum(num1, num2)\n puts \"Really? #{num1 + num2} foxes?!\"\nend", "def sum_numbers(num_1,num_2)\n puts \"The sum of #{num_1} and #{num_2} is #{num_1 + num_2}\"\nend", "def numbers(num1, num2)\n p num1 + num2\nend", "def numbers(a, b)\n puts \"First number is #{a}\"\n puts \"Second number is #{b}\"\n return a + b\nend", "def first_method(num_1, num_2)\n puts num_1 + num_2\nend", "def sum(number_A, number_B)\n p number_A + number_B\nend", "def two_sum(nums)\nend", "def sum(a, b)\n puts \"Sum total: #{a} + #{b} = #{10 + 20}\"\n\nend", "def two_numbers(one, two)\n p \"This is the sum of #{one} and #{two}\"\nend", "def find_sum(num1, num2)\n puts num1 + num2\nend", "def print_sum num1=0,num2=0\r\n\tputs num1 + num2\t\r\nend", "def sum(num1, num2)\n num1 * num2\nend", "def add_two(num1, num2)\n\tnumber = num1 + num2\n\tputs number\nend", "def addition_method(num1, num2)\n\tputs num1 + num2\nend", "def sum(num1, num2)\n return num1 + num2\nend", "def sum(a,b)\n p a + b\nend", "def sum(a, b)\n p a + b\nend", "def sum(a, b)\n p a + b\nend", "def sum_finder(num_1, num_2)\n p num_1 + num_2\nend", "def sum_two(x, y)\n x + y\nend", "def sum(x, y)\n puts x + y\nend", "def total(num1, num2)\n num1 + num2\nend", "def add(num_one,num_two)\n puts \"#{num_one} + #{num_two} = #{num_one + num_two}\"\nend", "def sum(x, y)\n puts \"The sum of #{x} + #{y} is:\"\n puts \"-> #{x+y}\"\nend", "def sum_these_numbers(num1, num2)\n num1 + num2\nend", "def add(num_1, num_2)\n puts num_1 + num_2\nend", "def sum(n1, n2)\n n1 + n2\nend", "def add_sum(a, b)\n puts \"ADDING #{a} + #{b}\"\n return a + b\nend", "def add(num_1, num_2)\n p num_1 + num_2\nend", "def numbers(a, b)\n p \"#{a} + #{b}\"\n return a + b\nend", "def numbers( num1 = 0, num2 = 0 )\n puts (num1 + num2)\nend", "def sum_it(num1, num2)\n return num1 + num2\nend", "def add_numbers(num1, num2)\n p num1 + num2\nend", "def sum x,y \n puts x+y \nend", "def sum_these_numbers(x,y)\n sum = x + y\n puts sum\nend", "def sum(a, b)\n puts \"The sum of #{a} + #{b} = \" + \"#{(a + b)}\"\n #return a + b not needed for this\nend", "def sum(number1, number2)\ntotal = number1 + number2 \nend", "def add_two num\n p num + 2\nend", "def add(a, b)\n puts \"SUM #{a} + #{b}\"\n return a + b\nend", "def maths2(firstNum, secondNum)\n total = firstNum + secondNum\n puts \"firstNum is #{firstNum}\"\n puts \"the secondnum is #{secondNum}\"\n puts \"and the total is #{total} \"\n puts firstNum\n puts secondNum\n puts total\n puts \"firstNum is firstNum\"\n puts \"the secondnum is secondNum\"\n puts \"and the total is total\"\nend", "def add(a, b)\n\t# a method that adds two numbers together\n\tputs \"ADDING #{a} + #{b}\"\n\treturn a + b\nend", "def add(number_1, number_2)\n p number_1 + number_2\nend", "def add(num1, num2)\n puts num1 + num2\nend", "def add_nums(num1,num2)\n p num1 + num2\nend", "def summator(x, y)\n p x + y\nend", "def my_math_method(num1, num2)\n sum = num1 + num2\n\tputs \"The sum of 2 + 2 is #{sum}\"\nend", "def addition num1,num2 #num1 and num2 are known as parameters\nputs num1 + num2 \nend", "def add(num_1, num_2)\n sum = num_1 + num_2\n puts sum\n return sum\nend", "def add(a,b)\n puts \"Adding these numbers #{a}, #{b}\"\n a + b\n end", "def sum a, b\n return a + b\nend", "def sum(a, b)\n return a + b\nend", "def sum(a, b)\n return a + b\nend", "def sum(a,b)\n a + b\nend", "def sum a, b\n a + b\nend", "def add_numbers(number1, number2)\n return sum\nend", "def sum(a, b)\n a + b\nend", "def sum(a, b)\n a + b\nend", "def sum (a, b)\n a + b\nend", "def add_twos(num1, num2)\n number = (num1 + num2)\n puts number\nend", "def main\n one = first_number\n two = second_number\n addit(one, two)\nend", "def sum(a,b)\n a + b \nend", "def add(x, y)\n puts \"The sum of x & y is: #{x} + #{y}\"\n return x + y\nend", "def add(x,y)\n total = x + y\n puts total\n calculate(total)\nend", "def add(a,b)\n puts \"Adding #{a} and #{b}:\"\n return a + b\nend", "def add_two_numbers(num1, num2)\n puts \"OK, I'm solving your math problem!\"\n # if return is not in method, the method\n # will return the last expression. here puts ...\n return num1 + num2\n\n # could be dropped for\n # num1 + num2 only, as that will be the last\n # operation the method runs.\nend", "def sum(x, y) # 2 arguments\n p \"The sum of #{x} and #{y} is #{x + y}\"\n # p math.sum(sum_numbers) # This will not work because the arguments are not in an array\nend", "def my_math_method(num1, num2)\n\tanswer = num1 + num2\n\tputs \"The sum of #{num1} and #{num2} is #{answer}.\"\nend", "def do_addition(number_1, number_2)\n\tfinal_number = number_1 + number_2\n\tputs \"Your first number, #{$first_number}, plus your second number, #{$second_number}, equals #{final_number}.\"\nend", "def add_num(a, b)\n puts a + b\nend", "def addition(a,b)\n puts a + b\nend", "def add(a, b)\n puts \"adding #{a} and #{b}:\"\n return a + b\nend", "def sum num1, num2\n\ttotal = num1 + num2\n\treturn total\nend", "def add(num1,num2)\n\tputs \"num1 has the value : #{ num1 }\"\n\tputs \"num2 has the value : #{ num2 }\"\n\tresults = num1 + num2\n\tputs \"results is then: #{ results}\"\nend", "def addition(a, b)\n puts a + b\nend", "def add(a, b)\n puts \"addng #{a} + #{b}\"\n return a + b\nend", "def add(num_1, num_2)\n num_1+num_2\nend", "def add (first_number , second_number)\n return first_number + second_number\nend", "def add(a, b)\n puts \"Add #{a} + #{b}\"\n return a + b\nend", "def add(n1,n2)\n\tn1+n2\nend", "def add( first_number, second_number )\n return first_number + second_number\nend", "def add(even, odd)\n puts even + odd\nend" ]
[ "0.8268361", "0.8160775", "0.8110773", "0.8090702", "0.8087931", "0.80878836", "0.8078098", "0.8064081", "0.8061318", "0.80469036", "0.803684", "0.8035132", "0.80345863", "0.80234927", "0.80145836", "0.8010853", "0.8001085", "0.7996767", "0.7977314", "0.79598856", "0.79591864", "0.79039127", "0.78795516", "0.78428495", "0.78178924", "0.7776002", "0.7762216", "0.77162814", "0.76999384", "0.7680262", "0.7678431", "0.7673808", "0.76698685", "0.7645517", "0.76375264", "0.7631142", "0.7631142", "0.7630963", "0.7616343", "0.7614945", "0.75951123", "0.7578918", "0.7571216", "0.75666755", "0.7566191", "0.7556518", "0.7532303", "0.753157", "0.75295544", "0.75261074", "0.75226945", "0.7519508", "0.7516515", "0.75158846", "0.751371", "0.7511229", "0.7507678", "0.75058734", "0.75037974", "0.74953866", "0.74877274", "0.74805576", "0.746393", "0.74578124", "0.7453279", "0.744362", "0.74304366", "0.7424515", "0.7402276", "0.7393927", "0.7393927", "0.7390867", "0.738968", "0.738677", "0.7383308", "0.7383308", "0.73746836", "0.7351965", "0.73488593", "0.7346396", "0.73405796", "0.73394126", "0.7332064", "0.7330434", "0.7327217", "0.7326166", "0.73234576", "0.7296418", "0.72795355", "0.7276211", "0.7275008", "0.72727716", "0.72694063", "0.7269208", "0.725385", "0.7250252", "0.72480905", "0.72351456", "0.7234264", "0.72341937" ]
0.78279155
24
Write a method that takes in two strings and prints a concatenation of those two strings, for example the arguments could be (man, woman) and the end result might be "When Harry Met Sally". Then, call that method.
def love(man, woman) puts "#{man} met #{woman} at karaoke night. The rest is history." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_concat(name_1, name_2)\n puts \"I went to the concert with \" +name_1 + \" and \" + name_2 + \".\"\nend", "def two_strings(man, woman)\n p \"When \" + man + \" Met \" + woman\nend", "def concatenation(word1, word2)\n puts \"Artist #{word1} just released their newest album, titled #{word2}.\"\nend", "def concatenation (blow_dryer_setting, male_first_name)\n puts \"but my friends call me #{blow_dryer_setting} #{male_first_name}\"\nend", "def two_strings(string_1, string_2)\n p \"When \" + string_1 + \" met \" + string_2 + \".\"\nend", "def concatenator(string1, string2)\n \"#{string1} #{string2}\"\nend", "def dog_names(name_1, name_2)\n puts \"The dogs are named #{name_1} and #{name_2}.\"\n puts \"It was hard to give up #{name_1} but we got #{name_2} right after.\"\n puts \"#{name_1} was a little crazy and #{name_2} is quite mature.\"\n puts \"We're not suppose to pick favoriets but I'd pick #{name_2} over #{name_1}.\"\n puts \"\" # Added this to create a space in between the different arguments.\n end", "def string_conc(dog, cat)\n p \"#{dog} #{cat} around the house.\"\nend", "def combine_name(first_name, last_name)\n # Q3 CODE HERE\n return \"#{first_name} #{last_name}\"\nend", "def concatentation_method(lover1, lover2)\n puts \"#{lover1} loves #{lover2}\"\nend", "def car(s1, s2)\n puts \"#{s1} #{s2}\"\nend", "def string_add(string1, string2)\n puts \"#{string1} #{string2}\"\nend", "def example(first_name, last_name)\n full_name = first_name + ' ' + last_name\n \"#{first_name} #{last_name}\"\nend", "def concat(name_1, name_2)\n puts \"Name 1: #{name_1} Name 2: #{name_2}\"\nend", "def car(str_1, str_2)\n \"#{str_1} #{str_2}\"\nend", "def names(arg1, arg2)\n puts \"man: #{arg1}, woman: #{arg2}\"\n puts \"when #{arg1} met #{arg2}\"\n puts \"#{arg1} is much funnier than #{arg2}\"\nend", "def concat(human, dog)\n p \"When #{human} walks #{dog}, there is never a dull moment.\"\nend", "def join_strings(parameter1, parameter2)\r\n\treturn parameter1 + \" \" + parameter2\r\nend", "def join_strings(first_string, second_string)\n\n joint_string = first_string + ' ' + second_string\n\n return(joint_string)\n\nend", "def concat_str(str1, str2)\n p str1 + str2\nend", "def say_hello name1=\"oscar\", name2=\"shane\"\n\t\"hello, #{name1} and #{name2}\"\nend", "def full_name(first_name, last_name)\n puts \"Your full name is #{first_name + \" \" + last_name}.\"\nend", "def greet name, name2\n puts \"Hello, #{name} and #{name2} how are you all doing today?\"\nend", "def concat(school, person, program)\n return person + \" wants to go to \" + school + \" for \" + program + \".\"\nend", "def sayHello( name=\"Stranger\", adjective=\"stinky\" )\n puts \"Hello #{ adjective } #{ name }\"\n \"hotdogs hotdogs hotdogs\"\nend", "def things(thing1, thing2)\n puts \"Hey can you get me #{thing1} and #{thing2}. Cool thanks\"\nend", "def movie_title(friend_name, other_friend_name)\n puts \"#{friend_name} + #{other_friend_name}'s Excellent Adventure.\"\n return friend_name + other_friend_name\nend", "def join_strings(a, b)\n a + \" \" + b\nend", "def say_hello name1=\"Oscar\", name2=\"Shane\"\n \"hello, #{name1} and #{name2}\"\nend", "def string_argument(drink1, drink2)\n p \"My favorite drink is #{drink1}, but I really like #{drink2} too\"\nend", "def join_strings(text_1, text_2)\n text_1 + \" \" + text_2\nend", "def names(name1, name2)\n puts \"Huge announcement today! #{name1} climbed #{name2}! Congratulations!\"\nend", "def join_strings(word_1, word_2)\n join_strings=\"#{word_1} #{word_2}\"\nend", "def complete_sentence(animal1, animal2)\n p \"The #{animal1} chased the #{animal2}\"\nend", "def say_hello name1, name2 #pass parameters just like any other language. If you have lots of parameters, use Parentheses for readability (keep the code clean)\n puts \"Hello, #{name1} and #{name2}\"\nend", "def join_strings(string_1, string_2)\n \"#{string_1} #{string_2}\"\nend", "def wedding(husband, wife)\n puts \"#{husband} and #{wife} are getting married this summer!\"\nend", "def hello(name)\n str1 = name\n str2 = \"Hello, \"\n str2.concat(str1)\nend", "def hello2 name2\n 'good day ' + name2\nend", "def strings(team1, team2)\n p \"I think the #{team1} are better than the #{team2}.\"\nend", "def car(first_name, second_name)\n puts \"#{first_name} #{second_name}\"\nend", "def beam_me_up(person1, person2)\n \"The away team consists of #{person1} and #{person2}.\"\nend", "def concatenate(strings)\n\nend", "def string(food, dessert)\n puts \"#{food.upcase} & #{dessert.upcase} is my restaurant\"\nend", "def together(string, string2, string3)\n return \"#{string} #{string2} #{string3}\" \nend", "def love(mom, dad)\n puts \"#{mom} #{dad}, The End.\"\nend", "def hello(name)\n \"Hello, \".concat(name)\nend", "def hello2 (name2)\n 'Hello ' + name2\nend", "def print(destination1, destinantion2)\n puts \"I am going to #{destination1} and #{destinantion2} this summer!\"\nend", "def can_join_two_strings(string_1, string_2)\n return \"#{string_1}#{string_2}\"\nend", "def string_me(char1,char2)\n puts \"I was a very nice day out #{x} could not believe the tales that #{y} told \"\nend", "def getFullName(arg1=\"Barton\", arg2=\"Joey\")\n \"#{arg1}, #{arg2}\"\nend", "def say_hello2(name1=\"oscar\", name2=\"shane\")\n puts \"hello, #{name1} and #{name2}\"\nend", "def hello2 name2\n 'Hello ' + name2\nend", "def hello2 name2\n 'Hello ' + name2\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n# Printing first argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n# Printing second argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n# Printing string\n puts \"Man that's enough for a party!\"\n# Printing string with newline character\n puts \"Get a blanket.\\n\"\n# Ending function\nend", "def pets_name(pet1, pet2)\n puts \"My pets name's are #{pet1} and #{pet2}.\"\nend", "def method1 arg1, arg2\n return \"#{arg1} #{arg2}\"\nend", "def full_name2 first_name, last_name\n first_name + \" \" + last_name\nend", "def thing(fave_one, fave_two, fave_three)\n \"I love that #{fave_two} too!\"\nend", "def full_name1(first, last)\n first + \" \" + last\nend", "def hello2 name2 \r\n 'Hello ' + name2 \r\nend", "def greet\n hello + \" \" + world # this format allows us to use puts on line 31\nend", "def join_strings(string_1, string_2)\n return string_1.to_s + \" \" + string_2.to_s\nend", "def car(string1, string2)\r\n string1 + string2 \r\n end", "def sayhi(name, age)\n puts (\"Hello\" + name + \", you are \" + age.to_s)\nend", "def introduction(name1, name2)\n puts \"Ladies and gentlemen, let me introduce you to Mr. \" + name1 + \" and Mrs. \" + name2 + \"!\"\nend", "def my_method2 argument1, argument2\n print argument1, \" \", argument2, \"\\n\" \n end", "def fullName\n # Print 'My name is Bruce Martha Thomas'\n puts firstName secondName lastName\n end", "def animal(pet1, pet2)\n puts \" The best pet is a #{pet1}, however it may also be a #{pet2}\"\nend", "def adstr(a, b)\n puts a + b\nend", "def full_name(first_name, last_name)\n p \"Your full name is #{first_name} #{last_name}.\"\nend", "def good_recipes(arg1, *rest)\n \"The deserts will be #{arg1} and #{rest.join(', ')}\" # the string has embedded two variables, the second variable 'rest' is defined by the 'join' method, which is basicly saying, join the rest of the strings with a comma and a space\nend", "def sayhi(name, age)\n puts (\"Hello \" + name + \", you are\" + age.to_s)\nend", "def marriage(name1,name2)\n p \"Do you #{name1} take #{name2} to be your lawfully wedded partner?\"\nend", "def say_hello3(name1=\"oscar\", name2=\"shane\")\n \"hello, #{name1} and #{name2}\"\nend", "def concatenate_words(w1, w2)\r\n raise ArgumentError.new(\"Only Strings allowed!\") if !w1.is_a? String or !w2.is_a? String\r\n w1 + ' ' + w2\r\nend", "def combine_names(first_name, last_name)\n first_name + \" \" + last_name\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n # Print string and the cheese_count argument using string interpolation\n puts \"You have #{cheese_count} cheeses!\"\n # Print string and the boxes_of_crackers argument using string interpolation\n puts \"You have #{boxes_of_crackers} boxes of crackers!\"\n # Print string\n puts \"Man that's enough for a party!\"\n # Print string with a line break at the end\n puts \"Get a blanket.\\n\"\n# End method\nend", "def print_two(thing, another_thing)\n\tputs \"thing 1: #{thing}, thing 2: #{another_thing}\"\nend", "def print_full_name(firstname, lastname)\n puts \"Hi \" + firstname.capitalize + \" \" + lastname.capitalize\nend", "def say_hello(name, city, state)\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\nend", "def concat(ga1, ga2)\n p \"#{ga1} makes a better ginger ale than #{ga2}\"\nend", "def say_hello(name, city, state)\r\n # Your Code Here\r\n \"Hello, #{name.join(\" \")}! Welcome to #{city}, #{state}!\"\r\nend", "def greetings(name, details)\n string_name = name.join(' ')\n \n puts \"Hello, #{string_name}! Nice to have a #{details[:title]} #{details[:occupation]} around.\"\nend", "def an_argument(*arguments)\n return \"You didn't give me any arguments.\" if arguments == []\n string = \"You gave me #{arguments.size} argument\"\n arguments.size == 1 ? string << \" and it is \" : string << \"s and they are \"\n if arguments.size > 1\n last = arguments.last\n arguments.pop\n end\n arguments.each {|argument| string << \"\\\"#{argument}\\\", \"}\n !last.nil? ? string.chop.chop<< \" and \\\"#{last}\\\".\" : string.chop.chop << \".\"\nend", "def concat_name(first_name, last_name)\n\treturn \"#{last_name}, #{first_name}\"\nend", "def join_string(string_1,string_2)\n joined_string = string_1 + string_2\n return joined_string\nend", "def do_something this,that,other\n puts \"We,I mean I ,am doing,er ,something!\"\nend", "def greet(person_1=\"default\", person_2)\n p person_1 + \" and \" + person_2\nend", "def say_hello(name, city, state)\n \"Hello, %s! Welcome to %s, %s!\" % [name.join(\" \"), city, state]\nend", "def print_two_agian(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "def greetings(names, info)\n \"Hello, #{names.join(' ')}! Nice to have a \" +\n \"#{info[:title]} #{info[:occupation]} around.\"\nend", "def say_hello_3 name1=\"Bill\", name2=\"Ted\"\n \"hello, #{name1} and #{name2}\"\nend", "def greetings(name, info)\n full_name = name.join(' ')\n puts \"Hello, #{full_name}! Nice to have a #{info[:title]} #{info[:occupation]} around.\"\nend", "def hello1(name)\n 'halo ' + name\nend", "def combine_names(first, last)\n first + ' ' + last\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 concat(str1, str2)\n str1 + str2\nend", "def print_two(mice1, mice2)\n puts \"mice1: #{mice1}, mice2: #{mice2}\"\n\nend" ]
[ "0.80018526", "0.7917969", "0.78921556", "0.75238246", "0.73974824", "0.73771477", "0.731658", "0.71835446", "0.71426123", "0.7141337", "0.71217495", "0.71159023", "0.7114538", "0.7113363", "0.7064323", "0.70562935", "0.70531356", "0.7050587", "0.7042087", "0.6990352", "0.6984698", "0.69836444", "0.69830376", "0.6975976", "0.6943302", "0.6932519", "0.6923437", "0.6913711", "0.6893488", "0.68908006", "0.68902797", "0.6885024", "0.68833387", "0.6880806", "0.6870351", "0.68660355", "0.6840857", "0.6832503", "0.68306214", "0.6817968", "0.6806941", "0.6789811", "0.67465705", "0.6736636", "0.6732328", "0.67306566", "0.67119867", "0.66960216", "0.6674327", "0.6670139", "0.6665232", "0.66626596", "0.66599804", "0.66497713", "0.66482466", "0.6633548", "0.6629353", "0.6617539", "0.66017354", "0.6589309", "0.65869117", "0.6579942", "0.6572871", "0.65709895", "0.65695506", "0.6549111", "0.6540387", "0.6537114", "0.6527089", "0.6522237", "0.6515989", "0.6511537", "0.6509295", "0.65085155", "0.6504498", "0.6496682", "0.6487773", "0.6484605", "0.6484433", "0.64754575", "0.646744", "0.64597726", "0.64460325", "0.6444251", "0.64376676", "0.6437521", "0.6432701", "0.6428443", "0.64241964", "0.6418442", "0.641689", "0.6408868", "0.6406939", "0.64066374", "0.64061433", "0.6403292", "0.6403287", "0.6395186", "0.6394731", "0.63929844" ]
0.6641795
55
GET /tcpdump_logs GET /tcpdump_logs.json
def index @tcpdump_logs = TcpdumpLog.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def index\n @server_monitor_logs = ServerMonitorLog.fetch_log(params) \n end", "def retrieve_logs_for_download\n parse_files_for_download\n\n output = ''\n jsons.reverse_each do |elem|\n output.insert(0, insert_log_line_for_download(elem))\n end\n\n output\n end", "def index\n @logs = Log\n .order(start_time: :desc)\n .limit(100)\n .offset(params[:offset])\n\n render json: @logs\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_log }\n end\n end", "def create\n @tcpdump_log = TcpdumpLog.new(tcpdump_log_params)\n\n respond_to do |format|\n if @tcpdump_log.save\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully created.' }\n format.json { render :show, status: :created, location: @tcpdump_log }\n else\n format.html { render :new }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_copy_jobs_logs(bookmark = '', page_size = 0, source_org_unit_id = 0,\n destination_org_unit_id = 0, start_date = '', end_date = '')\n # GET /d2l/api/le/(version)/ccb/logs\nend", "def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end", "def set_tcpdump_log\n @tcpdump_log = TcpdumpLog.find(params[:id])\n end", "def show\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logstash }\n end\n end", "def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend", "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def show\n render json: @log\n end", "def read_logs_all()\n logs = Log.find(:all, :order => 'created_at asc')\n end", "def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n @logs = @unit.logs.limit(15).order(:created_at)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def log( *files, **options )\n\t\toptions[:graph] = false\n\n\t\tentries = self.server.run_with_json_template( :log, *files, **options )\n\n\t\treturn entries.map {|entry| Hglib::Repo::LogEntry.new(entry) }\n\tend", "def show\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outgoing_message_log }\n end\n end", "def index\n @ncr_api_logs = NcrApiLog.all\n end", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def logs\n\n end", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @ethernet_logs = EthernetLog.all\n end", "def read_logs_all()\n #logs = Log.find(:all, :order => 'created_at asc')\n logs = Log.all.order('created_at asc')\n end", "def index\n @web_service_logs = WebServiceLog.limit(20).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @web_service_logs }\n end\n end", "def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end", "def index\n @logs = Log.all\n end", "def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end", "def logs\n end", "def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end", "def show_kannel_log\n @header = 'Kannel Log'\n @lines = `tail -200 log/kannel.log`\n render(:template => \"admin/show_lines\")\n end", "def fetch_log_streams(client, log_group)\n logger.info(\"fetching log streams of group:#{log_group.log_group_name}\")\n streams = []\n log_streams = []\n next_token = nil\n\n begin\n options = { log_group_name: log_group.log_group_name, next_token: next_token }\n resp = client.describe_log_streams(options)\n log_streams += resp.log_streams\n next_token = resp.next_token\n end while next_token\n\n cloudwatch_stream_template = File.read(@template_config.cloudwatch_stream_template)\n log_streams.each do |log_stream|\n stream_template_date = ERB.new(cloudwatch_stream_template).result(binding)\n streams << @template_config.process_template_data(stream_template_date)\n end\n streams\n end", "def show\n @deployment_log = DeploymentLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment_log }\n end\n end", "def show\n @log = @client.logs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def index\n\t\t\t@logs = AppTracker::Log.order('created_at DESC').paginate(:page => params[:page], :per_page => 50)\n\t\tend", "def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end", "def new\n @logstash = Logstash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logstash }\n end\n end", "def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end", "def fetch_flow_logs(ec2_client, vpc_id)\n logger.info(\"fetching flow logs of vpc:#{vpc_id}\")\n next_token = nil\n flow_logs = []\n\n begin\n options = { next_token: nil, max_results: 50, filter: [{ name: 'resource-id', values: [vpc_id] }] }\n resp = ec2_client.describe_flow_logs(options)\n next_token = resp.next_token\n flow_logs += resp.flow_logs\n end while next_token\n flow_logs\n end", "def index\n myarray = Log.all\n @logs = Kaminari.paginate_array(myarray).page(params[:page])\n \n \n readlogs = ::ReadLogs.new\n @filesize = readlogs.size('development.log')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def index\n @interaction_logs = InteractionLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interaction_logs }\n end\n end", "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def show\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_service_log }\n end\n end", "def get_xssrays_logs\n # validate nonce\n nonce = @params['nonce'] || nil\n (print_error \"nonce is nil\";return @body = {'success' => 'false'}.to_json) if nonce.nil?\n (print_error \"nonce incorrect\";return @body = {'success' => 'false'}.to_json) if @session.get_nonce != nonce\n\n # validate that the hooked browser's session has been sent\n zombie_session = @params['zombie_session'] || nil\n (print_error \"Zombie session is nil\";return @body = {'success' => 'false'}.to_json) if zombie_session.nil?\n\n # validate that the hooked browser exists in the db\n zombie = Z.first(:session => zombie_session) || nil\n (print_error \"Invalid hooked browser session\";return @body = {'success' => 'false'}.to_json) if zombie.nil?\n\n logs = []\n BeEF::Core::Models::Xssraysdetail.all(:hooked_browser_id => zombie.id).each{|log|\n logs << {\n 'id' => log.id,\n 'vector_method' => log.vector_method,\n 'vector_name' => log.vector_name,\n 'vector_poc' => log.vector_poc\n }\n }\n\n @body = {'success' => 'true', 'logs' => logs}.to_json\n end", "def index\n @vlogs = Vlog.all\n end", "def find_logfiles\n require 'json'\n filepaths = Dir['**/*.log']\n File.write('C:/logfiles',JSON.pretty_generate(filepaths))\nend", "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def index\n @calllogs = Calllog.all\n end", "def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dlog }\n end\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def logs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.logs_get ...'\n end\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'min_date'] = opts[:'min_date'] if !opts[:'min_date'].nil?\n query_params[:'max_date'] = opts[:'max_date'] if !opts[:'max_date'].nil?\n query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?\n query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?\n query_params[:'id_user'] = opts[:'id_user'] if !opts[:'id_user'].nil?\n query_params[:'id_connection'] = opts[:'id_connection'] if !opts[:'id_connection'].nil?\n query_params[:'id_connector'] = opts[:'id_connector'] if !opts[:'id_connector'].nil?\n query_params[:'charged'] = opts[:'charged'] if !opts[:'charged'].nil?\n query_params[:'id_source'] = opts[:'id_source'] if !opts[:'id_source'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#logs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def read_logs\n @@logs\n end", "def update\n respond_to do |format|\n if @tcpdump_log.update(tcpdump_log_params)\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcpdump_log }\n else\n format.html { render :edit }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def fetch_flow_logs(region)\n ec2_client = get_ec2_client(region)\n next_token = nil\n flow_logs = []\n\n loop do\n options = { next_token: nil, max_results: 50 }\n resp = ec2_client.describe_flow_logs(options)\n next_token = resp.next_token\n flow_logs += resp.flow_logs\n break unless next_token\n end\n flow_logs\n end", "def index\n @web_process_logs = WebProcessLog.all\n end", "def index\n @d_loggers = DLogger.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @d_loggers }\n end\n end", "def getTasklog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\ttasklogs_array = timeLogs_json[\"timelogs\"][\"tasklogs\"]\r\n\t\t\t\treturn jsonToTasklog(tasklogs_array[0])\r\n\t\t\tend", "def index\n @config_logs = ConfigLog.all\n end", "def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end", "def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend", "def index\n @data_logs = DataLog.all\n end", "def getTimeLogs(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\ttimeLogs_array = timeLogs_json[\"timelogs\"]\r\n\t\t\t\treturn jsonToTimelogList(timeLogs_array)\r\n\t\t\tend", "def index\n @devlogs = Devlog.all\n end", "def list_logs_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LogsAPI.list_logs ...'\n end\n # resource path\n local_var_path = '/api/v2/logs/events/search'\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(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'LogsListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth]\n\n new_options = opts.merge(\n :operation => :list_logs,\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 :api_version => \"V2\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: LogsAPI#list_logs\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def logs_for_download\n retrieve_logs_for_download\n end", "def index\n @redirect_logs = RedirectLog.all\n end", "def index\n @systemlogs = Systemlog.all\n end", "def index\n @entry_logs = EntryLog.all\n end", "def download_logs\n `mkdir -p tmp`\n `heroku logs -n 100000 > tmp/logs.txt`\nend", "def show\n @block_log = BlockLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @block_log }\n end\n end", "def fetch_log\n assert_privileges(\"fetch_log\")\n disable_client_cache\n send_data(fetch_local_log(\"evm\"), :filename => \"evm.log\")\n AuditEvent.success(:userid => session[:userid], :event => \"download_evm_log\", :message => \"EVM log downloaded\")\n end", "def logs_for(application)\n logs_at_url(get(\"/apps/#{application}/logs?logplex=true\", 2))\n end", "def gather_logs(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n uuid = HelperFunctions.get_random_alphanumeric()\n Djinn.log_info(\"Generated uuid #{uuid} for request to gather logs.\")\n\n Thread.new {\n # Begin by copying logs on all machines to this machine.\n local_log_dir = \"/tmp/#{uuid}\"\n remote_log_dir = \"/var/log/appscale\"\n FileUtils.mkdir_p(local_log_dir)\n @nodes.each { |node|\n this_nodes_logs = \"#{local_log_dir}/#{node.private_ip}\"\n FileUtils.mkdir_p(this_nodes_logs)\n Djinn.log_run(\"scp -r -i #{node.ssh_key} -o StrictHostkeyChecking=no \" +\n \"2>&1 root@#{node.private_ip}:#{remote_log_dir} #{this_nodes_logs}\")\n }\n\n # Next, tar.gz it up in the dashboard app so that users can download it.\n dashboard_log_location = \"/var/apps/appscaledashboard/app/static/download-logs/#{uuid}.tar.gz\"\n Djinn.log_info(\"Done gathering logs - placing logs at \" +\n dashboard_log_location)\n Djinn.log_run(\"tar -czf #{dashboard_log_location} #{local_log_dir}\")\n FileUtils.rm_rf(local_log_dir)\n }\n\n return uuid\n end", "def index\n @timelogs = Timelog.all\n end", "def flush_log_buffer()\n APPS_LOCK.synchronize {\n loop {\n break if @@logs_buffer.empty?\n encoded_logs = JSON.dump({\n 'service_name' => 'appcontroller',\n 'host' => my_node.public_ip,\n 'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/logs/upload\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_logs,\n {'Content-Type'=>'application/json'})\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the logs - just continue on.\n end\n }\n }\n end", "def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end", "def index\n @user_logs = UserLog.paginate(:page => params[:page], :per_page => 30).order('created_at desc')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_logs }\n end\n end", "def index\n @dump_lists = DumpList.all\n end", "def index\n# @time_logs = TimeLog.all\n @time_logs = TimeLog.paginate :page => params[:page], :per_page => 10, :order => 'site_id'\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @time_logs }\n end\n end", "def index\n @zabbix_servers = ZabbixServer.all\n\n respond_to do |format|\n format.json\n format.html\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_item }\n end\n end", "def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end", "def stats\n JSON.parse TCPSocket.new(@options[:stats_uri].host,@options[:stats_uri].port).read rescue {}\n end", "def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend", "def dump_log(request = nil, java = false)\n type_params = java ? '?type=java' : ''\n url = \"#{DUMP_LOG_ENDPOINT}#{type_params}\"\n request = request ? Request.new(symbolize_keys(request)) : {}\n\n logger.debug('Sending dump log request to mockserver')\n logger.debug(\"URL: #{url}. Payload: #{request.to_hash}\")\n\n response = @base[url].put(request.to_json)\n logger.debug(\"Got dump to log response: #{response.code}\")\n parse_string_to_json(response)\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_entry }\n end\n end", "def index\n @rjlogs = Rjlog.all\n end", "def getBuglog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tbuglogs_array = timeLogs_json[\"timelogs\"][\"buglogs\"]\r\n\t\t\t\treturn jsonToBuglog(buglogs_array[0])\r\n\t\t\tend" ]
[ "0.61444736", "0.5999891", "0.59523606", "0.5877743", "0.58684826", "0.5816977", "0.58129483", "0.5808105", "0.57251155", "0.56888396", "0.56809837", "0.56621057", "0.5640947", "0.55683887", "0.5550424", "0.55443877", "0.55137545", "0.55060226", "0.5446526", "0.54307395", "0.5409676", "0.5406593", "0.53693515", "0.53689545", "0.5343228", "0.5328556", "0.53234226", "0.5322242", "0.5316284", "0.53120077", "0.52963054", "0.52824736", "0.52803594", "0.5277086", "0.5251825", "0.5250775", "0.52473044", "0.52466387", "0.5244108", "0.5234022", "0.5232661", "0.5225474", "0.52225107", "0.5219868", "0.52094567", "0.5206102", "0.5201062", "0.5196632", "0.51962733", "0.5193734", "0.5191558", "0.51731527", "0.515832", "0.51579", "0.51578534", "0.51578534", "0.51574576", "0.51561916", "0.51534307", "0.51484", "0.51372975", "0.51362985", "0.51286143", "0.5123002", "0.5119121", "0.5104363", "0.509628", "0.50932306", "0.50911915", "0.5089933", "0.50887126", "0.5086038", "0.5077253", "0.5066065", "0.5058656", "0.50385875", "0.5036887", "0.5034439", "0.50333905", "0.5029552", "0.5028154", "0.5026093", "0.5016952", "0.50149935", "0.50137115", "0.50107217", "0.50102276", "0.4991729", "0.4991076", "0.49898797", "0.49893275", "0.4976351", "0.4976287", "0.4973301", "0.49352396", "0.49303767", "0.49290022", "0.492888", "0.49221557", "0.49209046" ]
0.73731434
0
GET /tcpdump_logs/1 GET /tcpdump_logs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tcpdump_logs = TcpdumpLog.all\n end", "def show\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n\n respond_to do |format|\n format.html { render :show, layout: false } # show.html.erb\n format.json { render json: @httping_log }\n end\n end", "def set_tcpdump_log\n @tcpdump_log = TcpdumpLog.find(params[:id])\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def show\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logstash }\n end\n end", "def create\n @tcpdump_log = TcpdumpLog.new(tcpdump_log_params)\n\n respond_to do |format|\n if @tcpdump_log.save\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully created.' }\n format.json { render :show, status: :created, location: @tcpdump_log }\n else\n format.html { render :new }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @server_monitor_logs = ServerMonitorLog.fetch_log(params) \n end", "def show\n respond_to do |f| \n f.json {\n render :json => { \n :activity_log => @activity_log,\n :snapshots => @activity_log.snapshots.order(\"id ASC\")\n }\n }\n end\n end", "def index\n @logs = Log\n .order(start_time: :desc)\n .limit(100)\n .offset(params[:offset])\n\n render json: @logs\n end", "def get_logs(opts = {})\n @transporter.read(:GET, '/1/logs', {}, opts)\n end", "def retrieve_logs_for_download\n parse_files_for_download\n\n output = ''\n jsons.reverse_each do |elem|\n output.insert(0, insert_log_line_for_download(elem))\n end\n\n output\n end", "def get_copy_jobs_logs(bookmark = '', page_size = 0, source_org_unit_id = 0,\n destination_org_unit_id = 0, start_date = '', end_date = '')\n # GET /d2l/api/le/(version)/ccb/logs\nend", "def show\n @unit = Unit.find(params[:id])\n @logs = @unit.logs.limit(15).order(:created_at)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def get_json_stats_from(ip, port)\n Net::HTTP.start(ip, port) {|http| http.get('/stats.json') }.body rescue \"{}\"\nend", "def call_rest_getlbvstats\n print \"get lb vserver stats\\n\"\n @uri.path = \"/nitro/v1/config/lbvserver/\"\n @request = Net::HTTP::Get.new(@uri)\n @request.basic_auth \"#{@username}\", \"#{@password}\"\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.lbvserver+json')\n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n\n if response.code == \"200\"\n result = JSON.parse(response.body)\n File.open(\"lbvserver-stats.json\", \"w\") do |file|\n file.write(JSON.pretty_generate(result))\n end\n end\n }\n\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def show\n render json: @log\n end", "def show\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outgoing_message_log }\n end\n end", "def show\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b_log }\n end\n end", "def show\n @deployment_log = DeploymentLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment_log }\n end\n end", "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def show\n @web_service_log = WebServiceLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_service_log }\n end\n end", "def new\n @logstash = Logstash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logstash }\n end\n end", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def index\n @deployment_logs = DeploymentLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @deployment_logs }\n end\n end", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @message_log }\n end\n end", "def show\n @log = @client.logs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @log }\n end\n end", "def show\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @time_log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def show\n @log = Log.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log }\n end\n end", "def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend", "def update\n respond_to do |format|\n if @tcpdump_log.update(tcpdump_log_params)\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcpdump_log }\n else\n format.html { render :edit }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @web_service_logs = WebServiceLog.limit(20).order(\"id desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @web_service_logs }\n end\n end", "def show\n @deployment = Deployment.find(params[:id])\n @log = Rails.cache.read(\"log_#{@deployment.id}\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deployment }\n end\n end", "def stats\n JSON.parse TCPSocket.new(@options[:stats_uri].host,@options[:stats_uri].port).read rescue {}\n end", "def show\n @dlog = Dlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dlog }\n end\n end", "def show\n @logtransfer = Logtransfer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @logtransfer }\n end\n end", "def show\n @block_log = BlockLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @block_log }\n end\n end", "def index\n @wr_logs = WrLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wr_logs }\n end\n end", "def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend", "def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end", "def index\n @interaction_logs = InteractionLog.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @interaction_logs }\n end\n end", "def logs_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConnectionsApi.logs_get ...'\n end\n # resource path\n local_var_path = '/logs'\n\n # query parameters\n query_params = {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'min_date'] = opts[:'min_date'] if !opts[:'min_date'].nil?\n query_params[:'max_date'] = opts[:'max_date'] if !opts[:'max_date'].nil?\n query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?\n query_params[:'period'] = opts[:'period'] if !opts[:'period'].nil?\n query_params[:'id_user'] = opts[:'id_user'] if !opts[:'id_user'].nil?\n query_params[:'id_connection'] = opts[:'id_connection'] if !opts[:'id_connection'].nil?\n query_params[:'id_connector'] = opts[:'id_connector'] if !opts[:'id_connector'].nil?\n query_params[:'charged'] = opts[:'charged'] if !opts[:'charged'].nil?\n query_params[:'id_source'] = opts[:'id_source'] if !opts[:'id_source'].nil?\n query_params[:'expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['api_key']\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 => 'InlineResponse20015')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ConnectionsApi#logs_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n myarray = Log.all\n @logs = Kaminari.paginate_array(myarray).page(params[:page])\n \n \n readlogs = ::ReadLogs.new\n @filesize = readlogs.size('development.log')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend", "def show_kannel_log\n @header = 'Kannel Log'\n @lines = `tail -200 log/kannel.log`\n render(:template => \"admin/show_lines\")\n end", "def index\n @logs = @goal.logs.order('log_date DESC')\n @log = Log.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logs }\n end\n end", "def list\n websites = @logs.records\n @view.show(websites)\n end", "def index\n @ethernet_logs = EthernetLog.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @log_item }\n end\n end", "def show\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heat_log }\n end\n end", "def show\n @log_entry = LogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @log_entry }\n end\n end", "def index\n @ncr_api_logs = NcrApiLog.all\n end", "def list(options={})\n Mailgun.submit(:get, log_url, options)\n end", "def read_logs_all()\n logs = Log.find(:all, :order => 'created_at asc')\n end", "def getTasklog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\ttasklogs_array = timeLogs_json[\"timelogs\"][\"tasklogs\"]\r\n\t\t\t\treturn jsonToTasklog(tasklogs_array[0])\r\n\t\t\tend", "def getBuglog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tbuglogs_array = timeLogs_json[\"timelogs\"][\"buglogs\"]\r\n\t\t\t\treturn jsonToBuglog(buglogs_array[0])\r\n\t\t\tend", "def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end", "def show\n @d_logger = DLogger.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @d_logger }\n end\n end", "def show\n @turn_log = TurnLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @turn_log }\n end\n end", "def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end", "def show\n @interaction_log = InteractionLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @interaction_log }\n end\n end", "def log_time_of_backup\n puts \"- Logging the time of this backup\"\n puts \"You can find this by extracting the document with the class type of LastRunDoc\"\n logger = {:class=>\"LastRunLog\",\n :logged_interval=>last_run,\n :ran_at=>Time.now}\n RestClient.post(\"#{@couch_db}\", logger.to_json )\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n @event_log_entry = EventLogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_log_entry }\n end\n end", "def logs\n ret = @uri.logs\n render plain: ret[:message], status: ret[:status]\n end", "def fetch_log_streams(client, log_group)\n logger.info(\"fetching log streams of group:#{log_group.log_group_name}\")\n streams = []\n log_streams = []\n next_token = nil\n\n begin\n options = { log_group_name: log_group.log_group_name, next_token: next_token }\n resp = client.describe_log_streams(options)\n log_streams += resp.log_streams\n next_token = resp.next_token\n end while next_token\n\n cloudwatch_stream_template = File.read(@template_config.cloudwatch_stream_template)\n log_streams.each do |log_stream|\n stream_template_date = ERB.new(cloudwatch_stream_template).result(binding)\n streams << @template_config.process_template_data(stream_template_date)\n end\n streams\n end", "def read_logs_all()\n #logs = Log.find(:all, :order => 'created_at asc')\n logs = Log.all.order('created_at asc')\n end", "def index\n @logs = Log.all\n end", "def getContract_log( contract_log_id)\n params = Hash.new\n params['contract_log_id'] = contract_log_id\n return doCurl(\"get\",\"/contract_log\",params)\n end", "def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end", "def index\n @daily_logs = current_user.daily_logs.order(\"updated_at DESC\")\n render json: @daily_logs, each_serializer: Rest::DailyLogSerializer\n end", "def index\n @zabbix_servers = ZabbixServer.all\n\n respond_to do |format|\n format.json\n format.html\n end\n end", "def fetch_flow_logs(ec2_client, vpc_id)\n logger.info(\"fetching flow logs of vpc:#{vpc_id}\")\n next_token = nil\n flow_logs = []\n\n begin\n options = { next_token: nil, max_results: 50, filter: [{ name: 'resource-id', values: [vpc_id] }] }\n resp = ec2_client.describe_flow_logs(options)\n next_token = resp.next_token\n flow_logs += resp.flow_logs\n end while next_token\n flow_logs\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def show\n @backlogentry = Backlogentry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backlogentry }\n end\n end", "def index\n @vlogs = Vlog.all\n end", "def index\n @calllogs = Calllog.all\n end", "def index\n\t\t\t@logs = AppTracker::Log.order('created_at DESC').paginate(:page => params[:page], :per_page => 50)\n\t\tend", "def show\n @applicationlog = Applicationlog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @applicationlog }\n end\n end", "def logs\n\n end", "def show\n @user_log = UserLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_log }\n end\n end", "def show\n @pvp_battle = PvpBattle.find(params[:id])\n @battle_logs = @pvp_battle.battle_logs\n end", "def show\n render json: @heartbeat\n end", "def index\n if (params[:redirect] == \"sql\")\n sql = <<-SQL\n WITH src AS (SELECT id, cow_no, date, state, owner_id FROM ai_logs\n WHERE owner_id = #{params[:search_owner]})\n SELECT json_agg(src) FROM src;\n SQL\n render json: ActiveRecord::Base.connection.select_value(sql)\n else\n @ai_logs = AiLog.all\n end\n end", "def log_history\n logger.info('[]' + request.method + \"\\t\" + request.fullpath + \"\\t\" + request.remote_ip + \"\\t\" + Time.now.strftime('%Y-%m-%d %H:%M:%S'))\n end", "def dump_log(request = nil, java = false)\n type_params = java ? '?type=java' : ''\n url = \"#{DUMP_LOG_ENDPOINT}#{type_params}\"\n request = request ? Request.new(symbolize_keys(request)) : {}\n\n logger.debug('Sending dump log request to mockserver')\n logger.debug(\"URL: #{url}. Payload: #{request.to_hash}\")\n\n response = @base[url].put(request.to_json)\n logger.debug(\"Got dump to log response: #{response.code}\")\n parse_string_to_json(response)\n end", "def index\n @web_process_logs = WebProcessLog.all\n end", "def show\n @steps_log = StepsLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @steps_log }\n end\n end", "def mlog_json(o)\n a = '1;7;48'\n fmt = \"\\033[1;34;4m%s:%d <%s>-:▼ %s\\n\\033[0m\"\n caller_infos = caller.first.split(\":\")\n print fmt % [caller_infos[0].split(\"/\")[-1].to_s, caller_infos[1], Time.new.strftime(\"%H:%M:%S\"), caller_infos[0].to_s]\n pp o\nend", "def show\n @work_log = WorkLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_log }\n end\n end", "def log( *files, **options )\n\t\toptions[:graph] = false\n\n\t\tentries = self.server.run_with_json_template( :log, *files, **options )\n\n\t\treturn entries.map {|entry| Hglib::Repo::LogEntry.new(entry) }\n\tend", "def index\n @dump_lists = DumpList.all\n end", "def show\n @backlog_entry = BacklogEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @backlog_entry }\n end\n end", "def request_timestamp(cli,request)\n\t\tprint_status(\"#{cli.peerhost} - #{current_time} - [HTTP GET] - #{request.uri}\")\n\tend", "def command_showAll\n entries = @log.get_entries()\n entries.each { |i|\n puts i.to_s\n }\n end", "def index\n @screenshots = Screenshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @screenshots }\n end\n end", "def index\n @d_loggers = DLogger.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @d_loggers }\n end\n end", "def show\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @heartbeat }\n end\n end" ]
[ "0.7060801", "0.58853596", "0.58558685", "0.58160603", "0.5812813", "0.57942075", "0.5740912", "0.57348025", "0.5674479", "0.56278396", "0.549321", "0.54276663", "0.5424898", "0.54209805", "0.5416899", "0.541523", "0.53882927", "0.53857595", "0.5374851", "0.5368773", "0.53449076", "0.53140104", "0.5309242", "0.529677", "0.5285721", "0.5283124", "0.52786285", "0.52746916", "0.5248275", "0.52408004", "0.52408004", "0.5221873", "0.51949155", "0.5185129", "0.5178221", "0.51782095", "0.51547384", "0.51507676", "0.5149291", "0.5145908", "0.51270497", "0.5113861", "0.50710815", "0.50671864", "0.5033985", "0.50294614", "0.50284857", "0.5022248", "0.50212026", "0.5019188", "0.49983674", "0.49922702", "0.4991308", "0.4983885", "0.4980065", "0.49796602", "0.49767622", "0.49724814", "0.4966171", "0.4958637", "0.49450386", "0.4929972", "0.4929835", "0.49280405", "0.4919271", "0.49106756", "0.490339", "0.4903267", "0.4893929", "0.4884107", "0.48810634", "0.4879647", "0.48777345", "0.48679906", "0.48633084", "0.48620564", "0.48620564", "0.48556203", "0.4847053", "0.48454392", "0.48406547", "0.48397878", "0.48382112", "0.48306498", "0.4826066", "0.48260152", "0.48176825", "0.4817003", "0.4805798", "0.47971827", "0.47916633", "0.4787826", "0.47806653", "0.4779551", "0.47794554", "0.47785446", "0.47775447", "0.47772157", "0.47759354", "0.47756857", "0.47749892" ]
0.0
-1
POST /tcpdump_logs POST /tcpdump_logs.json
def create @tcpdump_log = TcpdumpLog.new(tcpdump_log_params) respond_to do |format| if @tcpdump_log.save format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully created.' } format.json { render :show, status: :created, location: @tcpdump_log } else format.html { render :new } format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tcpdump_logs = TcpdumpLog.all\n end", "def tcpdump_log_params\n params.require(:tcpdump_log).permit(:user_id, :user_data)\n end", "def set_tcpdump_log\n @tcpdump_log = TcpdumpLog.find(params[:id])\n end", "def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end", "def send_cdn_logs\n authorize! :manage, CdnLog\n @log_data = JSON.load(params[:logdata])\n CdnLog.create(@log_data)\n respond_to do |format|\n format.json{ head :ok }\n end\n end", "def dump_log(request = nil, java = false)\n type_params = java ? '?type=java' : ''\n url = \"#{DUMP_LOG_ENDPOINT}#{type_params}\"\n request = request ? Request.new(symbolize_keys(request)) : {}\n\n logger.debug('Sending dump log request to mockserver')\n logger.debug(\"URL: #{url}. Payload: #{request.to_hash}\")\n\n response = @base[url].put(request.to_json)\n logger.debug(\"Got dump to log response: #{response.code}\")\n parse_string_to_json(response)\n end", "def flush_log_buffer()\n APPS_LOCK.synchronize {\n loop {\n break if @@logs_buffer.empty?\n encoded_logs = JSON.dump({\n 'service_name' => 'appcontroller',\n 'host' => my_node.public_ip,\n 'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/logs/upload\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_logs,\n {'Content-Type'=>'application/json'})\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the logs - just continue on.\n end\n }\n }\n end", "def update\n respond_to do |format|\n if @tcpdump_log.update(tcpdump_log_params)\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcpdump_log }\n else\n format.html { render :edit }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log(data)\n t = Thread.new do\n uri = URI(\"http://logs-01.loggly.com/inputs/.../tag/ost/\")\n req = Net::HTTP::Post.new(uri)\n req['content-type'] = \"content-type:application/x-www-form-urlencoded\"\n req.body = data.to_json\n res = Net::HTTP.start(uri.hostname, uri.port) {|http|\n http.request(req)\n }\n end\nend", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def post_create\n response = self.class.post(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end", "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def jsonlogger(status,certname,jsonuuid)\n tempHash = {\n \"status\" => status,\n \"certname\" => certname,\n \"uuid\" => jsonuuid\n }\n File.open(logfile,\"a\") do |f|\n f.puts(tempHash.to_json)\n end\nend", "def test_post_sample_traces\n header 'Content-Type', 'application/json'\n\n (0..4).each do |i|\n data = File.read \"sample-traces/#{i}.json\"\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n assert last_response.ok?\n end\n end", "def create\n @server_monitor_log = ServerMonitorLog.new(server_monitor_log_params)\n\n respond_to do |format|\n if @server_monitor_log.save\n format.html { redirect_to @server_monitor_log, notice: 'Server monitor log was successfully created.' }\n format.json { render :show, status: :created, location: @server_monitor_log }\n else\n format.html { render :new }\n format.json { render json: @server_monitor_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params[:logs].each { |message| Passbook::Log.create(message: message) }\n head :ok\n end", "def send_remote_syslog(headers)\n headers['version'] = RUBY_VERSION\n headers['apikit'] = @apikit\n sock = UDPSocket.new(Socket::AF_INET)\n message = JSON.generate headers\n sock.send '<22> ' + message, 0, @logger_host, @logger_port\n sock.close\n end", "def create\n # If the request body contains a single log (request body is not an array)\n if ( !JSON.parse(request.body.read).is_a?(Array) )\n log_data = JSON.parse(request.body.read)\n status, log = create_new_log(log_data)\n if (status)\n render json: log, status: :created\n else\n render json: log.errors, status: :unprocessable_entity\n end\n # If the request body contains multiple logs (request body is an array)\n else\n logs = []\n # Loop through all logs. Each array element is considered a single log\n JSON.parse(request.body.read).each do |log_data|\n status, log = create_new_log(log_data)\n if (!status)\n render render json: log.errors, status: :unprocessable_entity\n else\n logs.push(log)\n end\n end\n render json: logs, status: :created\n end\n \tend", "def create\n @ethernet_log = EthernetLog.new(ethernet_log_params)\n\n respond_to do |format|\n if @ethernet_log.save\n format.html { redirect_to @ethernet_log, notice: 'Ethernet log was successfully created.' }\n format.json { render :show, status: :created, location: @ethernet_log }\n else\n format.html { render :new }\n format.json { render json: @ethernet_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_init\n # Build a JSON representation\n r = {:source => \"#{@conn_obj.remote_db}\",\n :target => \"#{@conn_obj.our_db}\"}\n #, :continuous => true }\n r_json = r.to_json\n\n # Create the HTTP request\n req = \"POST /_replicate HTTP/1.1\\r\\n\"\n req += \"Content-Length: #{r_json.length}\\r\\n\\r\\n\"\n req += \"#{r_json}\"\n\n # Push it to the network\n send_data req\n end", "def log_request\n ServerRequestLog.create! default_log_hash\n end", "def create\n @log = Log.new\n @device = Device.find_by_macaddress(params[:macaddress])\n @ip_address = request.remote_ip\n @log_file = params[:log_file]\n @log.device = @device\n @log.ip_address = @ip_address\n @log.log_file = @log_file\n if @device.secret_key == params[:secret_key]\n respond_to do |format|\n if @log.save\n format.html { redirect_to index_logs_path(@device.id, :page => 1), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: index_logs_path(params[:device_id], :page =>1) }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_log_path, :notice => 'Invalied MAC Address or Secret key'\n end\n end", "def create\n @logstash = Logstash.new(params[:logstash])\n\n respond_to do |format|\n if @logstash.save\n format.html { redirect_to @logstash, notice: 'Logstash was successfully created.' }\n format.json { render json: @logstash, status: :created, location: @logstash }\n else\n format.html { render action: \"new\" }\n format.json { render json: @logstash.errors, status: :unprocessable_entity }\n end\n end\n end", "def process_ath9_crash(params)\n url = @@conf['register_url']\n crash_dump_path = @@conf['crash_dump_path']\n \tnodeid = params[:nodeid]\n \ttstmp = Time.at params[:tstmp].to_i\n \tdmesg = params[:dmesg]\n \tnow = Time.now.to_i\n\n \tFile.open(\"#{crash_dump_path}/#{now}.log\",\"w\") do |f|\n \t\tf.puts \"Node: #{nodeid} - at: #{tstmp}\\n\"\n \t\tf.puts dmesg\n \tend\n \tNet::HTTP.post_form URI(\"#{url}/watchdog_bites\"), \n \t\t{ \"node_id\" => nodeid, \"dmesg\" => dmesg, \"tstmp\" => params[:tstmp], 'submission_stmp' => now }\n end", "def logs\n\n end", "def create\n @log = Log.new(log_params)\n\n if @log.save\n render json: @log, status: :created, location: @log\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def write(event)\n ls_event= data2logstash_event(event)\n \n sync do\n logstash_device.write(ls_event.to_json+\"\\n\")\n logstash_device.flush\n end\n self\n end", "def webhook\n header = \"<h4>#{params[:verb]} #{params[:url]}</h4><p>Server: <b>#{params[:mode]}</b></p>\"\n query = if params[:params] then \"<p>Params: <pre>#{params[:params]}</pre></p>\" else \"\" end\n session = if params[:session] then \"<p>Session Attribute: <pre>#{params[:session]}</pre></p>\" else \"\" end\n exception = \"<p>Exception: <pre>#{params[:exception]}</pre></p>\"\n content = header + query + session + exception\n @project_logs = ProjectLog.create(project: @project, category: 'ERROR', content: content, date: Date.today)\n render nothing: true\n end", "def create\n @vlog = Vlog.new(vlog_params)\n\n respond_to do |format|\n if @vlog.save\n format.html { redirect_to @vlog, notice: 'Vlog was successfully created.' }\n format.json { render :show, status: :created, location: @vlog }\n else\n format.html { render :new }\n format.json { render json: @vlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def write(chunk)\n body = ''\n chunk.msgpack_each {|(tag,time,record)|\n\n # define index and sourcetype dynamically\n begin\n index = expand_param(@index, tag, time, record)\n sourcetype = expand_param(@sourcetype, tag, time, record)\n event_host = expand_param(@event_host, tag, time, record)\n token = expand_param(@token, tag, time, record)\n rescue => e\n # handle dynamic parameters misconfigurations\n router.emit_error_event(tag, time, record, e)\n next\n end\n log.debug \"routing event from #{event_host} to #{index} index\"\n log.debug \"expanded token #{token}\"\n\n # Parse record to Splunk event format\n case record\n when Integer\n event = record.to_s\n when Hash\n if @send_event_as_json\n event = Yajl::Encoder.encode(record)\n else\n event = Yajl::Encoder.encode(record).gsub(\"\\\"\", %q(\\\\\\\"))\n end\n else\n event = record\n end\n\n sourcetype = @sourcetype == 'tag' ? tag : @sourcetype\n\n # Build body for the POST request\n if !@usejson\n event = record[\"time\"]+ \" \" + Yajl::Encoder.encode(record[\"message\"]).gsub(/^\"|\"$/,\"\")\n body << '{\"time\":\"'+ DateTime.parse(record[\"time\"]).strftime(\"%Q\") +'\", \"event\":\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + @source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n elsif @send_event_as_json\n body << '{\"time\" :' + time.to_s + ', \"event\" :' + event + ', \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n else\n body << '{\"time\" :' + time.to_s + ', \"event\" :\"' + event + '\", \"sourcetype\" :\"' + sourcetype + '\", \"source\" :\"' + source + '\", \"index\" :\"' + index + '\", \"host\" : \"' + event_host + '\"}'\n end\n\n if @send_batched_events\n body << \"\\n\"\n else\n send_to_splunk(body, token)\n body = ''\n end\n }\n\n if @send_batched_events\n send_to_splunk(body, token)\n end\n end", "def log(service, level, summary, details: nil, host: nil, payload: {}, valid_for_secs: nil)\n service ||= @service\n if not service\n raise 'log: service must be passed, or set previously with set_service'\n end\n host ||= get_hostname\n post_body = {\n 'service' => service,\n 'datetime' => get_datetime(),\n 'host' => host,\n 'level' => level,\n 'summary' => summary,\n 'details' => details,\n 'payload' => payload,\n 'valid_for_secs' => valid_for_secs\n }\n \n url = \"https://#{@server_hostname}/api/log\"\n\n uri = URI.parse(url)\n http = Net::HTTP.new(uri.host, uri.port)\n vlog(0, \"url is #{url} host #{uri.host} port #{uri.port}\")\n http.use_ssl = true\n http.read_timeout = 20\n\n request = Net::HTTP::Post.new(url)\n request.content_type = \"application/json\" \n request.body = post_body.to_json\n\n vlog(0, \"request.body #{request.body}\")\n\n begin\n response = http.request(request)\n\n if response.code != '200'\n $stderr.puts \"POST to #{url} failed with status code #{response.code} and response #{response.body}\"\n return\n end\n rescue StandardError => error\n $stderr.puts \"POST to #{url} failed: #{error}\"\n end\n end", "def add_applogs(options={})\n self.class.post(\"#{applogs_endpoint}/applogs.json?apikey=#{apikey}\", :body => MultiJson.encode({applog: options}))\n end", "def log_connect(stream_obj)\n puts \"STREAM: connect for #{stream_obj.request_path} from #{request.ip}\" if VERBOSE\n # REDIS.PUBLISH 'stream.admin.connect', stream_obj.to_json\nend", "def post_as_json(data)\n uri = URI.parse(LISTENER)\n http = Net::HTTP.new(uri.host, uri.port)\n http.read_timeout = 0.5\n begin\n request = Net::HTTP::Post.new(uri.request_uri, {'Content-Type' => 'application/json'})\n request.body = data.to_json\n http.request(request){|res| puts \"Post status: #{res.body}\" }\n rescue StandardError => e\n puts \"Failed sending data: #{e.message}\"\n end\nend", "def create\n @dump_list = DumpList.new(dump_list_params)\n\n respond_to do |format|\n if @dump_list.save\n flash[:success] = 'Dump list was successfully created.'\n format.html { redirect_to @dump_list }\n format.json { render :show, status: :created, location: @dump_list }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :new }\n format.json { render json: @dump_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n case raw_json\n when Array then handle_many_logs\n when Hash then handle_single_log\n else; sorry \"Post a JSON array or object.\", 422\n end\n end", "def logs\n end", "def create\n @data_log = DataLog.new(data_log_params)\n\n respond_to do |format|\n if @data_log.save\n format.html { redirect_to @data_log, notice: 'Data log was successfully created.' }\n format.json { render :show, status: :created, location: @data_log }\n else\n format.html { render :new }\n format.json { render json: @data_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log( *files, **options )\n\t\toptions[:graph] = false\n\n\t\tentries = self.server.run_with_json_template( :log, *files, **options )\n\n\t\treturn entries.map {|entry| Hglib::Repo::LogEntry.new(entry) }\n\tend", "def download_logs\n `mkdir -p tmp`\n `heroku logs -n 100000 > tmp/logs.txt`\nend", "def log_params\n params.permit(:macaddress, :secret_key, :log_file, :page)\n end", "def s3LogJsonUpdate(presto_log_dir)\n println \"presto log dir : #{presto_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{presto_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/presto/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\n end", "def log(type='Log', text)\n puts \"[#{type}] #{text}\"\n submit_log(LOG_HOST, LOG_PORT, type, text)\nend", "def create\n @outgoing_message_log = OutgoingMessageLog.new(params[:outgoing_message_log])\n\n respond_to do |format|\n if @outgoing_message_log.save\n format.html { redirect_to @outgoing_message_log, notice: 'Outgoing message log was successfully created.' }\n format.json { render json: @outgoing_message_log, status: :created, location: @outgoing_message_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outgoing_message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @logstash = Logstash.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @logstash }\n end\n end", "def create\n @input_log = InputLog.new(input_log_params)\n\n respond_to do |format|\n if @input_log.save\n format.html { redirect_to @input_log, notice: 'Input log was successfully created.' }\n format.json { render :show, status: :created, location: @input_log }\n else\n format.html { render :new }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def reopen_logs; end", "def logs\n @file = \"crowbar-logs-#{ctime}.tar.bz2\"\n system(\"sudo -i /opt/dell/bin/gather_logs.sh #{@file}\")\n redirect_to \"/export/#{@file}\"\n end", "def logs\n @file = \"crowbar-logs-#{ctime}.tar.bz2\"\n system(\"sudo -i /opt/dell/bin/gather_logs.sh #{@file}\")\n redirect_to \"/export/#{@file}\"\n end", "def http_post(payload)\n LOGGER.info(\"Sending POST request to #{@collector_uri}...\")\n LOGGER.debug(\"Payload: #{payload}\")\n destination = URI(@collector_uri)\n http = Net::HTTP.new(destination.host, destination.port)\n request = Net::HTTP::Post.new(destination.request_uri)\n if destination.scheme == 'https'\n http.use_ssl = true\n end\n request.body = payload.to_json\n request.set_content_type('application/json; charset=utf-8')\n response = http.request(request)\n LOGGER.add(is_good_status_code(response.code) ? Logger::INFO : Logger::WARN) {\n \"POST request to #{@collector_uri} finished with status code #{response.code}\"\n }\n\n response\n end", "def log_time_of_backup\n puts \"- Logging the time of this backup\"\n puts \"You can find this by extracting the document with the class type of LastRunDoc\"\n logger = {:class=>\"LastRunLog\",\n :logged_interval=>last_run,\n :ran_at=>Time.now}\n RestClient.post(\"#{@couch_db}\", logger.to_json )\n end", "def postSyndication_log( entity_id, publisher_id, action, success, message, syndicated_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['publisher_id'] = publisher_id\n params['action'] = action\n params['success'] = success\n params['message'] = message\n params['syndicated_id'] = syndicated_id\n return doCurl(\"post\",\"/syndication_log\",params)\n end", "def create\n @dlog = Dlog.new(params[:dlog])\n\n respond_to do |format|\n if @dlog.save\n format.html { redirect_to @dlog, notice: 'Dlog was successfully created.' }\n format.json { render json: @dlog, status: :created, location: @dlog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |f|\n \n # formats decimal digits on level\n @level = params[:level].to_f.to_s[0..5]\n \n # the activities are clustered in a string, stored in a single row of the db, unless they are far apart,\n # in which case a new row is created\n # the interval is determined by INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n # see config/application.rb\n if !@last_log or Time.now - @last_log.updated_at > OmniEye::INTERVAL_BETWEEN_ACTIVITY_CHUNKS\n @activity_log = @camera.activity_logs.build( :level => @level, :datetime => params[:datetime] )\n else\n @activity_log = @last_log\n @activity_log.level = @activity_log.level + ' ' + @level\n end\n\n # uploads snapshot if the interval since the last upload is greater than INTERVAL_BETWEEN_SNAPSHOTS\n # see config/application.rb\n @last_snapshot = @activity_log.snapshots.last\n if (!@last_snapshot or Time.now - @last_snapshot.created_at > OmniEye::INTERVAL_BETWEEN_SNAPSHOTS) \n @activity_log.snapshots.build( :img_data => params[:image] ) \n end\n \n if @activity_log.save\n f.json { \n render :json => { :success => true } \n }\n else\n f.json { \n render :json => { :success => false, :errors => @activity_log.errors.as_json }\n }\n end\n end\n end", "def create\n @time_log = TimeLog.new(params[:time_log])\n \n puts \"Creating a new time_log\"\n\n respond_to do |format|\n if @time_log.save\n format.html { redirect_to @time_log, notice: 'Time log was successfully created.' }\n format.json { render json: @time_log, status: :created, location: @time_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timelog = Timelog.new(timelog_params)\n\n respond_to do |format|\n if @timelog.save\n format.html { redirect_to @timelog, notice: 'Timelog was successfully created.' }\n format.json { render :show, status: :created, location: @timelog }\n else\n format.html { render :new }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @red_packet_history = RedPacketHistory.new(red_packet_history_params)\n\n respond_to do |format|\n if @red_packet_history.save\n format.html { redirect_to [:admin, @red_packet_history], notice: 'Red packet history was successfully created.' }\n format.json { render action: 'show', status: :created, location: @red_packet_history }\n else\n format.html { render action: 'new' }\n format.json { render json: @red_packet_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @iptable_log = IptableLog.new(iptable_log_params)\n\n respond_to do |format|\n if @iptable_log.save\n format.html { redirect_to @iptable_log, notice: 'Iptable log was successfully created.' }\n format.json { render :show, status: :created, location: @iptable_log }\n else\n format.html { render :new }\n format.json { render json: @iptable_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_xssrays_logs\n # validate nonce\n nonce = @params['nonce'] || nil\n (print_error \"nonce is nil\";return @body = {'success' => 'false'}.to_json) if nonce.nil?\n (print_error \"nonce incorrect\";return @body = {'success' => 'false'}.to_json) if @session.get_nonce != nonce\n\n # validate that the hooked browser's session has been sent\n zombie_session = @params['zombie_session'] || nil\n (print_error \"Zombie session is nil\";return @body = {'success' => 'false'}.to_json) if zombie_session.nil?\n\n # validate that the hooked browser exists in the db\n zombie = Z.first(:session => zombie_session) || nil\n (print_error \"Invalid hooked browser session\";return @body = {'success' => 'false'}.to_json) if zombie.nil?\n\n logs = []\n BeEF::Core::Models::Xssraysdetail.all(:hooked_browser_id => zombie.id).each{|log|\n logs << {\n 'id' => log.id,\n 'vector_method' => log.vector_method,\n 'vector_name' => log.vector_name,\n 'vector_poc' => log.vector_poc\n }\n }\n\n @body = {'success' => 'true', 'logs' => logs}.to_json\n end", "def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{kafka_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/kafka/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\nend", "def log(event)\n log_file.puts(event.to_json)\n end", "def retrieve_logs_for_download\n parse_files_for_download\n\n output = ''\n jsons.reverse_each do |elem|\n output.insert(0, insert_log_line_for_download(elem))\n end\n\n output\n end", "def write(chunk)\n generate_tokens_list()\n return unless @tokens.is_a? Hash\n\n chunk.msgpack_each do |tag, record|\n next unless record.is_a? Hash\n next unless @use_json or record.has_key? \"message\"\n\n token = get_token(tag, record)\n next if token.nil?\n\n # Clean up the string to avoid blank line in logentries\n message = @use_json ? record.to_json : record[\"message\"].rstrip()\n send_logentries(token, message)\n end\n end", "def create\n @node_history = NodeHistory.new(node_history_params)\n\n respond_to do |format|\n if @node_history.save\n format.html { redirect_to @node_history, notice: 'Node history was successfully created.' }\n format.json { render :show, status: :created, location: @node_history }\n else\n format.html { render :new }\n format.json { render json: @node_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def log_http_call(payload); end", "def log_http_call(payload); end", "def create\n @log = @task.logs.new(log_params)\n\n respond_to do |format|\n if @log.save\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @log }\n else\n format.html { render action: 'new' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def emit_flood(event, time, sink)\n data = {\n \"time\": time.to_s,\n \"id\": event[\"site_no\"] + time.to_s.gsub(\" \", \"\"),\n \"type\": \"flood\",\n \"lat\": event[\"dec_lat_va\"],\n \"long\": event[\"dec_long_va\"],\n # \"measure\": (event[\"stage\"] - event[\"floodstage\"].to_f).round(2), # Something's wrong with the API, changing for now until fixed\n \"measure\": event[\"flow\"],\n \"metadata\": event.to_json\n }\n\n puts \"data: #{data}\"\n\n @logger.info(\"Sending message to #{sink}\")\n r = HTTParty.post(sink, \n :headers => {\n 'Content-Type' => 'text/plain',\n 'ce-specversion' => '0.2',\n 'ce-type' => 'dev.knative.naturalevent.flood',\n 'ce-source' => 'dev.knative.flood'\n },\n :body => data.to_json\n )\n\n if r.code != 200 or r.code != 202\n @logger.error(\"Error! #{r.code} - #{r}\")\n @logger.error(\"Body: #{r.body}\")\n end\nend", "def dump_ingest_payload( payload )\n puts '*' * 80\n payload.each { |k, v|\n puts \" ==> #{k} -> #{v}\"\n }\n puts '*' * 80\n end", "def post_d3_key d3_key\n log_file = \"log/\" + d3_key + \"-\" + Time.now.utc.to_s.gsub(/\\s/, \"-\")\n `mkdir -p log`\n `mkdir -p tmp`\n \n `curl --user-agent \"#{USER_AGENT}\" -v --cookie tmp/cookie --cookie-jar tmp/cookie2 -d \"gameKey=#{d3_key}\" https://us.battle.net/account/management/add-game.html 2>&1 >> #{log_file}`\n puts \"posted d3 key: #{d3_key}, posted_at: #{Time.now.to_s}\"\n nil\nend", "def create\n @ncr_api_log = NcrApiLog.new(ncr_api_log_params)\n # authorize(@ncr_api_log)\n respond_to do |format|\n if @ncr_api_log.save\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully created.' }\n format.json { render :show, status: :created, location: @ncr_api_log }\n else\n format.html { render :new }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_v11_cm_service_role_commands_jmap_dump_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_service_role_commands_jmap_dump_post ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/service/roleCommands/jmapDump\".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 = []\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(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_cm_service_role_commands_jmap_dump_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @punch_log = PunchLog.new(punch_log_params)\n\n respond_to do |format|\n if @punch_log.save\n format.html { redirect_to @punch_log, notice: 'Punch log was successfully created.' }\n format.json { render :show, status: :created, location: @punch_log }\n else\n format.html { render :new }\n format.json { render json: @punch_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def dump_to_log(thing, type)\n # Dump headers\n\n logger.info \"---- #{type} headers ----------------------------------\"\n thing.headers.each do |header, value|\n if header.starts_with?(\"HTTP_\")\n logger.info sprintf(\"%s: %s\\n\", header.sub(/^HTTP_/, \"\").downcase, value)\n end\n end\n\n logger.info \"Content-Type: \" + thing.content_type.to_s\n if thing.body\n logger.info \"---- #{type} body ------------------------------------\"\n if thing.body.kind_of?(String)\n logger.info thing.body\n else\n logger.info thing.body.read\n thing.body.rewind\n end\n end\n logger.info \"---- #{type} end ------------------------------------\"\n\n end", "def create\n @web_service_log = WebServiceLog.new(params[:web_service_log])\n\n respond_to do |format|\n if @web_service_log.save\n format.html { redirect_to @web_service_log, notice: 'Web service log was successfully created.' }\n format.json { render json: @web_service_log, status: :created, location: @web_service_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @web_service_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def log\n count = default_log_lines(params)\n lines = get_file_lines(log: true, tail: count)\n respond_with(lines)\n end", "def get_copy_jobs_logs(bookmark = '', page_size = 0, source_org_unit_id = 0,\n destination_org_unit_id = 0, start_date = '', end_date = '')\n # GET /d2l/api/le/(version)/ccb/logs\nend", "def create\n response = post_request(URI.parse(\"http://\"+Storage.find(cookies[:donabe_ip]).data+\"/\"+Storage.find(cookies[:current_tenant]).data+\"/containers.json\"), params[:container].to_json, Storage.find(cookies[:current_token]).data)\n json_respond response.body \n\n end", "def log(env, status, header, began_at)\n now = Time.now\n length = extract_content_length(header)\n\n data =\n {\n :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"?\",\n :remote_user => env[\"REMOTE_USER\"] || \"\",\n :http_method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query => env[\"QUERY_STRING\"].empty? ? \"\" : \"?\"+env[\"QUERY_STRING\"],\n :http_version => env[\"HTTP_VERSION\"],\n :http_status => status.to_s[0..3],\n :content_length => length,\n :duration => now - began_at\n }\n\n logger = @logger || env['rack.errors']\n #logger.write data\n end", "def create\n @debug_output = DebugOutput.new(params[:debug_output])\n\n respond_to do |format|\n if @debug_output.save\n format.html { redirect_to @debug_output, notice: 'Debug output was successfully created.' }\n format.json { render json: @debug_output, status: :created, location: @debug_output }\n else\n format.html { render action: \"new\" }\n format.json { render json: @debug_output.errors, status: :unprocessable_entity }\n end\n end\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def create\n @b_log = BLog.new(params[:b_log])\n\n respond_to do |format|\n if @b_log.save\n format.html { redirect_to @b_log, notice: 'B log was successfully created.' }\n format.json { render json: @b_log, status: :created, location: @b_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @b_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_dump\n end", "def start_dump\n end", "def create\n @block_log = BlockLog.new(params[:block_log])\n\n respond_to do |format|\n if @block_log.save\n format.html { redirect_to @block_log, notice: 'Block log was successfully created.' }\n format.json { render json: @block_log, status: :created, location: @block_log }\n else\n format.html { render action: \"new\" }\n format.json { render json: @block_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sleep_log(body)\n post(\"user/#{user_id}/sleep.json\", body)\n end", "def create\n @ventilation_log = VentilationLog.new(ventilation_log_params)\n\n respond_to do |format|\n if @ventilation_log.save\n format.html { redirect_to @ventilation_log, notice: 'Ventilation log was successfully created.' }\n format.json { render :show, status: :created, location: @ventilation_log }\n else\n format.html { render :new }\n format.json { render json: @ventilation_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_post_then_get\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n id = last_response.body\n\n get \"/traces/#{id}\"\n check_valid_trace last_response.body\n end", "def addLogsBatchXML(collection=\"lclsLogs\", dizList, bulk: false)\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/#{collection}/update\") \n # uri = URI.parse(\"http://psmetric04:8983/solr/lclsLogs/update\") \n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/xml')\n req.body = formatLogBatchAsXML(dizList)\n # puts req.body \n # res = http.request(req, xml: formatLogBatchAsXML(dizList) )\n res = http.request(req)\n # puts \"response: #{res.body}\"\n return [dizList.length, req.body.size, res]\n end", "def logs_response\n \"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35272 ttl=52 time=36.9 ms\\n\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35273 ttl=52 time=35.3 ms\\n\"\n end", "def make_sessions_logs\n sessions_uuids = []\n sessions_info = []\n info = ''\n hist_file = ''\n hist_file_name = ''\n log_list = []\n\n # Create list of sessions with base info\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info[:session_type] =~ /shell/ or e.info[:session_type] =~ /meter/\n if e.info[:command] != 'load stdapi'\n if not sessions_uuids.include?(e.info[:session_uuid])\n sessions_uuids << e.info[:session_uuid]\n sessions_info << {:uuid => e.info[:session_uuid],\n :type => e.info[:session_type],\n :id => e.info[:session_id],\n :info => e.info[:session_info]}\n end\n end\n end\n end\n\n sessions_uuids.each do |su|\n sessions_info.each do |i|\n if su == i[:uuid]\n print_line(\"Exporting Session #{i[:id]} history\")\n hist_file_name = \"#{framework.db.workspace.name}_session_#{i[:id]}_#{::Time.now.strftime('%Y%m%d.%H%M%S')}.log\"\n i.each do |k, v|\n info << \"#{k.to_s}: #{v.to_s} \"\n end\n break\n end\n end\n hist_file << \"# Info: #{info}\\n\"\n info = ''\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info.has_key?(:command) or e.info.has_key?(:output)\n if e.info[:session_uuid] == su\n if e.info.has_key?(:command)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:command]}\\n\"\n elsif e.info.has_key?(:output)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:output]}\\n\"\n end\n end\n end\n end\n\n # Set RC file path and file name\n session_hist_path = ::File.join(Msf::Config.log_directory, 'projects', framework.db.workspace.name)\n session_hist_fullpath = ::File.join(session_hist_path, hist_file_name)\n\n # Create folder\n ::FileUtils.mkdir_p(session_hist_path)\n\n print_line(\"Saving log file to #{session_hist_fullpath}\")\n file_write(session_hist_fullpath, hist_file)\n hist_file = ''\n print_line('Log file written')\n log_list << session_hist_fullpath\n end\n\n return log_list\n end", "def audit_log_params\n params.require(:audit_log).permit(:ip_address, :path)\n end", "def create\n @systemlog = Systemlog.new(systemlog_params)\n\n respond_to do |format|\n if @systemlog.save\n format.html { redirect_to @systemlog, notice: 'Systemlog was successfully created.' }\n format.json { render :show, status: :created, location: @systemlog }\n else\n format.html { render :new }\n format.json { render json: @systemlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_json(path, body)\n uri = build_uri(path)\n #puts \"🤖 POST #{path}\"\n #puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n #puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n #puts result[:result]\n result\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HTTP::Post.new(uri, 'Content-Type' => 'application/json')\n post_request.body = JSON.generate(body)\n\n response = Net::HTTP.start(uri.hostname, uri.port, :use_ssl => true) do |http|\n http.request(post_request)\n end\n\n puts \"HTTP #{response.code}\"\n result = JSON.parse(response.body)\n puts result[:result]\n result\nend", "def create\n response = post_request(URI.parse(\"http://\"+(sesh :donabe_ip)+\"/\"+(sesh :current_tenant)+\"/containers.json\"), params[:container].to_json, (sesh :current_token))\n json_respond response.body \n\n end", "def request_bulk(logs, token, dimensions, application_type)\n # NOTE: X-ApplicationType is not supported for V3 API.\n post_headers = {\n x_auth_token: token,\n content_type: 'application/json'\n }\n\n data = {\n \"dimensions\" => dimensions,\n \"logs\" => logs.map {|message, log_dimensions|\n {\n \"message\" => message,\n # Currently monasca errors if per-message dimensions are omitted.\n \"dimensions\" => log_dimensions,\n }\n }\n }.to_json\n\n @rest_client['logs'].post(data, post_headers)\n end", "def create\n @action_log = ActionLog.new(action_log_params)\n\n respond_to do |format|\n if @action_log.save\n format.html { redirect_to @action_log, notice: 'Action log was successfully created.' }\n format.json { render action: 'show', status: :created, location: @action_log }\n else\n format.html { render action: 'new' }\n format.json { render json: @action_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def metaWeblog_newPost(args)\n new_post_params = Hash.from_xml(args.children[3].to_s)['param']['value']['struct']['member']\n # title = new_post_params[0]['value']['string']\n title =''\n body = new_post_params[1]['value']['string']\n categories = []\n # categories = (new_post_params[2]['value']['array']['data']['value'].class == Array ? new_post_params[2]['value']['array']['data']['value'].map { |e| e['string'] } : [new_post_params[2]['value']['array']['data']['value']['string']] )\n tags = (new_post_params[3]['value']['array']['data']['value'].class == Array ? new_post_params[3]['value']['array']['data']['value'].map { |e| e['string'] } : [new_post_params[3]['value']['array']['data']['value']['string']] )\n ifttt_new_post(title, body, categories, tags)\n rpc_response(\"xml.value 'nothing'\")\n end", "def sub_log \n send_cmd(\"sub_log\")\n end" ]
[ "0.6375744", "0.5935233", "0.59238964", "0.5730587", "0.5652033", "0.5611735", "0.55410427", "0.5426721", "0.53939605", "0.5330068", "0.5319523", "0.52957505", "0.5282459", "0.52764916", "0.52598834", "0.52533084", "0.50917816", "0.505298", "0.5037162", "0.50034153", "0.49326828", "0.4923094", "0.49223772", "0.49092558", "0.49007368", "0.48922774", "0.48903865", "0.48872843", "0.48315263", "0.48221338", "0.4821068", "0.48148116", "0.47856995", "0.47835547", "0.4772014", "0.4771596", "0.476411", "0.47414613", "0.47335416", "0.4729468", "0.47267345", "0.47265953", "0.47161868", "0.47079214", "0.46993145", "0.469716", "0.4675115", "0.46698606", "0.46698606", "0.46589878", "0.46552348", "0.46540686", "0.46481502", "0.4639261", "0.4633713", "0.46336254", "0.46266985", "0.46213755", "0.4613898", "0.46085432", "0.4603801", "0.45995817", "0.45993635", "0.45927083", "0.45880103", "0.45880103", "0.45824412", "0.4570176", "0.45571527", "0.45544916", "0.45450157", "0.4538577", "0.45289668", "0.45231903", "0.45226112", "0.45110995", "0.45082185", "0.45046335", "0.44963813", "0.44954324", "0.44880742", "0.44869605", "0.44869202", "0.44869202", "0.44812757", "0.4481194", "0.44799432", "0.4470648", "0.4469223", "0.44675836", "0.4467227", "0.44644266", "0.44618905", "0.44609588", "0.44560906", "0.44499633", "0.44431442", "0.44417602", "0.44394112", "0.44391719" ]
0.6979693
0
PATCH/PUT /tcpdump_logs/1 PATCH/PUT /tcpdump_logs/1.json
def update respond_to do |format| if @tcpdump_log.update(tcpdump_log_params) format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully updated.' } format.json { render :show, status: :ok, location: @tcpdump_log } else format.html { render :edit } format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def s3LogJsonUpdate(kafka_log_dir)\n println \"kafka log dir : #{kafka_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{kafka_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/kafka/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\nend", "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 s3LogJsonUpdate(presto_log_dir)\n println \"presto log dir : #{presto_log_dir}\"\n logs_json_path = \"/etc/instance-controller/logs.json\"\n println \"Updating #{logs_json_path}\"\n json_obj=JSON.parse(File.read(\"#{logs_json_path}\"));\n sections = json_obj[\"logFileTypes\"]\n sections.each { |section|\n if section['typeName'] == 'SYSTEM_LOG' then\n user_log = section['logFilePatterns']\n user_log << {\n \"fileGlob\" => \"#{presto_log_dir}/var/log/(.*)\",\n \"s3Path\" => \"node/$instance-id/apps/presto/$0\",\n \"delayPush\" => \"true\"\n }\n break\n end\n }\n new_json=JSON.pretty_generate(json_obj)\n File.open('/tmp/logs.json','w') do |file_w|\n file_w.write(\"#{new_json}\")\n end\n sudo \"mv /tmp/logs.json #{logs_json_path}\"\n end", "def set_tcpdump_log\n @tcpdump_log = TcpdumpLog.find(params[:id])\n end", "def update\n @logstash = Logstash.find(params[:id])\n\n respond_to do |format|\n if @logstash.update_attributes(params[:logstash])\n format.html { redirect_to @logstash, notice: 'Logstash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @logstash.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$name}\", \n headers: { \"Fastly-Key\" => $key }, \n body: $put_form_data )\n end", "def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @proto_payload = args[:proto_payload] if args.key?(:proto_payload)\n @text_payload = args[:text_payload] if args.key?(:text_payload)\n @json_payload = args[:json_payload] if args.key?(:json_payload)\n @timestamp = args[:timestamp] if args.key?(:timestamp)\n @severity = args[:severity] if args.key?(:severity)\n @insert_id = args[:insert_id] if args.key?(:insert_id)\n @http_request = args[:http_request] if args.key?(:http_request)\n @labels = args[:labels] if args.key?(:labels)\n @operation = args[:operation] if args.key?(:operation)\n end", "def post_create_clone\n response = self.class.post(\"/service/#{$service_id}/version/#{$new_dev_version}/logging/sftp\", \n headers: { \"Fastly-Key\" => $key},\n body: { \"name\" => \"#{$name}\",\n \"address\" => \"#{$address}\",\n \"port\" => \"22\",\n \"format\" => \"#{$log_format}\",\n \"user\" => \"#{$user}\",\n \"secret_key\" => \"#{$secret_key}\",\n \"public_key\" => \"#{$public_key}\" })\n end", "def update\n ## Normal update behavior\n @stash = Stash.find(params[:id])\n \n ## check to make sure we're not adding a networked stash tunnel\n unless params[:create_tunnel] == \"true\"\n Rails.logger.debug \"Regular update\"\n respond_to do |format|\n if @stash.update_attributes(params[:stash])\n format.html { redirect_to @stash, :notice => 'Stash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stash.errors, :status => :unprocessable_entity }\n end\n end\n else\n \n ## Begin create tunnel behavior\n Rails.logger.debug \"Create tunnel behavior begin\"\n unless params[\"stash\"][\"id\"].blank?\n Rails.logger.debug \"Params check out\"\n Rails.logger.debug \"Tunnel to #{params[\"stash\"][\"id\"]}\"\n tunnel_to = (params[\"stash\"][\"id\"]).to_i\n @tunnel_to_stash = Stash.find(tunnel_to)\n @stash.network_stashes << @tunnel_to_stash\n else\n @stash.errors.add :base, \"There was no stash id provided to create a new tunnel.\"\n end\n \n respond_to do |format|\n if @stash.save\n format.html { redirect_to @stash, :notice => 'Stash was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @stash.errors, :status => :unprocessable_entity }\n end\n end\n \n end ## end create tunnel behavior \n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def rm_update path, data, msg\n\n re = rm_request path, data, 'PUT'\n puts re.body\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n return true\n\nend", "def update\n respond_to do |format|\n if @server_monitor_log.update(server_monitor_log_params)\n format.html { redirect_to @server_monitor_log, notice: 'Server monitor log was successfully updated.' }\n format.json { render :show, status: :ok, location: @server_monitor_log }\n else\n format.html { render :edit }\n format.json { render json: @server_monitor_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @request_logging = args[:request_logging] if args.key?(:request_logging)\n end", "def update\n respond_to do |format|\n if @log_file.update(log_file_params)\n format.html { redirect_to @log_file, notice: 'Log file was successfully updated.' }\n format.json { render :show, status: :ok, location: @log_file }\n else\n format.html { render :edit }\n format.json { render json: @log_file.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ethernet_log.update(ethernet_log_params)\n format.html { redirect_to @ethernet_log, notice: 'Ethernet log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ethernet_log }\n else\n format.html { render :edit }\n format.json { render json: @ethernet_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ncr_api_log.update(ncr_api_log_params)\n format.html { redirect_to @ncr_api_log, notice: 'Ncr api log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ncr_api_log }\n else\n format.html { render :edit }\n format.json { render json: @ncr_api_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @input_log.update(input_log_params)\n format.html { redirect_to @input_log, notice: 'Input log was successfully updated.' }\n format.json { render :show, status: :ok, location: @input_log }\n else\n format.html { render :edit }\n format.json { render json: @input_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n if @heartbeat.update(heartbeat_params)\n head :no_content\n else\n render json: @heartbeat.errors, status: :unprocessable_entity\n end\n end", "def patch(path, **args); end", "def update\n respond_to do |format|\n if @vlog.update(vlog_params)\n format.html { redirect_to @vlog, notice: 'Vlog was successfully updated.' }\n format.json { render :show, status: :ok, location: @vlog }\n else\n format.html { render :edit }\n format.json { render json: @vlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @punch_log.update(punch_log_params)\n format.html { redirect_to @punch_log, notice: 'Punch log was successfully updated.' }\n format.json { render :show, status: :ok, location: @punch_log }\n else\n format.html { render :edit }\n format.json { render json: @punch_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tcpdump_log = TcpdumpLog.new(tcpdump_log_params)\n\n respond_to do |format|\n if @tcpdump_log.save\n format.html { redirect_to @tcpdump_log, notice: 'Tcpdump log was successfully created.' }\n format.json { render :show, status: :created, location: @tcpdump_log }\n else\n format.html { render :new }\n format.json { render json: @tcpdump_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n response = http.request(request)\n\n if response.is_a?(Net::HTTPOK)\n body = response.body\n # test that we have sane looking JSON before we save it\n @tariff_data = JSON.parse(body)\n\n tariff_data_file.write(body)\n else\n LOGGER.fatal \"Error updating Octopus: #{response}\"\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n respond_to do |format|\n if @audit_log.update(audit_log_params)\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully updated.' }\n format.json { render :show, status: :ok, location: @audit_log }\n else\n format.html { render :edit }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @iptable_log.update(iptable_log_params)\n format.html { redirect_to @iptable_log, notice: 'Iptable log was successfully updated.' }\n format.json { render :show, status: :ok, location: @iptable_log }\n else\n format.html { render :edit }\n format.json { render json: @iptable_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tmpr_log.update(tmpr_log_params)\n format.html { redirect_to @tmpr_log, notice: 'Tmpr log was successfully updated.' }\n format.json { render :show, status: :ok, location: @tmpr_log }\n else\n format.html { render :edit }\n format.json { render json: @tmpr_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @b_log = BLog.find(params[:id])\n\n respond_to do |format|\n if @b_log.update_attributes(params[:b_log])\n format.html { redirect_to @b_log, notice: 'B log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @b_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @config_log.update(config_log_params)\n format.html { redirect_to @config_log, notice: 'Config log was successfully updated.' }\n format.json { render :show, status: :ok, location: @config_log }\n else\n format.html { render :edit }\n format.json { render json: @config_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update!(**args)\n @audit_log_configs = args[:audit_log_configs] if args.key?(:audit_log_configs)\n @service = args[:service] if args.key?(:service)\n end", "def update\n @heartbeat = Heartbeat.find(params[:id])\n\n respond_to do |format|\n if @heartbeat.update_attributes(params[:heartbeat])\n format.html { redirect_to @heartbeat, notice: 'Heartbeat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heartbeat.errors, status: :unprocessable_entity }\n end\n end\n end", "def put_clone\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/clone\", { \n headers: {\"Fastly-Key\" => $key} \n })\n end", "def update\n respond_to do |format|\n if @data_log.update(data_log_params)\n format.html { redirect_to @data_log, notice: 'Data log was successfully updated.' }\n format.json { render :show, status: :ok, location: @data_log }\n else\n format.html { render :edit }\n format.json { render json: @data_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_server(server_uuid, params)\n data = { \"server\" => params }\n json = JSON.generate data\n response = put \"server/#{server_uuid}\", json\n\n response\n end", "def update\n respond_to do |format|\n if @calllog.update(calllog_params)\n format.html { redirect_to @calllog, notice: 'Calllog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @calllog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @backlog.update(backlog_params)\n format.html { redirect_to project_backlogs_path(@backlog.project.id), notice: 'Backlog atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @backlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interaction_log = InteractionLog.find(params[:id])\n\n respond_to do |format|\n if @interaction_log.update_attributes(params[:interaction_log])\n format.html { redirect_to @interaction_log, notice: 'Interaction log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interaction_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to task_path(@log.task), notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @create_time = args[:create_time] if args.key?(:create_time)\n @etag = args[:etag] if args.key?(:etag)\n @labels = args[:labels] if args.key?(:labels)\n @name = args[:name] if args.key?(:name)\n @payload = args[:payload] if args.key?(:payload)\n @update_time = args[:update_time] if args.key?(:update_time)\n end", "def update\n @block_log = BlockLog.find(params[:id])\n\n respond_to do |format|\n if @block_log.update_attributes(params[:block_log])\n format.html { redirect_to @block_log, notice: 'Block log was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @block_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n head :ok\n end", "def update\n respond_to do |format|\n if @node_history.update(node_history_params)\n format.html { redirect_to @node_history, notice: 'Node history was successfully updated.' }\n format.json { render :show, status: :ok, location: @node_history }\n else\n format.html { render :edit }\n format.json { render json: @node_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @dump_list.update(dump_list_params)\n flash[:success] = 'Dump list was successfully updated.'\n format.html { redirect_to @dump_list }\n format.json { render :show, status: :ok, location: @dump_list }\n else\n flash[:danger] = \"There are some mistakes, please try again\"\n format.html { render :edit }\n format.json { render json: @dump_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @red_packet_history.update(red_packet_history_params)\n format.html { redirect_to [:admin, @red_packet_history], notice: 'Red packet history was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @red_packet_history.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @heat_log = HeatLog.find(params[:id])\n\n respond_to do |format|\n if @heat_log.update_attributes(params[:heat_log])\n format.html { redirect_to @heat_log, notice: 'Heat log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @heat_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def dump_log(request = nil, java = false)\n type_params = java ? '?type=java' : ''\n url = \"#{DUMP_LOG_ENDPOINT}#{type_params}\"\n request = request ? Request.new(symbolize_keys(request)) : {}\n\n logger.debug('Sending dump log request to mockserver')\n logger.debug(\"URL: #{url}. Payload: #{request.to_hash}\")\n\n response = @base[url].put(request.to_json)\n logger.debug(\"Got dump to log response: #{response.code}\")\n parse_string_to_json(response)\n end", "def update\n respond_to do |format|\n if @systemlog.update(systemlog_params)\n format.html { redirect_to @systemlog, notice: 'Systemlog was successfully updated.' }\n format.json { render :show, status: :ok, location: @systemlog }\n else\n format.html { render :edit }\n format.json { render json: @systemlog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @change_log.update(change_log_params)\n format.html { redirect_to @change_log, notice: 'Change log was successfully updated.' }\n format.json { render :show, status: :ok, location: @change_log }\n else\n format.html { render :edit }\n format.json { render json: @change_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @tcpdump_log.destroy\n respond_to do |format|\n format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n\n respond_to do |format|\n if @outgoing_message_log.update_attributes(params[:outgoing_message_log])\n format.html { redirect_to @outgoing_message_log, notice: 'Outgoing message log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @outgoing_message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def flush_log_buffer()\n APPS_LOCK.synchronize {\n loop {\n break if @@logs_buffer.empty?\n encoded_logs = JSON.dump({\n 'service_name' => 'appcontroller',\n 'host' => my_node.public_ip,\n 'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/logs/upload\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_logs,\n {'Content-Type'=>'application/json'})\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the logs - just continue on.\n end\n }\n }\n end", "def update\n respond_to do |format|\n if @tracing.update(tracing_params)\n format.html { redirect_to @tracing }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tracing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.attributes = params[:physical_rack]\n @physical_rack.audits << Audit.new(source: 'controller', action: 'update', admin_user: current_user)\n respond_to do |format|\n if @physical_rack.save\n format.html { redirect_to @physical_rack, notice: 'Physical rack was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physical_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @log }\n else\n format.html { render action: 'edit' }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, body_params = {})\n debug_log \"PATCH #{@host}#{path} body:#{body_params}\"\n headers = { 'Content-Type' => 'application/json' }\n res = connection.run_request :put, path, body_params.to_json, headers\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def tcpdump_log_params\n params.require(:tcpdump_log).permit(:user_id, :user_data)\n end", "def update\n @log = Log.find(params[:id])\n\n respond_to do |format|\n if @log.update_attributes(params[:log])\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log.update(log_params)\n format.html { redirect_to @log, notice: 'Log was successfully updated.' }\n format.json { render :show, status: :ok, location: @log }\n else\n format.html { render :edit }\n format.json { render json: @log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @message_log = MessageLog.find(params[:id])\n\n respond_to do |format|\n if @message_log.update_attributes(params[:message_log])\n format.html { redirect_to @message_log, notice: 'Message log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @message_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sample_storage_log.update(sample_storage_log_params)\n format.html { redirect_to @sample_storage_log, notice: 'Sample storage log was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample_storage_log }\n else\n format.html { render :edit }\n format.json { render json: @sample_storage_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(url, payload)\n url = URI.parse(url)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n request = Net::HTTP::Patch.new(url.path+'?access_token=verysecret')\n request.content_type = 'application/json'\n request.body = JSON.generate(payload)\n response = http.start {|http| http.request(request) }\n begin\n return JSON.parse(response.body)\n rescue\n # Log as a problematic case with rule number and line\n $problems.write \"#{$index}, #{payload}, #{response.body}\\n\"\n return nil\n end\nend", "def update\n respond_to do |format|\n if @action_log.update(action_log_params)\n format.html { redirect_to @action_log, notice: 'Action log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @action_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prod_cli = ProdCli.find(params[:id])\n respond_to do |format|\n if @prod_cli.update(prod_cli_params)\n #ATUALIZOU DADOS\n log = Loginfo.new(params[:loginfo])\n log.employee = current_user.name\n log.task = 'Atualizou os dados do produto no cliente: ' + @prod_cli.client.company.to_s\n log.save! \n \n format.html { redirect_to clients_path, notice: 'produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @prod_cli }\n else\n format.html { render :edit }\n format.json { render json: @prod_cli.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @timelog.update(timelog_params)\n format.html { redirect_to @timelog, notice: 'Timelog was successfully updated.' }\n format.json { render :show, status: :ok, location: @timelog }\n else\n format.html { render :edit }\n format.json { render json: @timelog.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @log_load_time.update(log_load_time_params)\n format.html { redirect_to @log_load_time, notice: 'Log load time was successfully updated.' }\n format.json { render :show, status: :ok, location: @log_load_time }\n else\n format.html { render :edit }\n format.json { render json: @log_load_time.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\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\n @node_incident = NodeIncident.find(params[:id])\n\n respond_to do |format|\n if @node_incident.update_attributes(params[:node_incident])\n format.html { redirect_to @node_incident, :notice => 'Node incident was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @node_incident.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @steplog.update(steplog_params)\n format.html { redirect_to @steplog, notice: 'Steplog was successfully updated.' }\n format.json { render :show, status: :ok, location: @steplog }\n else\n format.html { render :edit }\n format.json { render json: @steplog.errors, status: :unprocessable_entity }\n end\n end\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update\n respond_to do |format|\n if @ventilation_log.update(ventilation_log_params)\n format.html { redirect_to @ventilation_log, notice: 'Ventilation log was successfully updated.' }\n format.json { render :show, status: :ok, location: @ventilation_log }\n else\n format.html { render :edit }\n format.json { render json: @ventilation_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update!(**args)\n @log_name = args[:log_name] if args.key?(:log_name)\n @resource = args[:resource] if args.key?(:resource)\n @labels = args[:labels] if args.key?(:labels)\n @entries = args[:entries] if args.key?(:entries)\n end", "def update\n respond_to do |format|\n if @entry_log.update(entry_log_params)\n format.html { redirect_to @entry_log, notice: 'Entry log was successfully updated.' }\n format.json { render :show, status: :ok, location: @entry_log }\n else\n format.html { render :edit }\n format.json { render json: @entry_log.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end", "def update\n=begin\n @notification_log = NotificationLog.find(params[:id])\n\n respond_to do |format|\n if @notification_log.update_attributes(params[:notification_log])\n format.html { redirect_to @notification_log, notice: 'Notification log was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @notification_log.errors, status: :unprocessable_entity }\n end\n end\n=end\n end" ]
[ "0.5817983", "0.56800187", "0.5651337", "0.5624282", "0.56066096", "0.55394477", "0.5417865", "0.5318335", "0.52756274", "0.52443546", "0.52240497", "0.5183746", "0.5169122", "0.5164319", "0.50853044", "0.5067027", "0.50628006", "0.50576913", "0.5041863", "0.4991049", "0.49670926", "0.49581295", "0.49566677", "0.49542767", "0.49520594", "0.49177945", "0.49171308", "0.49136364", "0.49105138", "0.49002865", "0.48919106", "0.48850152", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4864041", "0.4863539", "0.48624268", "0.48581958", "0.48535877", "0.48531026", "0.48497757", "0.48360458", "0.48313215", "0.48216626", "0.4821261", "0.48171318", "0.4810362", "0.47997192", "0.47994173", "0.47941568", "0.47935048", "0.4782457", "0.4775717", "0.4775333", "0.47736597", "0.47732037", "0.47700146", "0.47662434", "0.47591433", "0.47514293", "0.47449836", "0.4744215", "0.47329837", "0.4731688", "0.47247466", "0.47241557", "0.47241557", "0.47241557", "0.47207633", "0.47163188", "0.4714985", "0.470849", "0.46988198", "0.46833733", "0.467923", "0.46740994", "0.46730372", "0.4670884", "0.46581224", "0.46535185", "0.46532387", "0.4653157", "0.4650133", "0.46437752", "0.46397772" ]
0.6808326
0
DELETE /tcpdump_logs/1 DELETE /tcpdump_logs/1.json
def destroy @tcpdump_log.destroy respond_to do |format| format.html { redirect_to tcpdump_logs_url, notice: 'Tcpdump log was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_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 delete_snapshot(snapshot_id)\n end", "def destroy\n @server = Server.find(params[:server_id])\n @httping_log = @server.httping_logs.find(params[:id])\n @httping_log.destroy\n\n respond_to do |format|\n format.html { redirect_to servers_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n head :no_content\n end", "def destroy\n @server_monitor_log.destroy\n respond_to do |format|\n format.html { redirect_to server_monitor_logs_url, notice: 'Server monitor log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def delete\n CONNECTION.execute(\"DELETE FROM logs WHERE id = #{self.id};\")\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n respond_to do |format|\n format.html { redirect_to index_logs_path(params[:device_id], :page => 1) }\n format.json { head :no_content }\n end\n end", "def destroy\n @heat_log = HeatLog.find(params[:id])\n @heat_log.destroy\n\n respond_to do |format|\n format.html { redirect_to heat_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @outgoing_message_log = OutgoingMessageLog.find(params[:id])\n @outgoing_message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to outgoing_message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @b_log = BLog.find(params[:id])\n @b_log.destroy\n\n respond_to do |format|\n format.html { redirect_to b_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block_log = BlockLog.find(params[:id])\n @block_log.destroy\n\n respond_to do |format|\n format.html { redirect_to block_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to dlogs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dump_list.destroy\n respond_to do |format|\n flash[:success] = 'Dump list was successfully destroyed.'\n format.html { redirect_to dumplist_path }\n format.json { head :no_content }\n end\n end", "def destroy\n redirect_to acm300_logs_path\n \n # @acm_logs300_log.destroy\n # respond_to do |format|\n # format.html { redirect_to acm300_logs_url, notice: 'Acm300 log was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end", "def delete_file(path)\n \n puts \"Sending path via MCollective Files client\"\n @mc.delete(:path => path)\n printrpcstats\n \n end", "def destroy\n @ethernet_log.destroy\n respond_to do |format|\n format.html { redirect_to ethernet_logs_url, notice: 'Ethernet log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def logs_delete(obj)\n @db.q_buffer do |db_buffer|\n buffer_hash = {:db_buffer => db_buffer}\n\n @ob.list(:Log_link, {\"object_class\" => obj.class.name, \"object_id\" => obj.id}) do |log_link|\n log = log_link.log\n @ob.delete(log_link, buffer_hash)\n @ob.delete(log, buffer_hash) if log and log.links(\"count\" => true) <= 0\n end\n end\n end", "def destroy\n @heartbeat.destroy\n\n head :no_content\n end", "def delete_sleep_log(sleep_log_id)\n delete(\"user/#{user_id}/sleep/#{sleep_log_id}.json\")\n end", "def destroy\n @sample_storage_log.destroy\n respond_to do |format|\n format.html { redirect_to sample_storage_logs_url, notice: 'Sample storage log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @logtransfer = Logtransfer.find(params[:id])\n @logtransfer.destroy\n\n respond_to do |format|\n format.html { redirect_to logtransfers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ai_log.destroy\n respond_to do |format|\n format.html { redirect_to ai_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_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 @heartbeat = Heartbeat.find(params[:id])\n @heartbeat.destroy\n\n respond_to do |format|\n format.html { redirect_to heartbeats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @message_log = MessageLog.find(params[:id])\n @message_log.destroy\n\n respond_to do |format|\n format.html { redirect_to message_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @audit_log.destroy\n respond_to do |format|\n format.html { redirect_to audit_logs_url, notice: 'Audit log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @iptable_log.destroy\n respond_to do |format|\n format.html { redirect_to iptable_logs_url, notice: 'Iptable log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log_file.destroy\n respond_to do |format|\n format.html { redirect_to log_files_url, notice: 'Log file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_log = ActionLog.find(params[:id])\n @action_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(action_logs_url) }\n format.xml { head :ok }\n end\n end", "def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def test_delete1()\n key = \"_Delete1\"\n c = Scalaroid::JSONConnection.new(url = Scalaroid::DEFAULT_URL)\n rdht = Scalaroid::ReplicatedDHT.new(conn = c)\n sc = Scalaroid::TransactionSingleOp.new(conn = c)\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n\n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(4, ok)\n results = rdht.get_last_delete_result()\n assert_equal(4, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n\n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(4, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n\n c.close()\n end", "def destroy\n @log_load_time.destroy\n respond_to do |format|\n format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n make_call(mk_conn(path), :delete)\n end", "def destroy\n @tmpr_log.destroy\n respond_to do |format|\n format.html { redirect_to tmpr_logs_url, notice: 'Tmpr log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @action_log.destroy\n respond_to do |format|\n format.html { redirect_to action_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interaction_log = InteractionLog.find(params[:id])\n @interaction_log.destroy\n\n respond_to do |format|\n format.html { redirect_to interaction_logs_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(path, params = {})\n debug_log \"DELETE #{@host}#{path} params:#{params}\"\n res = connection.delete path, params\n debug_log \"Response status:#{res.status}, body:#{res.body}\"\n res\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @data_log.destroy\n respond_to do |format|\n format.html { redirect_to data_logs_url, notice: 'Data log was successfully destroyed.' }\n format.json { head :no_content }\n end\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 destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_log.destroy\n respond_to do |format|\n format.html { redirect_to config_logs_url, notice: 'Config log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_uncompressed_backups\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = Log.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @update_log = UpdateLog.find(params[:id])\n @update_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(update_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @web_service_log = WebServiceLog.find(params[:id])\n @web_service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to web_service_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @sleep_log = SleepLog.find(params[:id])\n @sleep_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(sleep_logs_url) }\n format.xml { head :ok }\n end\n end", "def delete_snapshot snapshot\n subscriber.delete_snapshot snapshot: snapshot_path(snapshot)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @dlog = Dlog.find(params[:id])\n @dlog.destroy\n\n respond_to do |format|\n format.html { redirect_to(dlogs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vlog.destroy\n respond_to do |format|\n format.html { redirect_to vlogs_url, notice: 'Vlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @audit_log = AuditLog.find(params[:id])\n @audit_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(audit_logs_url) }\n format.xml { head :ok }\n end\n end", "def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end", "def deleteEBSSnapshot(client=nil,snapshots_to_delete=[],dry_run=true)\n return false if client.nil?\n unless snapshots_to_delete.instance_of? Array\n snapshots_to_delete = [snapshots_to_delete]\n end\n snapshots_to_delete.each do |snapshot|\n if dry_run\n printf \"\\e[33m\\\"Delete snapshot #{snapshot}?\\\" (y/n)? \\e[0m\"\n prompt = STDIN.gets.chomp\n next unless prompt == \"y\"\n end\n print \"Deleting ec2 snapshot #{snapshot}...\"\n begin\n # delete_snapshot API has no response\n client.delete_snapshot({\n dry_run: dry_run,\n snapshot_id: snapshot\n })\n puts \"\\e[32msuccess\\e[0m\"\n rescue Exception => e\n puts \"\\e[31mfailed - #{e.message}\\e[0m\"\n end\n end\n return true\nend", "def delete_fusion_vm_snapshot(options)\n clone_list = []\n if options['clone'].to_s.match(/\\*/) or options['clone'].to_s.match(/all/)\n clone_list = get_fusion_vm_snapshots(options)\n clone_list = clone_list.split(\"\\n\")[1..-1]\n else\n clone_list[0] = options['clone']\n end\n clone_list.each do |clone|\n fusion_vmx_file = get_fusion_vm_vmx_file(options)\n message = \"Information:\\tDeleting snapshot \"+clone+\" for #{options['vmapp']} VM \"+options['name']\n command = \"'#{options['vmrun']}' -T fusion deleteSnapshot '#{fusion_vmx_file}' '#{clone}'\"\n execute_command(options,message,command)\n end\n return\nend", "def destroy\n @database = Database.find(params[:id])\n path = @database.path\n delete = %x[rm -R #{path}]\n @database.destroy\n\n respond_to do |format|\n format.html { redirect_to databases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @wr_log = WrLog.find(params[:id])\n @wr_log.destroy\n\n respond_to do |format|\n format.html { redirect_to wr_logs_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def delete(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :version, :callback, :context])\n assert_required_keys(args, [:path])\n args[:version] ||= -1\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(VoidCallback)\n return zoo_adelete(@zk_handle, args[:path], args[:version], args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n rc = zoo_delete(@zk_handle, args[:path], args[:version])\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return rc\n end", "def destroy\n @calllog.destroy\n respond_to do |format|\n format.html { redirect_to calllogs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @daily_task_log.destroy\n respond_to do |format|\n format.html { redirect_to daily_task_logs_url, notice: 'Daily task log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def testDelete1()\n key = \"_Delete1\"\n c = Scalaris::JSONConnection.new(url = Scalaris::DEFAULT_URL)\n rdht = Scalaris::ReplicatedDHT.new(conn = c)\n sc = Scalaris::TransactionSingleOp.new(conn = c)\n rt = Scalaris::RoutingTable.new\n r = rt.get_replication_factor\n \n (0..($_TEST_DATA.length - 1)).each do |i|\n sc.write(@testTime.to_s + key + i.to_s, $_TEST_DATA[i])\n end\n \n # now try to delete the data:\n (0..($_TEST_DATA.length - 1)).each do |i|\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(r, ok)\n results = rdht.get_last_delete_result()\n assert_equal(r, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(0, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n \n # try again (should be successful with 0 deletes)\n ok = rdht.delete(@testTime.to_s + key + i.to_s)\n assert_equal(0, ok)\n results = rdht.get_last_delete_result()\n assert_equal(0, results.ok)\n assert_equal(0, results.locks_set)\n assert_equal(r, results.undefined)\n _checkKeyDoesNotExist(@testTime.to_s + key + i.to_s)\n end\n \n c.close()\n end", "def destroy\n render json: current_device.logs.destroy_all && \"\"\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 @d_logger = DLogger.find(params[:id])\n @d_logger.destroy\n\n respond_to do |format|\n format.html { redirect_to d_loggers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tasks_log.destroy\n respond_to do |format|\n format.html { redirect_to tasks_logs_url, notice: 'Tasks log was successfully destroyed.' }\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 delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def ftpDeleteDir(parentfolder, childfolder, logkey='')\n Ftpfunctions.deleteFTP(parentfolder, childfolder)\nrescue => logstring\nensure\n Mcmlln::Tools.logtoJson(@log_hash, logkey, logstring)\nend", "def destroy\n @redis_database = RedisDatabase.find(params[:id])\n @redis_database.destroy\n tflash('delete', :success, {:model=>@@model, :count=>1})\n respond_to do |format|\n format.html { redirect_to(redis_databases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @systemlog.destroy\n respond_to do |format|\n format.html { redirect_to systemlogs_url, notice: 'Systemlog was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_log name\n ensure_connection!\n resp = connection.delete_log name\n if resp.success?\n true\n else\n fail ApiError.from_response(resp)\n end\n end", "def destroy\n @service_log = ServiceLog.find(params[:id])\n @service_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(truck_service_logs_path(params[:truck_id])) }\n format.xml { head :ok }\n end\n end", "def deleteFileFromServer(filepath)\n filepath = filepath[1, filepath.length - 1] \n address = @@host + \"/user/\" + @@conf[\"username\"] + \"/device/\" + @@conf[\"dev_name\"] + \"/files/\" + filepath\n \n res = HttpRequest.new(:delete, address).send(@@host) \n puts res\n puts \"CODE: \" + res.code\n\nend", "def destroy\n @log.destroy\n respond_to do |format|\n format.html { redirect_to logs_url, notice: 'Shift was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @logentry.destroy\n respond_to do |format|\n format.html { redirect_to logentries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stash = Stash.find(params[:id])\n @stash.destroy\n\n respond_to do |format|\n format.html { redirect_to stashes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ncr_api_log.destroy\n respond_to do |format|\n format.html { redirect_to ncr_api_logs_url, notice: 'Ncr api log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @web_process_log.destroy\n respond_to do |format|\n format.html { redirect_to web_process_logs_url, notice: 'Web process log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @input_log.destroy\n respond_to do |format|\n format.html { redirect_to input_logs_url, notice: 'Input log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @red_packet_history.destroy\n respond_to do |format|\n format.html { redirect_to admin_red_packet_histories_url, notice: 'Red packet history was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @history_log = HistoryLog.find(params[:id])\n @history_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(history_logs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @activity_log.destroy\n respond_to do |format|\n format.html { redirect_to activity_logs_url, notice: 'Activity log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nginxtest.destroy\n respond_to do |format|\n format.html { redirect_to nginxtests_url, notice: \"Nginxtest was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @rcadmin_login_log.destroy\n respond_to do |format|\n format.html { redirect_to rcadmin_login_logs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crash_test = CrashTest.find(params[:id])\n @crash_test.destroy\n\n respond_to do |format|\n format.html { redirect_to crash_tests_url }\n format.json { head :no_content }\n end\n end", "def remove_last_alive_log\n AmqpAuditLog.where(routing_key: '-.-.-.alive.-.-.-.-').order(id: :desc)\n .offset(20).destroy_all\n end", "def destroy\n @punch_log.destroy\n respond_to do |format|\n format.html { redirect_to punch_logs_url, notice: 'Punch log was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dataload_ftp = DataloadFtp.find(params[:id])\n @dataload_ftp.destroy\n\n respond_to do |format|\n format.html { redirect_to dataload_ftps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @subscription_fu_log = SubscriptionFuLog.find(params[:id])\n @subscription_fu_log.destroy\n\n respond_to do |format|\n format.html { redirect_to(subscription_fu_logs_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.65134597", "0.63074255", "0.6267674", "0.6016508", "0.5971034", "0.5964369", "0.5955268", "0.5905765", "0.58796513", "0.58387285", "0.5835509", "0.5817114", "0.57980984", "0.5797562", "0.57947713", "0.5781482", "0.5780291", "0.5770592", "0.57682425", "0.5756064", "0.5753445", "0.5745263", "0.5737964", "0.5724496", "0.57240534", "0.5716171", "0.56941205", "0.56882095", "0.5684539", "0.56778836", "0.56774735", "0.56750685", "0.5672931", "0.5651722", "0.56500995", "0.56393695", "0.56391543", "0.5632637", "0.56233805", "0.5623151", "0.56205404", "0.56172514", "0.56171995", "0.56170374", "0.56165093", "0.5614705", "0.5613561", "0.5612559", "0.56107867", "0.56107867", "0.56085104", "0.56078357", "0.56047165", "0.56044567", "0.5601614", "0.55959076", "0.5594522", "0.55914056", "0.5584068", "0.5581504", "0.55793166", "0.5574135", "0.5574012", "0.55735606", "0.5567905", "0.55657727", "0.5563523", "0.5561655", "0.55562264", "0.5555787", "0.55537367", "0.55531436", "0.55512184", "0.55509573", "0.5548253", "0.5545325", "0.5530679", "0.5524262", "0.55232716", "0.55169845", "0.5515027", "0.55142003", "0.5512304", "0.5510831", "0.55107236", "0.5506122", "0.55015856", "0.54951173", "0.5489068", "0.5488372", "0.5483215", "0.54817414", "0.5478991", "0.547192", "0.5468358", "0.54682463", "0.54679906", "0.5467623", "0.5454492", "0.54537106" ]
0.7358373
0
Use callbacks to share common setup or constraints between actions.
def set_tcpdump_log @tcpdump_log = TcpdumpLog.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_handler\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 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 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 action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def before_dispatch(env); end", "def process_action(...)\n send_action(...)\n end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def config(action, *args); 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 before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup_signals; 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 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 after_set_callback; end", "def setup\n #implement in subclass;\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; end", "def around_hooks; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def call\n setup_context\n super\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.5328757", "0.5310255", "0.5300339", "0.5298796", "0.5295774", "0.5256034", "0.5243039", "0.5236007", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.52321917", "0.5227032", "0.52216744", "0.5216349", "0.52161187", "0.5210265", "0.5207244", "0.5177388", "0.5177142", "0.51747334", "0.516293", "0.51629275", "0.5155534", "0.51540613", "0.515197", "0.5151636", "0.5145279", "0.51380795", "0.5135777", "0.5117378", "0.5115066", "0.5115066", "0.5110235", "0.5106418", "0.50917816", "0.50909185", "0.50855017", "0.5082105", "0.506359", "0.5055345", "0.50546116", "0.50523037", "0.50523037", "0.50327307", "0.5024364", "0.5021113", "0.50174654", "0.50163317", "0.5000553", "0.50002855", "0.49991882", "0.49905527", "0.49905527", "0.49849054", "0.4982546", "0.4980941", "0.4979153", "0.49693102", "0.4967172", "0.49594432", "0.49564302", "0.49552485", "0.49533385", "0.49506924", "0.49452737", "0.49442786", "0.49347955", "0.49341312", "0.49295264", "0.49261844", "0.4925649", "0.49251428", "0.4920729", "0.49177617", "0.4916373", "0.49158472", "0.4915794", "0.49156648" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def tcpdump_log_params params.require(:tcpdump_log).permit(:user_id, :user_data) 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
This is the depth first method It uses recursion to dive deep as possible. When there are no more children, it checks if the payload matches the target before backing downwards. It eventually gives up when the first_node has no more children and doesn't match the payload.
def depth_first(node, target) if node.children node.children.each do |child| depth_first(child, target) end end return 'Found your target' if node.payload == target 'No luck' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def breadth_first(node, target)\n # Setup\n queue = Queue.new\n queue.enqueue(node)\n # While queue exists\n while queue.elements?\n # Pop bottom off\n current_node = queue.dequeue\n # Check if it is target or nil\n return 'Could not locate your payload :(' if current_node.nil?\n return 'Found your target' if current_node.payload == target\n # Otherwise add its children to\n # back of line for checking\n add_kids_to_queue(current_node, queue)\n end\nend", "def iterative_depth_first(target)\n return self if @value == target\n stack = []\n stack << self\n while !stack.empty?\n popped = stack.pop\n return popped if popped.get_value == target\n right_child = popped.get_right_pointer\n if !right_child.nil?\n stack << right_child\n end\n left_child = popped.get_left_pointer\n if !left_child.nil?\n stack << left_child\n end\n end\n return nil\n end", "def depth_first_search(target)\n return @root if @root.value == target\n search_stack = [@root]\n until search_stack.empty?\n test_node = search_stack.pop\n\n if test_node.value == target\n return test_node\n else\n search_stack << test_node.right_child unless test_node.right_child.nil?\n search_stack << test_node.left_child unless test_node.left_child.nil?\n end\n end\n\n nil\n\tend", "def depth_first(value_to_find)\r\n @children.each do |child|\r\n found_node = child.depth_first(value_to_find)\r\n if found_node != nil\r\n return found_node\r\n end\r\n end\r\n\r\n if payload == value_to_find\r\n return self\r\n else\r\n return nil\r\n end\r\n end", "def search_recursive(root,target_value)\n\n return root if root.payload == target_value\n\n root.children.each do |child|\n node = search_recursive(child,target_value)\n return node if node\n end\n\n return nil\n\nend", "def depth_first_search(target)\n stack = [@root]\n while ! stack.empty?\n node = stack.pop\n if node.value == target\n return node\n else \n if node.value < target && node.right_child != nil\n stack = stack << node.right_child\n end\n if node.value > target && node.left_child != nil\n stack = stack << node.left_child\n end\n end\n end\n return nil\n end", "def recursive_depth_first(target)\n match = @left.recursive_depth_first(target) unless @left.nil?\n return match unless match.nil?\n return self if @value == target\n return (@right.nil?) ? nil : @right.recursive_depth_first(target)\n end", "def depth_first_search(target)\n stack = Array.new\n stack.push(@root)\n\n while !stack.empty?\n\n element = stack.pop\n\n return element if element.value == target\n\n stack.push(element.leftchild) if !element.leftchild.nil?\n stack.push(element.rightchild) if !element.rightchild.nil?\n\n end\n\n return nil\n end", "def depth_first_search(target)\n stack = [@root]\n visited = []\n\n until stack.empty?\n node = stack[-1]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n stack << node.left\n elsif node.right && !visited.include?(node.right)\n stack << node.right\n else\n stack.pop\n end\n end\n end", "def depth_first_search(target)\n # create an array that acts like a stack\n stack = [self]\n # visited array keeps the visited nodes\n visited = []\n \n # search until there are no nodes left\n until stack.length == 0\n # get the last element in the stack\n node = stack[-1]\n\n # mark current node as visited\n visited << node\n\n # return the current node if the target value found\n return node if node.value == target\n \n # if there is unvisited left node, add it to stack\n if node.left && !visited.include?(node.left)\n stack << node.left\n # else if there is unvisited right node, add it to stack\n elsif node.right && !visited.include?(node.right)\n stack << node.right\n # if there are no visited children, pop the node from stack\n else\n stack.pop\n end\n end\n nil\n end", "def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end", "def breadth_first_search(target)\n\t\tsearch_queue = []\n\t\tinitial_node = @root\n\t\tsearch_queue << initial_node\n\n\t\treturn nil if @root.nil?\n\n\t\tuntil search_queue.empty?\n\t\t\ttest_node = search_queue.shift\n\n\t\t\tif test_node.value == target\n\t\t\t\treturn test_node\n\t\t\telse\n\t\t\t\tsearch_queue << test_node.left_child unless test_node.left_child.nil?\n\t\t\t\tsearch_queue << test_node.right_child unless test_node.right_child.nil?\n\t\t\tend\n\t\tend\n\t\tnil\n\tend", "def dfs_iterative(target)\n stack = [self]\n\n until stack.empty?\n node = stack.pop\n\n return node if node.value == target\n\n node.children.each do |child|\n stack << child\n end\n end\n\n nil\n end", "def DFS(root, target)\n ## base case: \n return nil if root.nil?\n return root if root.value == target\n ##indecutive step: \n ## DFS on the left side then DFS on the right side \n root.children.each do |child|\n search_result = DFS(child, target) ## better to save the actual value then check the value then return nil\n return search_result unless search_result.nil?\n end \n return nil\nend", "def breadth_first_search target_value, root=@root\n return nil if empty?\n\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n\n # Return value if found\n return current if current.value == target_value\n\n # Add children to the queue, if they exist\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n\n # returns nil if value not found\n nil\n end", "def depthFirstSearch(target, node)\n\treturn nil if node.nil? # checks if node is nil\n\tif node.data == target\n\t\treturn node\n\telse\n\t\tnode.children.each do |n|\n\t\t\tt = depthFirstSearch(target, n) # checks child for target\n\t\t\tnext if t.nil?\n\t\t\treturn t\n\t\tend\n\tend\n\treturn nil\nend", "def breadth_first_search(target)\n queue = [@root]\n while ! queue.empty?\n node = queue.shift\n if node.value == target\n return node\n else\n if node.value > target && node.left_child != nil\n queue = queue << node.left_child\n end\n if node.value < target && node.right_child != nil \n queue = queue << node.right_child\n end\n end\n end\n return nil\n end", "def dfs(target)\n return self if self.value == target\n # debugger\n self.children.each do |node|\n dfs(node)\n # if node.value == target\n # return node\n # else\n # node.dfs(target)\n # end\n end\n return nil if self.children.empty?\n p new_arr\n end", "def breadth_first_search(target)\n queue = Array.new\n queue.unshift(@root)\n\n while !queue.empty?\n\n element = queue.shift\n\n return element if element.value == target\n\n queue << element.leftchild if !element.leftchild.nil?\n queue << element.rightchild if !element.rightchild.nil?\n\n end\n\n return nil\n\n end", "def dfs(tree, target)\n\n node_stack = [ ]\n\n #push root\n node_stack.push(tree[0])\n\n # can also set current_node and do `while current_node`\n while node_stack.length > 0\n\n # pop first\n node = node_stack.pop\n\n # then do or look for something, generally w conditional\n if node == target\n return true\n else\n # seems multiple ways to do, but doing right before left\n # makes sense to me, even though most do left before right.\n # With my way, the left is pop'd first and you go down left\n # side first\n\n #### BELOW IS NOT RIGHT -- THERE HAS TO BE SOME RECURSSION HERE\n # This actually is starting to make sense: https://github.com/brianstorti/ruby-graph-algorithms/blob/master/depth_first_search/depth_first_search.rb\n #http://haozeng.github.io/blog/2014/01/05/trees-in-ruby/\n #https://github.com/breadoliveoilsalt/depth-first-search-lab-v-000/blob/solution/index.js\n if node.left\n node_stack.push(node.left)\n end\n if node.right\n node_stack.push(node.right)\n end\n end\n end\n\n return false\n\nend", "def bfs_iterative(target)\n queue = [self]\n\n until queue.empty?\n node = queue.shift\n\n return node if node.value == target\n\n node.children.each do |child|\n queue << child\n end\n end\n\n nil\n end", "def first(path_stack, node); end", "def bfs(target_value)\n child_arr = [self]\n # children.each {|child| children_arr << child }\n while child_arr.length > 0\n node_to_check = child_arr.shift\n return node_to_check if node_to_check.value == target_value\n node_to_check.children.each { |child| child_arr << child }\n end\n nil\n end", "def depth_first_search(query)\n stack = [@tree]\n\n loop do\n# exit when empty stack\n return nil if stack.empty?\n\n# node is equal to top of stack\n node = stack.pop\n \n# return node if match\n return node if query == node.value\n\n# i think it is pushing every descendant of the parent?\n stack.push node.left_child if node.left_child != nil\n stack.push node.right_child if node.right_child != nil\n end\n end", "def dfs(root, target)\n return root if root.value == target\n root.children.each do |child|\n search_result = dfs(child, target)\n return search_result unless search_result.nil?\n end\n\n nil\nend", "def breadth_first_search(target)\n queue = [@root]\n visited = []\n\n until queue.empty?\n node = queue[0]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n queue << node.left\n end\n if node.right && !visited.include?(node.right)\n queue << node.right\n end\n queue.shift\n end\n end", "def breadth_first_search(start_node, target_value)\n\t\tvisited = [start_node]\t\t\t\n\t\tqueue = [start_node]\n\t\n\t\twhile ( queue.length > 0 )\t\n\n\t\t\t# dequeue\n\t\t\tvertex = queue.shift\n\t\t\treturn vertex if target_value.name == vertex.name\n\t\n\t\t\t# visit all adjacent unvisited vertexes, mark visited, enqueue\n\t\t\tNode.childPointers.each do |child|\n\t\t\t\tif !eval(\"vertex.#{child}.nil?\")\n\t\t\t\t\tif !eval(\"visited.include?vertex.#{child}\")\n\t\t\t\t\t\tvisited << eval(\"vertex.#{child}\")\n\t\t\t\t\t\teval(\"vertex.#{child}.prev = vertex\")\n\t\t\t\t\t\tqueue << eval(\"vertex.#{child}\")\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tnil\n\tend", "def dfs_rec(target, current_node=@root)\n return if current_node.nil?\n return current_node if current_node.value == target\n dfs_rec(target, current_node.left_child) ||\n dfs_rec(target, current_node.right_child)\n\tend", "def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend", "def depth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n stack = [tree[0]]\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n puts current.value\n puts connections.count\n puts \"---\"\n \n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n if connections.count < 1\n stack.pop\n current = stack[-1]\n elsif connections.count == 1\n if visited.include?(connections[0])\n stack.pop\n current = stack[-1]\n else\n current = connections[0]\n stack.push(current)\n visited.push(current)\n end\n else\n if visited.include?(connections[0]) && visited.include?(connections[1])\n stack.pop\n current = stack[-1]\n elsif !visited.include?(connections[0])\n current = connections[0]\n stack.push(current)\n visited.push(current)\n else\n current = connections[1]\n stack.push(current)\n visited.push(current)\n end\n end\n end\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def dfs_object(root_node, target)\n #two base cases\n return root_node if root_node.value == target\n # return nil if root_node.parent.nil? #when there are no parents, we know we're back at the actual root of the tree\n\n root_node.children.each do |child_node|\n result = dfs(child_node, target)\n\n #returning nil at this point would cut short\n if result #is not nil\n return result\n end\n end\n\n nil\nend", "def depth_first_search(value, stack = [Node.get_root_node])\n node = stack[0]\n\n if !node.value.nil?\n puts \"Searching node #{node.value}...\"\n if node.value == value\n puts \"Found #{value} at node #{node}!\"\n return node\n end\n end\n\n left_child = node.left_child\n right_child = node.right_child\n\n if !left_child.nil?\n puts \"Left child is #{left_child.value}.\"\n else\n puts \"No left child.\"\n end\n\n if !right_child.nil?\n puts \"Right child is #{right_child.value}.\"\n else\n puts \"No right child.\"\n end\n\n if !left_child.nil?\n stack << left_child\n stack.shift\n return node if !depth_first_search(value, stack).nil?\n else\n nil\n end\n\n if !right_child.nil?\n stack << right_child\n stack.shift\n return node if !depth_first_search(value, stack).nil?\n else\n nil\n end\n\nend", "def bsearch_tree(node, target)\n return target if node == target\n y = nil\n node.each do |x|\n if x.is_a? node.class\n y = bsearch_tree(x, target)\n else\n return target if x == target\n end\n end\n y\nend", "def dfs_rec(target,current,array_length,stack,visited)\n left = current.find_left_child[0]\n right = current.find_right_child[0]\n parent = current.find_parent[0]\n if current.value == target\n return current\n elsif visited.length == array_length\n return nil\n elsif !left.nil? && !visited.include?(left)\n stack.push(left)\n visited.push(left)\n dfs_rec(target,left,array_length,stack,visited)\n elsif !right.nil? && !visited.include?(right)\n stack.push(right)\n visited.push(right)\n dfs_rec(target,right,array_length,stack,visited)\n else\n stack.pop\n dfs_rec(target,parent,array_length,stack,visited)\n end\nend", "def depth_first_search(tree, value)\n tgt_node = nil\n \n stack = Array(tree)\n \n while !stack.empty?\n cur_node = stack.pop\n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.reverse_each { |child| stack.push(child) unless child.nil? }\n end\n \n tgt_node\nend", "def bfs(target)\n q = [self]\n until q.empty?\n shifted = q.shift\n return shifted if shifted.value == target\n q += shifted.children\n # debugger\n end\n nil\n end", "def question_1(root, target)\n return false if root.nil?\n stack = [root]\n until stack.empty?\n current = stack.pop\n return true if current.value == target.value\n stack << current.right if !current.right.nil?\n stack << current.left if !current.left.nil?\n end\n false\nend", "def build_move_tree(node)\n queue = [node]\n until queue.empty?\n current_node = queue.shift\n return current_node if current_node.value == target_value\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\n end", "def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend", "def bfs(target)\n queue = [self]\n until queue.empty?\n return queue.first if queue.first.position == target\n queue += queue.first.children\n queue.shift\n end \n end", "def depth_first_search_pre_order(data)\n stack = [@root]\n node_match = nil\n match_found = false\n until stack.empty? || match_found || @root.nil?\n cur_node = stack.pop\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n end\n right = cur_node.right_child\n stack.push(right) unless right.nil?\n left = cur_node.left_child\n stack.push(left) unless left.nil?\n end\n return node_match\n end", "def depth_first_search(adj_matrix, source_index, end_index)\n node_stack = [source_index]\n # The code uses a forever loop and then breaks when we encounter certain conditions.\n loop do\n curr_node = node_stack.pop\n return false if curr_node == nil\n return true if curr_node == end_index\n\n # Out of the adjacency matrix, pick the “children” of curr_node by checking the 1’s in the adjacency matrix\n children = (0..adj_matrix.length-1).to_a.select do |i| \n adj_matrix[curr_node][i] == 1\n end\n \n # Take those nodes and push them onto the end of the stack\n node_stack = node_stack + children\n end\n end", "def breadth_first_search(tree, value)\n tgt_node = nil\n \n queue = Array(tree)\n \n while !queue.empty?\n cur_node = queue.shift \n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.each { |child| queue << child unless child.nil? }\n end\n \n tgt_node\nend", "def first_below(node, stack, branch=0)\n # Return node if node is a leaf\n if node.leaf?\n stack.push [node, node.peek_item.key]\n return node, stack\n end\n\n # Append node to ancestry stack for traversal\n if stack.empty?\n stack.push [node, NodeID.new]\n\n else\n if v2?\n stack.push [node, NodeID.new(:depth => node.depth,\n :key => node.common)]\n\n else\n stack.push [node, stack.last.last.child_node_id(branch)]\n end\n end\n\n # Iterate over non-empty branches\n i = 0\n while i < 16\n if !node.empty_branch?(i)\n # descend into branch\n node = descend_throw(node, i)\n raise if stack.empty?\n\n # Return first leaf\n if node.leaf?\n stack.push [node, node.peek_item.key]\n return node, stack\n end\n\n # Continue tree descent at new level\n if v2?\n stack.push [node, NodeID.new(:depth => node.depth,\n :key => node.common)]\n\n else\n stack.push [node, stack.last.last.child_node_id(branch)]\n end\n\n i = 0 # scan all 16 branches of this new node\n\n else\n i += 1\n end\n end\n\n # No node found, return nil and the stack\n return nil, stack\n end", "def dfs_recursive(query, node=@tree) \n return nil if node.nil?\n return node if query == node.value\n\n# left search equals if the left child is not nil then call the method with target & left child node parameters, otherwise is nil\n left_search = node.left_child != nil ? dfs_recursive(query, node.left_child) : nil\n\n# return if left search does not result in nil\n return left_search if left_search != nil\n right_search = node.right_child != nil ? dfs_recursive(query, node.right_child) : nil\n return right_search if right_search != nil \n end", "def dfs(node, target)\n return nil if (node.nil?) \n return node if (node.val == target) \n left = dfs(node.left, target)\n right = dfs(node.right, target)\n left || right\nend", "def find_min(target_node)\n while (target_node.left_child)\n target_node = target_node.left_child \n end\n return target_node\n end", "def bfs(target_value)\n queue = []\n queue << self\n\n while queue.empty? == false\n check = queue.pop\n \n if check.value == target_value\n return check.value\n else\n queue.unshift(*check.children)\n end\n end\n \n false\n end", "def search root, target\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n return current if current.x == target.x && current.y == target.y\n\n current.make_children.each { |child| queue << child }\n end\nend", "def bfs(root, target)\n return nil if target.nil? || root.nil? # nothing to do if there is no target or root to begin the search\n queue = Queue.new\n queue.enq(root)\n result = nil\n while !queue.empty?\n value = queue.deq\n p value[:value]\n if value[:value] == target\n result = value\n break\n end\n\n # keep moving the levels in tree by pushing left and right nodes of tree in queue\n queue.enq(value[:left]) if value[:left]\n queue.enq(value[:right]) if value[:right]\n end\n\n result # returns node found in BST else default value nil\nend", "def depth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # Get next node from the stack\n node = @list.pop\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # Push each child on the stack, making sure the left child\n # will be popped off the stack first (LIFO)\n @list << node.right if node.right\n @list << node.left if node.left\n end\n @list.clear # remove any remaining items from the stack\n\t node\n end", "def depth_first_search(value)\n search_stack = [@root_node]\n\n until search_stack.empty?\n curr_node = search_stack.pop\n return curr_node if curr_node.value == value\n search_stack << curr_node.left unless curr_node.left.nil?\n search_stack << curr_node.right unless curr_node.right.nil?\n end\n return nil\n end", "def bfs(target_value)\n queue = [self]\n\n until queue.empty?\n head = queue.shift\n return head if head.value == target_value\n\n head.children.each { |child| queue << child }\n end\n end", "def peek_next_item(id, stack)\n raise if stack.empty?\n raise unless stack.last.first.leaf?\n stack.pop\n\n until stack.empty?\n node, node_id = *stack.last\n raise if node.leaf?\n\n # Select next higher tree branch\n inner = node\n (node_id.select_branch(id) + 1).upto(15) { |b|\n next if inner.empty_branch?(b)\n node = descend_throw(inner, b)\n leaf, stack = *first_below(node, stack, b)\n raise unless leaf && leaf.leaf?\n return leaf, stack\n }\n\n stack.pop\n end\n\n return nil\n end", "def traverse_starter (node)\n return if node == nil\n traverse(node, 0)\n traverse_starter(node.left) if node.left\n traverse_starter(node.right) if node.right\nend", "def walk_towards_key(key)\n stack = []\n\n # Start with root node\n in_node = root\n node_id = NodeID.new\n\n # Iterate until node is no longer inner\n while in_node.inner?\n stack.push [in_node, node_id]\n\n return nil, stack if v2? && in_node.common_prefix?(key)\n\n # Select tree branch which has key\n # we are looking for, ensure it is not empty\n branch = node_id.select_branch(key)\n return nil, stack if in_node.empty_branch?(branch)\n\n # Descend to branch node\n in_node = descend_throw in_node, branch\n if v2?\n if in_node.inner?\n node_id = NodeID.new :depth => in_node.depth,\n :key => in_node.common\n else\n node_id = NodeID.new :depth => 64,\n :key => in_node.key\n end\n\n else\n # Get ID of branch node\n node_id = node_id.child_node_id branch\n end\n end\n\n # Push final node (assumably corresponding to key)\n stack.push [in_node, node_id]\n\n # Return final node (corresponding to key) and stack\n return in_node, stack\n end", "def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end", "def depth_first_search(tree, value, args = {})\r\n verbose = args.fetch(:verbose, false)\r\n return nil if tree == nil\r\n next_node = [tree]\r\n while !next_node.empty?\r\n current = next_node.pop\r\n if verbose\r\n puts \"current = #{current}\"\r\n puts \"head = #{next_node[0]}\"\r\n end\r\n # visited not strictly necessary for future proofs it \r\n if current.visited == false\r\n current.visited = true\r\n return current if current.value == value\r\n current.children.each { |child| next_node.push child if child } \r\n end\r\n end\r\n nil\r\n end", "def bfs(root, target)\n queue = []\n queue << root\n\n until queue.empty?\n current = queue.shift\n\n next if current.nil?\n return true if current.val == target\n\n queue << current.left\n queue << current.right\n end\n\n return false\nend", "def find_target(root, target)\n\t\ttree = Tree.new\n\t\ttree.root = Node.new(root)\n\t\tque = [tree.root]\n\t\tuntil que[0].value==target\n\t\t\tpossible_moves(que[0].value).each do |move|\n\t\t\t\tnew_node = Node.new(move)\n\t\t\t\tque[0].children << move\n\t\t\t\tnew_node.parent = que[0]\n\t\t\t\tque << new_node\n\t\t\tend\n\t\t\tque.shift\n\t\tend\n\t\treturn que[0] #Returns the node at the position we want the knight to move to, which has the parent data we are looking for.\n\tend", "def dfs_rec(target, node = @root)\n return \"Found target: #{target} at node #{node}\" if node.value == target # base case\n\n left_check = dfs_rec(target, node.left) if node.left\n right_check = dfs_rec(target, node.right) if node.right\n\n return left_check if left_check\n return right_check if right_check\n end", "def depth_first_search node= self.root, value\n\t\tstack =[node]\n\n\t\twhile stack.length > 0\n\t\t\tcurrent = stack.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tstack.push(current.left) if current.left\n\t\t\tstack.push(current.right) if current.right\n\t\tend\n\tend", "def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def first( path_stack, node )\n return nil if path.size == 0\n\n case path[0]\n when :document\n # do nothing\n return first( path[1..-1], node )\n when :child\n for c in node.children\n r = first( path[1..-1], c )\n return r if r\n end\n when :qname\n name = path[2]\n if node.name == name\n return node if path.size == 3\n return first( path[3..-1], node )\n else\n return nil\n end\n when :descendant_or_self\n r = first( path[1..-1], node )\n return r if r\n for c in node.children\n r = first( path, c )\n return r if r\n end\n when :node\n return first( path[1..-1], node )\n when :any\n return first( path[1..-1], node )\n end\n return nil\n end", "def breadth_first\n return do_breadth_first( [Node.new(@start)], Set.new, @dest)\n end", "def dfs(root, target)\n return false if root.nil?\n return true if root.val == target\n\n return dfs(root.left, target) || dfs(root.right, target)\nend", "def bfs(target_value)\n queue = [self]\n until queue.empty?\n checkme = queue.shift\n return checkme if checkme.value == target_value\n queue.concat(checkme.children)\n end\n nil\n\n end", "def test_first_sibling\n setup_test_tree\n\n # TODO: Need to fix the first_sibling method to return nil for nodes with no siblings.\n assert_same(@root, @root.first_sibling, \"Root's first sibling is itself\")\n assert_same(@child1, @child1.first_sibling, \"Child1's first sibling is itself\")\n assert_same(@child1, @child2.first_sibling, \"Child2's first sibling should be child1\")\n assert_same(@child1, @child3.first_sibling, \"Child3's first sibling should be child1\")\n assert_same(@child4, @child4.first_sibling, \"Child4's first sibling should be itself\")\n assert_not_same(@child1, @child4.first_sibling, \"Child4's first sibling is itself\")\n end", "def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n else\n q = MyQueue.new\n end\n current_tree = q.dequeue()\n end\nend", "def depth_first_search_recursive(source)\n visited.add(source)\n\n source.neighbors.each do |neighbor|\n unless visited.include?(neighbor)\n depth_first_search_recursive(neighbor)\n meta[neighbor] = source\n end\n end\n end", "def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do |term|\r\n steps[term] = 1\r\n end\r\n end\r\n #Here goes the graph algorithm\r\n while !search_queue.empty?\r\n person = search_queue.shift()\r\n if !( searched.include?(person) )\r\n\r\n if logic_function.call(person)\r\n if returned == \"steps\"\r\n return steps[person]\r\n end\r\n if returned == \"found\"\r\n return true\r\n end\r\n else\r\n if !(graph[person].nil?) \r\n graph[person].each do |related|\r\n steps[related] = steps[person] + 1 #Setting up the steps of parents of the current element in the queue\r\n end\r\n search_queue = search_queue.concat(graph[person])\r\n end\r\n end\r\n\r\n end\r\n end\r\n return false\r\nend", "def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend", "def breadth_first_search(data)\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n return node_match\n end", "def dfs_rec(cur_node, value)\n return nil if cur_node.nil?\n \n if cur_node.value == value\n\tcur_node\n else\n tgt_node = nil\n cur_node.children.each do |child| \n\t tgt_node = dfs_rec(child, value)\n\t break unless tgt_node.nil?\n\tend\n\ttgt_node\n end\nend", "def dfs_rec(target, root = @root_node)\n\t\tlocation = dfs_rec(target, root.small_child) if root.small_child != nil\n\t\treturn location if location != nil\n\t\treturn root if root.value == target\n\t\tlocation = dfs_rec(target, root.big_child) if root.big_child != nil\n\t\tlocation\n\tend", "def depth_first_search(node)\n return if node.nil?\n node.visit\n node.connections.each do |conn|\n depth_first_search(conn) unless conn.visited\n end\nend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def go_to_bottom(nodes=nil, target)\n\t\tnext_row = []\n\n\t\tif nodes.nil?\n\t\t\tnodes = [self.root]\n\t\tend\n\n\t\tnodes.each do |node|\n\t\t\tif node.left.nil?\n\t\t\t\tnode.left = target\n\t\t\t\tnode.left.parent = node\n\t\t\t\treturn\n\t\t\telsif node.right.nil?\n\t\t\t\tnode.right = target\n\t\t\t\tnode.right.parent = node\n\t\t\t\treturn\n\t\t\telse\n\t\t\t\tnext_row << node.left\n\t\t\t\tnext_row << node.right\n\t\t\tend\n\t\tend\n\n\t\tif next_row.count > 0\n\t\t\tgo_to_bottom(next_row, target)\n\t\tend\n\tend", "def depth_first_search_pre_order_with_debug(data)\n search_order = [] # For Debug output\n stack = [@root]\n node_match = nil\n match_found = false\n until stack.empty? || match_found || @root.nil?\n cur_node = stack.pop\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n end\n right = cur_node.right_child\n stack.push(right) unless right.nil?\n left = cur_node.left_child\n stack.push(left) unless left.nil?\n end\n puts \"Pre_order depth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end", "def find(root, data) #like a stack\n if data === nil #if data is nil\n return nil\n elsif root.title === data #if root matches data\n return root\n elsif root.title != data && root.left === nil #if root is dif from data and left is empty\n if root.right === data\n return root.right\n elsif root.right === nil\n return nil\n else\n find(root.right, data)\n end\n elsif root.title != data && root.left != nil #if root is dif from data and left is not empty\n if root.left === data\n return root.left\n else\n find(root.left, data)\n end\n end\n end", "def find_target(root, k)\n return nil if root == nil\n hash = Set.new([])\n queue = [root]\n \n while !queue.empty?\n node = queue.shift\n \n return true if hash.include?(node.val)\n \n hash.add(k-node.val)\n \n if node.left; queue.push(node.left) end\n if node.right; queue.push(node.right) end\n end\n \n return false\nend", "def bread_first_search(first)\n puts sprintf(\"%-25s %s\", \"Queue: [ bottom - top ]\", \"Visited list\")\n enqueue(first)\n insert_visited(first)\n print\n\n while !queue.empty?\n element = dequeue # => |V|\n @source.fetch(element).each do |s| \n unless @visited.include?(s) # => |E|\n enqueue(s)\n @T.push([element,s]) \n insert_visited(s) \n end\n end\n print\n end\n # spanning tree\n p @T\n end", "def explore_downwards(node)\n node = node.left until node.left.nil?\n node.data\nend", "def dfs(target_value)\n #self = individual possible values\n return self if self.value == target_value \n self.children.each do |child|\n leaves = child.dfs(target_value)\n return leaves unless leaves.nil?\n end\n nil\n end", "def find(root, data)\n return unless root && data \n if root.title != data\n target ||= self.find(root.right, data)\n return target if target\n target ||= self.find(root.left, data)\n else\n return root\n end\n end", "def bfs(target = nil, &prc)\n raise \"Need a proc or target\" if [target, proc].none?\n prc ||= Proc.new { |node| node.value == target }\n\n nodes = [self]\n until nodes.empty?\n node = nodes.shift\n return node if prc.call(node)\n nodes.concat(node.children)\n end\n nil \nend", "def breadth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # get next node from the queue\n node = @list.shift\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # place each child in the queue, from left to right\n @list << node.left if node.left\n @list << node.right if node.right\n end\n @list.clear # remove any remaining items from the queue\n\t node\n end", "def dfs(target_value)\n # base case\n return self if @value == target_value\n # iterative case\n @children.each do |child|\n result = child.dfs(target_value)\n return result if result\n end\n nil\n end", "def node(path)\n current_nodes = root_nodes\n matching_node = nil\n path.each_with_index do |target_node, index|\n case current_nodes\n when Array\n matching_node = current_nodes.find {|node| node.name == target_node} #TODO: make this work with regexes as well as strings...\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n when Bewildr::Element\n if current_nodes.name == target_node #TODO: make this work with regexes as well as strings...\n matching_node = current_nodes\n else\n raise Bewildr::ElementDoesntExist\n end\n end\n raise Bewildr::ElementDoesntExist if matching_node.nil?\n if path.size != index + 1\n matching_node.expand\n load_all_items_hack\n current_nodes = matching_node.child_nodes\n end\n end\n return matching_node\n end", "def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend", "def explore_upwards(node)\n node = node.parent until node.parent.nil? || node.parent.left == node\n node.parent.nil? ? nil : node.parent.data\nend", "def find_beeper()\n while not next_to_a_beeper?()\n move_toward_beeper()\n end\n end", "def extract\n # 1. Extract root (guaranteed minimum value)\n root = @nodes.shift\n return root if empty? || size == 1\n\n # 2. Move last node to be new root\n @nodes.unshift(@nodes.pop)\n # Keep track of new root index so we can move it down\n new_r_i = 0\n \n # 3. Satisfy heap property (bubble-down):\n # Move the new root down the tree as long as it is\n # larger than its parent(s), making sure along the way\n # that we have not reached any terminating leaves\n while min_child(new_r_i) && \n @compare_fn[@nodes[min_child(new_r_i)][:value], @nodes[new_r_i][:value]]\n temp_i = min_child(new_r_i)\n swap(new_r_i, temp_i)\n new_r_i = temp_i\n break unless new_r_i\n end\n root\n end", "def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend", "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 breadth_first_search node= self.root, value\n\t\tqueue = [node]\n\t\twhile queue.length > 0\n\t\t\tcurrent = queue.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tqueue.unshift(current.left) if current.left\n\t\t\tqueue.unshift(current.right) if current.right\n\t\tend\n\tend", "def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n puts \"Breadth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end", "def depth_first(value)\n\tend", "def find(target_value)\n current = self.root\n while current do\n if current.value == target_value\n return current\n elsif current.value > target_value\n current = current.left\n else\n current = current.right\n end\n end\n return nil\n end", "def dfs(tree)\n # Return the tree if the root value matches the search value\n if @stack[-1].nil?\n return nil\n elsif @stack[-1]['value'] == @value || @stack[-1] == @value\n return @stack[-1]\n end\n \n # Add left tree to the stack if it exists, otherwise the right branch if it exists\n if @stack[-1]['branches']['left'].nil? == false\n @stack << tree['branches']['left']\n dfs(@stack[-1])\n elsif @stack[-1]['branches']['right'].nil? == false\n @stack << tree['branches']['right']\n elsif @stack[-1]['branches']['left'].nil? == false && @stack[-1]['branches']['right'].nil? == false\n @stack.pop\n end\n \n end" ]
[ "0.670371", "0.6650446", "0.6513655", "0.6368222", "0.63251084", "0.6279265", "0.6264661", "0.60817873", "0.60588306", "0.60422087", "0.6009444", "0.6006707", "0.5956425", "0.58821356", "0.5867668", "0.585436", "0.58422345", "0.5784777", "0.5778536", "0.57719797", "0.57342046", "0.5670052", "0.5669515", "0.56578636", "0.56454813", "0.56233424", "0.55706495", "0.5568383", "0.5564459", "0.55560595", "0.5545717", "0.55404645", "0.5536984", "0.55069053", "0.55031425", "0.54958737", "0.54895025", "0.5459637", "0.5446343", "0.5433548", "0.5426556", "0.538843", "0.5387422", "0.53667647", "0.53465784", "0.53427744", "0.5335057", "0.53201497", "0.53067964", "0.5300456", "0.5291855", "0.5282222", "0.5249647", "0.5234767", "0.52291656", "0.5225922", "0.52251875", "0.5218507", "0.5201745", "0.5188983", "0.51853096", "0.5175638", "0.5152806", "0.51524085", "0.5130459", "0.5118191", "0.5115384", "0.5113001", "0.50860083", "0.5085852", "0.50575995", "0.50558186", "0.5053164", "0.50420314", "0.50369835", "0.50248104", "0.5015872", "0.5015872", "0.50108576", "0.5009679", "0.5007411", "0.4972405", "0.49612084", "0.49447432", "0.49437532", "0.49436426", "0.4940504", "0.4934773", "0.493249", "0.49312457", "0.49268845", "0.49251065", "0.4922413", "0.49206918", "0.49188092", "0.49122527", "0.4902102", "0.48960662", "0.48844397", "0.4863701" ]
0.7293459
0
This is the breadth first method As it works its way through the tree, it adds what it finds to a queue. Because items are dequeued based on the order they come in a firstin, firstout (FIFO) fashion, the leaves are evaulated at the end the trunk at the beginning after its branches.
def breadth_first(node, target) # Setup queue = Queue.new queue.enqueue(node) # While queue exists while queue.elements? # Pop bottom off current_node = queue.dequeue # Check if it is target or nil return 'Could not locate your payload :(' if current_node.nil? return 'Found your target' if current_node.payload == target # Otherwise add its children to # back of line for checking add_kids_to_queue(current_node, queue) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bfs(tree, value)\n q = MyQueue.new\n q.enqueue(tree)\n current_tree = q.dequeue() #need to do something when i dequeue \n \n while current_tree != nil\n puts current_tree.payload\n\n if current_tree.payload != value\n current_tree.children.each do |leaf|\n q.enqueue(leaf)\n end\n else\n q = MyQueue.new\n end\n current_tree = q.dequeue()\n end\nend", "def bfs_search(queue, item)\n root = @tree.root\n queue.add(root)\n current_node = queue.pop\n until current_node == item || current_node.nil?\n queue.add(current_node.left_child)\n queue.add(current_node.add_child)\n current_node = queue.pop\n end\n return current_node\nend", "def bft(&block)\n queue = Queue.new\n \n # Set all nodes to not enqueued\n self.each do |node|\n node.enqueued = false\n end\n\n queue.push(self) \n self.enqueued = true\n\n while(queue.size > 0)\n # Get next node in the queue\n node = queue.pop\n \n # Pass node off to block\n block.call(node)\n\n # Enqueue all children nodes\n node.child_array.each do |child|\n if !child.enqueued\n queue.push(child)\n child.enqueued = true\n end\n end\n\n end #while\n end", "def breadth_first\n result = []\n queue = [self]\n while !queue.empty?\n node = queue.shift\n result << node\n node.children.sort.each do |child|\n queue << child\n end\n end\n return result\n end", "def bfs(tree)\n Enumerator.new do |yielder|\n queue = [tree]\n while !queue.empty?\n node = queue.shift\n children = node[1..-1]\n yielder << node.first\n children.each do |child|\n queue << child\n end\n end\n end\nend", "def bread_first_search(first)\n puts sprintf(\"%-25s %s\", \"Queue: [ bottom - top ]\", \"Visited list\")\n enqueue(first)\n insert_visited(first)\n print\n\n while !queue.empty?\n element = dequeue # => |V|\n @source.fetch(element).each do |s| \n unless @visited.include?(s) # => |E|\n enqueue(s)\n @T.push([element,s]) \n insert_visited(s) \n end\n end\n print\n end\n # spanning tree\n p @T\n end", "def breadth_first_search(data)\n node = nil\n @list << @root if @root\n\n until @list.empty?\n # get next node from the queue\n node = @list.shift\n puts \"Visiting node #{node.value}\" if @debug\n break if node.value == data\n # place each child in the queue, from left to right\n @list << node.left if node.left\n @list << node.right if node.right\n end\n @list.clear # remove any remaining items from the queue\n\t node\n end", "def bfs\n q = []\n list = []\n\n return [] if @root.nil?\n\n current_node = @root\n \n q.push(current_node)\n # put current node into queue\n while q.length != 0\n # put current node into list and delete from queue\n # add current node's children into the queue\n list.push({key: q[0].key, value: q[0].value})\n q.shift\n \n if current_node.left != nil \n q.push(current_node.left) \n end \n\n if current_node.right != nil \n q.push(current_node.right)\n end\n current_node = q[0] \n end \n\n return list\n end", "def bfs(target)\n queue = [self]\n until queue.empty?\n return queue.first if queue.first.position == target\n queue += queue.first.children\n queue.shift\n end \n end", "def bfs(val) \n queue = [self] \n\n until queue.empty? \n if queue.first.value == val\n return queue.first\n else\n queue.concat(queue.shift.children) #you add [] + children's children\n end\n end\n nil #if noting == val\n end", "def bfs\n # this is 'really' a traversal, but this type of search is similar to what we'll be doing with graphs and it's called 'breadth first search'\n list = []\n return list if @root.nil?\n queue = [@root]\n\n until queue.empty?\n # big O of shift is O(n)\n current = queue.shift\n # how to check if current has a left subtree?\n queue.push(current.left) unless current.left.nil?\n queue.push(current.right) unless current.right.nil?\n\n list << { key: current.key, value: current.value}\n end\n end", "def bfs(root)\n # NOTE implement real queue for performance\n queue = []\n root.marked = true\n queue.push(root)\n\n while !queue.empty?\n node = queue.shift\n node.visit\n\n node.adjacent.each do |node|\n if node.marked == false\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def breadthTraversal(path, parent = nil)\n\t@jobs.push Job.new(path, parent)\n\n\twhile not @jobs.empty?\n\t\tbtraverse(@jobs.pop)\n\tend\nend", "def traverse_bfs\n q = Queue.new\n q.push @tree\n \n loop do\n break if q.empty?\n node = q.shift\n if block_given?\n yield node\n else\n @visited << node.data\n end\n node.children.each{ |n| q.push n } if node.children\n end\n end", "def inorder\n @queue = []\n inorder_traversal(@root)\n @queue\n end", "def bfs\n bfs_queue = []\n curr = @root\n node_list = []\n while curr\n visit(curr, node_list)\n bfs_queue << curr.left if curr.left\n bfs_queue << curr.right if curr.right\n curr = bfs_queue.shift\n end\n return node_list\n end", "def breadth_first(value_to_find)\r\n current_node = self\r\n queue = MyQueue.new \r\n\r\n while current_node != nil\r\n if current_node.payload == value_to_find\r\n return current_node\r\n end\r\n current_node.children.each do |child|\r\n queue.enqueue(child)\r\n end\r\n current_node = queue.dequeue\r\n end\r\n end", "def printBreadthFirst()\n # println(\"printBreadthFirst\");\n #\n # // queues for pushing and saving all elements in \"breadth first search\" style\n # ArrayList items = new ArrayList();\n # ArrayList depths = new ArrayList();\n # ArrayList indicesParent = new ArrayList();\n #\n # // add first elements and startingpoint\n # items.add(this);\n # depths.add(0);\n # indicesParent.add(-1);\n #\n # // tmp vars for running in while loop\n # int index = 0;\n # int itemCount = 1;\n #\n # while (itemCount > index) {\n # FileSystemItem item = (FileSystemItem) items.get(index);\n # int depth = (Integer) depths.get(index);\n # int indexToParent = (Integer) indicesParent.get(index);\n #\n # // print four spaces for each level of depth + debug println\n # for (int i = 0; i < depth; i++) print(\" \");\n # println(index+\" \"+indexToParent+\"<-->\"+index+\" (\"+depth+\") \"+item.file.getName());\n #\n # // is current node a directory?\n # // yes -> push all children to the end of the items\n # if (item.file.isDirectory()) {\n # for (int i = 0; i < item.childCount; i++) {\n # items.add(item.children[i]);\n # depths.add(depth+1);\n # indicesParent.add(index);\n # }\n # itemCount += item.childCount;\n # }\n # index++;\n # }\n # println(index+\" files\");\n end", "def bfs_adj_list(queue, item)\n @checked_edges = []\n @current_node = start\n queue.add(@current_node)\n until current_node == item || current_node.nil?\n @current_node.linked_list.each do |next_node|\n queue.add(next_node)\n end\n current_node = queue.pop\n end\n return @current_node\n end", "def breadth_first_search(tree, value)\n tgt_node = nil\n \n queue = Array(tree)\n \n while !queue.empty?\n cur_node = queue.shift \n \n\tif cur_node.value == value\n\t tgt_node = cur_node\n\t break\n\tend\n\t\n\tcur_node.children.each { |child| queue << child unless child.nil? }\n end\n \n tgt_node\nend", "def bfs\n return [] if @root.nil?\n queue = []\n list = []\n queue.push(@root)\n while queue.length > 0\n curr_node = queue[0]\n list << {key: curr_node.key, value: curr_node.value}\n queue.push(curr_node.left) if curr_node.left\n queue.push(curr_node.right) if curr_node.right\n queue.shift\n end\n return list \n end", "def use_breadth_first(item, graph, logic_function = ->(x){graph[x].empty?} , returned = \"steps\" )\r\n search_queue = []\r\n steps = {}\r\n search_queue = search_queue.concat(graph[item])\r\n searched = []\r\n #Setting up initial steps \r\n if !search_queue.empty?\r\n search_queue.each do |term|\r\n steps[term] = 1\r\n end\r\n end\r\n #Here goes the graph algorithm\r\n while !search_queue.empty?\r\n person = search_queue.shift()\r\n if !( searched.include?(person) )\r\n\r\n if logic_function.call(person)\r\n if returned == \"steps\"\r\n return steps[person]\r\n end\r\n if returned == \"found\"\r\n return true\r\n end\r\n else\r\n if !(graph[person].nil?) \r\n graph[person].each do |related|\r\n steps[related] = steps[person] + 1 #Setting up the steps of parents of the current element in the queue\r\n end\r\n search_queue = search_queue.concat(graph[person])\r\n end\r\n end\r\n\r\n end\r\n end\r\n return false\r\nend", "def add_to_tree(curr_node, new_node, queue = [])\n if curr_node.nil?\n curr_node = new_node\n elsif curr_node.left_node.nil?\n curr_node.left_node = new_node\n elsif curr_node.right_node.nil?\n curr_node.right_node = new_node\n else\n queue.push(curr_node.left_node)\n queue.push(curr_node.right_node)\n next_node = queue.shift\n next_node = add_to_tree(next_node, new_node, queue)\n end\n curr_node\n end", "def breadth_first\n queue = []\n values = []\n queue << @root\n\n while queue.size > 0\n node = queue.shift\n queue << node.left unless node.left.nil?\n queue << node.right unless node.right.nil?\n\n values << node.value\n end\n\n values\n end", "def bfs_search(root)\n queue = []\n\n root.marked = true\n queue.push(root)\n\n while queue.length != 0\n current = queue.shift\n visit(current)\n\n current.adjacent.each do |node|\n if !node.marked\n node.marked = true\n queue.push(node)\n end\n end\n end\nend", "def breadth_first\n return do_breadth_first( [Node.new(@start)], Set.new, @dest)\n end", "def build_tree(start, finish, node = Node.new(start), queue = [node])\n @root = node\n\n until queue.index { |n| n.value == finish }\n node = queue.shift\n node.children = generate_move_nodes(node.value, finish)\n node.children.each { |c| queue << c }\n end\n end", "def level_order(queue = [@root])\n return [] if queue.empty? # base case where traversal is done\n\n node = queue.shift # dequeue\n queue.push(node.left) unless node.left.nil? # enqueue unless nil\n queue.push(node.right) unless node.right.nil? # enqueue unless nil\n # prepend the result to the result of recursive call\n level_order(queue).unshift(node.value)\n end", "def level_order(queue = [@root])\n return [] if queue.empty? # base case where traversal is done\n\n node = queue.shift # dequeue\n queue.push(node.left) unless node.left.nil? # enqueue unless nil\n queue.push(node.right) unless node.right.nil? # enqueue unless nil\n # prepend the result to the result of recursive call\n level_order(queue).unshift(node.value)\n end", "def enqueue(items)\n @in_stack = []\n items.each { |item| @in_stack << item }\nend", "def find_breadth_traversal_tree(in_order,post_order,level, h)\n # level => 0F 0T 1F 1T etc\n if in_order.size == nil || in_order.size == 0\n puts \"finish\"\n elsif in_order.size == 1\n # finish\n yield(level, in_order[0])\n puts \"#{level} \\t #{in_order[0]}\"\n else \n # this is not finished yet\n max_index_in_post = 0\n max_index_in_in = 0\n in_order.each_with_index do |in_ele,in_index|\n post_index = post_order.index(in_ele)\n\n if post_index > max_index_in_post\n max_index_in_post = post_index\n max_index_in_in = in_index\n end\n\n end\n current_root = in_order[max_index_in_in]\n yield(level, current_root)\n puts \"#{level} \\t #{current_root}\"\n\n level[0] = (Integer(level[0])+1).to_s\n next_level_f = level+\"F\"\n next_level_t = level+\"T\"\n front_of_in = in_order[0...max_index_in_in]\n tail_of_in = in_order[(max_index_in_in+1)...in_order.size]\n \n #\n find_breadth_traversal_tree(front_of_in,post_order,next_level_f, h) {|level,ele| h[level] = ele}\n find_breadth_traversal_tree(tail_of_in,post_order,next_level_t, h) {|level,ele| h[level] = ele}\n\n #\n end # end of else\n\n\nend", "def breadthFirstSearch(array)\n queue = [self]\n\n while queue.length > 0\n current = queue.shift\n array.append(current.name)\n for child in current.children\n queue.append(child)\n end\n end\n\n return array\n\n end", "def bfs\n list = []\n if @root\n queue = []\n queue << @root\n queue.each do |current|\n list << {key: current.key, value: current.value}\n queue << current.left if current.left\n queue << current.right if current.right\n end\n end\n return list\n end", "def bfs(target_value)\n queue = [self]\n\n until queue.empty?\n head = queue.shift\n return head if head.value == target_value\n\n head.children.each { |child| queue << child }\n end\n end", "def bfs(root, target)\n queue = []\n queue << root\n\n until queue.empty?\n current = queue.shift\n\n next if current.nil?\n return true if current.val == target\n\n queue << current.left\n queue << current.right\n end\n\n return false\nend", "def move_to_top_in_queue\n return unless in_queue?\n acts_as_queue_class.transaction do\n increment_queue_positions_on_higher_items\n assume_top_queue_position\n end\n end", "def build_move_tree(node)\n queue = [node]\n until queue.empty?\n current_node = queue.shift\n return current_node if current_node.value == target_value\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\n end", "def bfs_iterative(target)\n queue = [self]\n\n until queue.empty?\n node = queue.shift\n\n return node if node.value == target\n\n node.children.each do |child|\n queue << child\n end\n end\n\n nil\n end", "def breadth_first_search node= self.root, value\n\t\tqueue = [node]\n\t\twhile queue.length > 0\n\t\t\tcurrent = queue.pop\n\t\t\treturn \"Value #{value} found in #{current.to_s}\" if current.value == value\n\t\t\tqueue.unshift(current.left) if current.left\n\t\t\tqueue.unshift(current.right) if current.right\n\t\tend\n\tend", "def process_new_node(node)\n continue_unless_match(node) do\n if (node_in_queue = queue.find { |n| n.name == node.name }).present?\n if node.depth < node_in_queue.depth\n @requeued += 1\n queue.delete(node_in_queue)\n queue << node\n end\n elsif (node_in_queue = marked.find { |n| n.name == node.name }).present?\n if node.depth < node_in_queue.depth\n @unmarked += 1\n marked.delete(node_in_queue)\n queue << node\n end\n else\n @steps += 1\n queue << node\n end\n end\n end", "def add_to_queue(graph, queue, node, visited)\n graph.vertices[node].each do |child|\n unless visited[child]\n queue.push(child)\n visited[child] = true\n end\n end\n end", "def breadth_first_search(find,tree)\n current = tree[0]\n answer = \"\"\n queue = []\n visited = [tree[0]]\n \n condition = false\n until condition == true\n connections = [current.find_right_child[0],current.find_left_child[0]].compact\n if current.value == find\n answer = current\n condition = true\n elsif visited.count == tree.count\n answer = nil\n condition = true\n else\n connections.each do |i|\n if i.value == find\n answer = i\n condition = true\n elsif !visited.include?(i)\n visited.push(i)\n queue.push(i)\n end\n end\n end\n current = queue.shift\n end\n puts answer ? answer : \"Value not found!\"\n puts answer.value if answer != nil\nend", "def bfs\n result = []\n\n return result if @root.nil?\n\n queue = [@root]\n\n while !queue.empty?\n node = queue.shift\n\n result << { key: node.key, value: node.value }\n\n if node.left\n queue << node.left\n end\n\n if node.right\n queue << node.right\n end\n end\n\n return result\n end", "def breadth_first_search target_value, root=@root\n return nil if empty?\n\n queue = [root]\n\n until queue.empty?\n current = queue.shift\n\n # Return value if found\n return current if current.value == target_value\n\n # Add children to the queue, if they exist\n queue << current.left unless current.left.nil?\n queue << current.right unless current.right.nil?\n end\n\n # returns nil if value not found\n nil\n end", "def enqueue(node)\n #the double arrow means to PUSH the node into our q list\n @q << node\n end", "def dequeue\n return nil if self.empty?\n return @dequeue_stack.pop if !@dequeue_stack.empty?\n until @enqueue_stack.empty?\n @dequeue_stack.push(@enqueue_stack.pop)\n end\n @dequeue_stack.pop\n end", "def dequeue\n return nil if self.empty?\n return @dequeue_stack.pop if !@dequeue_stack.empty?\n until @enqueue_stack.empty?\n @dequeue_stack.push(@enqueue_stack.pop)\n end\n @dequeue_stack.pop\n end", "def build\n\t\t\tfifo_q = Array.new\n\t\n\t\t\t# Set the failures for the nodes coming out of the root node.\n\t\t\t@root.get.each_pair do |item, node|\n\t\t\t\tnode.failure = @root\n\t\t\t\tfifo_q.push node\n\t\t\tend\n\n\t\t\t# Set the failures in breadth-first search order\n\t\t\t# using a FIFO queue. A failure identifies the deepest node\n\t\t\t# that is a proper suffix of the current node. \n\t\t\twhile !fifo_q.empty?\n\t\t\t\tp_node = fifo_q.shift\n\t\t\t\tif p_node.get\n\t\t\t\t\tp_node.get.each_pair do |item, node|\n\t\t\t\t\t\t# Push the current node onto the queue, so any child\n\t\t\t\t\t\t# nodes can be processed later.\n\t\t\t\t\t\tfifo_q.push node \n\t\t\t\t\t\n\t\t\t\t\t\tf_node = p_node.failure\n\t\t\t\t\t\t\n\t\t\t\t\t\t# Follow the failures until we find a goto transition\n\t\t\t\t\t\t# or arrive back at the root node\n\t\t\t\t\t\twhile f_node.goto(item) == nil and !f_node.eql? @root\n\t\t\t\t\t\t\tf_node = f_node.failure\n\t\t\t\t\t\tend\n\n\t\t\t\t\t\tif f_node.eql? @root and f_node.goto(item) == nil\n\t\t\t\t\t\t\tnode.failure = @root\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tnode.failure = f_node.goto(item)\n\t\t\t\t\t\t\tif block_given?\n\t\t\t\t\t\t\t\tnode.output = yield node.output, (node.failure).output\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tif node.output && (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = node.output + (node.failure).output\n\t\t\t\t\t\t\t\telsif (node.failure).output\n\t\t\t\t\t\t\t\t\tnode.output = (node.failure).output\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tbuild_dfa if @type == :DFA\n\n\t\tend", "def each\n queue = [@root]\n until queue.empty?\n node = queue.shift\n queue += node.children\n yield node\n end\n end", "def level_order(current_node = root, queue = [])\n print \"#{current_node.value} \"\n queue << current_node.left unless current_node.left.nil?\n queue << current_node.right unless current_node.right.nil?\n return if queue.empty?\n\n level_order(queue.shift, queue)\n end", "def breadthFirstSearch(target, node)\n\tqueue = []\n\tqueue << node # creates array\n\tqueue.each do |n| # checks each child\n\t\treturn n if n.data == target\n\t\tn.children.each { |c| queue.push(c) }\n\tend\n\treturn nil # return if found nothing\nend", "def peek\n if empty?\n nil\n else\n tempArr = []\n while @queue.size > 1\n tempArr.push(@queue.remove)\n end\n tempItem = @queue.remove\n while !tempArr.empty?\n @queue.insert(tempArr.pop)\n end\n @queue.insert(tempItem)\n tempItem\n end\n end", "def inorder_traversal_i(root)\n # declare a queue (Stack)'\n # declare an array variable\n # until root.value.nil? \n # push all the left nodes to the stack\n # once reach to root.value, push stack value to array \n arr = []\n stack = Queue.new \n currentNode = root\n while (!currentNode.nil? || !stack.empty?)\n while !currentNode.nil?\n stack.push(currentNode)\n currentNode = root.left\n end \n currentNode = stack.pop \n arr.push(currentNode.val)\n currentNode = currentNode.right \n end \n return arr\n\nend", "def all\n result = []\n\n queue = []\n current_node = self.find_root\n queue << current_node\n\n until queue.empty?\n current_node = queue[0]\n result << current_node.val\n # use empty nodes to maintain two-childs for each node so it's easier to read the array output\n if current_node.val != \"E\"\n if current_node.left\n queue << current_node.left\n else\n # only insert an empty node when the other branch exists\n # prevents excessive empty nodes for external nodes\n queue << BSTNode.new(\"E\", parent = current_node) if current_node.right\n end\n if current_node.right\n queue << current_node.right\n else\n # only insert an empty node when the other branch exists\n # prevents excessive empty nodes for external nodes\n queue << BSTNode.new(\"E\", parent = current_node) if current_node.left\n end\n end\n queue.shift\n end\n\n result\n end", "def traverse\n @result.clear\n @queue.clear\n\n @queue.enqueue(@node)\n @result.push @node\n\n\n while not @queue.empty?\n node = @queue.dequeue\n return @result unless node\n # puts \"Visiting node: #{node}\"\n return node if (@search and node==@search)\n node && node.children.each do |node|\n unless @result.include?(node)\n @result.push(node)\n @queue.enqueue(node)\n end\n end\n end\n return result\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 bfs(target_value)\n queue = []\n queue << self\n\n while queue.empty? == false\n check = queue.pop\n \n if check.value == target_value\n return check.value\n else\n queue.unshift(*check.children)\n end\n end\n \n false\n end", "def breadth_first_search(target)\n queue = [@root]\n while ! queue.empty?\n node = queue.shift\n if node.value == target\n return node\n else\n if node.value > target && node.left_child != nil\n queue = queue << node.left_child\n end\n if node.value < target && node.right_child != nil \n queue = queue << node.right_child\n end\n end\n end\n return nil\n end", "def BFT_iterative(root)\n print '[\"I\", \"O\", \"H\", \"L\", \"R\", \"T\", \"M\", \"A\", \"G\"]' + \"\\n\"\n if root == nil\n return\n end\n q = Queue.new\n q.enqueue(root)\n\n while !q.empty?\n root = q.dequeue # I\n print(\"#{root.value}\\n\") \n if !root.left.nil?\n q.enqueue(root.left)\n end\n if !root.left.nil?\n q.enqueue(root.right)\n end\n end\n end", "def build_move_tree(end_pos)\n queue = [self.root_node]\n until queue.empty?\n curr_node = queue.shift\n if curr_node.value == end_pos\n return curr_node\n end\n end\n end", "def enqueue(obj)\n if @first.nil?\n @last = Node.new(obj)\n @first = @last\n else\n @last.next = Node.new(obj)\n @last = @last.next\n end\n end", "def notify_new_traversal\n @item = @queue.shift\n @layers = @item.each\n @layer = @layers.next\n @index = 0\n end", "def level_order(root)\n return [] if root.nil? #\"If there is no root return an empty array\"\n queue = [ root ] #\" Our Queue starts with the root inside of it\"\n level = [] #\"All nodes per level go here\"\n order = [] #\"Our return value for all levels\"\n children = [] # All the nodes children go here\"\n\n while queue.length > 0 #\"Until our queue is empty\"\n node = queue.shift #\"We must Shift(FIFO), Our current Node, and how we escape out of the loop\"\n level.push(node.val) #\"Collect the node's value, one by one\"\n\n children.push(node.left) if !node.left.nil? #\"Notice we push it into the children Array if there is a left child\"\n children.push(node.right) if !node.right.nil? #\"Same for the right child\"\n\n if queue.empty? #\"Important. Once the queue is empty we know the level is complete\"\n order.push(level) #\"Push our level into our Order Array and reset its value below\"\n level = [] \n\n if children.length > 0 #\"When the queue is empty(above) and IF there are children\"\n queue.push(*children) #\"We push the children into our Queue...we are ready for the next level, also notice we are using the spread operator to push the children in as arguements and not an array\"\n children = [] #\" Reset the children value.\n end\n end\n end\n\n return order #\"Once we are out of the loop we have collected all our levels\"\n\nend", "def peek_next_item(id, stack)\n raise if stack.empty?\n raise unless stack.last.first.leaf?\n stack.pop\n\n until stack.empty?\n node, node_id = *stack.last\n raise if node.leaf?\n\n # Select next higher tree branch\n inner = node\n (node_id.select_branch(id) + 1).upto(15) { |b|\n next if inner.empty_branch?(b)\n node = descend_throw(inner, b)\n leaf, stack = *first_below(node, stack, b)\n raise unless leaf && leaf.leaf?\n return leaf, stack\n }\n\n stack.pop\n end\n\n return nil\n end", "def bfs(target_value)\n queue = [self]\n until queue.empty?\n checkme = queue.shift\n return checkme if checkme.value == target_value\n queue.concat(checkme.children)\n end\n nil\n\n end", "def queue(_); end", "def queue(_); end", "def bfs\n return [] unless @root\n q = [@root]\n out = []\n\n until q.empty? do\n current = q.shift\n out << { key: current.key, value: current.value }\n q << current.left if current.left\n q << current.right if current.right\n end\n\n return out\n end", "def breadth_first_search(v)\r\n if @root == nil\r\n puts \"Tree is empty\"\r\n end\r\n queue = [@root]\r\n current_node = @root\r\n while not queue.empty?\r\n current_node = queue[0]\r\n if current_node.value == v\r\n return \"Found at node \" + current_node.to_s\r\n end\r\n queue << current_node.left_child if not current_node.left_child.nil?\r\n queue << current_node.right_child if not current_node.right_child.nil?\r\n queue.shift\r\n end\r\n return \"Value not found.\"\r\n end", "def level_order_traversal(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n magic_node = queue.deq\n\n puts magic_node.value\n\n queue.enq(magic_node.left) unless magic_node.left.nil?\n\n queue.enq(magic_node.right) unless magic_node.right.nil?\n end \n end", "def breadth_first_search(node, search_val = nil)\n return unless node\n visit_queue = [node]\n\n while (!visit_queue.empty?)\n node = visit_queue.shift\n node.visit\n return node if node.value == search_val\n node.connections.each do |conn|\n next if conn.marked\n conn.marked = true\n visit_queue.push(conn)\n end\n end\nend", "def find_path(target)\n queue = [root_node]\n until queue.empty?\n p current_node = queue.shift\n p queue\n return current_node if current_node.value == target\n current_node.children.each do |child|\n queue << child\n end\n end\n nil\nend", "def bfs(starting_node, target_value)\n return starting_node if starting_node.value == target_value\n queue = [starting_node]\n until queue.empty?\n queue += starting_node.neighbors\n queue.each { |neighbor| bfs(neighbor, tar) }\n end\n nil\nend", "def level_order(node)\n return if !node # return if the node is nil\n queue = Queue.new() # create an empty queue\n queue.enqueue(node) # add the node to the queue\n while !queue.is_empty? # loop as long as the queue is not empty\n temporal_node = queue.dequeue # remove an element from the queue and save it as temporal_node\n print temporal_node.value, \" \" # print the value of temporal_node\n # add both the left and right nodes (if they are not nil) to the queue\n queue.enqueue(temporal_node.left_child) if temporal_node.left_child\n queue.enqueue(temporal_node.right_child) if temporal_node.right_child\n end\n end", "def breadth_first_search_with_debug(data)\n search_order = [] # For Debug output\n queue = [@root]\n node_match = nil\n match_found = false\n until queue.empty? || match_found || @root.nil?\n cur_node = queue.first\n next_node_value = cur_node.nil? ? \"nil\" : cur_node.value # For Debug output\n search_order << next_node_value # For Debug output\n if cur_node.value == data\n match_found = true\n node_match = cur_node\n else\n queue.push(cur_node.left_child) unless cur_node.left_child.nil?\n queue.push(cur_node.right_child) unless cur_node.right_child.nil?\n queue.shift\n end\n end\n puts \"Breadth-first search order for nodes visited:\" # For Debug output\n p search_order # For Debug output\n puts \"\\nTotal nodes visited: #{search_order.size}\" # For Debug output\n return node_match\n end", "def queue(*items)\n\t\t\t# insert @ tail\n\t\t\t# increment size (if able)\n\t\t\t# check size\n\t\t\t\t# move head if necessary\n\t\t\t# move tail\n\t\t\t\n\t\t\titems.each do |i|\n\t\t\t\t# puts \"head #{@head_index} tail #{@tail_index}\"\n\t\t\t\t\n\t\t\t\t@queue[@tail_index] = i\n\t\t\t\t\n\t\t\t\t@size += 1 unless @size == @queue.size\n\t\t\t\t\n\t\t\t\tif @size == @queue.size\n\t\t\t\t\tadvance_head\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tadvance_tail\n\t\t\tend\n\t\tend", "def tree_search(problem, fringe)\n # \"\"\"Search through the successors of a problem to find a goal.\n # The argument fringe should be an empty queue.\n # Don't worry about repeated paths to a state. [Fig. 3.8]\"\"\"\n # Since we dont worry about repeated paths this can lead to infinite loops\n fringe.append(Node.new(problem.initial))\n while fringe.len > 0\n node = fringe.pop()\n return node if problem.goal_test(node.state) if node\n fringe.extend(node.expand(problem)) if node\n end\n return nil\nend", "def breadth_first_search(target)\n queue = Array.new\n queue.unshift(@root)\n\n while !queue.empty?\n\n element = queue.shift\n\n return element if element.value == target\n\n queue << element.leftchild if !element.leftchild.nil?\n queue << element.rightchild if !element.rightchild.nil?\n\n end\n\n return nil\n\n end", "def bfs(target_pos) #this is called on the root node \n tar_x, tar_y = target_pos \n\n arr = [self]\n\n until arr.empty?\n current_check = arr.shift \n return current_check if current_check.root_node == target_pos\n arr.concat(current_check.children)\n end\n nil\n end", "def bfs\r\n q = Queue.new\r\n visited = Set.new\r\n\r\n q << [0, panda]\r\n visited << panda\r\n\r\n until q.empty?\r\n level, current_panda = q.shift\r\n unvisited = @members[current_panda].select { |v| !visited.include? v }\r\n unvisited.each do |v|\r\n q << [level + 1, v]\r\n visited << v\r\n end\r\n end\r\n end", "def enqueue(obj)\n node = Node.new(obj)\n if @first.nil?\n @first = @last = node\n else\n @last.next = node\n @last = node\n end\n return self\n end", "def ensure_order_and_write\n fill_queues\n unless @heap.empty?\n #extract the minimum element from the heap \n extracted_el = @heap.extract\n write_to_disk(extracted_el)\n #add the next element from the same thread to the heap\n from_queue = extracted_el[:thread]\n fill_queues\n next_el = @thread_queues[from_queue].shift\n if next_el\n @heap.push(next_el) \n end\n end\n end", "def breadth_first_search(value)\n search_queue = [@root_node]\n\n until search_queue.empty?\n curr_node = search_queue.shift\n return curr_node if curr_node.value == value\n search_queue << curr_node.left unless curr_node.left.nil?\n search_queue << curr_node.right unless curr_node.right.nil?\n end\n return nil\n end", "def double_unsorted_add(item)\n if (@head == nil) and (@tail == nil)\n @head = @tail = Node.new(item,nil,nil)\n elsif @behaviour == :stack\n @head = Node.new(item, @head, nil)\n @head.nxt.prv = @head if @head.nxt\n elsif @behaviour == :queue\n @tail = Node.new(item, nil, @tail)\n @tail.prv.nxt = @tail if @tail.prv\n end\n end", "def _level_order(root, ary=[], lbd)\n ary, q = [], BST::MyQueue.new\n q.enqueue root\n loop do\n break if q.empty?\n node = q.dequeue\n ary << lbd.call(node.val)\n q.enqueue node.lnode if node.lnode \n q.enqueue node.rnode if node.rnode\n end\n ary \n end", "def build_move_tree\n queue = [@root_node]\n until queue.empty?\n current_node = queue.shift\n possible_positions = new_move_positions(current_node.value) #[]\n possible_positions.each do |position| #[1,2]\n child_node = PolyTreeNode.new(position) #node object(value = 1,2)\n child_node.parent = current_node\n current_node.add_child(child_node)\n queue << child_node\n end\n end\n end", "def bfs_11(node, find_this_value)\n\t\t# establish an empty array for queue\n\t\tqueue = []\n\t\t# then push node value into queue\n\t\tqueue.push(node)\n\t\t# while queue is not empty, \n\t\twhile queue.length != 0\n\t\t\t# set a variable to shift out FIFO value, which is the first element in variable\n\t\t\tvalue = queue.shift\n\t\t\t# return the variable with the shifted FIFO value if it equals 11\n\t\t\treturn value.payload if value.payload == find_this_value\n\t\t\t# if not, then loop thru children of variable and push each |child| back to the queue\n\t\t\tvalue.children.each do |child|\n\t\t\t\tqueue.push(child)\n\t\t\tend\n\t\tend\n\tend", "def build_move_tree\n self.root_node = PolyTreeNode.new(start_pos) #instance variable\n \n queue = [root_node]\n until queue.empty?\n #pop,queue\n cur_node = queue.shift\n move_list = new_move_positions(cur_node.value)\n move_list.each do |pos|\n child_node = PolyTreeNode.new(pos)\n cur_node.add_child(child_node)\n queue << child_node\n end\n end\n end", "def breadth_traversal(top_node)\n # start with the first nodes\n nodes = [top_node]\n nodes_to_iterate = [top_node]\n\n # while we have more nodes to print\n while (!nodes_to_iterate.empty?)\n next_nodes = [] # start with an empty list\n # for each node we iterate over in this, find their children\n nodes_to_iterate.each do |n|\n # add the next nodes we iterate\n next_nodes.concat(n.children)\n end\n\n #\n nodes.concat(next_nodes)\n nodes_to_iterate = next_nodes\n end\n\n # print them out in order\n # nb: (this could be a nested structure so you could print out\n # each row on a separate line, which might be cool)\n nodes.each {|n| yield n.value }\nend", "def bfs(target)\n q = [self]\n until q.empty?\n shifted = q.shift\n return shifted if shifted.value == target\n q += shifted.children\n # debugger\n end\n nil\n end", "def pre_order_traversal(tree=root, ordering=[])\n end", "def enqueue(element)\n # if queue is full or the element you're trying to add = nil, item cannot be added to the queue\n if full? or element.nil?\n nil\n else\n # 1 subtracted from @tail because the queue is going to be one item longer now\n @tail = @tail.pred\n # last element in the queue is set equal to the element you passed in as an argument\n @store[@tail] = element\n # returns the Queue\n self\n end\n end", "def breadth_first_search(target)\n queue = [@root]\n visited = []\n\n until queue.empty?\n node = queue[0]\n visited << node\n return \"Found target: #{target} at node #{node}\" if node.value == target\n if node.left && !visited.include?(node.left)\n queue << node.left\n end\n if node.right && !visited.include?(node.right)\n queue << node.right\n end\n queue.shift\n end\n end", "def move_higher_in_queue\n return unless higher_item_in_queue\n\n acts_as_queue_class.transaction do\n higher_item_in_queue.increment_queue_position\n decrement_queue_position\n end\n end", "def build_tree(piece, finish, space = piece.space, board = self)\n piece.class == Queen ? space.find_adjacent_queen(board, finish, piece) : space.find_adjacent(board, piece)\n @searched << space\n return space if space == finish\n\n space.adjacent.each { |square| @queue << square }\n build_tree(piece, finish, @queue.shift)\n end", "def dequeue\n @items.shift\n end", "def enqueue(data) \n node = Node.new(data)\n\n if @rear.nil?\n @front = node\n @rear = node\n return\n end\n\n @rear.next_node = node\n @rear = node\n end", "def nodes_breadthfirst(node = self.root, &block)\n @nodes = []\n iterate_breadthfirst(node, &block)\n ensure\n @nodes = nil\n end", "def level_order_traversal_line_by_line_sol1(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n node_count = queue.size\n while(node_count > 0)\n node = queue.deq\n print node.value\n print \"\\s\"\n\n queue.enq node.left unless node.left.nil?\n queue.enq node.right unless node.right.nil?\n node_count -= 1\n end\n puts \"\\n\"\n end \n end", "def enqueue(item)\n end" ]
[ "0.78859895", "0.7632694", "0.70792097", "0.70443314", "0.7025109", "0.7009682", "0.69752085", "0.6921961", "0.6910484", "0.6780543", "0.67169476", "0.6613039", "0.6573209", "0.6558988", "0.65461046", "0.65428656", "0.6509829", "0.64741606", "0.6433896", "0.6419744", "0.6411062", "0.6410743", "0.64014256", "0.63877857", "0.63704026", "0.63634866", "0.6314183", "0.6308568", "0.6308568", "0.63002527", "0.6296398", "0.62122625", "0.62093073", "0.62089574", "0.6199454", "0.6150008", "0.61340994", "0.61291194", "0.6107185", "0.60931873", "0.60810935", "0.6074441", "0.6073368", "0.6062777", "0.6057138", "0.6032998", "0.6032998", "0.6026212", "0.6024238", "0.5990901", "0.59731954", "0.5960741", "0.59488034", "0.593101", "0.59274954", "0.5924719", "0.5922169", "0.59084886", "0.589648", "0.5889652", "0.5888849", "0.5886097", "0.587778", "0.58592457", "0.5835505", "0.5823008", "0.5823008", "0.58187926", "0.5803949", "0.58019286", "0.5787786", "0.5784406", "0.5778962", "0.57776505", "0.57731766", "0.57714957", "0.57700896", "0.5750003", "0.5748327", "0.57399505", "0.5723214", "0.57115406", "0.57108456", "0.5709041", "0.57071036", "0.570577", "0.570452", "0.57042676", "0.5657828", "0.56521446", "0.56483823", "0.56443626", "0.56410897", "0.56354606", "0.5629324", "0.56292224", "0.5626449", "0.56204695", "0.5615329", "0.56127936" ]
0.6873657
9
Get all events from the API, get all events in chunks defined by limit and since timestamp
def get_since(timestamp, limit=20) uri = '/api/v1/pulses/events' params = {limit: limit, since: timestamp} events = [] begin json_data = get(uri, params) page = json_data['next'] params = URI::decode_www_form(URI(page).query).to_h unless page.nil? events += json_data['results'] end while !page.nil? results = [] events.each do |event| results << OTX::Event.new(event) end return results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events_request(max_pages=100)\n results = []\n max_pages.times do |page|\n # Repeatedly request events, page by page, until we reach the final page\n # of results (or for some maximum number of pages)\n req = MobilizeAmericaRequest.new(@api_key, @org_id, page+1)\n results += req.results\n break if req.last_page?\n end\n results\n end", "def get_events(num_per_slice = 20, part_no = 0)\n self.events.order(created_at: :desc)\n .limit(num_per_slice)\n .offset(num_per_slice * part_no)\n end", "def events_for target, event_types\n url = GITHUB_EVENT_API_END_POINT % target\n etag = @etag_hash[target]\n last_event = @last_event_hash[target]\n\n events_to_send = []\n page = 1\n while page <= 10\n result = @clnt.get(url, {client_id: @client_id, client_secret: @client_secret}, {\"If-None-Match\" => etag})\n break unless result.status_code == 200\n events = JSON.load result.body\n if page == 1 # etag and last event should be set when querying the very first page\n @etag_hash[target] = result.header[\"etag\"]\n @last_event_hash[target] = events[0]\n end\n\n events.each do |event|\n return events_to_send if last_event == event # no need to proceed\n events_to_send << event if event_types.accept? event\n end\n\n page += 1\n end\n\n events_to_send\n end", "def entries(limit=nil)\n limit ||= -1\n LiveJournal::Request::GetEvents.new(@user, :recent => limit, :strict => false).run\n end", "def fetch_events\n params = {'calendarId' => CONFIG[:cal_id], \n 'orderBy' => 'startTime',\n #'timeMax' => Time.utc(CONFIG[:year].to_i + 1, 4, 1).iso8601, \n #'timeMin' => Time.utc(CONFIG[:year].to_i, 4, 1).iso8601,\n 'singleEvents' => 'True'}\n \n result = @client.execute(:api_method => @cal.events.list, :parameters => params)\n\n @events_list = []\n result.data.items.each do |item|\n @events_list << item\n end\n end", "def poll\n rate_limiting do\n body = @client.get('/events',\n params: params,\n options: @options).body\n @sync = body['sync']\n @events += body.fetch('data', []).map do |event_data|\n Event.new(event_data, client: @client)\n end\n end\n end", "def events_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EventsApi.events_list ...'\n end\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] > 100\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EventsApi.events_list, must be smaller than or equal to 100.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'limit'].nil? && opts[:'limit'] < 1\n fail ArgumentError, 'invalid value for \"opts[:\"limit\"]\" when calling EventsApi.events_list, must be greater than or equal to 1.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'offset'].nil? && opts[:'offset'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"offset\"]\" when calling EventsApi.events_list, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/sample/v1/events'\n\n # query parameters\n query_params = {}\n query_params[:'eventType'] = opts[:'event_type'] if !opts[:'event_type'].nil?\n query_params[:'extLineItemId'] = opts[:'ext_line_item_id'] if !opts[:'ext_line_item_id'].nil?\n query_params[:'extProjectId'] = opts[:'ext_project_id'] if !opts[:'ext_project_id'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.events+json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml', 'application/gob', 'application/x-gob'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['jwt']\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 => 'Events')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#events_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def download_events(apiEngine)\n @events = []\n results = []\n results = apiEngine.client.execute!(\n :api_method => apiEngine.api.events.list,\n :parameters => {\n :calendarId => @ident,\n :singleEvents => true,\n :orderBy => 'startTime',\n :timeMin => @dateMin.iso8601,\n :timeMax => @dateMax.iso8601 })\n\n results.data.items.each do |event|\n if event.start.date_time\n fulldate = event.start.date_time.strftime(\"%B, %d, %Y\")\n month = fulldate.split(',')[0]\n day = fulldate.split(',')[1]\n year = fulldate.split(',')[2]\n else\n fulldate = event.start.date.to_s\n month = fulldate.split('-')[1].to_i\n month = I18n.t(\"date.month_names\")[month]\n day = fulldate.split('-')[2]\n year = fulldate.split('-')[0]\n end\n @events.push(Event.new(event.creator.email, year, month, day, :summary => event.summary))\n end\n end", "def read_events(start, page_size, &block)\n if block_given?\n @events.lazy.drop(start).each_slice(page_size, &block)\n else\n @events[start..start + page_size]\n end\n end", "def load\n data = []\n page = 1\n total_size = 0\n\n loop do\n request_url = \"#{@request_url_base}&page=#{page}&api_key=#{@api_key}\"\n response = Faraday.get(request_url)\n\n response_json = JSON.parse(response.body)\n\n break if response_json.empty?\n\n response_json.each do |item|\n data << item\n end\n\n unless @limit.nil?\n total_size += response_json.length\n\n break if total_size > @limit\n end\n\n page += 1\n end\n\n data = data.first(@limit) unless @limit.nil?\n\n data\n end", "def get_events(trace: false, &block)\n r = dropbox_query(query: '2/team_log/get_events', trace: trace)\n r['events'].each(&block)\n while r['has_more']\n r = dropbox_query(query: '2/team_log/get_events/continue', query_data: \"{\\\"cursor\\\":\\\"#{r['cursor']}\\\"}\", trace: trace)\n r['events'].each(&block)\n end\n end", "def fetch_next_week_events\n return [] unless sources.try(:first).present?\n\n source = sources.first\n source.refresh_token_if_expired\n\n gdata = Googledata.new\n gdata.pull(source.oauth_token)\n end", "def index\n params[:offset] = 0 unless params.has_key? :offset\n #TODO optimize with revert indexes at least\n @events = @host.events.offset(params[:offset]).limit(100).order('id DESC')\n end", "def get_all_events\n events, cursor = get_paginated_first\n while cursor do\n next_events, cursor = get_paginated_next(cursor: cursor)\n events += next_events\n end\n events\n .map(&:to_i)\n end", "def fetch\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_time, \"tags\" => \"miq.event_type|*\", \"thin\" => true)\n @start_time = new_events.max_by(&:ctime).ctime + 1 unless new_events.empty? # add 1 ms to avoid dups with GTE filter\n new_events\n rescue => err\n $mw_log.info \"Error capturing events #{err}\"\n []\n end", "def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend", "def read_events(start, page_size, poll: 0)\n if block_given?\n position = start\n loop do\n events = read_events(position, page_size, poll: poll)\n return if events.empty?\n yield(events)\n position += events.size\n end\n else\n @client.retry_read_events_forward(@name, start, page_size, poll, max_retries: @max_retries)\n end\n end", "def get(options = {})\n lower = nil\n upper = nil\n\n if options[:in].nil?\n lower = options[:after].nil? ? '-inf' : coerce_time_milli(options[:after])\n upper = options[:before].nil? ? '+inf' : [0, coerce_time_milli(options[:before])].max\n else\n lower = coerce_time_milli(options[:in].begin)\n upper = coerce_time_milli(options[:in].end)\n upper = \"(#{upper}\" if options[:in].exclude_end?\n end\n\n argv = [expires_at, lower, upper]\n\n unless options[:limit].nil?\n limit = options[:limit].to_i\n raise ArgumentError, 'limit must be positive' unless limit.positive?\n argv.push(limit, [0, options[:offset].to_i].max)\n end\n\n events = get_script(keys: @event_list.key, argv: argv)\n return events.map(&method(:remove_event_id))\n end", "def fetch_latest(params)\n wines = []\n offset = 0\n limit = 5000\n params_with_defaults = { limit: limit }.merge(params)\n response = auth_then.get(BASE_URL, params: params_with_defaults)\n count = response.parse[\"count\"]\n\n while offset < count\n if response.code == 200\n response.parse[\"results\"].each do |result|\n wines << result\n end\n else\n []\n end\n response = auth_then.get(response.parse[\"next\"]) if response.parse[\"next\"] != nil\n offset += 5000\n end\n wines\n end", "def paginate_all_data(url:, more_params: nil)\n query_params = \"since=#{@start_date}&until=#{@end_date}#{more_params ? \"&#{more_params}\" : ''}\"\n total_count = parse_json_from_api(\"#{url}?#{query_params}\")['page']['total_elements']\n puts \"[#{Time.new.strftime('%k:%M')}] total count for #{url}?#{query_params}: #{total_count}\"\n idx = 0\n result = []\n while idx * PER_PAGE < total_count\n result += parse_json_from_api(\"#{url}?page=#{idx}&per_page=#{PER_PAGE}&#{query_params}\")['data']\n idx += 1\n end\n puts \"[#{Time.new.strftime('%k:%M')}] ERROR: result.length #{result.length} != total_count #{total_count}\" if result.length != total_count\n result\nrescue MyApiError\n []\nend", "def fetch_events(app_name, env_name, options={})\n @event_fetched_times += 1\n set_env_ready(app_name, env_name, true) # assume env become ready after it spit out all the events\n\n unless @events # unrestricted mode for testing if no explicit events set\n return [generate_event_from_messages(['Successfully deployed new configuration to environment',\n 'terminateEnvironment completed successfully',\n 'Successfully launched environment',\n 'Completed swapping CNAMEs for environments'\n ], Time.now + @event_fetched_times), nil]\n end\n\n events = @events[env_key(app_name, env_name)][@event_fetched_times - 1]\n\n if options.has_key?(:start_time)\n start_time = Time.parse(options[:start_time])\n events = events.select { |e| e[:event_date] >= start_time }\n end\n\n if limit = options[:max_records]\n events = events[0..limit]\n end\n\n [events, nil]\n end", "def each\n params = {}\n if range[:begin]\n begin_key = range[:begin_inclusive] ? :start : :after\n params[begin_key] = range[:begin]\n end\n if range[:end]\n end_key = range[:end_inclusive] ? :end : :before\n params[end_key] = range[:end]\n end\n params[:limit] = range[:limit]\n @response ||= collection.perform(:list, params)\n return enum_for(:each) unless block_given?\n raise ResultsNotReady.new if collection.app.inside_parallel?\n loop do\n @response.results.each do |doc|\n yield KeyValue.from_listing(collection, doc, @response)\n end\n break unless @response.next_link\n @response = @response.next_results\n end\n @response = nil\n end", "def get_entities(entity_name, opts = {}, last_synchronization_date = nil)\n with_token_refresh do\n batched_call = opts[:__skip] && opts[:__limit]\n query_params = build_query_params(batched_call, last_synchronization_date, opts)\n\n response = RestClient.get \"https://api.getbase.com/v2/#{entity_name.downcase.pluralize}?#{query_params.to_query}\", headers_get\n #the meta field is retrieved indipendently to avoid conflicting with DataParser\n meta = JSON.parse(response)['meta']\n\n #DataParser strips the response from 'items' and 'data' fields\n entities = DataParser.from_base_collection(response.body)\n #if both batched_call and last_synchronization_date are true the array is sliced\n #before the first entry that is older than last_synchronization_date.\n entities = only_updated_entities(entities, last_synchronization_date) if batched_call && last_synchronization_date\n\n unless batched_call\n while meta['links']['next_page']\n response = RestClient.get \"#{meta['links']['next_page']}\", headers_get\n entities.concat DataParser.from_base_collection(response.body)\n raise 'No response received while fetching subsequent page' unless response && !response.body.blank?\n break if last_synchronization_date && entities.last['updated_at'] < last_synchronization_date\n meta = JSON.parse(response)['meta']\n end\n end\n entities\n end\n rescue => e\n Maestrano::Connector::Rails::ConnectorLogger.log('warn', @organization, \"Error fetching entities\", {entity_name: entity_name, message: e.message, backtrace: e.backtrace})\n\n # Fetching Products without a correct subscription returns a 500 error\n return []\n end", "def all(options={})\n offset = nil\n results = []\n begin\n options.merge!(:limit => LIMIT_MAX, :offset => offset)\n response = records(options)\n results += response.records\n offset = response.offset\n end until offset.nil? || offset.empty? || results.empty?\n results\n end", "def all\n end_time = (Time.now - (30 * 60 * 60 * 24)).to_i\n all_items = Array.new\n cur_items = self\n begin\n all_items += cur_items.items\n cur_items = cur_items.next(:count => 200, :start_time => end_time)\n end until cur_items.nil?\n all_items\n end", "def list(from = nil, to = Time.now, limit = 100, cursor = nil)\n raise ArgumentError unless from && to\n wf_event_id?(cursor) if cursor\n\n from = parse_time(from, true)\n to = parse_time(to, true)\n\n wf_ms_ts?(from)\n wf_ms_ts?(to)\n\n body = { earliestStartTimeEpochMillis: from,\n latestStartTimeEpochMillis: to,\n cursor: cursor,\n limit: limit }\n\n api.get('', body.cleanse)\n end", "def events_request(next_page_token = nil)\n params = {:calendarId => calendar_id}\n params.merge!(:pageToken => next_page_token) if next_page_token\n\n JSON.parse(client.execute(\n :api_method => calendar.events.list,\n :parameters => params).response.body)\n end", "def events\n object.events.last(10)\n end", "def events(params = {})\n loop do\n begin\n return events!(params)\n rescue Podbay::TimeoutError\n # Keep waiting\n end\n end\n end", "def all\n gen_feed Event.find(:all, :limit => @@limit, :order => 'id DESC'), 'All Events';\n end", "def all\n @events = Event.order(updated_at: :desc).page(params[:page]).per(10)\n end", "def upcoming_events(order_by: self.class::START_OLDEST_FIRST,\n status: self.class::ALL)\n EventbriteSDK::ResourceList.new(\n url_base: \"#{path}/events\",\n object_class: EventbriteSDK::Event,\n key: 'events',\n query: {\n order_by: order_by,\n status: status\n }\n )\n end", "def geoGetEvents(location, limit = 10, page = 1)\r\n params = {\r\n :method => \"geo.getevents\",\r\n :location => location,\r\n :api_key => @api_key,\r\n :limit => limit,\r\n :page => page\r\n }\r\n #--\n # TODO Handle connection errors\n #++\n @uri.query = URI.encode_www_form(params)\r\n response = Net::HTTP.get_response(@uri)\r\n return response.body if response.is_a?(Net::HTTPSuccess)\r\n end", "def index\n pag = params[:page] || 1\n limit = params[:limit] || 30\n events = ::Event.paginate(:page => pag, :per_page => limit).where(user_id: current_user.id)\n render :status => 200, :json => {success: true, limit: limit, page:pag, data: events }\n end", "def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n\n begin\n set = handle_timeouts(MAX_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n\n records += set\n offset += per_page\n end until set.empty?\n\n records\nend", "def index\n #This clamps the offset and limit values between 0 and Event.count-1, since there isnt a clamp function in ruby\n offset = [0, params[:offset].to_i, User.count-1].sort[1]\n #This also clamps, between 1 and 5\n limit = [1, params[:limit].to_i, 5].sort[1]\n #Sort asc since that means start from id 1 and work upwards\n @users = User.all.offset(offset).limit(limit)\n\n count = @users.count\n\n #If the offset + limit selects higher items than there is, no next_link\n if offset+limit >= User.count\n next_link = nil\n elsif count < User.count\n next_link = \"http://localhost:3000/api/v1/users/?offset=#{offset+limit}&limit=#{limit}\"\n else\n next_link = nil\n end\n #If the offset is larger than 0, there must be atleast 1 item before\n if offset > 0 && User.count > 0\n #Do note that offset - limit can become negative, but since offset gets clamped, it doesn't really matter\n previous = \"http://localhost:3000/api/v1/users/?offset=#{offset-limit}&limit=#{limit}\"\n else\n previous = nil\n end\n\n respond_with users: @users, total: User.count, limit: limit, offset: offset, next: next_link, previous: previous\n end", "def sync_paged_history(channel, page, limit, include_token, callback, timetokens)\n envelopes = []\n page.times do |_i|\n envelope = history(\n channel: channel,\n include_token: include_token,\n http_sync: true,\n count: limit,\n start: timetokens[:start],\n end: timetokens[:end]\n )\n\n break if envelope.result[:data][:messages].empty?\n\n envelopes.push envelope\n timetokens[:start] = envelope.result[:data][:start].to_i\n # No need to iterate further if there is no more messages.\n break if envelope.result[:data][:messages].length < limit\n end\n\n call_callback(envelopes, callback)\n end", "def next_occurrences(options = {})\n begin_datetime = start_datetime_for_collection(options)\n final_datetime = final_datetime_for_collection(options)\n limit = options.fetch(:limit, 100)\n [].tap do |occurences|\n occurrences_between(begin_datetime, final_datetime).each do |time|\n occurences << { event: self, time: time }\n return occurences if occurences.count >= limit\n end\n end\n end", "def events_in_period\n t0 = start.midnight\n tf = finish.end_of_day\n\n events = []\n while t0 < tf\n t1 = [t0.advance(days: 21), tf].min\n events.concat(dog.stream(t0, t1, tags: @job_tags)[1]['events'])\n t0 = t1\n end\n events\n end", "def fetch_top_events(params={}, save_to_db=true)\n params = setup_params(params)\n self.model_class = ::Mixpanel::Event\n \n method_url = get_method_url('events', 'top')\n request_params = self.select_params(params, [:type, :limit, :bucket])\n request_params[:resource] = method_url\n \n data = send_request(request_params)\n \n is_empty = (data.blank? || data['events'].blank?)\n if save_to_db && !is_empty\n target_ids = get_target_ids(params) \n \n self.model_class.transaction do\n data['events'].each do |event|\n target_id = event['event']\n # Format to JSON data.\n json_data = {:events => event}.to_json\n \n self.insert_or_update(params, target_ids, \n target_id, json_data)\n end\n end \n end\n return data\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def last_n_events(n)\n events.where(['date < ?', Date.today]).first(5)\n end", "def read_pages\n loop do\n @fetched_events = adapter.fetch_single_page\n sync_events\n break unless adapter.has_next_page\n end\n end", "def events(count: 150, startId: nil)\n data = get '', resource: 'userEvent', count: count, startId: startId\n data.userEvents\n end", "def request_events(access_token, my_email, calendar_id, calendar_zone)\n service = build_service(access_token)\n\n # Return each google api calendar as an ActiveRecord Calendar model\n events = get_calendar_events(service, calendar_id).map do |item|\n upsert_service_event_item(my_email, calendar_zone, item)\n end\n\n # upsert_service_event_item sometimes returns nils, when an event doesn't\n # get made\n events.reject(&:nil?)\n end", "def events_feed\n @group = Group.find_by(id: params[:id]) || not_found\n not_found unless @group.status?\n raise 'NotGroupMember' unless @group.member?(current_user)\n @events = @group.events.confirmed.by_date\n\n feed = []\n @events.each do |event|\n next if event.date_tba == true\n event_link = url_for(\n controller: 'events', action: 'show', group_id: @group.id,\n id: event.id\n )\n feed << {\n date: event.start_time.strftime('%Y-%m-%d'),\n title: \"#{event.time != '' ? event.time : 'TBA'} - #{event.event_name}\",\n url: event_link,\n ticket_stats: event.ticket_stats(@group, current_user)\n }\n end\n render json: feed\n end", "def getEventsByMounthWithCountAndTag\n count = params[:count].to_i > 0 ? params[:count].to_i : 10\n event_ids = EventsToTag.select(:event_id).where(:tag_id => params[:tag_id]).load\n from_date = (params[:date].to_i / 100) * 100 #19790500\n to_date = (from_date % 10000 >= 1200 ? from_date + 10000 : from_date + 100)\n return render :json => Event.where(\"events.id IN (?) AND events.date > ? AND events.date < ?\", event_ids, from_date, to_date).last(count)\n end", "def make_api_call \n Artist.all.each do |artist|\n request = RestClient.get(\"https://api.songkick.com/api/3.0/artists/#{artist.song_kick_id}/calendar.json?apikey=zIDG2c72WHINjQ8Y\")\n artist_data = JSON.parse(request)\n create_event(artist_data, artist.id)\n end \n \nend", "def get_events_get(startdate,\r\n events = nil,\r\n sort = nil,\r\n enddate = nil,\r\n offset = 0,\r\n limit = 10,\r\n subject = nil,\r\n xapiheader = nil,\r\n fromaddress = nil,\r\n email = nil)\r\n # Prepare query url.\r\n _path_url = '/events'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_builder = APIHelper.append_url_with_query_parameters(\r\n _query_builder,\r\n {\r\n 'startdate' => startdate,\r\n 'events' => events,\r\n 'sort' => sort,\r\n 'enddate' => enddate,\r\n 'offset' => offset,\r\n 'limit' => limit,\r\n 'subject' => subject,\r\n 'xapiheader' => xapiheader,\r\n 'fromaddress' => fromaddress,\r\n 'email' => email\r\n },\r\n array_serialization: Configuration.array_serialization\r\n )\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 403\r\n raise APIException.new(\r\n 'API Response',\r\n _context\r\n )\r\n elsif _context.response.status_code == 405\r\n raise APIException.new(\r\n 'Invalid input',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def where(endpoint, params = {})\n limit = params[:limit] || Float::INFINITY\n params = self.parse_params(params)\n output = []\n begin\n response = self.request(endpoint, params)\n break unless response.any?\n meta = response['metadata']['resultset']\n output.concat response['results']\n count = meta['offset'] + meta['limit'] - 1\n params[:offset] = count + 1\n params[:limit] = limit - count if (limit - count) < 1000\n end while count < meta['count'] && count < limit && limit > 1000\n output\n end", "def get_entries(limit = nil)\n limit ||= -1\n prepare_entries(LiveJournal::Request::GetFriendsPage.new(@user, :recent => limit, :strict => false).run)\n rescue exception_block\n end", "def get_next_from(id, event_types: nil, limit: 1000)\n query = events_table.\n order(:id).\n where(Sequel.lit('id >= ?', id)).\n limit(limit)\n query = query.where(type: event_types) if event_types\n query.map { |event_row| build_event(event_row) }\n end", "def get_events\n # conditions = \"starttime >= '#{Time.at(params['start'].to_i).to_formatted_s(:db)}' AND endtime <= '#{Time.at(params['end'].to_i).to_formatted_s(:db)}'\"\n conditions = \"starttime >= '#{params['start'].to_time}' AND endtime <= '#{(params['end']+\" 23:59:59\").to_time}'\"\n if @profile\n @events = @profile.events.where conditions\n else\n conditions += \" AND profile_type = '#{event_params[:profile_type]}'\"\n @events = Event.where conditions\n end\n\n events = []\n @events.each do |event|\n events << {:id => event.id, :title => event.title, :description => event.description || \"Some cool description here...\", :start => \"#{event.starttime.iso8601}\", :end => \"#{event.endtime.iso8601}\", :allDay => event.all_day, :recurring => (event.event_series_id) ? true : false}\n end\n set_profile\n render :text => events.to_json\n end", "def track_events(events)\n url = \"v2/#{account_id}/events/batches\"\n make_json_api_request :post, url, private_generate_resource(\"batches\", { \"events\" => events })\n end", "def index\n # @events = Event.all\n\n if params[:id]\n # get all records with id less than 'our last id'\n # and limit the results to 5\n @events = Event.where('id < ?', params[:id]).limit(5)\n else\n @events = Event.limit(5)\n end\n\n respond_to do |format|\n format.html\n format.js\n end\n end", "def events\n results = @client.execute(\n :api_method => @calendar.events.list,\n :authenticated => false,\n :parameters => {\n 'calendarId' => @config[:calendar_id],\n 'fields' => 'items(start,end,summary)',\n 'singleEvents' => true,\n 'orderBy' => 'startTime',\n 'timeMin' => DateTime.now.to_s,\n 'timeMax' => (DateTime.now + 7).to_s,\n 'q' => 'LIVE'\n }\n )\n\n results.data.items.map do |event|\n summary = event.summary.gsub(/^LIVE:\\s+/, '')\n CalendarEvent.new(summary, event.start.date_time, event.end.date_time)\n end\n end", "def fetch_with_limit\n start_result = 10\n start_result.step(RESULTS_LIMIT, 10) do |number|\n response = get_subdomains!(number)\n break unless response.items_present?\n end\n end", "def latest_articles(limit = 10)\n articles[0..limit]\n end", "def get_all_report\n limit = 15\n begin\n if params.has_key? :last_iso_timestamp\n from_time = DateTime.iso8601 params[:last_iso_timestamp]\n\n items = Item.active_items.order('updated_at DESC').where(\"updated_at < ?\",from_time).limit(limit)\n else \n items = Item.active_items.order('updated_at DESC').limit(limit)\n end\n #return\n render json:{success:true, lost_and_found: items.take(limit)} \n rescue Exception => e\n render json:{success:false, message: e.to_s}\n end\n end", "def bulk_upload_events(body, opts = {}, &callback)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: EventsApi.bulk_upload_events ...\"\n end\n if @retryAfterTimestamp > Time.now.to_i\n return @latestResponse\n end\n # verify the required parameter 'body' is set\n fail ArgumentError, \"Missing the required parameter 'body' when calling EventsApi.bulk_upload_events\" if body.nil?\n # resource path\n local_var_path = \"/bulkevents\".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(['text/html', '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 = ApiClient.object_to_json(body)\n auth_names = ['basic']\n if (callback.nil?)\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#bulk_upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n thread = data, status_code, headers\n else\n thread = @api_client.call_api(:POST, local_var_path,\n {\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 }) { |data, status_code, headers|\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: EventsApi#bulk_upload_events\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n yield data, status_code, headers\n }\n end\n if thread[1] == 429\n @latestResponse = thread\n @retryAfterTimestamp = Time.now.to_i + thread[3][\"Retry-After\"]\n end\n return thread\n end", "def index\n @events = Event.where(start: params[:start]..params[:end])\n render json: @events\n end", "def index\n @events = Event.available.page(params[:page])\n end", "def get_events\n events = [] \n @log ||= Rails.logger\n Appsterdam::Application.ical_subscriptions.each do |options|\n @log.info \"getting events from #{options[:url]}\"\n components = parse_ical(options[:url])\n events.concat(extract_events(components.first))\n end\n @log.info \"done importing iCal events.\"\n \n events\n end", "def read_many(number_of_events=1)\n synchronize {\n until (events ||= []).size == number_of_events\n events += read_many_nonblock(number_of_events)\n end\n events\n }\n end", "def group_feed(group_id, limit)\n Enumerator.new do |y|\n processed = 0\n current_page = group_raw_feed(group_id, @page_size)\n\n until current_page.empty? || (processed >= limit)\n current_page.each do |element|\n y << element\n processed = processed + 1\n end\n current_page = current_page.next_page\n end\n end\n end", "def events\n event.user.events.where(:timestamp => beginning...ending)\n end", "def events(dbname, &block)\n # can't use RestClient.get b/c of :block_response\n RestClient::Request.execute(:method => :get,\n :url => root_url('events', @storage, dbname),\n :headers => {:accept => \"text/event-stream\"},\n :block_response => block, &HANDLE_RESPONSE)\n end", "def pullChunkOfData(startFrom=100)\n hundred = 50\n limit = startFrom % hundred * hundred\n puts limit\n\n pageNumber = startFrom % hundred\n puts pageNumber\n\n dataPuller = DroneAttackHelper.new\n\n while(!jsonData.nil?)\n url = getUrl(pageNumber, 0, limit)\n jsonData = dataPuller.pull_data(url)\n\n dataPuller.update_db(jsonData)\n pageNumber+=1\n end\n end", "def get_articles\n article_array = []\n offset = 0\n MAX_API_CALLS.times do\n type = \"json\"\n url = \"http://api.nytimes.com/svc/mostpopular/v2/mostviewed/all-sections/30.json?offset=#{offset}&api-key=#{ENV[\"ny_times_most_popular_key\"]}\"\n response_hash = JSON.load(open(url))\n article_array = article_array + response_hash[\"results\"]\n offset += ARTICLES_PER_CALL\n end\n article_array\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def list(offset = 0, limit = 100)\n api.get('', offset: offset, limit: limit)\n end", "def index\n @events = Event.getRecords(params[:page])\n end", "def find_every(options = {})\n query = {:limit => 100}.merge(options)\n \n feedkey = Wakoopa.feedkey\n if feedkey\n query.merge!(:key => feedkey)\n end\n \n Wakoopa::Request.get(self, :query => query)\n end", "def get_event_logs(last_n=5)\n\n service_logs = []\n\n logrow = 0\n\n if last_n > @describe_service.services[0].events.length\n loop_to = @describe_service.services[0].events.length\n else\n loop_to = last_n\n end\n\n while logrow < loop_to\n log = RaisEcs::ServiceEventLog.new({\n id: @describe_service.services[0].events[logrow].id,\n created_at: @describe_service.services[0].events[logrow].created_at,\n message: @describe_service.services[0].events[logrow].message\n })\n\n service_logs << log\n logrow += 1\n end\n\n return service_logs\n\n end", "def get_all_results\n\t\tresult_array = []\n\t\tskip = 0\n\t\ttake = 1000\n\t\tloop do\n\t\t\tcurrent_result = get_data_from_result(execute_request(take, skip)[1])\n\t\t\tresult_array.concat(current_result)\n\t\t\tskip = skip + take\n\t\t\tbreak if current_result.size != take\n\t\tend\n\t\treturn result_array\n\tend", "def index\n number = request.query_parameters.first[1].to_i\n respond_with Event.where(date_time: Date.current..(Date.current + number.days))\n end", "def multi_page_response\n @multi_page_reponse ||= events_builder.multi_page_response\n rescue => e\n Rails.logger.error(e)\n Array.new\n end", "def test_all\n assert_gets(\"/api/v2/#{api_class}?offset=0&limit=999\") { wf.all }\n end", "def get_all(*path, query: nil, api_v1: true)\n query = {} if query.nil?\n query[:limit] = 250\n body = {}\n\n [].tap do |body_values|\n until body[\"isLastPage\"] == true do\n url = encode_url(\n path: path,\n query: query,\n api_v1: api_v1\n )\n\n body = faraday_safe(:get, url).body\n body_values.concat(body[\"values\"])\n\n query[:start] = body[\"nextPageStart\"]\n end\n end\n end", "def request(endpoint, *args)\n first_response_data = client.paginate(url(endpoint, args.shift), *args) do |_, last_response|\n last_response.data.each { |data| yield data }\n end\n first_response_data.each { |data| yield data }\n end", "def batch_requests(pipeline_params, limit = nil)\n limit ||= Process.respond_to?(:getrlimit) ? Process.getrlimit(:NOFILE).first : 256\n responses = []\n\n pipeline_params.each_slice(limit) do |params|\n responses.concat(requests(params))\n end\n\n responses\n end", "def fetch_next_week_events_and_analyze\n events = fetch_next_week_events\n analyze_events(events)\n end", "def fetch_with_pagination(connection, entity, per_page)\n offset = 0\n records = []\n page = 1\n\n begin\n log.info \" Requesting set #{page} (limit #{per_page}, offset #{offset})\"\n set = handle_timeouts(MAX_CONSECUTIVE_TIMEOUTS, \"loading tasks (offset: #{offset})\") { connection.send(entity, offset, \"yes\", \"owner,coworker,reporter\") }\n log.info \" Fetched #{set.size} records\"\n\n records += set\n offset += per_page\n page += 1\n end until set.size < per_page\n\n records\n end", "def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end", "def index\n @events = Event.paginate(page: params[:page], :per_page => 20)\n end", "def index\n tenantId = params[:tenantId]\n if tenantId.present?\n @events = Com::Nbos::Events::Event.active_events.where(tenant_id: tenantId).page(params[:page])\n paginate json: @events, per_page: params[:per_page]\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end", "def last_n_events_for_organization(n)\n events.order(created_at: :desc).limit(n)\n end", "def collect1 pages\n id = 'joshuabaer'\n results = []\n 1.upto pages do |page|\n results += http_get id, page\n end\n results\nend", "def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end", "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def fetch_events(calendar_id)\n response = service.list_events(calendar_id,\n max_results: 5,\n single_events: true,\n order_by: \"startTime\",\n time_min: Time.now.iso8601,\n time_max: Date.today.+(1).to_time.iso8601)\n\n # filter out any declined events – they normally represent a clash or room release\n response.items.reject { |event|\n next if event.attendees.nil?\n event.attendees.all? { |attendee| attendee.response_status == \"declined\" }\n }\n end", "def stream(to: :unset, from: :unset, parent_call_sid: :unset, status: :unset, start_time: :unset, start_time_before: :unset, start_time_after: :unset, end_time: :unset, end_time_before: :unset, end_time_after: :unset, limit: nil, page_size: nil)\n limits = @version.read_limits(limit, page_size)\n\n page = self.page(\n to: to,\n from: from,\n parent_call_sid: parent_call_sid,\n status: status,\n start_time: start_time,\n start_time_before: start_time_before,\n start_time_after: start_time_after,\n end_time: end_time,\n end_time_before: end_time_before,\n end_time_after: end_time_after,\n page_size: limits[:page_size], )\n\n @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit])\n end", "def index\n @page = (params[:page].to_i > 0) ? params[:page].to_i : 1\n @per = (params[:per].to_i == 0) ? 100 : params[:per].to_i.clamp(1, 1000)\n\n @weight_events = WeightEvent.order(id: :desc).limit(@per).offset((@page - 1) * @per).all\n end", "def pending_events_in_buckets(end_time_utc: Time.now.utc, max_buckets: nil)\n buckets = if max_buckets\n pending_buckets(end_time_utc).take(max_buckets)\n else\n pending_buckets(end_time_utc).to_a\n end\n\n { events: events(buckets), latest_bucket: buckets.last }\n end", "def get_readings_from_remote_server_for_dates(type, start_date, end_date)\n readings = []\n start_date.upto(end_date) do |date|\n readings += get_readings_from_remote(type, date)\n end\n return readings\nend", "def get_all(opts = {})\n after = nil\n objects = []\n opts[:limit] ||= MAX_PAGE_SIZE\n loop do\n page_opts = opts.merge(after: after)\n page = get_page(page_opts)\n objects.concat(page.results)\n break objects if page.paging.nil?\n\n after = page.paging._next.after\n end\n\n end", "def events_now\n\n # Open empty array\n events = []\n\n # Loop over all the calendars\n CALENDARS.each do |name, id|\n\n # Get the events\n cal_events = calendar(id).find_events_in_range(Time.now, Time.now + 60)\n\n # Loop over each one and add it to the array\n cal_events.each do |e|\n events << {event: e, cal: name} unless e.nil?\n end\n\n end\n\n # Return the final list\n return events\n\nend", "def feed\n if current_user\n feed = []\n Event.where(user_id: current_user.id).each do |event|\n event.comments.each do |comment|\n if (DateTime.current - comment.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << comment\n end\n end\n event.file_attachments.each do |file|\n if (DateTime.current - file.created_at.to_datetime).to_f < (DateTime.current - current_user.last_sign_in.to_datetime).to_f\n feed << event.name << file\n end\n end\n end\n respond_with feed\n else\n redirect_to root_path\n end\n end" ]
[ "0.74314517", "0.70121956", "0.6835659", "0.6781842", "0.67541605", "0.6594201", "0.6573634", "0.65617687", "0.64882636", "0.6434823", "0.639415", "0.63327134", "0.63307613", "0.63223135", "0.6309933", "0.62536615", "0.6243847", "0.6213721", "0.61043525", "0.6102592", "0.6067687", "0.60532427", "0.6049629", "0.6046611", "0.6002346", "0.59589106", "0.5931884", "0.590834", "0.58756924", "0.5875213", "0.58751696", "0.58701134", "0.58625084", "0.58589214", "0.57845706", "0.57727766", "0.57688165", "0.57613224", "0.5756262", "0.5747155", "0.57376647", "0.57319623", "0.57128507", "0.57107407", "0.5706085", "0.57026285", "0.569455", "0.5682122", "0.56809956", "0.5677068", "0.5674186", "0.5673443", "0.56700593", "0.56640005", "0.56512034", "0.56507707", "0.5647666", "0.5645467", "0.5642274", "0.56383413", "0.5631584", "0.5621309", "0.56114334", "0.56088674", "0.5594617", "0.5583745", "0.5581173", "0.55757", "0.5570116", "0.556587", "0.556587", "0.556587", "0.556587", "0.5562911", "0.5556857", "0.55543727", "0.5554088", "0.55452496", "0.5533541", "0.5531411", "0.5522072", "0.5506966", "0.55036205", "0.5501443", "0.5497701", "0.5493663", "0.5490508", "0.54863864", "0.54849446", "0.5482703", "0.54763496", "0.5471032", "0.5460851", "0.54588777", "0.54529524", "0.54455304", "0.5445391", "0.5443201", "0.54424024", "0.54341567" ]
0.6563211
7
method does nothing; as long as views/posts/new.html.rb exists, new post page will be displayed /posts/new
def new # prevents nil when checking @post.errors.any? in new.html.erb @post = Post.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end", "def new\n\t\t@post = Post.new\n\t\trender :new\n\tend", "def new\n @post = Post.new\n render :new\n end", "def new\n @page = Page.new\n #render :new - app/views/pages/new.html.erb\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html\n end\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n # default: render 'new' template\n end", "def new\n @page = Page.new\n # render :new app/views/pages/new.html.erb\n end", "def new\n # render new.html\n end", "def new\n # Display a form to create a new post\n # The actual post creation is handled by method: create\n @post = Post.new\n end", "def new # Showing the new form\n # Responsible for creating a new instance of a post - not saved in DB yet.\n @post = Post.new\n end", "def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def new\n session[:single_blog] = nil\n @post = Post.new\n \n render :layout => 'application'\n\n end", "def new\n # We are going to use this in the form_for tag\n # Check out the documentation for it:\n # - http://guides.rubyonrails.org/form_helpers.html#customizing-form-builders\n # - http://guides.rubyonrails.org/form_helpers.html#using-form-helpers\n\n # It will use this instance variable inside as a requirement\n # And when we use a form_for tag, we will need to use\n # STRONG PARAMS for our `posts#create` action\n @post = Post.new\n\n render :new\n end", "def new\n @page = Page.new\n # render new.html.erb\n end", "def new\n @page = Page.new\n # render new.html.erb\n end", "def new\n @post = Post.new\n # Creating a new post involves two actions. \n # The first is the new action, which \n # instantiates an empty Post object\n # The new.html.erb view displays this \n # empty Post to the user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n\t\t@post = Post.new\n\t\trender layout: \"admin_layout\"\n\tend", "def create\n\t\t@post = Post.new(post_params)\n\n\t\t#if the post has been saved redirects to index of posts\n\t\tif @post.save\n\t\t\tredirect_to root_path\n\t\telse\n\t\t\trender 'new'\n\t\tend\n\tend", "def create\n @post = Post.new\n @post.title = params[:title]\n @post.description = params[:description]\n @post.save\n\n #each route will automatically check for a matching view..\n # since we don't need a view for create, we must redirect\n # after we are done saving the post... in order to avoid errors.\n \n redirect_to post_path(@post)\n end", "def new\n @posts = Post.find(:all, :order => 'updated_at DESC')\n @post = Post.new\n @post.title = \"Überschrift*\"\n\n respond_to do |format|\n format.html { render :template => \"posts/new\" }\n format.xml { render :xml => @post }\n end\n end", "def new\n render 'new.html.erb'\n \n end", "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @pages = Page.new\n #renders new.html.erb\n end", "def new_post\n @i = 0\n @post_title = params[:title]\n @post\n render \"post\"\n end", "def new\n @post = Post.new\n @title = \"New Post\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n format.json { render :json => @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n respond_to do |format|\n format.html { render :template => 'posts/new' } # we specify the template because in theory we could be reverting from a post to create \n format.js { render :partial => 'posts/reply' }\n end\n end", "def create\n\t\t@post = Post.new(params[:post].permit(:title, :text))\n\t\t\n\t\tif @post.save\n\t\t\n\t\t\t#tell browser to issue anothe request\n\t\t\tredirect_to @post\n\t\telse\n\t\t\n\t\t\t#render is used so that @post is passed back to the\n\t\t\t#new template when it is rendered\n\t\t\trender 'new'\n\t\tend\n\tend", "def new\n @post = current_user.posts.build\n #Modal to say whether user has successfully created a new post - should be intialized to false so it doesnt appear\n #every time the profile page opens\n session[:show_new_post_dialog] = false\n end", "def new\n @post = Post.new\n \n @user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end", "def create\n if @post.save\n redirect_to root_path, notice: t('.notice_create')\n else\n render :new\n end\n end", "def new\n @post = flash[:form_data] || Post.new\n @title = 'New post'\n\n render_view(:form)\n end", "def new\n @todo = TodoItem.new\n # render :new - app/views/pages/new.html.erb\n end", "def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @post }\r\n end\r\n end", "def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @post }\r\n end\r\n end", "def create\n #first create post\n @post = Post.new(post_params)\n\n # if statement to control when to display error messages and to handle if save is successful\n if @post.save\n flash[:notice] = \"Post successfully created\"\n redirect_to @post\n else\n #we want to do a render instead of a redirect because a redirect will do a new http refresh if the post did not save and the user will loose all the content they put in the form. Render new method keeps all content in place\n flash.now[:notice] = \"Could not create new post, please try again\"\n render 'new'\n end\n end", "def create\n restrict('allow only admins and store users') or begin\n @post = Post.new(params[:post])\n @post.author = current_user\n respond_to do |format|\n if @post.save\n format.html {redirect_to current_user.kind_of?(Admin) ? admin_posts_url : posts_url}\n format.js do\n responds_to_parent do\n render :update do |page|\n page.insert_html :top, 'posts_container', \"<hr />\"\n page.insert_html :top, 'posts_container', :partial => 'posts/show_post', :locals => { :post => @post }\n page['new_post_title'].value = ''\n page['new_post_text_area'].value = ''\n page['post_attachment_temp'].value = ''\n page['post_attachment'].value = ''\n page.hide('new_post_container')\n end # render\n end # responds_to_parent\n end # wants\n format.xml\n else\n format.html { render :action => \"new\" }\n format.js {}\n format.xml \n end\n end\n end\n end", "def new\n render 'new'\n end", "def new\n render \"new\"\n end", "def new\n render \"new\"\n end", "def new\n\t\trender layout: false\n\tend", "def create\n # render plain: params[:post].inspect #get the inspected parameters filled by the user in the form\n @post = Post.new(post_params) #Create a new post with the supplied post parameters\n if(@post.save) #Saves the post to the database\n redirect_to @post #Redirects to the show method\n else\n render 'new' #If got any errors while saving, render the new.html.erb page and show the error \n end\n end", "def new\n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end", "def create\n @post = Post.new(post_params)\n\n if @post.save\n redirect_to posts_path\n\n else\n render :new\n end\n\n end", "def new\n authorize! :write, Post\n @post = current_user.posts.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @page_title = \"New Blog\"\n @blogpost = Blogpost.new\n end", "def render_new\n render :template => 'shared/new'\n end", "def new\n\t\t# no code needed here; all handled in the view\n\tend", "def create\n @post = Post.new(params[:post])\n if @post.save\n redirect_to post_path(@post)\n else\n render :action => \"new\"\n end\n end", "def new\n render layout: false\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n # @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n @title = \"New post\"\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n @publish = false\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n new_object Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :layout => \"default\" }\n end\n end", "def new\n @post = Post.new\n #if new is being called because the user clicked the add tag button\n if params[:tag].present?\n @post.text = params[:currentPostText]\n addTag()\n #if new is being called because the user clicked an x to remove one of the tags\n elsif params[:tagToRemove].present?\n @post.text = params[:currentPostText]\n removeTag()\n #if new is being called because the user has just navigated to this page\n else\n @tagsToAdd = []\n end\n end", "def create\n # displays post information in JSON format\n # render([current,] :text => params[:post].inspect )\n# render text: params[:post].inspect\n\n # get post form data from params as new Post\n# Rails 4.0\n# @post = Post.new(params[:post].permit(:title, :text))\n @post = Post.new(params[:post])\n\n # save post in sqlite db; save returns false if invalid\n if @post.save\n # send GET request to post, conveying post id => posts#show\n redirect_to @post\n else # invalid form\n # same form => posts#new\n render 'new'\n end\n end", "def create\n @post = Post.new(post_params)\n if @post.save\n redirect_to post_path(@post)\n else\n render :new\n end\n end", "def new\n @title = \"Create New Post\"\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\t\n\t\t@post = Post.new\n\tend", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n make_rss\n end", "def new\n @post = Post.new\n\t@posts = Post.all\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\n\t @post = Post.new\n\tend", "def new\n @user = User.find(session[:user_id])\n @post = @user.posts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new \n\t\t@post = Post.new\n\tend", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n format.xml { render :xml => @post }\n end\n end", "def new\n render :text => \"The current time is #{Time.now.to_s}\"\n\t #@post = Post.new\n\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @post }\n #end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n render :new\n end", "def new\n @post = Post.new #returns an empty post\n end", "def new\n\t\t@post = Post.new \n\tend", "def new\n @post = Post.new\n respond_to do |format|\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def index\n\t\t@posts = Post.all\n\t\t@post = Post.new\n\t\t# When called upon, rails will look for a folder in the views called posts, with an erb file called index.html.erb\n\tend", "def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end", "def new\n\t\t@post = Post.new\n\tend", "def new\n\t\t@post = Post.new\n\tend" ]
[ "0.739904", "0.7288742", "0.728315", "0.7162108", "0.71055907", "0.70984614", "0.70984614", "0.70984614", "0.70984614", "0.70828575", "0.7081854", "0.7072925", "0.70082563", "0.69871354", "0.6986777", "0.6961107", "0.6952532", "0.6952532", "0.69297355", "0.69042814", "0.6901804", "0.6880634", "0.68211603", "0.68184346", "0.6805923", "0.6795638", "0.67656416", "0.6765024", "0.67581093", "0.6753015", "0.67492425", "0.67436206", "0.67359173", "0.6735564", "0.67195183", "0.6700479", "0.66988", "0.6690685", "0.6690685", "0.6673056", "0.666484", "0.6662899", "0.6660857", "0.6660857", "0.6655362", "0.6646896", "0.6627117", "0.66108096", "0.6609639", "0.6607031", "0.660554", "0.66020375", "0.65994275", "0.6596986", "0.6596973", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.6589578", "0.65827465", "0.6578383", "0.65655667", "0.65626246", "0.65402305", "0.6538322", "0.6523269", "0.6516494", "0.6516262", "0.65144426", "0.651312", "0.6497765", "0.6497515", "0.64972067", "0.6486745", "0.6485843", "0.64755464", "0.6474883", "0.64743197", "0.6470936", "0.6457398", "0.6450027", "0.6449596", "0.6449034", "0.64440316", "0.644157", "0.644157" ]
0.6958557
16
form data from /posts/new gets sent here (/posts) via POST
def create # displays post information in JSON format # render([current,] :text => params[:post].inspect ) # render text: params[:post].inspect # get post form data from params as new Post # Rails 4.0 # @post = Post.new(params[:post].permit(:title, :text)) @post = Post.new(params[:post]) # save post in sqlite db; save returns false if invalid if @post.save # send GET request to post, conveying post id => posts#show redirect_to @post else # invalid form # same form => posts#new render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new #http://localhost:3000/posts/new\n\t@post = Post.new #creates a new empty post,if a form is created for it, it will be empty as well \n end", "def new\n respond_with(@post)\n end", "def new\n # responsbile for creating a new instance of a post\n @post = Post.new\n end", "def new\n respond_with @post\n end", "def new\n post = Post.new\n render json: post\n end", "def new\n authenticated\n\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n respond_with(@post)\n end", "def new\n @post = Post.new\n respond_with(@post)\n end", "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n # Display a form to create a new post\n # The actual post creation is handled by method: create\n @post = Post.new\n end", "def new\n @post = current_user.posts.build\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\nend", "def new\n\t@post = Post.new\nend", "def new\n @post = Post.new(content: params[:content])\n end", "def new # Showing the new form\n # Responsible for creating a new instance of a post - not saved in DB yet.\n @post = Post.new\n end", "def new \n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n end", "def new\n @post = Post.new\n\n end", "def new\n @post = Post.new\n\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n redirect_to posts_path and return unless Mist.authorized?(:create_post, self)\n @post = Mist::Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n # We are going to use this in the form_for tag\n # Check out the documentation for it:\n # - http://guides.rubyonrails.org/form_helpers.html#customizing-form-builders\n # - http://guides.rubyonrails.org/form_helpers.html#using-form-helpers\n\n # It will use this instance variable inside as a requirement\n # And when we use a form_for tag, we will need to use\n # STRONG PARAMS for our `posts#create` action\n @post = Post.new\n\n render :new\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\r\n @post = Post.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @post }\r\n end\r\n end", "def new \n @post = Post.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n \t@post = Post.new\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end", "def new\n @post = session[:post] || @contest.posts.build\n @post.subject = @contest.name #|| params[:subject] if params[:subject]\n @post.url = @contest.url #|| params[:url] if params[:url]\n @post.description = @contest.description \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post }\n end\n end", "def new\r\n @post = Post.new\r\n end", "def new\n\t\t@post = Post.new\n\tend", "def new\n\t\t@post = Post.new\n\tend", "def new\n\t\t@post = Post.new\n\tend" ]
[ "0.7558007", "0.7335163", "0.72869104", "0.7255449", "0.7247171", "0.7241858", "0.71924084", "0.71924084", "0.71850437", "0.7173821", "0.7142579", "0.7125772", "0.71255106", "0.7113643", "0.70952046", "0.7083919", "0.7075052", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7072681", "0.7071918", "0.70635444", "0.70635444", "0.70576495", "0.70558935", "0.70484275", "0.70360065", "0.7021656", "0.70116514", "0.70108974", "0.70102775", "0.7008714", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.7007262", "0.6999265", "0.6968877", "0.6960353", "0.6960353", "0.6960353" ]
0.7168225
10
form data from /posts/:id/edit gets sent here (/posts/:id) via PATCH
def update # get current post form data @post = Post.find(params[:id]) # update post with form data from post/:id/edit # Rails 4.0 # if @post.update(params[:post].permit(:title, :text)) if @post.update_attributes(params[:post]) redirect_to @post else # same form => posts#edit render 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n post = PostsService.getPostById(params[:id])\n @post_update_form = PostUpdateForm.new(PostUpdateForm.attributes(post))\n end", "def edit \n\t@post=Post.find(params[:id])# URL is used to get de post id to find, @post gets assigned a post object, if a form is created for it, it will map such object properties \n end", "def edit\n @post = PostService.getPostById(params[:id])\n @post_form = PostForm.new(PostForm.initialize(@post))\n end", "def update\n #disable edit for now\n redirect_to posts_path\n return\n \n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = Post.find(params[:id])._id\n \n respond_to do |format|\n if ((@post.update_attributes(params[:post])) && (@post._id = id))\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit # Showing edit form\n @post = Post.find(params[:id])\n end", "def update\n @post = Post.find(params[:id])\n @title = \"EDIT\"\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n # @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find_by(id: params[:id])\n end", "def update\n authenticated\n\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\t\t@post = Post.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend", "def update\n # instantiant / Find\n @post = Post.find_by id: params[:id]\n # set values\n @post.title = params[:post][:title]\n @post.postbody = params[:post][:postbody]\n @post.user_id = params[:post][:user_id]\n # save it\n if @post.save\n # redirect to \"/posts\"\n redirect_to post_path(id: @post.id)\n else\n render :edit\n end\n end", "def edit\n # @post = Post.find(params[:id])\nend", "def edit\r\n @post = Post.find(params[:id])\r\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to posts_path, notice: 'Post was successfully updated.' }\n format.json { render json: @post }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n\t\t@post = Post.find(params[:id])\n\tend", "def edit\n\t\t@post = Post.find(params[:id])\n\tend", "def edit\n @post = Post.find(params[:id]) #find the post\n end", "def edit\n \t\t@post = Post.find(params[:id])\n\tend", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n @post = Post.find(params[:id])\n\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, :notice => 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find(params[:id])\n end", "def update\r\n @post = Post.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @post.update_attributes(params[:post])\r\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: '' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit\n @post = Post.find(params[:id])\n end", "def edit(id)\n @post = flash[:form_data] || Post[id]\n\n # Make sure the post is valid\n if @post.nil?\n flash[:error] = 'The specified post is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@post.title}\"\n\n render_view(:form)\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to :action => 'index', notice: 'Post was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n #@post = Post.find(params[:id])\n\n #respond_to do |format|\n # if @post.update_attributes(params[:post])\n # format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n # format.json { head :no_content }\n #else\n # format.html { render action: \"edit\" }\n # format.json { render json: @post.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'slam updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if signed_in? && author_signed_in?\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n end\n end\n else\n redirect_to root_path\n end\n end", "def update\n @post = Post.find(params[:id])\n\t@posts = Post.all\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\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 @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to \"/#{session[:username]}\", notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_edit_form\n @post_update_form = PostUpdateForm.new(post_update_form_params)\n unless @post_update_form.valid?\n render :edit\n else\n redirect_to :action => \"update_confirm\", title: @post_update_form.title, description: @post_update_form.description, state: @post_update_form.status, id: @post_update_form.id\n end\n end", "def update\n @user = current_user\n @post = @user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @post = Post.find(params[:post_id])\n\n assert(@post.kind_of?(Post))\n\n return @post\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n restrict('allow only admins and store users') or begin\n @post = Post.find_by_id(params[:id])\n @post.author = current_user\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html \n format.js {}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js {}\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end\n end", "def update\n @post = Post.find_by_slug(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n r = PostRepository.new\n @post = r.GetPost(\"PostID\", params[:id].to_i)\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to post_path(@post), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to magazine_post_path(@post.short_url), notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to @post, notice: 'Post actualizado con éxito.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n \n if @post.update_attributes(params[:post])\n redirect_to(posts_path, :notice => t(:post_updated))\n else\n render :action => \"edit\" \n end\n \n end", "def update\n respond_to do |format|\n if @post.update(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_by_title\n @post = Roxiware::Blog::Post.where(:guid=>request.env['REQUEST_PATH']).first\n raise ActiveRecord::RecordNotFound if @post.nil?\n authorize! :edit, @post\n\n respond_to do |format|\n format.html { render :partial =>\"roxiware/blog/post/editform\" }\n format.json { render :json => @post.ajax_attrs(@role) }\n end\n end", "def update\n\t@post=Post.find(params[:id])#params uses the URL to get de post id object\n\tif @post.update_attributes(params[:post])# gets passed in a post from URL\n\t\tredirect_to posts_path, :notice=>\"the post was updated\" #posts_path is a named route, can be inferred from command rake routes result\n\telse\n\t\trender \"edit\"\n\tend\n end", "def update\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(@post, :notice => 'Post was successfully updated.') }\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\t\t@post = post.find(params[:id])\n\t\t@post.update_attributes(post_params)\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_to post_path(@post)}\n\t\t\tformat.json {render json: @post}\n\t\tend\n\tend", "def update\n if @post.update_attributes(post_params)\n redirect_to post_path(@post)\n else\n render :edit\n end\n end", "def update\n if @post.update_attributes(post_params)\n redirect_to post_path(@post)\n else\n render :edit\n end\n end", "def update\n @post = current_user.posts.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to sites_url, notice: 'Post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @post.update_attributes(post_params)\n format.html { redirect_to @post, notice: 'Post was successfully updated.' }\n format.json { render :show, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post = Post.find(params[:id])\n\n respond_to do |format|\n if @post.update_attributes(params[:post])\n format.html { redirect_to(posts_url, :notice => 'Post was successfully updated.') }\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" ]
[ "0.7390354", "0.72732234", "0.7082918", "0.7036397", "0.6946387", "0.69179606", "0.6904007", "0.689846", "0.6893338", "0.6887264", "0.6857603", "0.68479586", "0.6810948", "0.680807", "0.6804186", "0.67984134", "0.67941487", "0.67941487", "0.67924577", "0.67798615", "0.67772454", "0.67643476", "0.6762067", "0.67572826", "0.67572826", "0.67572826", "0.67572826", "0.67572826", "0.67572826", "0.67572826", "0.67475533", "0.67475533", "0.67383045", "0.67231643", "0.6706471", "0.6706471", "0.6706471", "0.6706471", "0.6703757", "0.6703552", "0.6703552", "0.6703552", "0.66903824", "0.6690081", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6689886", "0.6676744", "0.66525006", "0.6649291", "0.6644427", "0.6628946", "0.6628003", "0.66272295", "0.6623109", "0.6622848", "0.66212654", "0.6617112", "0.66161877", "0.66033804", "0.66018677", "0.6588826", "0.6578253", "0.6576302", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65680474", "0.65674686", "0.65647405", "0.65645415", "0.6557482", "0.6549511", "0.6545408", "0.6539436", "0.65339154", "0.65300363", "0.65300363", "0.65292823", "0.6529037", "0.65245044" ]
0.706704
3
link_to 'link_name', post, method: :delete goes here
def destroy @post = Post.find(params[:id]) @post.destroy # back to posts#index redirect_to posts_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_link\n link_to 'Delete', blog_post_path(model), method: :delete\n end", "def link_to_delete(path)\n link_to 'Delete', path,\n data: { confirm: 'Are you sure you want to delete?' },\n method: 'delete',\n class: 'btn btn-danger btn-xs'\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @linkpost.destroy\n respond_to do |format|\n format.html { redirect_to linkposts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n destroy_and_respond(@link)\n end", "def destroy\n @link = Links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to('/') }\n end\n end", "def delete_post\n\t \n \tend", "def destroy\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html do\n redirect_to root_path,\n notice: \"Link was successfully deleted\"\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: '투표안건이 성공적으로 삭제되었습니다.' }\n format.json { head :no_content }\n end\n end", "def delete\n\t@post.destroy\n redirect_to @post, notice: 'Post was successfully destroyed.'\n \n \n \nend", "def delete\n destroy\n end", "def delete\n destroy\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :no_content }\n end\n end", "def link_to_delete(page)\n raw link_to 'Delete', admin_page_path(page),\n method: :delete,\n class: 'delete button',\n confirm: confirm_delete_message\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to root_url+\"#show-links\", notice: 'Link was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to new_link_url, notice: \"Link was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.json { head :ok }\n end\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Review was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def destroy\n redirect_to '/posts'\n end", "def destroy\n @post.destroy\n redirect_to \"/\"\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n respond_to do |format|\n format.html { redirect_to links_url, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n Post.find(params[:id]).delete\n\n redirect_to '/'\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @link = Link.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(links_url) }\n format.xml { head :ok }\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 destroy\n respond_with @post.destroy\n end", "def destroy\n @link_resource.destroy\n respond_to do |format|\n format.html { redirect_to @lab }\n format.json { head :no_content }\n end\n end", "def destroy\n @link.destroy\n flash[:success] = \"Link to Doc Deleted\"\n redirect_to current_user\n \n end", "def delete\n @post = Post.find(params[:id])\n end", "def link_action_destroy(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.delete\"), 'remove', path,\n :confirm => ti(:confirm_delete),\n :method => :delete\n end", "def destroy\n @post.destroy\n redirect_to root_url\n end", "def delete(url)\n call(url: url, action: :delete)\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def destroy\n @post.destroy\n head :no_content\n end", "def delete; rest_delete(link('self')); end", "def delete; rest_delete(link('self')); end", "def destroy\n @post.destroy\n\n head :no_content\n end", "def link_to_deleting(entity = @entity, text = \"削除する\", options = {}, html_options = {})\n link_to_altering(entity, text, :destroying, options, html_options)\n end", "def destroy\n @post.destroy\n\n redirect_to posts_url\n end", "def destroy\n @demo_link.destroy\n respond_to do |format|\n format.html { redirect_to demo_links_url, notice: 'Demo link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n end", "def link_action_destroy(path = nil)\n path ||= path_args(entry)\n link_action ti(:\"link.delete\"), 'remove', path,\n :data => { :confirm => ti(:confirm_delete),\n :method => :delete }\n end", "def destroy\n @post.destroy\n redirect_to posts_path\n end", "def destroy\n @post.destroy\n redirect_to posts_path\n end", "def clicks_delete_link(link_text)\n clicks_link_with_method(link_text, :delete)\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n end\n end", "def link_to_remove(path)\n link_to path,\n method: \"delete\",\n class: \"btn btn-danger btn-sm\",\n title: \"Excluir\",\n data: { confirm: label_translate(:confirm_delete),\n 'confirm-button-text': \"Confirmar\",\n 'cancel-button-text': \"Cancelar\",\n 'confirm-button-color': \"#66CD00\",\n 'cancel-button-color': \"#ff0000\",\n 'sweet-alert-type': \"warning\",\n },\n style: \"color: #FFF; float: none;\" do\n content_tag :span, class: \"fa fa-trash-o\" do\n end\n end\n end", "def destroy\n #\n end", "def destroy\n #\n end", "def destroy\n @post = Post.find(params[:id])\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_path }\n end\n end", "def destroy\n @post.destroy\n redirect_to posts_url \n end", "def destroy\n\n @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to dashboard_index_path }\n format.json { head :no_content }\n end\n end", "def delete(path, params = {})\n post(path, params.merge(\"_method\" => \"delete\"))\n end", "def link_to_destroy(path)\n link_to icon('remove-sign'), path, :confirm => 'Are you sure?', :method => :delete, title: 'Delete this record'\n end", "def destroy\n @linkctr.destroy\n respond_to do |format|\n format.html { redirect_to linkctrs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @post = Post.find(params[:id])\n # @post.destroy\n\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/posts' }\n format.json { head :no_content }\n end\n end", "def destroy\n # @post = Post.find(params[:id])\n #@post.destroy\n\n #respond_to do |format|\n # format.html { redirect_to posts_url }\n #format.json { head :no_content }\n #end\n end", "def destroy\n respond_with Post.destroy(params[:id])\n end", "def destroy\n @link = @entity.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to links_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @task_link.destroy\n respond_to do |format|\n format.html { redirect_to task_links_url, notice: 'Task link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n head :no_content\n end", "def destroy\n head :no_content\n end", "def destroy\n @link.destroy\n respond_to do |format|\n format.html { redirect_to campaign_links_path, notice: 'Link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.7959172", "0.7734061", "0.72457945", "0.7226492", "0.7196123", "0.70085675", "0.6975256", "0.6965957", "0.6963446", "0.69621575", "0.69582254", "0.6921334", "0.69010836", "0.69010836", "0.69007975", "0.69007975", "0.69007975", "0.68970144", "0.6888937", "0.6862053", "0.6862053", "0.6862053", "0.6862053", "0.6862053", "0.6862053", "0.6862053", "0.6862053", "0.68550694", "0.68515384", "0.6849205", "0.6838184", "0.68329936", "0.6824401", "0.68234104", "0.681549", "0.6788148", "0.67843795", "0.677445", "0.67699945", "0.6752212", "0.6752212", "0.6752212", "0.6752212", "0.6752212", "0.6752212", "0.67491305", "0.67491305", "0.67491305", "0.67491305", "0.67491305", "0.67491305", "0.67491305", "0.6744767", "0.6733597", "0.67202044", "0.6694393", "0.66801137", "0.6673055", "0.6668774", "0.66656816", "0.66656816", "0.6665359", "0.6665359", "0.66532916", "0.6650337", "0.66475016", "0.66441554", "0.66397613", "0.6638739", "0.6630546", "0.6630546", "0.6626425", "0.66217655", "0.6606557", "0.65955", "0.65955", "0.6592152", "0.6591894", "0.65765554", "0.65714675", "0.65630996", "0.6556789", "0.65477496", "0.6545866", "0.6543904", "0.6531229", "0.6531125", "0.6519386", "0.65184015", "0.6516252", "0.6516252", "0.65112627", "0.65106803", "0.65106803", "0.65106803", "0.65106803", "0.65106803", "0.65106803", "0.65106803", "0.65106803", "0.65106803" ]
0.0
-1
Register new callback See main example
def callback(event, method, callback) reg_callback(event.to_sym, method.to_sym, callback.to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def callback\n\n end", "def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend", "def callback\n end", "def callback\n\tend", "def callback_method\n run(\"on\", \"string\", \"callback\")\n end", "def add_callback(type, options, &block); end", "def callback(&block)\n @callbacks << block\n end", "def register_callback(&proc)\n if ready?\n proc.call(sync)\n else\n @callbacks << proc\n end\n end", "def insert_callback(&block)\n @callbacks << block\n end", "def setCB(callback)\n @callbackfn = callback\n end", "def register_callback(&block)\n @_aclize_callback = block\n end", "def callbacks; end", "def callbacks; end", "def callback(&block)\n @callbacks ||= []\n @callbacks << block\n end", "def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end", "def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end", "def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end", "def register_callback(id, &block)\n callback = block\n @registered_callbacks[id] = callback\n end", "def method_missing(callback_name, &block)\n @callbacks[callback_name] = block\n end", "def callback\n self.class.callback\n end", "def callback\n self.class.callback\n end", "def callback\n @callback ||= method(:push)\n end", "def callback=(_arg0); end", "def on_connect(&callback)\n @connect_cb = callback\n end", "def on(callback_name, &block)\n raise(ArgumentError, \"Argument 'callback_name' must be a String.\") unless callback_name.is_a?(String)\n raise(ArgumentError, \"Argument 'callback_name' can not be '#{callback_name}'.\") if @@reserved_callbacks.include?(callback_name)\n raise(ArgumentError, \"Must have a Proc.\") unless block_given?\n @procs_callback[callback_name] = block\n return self\nend", "def add_update_callback &cb\n\t\t\t@update_callbacks << cb\n\t\t\tcb\n\t\tend", "def register_completion_callback(callback)\n @duty_completion_callback = callback\n end", "def append_callback(callback_name, &callback)\n connection.append_callback(callback_name, callback)\n end", "def register_callback(label)\n @callbacks << label unless @callbacks.include?(label) || label == 'application'\n end", "def register_callback(&callback)\n EM.schedule do\n if @stream.empty?\n @stream_callbacks << callback\n else\n callback.call(@stream.shift)\n end\n end\n end", "def callback_type; end", "def callback\n def_deferr = ::EventMachine::DefaultDeferrable.new\n proc_callback = Proc.new { |response| ::OnesnooperServer::Log.debug(\n \"[#{self.class.name}] Handled as: #{response}\"\n ) }\n\n def_deferr.callback &proc_callback\n def_deferr.errback &proc_callback\n\n def_deferr\n end", "def register_default(callback)\n @callbacks.add_default(callback)\n end", "def on(what, &block)\n @callback_map[what] = block\n end", "def initialize(callback)\n @callback = callback\n end", "def callback_registered(namespaces, callback)\n # Get rid of all arguments passed to the namespaces. Will support arguments in the future.\n namespaces = namespaces.map { |namespace| namespace.first }\n \n theatre.namespace_manager.register_callback_at_namespace namespaces, callback\n end", "def callback(&blk)\n @blk=blk\n end", "def definecallback(&b)\r\n\t$gamemode.definecallback(&b)\r\nend", "def register_callback(c_when, method)\n callbacks[c_when] << method\n end", "def callback( which, *args )\n block = instance_variable_get( \"@on_#{which.to_s}\" )\n block.call( *args ) if block\n end", "def callback &block\n @callback = block\n if @callback_args\n @callback.call *@callback_args\n end\n self\n end", "def define_callback(callback_name)\n add_callback_setter(callback_name)\n add_callback_array_writer(callback_name)\n end", "def register_request_callback(&block)\n request_callbacks << block\n end", "def write_callback(name)\r\n write _package_.callbacks[name].string\r\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def set_Callback(value)\n set_input(\"Callback\", value)\n end", "def let(callback_name, &block)\n raise ArgumentError, \"Incorrect callback `#{callback_name}'.\" unless [:uuid_scope, :push].include?(callback_name)\n @callbacks[callback_name] = block\n end", "def callbacks\n @callbacks ||= {}\n end", "def callback\n @callback ||= :value.to_proc\n end", "def append_callback(callback_name, callback)\n callbacks[callback_name] = callback\n callbacks_queue << callback_name\n end", "def add_callback(&block)\n @blocks << block\n end", "def add_callback(command_class, callback)\n @callbacks[command_class] = [] unless @callbacks.include?(command_class)\n @callbacks[command_class] << callback\n end", "def verify_callback=(verify_callback); end", "def verify_callback=(verify_callback); end", "def set_callback\n @callback = ::Callback.find(params[:id])\n end", "def initialize()\n @callbacks = {}\n end", "def on_connect(&callback)\n if block_given?\n @on_connect = callback\n elsif @on_connect\n @on_connect.call\n end\n end", "def record_callback(on, *names)\n names.each do |name|\n on.on name do |*args|\n callback_recorded(name, args)\n end\n end\n end", "def register(msg, callback)\n key = msg.kind_of?(Numeric) \\\n ? (\"%03d\" % msg) \\\n : msg.to_s.upcase\n @callbacks.add(key, callback)\n end", "def call_callback(symbol, *args, &block)\n init_callbacks unless @callbacks\n @callbacks[symbol].each { |func| func.call(*args, &block) }\n @callback_log.puts \"[#{self.class} call_callback] : #{symbol}\" if @callback_log\n end", "def on_notification(&block)\n @callback = block\n end", "def on_process(&callback)\n @callback = callback\n end", "def on name, &block\n (callbacks[name] ||= []) << block\n end", "def callback\n @on_declare\n end", "def prepend_callback(callback_name, &callback)\n connection.prepend_callback(callback_name, callback)\n end", "def watcher_callback\n @callback ||= Proc.new do |event|\n # Set new watcher\n watch\n # Rediscover\n discover\n end\n end", "def callback(name)\r\n target = _package_.callbacks[name]\r\n capture_block(target) { yield }\r\n end", "def on_data(&callback)\n @data_callback = callback\n end", "def register_failure_callback(callback)\n @duty_failure_callback = callback\n end", "def add_callback(sym, func=nil, &block)\n init_callbacks unless @callback\n if func && block || !func && !block\n raise(ArgumentError,\n \"Either pass a block (block), or a Proc (func)\")\n end\n (@callback[sym] ||= []).push(func || block)\n end", "def callback &block\n super\n end", "def callback &block\n super\n end", "def register_update_handle_callback(&blk)\n @logger.debug(\"Register update handle callback with #{blk}\")\n @update_handle_callback = blk\n end", "def add_callback(sym, func=nil, &block)\n init_callbacks unless @callback\n if func && block || !func && !block\n raise(ArgumentError,\n \"Either pass a block (block), or a Proc (func)\")\n end\n (@callback[sym] ||= []).push(func || block)\n end", "def callback(&block)\n return yield if closed?\n @callbacks << block\n end", "def add_callback(hook_name, handle_or_method=nil, &block)\n if block\n add_block_callback(hook_name, handle_or_method, block)\n else\n add_method_callback(hook_name, handle_or_method)\n end\n end", "def add_callback(hook_name, handle_or_method=nil, &block)\n if block\n add_block_callback(hook_name, handle_or_method, block)\n else\n add_method_callback(hook_name, handle_or_method)\n end\n end", "def pubsub_callback &block\n @pubsub_callback = block\n end", "def add_basic_callback(handle=nil, &block)\n add_block_callback(HookR::BasicCallback, handle, &block)\n end", "def after_set_callback; end", "def recv_callback\n @recv_callback ||= Proc.new {|message|}\n end", "def facebook\n callback\n end", "def have_callback(method)\n HaveCallback.new(method)\n end", "def callbacks(*callback_names)\n new_callbacks = Set.new(callback_names) - _callback_names\n new_callbacks.each do |callback_name|\n add_callbacks_accessor callback_name\n define_callback callback_name\n add_invoke_callback callback_name\n end\n self._callback_names = new_callbacks\n end", "def register_plugin_for(plugin_name,value,callback_type,default=nil,callback_fct=nil,&block)\n current_loader_instance.register_plugin_for(plugin_name,value,callback_type,default,callback_fct,&block)\n end", "def register_ctcp(msg, callback)\n @ctcp_callbacks.add(msg.to_s.upcase, callback)\n end", "def listen_to(io, &callback); end", "def add_external_callback(handle=nil, &block)\n if block.arity > -1 && block.arity < params.size\n raise ArgumentError, \"Callback has incompatible arity\"\n end\n add_block_callback(HookR::ExternalCallback, handle, &block)\n end", "def on_update(&update_callback)\n @update_callbacks << update_callback\n end", "def add_external_callback(handle=nil, &block)\n if block.arity > -1 && block.arity < params.size\n raise ArgumentError, \"Callback has incompatible arity\"\n end\n add_block_callback(Hookr::ExternalCallback, handle, &block)\n end", "def set_callback(string, set_callback_status)\n @callback = string\n @callback_status = true if set_callback_status\n end", "def callback (name, params=[])\n @receiver.send(name, *params) if @receiver.respond_to?(name)\n end", "def callback name, *args\n cb = @callbacks[name.to_sym]\n return unless cb\n log.debug { \"callback: #{name}\" }\n cb.call(*args)\n end", "def _callback_names=(new_callbacks)\n @_callback_names = _callback_names | new_callbacks\n end", "def subscribe(&callback)\n @parent_callback = callback\n end" ]
[ "0.79436696", "0.7775793", "0.7760033", "0.76499873", "0.7610878", "0.76004326", "0.75556475", "0.7364512", "0.73558766", "0.73374283", "0.7248841", "0.72468543", "0.72468543", "0.72236365", "0.7213837", "0.7213837", "0.7213837", "0.7213837", "0.7102855", "0.7096066", "0.7096066", "0.70936567", "0.7051735", "0.70085", "0.69707793", "0.69598305", "0.69232154", "0.6916353", "0.6912952", "0.6856618", "0.6852164", "0.6839692", "0.68381923", "0.683444", "0.6821861", "0.6725139", "0.67232925", "0.6694585", "0.6677317", "0.6676382", "0.666626", "0.6638128", "0.66089296", "0.6604785", "0.65972054", "0.6595232", "0.6594914", "0.6594914", "0.6594914", "0.6594914", "0.658498", "0.6571021", "0.6565979", "0.6540944", "0.6538399", "0.65383697", "0.65347767", "0.6526828", "0.6526828", "0.6524765", "0.6518774", "0.65183663", "0.6514314", "0.6503962", "0.6486886", "0.64845353", "0.6467569", "0.64546806", "0.64458793", "0.6392799", "0.6359357", "0.6345494", "0.63412166", "0.6313465", "0.63030434", "0.62995046", "0.62995046", "0.6295614", "0.62922204", "0.62915957", "0.6271272", "0.6271272", "0.6265054", "0.6252429", "0.62499297", "0.6237373", "0.6235445", "0.6233124", "0.623163", "0.62255555", "0.62219155", "0.6209772", "0.6206741", "0.61974025", "0.6193625", "0.6185853", "0.61736405", "0.6172763", "0.61671215", "0.6165261" ]
0.70218736
23
Creates an Item ownership
def create item = current_user.find_item(params[:id]) item.assign_attributes(params[:item]) response = current_user.follow_item(item) unless response.is_a? StandardError redirect_to items_path, notice: "Item suivi" else redirect_to new_item_path(item.id), alert: response.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 add_item(item)\r\n items.push(item)\r\n item.owner = self\r\n end", "def create(attributes)\n response = JSON.parse(@client.post('items', attributes).body)\n Promisepay::Item.new(@client, response['items'])\n end", "def add_item(item)\n fail \"An items id should initially be nil, but was #{item.id}\" unless (item.id == nil)\n fail \"An item must have an owner when added to the system.\" if (item.owner == nil)\n item.id = @item_id_count\n @items.store(@item_id_count, item)\n @item_id_count += 1\n end", "def create_item(data_bag, item_name, data = {}, metadata = {})\n item = ::SecureDataBag::Item.new(metadata)\n item.raw_data = { 'id' => item_name }.merge(data)\n item.data_bag data_bag\n item\n end", "def create_item( *args )\n raise NotImplementedError.new(\"Subclasses must implement #create_item\")\n end", "def create\n @item = @user.items.build item_params.merge(private: true)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to private_items_user_path(@user), notice: t('.notice') }\n format.json { render :show, status: :created, location: @item }\n else\n @item.image = Image.new\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 = current_user.items.build(item_params)\n authorize! :read,@item\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 create\n @item = Item.new(item_params)\n# authorize @item\n @item.user = current_user \n if @item.save\n flash[:notice] = \"\\\"#{@item.name}\\\" was added to your registry.\"\n else\n flash[:error] = \"There was a problem adding the item to your registry. Please try again.\"\n end\n redirect_to user_registry_path(current_user.link_id)\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index)\n \n ucItem = UCVictoryItem.new(self, item, rect)\n \n return ucItem\n end", "def create\n ##ensure that the cart item is new\n \n check_for_create(@auth_shopping_cart_item)\n @auth_shopping_cart_item = add_owner_and_signed_in_resource(@auth_shopping_cart_item)\n \n @auth_shopping_cart_item.save\n\n respond_with @auth_shopping_cart_item\n end", "def create\n @item = current_user.items.build(item_params)\n if @item.save\n redirect_to items_path, notice: 'Item was successfully created.'\n else\n render :new, notice: 'Something went wrong try again.'\n end\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 item_create\n @brief = Brief.find(params[:brief_id])\n @brief_vendor = @brief.brief_vendors.find_by_org_id(@cur_user.org_id)\n invalid_op unless @brief_vendor\n @brief_vendor.items << Item.new(params[:item]){|r|r.kind = params[:kind]}\n redirect_to vendor_show_brief_path(@brief)\n end", "def create\n @item = current_user.items.build(params[:item])\n\n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to home_path }\n format.xml { head :created, :location => item_url(@item) }\n else\n format.html { render :action=>:new }\n format.xml { render :xml=>@item.errors.to_xml }\n end\n end\n end", "def create\n # @item = Item.new(item_params)\n @item = current_user.items.build(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\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 @item = Item.new(params[:item])\n @item.user = current_user\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_item_from(order_item, lot_code = nil, expires_at = nil, amount = nil)\n transfer_items.create!(\n order_item: order_item,\n product: order_item.product,\n lot_code: lot_code || order_item.lot_code,\n expires_at: expires_at,\n amount: amount || order_item.waiting\n )\n end", "def create_item(name, price)\r\n new_item = Models::Item.created( name, price, self )\r\n self.item_list.push(new_item)\r\n new_item.save\r\n return new_item\r\n end", "def create\n @order_item = OrderItem.new(order_item_params)\n authorize @order_item\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", "def create\n @item = current_user.items.create(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to [current_user, @item], notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n @item.pictures.build\n format.html { render action: 'new', :locals => {item:@item} }\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.user = current_user\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\n @item = Item.new(params[:item])\n @item.user_id = current_user.id\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/main', :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 place(direct, preposition, target, detail = 'default')\n ItemRelationship.create!(\n source: direct,\n target: target,\n detail: detail,\n preposition: preposition\n )\nend", "def create_item(user_id, data) \n data = data.just(SETTABLE_ITEM_FIELDS)\n data[:user_id] = user_id\n data[:title] ||= 'item'\n data[:price] ||= 5\n data[:price] = data[:price].to_i\n data[:slug] = get_unique_slug($items,:slug,data[:title])\n\n data[:imgs] = data[:imgs].to_a.map {|link| {link: link}}\n data[:videos] = data[:videos].to_a.map {|link| {link: link}}\n data[:status] = :pending\n item = $items.add(data)\nend", "def create\n @item = Item.new(item_params)\n @item.user_id = current_user.id\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 @item.user = current_user\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 params[:item][:user_id] = current_user.id\n # @user = User.find(params[:id])\n\n @item = Item.create(item_params)\n\n redirect_to \"/items/#{@item.id}\"\n end", "def create\n @item = Item.new(params[:item])\n @item.load_item_photos_with_params( params[:item] )\n\n specified_child = nil\n if auth_user.is_a?(Parent)\n specified_child_id = params[:item].try(:[], :user_id)\n if specified_child_id.to_i > 0 && auth_user.children.find { |child| child.id == specified_child_id }\n specified_child = User.find_by_id(specified_child_id)\n end\n specified_child ||= auth_user.children.last # refer to latest child\n @item.status = ::Item::Status::OPEN\n end\n @item.user = specified_child || auth_user\n last_item = Item.owned_by(@item.user).last\n if last_item && last_item.description.strip == @item.description\n logger.info \"------ #{@item.user.display_name} is posting duplicate of last item (#{last_item.id})\"\n @item = last_item\n else\n logger.info \"------ #{@item.user.display_name} creating item #{@item}\"\n end\n\n respond_to do |format|\n if @item.save\n logger.info \"------ #{@item.user.display_name} created item #{@item}\"\n logger.info \" -------------------- DONE w/ item ----------\"\n format.html { redirect_to @item, notice: 'Item was successfully created. ' + flash[:notice].to_s }\n format.json { render json: {item: @item, status: :created, success: true, location: @item } }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"new\", item: params[:item], category_id: params[:category_id] }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def create_item\n object = @spawn_object.call\n\n object.pool_create if object.respond_to? :pool_create\n\n item = PoolItem.new(object)\n\n @item_stack.push(item)\n\n item\n end", "def create\n @order = Order.find(request[:order_id])\n @order_item = OrderItem.new(params[:order_item])\n @order_item.order_id = @order.id\n @order_item.owner = current_user\n\n respond_to do |format|\n #if @order.order_items.push(@order_item)\n result = @order_item.save()\n if result\n format.html { redirect_to [@order, @order_item], notice: \"This item was successfully added to '#{@order.name}'.\" }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if !self.auth_admin\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_path(@item), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n end\n end\n end\n end", "def create\n\n @item = Item.new(params[:item])\n\n if(!@item.borrower.nil? && @item.borrower != \"\")\n UserMailer.loaned_notification_email(current_user, @item).deliver\n end\n\n current_user.items.push @item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(root_path, :notice => 'Item was successfully created.') }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @item = current_user.items.build(item_params)\n\n\n respond_to do |format|\n if @item.save\n\n format.html { redirect_to edit_pics_path(:id => @item.id), notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n\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 = current_user.items.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 do\n flash[:alert] = 'Something went wrong while creating an item.'\n render action: \"new\"\n end\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n ucItem = UCItem.new(self, item, rect)\n ucItem.active = enable?(item)\n \n if $game_party.newest_items.include?(item)\n ucItem.cItemName.font.color = Color.new_item_color\n ucItem.cItemNumber.font.color = Color.new_item_color\n end\n \n return ucItem\n end", "def create_item\n @item = Fox_Item.new(self, @content.join(\"\\t\"), @icon, @icon)\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_item(name, price)\r\n new_item = Trading::Item.created( name, price, self )\r\n self.item_list.push(new_item) # AK You can also do `item_list << new_item`\r\n return new_item\r\n end", "def new\n @item = current_user.items.build\n end", "def create\n @item = Item.new(item_params)\n manifestation = Manifestation.find(@item.manifestation_id)\n\n respond_to do |format|\n if @item.save\n @item.manifestation = manifestation\n Item.transaction do\n if defined?(EnjuCirculation)\n if @item.reserved?\n flash[:message] = t('item.this_item_is_reserved')\n @item.retain(current_user)\n end\n end\n end\n format.html { redirect_to(@item, notice: t('controller.successfully_created', model: t('activerecord.models.item'))) }\n format.json { render json: @item, status: :created, location: @item }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_to_inventory\n @user = User.find(params[:id])\n @item = Item.find(1)\n @user.items.push(@item)\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 new_item(content)\n Item.new(:project_id => @project_id, :content => content)\n end", "def create(params = {})\n item = build(params)\n item.save\n item\n end", "def create\n @part_types = Constants::PART_TYPES\n @item = Item.new(item_params.merge(user_id: current_user.id))\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_item(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacterGraphic.new(self, Rect.new(rect.x+9,rect.y+9,30,30), actor,\n 0, 255, 0, PARTY_CONFIG::CHARS_FACING_DIRECTION)\n \n if actor != nil && actor.party_locked\n ucItem.cCharGraphic.opacity = 125\n end\n \n return ucItem\n end", "def create_feed_item\n feed_item = FeedItem.create(:item => self)\n owner.feeds.create(:feed_item_id => feed_item.id, :is_public => true)\n notifiers = [] + owner.followers\n notifiers += [event.owner]\n notifiers.uniq!\n notifiers.each{|p| p.feeds.create(:feed_item_id => feed_item.id, :is_public => false)}\n end", "def create\n @user_address_book_item = UserAddressBookItem.new(params[:user_address_book_item])\n\n unless @user_address_book_item.save\n logger.debug \"UserAddressBookItem there`s problem to save #{self.name} #{self.email} user_id==#{user_id}\"\n end\n end", "def create\n @item = Item.from_url(item_params[:url])\n @item.user = current_user\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_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", "def create\n @item = Item.new(item_params)\n @user = User.find_by_id(session[:user_id]) if session[:user_id]\n\n @item.rating = 0\n @item.rating_count = 0\n @item.current_amount = item_params[:max_amount]\n @item.user = @user #This is the owner of the item\n respond_to do |format|\n if @item.save\n format.html { redirect_to user_supplier_path_url(@user)}\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(index)\n actor = @data[index]\n rect = item_rect(index)\n \n ucItem = UCCharacterGraphic.new(self, Rect.new(rect.x+9,rect.y+9,30,30), actor,\n 0, 255, 0, PARTY_CONFIG::CHARS_FACING_DIRECTION)\n \n if actor != nil && actor.reserve_locked\n ucItem.cCharGraphic.opacity = 125\n end\n \n return ucItem\n end", "def create\n @item = Item.new(item_params)\n vendor = Vendor.find(item_params[:vendor_id])\n @item.build_vendor(:id => vendor.id)\n @item.save!\n @current_item = @item\n @items = Item.all\n end", "def create\n @item = @project.items.build(item_params)\n @item.user = current_user\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 make_item(object_type_name)\n\n ot = ObjectType.find_by(name: object_type_name)\n raise \"Could not find object type #{name}\" unless ot\n\n Item.make({ quantity: 1, inuse: 0 }, sample: self, object_type: ot)\n\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 = Item.new\n @item.prevent_processing!\n @item.attributes = params[:item]\n @item.user = current_user\n\n authorize! :create, @item\n\n respond_to do |format|\n if @item.check_user_limit(current_user) && @item.save\n format.html { redirect_to(items_path, notice: I18n.t('create.success') ) }\n format.json { render action: :create, status: :ok, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render action: :create, status: :unprocessable_entity }\n end\n end\n end", "def new\n @item = Item.new\n end", "def add_item(itemToAdd)\r\n itemToAdd.set_owner(self)\r\n itemToAdd.deactivate\r\n self.items.push(itemToAdd)\r\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "def new\n @item = Item.new\n end", "def create_item(item_code)\n \t\txero = XeroConnection.new.connect\n\n \t\tif xero.Item.all(where: 'code == \"%s\"' % item_code).empty?\n \t\t\tnew_item = xero.Item.build(code: item_code)\n \t\t\tnew_item.save\n \t\tend\n \tend", "def create\n @item = Item.new(item_params) #Remember to add Session[user_id]\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 set_item\n @item = current_owner.items.find(params[:id])\n end", "def new\r\n @item = Item.new\r\n @item.user_id = 0\r\n end", "def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end", "def create(*args)\n item = build_virtual_item(*args)\n @conglomerate.items.push(item)\n [item]\n end", "def create\n @item = Item.new(item_params)\n @item.save\n redirect_to @item\n end", "def create\n @item = Item.find(params[:item_id])\n @unit = @item.units.create(params[:unit])\n \n redirect_to item_path(@item)\n end", "def createItem(title, description, date)\n new_item = List.new\n new_item.title = title\n new_item.description = description\n new_item.save\n new_item.date = date\n end", "def create\n upload_item params[params[:item_type]], session['username'], params[:alternative_name], params[:tag_name], params[:item_type], params[:details]\n end", "def create_item\n if @work_order_item.present?\n render json: :conflict, status: :conflict\n else\n @work_order_item = WorkOrderItem.new\n @work_order_item.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_item.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_item.save\n render json: serialized_work_order_item(@work_order_item), status: :created\n else\n render json: format_errors(@work_order_item), status: :unprocessable_entity\n end\n end\n end", "def create_item(list_id, content, responsible_party=nil, notify=true)\n record \"/todos/create_item/#{list_id}\",\n :content => content, :responsible_party => responsible_party,\n :notify => notify\n end", "def create!(name, params = {})\n item = build(name, params)\n item.save!\n item\nend", "def create\n @item = Item.new(item_params)\n @category = Category.find(params[:category]) unless params[:category].nil?\n respond_to do |format|\n if @item.save\n @category.items << @item if @category\n current_user.items << @item\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(item)\n item.available? ? items.create(cartable: item) : false\n release\n end", "def create\n @album = Album.find_by_slug(params[:album_id])\n @album_item = @album.album_items.create(params[:album_item])\n\n respond_to do |format|\n if @album_item.save\n format.html { redirect_to @album, notice: 'Album item was successfully created.' }\n format.json { render json: @album_item, status: :created, location: @album_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @album_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_todo_item(title, description)\n new_item = Todoitem.new\n new_item.title = title\n new_item.description = description\n new_item.save\n end", "def create(item_attrs = {})\n body = { value: item_attrs }\n Iterable.request(conf, base_path).put(body)\n end", "def create\n @product = Product.find(params[:product_id])\n @item = current_user.items.new(item_params)\n if @item.save\n redirect_to @product, success: 'Item was successfully created.'\n else\n redirect_to @product, alert: 'Все проебал'\n end\n end", "def create\n @item = Item.new(item_params)\n \n if @item.save\n redirect_to @item\n else\n render :new\n end\n end", "def new_item(opts={})\n defaults = {:number => @items.count + 1}\n @items << ItemRecord.new(defaults.merge(opts))\n end", "def create\n @item = @resource.new(params[@object_name])\n\n set_attributes_on_create\n\n respond_to do |format|\n if @item.save\n format.html do\n params[:resource] ? create_with_back_to : redirect_on_success\n end\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 new_with(item) \n occupation = item.occupation\n if occupation.present?\n link_text = occupation&.link_text || 'n/a'\n organization = find_or_create_org(link_text, occupation)\n\n link = find_or_create_link(link_text, \"XING\", \"xing\", (occupation&.link || 'n/a'))\n\n unless (link.nil? || organization.links.exists?(link.id))\n organization.links << link\n end\n end\n end", "def create\n @order_item = OrderItem.new(order_item_params)\n @order_item.requested_by = current_user\n\n respond_to do |format|\n if @order_item.save\n format.html { redirect_to @order_item, notice: 'Order item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @order_item }\n else\n format.html { render action: 'new' }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, LibraryItem\n @library_item = current_account.library_items.new(library_item_params)\n add_flash :notice => I18n.t('library_item.created') if @library_item.save\n respond_with @library_item\n end", "def create_with_item(params_item, params_fuman)\n ActiveRecord::Base.transaction do\n\n #TODO 条件にservice_codeもいれる\n #TODO 二重で登録されているところあり\n item = Item.find_by_product_id(params_item[:product_id])\n\n # create\n if item.nil?\n\n name = ApiBucket::Service.name(params_item[:service_code].to_i)\n\n if Rails.env.test?\n item = @service.lookup(params_item[:product_id])\n else\n service = ApiBucket::Service.instance(:\"#{name}\")\n res = service.lookup(params_item[:product_id])\n item = res.items.first\n end\n\n params_item.merge!({\n url: item.detail_url,\n preview_url: item.preview_url,\n title: item.title,\n description: item.description,\n release_date: item.release_date,\n image_s: item.image[:l][:url],\n image_m: item.image[:l][:url],\n image_l: item.image[:l][:url],\n price: item.price\n })\n\n item = Item.new(params_item)\n raise ActiveRecord::Rollback unless item.save\n end\n\n @fuman = Fuman.where(user_id: @user.id).where(item_id: item.id).first\n return true if @fuman.present?\n\n # create\n params_fuman.merge!({\n user_id: @user.id,\n item_id: item.id\n })\n\n @fuman = Fuman.new(params_fuman)\n raise ActiveRecord::Rollback unless @fuman.save\n end\n\n true\n end", "def create\n # The item is either \"Local\" or \"Remote\" depending on the source selected\n @item = Item.factory(params[:source], params[@hash_key.to_sym])\n \n respond_to do |format|\n if @item.save\n flash[:notice] = 'Item was successfully created.'\n format.html { redirect_to(item_url(@item)) }\n format.xml { render :xml => @item, :status => :created, :location => @item }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_two_items\n Item.create(id: 1,\n name: \"Ergonomic Steel Bottle\",\n description: \"Sint quasi modi officiis.\",\n image_url: \"http://robohash.org/0.png?set=set2&bgset=bg1&size\",\n created_at: \"2016-03-08 14:53:57\",\n updated_at: \"2016-03-08 14:53:57\")\n\n Item.create(id: 2,\n name: \"Ergonomic Steel Hat\",\n description: \"Sint quasi modi officiis.\",\n image_url: \"http://robohash.org/0.png?set=set2&bgset=bg1&size\",\n created_at: \"2016-03-08 14:53:57\",\n updated_at: \"2016-03-08 14:53:57\")\n end", "def create(options)\n item = build(options)\n item.save\n item\n end", "def create_feed_item\n feed_item = FeedItem.create(:item => self)\n owner.feeds.create(:feed_item_id => feed_item.id, :is_public => true)\n notifiers = [] + owner.followers\n notifiers += lesson.watchers\n notifiers -= [owner]\n notifiers.uniq!\n notifiers.each{|p| p.feeds.create(:feed_item_id => feed_item.id, :is_public => false)}\n end", "def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @item\n end", "def create\n @rentable_item = RentableItem.new(rentable_item_params)\n @rentable_item.save\n end", "def create_item( name, destination, publish_headers={}, broker_name=nil)\n \n # Get the real broker from the symbolic broker name.\n b = @broker_registry[ broker_name ] \n\n raise TypeError.new(\"Broker must respond to #new_destination\") unless \n b.adapter.respond_to?( :new_destination ) \n\n dest = b.adapter.new_destination( name, destination, publish_headers )\n dest.validate!\n \n # This is done so that adapters will not attempt to to use instance \n # variables to store state. \n dest.freeze \n end", "def create\r\n @item = Item.new(params[:item])\r\n if @item.save\r\n redirect_to @item, notice: 'Item was successfully created.'\r\n else\r\n render action: \"new\"\r\n end\r\n end", "def create_item(index)\n item = @data[index]\n rect = item_rect(index, true)\n \n shopItem = UCShopItem.new(self, item, rect,\n SHOP_CONFIG::ITEM_NUMBER_PATTERN)\n \n shopItem.cItemPrice.align = 2\n shopItem.cItemPossess.align = 2 \n shopItem.cItemPossess.font = Font.shop_possess_font\n shopItem.ucItemNumber.cLabelNumber.align = 2\n shopItem.ucItemNumber.min = 0\n shopItem.ucItemNumber.max = shopItem.inventory_quantity\n return shopItem\n end" ]
[ "0.71065676", "0.6800479", "0.6615203", "0.6584053", "0.65206856", "0.646244", "0.6439581", "0.6412984", "0.6397264", "0.6373707", "0.63604087", "0.6359704", "0.63543564", "0.6351245", "0.6350269", "0.6338161", "0.6331081", "0.6304055", "0.62841266", "0.62719464", "0.62632835", "0.626141", "0.6246457", "0.62412506", "0.62389874", "0.6223038", "0.62199366", "0.62153476", "0.6206143", "0.61970633", "0.6189969", "0.61754614", "0.6165875", "0.6162346", "0.6144096", "0.61313546", "0.6120971", "0.61206293", "0.6114201", "0.6091875", "0.60815066", "0.6077231", "0.6066544", "0.6051194", "0.60391885", "0.60317636", "0.60264564", "0.60149115", "0.60144836", "0.6014399", "0.6008376", "0.5993109", "0.5992855", "0.59912425", "0.59882766", "0.5980867", "0.5966084", "0.596404", "0.59581566", "0.5952869", "0.5941463", "0.59339345", "0.5933912", "0.5933912", "0.5933912", "0.59299695", "0.59110224", "0.5907752", "0.5905298", "0.5900506", "0.5894344", "0.58935153", "0.58914423", "0.58839315", "0.5880246", "0.5864055", "0.58633775", "0.5854705", "0.5848287", "0.58411705", "0.58211213", "0.5813212", "0.5811047", "0.58064663", "0.58062357", "0.58025515", "0.5798372", "0.57980454", "0.57917494", "0.5786279", "0.57795614", "0.57739663", "0.5770386", "0.57697845", "0.57686263", "0.57660025", "0.5759806", "0.57536525", "0.5746504", "0.57448643" ]
0.62673426
20
Updates an Item ownership
def update item = current_user.item_infos(params[:id]) item.assign_attributes(params[:item]) response = current_user.update_item(item) unless response.is_a? StandardError redirect_to items_path, notice: "Item mis a jour" else redirect_to edit_item_path(item), alert: response.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_item\n @item = current_owner.items.find(params[:id])\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n end", "def update\n authorize! :edit, @item\n if @item.update(item_params)\n redirect_to @item\n else\n render 'edit'\n end\n\n end", "def item_update(item)\n @item = item\n end", "def notify_item_ownership\n [[buyer, buyer_items], [seller, seller_items]].each do |set|\n shareholder, items = set\n items.each do |item|\n item.owner = shareholder\n end\n end\n end", "def update\n @ownership = ownerships.find(params[:id])\n\n respond_to do |format|\n if @ownership.update_attributes(params[:ownership])\n format.html { redirect_to my_games_path, notice: 'Your game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ownership.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @conflicting_ownership = args[:conflicting_ownership] if args.key?(:conflicting_ownership)\n @territory = args[:territory] if args.key?(:territory)\n end", "def update!(**args)\n @item_id = args[:item_id] if args.key?(:item_id)\n end", "def update\n @item = Item.find(params[:id])\n\n if @item.user.id == current_user.id && @item.update(items_params)\n redirect_to item_path(@item)\n else\n render :edit\n end\n end", "def manage_update\n item = resource_for_controller\n raise 'shouldnt get this far without manage rights' unless item.can_manage?\n item.update(params_for_controller)\n update_sharing_policies item\n respond_to do |format|\n if item.save\n flash[:notice] = \"#{t(item.class.name.underscore)} was successfully updated.\"\n format.html { redirect_to(item) }\n format.json { render json: item, include: json_api_include_param }\n else\n format.html { render action: 'manage' }\n format.json { render json: json_api_errors(item), status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @location_name = args[:location_name] if args.key?(:location_name)\n @ownership = args[:ownership] if args.key?(:ownership)\n end", "def update\n @item.update!(item_params)\n end", "def update_owner(organization, owner_id)\n if owner_id\n new_owner = User.find(owner_id)\n\n unless new_owner.owns\n new_owner.organization = organization\n new_owner.save\n end\n end\n end", "def set_Ownership(value)\n set_input(\"Ownership\", value)\n end", "def update_item\n pcp_item.update_new_assmt( self )\n end", "def update\n check_for_update(@auth_shopping_cart_item)\n @auth_shopping_cart_item.assign_attributes(@auth_shopping_cart_item_params)\n @auth_shopping_cart_item = add_owner_and_signed_in_resource(@auth_shopping_cart_item) \n @auth_shopping_cart_item.save\n puts @auth_shopping_cart_item.errors.full_messages.to_s\n respond_with @auth_shopping_cart_item\n end", "def update\n @album_owned = AlbumOwned.find(params[:id])\n\n respond_to do |format|\n if @album_owned.update_attributes(params[:album_owned])\n format.html { redirect_to @album_owned, notice: 'Album owned was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @album_owned.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_order_item\n \n end", "def update\n @rentable_item.update(rentable_item_params)\n end", "def update_owner(user)\n self.notify = true if self.owner != user\n self.owner = user unless user.nil?\n self.save\n end", "def update(args)\n return @client.api_helper.command(args, \"item_update\")\n end", "def update\n @asset_item = AssetItem.find(params[:id])\n ori_amount = @asset_item.amount\n\n respond_to do |format|\n if @asset_item.update_attributes(params[:asset_item])\n auto_create_or_update_asset_item_detail( @asset_item.id, @asset_item.amount, ori_amount ) if ori_amount != @asset_item.amount\n flash[:notice] = 'AssetItem was successfully updated'\n format.html { redirect_to(asset_items_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @asset_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item = current_user.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: \"#{@item.name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html do\n flash[:alert] = 'Something went wrong while updating an item.'\n render action: \"edit\"\n end\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @receipt.items.find_by(id: params[:id])\n\n unless @item\n return render_error_code(:not_found,\n :db_failure,\n item: 'was not found')\n end\n\n if @item.update(permitted_params)\n render_ok\n else\n render_error_code(:bad_request, :db_failure, @item.errors)\n end\n end", "def update\n @reward_owner.update(reward_owner_params)\n @reward_owner = RewardOwner.new\n @reward_owners = RewardOwner.all\n end", "def update_item\n @item = Item.find(params[:id])\n @item.update(params[:item])\n redirect \"/items/#{@item.id}\"\n end", "def update\n @accounting_item = Accounting::Item.find_by(id: params[:id], user_id: @current_user.id)\n logger.info @accounting_item.inspect\n\n respond_to do |format|\n if @accounting_item.update(item_params)\n format.json { head :no_content }\n else\n format.json { render json: @accounting_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n item = Item.find(params[:item_id])\n\n item.name = params[:name]\n item.details = params[:details]\n item.save\n end", "def update\n @item = Item.find(params[:id])\n\n logger.info \"Item: #{@item}\\nw/ param attr: #{params[:item].inspect}\"\n respond_to do |format|\n @item.attributes = params[:item].select{|k,v| ![:item_photos, :item_photos_attributes, :location].include?(k.to_sym) }\n\n @item.load_item_photos_with_params(params[:item] )\n\n if @item.save\n\n @item.set_by_user(auth_user)\n\n logger.info \" C) after save: attr: #{@item.attributes}\"\n\n if manage_item_photos(@item).present? || @item.changed?\n @item.save\n logger.info \" D) attr: #{@item.attributes}\"\n end\n\n format.html {\n redirect_to inventory_approve_item_path(:user_id => \"#{@item.owner.id}\")\n }\n format.json { render json:{ item: @item, success: true} }\n else\n set_flash_messages_from_errors(@item)\n format.html { render action: \"edit\" }\n format.json { render json: { error: @item.errors.first.join(' ') }, status: :unprocessable_entity }\n end\n end\n end", "def test_can_edit_org_item\n user = User.named(\"user\")\n org = Organization.named(\"org\")\n\n item = org.propose_item(\"Item\", 20, :fixed, nil, nil)\n assert(!user.can_edit?(item))\n\n user.work_on_behalf_of(org)\n assert(user.on_behalf_of.can_edit?(item))\n end", "def update\n @library_item = current_account.library_items.find(params[:id])\n authorize! :update, @library_item\n params[:library_item].delete(:user_id)\n if @library_item.update_attributes(library_item_params)\n add_flash :notice, t('library_item.updated')\n end\n respond_with @library_item, location: params[:destination] || request.env['HTTP_REFERER'] || library_items_path\n end", "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n format.html { redirect_to owners_path, notice: 'Oferta a fost updatata cu success.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n @location = args[:location] if args.key?(:location)\n end", "def update\n\n @item = Item.find(params[:id])\n @item.update(item_params)\n\n redirect_to user_list_path(@item.list.user, @item.list)\n end", "def update!(**args)\n @create_item = args[:create_item] if args.key?(:create_item)\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to user_item_path(current_user, @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\n @owner = Owner.find(params[:id])\n @owner.house.owner_name = @owner.name\n if @owner.update_attributes(params[:owner])\n redirect_to(owners_url, :notice => '更新业主信息成功')\n else\n render :action => \"edit\"\n end\n end", "def update!(**args)\n @owners = args[:owners] if args.key?(:owners)\n @readers = args[:readers] if args.key?(:readers)\n @writers = args[:writers] if args.key?(:writers)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def release_item(item)\r\n if self.items.include?(item)\r\n item.owner = nil\r\n self.items.delete(item)\r\n end\r\n end", "def set_item\n @item = current_user.items.find(params[:id])\n end", "def update!(**args)\n @item = args[:item] if args.key?(:item)\n @location = args[:location] if args.key?(:location)\n @update_mask = args[:update_mask] if args.key?(:update_mask)\n end", "def update_item(index, attrs)\n new_items = items\n new_items[index] = new_items[index].merge(attrs)\n item = item_from_attributes(new_items[index])\n raise ActiveRecord::RecordInvalid, item unless item && item_is_valid?(item)\n update_attribute :items, new_items\n item\n end", "def release_item(item)\n if self.items.include?(item)\n item.owner = nil\n self.items.delete(item)\n end\n end", "def update\n @item ||= Item.find_by_id_or_name(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @item.update(item_params)\n return success_item_show\n else\n return error_item_save\n end\n end", "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@item.user, @item], notice: t('.notice') }\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 @item.update_attributes(params[:item])\n respond_with @item\n end", "def update\n @total_owner = TotalOwner.find(params[:id])\n\n respond_to do |format|\n if @total_owner.update_attributes(params[:total_owner])\n format.html { redirect_to(@total_owner, :notice => 'Total owner was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @total_owner.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_item(item)\r\n items.push(item)\r\n item.owner = self\r\n end", "def update!(**args)\n @create_item = args[:create_item] if args.key?(:create_item)\n @delete_item = args[:delete_item] if args.key?(:delete_item)\n @move_item = args[:move_item] if args.key?(:move_item)\n @update_form_info = args[:update_form_info] if args.key?(:update_form_info)\n @update_item = args[:update_item] if args.key?(:update_item)\n @update_settings = args[:update_settings] if args.key?(:update_settings)\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @publisher = args[:publisher] if args.key?(:publisher)\n @ratio = args[:ratio] if args.key?(:ratio)\n @territories = args[:territories] if args.key?(:territories)\n @type = args[:type] if args.key?(:type)\n end", "def update\n \n @invoice_item.update(@invoice_item)\n respond_with(@invoice)\n \n end", "def updated(item)\n end", "def update\n get_item\n @pcp_subject = @pcp_item.pcp_subject\n @pcp_step = @pcp_subject.current_step\n if @pcp_step.status_closed?\n render_bad_logic t( 'pcp_items.msg.subj_closed')\n return\n end\n if user_has_permission?( :to_update ) then\n respond_to do |format|\n if @pcp_item.update( pcp_item_params )\n format.html { redirect_to @pcp_item, notice: t( 'pcp_items.msg.edit_ok' )}\n else\n format.html { render :edit }\n end\n end\n else\n render_no_permission\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to owners_path, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: owners_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @source = args[:source] if args.key?(:source)\n end", "def item_update(item)\n debug \"item update\"\n row = @contacts_rows[item.jid]\n unless row\n add_item_to_roster(item)\n row = @contacts_rows[item.jid]\n end\n fill_model_values_for_item item, row\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 @list.append_items!(params.dig(:list, :items), current_user)\n redirect_to [@project, @randomization_scheme], notice: \"Items successfully added.\"\n end", "def update_item\n self.item.update_complete\n end", "def update\n @inventory_item = InventoryItem.find(params[:id])\n @binder = Binder.find(@inventory_item.binder_id)\n \n authorize! :write, @inventory_item\n\n respond_to do |format|\n if @inventory_item.update_attributes(params[:inventory_item])\n @inventory_items = InventoryItem.where(:binder_id => @inventory_item.binder_id).order(\"name\")\n format.html { redirect_to @inventory_item, notice: 'Inventory item was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_item.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def set_item\n @item = @user.items.find_by id: params[:id]\n end", "def update!(**args)\n @mobile_owner_id = args[:mobile_owner_id] if args.key?(:mobile_owner_id)\n end", "def update\n get_projects\n\n @breadcrumb = 'update'\n @billable_item = BillableItem.find(params[:id])\n @billable_item.updated_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @billable_item.update_attributes(params[:billable_item])\n format.html { redirect_to @billable_item,\n notice: (crud_notice('updated', @billable_item) + \"#{undo_link(@billable_item)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_item(list, name, quantity)\r\n # steps: \r\n # check if item is present\r\n if list[name] != nil\r\n # update with new amount\r\n list[name] = quantity\r\n end\r\n return list\r\n # output: list\r\nend", "def update\n respond_to do |format|\n if @users_item.update(users_item_params)\n format.html { redirect_to @users_item, notice: 'Users item was successfully updated.' }\n format.json { render :show, status: :ok, location: @users_item }\n else\n format.html { render :edit }\n format.json { render json: @users_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item(item)\n fail \"An items id should initially be nil, but was #{item.id}\" unless (item.id == nil)\n fail \"An item must have an owner when added to the system.\" if (item.owner == nil)\n item.id = @item_id_count\n @items.store(@item_id_count, item)\n @item_id_count += 1\n end", "def update\n item = Item.find(params[:id])\n if item.user == current_user\n if item.update(item_params)\n render json: item\n else\n render json: {errors: item.errors}, status: :unprocessable_entity\n end\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @owner = args[:owner] if args.key?(:owner)\n @reader = args[:reader] if args.key?(:reader)\n @writer = args[:writer] if args.key?(:writer)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @self_link = args[:self_link] if args.key?(:self_link)\n @total_items = args[:total_items] if args.key?(:total_items)\n end", "def update!(**args)\n @items = args[:items] if args.key?(:items)\n @self_link = args[:self_link] if args.key?(:self_link)\n @total_items = args[:total_items] if args.key?(:total_items)\n end", "def update_qty(list_items, item_name, new_qty)\n raise ArguementError.new(\"This item does not exist\") unless list_items.include?(item_name)\n list_items[item_name] = item_qty\nend", "def update\n @poem = current_user.poems.find(params[:id])\n unless @poem.owned_by?(current_user)\n redirect_to(poems_path, :alert => 'Nie jestes autorem tego wiersza!')\n end\n\n\n respond_to do |format|\n if @poem.update_attributes(params[:poem])\n format.html { redirect_to(@poem, :notice => 'Zaktualizowano wiersz.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @poem.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if !self.auth_admin\n respond_to do |format|\n @item.update(item_params)\n format.html { redirect_to item_path(@item), notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item } \n end\n end\n end", "def update_item(id, content, responsible_party=nil, notify=true)\n record \"/todos/update_item/#{id}\",\n :item => { :content => content }, :responsible_party => responsible_party,\n :notify => notify\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to edit_owner_path(@owner), notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @owner.update(owner_params)\n format.html { redirect_to @owner, notice: 'Owner was successfully updated.' }\n format.json { render :show, status: :ok, location: @owner }\n else\n format.html { render :edit }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @item = @user.items.find(params[:id])\n\n @item.update(:type_list => \"\", :tag_list => \"\")\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to [@user, @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\n\n end", "def update\n @owner = Owner.find(params[:id])\n\n respond_to do |format|\n if @owner.update_attributes(params[:owner])\n flash[:notice] = 'Proprietario atualizado com sucesso'\n format.html { redirect_to :action => 'show', :id => @owner.id}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @owner.errors, status: :unprocessable_entity }\n end\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 redirect_nonadmin(root_url)\n @item = Item.find(params[:id])\n orig_inventory = @item.inventory\n if @item.update(item_params)\n if orig_inventory <= 0 && @item.inventory > 0 && !@item.disabled\n @item.subscriber_list.users.each do |user|\n UserMailer.with(user: user, item: @item).subscribe_email.deliver_now\n end\n @item.subscriber_list.users.clear\n end\n redirect_to @item\n else\n render 'edit'\n end\n end", "def update\n if @item.update(item_params)\n redirect_to items_path, notice: 'Item was successfully updated.'\n else\n render :edit, notice: 'Something went wrong try again.'\n end\n end", "def update\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to deal_items_url(@deal), 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 if @item.update(item_params)\n redirect_to @item, notice: 'Item was successfully updated.'\n else\n render :edit\n end\n end", "def update_names\n\t\tparams[:item].each do |key, item|\n\t\t\tcurrent_item = Item.find(key)\n\t\t\tcurrent_item.update(:claimed_by => item[:claimed_by])\n\t\tend\n\t\tflash[:success] = \"Names updated.\"\n\t\tredirect_to(:back)\n\tend", "def update\n @unit = Unit.find(params[:id])\n @item = Item.find(@unit.item_id)\n respond_to do |format|\n if @unit.update_attributes(params[:unit])\n format.html { redirect_to @item, notice: 'Unit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unit.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6524459", "0.64993316", "0.64993316", "0.64794767", "0.6428831", "0.63823146", "0.6323374", "0.63119066", "0.6305324", "0.62764156", "0.62289596", "0.622146", "0.62140685", "0.6185285", "0.61844456", "0.6155139", "0.6139814", "0.61117005", "0.6110154", "0.6087916", "0.60870683", "0.60808694", "0.607207", "0.60674924", "0.6043651", "0.60285807", "0.60233974", "0.60202", "0.60027206", "0.6000356", "0.597443", "0.59676236", "0.5953631", "0.59489936", "0.5933083", "0.59225756", "0.5914247", "0.5893929", "0.5883069", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.58795226", "0.5857949", "0.5857949", "0.5857949", "0.5856564", "0.58504784", "0.5846448", "0.583495", "0.5819814", "0.58160114", "0.58104473", "0.58070135", "0.57976747", "0.579247", "0.5791368", "0.5790389", "0.57877964", "0.57784104", "0.5778331", "0.57774526", "0.57510173", "0.57491046", "0.5748015", "0.5741221", "0.5740318", "0.5736803", "0.57339734", "0.5732411", "0.57270485", "0.57237417", "0.5711873", "0.57116675", "0.57090414", "0.5704959", "0.57043326", "0.57037264", "0.57037264", "0.57025516", "0.5699421", "0.56962645", "0.5692229", "0.5678779", "0.56742", "0.56742", "0.5667715", "0.5666685", "0.5664648", "0.5660107", "0.56542754", "0.56448007", "0.56425196", "0.5637959", "0.56345534" ]
0.6397933
5
Deletes an Item ownership
def destroy response = current_user.unfollow_item(params[:id]) redirect_to items_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end", "def release_item(item)\r\n if self.items.include?(item)\r\n item.owner = nil\r\n self.items.delete(item)\r\n end\r\n end", "def release_item(item)\n if self.items.include?(item)\n item.owner = nil\n self.items.delete(item)\n end\n end", "def delete_item(item)\n @chores.delete(item)\n end", "def destroy\n authorize! :edit, @item\n @item.destroy\n redirect_to items_path\n end", "def destroy\n get_item\n @pcp_subject = @pcp_item.pcp_subject\n if @pcp_subject.user_is_owner_or_deputy?( current_user, @pcp_item.pcp_step.acting_group_index )\n if @pcp_item.released?\n notice = 'pcp_items.msg.cannot_del'\n else \n @pcp_item.destroy\n notice = 'pcp_items.msg.delete_ok'\n end\n respond_to do |format|\n format.html { redirect_to pcp_subject_pcp_items_path( @pcp_subject ), notice: t( notice )}\n end\n else\n render_no_permission\n end\n end", "def destroy\n @item.destroy!\n end", "def destroy\n \t@user = User.find(params[:user_id])\n \t@item = @user.items.find(params[:id])\n \t@item.destroy\n \tredirect_to @user\n \tend", "def destroy\n @item = Item.find(params[:id])\n\n if @item.user.id == current_user.id\n @item.destroy\n redirect_to root_path\n else\n redirect_to item_path(@item)\n end\n end", "def delete_item(item)\r\n @list.delete(item)\r\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 delete_item(item)\n @get_items.delete(item)\n end", "def destroy\n AlbumOwnership.find_by({album_id: @album.id, user_id: current_user.id}).destroy\n end", "def delete_item(item_id, log = true)\r\n item = Item.by_id(item_id)\r\n\r\n fail if item.nil?\r\n fail unless self.can_delete?(item)\r\n\r\n item.owner.release_item(item)\r\n item.delete\r\n\r\n ItemDeleteActivity.create(self, item).log if log\r\n end", "def delete_item(item_id, log = true)\n item = Item.by_id(item_id)\n\n fail if item.nil?\n fail unless self.can_delete?(item)\n\n item.owner.release_item(item)\n item.delete\n\n Analytics::ItemDeleteActivity.with_remover_item(self, item).log if log\n end", "def destroy\n @user_address_book_item = UserAddressBookItem.find(params[:id])\n @user_address_book_item.destroy\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 \n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to user_path(current_user.id) }\n format.json { head :ok }\n end\n end", "def destroy\n @rentable_item.destroy\n end", "def remove_item(id:)\n order.items.destroy(id)\n end", "def deleteItem\n\t\tif @public_id\n\t\t\tCloudinary::Uploader.destroy(@public_id)\n\t\tend\n\tend", "def destroy\n item = Item.find(params[:item_id])\n user = User.find(item[:user_id])\n if(user && user[:username] == session['username'])\n if (item.item_type == 'file')\n FileUploader.delete_file item.path\n end\n Item.delete(params[:item_id])\n end\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to private_items_user_path(@user), notice: t('.notice') }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list = WishList.find(params[:wish_list_id])\n @item = @wish_list.items.find(params[:item_id])\n\n if @item.purchased_by == current_user\n @item.purchased_by = nil\n @item.save\n else\n flash[:alert] = \"You do not have permission to unpurchase this Item.\"\n end\n head 200\n end", "def destroy\n @item.destroy\n redirect_to my_account_url, notice: 'Item was successfully destroyed.'\n end", "def brief_vendor_del_item\n brief = Brief.find(params[:brief_id])\n brief_vendor = brief.brief_vendors.find_by_org_id(params[:vendor_id])\n item = brief_vendor.items.find_by_parent_id(params[:item_id])\n\n item.destroy\n\n redirect_to(cheil_brief_vendor_items_url(params[:brief_id],params[:vendor_id])) \n end", "def destroy\n @item.destroy\n redirect_to items_url, notice: \"This item was removed from the system.\"\n end", "def remove_item\n\tsaved = current_user.saved\n\titem = saved.items.find(params[:item])\n saved.items.delete(item)\n redirect_to :back\n\tend", "def destroy\n @orden_item.destroy\n respond_to do |format|\n format.html { redirect_to orden_items_url, notice: 'Orden item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = Item.find(params[:id])\n authorize @item\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 destroyItem(id)\n item = List.find(id)\n item.destroy\n end", "def remove_item\n\n end", "def remove_item(item)\n @items.delete(item)\n end", "def unlinkItem _obj, _args\n \"_obj unlinkItem _args;\" \n end", "def destroy\n @item.destroy\n redirect_to items_path, notice: 'Item was successfully destroyed.'\n end", "def destroy\n @item.destroy\n redirect_to items_url, notice: 'Item was successfully destroyed.'\n #head :no_content\n end", "def destroy\n user = @item.user\n @item.destroy\n respond_to do |format|\n format.html { redirect_to user_path(user) }\n format.json { head :no_content }\n end\n end", "def grocery_item_deleter(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def destroy\r\n @item = Item.find(params[:id])\r\n @item.destroy\r\n redirect_to items_url\r\n end", "def destroy\n authorize @item\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 remove(item)\r\n @contents.delete(item)\r\n end", "def destroy\n @item.destroy\n return success_item_destroy\n end", "def user_delete_item\n @item = Item.find_by_id(params[:id])\n if @item.auction_flag\n #@auction = Auction.find(@item.auction_id)\n #@auction.destroy\n redirect_to item_path(@item),:notice => \"You can't delete this item, because its auctioned and it has a bidder\"\n\n else\n @item.destroy\n redirect_to(:action => 'user_items_list')\n end\n\n end", "def destroy\n @item ||= Item.find_by_id_or_name(params[:id])\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 if item.user == current_user\n item.destroy\n render json: {status: :ok}, status: :ok\n else\n render json: {errors: \"you can't do it\"}, status: :unprocessable_entity\n end\n end", "def delete_item\n if current_user\n @item = Item.find(params[:id].to_i)\n current_cart.items.delete(@item)\n redirect_to cart_path\n else\n delete_item_in_guest_cart(params[:id].to_i)\n redirect_to cart_path\n end\n end", "def destroy\n @item = current_user.lists.items.find(item_params)\n @item.destroy\n flash[:success] = \"Item deleted\"\n redirect_to current_user\n end", "def trash(item)\n receipts_for_item(item).delete_all\n item.destroy if item.receipts(true).empty?\n end", "def destroy\n @item.destroy\n redirect_to items_url, notice: 'Item was successfully destroyed.'\n end", "def remove item #(item: pointer)\n freeitem item\n delete item\n end", "def delete_from(grocery, item)\n grocery.delete(item)\n grocery\nend", "def destroy\n @aux=@item_pautum\n @item_pautum.destroy\n respond_to do |format|\n format.html { redirect_to pautum_path(@aux.pautum), notice: 'Item da pauta removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_item(item_id)\n raise \"implemented in subclass\"\n end", "def delete_item (grocery, item_name)\n grocery.delete(item_name)\n display_list(grocery)\n end", "def destroy\n @book_item.destroy\n redirect_to user_path\n end", "def delete_item(access_token)\n @client.item.remove(access_token)\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to user_items_url(current_user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @accident_item.destroy\n respond_to do |format|\n format.html { redirect_to accident_items_url }\n format.json { head :no_content }\n end\n end", "def delete_item(item)\n unless item.nil?\n @items.delete(item.to_s.downcase)\n end\n @items\n end", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(current_user) }\n format.xml { head :ok }\n end\n end", "def deleted(item)\n end", "def delete_item(db, item_name, current_user)\r\n db.execute(\"DELETE FROM items WHERE item_name = ? AND user_id = ?\", [item_name, current_user])\r\nend", "def destroy\n @itemtipo.destroy\n\n head :no_content\n end", "def destroy\n @item.destroy\n head :no_content\n end", "def remove_item(user, item)\n before = get_item_count\n self.items.delete(item)\n after = get_item_count\n (before-after-1).times do\n user.add_to_list(item)\n end\n end", "def destroy\n raise \"Permission denied\" if (RemoveItemOrderTask.roles & @permissions).empty?\n OrderItem.transaction do\n item = @order.items.find(params[:id])\n item.destroy\n task_complete({ :data => { :product_id => item.product.id, :item_id => item.id } },\n RemoveItemOrderTask, [RemoveItemOrderTask])\n end\n redirect_to :back\n end", "def delete(id)\n @item = Item.find_by_id(id)\n \n begin\n item.destroy!\n say 'Item Deleted'\n rescue StandardError => e\n say e.message\n end\n end", "def destroy\n\t\t@item.destroy\n\t\thead :no_content\n\tend", "def destroy\n Todoable.client.delete(path)\n list.items.delete(self)\n true\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 remove_item(item)\n\t$grocery_list.delete(item)\n\tp \"You crossed off #{item} from your list.\"\nend", "def removeItem _obj, _args\n \"_obj removeItem _args;\" \n end", "def delete_item(list,item)\n\tlist.delete(item)\nend", "def destroy\n @billable_item = BillableItem.find(params[:id])\n\n respond_to do |format|\n if @billable_item.destroy\n format.html { redirect_to billable_items_url,\n notice: (crud_notice('destroyed', @billable_item) + \"#{undo_link(@billable_item)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to billable_items_url, alert: \"#{@billable_item.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @billable_item.errors, status: :unprocessable_entity }\n end\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 @convenience_item.destroy\n respond_to do |format|\n format.html { redirect_to convenience_items_url, notice: 'Convenience item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_an_item(code_item_to_delete)\n to_do_list.delete_at(code_item_to_delete)\n end", "def destroy\n return render status: 403 if @item.user != current_user\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 item_delete(delete_item)\n @items.delete_if {|e| e.description == delete_item.capitalize}\n conf_message(delete_item, \"removed\")\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 delete_item\n\nend", "def destroy\n @pedido=@item.pedido\n @item.destroy\n respond_to do |format|\n format.html { redirect_to @pedido, notice: 'Se ha eliminado el item del pedido' }\n format.json { head :no_content }\n end\n end", "def destroy\n @instancia_item = InstanciaItem.find(params[:id])\n @instancia_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(instancia_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @users_item.destroy\n respond_to do |format|\n format.html { redirect_to users_items_url, notice: 'Users item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item = NavItem.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to nav_items_url, notice: t('nav_items.destroyed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_alias.destroy\n end", "def del_item(list, item_to_del)\n list.delete(item_to_del)\nend", "def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(manage_items_url, :notice => 'Item was successfully deleted.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @household_item.destroy\n respond_to do |format|\n format.html { redirect_to household_items_url, notice: 'Household item was successfully destroyed.' }\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 remove_from\n begin\n study = Study.find(params[:study_id])\n unless study.user_id != session[:user_id] || study.active\n params[:items].each do |i|\n item = Item.find(i)\n unless item.study_id != params[:study_id].to_i\n item.destroy\n end\n end\n end\n rescue\n \n ensure\n redirect_to(edit_study_path(params[:study_id]))\n end\n end", "def delete(item)\n if @items.include?(item)\n @items.delete_at(item.id)\n true\n else\n false\n end\n end", "def remove_item(id)\n @items.delete_at(id)\n end", "def delete( item )\n LOG.debug \"#{self} is attempting to delete #{item.name} (#{item})\"\n @lock.synchronize do\n @registry.delete( item.name )\n LOG.debug \"Deleted #{item.name} (#{item}) from #{self}.\" \n end\n notify_observers(:delete, item)\n end", "def destroy\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n @purchase_item.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_path(@purchase) }\n format.json { head :no_content }\n end\n end", "def destroy\n @priced_item = PricedItem.find(params[:id])\n @priced_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_priced_items_url) }\n format.xml { 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 delete_item(iid)\n params = {'pio_iid' => iid}.merge(default_params)\n @connection.delete(:items, iid, params).body\n end", "def destroy\n @ownership = ownerships.find(params[:id])\n @ownership.destroy\n\n respond_to do |format|\n format.html { redirect_to my_games_path, notice: 'Your game was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @user.id != current_user.id\n redirect_to '/'\n else\n @item.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end" ]
[ "0.7630052", "0.719516", "0.7162218", "0.71107256", "0.7108014", "0.7081457", "0.6870279", "0.6864934", "0.6802759", "0.67891395", "0.67815685", "0.6777144", "0.6731851", "0.6697997", "0.66948354", "0.6656977", "0.66555476", "0.66475236", "0.66152525", "0.6614076", "0.6613086", "0.66100067", "0.6593144", "0.6591107", "0.6566015", "0.65338224", "0.6502878", "0.64956605", "0.64780164", "0.64774036", "0.6474617", "0.6473808", "0.64689124", "0.6464314", "0.6460141", "0.64595395", "0.64590096", "0.64495796", "0.64485514", "0.644141", "0.64309007", "0.64177215", "0.641619", "0.64119625", "0.6399439", "0.6399039", "0.63987356", "0.6390026", "0.6372179", "0.63717246", "0.63612944", "0.6359972", "0.63577265", "0.6354314", "0.63539743", "0.63532406", "0.63532186", "0.6306847", "0.6304703", "0.6298024", "0.62963253", "0.6294695", "0.6279258", "0.6278143", "0.627627", "0.62737113", "0.6249685", "0.62489444", "0.62466913", "0.62451035", "0.6236345", "0.6232859", "0.62273467", "0.6224033", "0.6223214", "0.62202615", "0.6219341", "0.6217682", "0.6214945", "0.6213716", "0.62136155", "0.62030005", "0.62020445", "0.6199815", "0.619745", "0.61950856", "0.61824965", "0.6171628", "0.6169579", "0.6168414", "0.61671793", "0.61643815", "0.6148667", "0.61468977", "0.6146251", "0.614571", "0.614525", "0.6143235", "0.6141892", "0.61402184" ]
0.6542159
25
Find entity by ID id: ID of the entity Returns: Entity object. Returns null entity object if no result.
def find_by_id(id) raise NotImplementedError.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end", "def find(id)\n @adapter.find(collection, id).tap do |record|\n raise Lotus::Model::EntityNotFound.new unless record\n end\n end", "def find_by_id!(id)\n found = entities.detect { |elm| elm.id == id }\n raise Occi::Core::Errors::CollectionLookupError, \"Entity #{id.inspect} not found in the collection\" unless found\n found\n end", "def find_by_id(id)\n filtered_set(entities, key: 'id', value: id)\n end", "def find_entity(entity_id, entity_type)\n entity_class = begin; entity_type.constantize; rescue; nil; end\n return if entity_class.nil?\n\n @entity = if entity_class.respond_to?(:visible)\n entity_class.visible.find_by(id: entity_id)\n else\n entity_class.find_by(id: entity_id)\n end\n end", "def find_by_id(id)\n find(id)\n end", "def find(id)\n finder_or_run(:find, id)\n end", "def find id, preserve_html=false\n check_for_falsy_id id\n Entity.new id, preserve_html\n end", "def find(id)\n find_by_id(id).tap { |result|\n if result.nil?\n raise RecordNotFound, \"#{self.class.name}#find with ID #{id.inspect} was not found\"\n end\n }\n end", "def find_by_id(id)\n find_by_attributes(:id => id).first\n end", "def find id\n return nil if node.ids.empty?\n node.send(:orm_class).find id\n end", "def find(id)\n find_result\n end", "def find(id)\n repository.find(self, id)\n end", "def find(id)\n map_id = proc { |object| object.respond_to?(:id) ? object.send(:id) : object }\n\n result = find_by_id_or_ids(map_id, id)\n\n fail RecordNotFound.new(\n \"Couldn't find #{name} with '#{id_property_name}'=#{id.inspect}\",\n name, id_property_name, id) if result.blank?\n result.tap { |r| find_callbacks!(r) }\n end", "def find(id); end", "def find(id); end", "def find_by_id(id)\n find_by(:id, id)\n end", "def find(id)\n raise NotImplementedError\n end", "def find_by_id(id)\n find_by_id!(id)\n rescue TopdeskAPI::Error::RecordNotFound\n nil\n end", "def find(id)\n first(\"Id = '#{id}'\")\n end", "def find(id)\n describe(entity(id))\n end", "def find id\n model.find id\n end", "def find(entity_set, id)\n query = service[entity_set].query\n url_chunk = query.find(id)\n\n body = api_get(url_chunk).body\n build_entity(entity_set, body)\n end", "def find(id)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path lambda { \"#{@owner.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get(path, @params)\n end", "def find(id)\n klass.find(id)\n end", "def find(id)\r\n find_one do |record|\r\n record.id == id\r\n end\r\n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && !results['id'].blank? && new(results) || nil\n end", "def find_by_id(id)\n resp = get(\"/#{exposed_as}/#{id}\")\n case resp.response.code.to_i\n when 200\n result = MultiJson.load resp.parsed_response\n new(result)\n when 404\n nil\n else\n raise \"#{self.class.name}#try_find with ID #{id.inspect} returned unexpected response: #{resp.inspect}\"\n end\n end", "def find(id, optional = {})\n find_all([id], optional).first\n end", "def find(id)\n self.detect{|x| x.id == id.to_i}\n end", "def entity_by_id(model_class)\n halt 400 unless (params[:id].to_i.to_s == params[:id])\n model_class[params[:id]] || (halt 404)\n end", "def find(id)\n # Used where so no exception will be raised if the instance\n # does not exist.\n @model.unscoped.where(@model_data['mappings']['id'].to_sym => id).first\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(id)\n Ribs.with_handle(self.database) do |h|\n h.get(self.metadata.persistent_class.entity_name, id)\n end\n end", "def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.class.name} with ID=#{id}\")\n end", "def find(id)\n where({'id' => \"#{id}\"}).first\n end", "def find_by_id(clazz, id)\n clazz.find(id)\n end", "def find(id)\n return nil if id.blank?\n path = build_association_path -> { \"#{@parent.request_path(@params)}#{@opts[:path]}/#{id}\" }\n @klass.get_resource(path, @params)\n end", "def find_single(id, *args)\n data = get(id.to_s, *args)\n return nil unless data && !data.empty?\n instantiate(id, data)\n end", "def find(id)\n find_by_index(id: id)\n end", "def find(id)\n fetch([name, id]) do\n super\n end\n end", "def find(id)\n resource_hash = PrestaShop.get :resource => self.resource,\n :id => id\n\n resource_hash.nil? ? nil : self.new(resource_hash)\n end", "def find(id, ignore: [])\n hit = es_get(id, ignore: ignore)\n if hit['found']\n result = instantiate_result(hit)\n return result\n end\n false\n end", "def find(id)\n all.find { |obj| obj.id == id }\n end", "def get(id)\n klass.find(:first, params: { klass.primary_key => wrap_key(id) })\n end", "def find(id)\n @entries_by_id[id]\n end", "def find(id, options = {})\n response = fetch({:key => id})\n response.parsed_response['id'] = id\n new(response.parsed_response)\n end", "def find_by_id(id)\n id = id.to_i\n\n @id_hash[id]\n end", "def find(id)\n @objects[id]\n end", "def find_by_id(id, options = {})\n if item = Dynamoid::Adapter.read(self.table_name, id, options)\n obj = self.new(item)\n obj.new_record = false\n return obj\n else\n return nil\n end\n end", "def find!(id)\n find(id) || raise(RecordNotFound, id)\n end", "def find_by_id(id)\n results = one.find_by_id_ne(id)\n results && new(results) || nil\n end", "def fetch(id)\n fetch_by_id(id) or raise(ActiveRecord::RecordNotFound, \"Couldn't find #{self.name} with ID=#{id}\")\n end", "def find(id)\n begin\n @@grid.get(id)\n rescue\n nil\n end\n end", "def find(id)\n found_id = redis.get \"#{klass}:id:#{id}\"\n\n if found_id\n object = self.new\n object.send(:id=, found_id.to_i)\n object\n end\n end", "def find_by_id(id)\n models.each do |model|\n el = model.find_by_id(id)\n return el if el\n end\n nil\n end", "def fetch(id)\n search(id: id)[:records].first\n end", "def find_by_id(id, options={})\n name = self.class.name.demodulize.downcase\n route = Automatic::Client.routes.route_for(name)\n url = route.url_for(id: id)\n\n request = api_client.get(url, options)\n\n if request.success?\n self.class::INDIVIDUAL_MODEL.new(request.body)\n else\n nil\n end\n end", "def find_by_id!(id)\n new(one.find_by_id(id) || raise(RecordNotFound, \"A #{name} record for #{id} does not exist.\"))\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def find_by_id(id)\n self.select { |record| record.id == id.to_s }.first\n end", "def locate(id)\n return self if are_you(id)\n\n # Try Inventory\n i = @inv.fetch(id)\n return i if !i.nil?\n\n return nil\n end", "def find_by_id(id)\n results = many.find_with_attributes_ne(id)\n results.blank? && nil || with_details(results)\n end", "def locate(id)\n return self if are_you(id)\n \n i = @inv.fetch(id)\n return i if !i.nil?\n \n return nil\n end", "def find(id)\n @data[id]\n end", "def find(id)\n item = raw_find(id)\n item && item.dup\n end", "def find(id)\n response = client.get(endpoint(id))\n\n if response.success?\n new(response.body)\n else\n false\n end\n end", "def find(id, options = {})\n decorated = decorated_class.find(id)\n decorated ? resolve_associations([new(decorated)], options).first : nil\n end", "def find id\n @objs_list[id] if @objs_list\n end", "def find(id, options = {})\n if model = find_locally(id)\n model\n else\n adapter(model_class).find(id, options)\n end\n end", "def get(entity_name, id) # :nodoc:\n chk_conn\n @hibernate_session.get(entity_name, java.lang.Integer.new(id))\n end", "def find(id)\n sid = id.to_s\n return nil if sid == ''\n return _record_cache[sid] if _record_cache.has_key?(sid) && _class_fetch_states[\"record_#{id}\"] == 'f'\n observer = React::State.current_observer\n record_in_progress = if _record_cache.has_key?(sid)\n _record_cache[sid]\n else\n self.new(id: id)\n end\n record_in_progress_key = \"#{self.to_s}_#{record_in_progress.object_id}\"\n React::State.get_state(observer, record_in_progress_key) if observer\n return _record_cache[sid] if _record_cache.has_key?(sid) && _class_fetch_states[\"record_#{id}\"] == 'i'\n _promise_find(id, record_in_progress).then do\n React::State.set_state(observer, record_in_progress_key, `Date.now() + Math.random()`) if observer\n end\n record_in_progress\n end", "def find(id, query_options = {})\n raise 'ID is required' unless id\n\n response = request(:get, credentials, \"#{api_model.api_path}/#{id}\", query: query_options)\n api_model.parse(response.parsed_response).first\n end", "def find(id)\n\nend", "def load_entity(entity_id)\n @entities[entity_id]\n end", "def find_by_id(id, timeout=nil)\r\n return source_find_by_id(page, id, timeout)\r\n end", "def entity load=true\n @entity ||= (klass.where(id: id).first if load)\n end", "def find(id = nil)\n args = [id].compact\n session = new(*args)\n return session if session.find_record\n nil\n end", "def find(id, params = {})\n from_base id, params\n end", "def get_object_by_id(class_name, id)\n obj = nil\n get_objects_of_class(class_name).each do |o|\n if o.id == id\n obj = o\n break\n end\n end\n obj\n end", "def find_by_id(id)\n unless id.class == BSON::ObjectId\n if BSON::ObjectId.legal? id\n id = BSON::ObjectId.from_string(id)\n else\n nil\n end\n end\n\n find('_id' => id).first\n end", "def find(id)\n fail(ArgumentError, \"Missing id/slug\") unless id\n\n result = access_token.get(\"#{API_BASE}#{self.class::API_PATH}#{id}\")\n fail(ArgumentError, \"Bad request\") unless result.code == \"200\"\n\n self.class::ITEM_CLASS.new(result.body)\n end", "def find(id)\n new.from_json(db_root.join(id).read)\n end", "def find(id)\n code, data = @session.get(element_path(id) + '.json')\n if code == 200\n key = @resource.name.to_s.split('::').last.downcase\n @resource.new(data[key].merge(:session =>@session))\n elsif code == 404\n raise ResourceNotFound\n end\n end", "def find( id )\n model.get( id ).extend( InstanceMethods )\n end", "def promise_find(id)\n sid = id.to_s\n record_in_progress = if _record_cache.has_key?(sid)\n _record_cache[sid]\n else\n self.new(id: id)\n end\n _promise_find(id, record_in_progress)\n end", "def find(model, id)\n key = model.primary_key\n condition = {\"#{key}\" => id}\n data = store.read(condition, table: table_name).first\n fail RecordNotFound.new(condition, table_name) unless data\n\n model.new data\n end", "def find(id=nil)\n record = self.connection.exec_params('SELECT * FROM contacts '\\\n 'WHERE id = $1::int', [id]) if id.is_a?(Integer)\n \n record.nil? || record.num_tuples.zero? ? nil : new(record[0].values[1], record[0].values[2], record[0].values[0])\n end", "def retrieve_entity\n if self.id\n @entity = Deltacloud::Database::Entity::retrieve(@model)\n if @entity.exists?\n after_retrieve\n end\n else\n @entity = nil\n end\n end", "def fetch_by_id(id)\n ensure_base_model\n raise_if_scoped\n return unless id\n raise NotImplementedError, \"fetching needs the primary index enabled\" unless primary_cache_index_enabled\n if IdentityCache.should_use_cache?\n\n require_if_necessary do\n object = nil\n coder = IdentityCache.fetch(rails_cache_key(id)){ coder_from_record(object = resolve_cache_miss(id)) }\n object ||= record_from_coder(coder)\n IdentityCache.logger.error \"[IDC id mismatch] fetch_by_id_requested=#{id} fetch_by_id_got=#{object.id} for #{object.inspect[(0..100)]} \" if object && object.id != id.to_i\n object\n end\n\n else\n self.reorder(nil).where(primary_key => id).first\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 find_record(id)\n @model_class.find(id)\n end", "def find_record(id)\n @model_class.find(id)\n end", "def search_by_id(id)\n @data.each do |item|\n return item if item.id == id\n end\n\n nil\n end", "def eds_get_record(id, eds_params = nil)\n dbid, an = extract_dbid_an(id)\n eds = eds_session('bl-repo-find', eds_params)\n eds.retrieve(dbid: dbid, an: an)\n end", "def get_by_id(class_name, id)\n @data = get_all()\n for item in @data[class_name]\n if item[\"id\"] == id\n return item\n end\n end\n raise \"#{class_name} id #{id} not found.\"\n end", "def find_item_by_id(id)\n\n @items.each do |item|\n return item if item.item_id == id\n end\n return nil\n end", "def find(id)\n firebase_response = firebase_request(:get, \"#{firebase_model}/#{id}\")\n firebase_hash = normalize_firebase_hash(firebase_response, id)\n\n create_firebase_object(firebase_hash)\n end", "def find! id, options = {}\n\n find( id, options ) ||\n raise( MongoMapper::DocumentNotFound.new(\"#{self.to_s} with id #{id} not found\") )\n\n end" ]
[ "0.8043405", "0.7864867", "0.7664213", "0.7542109", "0.74993473", "0.7444415", "0.7407578", "0.7390821", "0.738587", "0.7373103", "0.7341907", "0.7315604", "0.73152214", "0.7245963", "0.7219139", "0.7219139", "0.7203896", "0.71857196", "0.71790224", "0.71552527", "0.71363026", "0.7123144", "0.7122878", "0.71085095", "0.71030366", "0.7096078", "0.70492274", "0.70343775", "0.70245934", "0.69912344", "0.6985613", "0.69788384", "0.69770384", "0.6976016", "0.6972329", "0.6953492", "0.6953042", "0.69151276", "0.6915015", "0.6911123", "0.69103646", "0.6895542", "0.6880989", "0.687779", "0.6844108", "0.68201554", "0.67902744", "0.67883956", "0.6777889", "0.67736113", "0.676237", "0.6759404", "0.67498773", "0.67373264", "0.67325217", "0.67180324", "0.6714207", "0.6708691", "0.669245", "0.6681571", "0.66749835", "0.66749835", "0.6638338", "0.6616515", "0.66144043", "0.6605112", "0.65979314", "0.65967053", "0.6571297", "0.65610117", "0.65518034", "0.6535697", "0.6521267", "0.6513119", "0.6495463", "0.64952534", "0.64875686", "0.646544", "0.6464377", "0.64634943", "0.6457896", "0.645637", "0.6445179", "0.6436643", "0.64186543", "0.64021", "0.63892955", "0.63865703", "0.63757205", "0.63703287", "0.6347182", "0.6322242", "0.63122445", "0.63122445", "0.63046104", "0.6295397", "0.62871385", "0.62764466", "0.6266816", "0.6249445" ]
0.7044
27
Find entities which match all attributes attributes: Hash of attributes to match Returns: Array of entity objects.
def find_all_by(attributes = {}) raise NotImplementedError.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semantic_find_all\n attributes = self.class.semantic_resource.columns.collect{|c| c.name.to_sym }\n conditions = { }\n params.keys.each{|p| conditions[p] = params[p] if attributes.include?(p.to_sym) }\n self.class.semantic_resource.find(:all, :conditions => conditions)\n end", "def filter_by attributes\n\n all.select { |item| matches? item, attributes }\n\n end", "def retrieve_all(attributes_hash, finder)\n case method(:all).arity\n when 0\n all\n when 1, -1\n all(attributes_hash)\n else\n all(attributes_hash, finder)\n end\n end", "def entities(options = {})\n @redis.keys('contacts_for:*').inject({}) {|ret, k|\n if @redis.sismember(k, self.id)\n if k =~ /^contacts_for:([a-zA-Z0-9][a-zA-Z0-9\\.\\-]*[a-zA-Z0-9])(?::(\\w+))?$/\n entity_id = $1\n check = $2\n\n entity = nil\n\n if ret.has_key?(entity_id)\n entity = ret[entity_id][:entity]\n else\n entity = Flapjack::Data::Entity.find_by_id(entity_id, :redis => @redis)\n ret[entity_id] = {\n :entity => entity\n }\n # using a set to ensure unique check values\n ret[entity_id][:checks] = Set.new if options[:checks]\n ret[entity_id][:tags] = entity.tags if entity && options[:tags]\n end\n\n if options[:checks]\n # if not registered for the check, then was registered for\n # the entity, so add all checks\n ret[entity_id][:checks] |= (check || (entity ? entity.check_list : []))\n end\n end\n end\n ret\n }.values\n end", "def where(attributes)\n # (class method) think about how to loop through hashes\n # try looping thru a test ruby file or within irb\n end", "def find_entities\n []\n end", "def field_find_all(**args)\n # if looking for a specific field, use built-in hash for initial filter,\n # otherwise get all fields.\n fields_in_scope =\n if args[:tag].is_a?(String)\n fields(args[:tag]).dup\n else\n @fields.dup\n end\n fields_in_scope.select { |f| f.meets_criteria?(args) }\n end", "def find_by(attributes = {}, options = {}, header = {})\n search = { search: attributes }.merge!(options)\n request = requester.new(:get, \"#{to_url}/find_by\", {}, search, header)\n request.resource.map do |element|\n build(element)\n end\n end", "def all(entity_name) # :nodoc:\n chk_conn\n @hibernate_session.create_criteria(entity_name).list.to_a\n end", "def entities\n @entities ||= begin\n acc = {}\n @api.routes.filter_map(&:entity).each do |entity|\n collect_entities(acc, entity)\n end\n acc.keys.sort_by(&:name)\n end\n end", "def find_many(entity_type, uuids, params)\n uuids.map do |uuid|\n find_one(entity_type, uuid, params)\n end\n end", "def find_all(req)\n @sets.map do |s|\n s.find_all req\n end.flatten\n end", "def entities\n @entities ||= questions.map{|question|question.meta_attribute_entity}.uniq\n end", "def where(params)\n found = []\n\n @registry.each do |item|\n if item.to_h.values_at(*params.keys) == params.values\n found << item\n end\n end\n found\n end", "def where(attributes)\n raise 'expected a Hash of attributes' unless attributes.kind_of?(Hash)\n attributes.each { |column, _| raise \"unknown column :#{column}\" unless columns.key?(column) }\n\n rows.map do |row|\n if attributes.all? { |column, value| row[columns[column]] == value }\n columns.inject({}) { |retval, (column, index)| retval[column] = row[index]; retval }\n end\n end.compact\n end", "def find_entities(*query)\n query = create_query(*query)\n ids = find_entity_ids(query)\n load_resources \"entities/#{query.type}\", ids do |id, data|\n create_entity(query.type, id, data)\n end\n end", "def where(**args)\n _values.values.select { |value| args.map { |k, v| value.attributes[k] == v }.all? }\n end", "def method_missing(method_id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n \n method_id.to_s.match(/^find_all_by_([_a-zA-Z]\\w*)$/)\n attributes = {}\n\n $1.split('_and_').each do |key|\n attributes.merge!({key.intern => args.shift})\n end\n \n find(:all, attributes.merge(options))\n end", "def find(*args)\n raise ArgumentError unless args[0].is_a?(Hash)\n r = []\n # If args[0] has ALL of the class keys then look based on the key values\n # If args[0] does not have ALL of the class keys then drop to the table scan approach\n if args[0].has_keys?(keys)\n # If the keys of args are a subset of keys then look up by the key values\n key_record = records[build_key(args[0])]\n if key_record\n # Make sure the other elements of args[0] match the corresponding k/v pairs in key_record\n match = true\n args[0].each_pair do |k, v|\n match = false unless key_record[k] == v\n break unless match\n end\n r << key_record if match\n else\n # the record you are looking for isn't here, stop searching\n end\n else\n # look at each record in records individually - basically a table scan\n records.each_value do |record|\n match = true\n args[0].each do |k, v|\n match = false unless record.send(k) && record.send(k) == v\n break unless match\n end\n r << record if match\n end\n return r unless r.empty?\n nil\n end\n end", "def all(opts={})\n find_many(::Hashie::Mash.new(opts))\n end", "def index\n @entities = Entity.any_of( { :title => /.*#{params[:search]}.*/i } )\n end", "def matches\n attributes.fetch(:matches)\n end", "def search(roles_in, roles_out)\n\n# roles_in is a hash, keyed by the role names. Each hash value is the specifications for that role. These specs say, for\n# example, what values the attributes of each entity in that role must have for that entity to play that role in the\n# relationship. In general, these specs can be complicated, but for now (Jan 2010) we'll limit ourselves to simple\n# specs.\n\n# For now 3 types of specs are allowed, :key_single_value, :key_range, and :general.\n\n# Meaning (if quantifier for roles_in is :all for every input role): for every relationship in this relset such that\n# all the entities in the input roles satisfy the given constraints, output the entities in the roles_out specs.\n# For simplicity just allow 1 constraint, at most, per role right now!! To be generalized, of course.\n\n # Need a place to accumulate relationship objects\n relationships = Array.new\n\n first_role_considered = true\n roles_in.each_pair{|role_name, role_specs|\n # for each role, compute the entity set name and the entity set\n puts 'Processing role ' + role_name.to_s\n puts '@role_desc_hash is ' + @role_desc_hash.inspect\n esname = @role_desc_hash[role_name]\n puts 'esname = ' + esname\n es = @currentdb.hes[esname]\n if role_specs[:spec_type] == :key_single_value # single key value, but of course each key attrib must have a value\n if role_specs[:specs].class != Array # single spec\n puts 'Single spec for this role, which means KEY must have SINGLE ATTRIBUTE'\n puts 'Put it in an array of length 1 and proceed!'\n givenspecs = role_specs[:specs]\n role_specs[:specs] = Array.new\n role_specs[:specs].push givenspecs\n end\n # Now get to the entity based on the given key\n # Must first parse the given array elements for the key attributes!\n numkeys = @currentdb.hes[esname].keyattribnames.size\n puts \"number of key attributes is #{numkeys}\"\n if role_specs[:specs].size != numkeys\n puts \"ACHTUNG: size of role specs, #{role_specs[:specs].size}, is not equal to number of key attributes, quitting\"\n exit\n end\n \n # Find the entity keyed by the given key attributes, and find the array of all relationships in the relevant relset (self)\n # with this entity serving in this role!\n entity = es.hashofentities # entity will eventually refer to the entity keyed by the given attribute values\n role_specs[:specs].each{|spec| # the specs are just the values of the key attributes\n puts \"Processing spec = #{spec.to_s}\"\n entity = entity[spec]\n puts \"entity just became #{entity.to_s}\"\n } # each\n # ensure that the variable 'entity' points to an entity!\n puts \"Arrived at this entity: #{entity.to_s}\" \n if entity.class != Entity\n puts \"Something's wrong! The variable called entity points to an object of class #{entity.class.to_s}\"\n exit\n end # if, inner\n if first_role_considered\n first_role_considered = false\n if entity.relationships[self].class == Array\n puts 'Inaugurating the relationships array!'\n relationships = entity.relationships[self]\n else\n puts 'First role considered but entity.relationships[self] is not an Array'\n relationships.push (entity.relationships[self])\n end # if, inner\n \n puts \"Just made relationships array = #{relationships.to_s}\"\n else\n puts 'Must correct this part of the code because either operand of the & operator may not be an Array!'\n relationships = relationships & entity.relationships[self] # intersect existing relationship set (Array) with incoming one\n puts \"Hey, just made relationships array = #{relationships.to_s}\"\n end # if, inner\n\n else\n puts 'Role type not yet implemented, sorry!'\n exit\n end # if\n \n } # role_in.each_pair\n \n # Now do something with the relationship set obtained!!!\n puts 'Will have the code the part where we look at the output specs LATER!!'\n puts 'For now, here are the relationships obtained:'\n relationships.each_with_index{|r,i|\n puts \"Relationship number #{i}:\"\n r.show\n }\n end", "def match_attributes(attrs)\n attrs = Saxxy::Helpers.stringify_keys(attrs)\n attributes.reduce(true) do |b, (k, v)|\n value = attrs[k]\n b && ((!value.nil? && match(v, value)) || (v.nil? && value.nil?))\n end\n end", "def find(attributes={})\n attributes = attributes.to_h\n\n all.find { |license| license.matches?(attributes) }\n end", "def find_all(conditions={}, &block)\n all.select { |item| match_all(item, conditions, &block) }\n end", "def filtered_attributes\n # Run the read permission check\n allow_and_deny_fields(:read).then do |allow, deny|\n\n result = nil\n\n if allow && allow != true && allow.size > 0\n # always keep id\n allow << :id\n\n # Only keep fields in the allow list\n result = @attributes.select { |key| allow.include?(key) }\n elsif deny == true\n # Only keep id\n # TODO: Should this be a full reject?\n result = @attributes.reject { |key| key != :id }\n elsif deny && deny.size > 0\n # Reject any in the deny list\n result = @attributes.reject { |key| deny.include?(key) }\n else\n result = @attributes\n end\n\n # Deeply filter any nested models\n result.then do |res|\n keys = []\n values = []\n res.each do |key, value|\n if value.is_a?(Model)\n value = value.filtered_attributes\n end\n keys << key\n values << value\n end\n\n Promise.when(*values).then do |values|\n keys.zip(values).to_h\n end\n end\n end\n end", "def find_by(attributes)\n id_match = attributes[:id_match]\n championship = attributes[:championship]\n serie = attributes[:serie]\n\n if @config.championship_associate?\n find_match_associated(id_match, championship)\n else\n find_match(id_match, championship, serie)\n end\n end", "def all(arg={})\n find(:all, :conditions => arg)\n end", "def method_missing(method, *args)\n if method =~ /find/\n finder = method.to_s.split('_by_').first\n attributes = method.to_s.split('_by_').last.split('_and_')\n\n chain = Dynamoid::Criteria::Chain.new(self)\n chain.query = Hash.new.tap {|h| attributes.each_with_index {|attr, index| h[attr.to_sym] = args[index]}}\n \n if finder =~ /all/\n return chain.all\n else\n return chain.first\n end\n else\n super\n end\n end", "def find_all(options = {})\n conditions, = extract_conditions!(options)\n klass.find(:all, params: conditions)\n end", "def find_many(ids, *args)\n return [] if ids.blank?\n hashes = multi_get(ids.collect(&:to_s), *args)\n\n hashes.inject([]) do |res, (key, data)|\n res << instantiate(key, data) unless data.empty?\n end\n end", "def find_by_attributes\n Hash[@ucrm_local_id_field, id]\n end", "def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }.compact\n else\n []\n end\n end", "def all(prototype={})\n @coll.find(prototype)\n end", "def all(prototype={})\n @coll.find(prototype)\n end", "def lookup( *ids )\n cache = attribute_cache( :id )\n matching = ids.map do |id|\n entity = cache.fetch( id ) do\n entities.find { |e| e.id == id }\n end\n\n entity || missing_entity_class.new\n end\n\n List.new matching\n end", "def filter_search(attributes)\n # TODO CHANGE because to _unsafe h permits to inject all the things of attributes\n attributes.to_unsafe_h.inject(self) do |scope, (key, value)|\n # return scope.scoped if value.blank?\n if value.blank?\n scope.all\n else\n case key.to_sym\n when :order # order=field-(ASC|DESC)\n attribute, order = value.split('-')\n scope.order(\"#{table_name}.#{attribute} #{order}\")\n\n else # unknown key (do nothing or raise error, as you prefer to)\n scope.all\n end\n\n end\n end\n end", "def entities_for_group group\n questions_for_group(group).map{|questions|questions.meta_attribute_entity}.uniq\n end", "def matched_identities\n @matched_identities ||= @provider_identity.find_records\n end", "def find_from_search(*ids)\n unless ids.blank?\n results = {}\n ids.flatten.dice(20).each do |set|\n query = (set.map { |id| \"(id:\\\"#{id}\\\")\" }).join(' || ')\n search_results = search_for(query, :qt => 'standard', :rows => set.length)\n search_results.models.each do |result|\n results[result.id] = result\n end\n end\n ids.flatten.map { |id| results[id] }\n else\n []\n end\n end", "def instances_from_matches\n return single_class_results if one_class\n \n groups = results[:matches].group_by { |match|\n match[:attributes][\"class_crc\"]\n }\n groups.each do |crc, group|\n group.replace(\n instances_from_class(class_from_crc(crc), group)\n )\n end\n \n results[:matches].collect do |match|\n groups.detect { |crc, group|\n crc == match[:attributes][\"class_crc\"]\n }[1].compact.detect { |obj|\n obj.primary_key_for_sphinx == match[:attributes][\"sphinx_internal_id\"]\n }\n end\n end", "def find_by(hash)\n # firebase does not have complex querying\n # so we have to grab all objects satisfying\n # first key/value\n init_key, init_value = hash.shift\n firebase_response = firebase_request :get,\n firebase_model,\n orderBy: \"\\\"#{init_key}\\\"\",\n equalTo: encode_init_value(init_value)\n\n # we then filter the remaining key/values with ruby\n hash.each do |key, value|\n firebase_response = firebase_response.select do |_firebase_key, firebase_hash|\n firebase_hash[key.to_s] == value\n end\n end\n\n firebase_hashes_array = normalize_firebase_hashes(firebase_response)\n\n firebase_hashes_array.map { |hash_item| create_firebase_object(hash_item) }\n end", "def all(*args)\n find(:all, *args)\n end", "def searchable_attributes\n key_props = self.class.primary_key_attributes\n return key_props if key_searchable?(key_props)\n key_props = self.class.secondary_key_attributes\n return key_props if key_searchable?(key_props)\n key_props = self.class.alternate_key_attributes\n return key_props if key_searchable?(key_props)\n end", "def deep_find_providers_for(attributes)\n plugins = []\n attributes.each do |attribute|\n attrs = select_subtree(@map, attribute)\n\n unless attrs\n attrs = select_closest_subtree(@map, attribute)\n\n unless attrs\n raise Ohai::Exceptions::AttributeNotFound, \"No such attribute: \\'#{attribute}\\'\"\n end\n end\n\n collect_plugins_in(attrs, plugins)\n end\n\n plugins.uniq\n end", "def find_by_attributes(project_id, attributes = {})\n search_by_attribute(self.find_all(project_id), attributes)\n end", "def select(attributes)\n condition = attributes.collect {|k, v| \"#{k} = #{format_mysql(k, v)}\"}.join(\" AND \")\n results = @@connection.execute(\"SELECT * FROM base WHERE (#{condition});\")\n objects = []\n results.fetch_hash do |row|\n objects << new(row)\n end\n objects\n end", "def entities\n @entities ||= Entity.from_models(self, @models)\n end", "def matches_by\n Array(options_by_type(:matches_by))\n end", "def find_all(table, table_hash, conditions = {})\n\t\t\t\tres = []\n\t\t\t\tlen = table.length - 1\n\t\t\t\t\n\t\t\t\tfor i in 0..len\n\t\t\t\t\tfound = true\n\t\t\t\t\t\n\t\t\t\t\tconditions.each do |key, val|\n\t\t\t\t\t\tif (table[i][table_hash[key]] != val)\n\t\t\t\t\t\t\tfound = false\n\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tif (found)\n\t\t\t\t\t\tres << table[i]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn res\n\t\t\tend", "def match_records(records)\n records.select do |record|\n conditions.matches?(record)\n end\n end", "def find_matching_people(options={})\n tags = self.tag_list.reject(&:blank?).uniq\n @find_matching_people_cache ||= Person.find_tagged_with(tags, {\n :conditions => [\"people.id <> ?\", self.person.id]\n }.merge_finder_options(options))\n end", "def all(conditions = {})\n self.request.all(self.seed)\n end", "def all\n where\n end", "def all(*args)\n find(:all, *args)\n end", "def all(*args)\n find(:all, *args)\n end", "def find_all_by(opts = {})\n list_all_products(opts)\n end", "def find_all_tagged_with(*args)\n find_tagged_with(*args)\n end", "def all(params = {})\n where(params)\n end", "def match(attributes = nil)\r\n body = { query: { match: attributes } }\r\n result = client.search index: index, type: type, body: body\r\n\r\n result_instance(result)\r\n end", "def entities_used\n entities_arr = Array.new\n @entities.each do |entity|\n entities_arr << entity.id unless entities_arr.include?(entity.id)\n end\n return entities_arr\n end", "def process matching: {}\n query = collection.query\n\n query = query.matching(matching) if matching.is_a?(Hash)\n\n query.to_a.map { |entity| persist_entity(entity) }\n end", "def find_all *keys\n ensure_service!\n lookup_res = service.lookup(*Array(keys).flatten.map(&:to_grpc),\n transaction: @id)\n LookupResults.from_grpc lookup_res, service, nil, @id\n end", "def find(criteria = {}, options = {})\n matches = @store.find_all do |rec|\n criteria.all? { |k, v| v == rec[k] }\n end\n if sorting = options[:sort]\n k = sorting.keys.first\n matches.sort_by { |m| m[k] }.reverse\n else\n matches\n end\n end", "def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end", "def all_by_tag(*tags)\n find(:all).by_tag(*tags)\n end", "def ids_matching(hash_or_hashes = nil, &block)\n do_matching(hash_or_hashes, block, :ids_matching)\n end", "def find_all(req)\n prefetch nil\n\n specs.values.select do |spec|\n req.match? spec\n end\n end", "def find_identities_by_attribute_name(operation_name)\n# o = Attribute.find_by_content(operation_name)\n# o = Attribute.where(:content => operation_name)\n ret = []\n# unless o.nil?\n ret = self.identities.reject {|i| not i.attributes.include? i.attributes.find_by_content(operation_name)}\n# end\n return ret\n end", "def find_all(*args)\n element.all(*args)\n end", "def find_matching(options)\n find_all {|x| options.map {|k, v| v.nil? || x.send(k) == v}.all?}\n end", "def find_all(attrib, match)\n results = []\n if attrib == \"class\" and not (match.is_a? Class or match.is_a? Module)\n match = Module.const_get(match.to_sym) rescue NameError\n end\n case match\n when \"nil\"\n match = nil\n when \"true\"\n match = true\n when \"false\"\n match = false\n when /^\\d+$/\n match = match.to_i\n when /^:/\n match = match[1..-1].to_sym\n end\n if attrib == \"class\" and (match.is_a? Class or match.is_a? Module)\n @ghash.dup.each do |goid, obj|\n results << obj if obj.is_a? match\n end\n elsif match.is_a? String\n match.downcase!\n @ghash.dup.each do |goid, obj|\n if obj.instance_variables.include? attrib or obj.instance_variables.include? attrib.to_sym\n var = obj.instance_variable_get(attrib.to_sym)\n if var.is_a? String and var.downcase == match\n results << obj\n end\n end\n end\n else\n @ghash.dup.each do |goid, obj|\n results << obj if (obj.instance_variables.include? attrib or obj.instance_variables.include? attrib.to_sym) and obj.instance_variable_get(attrib.to_sym) == match\n end\n end\n results\n end", "def find_all_by_asset_types(asset_types, *args)\n with_asset_types(asset_types) { where *args }\n end", "def compare_attributes(data_criteria, criteria)\n return false unless data_criteria['dataElementAttributes']&.any?\n\n data_criteria['dataElementAttributes'].map { |dc| dc.except('_id') }.include? criteria['dataElementAttributes'][attribute_index].except('_id')\n end", "def find_expressions (options={})\n\n #conditions = determine_conditions(options)\n # note : this call modifies the options hash...\n\n conditions = {}\n\n #\n # maximize usage of SQL querying\n\n exps = DataMapper.repository(@dm_repository) {\n DmExpression.all(conditions)\n }\n\n #\n # do the rest of the filtering\n\n exps.inject([]) { |a, de|\n fe = de.as_owfe_expression(application_context)\n a << fe if does_match?(options, fe)\n a\n }\n end", "def find(enumerable, **conditions)\n enumerable.find do |item|\n conditions.all? do |key, value|\n item.send(key) == value\n end\n end\n end", "def find_with_tags(*tags)\n options = tags.extract_options!\n self.all(options.merge(:tags => tags))\n end", "def get_contained_attribute_ids(_opts = {})\n get_directly_contained_object_ids(:attribute) || []\n end", "def all\n response = request(:get_all)\n handles = response.values.flatten.collect { |handle| Entity::Handle.build(handle) }\n\n if handles.size == 1\n # Fetch data for single entity\n find(handles.first)\n elsif handles.size > 1\n # Fetch all data for all the entities\n entity_data = get_data_array(handles)\n\n # Build Entity objects and add them to the proxy\n entity_data.each do |data|\n entity = build(data)\n entity.persisted = true\n end\n end\n\n self\n end", "def entities\n @entities ||= []\n end", "def entity_sets\n @entity_sets ||= metadata.xpath('//EntitySet').map do |entity|\n [\n entity.attributes['Name'].value,\n entity.attributes['EntityType'].value\n ]\n end.to_h\n end", "def entity_search\n @entity_search = Array.new\n entity_search = {}\n @entity = UserEntity.where(:entity_name => /.*#{params[:entity][:char]}*./).all\n @entity.each do |entity|\n @user_entity = User.where(:id => entity.user_id)\n @user_entity.each do |users|\n es = entity_search.merge(:user_entity_id => entity.id ,:user_id => users.id, :profile_picture => users.profile_picture_url, :first_name => users.first_name,:address => entity.address, :comment => entity.comment, :entity_image => entity.entity_image, :entity_name => entity.entity_name, :rating_count => entity.rating_count, :sub_category => entity.sub_category, :lat => entity.lat , :longitude => entity.longitude, :user_category_id => entity.user_category_id)\n @entity_search << es\n end\n end\n respond_to do |format|\n if @entity.present?\n format.json {render :json => @entity_search}\n else\n end\n end\nend", "def get_virtual_attributes(attribute_names, cols, field_to_match = :display_name)\n sp_hash = {\n model_name: :attribute,\n filter: [:oneof, field_to_match, attribute_names],\n cols: Aux.array_add?(cols, field_to_match)\n }\n get_children_from_sp_hash(:attribute, sp_hash)\n end", "def all(*args, &block)\n find(:all, *args, &block)\n end", "def by_keys(conditions)\n if conditions.size > 1\n find_by_multiple_conditions(conditions) || []\n else\n find_by_one_condition(conditions.first) || []\n end\n end", "def contained_attributes\n @images.map(&:attribute).uniq\n end", "def find_all\n end", "def find_all &filter\n result_set = self.driver.activities.find_all { |activity| activity.start_date >= @start_date && activity.start_date <= @end_date }\n\n if filter\n return result_set.find_all &filter \n end\n\n result_set\n end", "def all\n db.transaction(true) do\n ids = extract_model_ids(db)\n ids.map { |key| db[key] }\n end\n end", "def find_entries(include_all = true)\n @group.entries(include_all)\n end", "def create_entities\n results = []\n if @attributes.has_key?(:entities)\n @attributes[:entities].each do |result|\n results.push Muddyit::Collections::Collection::Entities::Entity.new(@muddyit, result.merge!(:collection => @attributes[:collection]))\n end\n @attributes[:entities] = results\n end\n end", "def filter_lists(attr_class_option_ids)\n sql = %{\n SELECT attributable_id\n FROM product_attributes pa\n JOIN attribute_lists al ON al.id=pa.value_id AND pa.value_type=:attribute_lists\n JOIN attribute_class_options_attribute_lists oal ON oal.attribute_list_id=al.id\n WHERE attributable_type=:product AND value_type=:attribute_lists\n AND oal.attribute_class_option_id IN (:attr_class_option_ids)\n GROUP BY attributable_id\n HAVING COUNT(attributable_id)=:count\n }\n query = sanitize_sql_array [sql,\n {\n product: SitescanCommon::Product.to_s,\n attribute_lists: SitescanCommon::AttributeList.to_s,\n attr_class_option_ids: attr_class_option_ids,\n count: attr_class_option_ids.size\n }]\n connection.select_values query\n end", "def find_by_tags(tenant_id,tags,strict=true)\n return @instance.find_by_tags_in_entity_type(tenant_id,entity_type_id,tags,strict)\n end", "def entities(*values)\n values.inject(self) { |res, val| res._entities(val) }\n end", "def hashes_for(*args)\n return matches_for(*args).map { |match| match.hash }\n end", "def entities\n _entities\n end", "def entities\n _entities\n end", "def filter_instances(instances, filters)\n filtered = instances\n # Include only instances that match all filters.\n filters.each do |filter|\n key, value = filter.first\n filtered = filtered.select { |i|\n found_tag = i.tags.find { |t|\n t.key == key.to_s\n }\n next if found_tag.nil?\n\n found_tag.value == value\n }\n end\n filtered\n end", "def matches(facts)\n rules.values.map {|rule|\n rule.matches(facts).map { |bindings| Match.new(rule,bindings) }\n }.reduce(:+).uniq\n end" ]
[ "0.6427778", "0.638782", "0.60403734", "0.57986546", "0.5785672", "0.5775297", "0.5756768", "0.5647377", "0.56201416", "0.56098604", "0.55876213", "0.55650944", "0.5556188", "0.5545368", "0.5531247", "0.5526773", "0.55104667", "0.5492941", "0.5479464", "0.5423858", "0.54189944", "0.53920513", "0.5389113", "0.5384349", "0.53723127", "0.5348661", "0.53389543", "0.5337841", "0.53361815", "0.5328583", "0.5323436", "0.5316568", "0.5278594", "0.52752", "0.52750176", "0.52750176", "0.5270697", "0.52653354", "0.5260901", "0.5255435", "0.5235723", "0.52191854", "0.5207821", "0.51983106", "0.5192075", "0.51898223", "0.51879436", "0.51848775", "0.51745594", "0.5171982", "0.5171343", "0.5163041", "0.5159337", "0.51466966", "0.5141416", "0.5138209", "0.5138209", "0.51359046", "0.5131405", "0.5130223", "0.51299506", "0.5121642", "0.51188946", "0.51094264", "0.51067185", "0.5102031", "0.5102031", "0.5091931", "0.50841004", "0.5081142", "0.5079174", "0.50748384", "0.50696874", "0.5066711", "0.50666684", "0.5060551", "0.5059671", "0.505226", "0.5050496", "0.5042097", "0.50293624", "0.50255096", "0.5017338", "0.50092125", "0.49975073", "0.4987725", "0.49785727", "0.49673545", "0.49568978", "0.49537116", "0.49526164", "0.49520865", "0.49487633", "0.49446774", "0.4937773", "0.49349743", "0.4933457", "0.4933457", "0.49224776", "0.49151656" ]
0.65226793
0
Parses the response to match the format requested
def parse_response(response) # @todo Parse the response based on the @format ("txt", "json" or "xml") JSON.parse(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_response\n parse_address()\n parse_expires()\n parse_token_type()\n parse_token()\n end", "def parse_response(response)\n if response.kind_of?(Net::HTTPServerError)\n raise Jamendo::Error.new(\"Jamendo Server Error: #{response} - #{response.body}\", response)\n end\n \n case @format\n when :json\n JSON.parse(response.body, symbolize_names: true)\n when :xml\n REXML::Document.new(response.body)\n else\n raise Jamendo::Error.new('You are trying to parse unparsable!')\n end\n end", "def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n @parsed_response ||= ResponseParser.parse(response)\n end", "def parse_response(response)\n check_version_and_warn(response.headers[X_KONTENA_VERSION])\n\n if response.headers[CONTENT_TYPE] =~ JSON_REGEX\n parse_json(response)\n else\n response.body\n end\n end", "def parse_response\n if @http_response.body && @http_response.respond_to?(:headers) && @http_response.headers['Content-Type']\n if @http_response.headers['Content-Type'].include?('xml')\n parse_xml_response\n elsif @http_response.headers['Content-Type'].include?('json')\n parse_json_response\n end\n else\n parse_unknown_response\n end\n end", "def parse_response!; end", "def parse_response(response)\n response.parse\n rescue HTTP::Error\n nil\n end", "def parse_response(response)\n case response.content_type\n when JSON_CONTENT_TYPE\n JSON.parse(response.body, quirks_mode: true, symbolize_names: true)\n else\n response.body\n end\n end", "def parsed_response\n response\n end", "def parse_response(response)\n if response.headers['Content-Type'] == \"application/json\"\n JSON.parse(response.body) rescue nil\n else\n response.body\n end\n end", "def parse_response(response)\n @response = response.body\n @code = response.code\n @message = response.message\n end", "def parse response\n JSON.parse(response, symbolize_names: true)\n end", "def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), response.body ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end", "def parse_response(response)\n if response['content-type']\n [ response['content-type'].gsub(/\\s*;.*$/,''), uncompress_body(response) ]\n else\n raise _(\"No content type in http response; cannot parse\")\n end\n end", "def parse_response(response)\n raise NotImplementedError\n end", "def parse_response(response)\n split_response = response.split(/\\n/).map(&:strip)\n ((/^total/.match(split_response.first)) ? split_response[1..-1] : []).each_with_object(Hash.new { |h,k| h[k] = []}) do |e, acc|\n fields = e.split(/\\s +/)\n acc[fields.last] << { :state => fields[0], :uuid => fields[1], :pid => fields[2], :description => fields.last }\n end\n end", "def parse_response(response)\n JSON.parse response if response && !response.blank\n end", "def parse_response(body)\n return nil if body.nil? or body.empty?\n case options.format\n when :xml\n MultiXml.parse(body)\n else\n body\n end\n end", "def parsed_response\n #logger.debug { \"Parsing Response: #{response.content_type}\" }\n return response unless response\n @parsed_response ||= case response.content_type\n when 'application/json'; response.body.empty? ? '' : JSON.parse(response.body)\n when 'text/html'; { } #HTMLResponseParser.parse(response.body)\n else; response.respond_to?(:to_hash) ? response.to_hash : response.to_s\n end\n @parsed_response\n end", "def parse_response(response)\n raise NotImplementedError, '.parse_response should be implemented in subclass'\n end", "def parse_response(response)\n status = RESPONSE_STATUSES.fetch(response.code) { raise \"Response not known\" }\n raise Amfetamine::RecordNotFound if status == :notfound\n body = if response.body && !(response.body.blank?)\n response.parsed_response\n else\n self.to_json\n end\n { :status => status, :body => body }\n end", "def parse_response(body)\n json = JSON.parse body, symbolize_names: true\n @success = json[:success]\n @failed = json[:failure]\n @canonical_ids = json[:canonical_ids]\n @results = (json[:results] || []).map { |result| gcm_result_for result }\n end", "def parse(response)\n case response\n when /\\ANOTIFY/ then\n SSDP::Notification.parse response\n when /\\AHTTP/ then\n SSDP::Response.parse response\n when /\\AM-SEARCH/ then\n SSDP::Search.parse response\n else\n raise Error, \"Unknown response #{response[/\\A.*$/]}\"\n end\n end", "def parse(response)\n\nend", "def prepare_response(response)\n JSON.parse(response)\n end", "def parse_response(response)\n response = sanitize_response_keys(response.parsed_response)\n end", "def parse_response(response)\n return response unless response.respond_to?(:body)\n\n JSON.parse(response.body, symbolize_names: true)\n rescue StandardError => e\n puts \"Error parsing response from #{api_path}\"\n handle_error(e)\n end", "def parse!(response)\n case response.code\n when 404\n raise Rioter::Errors::SummonerNotFound.new\n when 403\n # TODO: custom errors\n raise StandardError.new(\"Riot error: Forbidden.\")\n when 429\n retry_after = response.headers[\"Retry-After\"]\n raise Rioter::Errors::RateLimited.new(msg: \"Rate limit reached, retry after: #{retry_after}\", retry_after: retry_after)\n else\n JSON.parse(response.body)\n end\n end", "def parse_and_format_response(response)\n response_body = response.body\n\n # is used for logout action that returns empty body\n if response_body.empty?\n response_body = \"{}\"\n end\n\n body_hash = OpsviewHelper.symbolize_keys(JSON.parse(response_body))\n\n if response.code == 200 || response.code == 409 # 409 - reload already in progress\n if body_hash.has_key? :list\n body_hash[:list]\n elsif body_hash.has_key? :object\n body_hash[:object]\n else\n body_hash\n end\n else\n error_message = \"Request failed (code = #{response.code}):\"\n\n if body_hash.has_key? :message\n error_message << \" #{body_hash[:message]}\"\n if body_hash.has_key? :detail\n error_message << \", details: #{body_hash[:detail]}\"\n end\n elsif body_hash.has_key? :messages\n body_hash[:messages].each { |message| error_message << \" details: #{message[:detail]}\" }\n else\n error_message << \" unknown reason\"\n end\n\n raise error_message\n end\n end", "def parse_response(response_string)\n\n if (response_string.include? \"ERROR~\")\n return parse_errors(response_string)\n end\n\n pairs = response_string.split(@field_delim)\n pairs.each do |p|\n k,v = p.split(@value_delim)\n if @values.has_key?(k)\n @values[k] = [@values[k]] unless @values[k].is_a?(Array)\n @values[k] << v\n else\n @values[k] = v\n end\n end\n end", "def response_data\n unless response.media_type.to_s =~ /^application\\/(.+)/\n raise \"Unexpected response type: #{response.media_type}\"\n end\n\n format = $1\n case format\n when 'xml'\n Hash.from_xml(response.body)\n when 'json'\n ActiveSupport::JSON.decode(response.body)\n else\n raise \"Unknown response format: #{format}\"\n end\n end", "def parse(response)\n case response\n when Hash\n response.each_with_object({}) do |(key, value), new_hash|\n new_hash[camel_case_to_snake_case(key).to_sym] = parse(value)\n end\n when Array\n response.map { |item| parse item }\n else\n response\n end\n end", "def parse_response(response)\n begin\n data = JSON.parse(response.to_s)\n return data\n rescue JSON::ParserError\n # try as HTML\n logger.debug(\"Error parsing JSON response, now trying HTML ...\")\n data = Nokogiri::HTML(response.to_s)\n errors = data.css(\"div.error span.help-inline\").map(&:text)\n logger.warn(\"Nagyo Model errors: #{errors.inspect}\")\n return errors\n rescue Exception => e\n logger.error(\"Errors parsing response: #{e}: #{e.inspect}\")\n raise e if self.raise_errors\n end\n end", "def parse\n # if body.chomp!\n if body.include?(\"\\n\")\n parse_multi_line\n else\n parse_line(response_keys, body)\n end\n end", "def parse_response(resp)\n return resp unless resp.respond_to?(:body)\n\n JSON.parse(resp.body, symbolize_names: true)\n rescue StandardError => e\n puts \"Error parsing response from #{api_path}\"\n handle_error(e)\n end", "def parse(http_response)\n return { 'OK' => 'session_id' } if API.test_mode\n \n if http_response.body.scan(/ERR/).any?\n raise Clickatell::API::Error.parse(http_response.body)\n end\n results = http_response.body.split(\"\\n\").map do |line|\n # YAML.load converts integer strings that have leading zeroes into integers\n # using octal rather than decimal. This isn't what we want, so we'll strip out any\n # leading zeroes in numbers here.\n response_fields = line.scan(PARSE_REGEX)\n response_fields = response_fields.collect { |field| field.gsub(/\\b0+(\\d+)\\b/, '\\1') }\n YAML.load(response_fields.join(\"\\n\"))\n end\n results.length == 1 ? results.first : results\n end", "def response\n @parsed_response ||= JSON.parse(@response.body, symbolize_names: true)\n end", "def parse_rest(response)\n if response.code == 200\n require 'json'\n JSON.parse(response.body)\n else\n {\n status: response.code,\n message: \"Error on IP21: #{response.body}\"\n }\n end\n end", "def parse_response(response)\n find_elements(name.split('::').last.downcase, response).map do |e|\n new id: e.attr('id').to_i, name: e.text\n end\n end", "def parse(savon_response)\n response = new(savon_response)\n response.raw[\"#{key}_response\".to_sym][\"#{key}_result\".to_sym][:response_type]\n end", "def parse_response(response)\n details = response[:completed_shipment_detail]\n rate = details[:shipment_rating][:shipment_rate_details].first[:total_net_charge]\n package_details = details[:completed_package_details]\n \n shipment = Shipment.new\n shipment.rate = BigDecimal.new(rate[:amount])\n shipment.currency = rate[:currency]\n shipment.delivery_date = Date.parse(details[:routing_detail][:delivery_date])\n shipment.tracking_number = package_details[:tracking_id][:tracking_number]\n shipment.label = package_details[:label][:parts][:image] && Base64.decode64(package_details[:label][:parts][:image])\n shipment.barcode = package_details[:barcodes][:common2_d_barcode] && Base64.decode64(package_details[:barcodes][:common2_d_barcode])\n shipment\n end", "def parse(body)\n response = {}\n\n # Remove the double quotes from response values.\n values = body.split(',').map { |value| value.gsub(/\\A\"|\"\\Z/, '') }\n\n # Transaction Response: String that beings with 'Y', 'N', or 'U'\n response[:response] = values[0].to_s\n\n response[:avs_response] = values[1].to_s\n response[:cvv_response] = values[2].to_s\n response[:invoice_number] = values[3].to_s\n response[:transaction_id] = values[4].to_s\n\n response\n end", "def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end", "def parse_response(response)\n\t date_title = response.parsed_response['response']['trip']\n\t self.title = date_title['title']\n\n\t date_start = response.parsed_response['response']['trip']['period_of_record']['date_start']['date']\n\t self.startdate = date_start['pretty']\n\n\t date_end = response.parsed_response['response']['trip']['period_of_record']['date_end']['date']\n\t\tself.enddate = date_end['pretty']\n\n\t\t#elements\n\t \tminprecip = response.parsed_response['response']['trip']['precip']['min']\n\t self.precipmin = minprecip['in']\n\t avgprecip = response.parsed_response['response']['trip']['precip']['avg']\n\t self.precipavg = avgprecip['in']\n\t maxprecip = response.parsed_response['response']['trip']['precip']['max']\n\t self.precipmax = maxprecip['in']\n\n\t mindewpoint = response.parsed_response['response']['trip']['dewpoint_high']['min']\n\t self.dewmin = mindewpoint['F']\n\t avgdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['avg']\n\t self.dewavg = avgdewpoint['F']\n\t maxdewpoint = response.parsed_response['response']['trip']['dewpoint_high']['max']\n\t self.dewmax = maxdewpoint['F']\n\n\t chance_of_sunny = response.parsed_response['response']['trip']['chance_of']['chanceofsunnycloudyday']\n\t self.sunny = chance_of_sunny['name']\n\t self.sunnyper = chance_of_sunny['percentage']\n\n\t chance_of_rain = response.parsed_response['response']['trip']['chance_of']['chanceofrainday']\n\t self.rain = chance_of_rain['name']\n\t self.rainper = chance_of_rain['percentage']\n\n\t chance_of_thunder = response.parsed_response['response']['trip']['chance_of']['chanceofthunderday']\n\t self.thunder = chance_of_thunder['name']\n\t self.thunderper = chance_of_thunder['percentage']\n\n\t chance_of_wind = response.parsed_response['response']['trip']['chance_of']['chanceofwindyday']\n\t self.wind = chance_of_wind['name']\n\t self.windper = chance_of_wind['percentage']\n\n\t chance_of_snow = response.parsed_response['response']['trip']['chance_of']['chanceofsnowday']\n\t self.snow = chance_of_snow['name']\n\t self.snowper = chance_of_snow['percentage']\n\n\t chance_of_tornado = response.parsed_response['response']['trip']['chance_of']['chanceoftornadoday']\n\t self.tornado = chance_of_tornado['name']\n\t self.tornadoper = chance_of_tornado['percentage']\n\n\t chance_of_hail = response.parsed_response['response']['trip']['chance_of']['chanceofhailday']\n\t self.hail = chance_of_hail['name']\n\t self.hailper = chance_of_hail['percentage']\n\n\t chance_of_fog = response.parsed_response['response']['trip']['chance_of']['chanceoffogday']\n\t self.fog = chance_of_fog['name']\n\t self.fogper = chance_of_fog['percentage']\n\n\t #temperature\n\t date_mintemp = response.parsed_response['response']['trip']['temp_high']['min']\n\t self.min = date_mintemp['F']\n\t date_avgtemp = response.parsed_response['response']['trip']['temp_high']['avg']\n\t self.avg = date_avgtemp['F']\n\t date_maxtemp = response.parsed_response['response']['trip']['temp_high']['max']\n\t self.max = date_maxtemp['F']\n\n\t chance_of_freezing = response.parsed_response['response']['trip']['chance_of']['tempbelowfreezing']\n\t self.freeze = chance_of_freezing['name']\n\t self.freezeper = chance_of_freezing['percentage']\n\n\t chance_of_overfreezing = response.parsed_response['response']['trip']['chance_of']['tempoverfreezing']\n\t self.overfreeze = chance_of_overfreezing['name']\n\t self.overfreezeper = chance_of_overfreezing['percentage']\n\n\t chance_of_oversixty = response.parsed_response['response']['trip']['chance_of']['tempoversixty']\n\t self.warm = chance_of_oversixty['name']\n\t self.warmper = chance_of_oversixty['percentage']\n\n\t chance_of_overninety = response.parsed_response['response']['trip']['chance_of']['tempoverninety']\n\t self.hot = chance_of_overninety['name']\n\t self.hotper = chance_of_overninety['percentage']\n\n\t chance_of_sultry = response.parsed_response['response']['trip']['chance_of']['chanceofsultryday']\n\t self.sweltering = chance_of_sultry['name']\n\t self.swelteringper = chance_of_sultry['percentage']\n\n\t chance_of_humid = response.parsed_response['response']['trip']['chance_of']['chanceofhumidday']\n\t self.humid = chance_of_humid['name']\n\t self.humidper = chance_of_humid['percentage']\n\tend", "def parse_response(result, opts = {})\n opts.delete(:raw) ? result : MultiJson.decode(result, opts.update(:max_nesting => false))\n end", "def parse_response\n @fields['address_components'].each do |field|\n parse_field(field)\n end\n define_address\n end", "def parse_response\n @api_method = @api_response.env[:method]\n @api_url = @api_response.env[:url].to_s\n @api_status = @api_response.status\n @api_message = 'undef'\n @api_request_id = 'undef'\n\n unless @api_response.body.empty?\n begin\n parsed = JSON.parse(@api_response.body, symbolize_names: true)\n @api_message = parsed[:message]\n @api_request_id = parsed[:requestId]\n rescue JSON::ParserError\n # We fail silently as defaults have been set\n end\n end\n end", "def parse_body\n Nori.new.parse(body)['Response']\n end", "def parse_response(body)\n # Handling first response\n if INITIAL_FEELINGS.include? body\n @answers.push(body)\n create_response(create_second_text_message(body))\n # Handling second response\n elsif FOLLOWUP_FEELINGS.include? body\n @answers.push(body)\n if (@answers.length >= 1)\n create_response(\"Feel #{@answers[0]} and #{@answers[1]} throughout the day!\")\n else\n create_response(\"Empower youself with these feelings throughout the day. You can do it.\")\n end\n else\n create_response(\"We're not sure how to reply, please follow up with a valid feeling.\")\n end\n end", "def success(response)\n ChefAPI::Log.info \"Parsing response as success...\"\n\n case response[\"Content-Type\"]\n when /json/\n ChefAPI::Log.debug \"Detected response as JSON\"\n ChefAPI::Log.debug \"Parsing response body as JSON\"\n JSON.parse(response.body)\n else\n ChefAPI::Log.debug \"Detected response as text/plain\"\n response.body\n end\n end", "def parse_json_response(response) # :nodoc:\n doc = JSON.parse(response)\n\n result_params = {\n :doctype => :html5,\n :checked_by => MARKUP_VALIDATOR_URI\n }\n\n result_params[:uri] = doc['url'] ||= nil\n if doc['source']\n result_params[:charset] = doc['source']['encoding'] ||= nil\n end\n\n result_params[:validity] = !doc['messages'].any? { |msg| msg['type'] =~ /^error$/i }\n\n results = Results.new(result_params)\n\n doc['messages'].each do |msg|\n if msg['type'] =~ /^error$/i\n msg_type = :error\n elsif msg['subType'] =~ /^warning$/\n msg_type = :warning\n else\n next\n # TODO: should throw exceptions here\n end\n\n message_params = {\n :line => msg['lastLine'],\n :col => msg['firstColumn'],\n :message => msg['message'],\n :source => msg['extract']\n }\n\n results.add_message(msg_type, message_params)\n end\n\n return results\n\n rescue Exception => e\n handle_exception e\n end", "def response_parser; end", "def parse_response_data\n log :debug, \"cas_server response.body:\\r\\n#{@raw_data}\"\n formatted_data = format_data\n formatted_data = formatted_data.nil? ? @raw_data : formatted_data\n log :debug, \"Formatted response.body: #{formatted_data}\"\n\n formatted_data\n end", "def parse(response_body)\n Filepreviews::Response.new(JSON.parse(response_body))\n end", "def parse(response_body)\n Filepreviews::Response.new(JSON.parse(response_body))\n end", "def handle res, opts = {}\n @response = res\n\n parse = opts.has_key?(:parse) ? opts[:parse] : true\n\n case res.status\n when 200..299, 422 then JSON.parse res.body if parse\n when 401, 403 then raise Audiosocket::Unauthorized\n when 404 then nil\n\n else\n raise \"Unexpected response (#{res.status}) from the API:\\n#{res.body}\"\n end\n end", "def interpret_response(response)\n case response.code.to_i\n when 200\n puts 'OK'\n when 201,202,204\n puts 'OK'\n return\n when 400\n puts 'Bad request'\n return\n when 404\n puts 'Resource not found'\n return\n when 500\n puts 'Sensu encountered an error'\n return\n else\n puts \"Unexpected HTTP response code #{response.code}\"\n return\n end\n\n return JSON.parse(response.body)\n end", "def parse_response(response)\n response = Hash.from_xml( response.parsed_response.gsub(\"\\n\", \"\") ) if response.parsed_response.is_a? String\n response = sanitize_response_keys(response)\n end", "def parse_response(response)\n response = Hash.from_xml(response.parsed_response.gsub(\"\\n\", \"\")) if response.parsed_response.is_a? String\n response = sanitize_response_keys(response)\n end", "def validate(response)\n raw_validate response\n\n response.parsed_response\n end", "def parse_user_response(response)\n\tJSON.parse(response.body)\n\nend", "def parse_response_body(body)\r\n case body\r\n when SUCCESS_REGEXP\r\n log :success, $1\r\n $1\r\n when FAILURE_REGEXP \r\n log :failure, $1.gsub(\"<BR>\", \"\\n\")\r\n nil\r\n else \r\n raise \"unparseable response: #{body}\"\r\n end\r\n end", "def process_response(response)\n content_type = content_type_for(response)\n result = process_body(response.body)\n\n if response.success?\n case content_type_for(response)\n when :csv\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: CSV.parse(result))\n else\n OpenStruct.new(success?: true, status: response.status, content_type: content_type, body: parse_body(result))\n end\n else\n handle_error(result, response.status, content_type)\n end\n end", "def parse_result(response)\n response_code = response.code\n query = response.request.options[:query]\n unless response_code == 200\n @logger.error(\"returned status code : #{response_code} query : #{query} response : #{response.body[(0..1000)]}\")\n raise \"returned status code : #{response_code}, query is #{query}\"\n end\n @logger.info(\"query succeeded with: #{response_code}, query is #{query}\")\n JSON.parse(response.body, symbolize_names: true)\n end", "def parse_faraday(response)\n JSON.parse(response)\n end", "def response_to_h(resp) # :nodoc:\n resp = resp.body.gsub(/RT\\/\\d+\\.\\d+\\.\\d+\\s\\d{3}\\s.*\\n\\n/,\"\") # toss the HTTP response\n\n # unfold folded fields\n # A newline followed by one or more spaces is treated as a\n # single space\n resp.gsub!(/\\n +/, \" \")\n\n #replace CF spaces with underscores\n while resp.match(/CF\\.\\{[\\w_ ]*[ ]+[\\w ]*\\}/)\n resp.gsub!(/CF\\.\\{([\\w_ ]*)([ ]+)([\\w ]*)\\}/, 'CF.{\\1_\\3}')\n end\n return {:error => resp } if (resp =~ /^#/ and resp =~/does not exist\\.$/) or (resp =~ /Transaction \\d+ is not related to Ticket/)\n\n # convert fields to key value pairs\n ret = {}\n resp.each_line do |ln|\n next unless ln =~ /^.+?:/\n ln_a = ln.split(/:/,2)\n ln_a.map! {|item| item.strip}\n ln_a[0].downcase!\n ret[ln_a[0]] = ln_a[1]\n end\n\n return ret\n end", "def parse response\n if response #and response.code >= 200 and response.code < 300\n return !response.empty? ? JSON.parse(response) : true\n else\n false\n end\n rescue => e\n $logger.trace \"Failed to parse response: #{response} -> #{e}\"\n false\n end", "def unpack_response( response )\n\t\ttable = TNetstring.parse( response ).first\n\t\tself.log.debug \"Unpacking response: %p\" % [ table ]\n\n\t\t# Success\n\t\tif table.key?( 'headers' )\n\t\t\theaders, rows = table.values_at( 'headers', 'rows' )\n\t\t\theaders.map!( &:to_sym )\n\n\t\t\treturn rows.collect do |row|\n\t\t\t\tHash[ [headers, row].transpose ]\n\t\t\tend\n\n\t\t# Error\n\t\telsif table.key?( 'code' )\n\t\t\t# {\"code\"=>\"INVALID_ARGUMENT\", \"error\"=>\"Invalid argument type.\"}\n\t\t\traise Mongrel2::ControlError.new( table['code'], table['error'] )\n\n\t\telse\n\t\t\traise ScriptError, \"Don't know how to handle response: %p\" % [ table ]\n\t\tend\n\tend", "def parse(text)\n text.split(\"\\n\").each do |line|\n if line =~ /^.*\\:.*$/\n s = line.split(\":\")\n \n key = s[0].strip\n value = s[1].strip\n \n @headers[key] = value\n else\n s = line.split\n \n @http_version = s[0]\n @status = s[1].to_i\n @response_text = s[2]\n end\n end\n end", "def parse_response(resp)\n doc = Hpricot(resp)\n\n find_error_and_raise(doc) if errors_exist?(doc)\n\n codes = []\n doc.search('//ratedshipment/service/code') do |ele|\n codes << SERVICE_CODES[ele.innerHTML]\n end\n costs = []\n doc.search('//ratedshipment/totalcharges/monetaryValue') do |ele|\n costs << ele.innerHTML\n end\n\n quotes = codes.zip costs\n end", "def parse\n @parsed\n end", "def parse_response_body(response_body)\n is_json?(response_body) ? JSON.parse(response_body) : response_body\n end", "def parse_response(response)\n\n if response[\"outcome\"]==\"success\"\n\n #Assign calorie counts and grams breakdown\n self.total_calories=response[\"fields\"][\"total_calories\"].to_i\n self.protein_grams=response[\"fields\"][\"total_calories\"].to_i\n self.fat_grams=response[\"fields\"][\"fat_grams\"].to_i\n self.carbohydrate_grams=response[\"fields\"][\"carbohydrate_grams\"].to_i\n self.fiber_grams=response[\"fields\"][\"fiber_grams\"].to_i\n\n #Number of coffees\n self.number_of_coffees=response[\"fields\"][\"number_of_coffees\"].to_i\n\n #Assign medications based on response\n if response[\"choice\"]=='only_took_morning_meds'\n self.morning_medications=true\n self.evening_medications=false\n\n elsif response[\"choice\"]=='only_took_evening_meds'\n self.morning_medications=false\n self.evening_medications=true\n\n elsif response[\"choice\"]=='took_both_morning_and_evening'\n self.morning_medications=true\n self.evening_medications=true\n\n else\n self.morning_medications=false\n self.evening_medications=false\n\n end\n\n self.save \n\n else\n raise \"Bad Scale API callback data\"\n end\n\n end", "def parse(uri, response, body); end", "def parse_json_response(body)\n begin\n response_data = JSON.parse(body)\n response_data = response_data.first if response_data.is_a?(Array)\n rescue => e\n raise Megar::MegaRequestError.new(body.to_i) if body =~ /^[-\\d]+$/\n raise Megar::BadApiResponseError.new(e)\n end\n raise Megar::MegaRequestError.new(response_data) if response_data.is_a?(Fixnum)\n response_data\n end", "def parse_api_response(http_response)\n response_data = Oj.load(http_response.body, mode: :strict) rescue {} #, {symbol_keys: true}\n case http_response.class.name\n when 'Net::HTTPOK'\n if response_data['success']\n # Success\n formatted_data = format_success_response_data(response_data['data'])\n Rails.logger.debug(\"API formatted data ==*== #{formatted_data.inspect}\")\n Rails.logger.debug(\"API response_data['go_to'] ==*== #{response_data['go_to'].inspect}\")\n success_with_data(formatted_data, response_data['go_to'])\n elsif response_data['err']['go_to'].present?\n # API Error\n Rails.logger.info(\"=*=COMPANY-API-ERROR-WITH-GOTO=*= #{response_data.inspect}\")\n error_with_go_to('company_api_error', 'company api error with goto', GlobalConstant::ErrorCode.temporary_redirect, response_data['err']['go_to'])\n else\n # API Error\n Rails.logger.info(\"=*=COMPANY-API-ERROR=*= #{response_data.inspect}\")\n error_with_internal_code(\n \"company_api_error\",\n response_data['err']['display_text'],\n GlobalConstant::ErrorCode.internal_server_error,\n {},\n response_data['err']['error_data'],\n response_data['err']['display_text']\n )\n end\n when 'Net::HTTPUnauthorized', 'Net::HTTPPreconditionFailed'\n # Login required\n Rails.logger.info(\"=*=COMPANY-API-ERROR=*= Net::HTTPUnauthorized\")\n error_with_go_to('company_api_login_required', 'company api login required', '', {'by_screen_name' => 'login'})\n when 'Net::HTTPNotFound'\n # Page not found - 404\n Rails.logger.info(\"=*=COMPANY-API-ERROR=*= '404 Not Found'\")\n error_with_internal_code('company_api_not_found', 'company api not found', GlobalConstant::ErrorCode.not_found, {}, {}, '404 Not Found')\n else\n # HTTP error status code (500, 504...)\n exception_with_internal_code(\n Exception.new(\"COMPANY API STATUS CODE #{http_response.code.to_i}\"),\n 'company_api_exception',\n 'company api exception',\n http_response.code,\n debug_data\n )\n end\n \n end", "def parse(response)\n Hpricot.XML(response || '')\n end", "def parse_response(response, klass=nil, parent=nil)\n return false if response.status >= 400\n\n body = Yajl::Parser.parse(response.body) rescue nil\n klass = (klass || self)\n\n case body\n when Array\n Collection.new(parent, klass, body.map { |o| klass.new(o) })\n when Hash\n klass.new(body)\n else\n body\n end\n end", "def parse(body)\n puts \"DATACASH RESPONSE\"\n puts body\n\n response = {}\n xml = REXML::Document.new(body)\n root = REXML::XPath.first(xml, \"//Response\")\n\n root.elements.to_a.each do |node|\n parse_element(response, node)\n end\n\n response\n end", "def crossref_parse(response)\n if response.status == 200\n JSON.parse(response.body)\n # most useful fields:\n # author, title, subtitle,\n # issued['date-parts']\n # container-title, volume, issue, page\n # DOI, URL, ISSN\n else\n nil\n end\n end", "def parse_scsb_response(response)\n parsed = response.status == 200 ? JSON.parse(response.body) : {}\n parsed.class == Hash ? parsed.with_indifferent_access : parsed\n rescue StandardError => error\n Rails.logger.error(\"Invalid response from the SCSB server: #{error}\")\n { success: false, screenMessage: 'A server error arose, please contact your local administrator for assistance.' }\n end", "def parse_api_response(http_response)\n response_data = Oj.load(http_response.body, mode: :strict) rescue {}\n\n # Rails.logger.info(\"=*=HTTPResponse=*= #{response_data.inspect}\")\n\n case http_response.class.name\n when 'Net::HTTPOK'\n if response_data['success']\n # Success\n success_result(response_data['data'])\n else\n # API Error\n deprecated_error_with_internal_code(response_data['err']['code'],\n 'simple token api error',\n GlobalConstant::ErrorCode.ok,\n {}, response_data['err']['error_data'],\n response_data['err']['display_text'])\n end\n when \"Net::HTTPUnauthorized\"\n # 401\n deprecated_error_with_internal_code('oka_r_unauthorized', 'ost kyc api authentication failed',\n GlobalConstant::ErrorCode.ok, {}, {}, 'Invalid Credentials')\n else\n # HTTP error status code (500, 504...)\n exception_with_internal_code(Exception.new(\"Ost Kyc API STATUS CODE #{http_response.code.to_i}\"), 'ost_kyc_api_exception', 'ost kyc api exception',\n GlobalConstant::ErrorCode.ok)\n end\n end", "def test_parse_response_body_returns_expected_format\n response_body_to_json = @data_parser.parse_response_body(@page)\n assert_equal Hash, response_body_to_json.class\n end", "def parse(response)\n XMLRPC::Marshal.load_response(response.body)\n end", "def parse_response(uri)\n response = Net::HTTP.get_response(uri)\n\n if response.code.to_i == 403\n if response.body.include?(\"Forbidden\")\n e = EANException.new(\"You have not been granted permission to access the requested method or object.\")\n e.type = :forbidden\n elsif response.body.include?(\"Not Authorized\")\n e = EANException.new(\"The API key associated with your request was not recognized, or the digital signature was incorrect.\")\n e.type = :not_authorized\n elsif response.body.include?(\"Developer Inactive\")\n e = EANException.new(\"The API key you are using to access the API has not been approved, is not correct, or has been disabled. If using SIG Authentication, your digital signature is incorrect and does not match the one generated when receiving your request.\")\n e.type = :developer_inactive\n elsif response.body.include?(\"Queries Per Second Limit\")\n e = EANException.new(\"The API key you are using has attempted to access the API too many times in one second.\")\n e.type = :query_limit\n elsif response.body.include?(\"Account Over Rate Limit\")\n e = EANException.new(\"The API key you are using has attempted to access the API too many times in the rate limiting period.\")\n e.type = :rate_limit\n elsif response.body.include?(\"Rate Limit Exceeded\")\n e = EANException.new(\"The service you have requested is over capacity.\")\n e.type = :over_capacity\n elsif response.body.include?(\"Authentication Failure\")\n e = EANException.new(\"The combination of authentication checks failed.\")\n e.type = :authentication_failure\n else\n e = EANException.new(\"An unknown error occured: #{response.body}.\")\n e.type = :unknown\n end\n\n raise e\n end\n\n JSON.parse(Net::HTTP.get_response(uri).body)\n end", "def format_response(response)\n case\n when response == 'OK'\n true\n when response =~ /^ACK/\n ack = format_ack(response)\n logger.warn ack\n \n ack\n when response.split.size == 1\n # set value -> value\n Hash[*(response.split.*2)]\n else\n # remove first response: \"OK\"\n response = response.split\n response.pop\n\n Hash[*response.collect{|x| x.gsub(/:$/,'')}]\n end\n end", "def parse(body)\n response = {}\n\n # parse reponse body into a hash\n body.gsub!(\"<html><body><plaintext>\", \"\")\n body.split(\"\\r\\n\").each do |pair|\n key,val = pair.split(\"=\")\n response[key.underscore.to_sym] = val if key && val\n end\n\n # split response from : delimited format\n if response[:result] == \"1\"\n approval_response = response[:accepted].split(\":\")\n response[:message] = \"Accepted\"\n response[:transaction_type] = approval_response[0]\n response[:authorization_code] = approval_response[1]\n response[:reference_number] = approval_response[2]\n response[:batch_number] = approval_response[3]\n response[:transaction_id] = approval_response[4]\n response[:avs_result] = approval_response[5]\n response[:auth_net_message] = approval_response[6]\n response[:cvv_result] = approval_response[7]\n response[:partial_auth] = approval_response[8]\n\n # if a stored profile was added use its id for authorization otherwise\n # use the historyid, and append the last4digits of the card number so\n # that it does not have to be passed in, making it more compliant to\n # ActiveMerchant\n if response[:accountnumber]\n response[:authorization] = \"#{response[:transaction_type] == 'PROFILEADD' || response[:partial_auth] == 'DUPLICATE' ? response[:userprofileid] : response[:historyid]}#{response[:accountnumber][-4..-1]}\"\n end\n else\n decline_response = response[:reason].split(\":\")\n response[:transaction_result] = decline_response[0]\n response[:decline_code] = decline_response[1]\n response[:message] = decline_response[2]\n end\n\n response\n end", "def response_message\n parsed_response['message']\nend", "def parse(content)\n @response = []\n if ( content.respond_to?(:body) )\n @response = JSON.parse(content.body)\n else\n @response = JSON.parse(content)\n end\n @complete_items = @response[\"items\"]\n @raw_items = @response[\"items\"].map{|i| i['raw']}\n end", "def parse_response(key)\n JSON.parse(@response.body)[key.to_s]\n end", "def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end", "def parse_vapix_response(raw)\n if raw =~ /Error: Error/\n return {}\n end\n response = nested_hash\n raw_responses = raw.split(/\\n/)\n raw_responses.each do |raw_response|\n raw_key_string, raw_value = raw_response.split('=')\n raw_keys = raw_key_string.split('.')\n raw_keys.shift # get rid of root.\n last_key = nil\n semilast_hash = nil\n last_hash = response\n raw_keys.length.times do |level|\n last_key = raw_keys[level]\n semilast_hash = last_hash\n last_hash = last_hash[last_key]\n end\n semilast_hash[raw_keys.last] = raw_value\n end\n return response\n end", "def parse(data)\n new_data = {}\n\n unless data =~ /\\n/\n log \"Received response as a single-line String. Discarding.\"\n log \"Bad response looked like:\\n#{data}\"\n return new_data\n end\n\n data.each_line do |line|\n line =~ /(\\S*):(.*)/\n\n unless $1.nil?\n key = $1\n value = $2\n key = key.gsub('-', '_').downcase.to_sym\n new_data[key] = value.strip\n end\n end\n\n new_data\n end", "def parse_request_result(result)\n if result.nil?\n []\n else\n json = result.read\n\n if json.nil?\n []\n else\n r = JSON.parse(json)\n\n # Add the etag to the response only for individual entities\n if result.meta['etag'] and r.class != Array\n r['etag'] = result.meta['etag']\n end\n\n r\n end\n end\n end", "def validate(response)\n error_klass = Error.klass(response)\n raise error_klass, response if error_klass\n\n parsed = response.parsed_response\n parsed.client = self if parsed.respond_to?(:client=)\n parsed.parse_headers!(response.headers) if parsed.respond_to?(:parse_headers!)\n parsed\n end", "def parse_response(response)\n puts \"Parsing/Cleaning up the response\" if @enable_debug_logging\n data = response.body[:get_list_items_response][:get_list_items_result][:listitems][:data]\n\n # initialize needed variables\n items = []\n # retrieving the number of list items\n list_length = data[:@item_count].to_i\n\n # If there is only one item in the list, the JSON response is not warpped \n # in an array, so the record can be added directly\n if list_length == 1\n # Sort the keys\n keys = data[:row].keys.sort {|a,b| a.to_s <=> b.to_s}\n # Build up the item by \n item = keys.inject({}) do |hash, key|\n hash.merge!(key.to_s.gsub(/^@ows_/,\"\").gsub(\"_x0020_\",\"_\") => data[:row][key])\n end\n # Add the item to the list\n items.push(item)\n # If these are multiple items in the list, this iterates through the list\n # items, cleaning each one up\n elsif list_length > 0\n data[:row].each do |row|\n # Sort the keys\n keys = row.keys.sort {|a,b| a.to_s <=> b.to_s}\n # Build up the item\n item = keys.inject({}) do |hash, key|\n hash.merge!(key.to_s.gsub(/^@ows_/,\"\").gsub(\"_x0020_\",\"_\") => row[key])\n end\n # Add the item to the list\n items.push(item)\n end\n end\n\n # Build the results\n return {:list_length => items.length, :items => items}\n end", "def parse_response(response)\n object = nil\n\n if response.body and !response.body.empty?\n object = MultiJson.load response.body\n end\n\n object\n end", "def parse_response(response)\n gimme_what_you_got = {}\n response_doc = JSON.parse(response)\n response_doc['data'].each do |id, tap|\n tap_name = id\n\n brewery = tap['brewery']\n beer_name = tap['beer']\n\n beer_type = tap['style']\n # beer_type.sub! /\\s+-\\s+/, ''\n\n # abv = beer_node.css('td')[4].children.to_s\n full_text_search = \"#{brewery} #{beer_name.to_s.gsub /(\\d+|')/, ''}\" # #{beer_desc.to_s.gsub /\\d+\\.*\\d*%*/, ''}\n\n price = (tap['prices'][0].sub /\\$/, '').to_f\n\n gimme_what_you_got[tap_name] = {\n # type: tap_type,\n # remaining: remaining,\n brewery: brewery.to_s,\n name: beer_name.to_s,\n desc: beer_type.to_s,\n # abv: abv.to_f,\n price: price,\n search: full_text_search\n }\n end\n\n gimme_what_you_got\n end", "def parse_response(response, template_param)\n params = template_param.split('.')\n result = response\n params.each do |param|\n result = result[param] if result.class == Hash\n end\n\n result\n end" ]
[ "0.80483395", "0.7784271", "0.7653687", "0.75649554", "0.7493407", "0.7484105", "0.74695975", "0.74392503", "0.73845387", "0.73843646", "0.7365523", "0.7263753", "0.7251216", "0.72412694", "0.72119707", "0.720483", "0.7154983", "0.71441185", "0.7129483", "0.7105247", "0.7065624", "0.7047132", "0.70367503", "0.7030629", "0.701894", "0.70123845", "0.6981998", "0.6946076", "0.6938264", "0.6929317", "0.691034", "0.6884562", "0.68566483", "0.6825726", "0.68251276", "0.68072367", "0.6801816", "0.67690074", "0.6761605", "0.67512584", "0.6741016", "0.6735956", "0.66826653", "0.6662664", "0.66578174", "0.66517645", "0.6642995", "0.66393805", "0.66091853", "0.6606785", "0.6599753", "0.65852535", "0.6581202", "0.65746903", "0.65746903", "0.65722996", "0.65700144", "0.6539635", "0.65394145", "0.65337855", "0.6528652", "0.64952356", "0.6492634", "0.6486257", "0.647928", "0.6471264", "0.64561933", "0.6439949", "0.64378643", "0.643731", "0.64171666", "0.64158416", "0.64098", "0.6407747", "0.64054525", "0.63683563", "0.6364604", "0.63555706", "0.63446355", "0.6342722", "0.6342372", "0.63318795", "0.63313824", "0.6329999", "0.63280976", "0.63263303", "0.6325234", "0.6317526", "0.63155675", "0.6315476", "0.63119894", "0.63096374", "0.6309615", "0.6303019", "0.6294945", "0.629452", "0.62911034", "0.62801045", "0.6268273" ]
0.77555
3
1. 2 2. nil 3 Joe 4 four 5 nil print also retunrs nil, ofc
def multiply(x,y) x * y end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greet(name)\n\n if name == \"\" || name == nil\n p nil\n else\n return \"hello #{name}!\"\n end\n\nend", "def process_nil(exp)\n return \"Qnil\"\n end", "def process_nil(exp)\n return \"NULL\"\n end", "def greet(name)\n\nif name == \"\"\n p nil\nelsif name == nil\n p nil\nelse\n \"hello #{name}!\"\nend\n\nend", "def nil \n \"nil\" \n end", "def nil?() end", "def nil?() end", "def test_via_nil_string\r\n assert_equal 'Fifth Ave', @driver.via('nil', 'nil')\r\n end", "def weed_nils\n subject.reject! { |s| s == \"\" } if subject.present?\n end", "def test\n puts [].empty?\n puts \"\".empty?\n puts [].present?\n puts 1.present?\n puts nil.blank?\nend", "def refute_nil(obj, msg = T.unsafe(nil)); end", "def nil?() true; end", "def returns_nil; end", "def test_NilClass_InstanceMethod_to_s\n\t\tassert_equal(\"\", nil.to_s)\n\tend", "def print_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs \"I got nothin' fellas\"\nend", "def write_nil\n end", "def puts_none()\n\tputs \"I got nothin'.\"\nend", "def puts_none()\n\tputs \"I got nothin'.\"\nend", "def puts_none()\n\tputs \"I got nothin'.\"\nend", "def print_none()\n\tputs\"there is nothing\"\nend", "def puts_none()\n\tputs \"I have nothin'.\"\nend", "def greet(person_1, person_2=nil)\n if person_2.nil?\n p \"Hey \" + person_1\n else\n p \"Hey \" + person_1 + \" and \" + person_2 \n end\nend", "def print_none()\n puts \"i got nothin'.\"\n end", "def print_none()\n puts \"i got nothing'.\"\nend", "def nil?; false; end", "def saludar(name=nil)#El nulo o NULL en ruby es nil\n if name\n puts \"Hola #{name}\"#Llamas una variable dentro del puts con #{variable}\n else\n puts \"Hola\"\n end\nend", "def print(msg = T.unsafe(nil)); end", "def if_nil(argument)\n if argument == nil \n \"\"\n else\n argument\n end\n end", "def print\n \"[#{@value},#{@left ? @left.print : \"nil\"},#{@right ? @right.print : \"nil\"}]\"\n end", "def print_none()\n puts \"i got nothin'.\"\n end", "def null\n end", "def puts_none\n\tputs \"I got nothing T_T\"\nend", "def puts_none()\n\tputs \"I got nothing.\"\nend", "def puts_none()\n\tputs \"I got nothing.\"\nend", "def whatever\n array = [1,nil,2,3]\n array.each do |item|\n aux ||= 0\n puts item ||= aux\n end\nend", "def puts_none()\n\tputs \"I gor nothin.\"\nend", "def test_print_heading_nil\n assert_output(\"Heading from to \\n\"){@p.print_heading(nil, nil)}\n end", "def puts_none\n\tputs \"I have nothing\"\nend", "def print_none()\r\n puts \"I got nothin'.\"end", "def saludar(name=nil)\n print 'Hola'\n print \" #{name}\" if name\n print \"\\n\"\nend", "def print_none()\n puts \"I got nothing'.\"\nend", "def main\n if 0\n p 0\n end\n\n if \"\" then\n p 1\n end\n\n if false\n p 2\n end\n\n if nil\n p 3\n end\n\n scope\nend", "def test_print_start_nil\n assert_raises(StandardError) { print_start(nil) } # pass\n end", "def print_none\n puts \"I got nothin'.\"\nend", "def print_none()\n p \"I got nothin'.\"\nend", "def puts_none()\n puts \"I got nothing'.\"\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 null!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 67 )\n\n type = NULL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 188:8: 'null'\n match( \"null\" )\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__, 67 )\n\n end", "def nstr(item)\n return if item.nil?\n\n item.to_s\nend", "def greet(person_1, person_2 = nil)\n if person_2.nil?\n p \"Hey \" + person_1\n else\n p \"Hey \" + person_1 + \" and \" + person_2\n end\nend", "def print_none()\n\tputs \"\\t>> print_none\"\n\tputs \"i got nothin'.\"\n\tputs \"\\t<< print_none\"\nend", "def none?; end", "def none?; end", "def none?; end", "def puts_none()\n\tputs \"I got nothin\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"i got nothin'.\"\nend", "def print_names(list_of_students)\n puts !list_of_students.empty? ? print_student_list(list_of_students) : \"no students\"\nend", "def fine_name\r\n nil\r\n end", "def displayNull \n \"displayNull\" \n end", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def print_none()\n puts \"I got nothin'.\"\nend", "def test_print_nil\n assert_output(\"\\tMining Results\\n\\tNo precious metals were found!\\n\") do\n @game.print_mining_results(0, 0)\n end\n end", "def puts_none()\r\n puts \"I got nothing'.\"\r\nend", "def print_none()\n puts \"I got nothing.\"\nend", "def puts_none()\n puts \"I got nothing'.\"\nend", "def print_none()\r\n\tputs \"I got nothin\"\r\nend", "def print_good(msg='')\n end", "def null?; false end", "def null?; @null; end", "def test_nil_args\n refute check_args(nil)\n end", "def print_none()\n puts \"I got nothing\"\nend", "def print_none()\n puts \"I got nothing\"\nend", "def print_none()\n puts \"I got nothing\"\nend", "def print_none()\n puts \"I got nothing\"\nend", "def print_none()\n puts \"I get nothing.\"\nend", "def puts_none()\n puts \"I got nothing'.\"\nend", "def puts_none()\r\n puts \"I got nothin'.\"\r\nend", "def puts_none()\n puts \"I got nothin'.\"\nend" ]
[ "0.6752813", "0.6638299", "0.6531137", "0.64756066", "0.6266328", "0.58996147", "0.58996147", "0.58889663", "0.5857725", "0.57292926", "0.5700065", "0.56931454", "0.5655186", "0.56332463", "0.561617", "0.561617", "0.561617", "0.561617", "0.561617", "0.5598927", "0.5557926", "0.5547129", "0.5547129", "0.5547129", "0.5543542", "0.5537713", "0.55329305", "0.55262554", "0.5518002", "0.5516061", "0.5513316", "0.5500511", "0.5495399", "0.5493234", "0.5489916", "0.54866844", "0.54828185", "0.5479297", "0.5479297", "0.5467163", "0.5462323", "0.5460819", "0.5434801", "0.54319644", "0.543043", "0.5428364", "0.54231554", "0.54223275", "0.5417877", "0.5415488", "0.5415442", "0.54094803", "0.5405321", "0.53883845", "0.5383981", "0.53766215", "0.5372191", "0.5372191", "0.5372191", "0.53539604", "0.53432965", "0.53304553", "0.5324922", "0.53247494", "0.5322575", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.532174", "0.53025705", "0.5298368", "0.5295113", "0.52925885", "0.5287674", "0.52829933", "0.5281597", "0.528082", "0.52790797", "0.52646965", "0.52646965", "0.52646965", "0.52646965", "0.5263703", "0.5260145", "0.52475536", "0.52473116" ]
0.0
-1
GET /vegetals GET /vegetals.json
def index @vegetals = Vegetal.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def list\n meals = @meals_repository.all\n @view.list(meals)\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end", "def index\n @meals = Meal.all\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end", "def index\n respond_with(deals)\n end", "def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def index\n @meals = current_user.meals\n end", "def index\n @meals = current_user.meals\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @meal }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end", "def all_deals(**args)\n params = parameters(args) do\n optional_params :user_id, :filter_id, :stage_id, :status, :start, :limit, :sort, :owned_by_you\n end\n request(:get, 'deals', params)\n end", "def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end", "def index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index\n @mealplan_meals = MealplanMeal.all\n end", "def index\n @meals = current_user.meals.all\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # show.js.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end", "def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def index\n meals = json_decode(RestClient::Resource.new(BASE_URL).get({:accept => :json}).body)\n\n styled_array(meals.map do |meal|\n [(meal['today'] ? '*' : ''), day_of_week(meal['date']), meal['summary']]\n end, :sort => false)\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def index\n @expenses = find_expenses.all\n render json: @expenses\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show_deal(id)\n get(\"deals/#{id}\")\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def list\n # 1. Ask the repo to bring all meals #all\n meals = @meal_repo.all\n # 2. Pass the meals to the view to display them\n @meal_view.display_all(meals)\n end", "def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end", "def index\n @user_meals = UserMeal.all\n end", "def index\n @goals = current_user.goals.where(archived: false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show \n @meal = Meal.where(id: params[:id])\n end", "def index\n @rentals = Rental.get_all\n end", "def index\n render json: Loan.all\n end", "def show\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_meeting }\n end\n end", "def show_deals(search = nil, **params)\n params[:search] = search\n\n get('deals', params)\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def list\n display_meals\n end", "def index\n @todos = Todo.all\n render json: @todos\n end", "def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n @todo=Todo.find(params[:id])\n render json: @todo\n end", "def index \n restaurant = Restaurant.all\n render json: restaurant\n end", "def show\n @ef_mental = EfMental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ef_mental }\n end\n end", "def index\n @deals = Deal.where(:status => \"published\")\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end", "def show\n @lending = Lending.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lending }\n end\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n @todos = Todo.all\n json_response(@todos)\n end", "def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end", "def index\n @arsenals = Arsenal.all\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\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 if not @document.nil?\n tvDocument = @document.read_tv_document(@@tvVaultID, @@tvAdminAPI)\n tvGoals = Goal.get_goals(tvDocument)\n\n render json: {\n message: 'Document was successfully retrieved.',\n data: tvGoals\n },\n status: 200\n else\n render json: {\n message: 'Document does not exist!'\n },\n status: 500\n end\n end", "def show\n @meals = Menu.meals\n @locations = Menu.locations\n @menu = Menu.where(id: params[:id]).first\n @items = @menu.items.sort_by{ |obj| obj.updated_at }\n #we have access to meal\n end", "def index\n @indication_for_meals = IndicationForMeal.all\n end", "def show\n @todo = Todo.find(params[:id])\n #@todos = Todo.where(:id>=0).order(\"id asc\").page(params[:page]).per(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n json_response(@todo)\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meal }\n end\n end", "def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end", "def show\n json_response(@food_item)\n end", "def index\n @cooked_meals = CookedMeal.all\n end", "def index\n @essays = Essay.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @essays }\n end\n end", "def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\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 json_response(current_restaurant.restaurant_food_items)\n end", "def show\n render json: @todo\n end", "def show\n render json: @todo\n end", "def index\n @title = \"Deals\"\n if is_company?\n @company = Company.find_by_user_id(current_user.id)\n @deals = @company.deals\n else\n @deals = Deal.all.sort{|a,b| b.popularity <=> a.popularity} #most popular first\n end\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @deals }\n end\n end", "def show\n render json: @investment, root: false\n end", "def index\n @rentals = Rental.all\n end" ]
[ "0.7924275", "0.7193109", "0.6944809", "0.67600524", "0.67520845", "0.6693124", "0.65943605", "0.65157497", "0.64996415", "0.64956534", "0.64890826", "0.64443564", "0.6434203", "0.6423552", "0.6415948", "0.6415948", "0.64044166", "0.63958484", "0.6374165", "0.63310677", "0.63075936", "0.6272684", "0.62597245", "0.62582636", "0.62520176", "0.62520176", "0.6249291", "0.6238111", "0.62146884", "0.6208382", "0.6206757", "0.62045836", "0.6194633", "0.6189535", "0.6179213", "0.61761445", "0.61668843", "0.6165245", "0.6155917", "0.614423", "0.61437047", "0.61332303", "0.61309195", "0.61281586", "0.6085556", "0.60709256", "0.6060408", "0.6046511", "0.6046015", "0.6040094", "0.60263073", "0.60263073", "0.60263073", "0.60263073", "0.6019631", "0.6019631", "0.6019631", "0.60180396", "0.5994296", "0.59821886", "0.59730554", "0.5960193", "0.59569776", "0.59524894", "0.5939858", "0.5938461", "0.59366286", "0.59277666", "0.59229046", "0.5916124", "0.59113204", "0.59105575", "0.5909671", "0.5909193", "0.5904065", "0.5900149", "0.5897246", "0.5894785", "0.5892698", "0.58908564", "0.58908564", "0.58908564", "0.58869857", "0.5886152", "0.5885723", "0.5885481", "0.58693916", "0.5865802", "0.5863769", "0.5851566", "0.58485895", "0.58467567", "0.5846635", "0.58444256", "0.58423513", "0.58416307", "0.58416307", "0.5838524", "0.58363986", "0.5829893" ]
0.6897319
3
GET /vegetals/1 GET /vegetals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @meal }\n end\n end", "def index\n @vegetals = Vegetal.all\n end", "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal }\n end\n end", "def index\n @meals = Meal.all\n end", "def show\n respond_to do |format|\n format.html { render :show }\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n render json: @goal\n end", "def show\n goal = Goal.find(params[:id])\n render json: goal,status: :ok\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @appeal }\n end\n end", "def show\n todo = Todo.find_by_id(params[:id])\n render json: todo.todos\n end", "def list\n meals = @meals_repository.all\n @view.list(meals)\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js # show.js.erb\n format.json { render json: @meal }\n end\n end", "def show\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dental }\n end\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def index\n @appeals = @conference.appeals\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @appeals }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n @goal = Goal.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal }\n end\n end", "def show\n puts params[:id]\n render json: Todo.find(params[:id])\n end", "def show \n @meal = Meal.where(id: params[:id])\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def show_deal(id)\n get(\"deals/#{id}\")\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def show\n @meal = Meal.find(params[:id])\n end", "def meal\n @meals = Meal.all\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @meals, :only => [:id, :name, :price], :include => { :items => {:only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}} }\n end\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end", "def show\n @meal = Meal.find(params[:meal_id]) if params[:meal_id]\n @recipe = @meal.recipes.find(params[:id]) if @meal\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end", "def index\n respond_with(deals)\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 index\n @goals = Goal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n render json: @diet, status: 200, root: true\n end", "def show\n @love = Love.find(params[:id])\n render json: @love\n end", "def index\n @meals = current_user.meals\n end", "def index\n @meals = current_user.meals\n end", "def show\n @v_goal = VGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @v_goal }\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def show\n @todo=Todo.find(params[:id])\n render json: @todo\n end", "def show\n @Love = Love.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @Love }\n end\n end", "def index\n @loves = Love.all\n render json: @loves\n end", "def show\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_meeting }\n end\n end", "def index\n @mealplan_meals = MealplanMeal.all\n end", "def show\n @goal_reward = GoalReward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @goal_reward }\n end\n end", "def show\n @meal_profile = MealProfile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_profile }\n end\n end", "def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end", "def show\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @meal }\n end\n end", "def show\n @todo = Todo.find(params[:id])\n #@todos = Todo.where(:id>=0).order(\"id asc\").page(params[:page]).per(3)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def index \n restaurant = Restaurant.all\n render json: restaurant\n end", "def show\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def show\n\n @food = Food.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food }\n end\n end", "def show\n render json: @api_v1_todo\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def show\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json=>@todo }\n end\n end", "def show\n @meal_time = MealTime.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @meal_time }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n render json: Festival.build_for(params[:id]).to_json\n end", "def show\n @nail_salon = NailSalon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def index\n @rentals = Rental.get_all\n end", "def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\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 @ef_mental = EfMental.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ef_mental }\n end\n end", "def show\n @rental = Rental.get_by_id(params[:id])\n end", "def show\n @todo = @list.todos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @todo }\n end\n end", "def show\n @retweet = Retweet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @retweet }\n end\n end", "def index\n @user_meals = UserMeal.all\n end", "def index\n @meals = current_user.meals.all\n end", "def index\n @api_v1_todos = Todo.all\n render json: @api_v1_todos\n end", "def show\n @level_goal = LevelGoal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @level_goal }\n end\n end", "def show\n @lease = Lease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lease }\n end\n end", "def show\n @lending = Lending.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lending }\n end\n end", "def index\n @goals = @user.goals\n \n render json: @goals\n end", "def show\n @deals_wizard = DealsWizard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @deals_wizard }\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 @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @restaurant }\n end\n end", "def show\n render json: @todo\n end", "def show\n render json: @todo\n end", "def show\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale }\n end\n end", "def show\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sale }\n end\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def show\n @salary = Salary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @salary }\n end\n end", "def index\n @todos = Todo.all\n render json: @todos\n end", "def index\n @deals = Deal.where(:status => \"published\")\n end", "def index\n @todos = @list.todos\n render json: @todos\n end", "def show\n @favourite_food = FavouriteFood.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @favourite_food }\n end\n end" ]
[ "0.7652288", "0.71471846", "0.7011456", "0.7005884", "0.6891121", "0.67764294", "0.66231567", "0.6618944", "0.6573228", "0.6573228", "0.65539825", "0.6551145", "0.65374017", "0.65022075", "0.64776385", "0.6455948", "0.64533406", "0.6440103", "0.64285344", "0.64171034", "0.6398438", "0.6398438", "0.6398438", "0.6398438", "0.63833046", "0.6371153", "0.63647807", "0.6352402", "0.6340858", "0.6340489", "0.6340489", "0.6340489", "0.6325192", "0.6322602", "0.6318153", "0.63114494", "0.6299703", "0.6286317", "0.6286317", "0.6286317", "0.62829536", "0.6281335", "0.6272825", "0.62517846", "0.62517846", "0.6250598", "0.6247326", "0.62472963", "0.62450933", "0.62428975", "0.6239614", "0.6229528", "0.6204694", "0.6192671", "0.615928", "0.61592114", "0.615744", "0.61573756", "0.61526215", "0.61287594", "0.61158454", "0.611533", "0.6109051", "0.6106186", "0.61061484", "0.61061484", "0.6094269", "0.60886765", "0.6085804", "0.6085708", "0.6083021", "0.6078555", "0.60754865", "0.60753816", "0.6071106", "0.6070203", "0.6068297", "0.6066201", "0.6065443", "0.6051507", "0.605025", "0.6028576", "0.60226995", "0.6017751", "0.6010038", "0.60087025", "0.5993801", "0.59930897", "0.59889567", "0.59889567", "0.59889567", "0.5988772", "0.5988772", "0.5981747", "0.5981747", "0.59782445", "0.5976456", "0.5964835", "0.59640443", "0.59636515", "0.5959222" ]
0.0
-1
POST /vegetals POST /vegetals.json
def create @vegetal = Vegetal.new(vegetal_params) respond_to do |format| if @vegetal.save format.html { redirect_to @vegetal, notice: 'Vegetal was successfully created.' } format.json { render :show, status: :created, location: @vegetal } else format.html { render :new } format.json { render json: @vegetal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n # get meals from the user\n @meals = @user.meals\n # create a new meal for the ajax form to use\n @meal = Meal.new\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def meals\n get(\"/user/#{@user_id}/meals.json\")\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal }\n end\n end", "def new\n @journal = @journals.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @journal }\n end\n end", "def new\n @meal = Meal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @meal }\n end\n end", "def create\n @goal = @todo.goals.create(goal_params)\n render json: @goal\n end", "def create\n @meal = Meal.new(meal_params)\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render json: @meal, status: :created, location: @meal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @meals = Meal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meals }\n end\n end", "def create\n rental = sporting_goods.rentals.new(rental_params)\n rental.user_id = current_user.id\n if rental.save\n render json: rental, status: 200\n else\n render json: rental, status: 400\n end\n end", "def new #GIRO: POST /foals(.:format) foals#create\n@foal = Foal.new #GIRO: http://localhost:3000/foals/new\nend", "def create\n @meal = current_user.meals.build(meal_params)\n @meal.ip_address = request.location.ip\n @meal.expires_at = DateTime.now + 1.hour\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, notice: 'Meal was successfully created.' }\n format.json { render :show, status: :created, location: @meal }\n else\n format.html { render :new }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_deal(**args)\n params = parameters(args) do\n required_params :title\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :add_time, :visible_to\n end\n request(:post, 'deals', params)\n end", "def add\n meal_name = @view.ask_name\n meal_price = @view.ask_price.to_i\n new_meal = Meal.new({name: meal_name, price: meal_price})\n @meals_repository.add(new_meal)\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 goals_add\n @goal = Goal.create(goal_params)\n goal = GoalsUser.create({user_id:@user.id,goal_id:@goal.id})\n respond_to do |f|\n f.html {redirect_to goals_path(@user)}\n f.json {render json: {new_goal:goal,success: true}}\n end\n end", "def add\n # ask user for name and price\n attributes = {\n name: @view.ask_for_string(:name),\n price: @view.ask_for_number(:price)\n }\n # make new meal object\n # pass that to the repository\n @meals_repository.add(Meal.new(attributes))\n end", "def index\n @vegetals = Vegetal.all\n end", "def create\n @arsenal = Arsenal.new(arsenal_params)\n\n respond_to do |format|\n if @arsenal.save\n format.html { redirect_to @arsenal, notice: 'Arsenal was successfully created.' }\n format.json { render :show, status: :created, location: @arsenal }\n else\n format.html { render :new }\n format.json { render json: @arsenal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @dental = Dental.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dental }\n end\n end", "def index\n @meals = User.find(params['user_id']).meals.order('meals.created_at DESC')\n @oldmeal = User.find(params['user_id']).meals\n puts \"params: #{params['user_id']}\"\n puts \"all params: #{params}\"\n # puts \"chicken: #{User.find(1).meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])}\"\n # @apples = User.find(1).meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])\n # @apples = @meals.where([\"food_name like ? and sick = ?\", \"%Apples%\", true])\n\n\n # Seems like I need to add this whole section to create and post routes?????\n @sick = @oldmeal.select(:food_name).where(\"sick\": true)\n @sickCount = @sick.group(:food_name).count\n @sickString = ''\n @sick.each {|x| @sickString.concat(\" \" + x[:food_name])}\n @sickNoComma = @sickString.gsub(/,/, ' ').gsub(/ /, ' ')\n @stringResult = @sickNoComma.downcase.split.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n\n # I think it would make sense to 'clean' @sickString to make it all downcase and remove commas\n puts \"apple test: #{@sick} count: #{@sickCount} string: #{@sickString}\"\n\n # Could certainly refactor this down to only show meals and stringResult\n\n render json: {meals: @meals, sick: @sick, count: @sickCount, string: @sickString, stringResult: @stringResult.sort_by {|key, value| value}}\n # render json: @meals.reverse\n end", "def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end", "def create\n @todo = Todo.create(todo_params)\n render json: @todo\n end", "def add\n # ask user for name and price\n attributes = {\n name: @view.ask_for_string(:name),\n price: @view.ask_for_number(:price)\n }\n # make new meal object\n # pass that to the repo\n @meals_repo.add(Meal.new(attributes))\n end", "def create\n @mealplan_meal = MealplanMeal.new(mealplan_meal_params)\n\n respond_to do |format|\n if @mealplan_meal.save\n format.html { redirect_to @mealplan_meal, notice: 'Mealplan meal was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan_meal }\n else\n format.html { render :new }\n format.json { render json: @mealplan_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @nepals = Nepal.all\n\n render json: @nepals\n end", "def menu\n foods = current_user.restaurant.meals.where(meal_type: 0)\n drinks = current_user.restaurant.meals.where(meal_type: 1)\n render json: {foods: foods, drinks: drinks, is_success: true}, status: :ok\n end", "def create\n @investment = Investment.new(investment_params)\n\n if @investment.save\n render json: @investment, status: :created\n else\n render json: @investment.errors, status: :unprocessable_entity\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lease }\n end\n end", "def create\n @hotdeal = current_user.hotdeals.build(hotdeal_params)\n\n respond_to do |format|\n if @hotdeal.save\n format.html { redirect_to @hotdeal, notice: 'Hotdeal was successfully created.' }\n format.json { render :show, status: :created, location: @hotdeal }\n else\n format.html { render :new }\n format.json { render json: @hotdeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @deals_wizard = DealsWizard.new\n \n \n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @deals_wizard }\n end\n end", "def create\n @user_meal = UserMeal.new(user_meal_params)\n\n respond_to do |format|\n if @user_meal.save\n format.html { redirect_to @user_meal, notice: 'User meal was successfully created.' }\n format.json { render :show, status: :created, location: @user_meal }\n else\n format.html { render :new }\n format.json { render json: @user_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @list = @goal.list\n respond_to do |format|\n if @goal.save\n format.js {render :action => 'update_goals.js.haml', :locals => {:goals => @list.goals}}\n else\n format.html { render :new }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sale = Sale.new(sale_params)\n\n if @sale.save\n render json: @sale, status: :created, location: @sale\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end", "def index\n respond_with(deals)\n end", "def index\n @investments = Investment.all\n\n render json: {investments: @investments}, root: false\n end", "def create_rental(options = {})\n post(:rentals, rentals: [options]).pop\n end", "def new\n @salary_slip = SalarySlip.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @salary_slip }\n end\n end", "def create_deals_search body, from: nil, size: nil\r\n # the base uri for api requests\r\n query_builder = Configuration::BASE_URI.dup % [@version]\r\n\r\n # prepare query string for API call\r\n query_builder << \"/deals/search\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_query_parameters query_builder, {\r\n \"from\" => from,\r\n \"size\" => size,\r\n }\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-Api-Key\" => @x_api_key\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:body.to_json\r\n\r\n #Error handling using HTTP status codes\r\n if !(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\n puts \"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\"\n @investment = Investment.new(amount:params[:amount])\n\n respond_to do |format|\n if @investment.save\n format.html { redirect_to @investment, notice: 'Investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @investment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n num_days = (Date.parse(params['rent_info']['end_date']).mjd - Date.parse(params['rent_info']['start_date']).mjd) \n total = num_days * params['rent_info']['price_per_day']\n # byebug\n if User.find(params['rent_info']['owner_id'])\n user = User.find(params['rent_info']['owner_id'])\n user.money_made += total \n user.save\n end\n\n renter_post = RenterPost.create(\n renter_id: params['rent_info']['renter_id'],\n post_id: params['rent_info'][\"post_id\"],\n start_date: params['rent_info'][\"start_date\"],\n end_date: params['rent_info'][\"end_date\"],\n status: params['rent_info'][\"status\"]\n )\n if renter_post \n render json: renter_post\n else\n render json: {error: \"Could not create Renter Post\"}\n end\n end", "def index\n @meals = Meal.all\n end", "def index\n @goals = @todo.goals.all\n render json: @goals\n end", "def index\n @ef_mentals = EfMental.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_mentals }\n end\n end", "def create\n @appraisal_fee = AppraisalFee.new(appraisal_fee_params)\n @appraisal_fee.loan_id = session[:current_loan_id]\n\n respond_to do |format|\n if @appraisal_fee.save\n # format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully created.' }\n format.html { redirect_to Loan.find(@appraisal_fee.loan) }\n format.json { render action: 'show', status: :created, location: @appraisal_fee }\n else\n format.html { render action: 'new' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def new\n @goal = Goal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goal }\n end\n end", "def create\n @goals = goals_for_current_user\n @goal = Goal.new(params[:goal])\n @goal.user = current_user\n\n respond_to do |format|\n if @goal.save\n format.html { redirect_to({action: 'index'}, notice: 'Goal was successfully created.') }\n format.json { render json: @goal, status: :created, location: @goal }\n else\n format.html { render action: 'index' }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @dental = Dental.new(params[:dental])\n\n respond_to do |format|\n if @dental.save\n format.html { redirect_to @dental, notice: 'Dental was successfully created.' }\n format.json { render json: @dental, status: :created, location: @dental }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dental.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meal_posting = MealPosting.new(meal_posting_params)\n @meal_posting.user = current_user\n\n respond_to do |format|\n if @meal_posting.save\n format.html { redirect_to @meal_posting }#, notice: 'Meal posting was successfully created.' }\n format.json { render :show, status: :created, location: @meal_posting }\n else\n format.html { render :new }\n format.json { render json: @meal_posting.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fee = Fee.new(params[:fee])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to fees_path, notice: 'Fee was successfully created.' }\n format.json { render json: @fee, status: :created, location: @fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meal_plan = MealPlan.new(meal_plan_params)\n\n respond_to do |format|\n if @meal_plan.save\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully created.' }\n format.json { render :show, status: :created, location: @meal_plan }\n else\n format.html { render :new }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @todo = Todo.new(todo_params)\n @todo.save\n #render json: { :success => 1, :todo => @todo } \n end", "def index\n @goals = goals_for_current_user\n @goal = Goal.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def new\n @todo = @list.todos.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @todo }\n end\n end", "def create\n @journal = @journals.new(params[:journal])\n\n respond_to do |format|\n if @journal.save\n format.html { redirect_to [@user, @journal], notice: 'Journal was successfully created.' }\n format.json { render json: @journal, status: :created, location: @journal }\n else\n format.html { render action: \"new\" }\n format.json { render json: @journal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @nail_salon = NailSalon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @nail_salon }\n end\n end", "def create\n @mealplan = Mealplan.new(mealplan_params)\n\n respond_to do |format|\n if @mealplan.save\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully created.' }\n format.json { render :show, status: :created, location: @mealplan }\n else\n format.html { render :new }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @indication_for_meal = IndicationForMeal.new(indication_for_meal_params)\n\n respond_to do |format|\n if @indication_for_meal.save\n format.html { redirect_to @indication_for_meal, notice: 'Indication for meal was successfully created.' }\n format.json { render action: 'show', status: :created, location: @indication_for_meal }\n else\n format.html { render action: 'new' }\n format.json { render json: @indication_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n event_params = params[:event]\n\n @event = current_user.chef_events.new({\n held_at: Date.parse(event_params[:time]),\n maximum_guest_count: event_params[:seats],\n address: event_params[:address]\n })\n\n meal = Meal.new({\n chef_user: current_user,\n name: event_params[:dishname],\n ingredients: event_params[:ingredients],\n suggested_price: event_params[:price]\n })\n\n offer = @event.offered_meals.new({\n meal: meal,\n price: event_params[:price]\n })\n\n offer.photos.new({\n image: event_params[:image]\n })\n\n if @event.save\n referer = URI(request.referer)\n # render :show, status: :created, location: @event\n redirect_to URI(%{http://#{referer.host}:#{referer.port}/TopPicks}).to_s\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end", "def create\n @vote = Vote.new\n set_item = SetItem.find_by(id: params[:set_item_id])\n @vote.set_item_id = params[:set_item_id]\n @vote.audience_member_id = params[:audience_member_id]\n @vote.event_id = params[:event_id]\n\n\n respond_to do |format|\n if @vote.save\n format.html { redirect_to live_event_url(set_item.event.code) }\n format.json { render action: 'show', status: :created, location: @vote }\n else\n format.html { redirect_to live_event_url(set_item.event.code) }\n format.json { render json: @vote.errors, status: :unprocessable_entity }\n end\n end\n end", "def meal_params\n params.require(:meal).permit(:date, :meal, :ingredients, :nutrition, :notes, :target, :user_id)\n end", "def create\n @diet = Diet.new(diet_params)\n @diet.user = @current_user\n\n if @diet.save\n render json: @diet, status: 201, location: @diet, root: true\n else\n render json: @diet.errors, status: 422\n end\n end", "def new\n @exercise_plan = ExercisePlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def save\n\t\t@@deals << self\n\tend", "def create\n @meal_food = MealFood.new(meal_food_params)\n\n respond_to do |format|\n if @meal_food.save\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully created.' }\n format.json { render :show, status: :created, location: @meal_food }\n else\n format.html { render :new }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tally = Tally.new(tally_params)\n respond_to do |format|\n if @tally.save\n format.html { redirect_to @tally, notice: 'Tally was successfully created.' }\n format.json { render :show, status: :created, location: @tally }\n else\n format.html { render :new }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooked_meal = CookedMeal.new(cooked_meal_params)\n\n respond_to do |format|\n if @cooked_meal.save\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully created.' }\n format.json { render :show, status: :created, location: @cooked_meal }\n else\n format.html { render :new }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mental_post = MentalPost.new(mental_post_params)\n @mental_post.user = current_user\n\n respond_to do |format|\n if @mental_post.save\n format.html { redirect_to @mental_post, notice: \"Mental post was successfully created.\" }\n format.json { render :show, status: :created, location: @mental_post }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @mental_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @retweet = Retweet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @retweet }\n end\n end", "def new_lead\n @lead = Lead.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lead }\n end\n end", "def create\n @loan = Loan.new(loan_params)\n\n respond_to do |format|\n if @loan.save\n @item = @loan.item\n format.html { redirect_to @item, notice: I18n.t('views.loan.created') }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :new }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @todo = Todo.new(todo_params)\n if @todo.save\n render json: @todo, status: :created, location: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def POST; end", "def create\n @goal_entry = GoalEntry.new(goal_entry_params)\n\n respond_to do |format|\n if @goal_entry.save\n format.html { redirect_to @goal_entry, notice: 'Goal entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @goal_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @goal_entry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.user = current_user\n @goals = current_user.goals\n respond_to do |format|\n if @goal.save\n format.html { redirect_to home_index_path, notice: 'Goal was successfully created.' }\n # format.json { render :show, status: :created, location: @goal }\n else\n format.html { render :new, notice: \"There was an error updating your goal.\" }\n # format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @addre = Addre.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @addre }\n end\n end", "def create\n passenger = Passenger.new(:name => params[:name], :contact_number => params[:contact_number], :nationality => params[:nationality], :meal_pref => params[:meal_pref])\n passenger.save\n render :json => passenger\n end", "def new\n @ped = Ped.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ped }\n end\n end", "def new\n @meal_meeting = MealMeeting.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @meal_meeting }\n end\n end", "def new\n @assay = Assay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @assay }\n end\n end", "def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rental = Rental.new(rental_params)\n\n respond_to do |format|\n if @rental.save\n format.html { redirect_to @rental, notice: \"Rental was successfully created.\" }\n format.json { render :show, status: :created, location: @rental }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @goal = Goal.new(goal_params)\n @goal.client_id = params[:client_id]\n @goal.status = 'active'\n\n if @goal.save\n flash[:message] = \"Goal saved\"\n render json: @goal.to_json\n else\n end\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def index\n @mealplan_meals = MealplanMeal.all\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n @sale = Sale.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale }\n end\n end", "def new\n post = Post.new\n render json: post\n end", "def _state_deals(state_id)\n get('state/deals', state_id, options: { type: :array })\n end", "def new\n @office = Office.new\n\n track_event(\"Viewed AddListing\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @office }\n end\n end", "def create\n @meal = Meal.new(params[:meal])\n respond_to do |format|\n if @meal.save\n recipeid = @meal.recipe_id\n flash[:notice] = 'Meal was successfully created.'\n #format.html { redirect_to(recipe_url(recipeid), :layout => false) }\n format.xml { render :xml => @meal, :status => :created, :meal => @meal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @guest_name = params[:meal][:guest_name]\n params[:meal].delete :guest_name\n @guest = Guest.where(:name => @guest_name).first\n if (@guest.nil?)\n @guest = Guest.new\n @guest.name = @guest_name\n end\n\n @meal = Meal.new(params[:meal])\n @meal.guest = @guest\n\n respond_to do |format|\n if @meal.save\n format.html { redirect_to @meal, :notice => 'Le repas a été créé avec succès.' }\n format.json { render :json => @meal, :status => :created, :location => @meal }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n monthly_slip(params)\n # secure valid input\n return render json: { msg: \"input valid number\" } unless @annual_salary > 0\n @timestamp = DateTime.now\n slip = Slip.new({\n \"time_stamp\" => @timestamp,\n \"annual_salary\" => @annual_salary,\n \"employee_name\" => @employee_name,\n \"monthly_income_tax\" => @monthly_income_tax,\n })\n if slip.save\n render json: { status: \"SUCCESS\", message: \"Saved Infotmation\", data: slip }, status: :ok\n else\n render json: { status: \"ERROR\", message: \"Information not saved\", data: slip.errors }, status: :unprocessable_entity\n end\n end", "def new\n render :json => @fiestas.push(params[:fiesta])\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" ]
[ "0.64241505", "0.636418", "0.59712434", "0.59712434", "0.5943987", "0.59247273", "0.58807313", "0.58673614", "0.5854373", "0.58087", "0.5793811", "0.5786672", "0.5770917", "0.5764057", "0.5638997", "0.5634328", "0.56289107", "0.5600503", "0.55712026", "0.5569794", "0.55513674", "0.5543583", "0.55310297", "0.5528739", "0.5509717", "0.55014193", "0.54970014", "0.5495672", "0.5495567", "0.548881", "0.54835147", "0.54806954", "0.54750156", "0.54736817", "0.54679054", "0.5464807", "0.54509944", "0.5446078", "0.54456514", "0.54117197", "0.5409934", "0.540798", "0.54059196", "0.5404534", "0.53886944", "0.53808546", "0.53808546", "0.53808546", "0.5380528", "0.53791994", "0.5375185", "0.5364935", "0.5364007", "0.53637403", "0.5358461", "0.5356329", "0.5354007", "0.5343086", "0.5341526", "0.5341427", "0.5337782", "0.53334486", "0.53309476", "0.53239554", "0.53217876", "0.5317508", "0.53131646", "0.5311731", "0.5311554", "0.5310207", "0.53098893", "0.53077507", "0.5303996", "0.529606", "0.52921844", "0.5286718", "0.52841467", "0.528179", "0.5281629", "0.528092", "0.52774465", "0.5272506", "0.5268708", "0.52666825", "0.5265694", "0.52611834", "0.52610296", "0.52608246", "0.52608246", "0.52608246", "0.5259721", "0.5255951", "0.5241781", "0.52394456", "0.5237556", "0.5235299", "0.5234073", "0.5232473", "0.5232473", "0.5232473" ]
0.56794524
14
PATCH/PUT /vegetals/1 PATCH/PUT /vegetals/1.json
def update respond_to do |format| if @vegetal.update(vegetal_params) format.html { redirect_to @vegetal, notice: 'Vegetal was successfully updated.' } format.json { render :show, status: :ok, location: @vegetal } else format.html { render :edit } format.json { render json: @vegetal.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update_attributes(todo_params)\n render json: @todo, status: :ok\n else\n render json: @todo.errors, status: 422\n end\n end", "def update\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n if @todo.update(todo_params)\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\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 goal = Goal.find params[:id]\n if goal.update(goal_params)\n render json: goal, status: 200\n else\n render json: goal.errors.full_messages, status: 422\n end\n end", "def update\n ingredient.update(ingredient_params)\n render json: ingredient\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 @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to([@test_subject, @meal]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def UpdateView params = {}\n \n APICall(path: 'views.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n @serving = Serving.find(params[:id])\n\n respond_to do |format|\n if @serving.update_attributes(params[:serving])\n format.html { redirect_to @serving, notice: 'Serving was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @serving.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n if @todo.update(todo_params)\n head :no_content\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, :notice=>\"Todo was successfully updated.\"}\n format.json { head :ok }\n else\n format.html { render :action=>\"edit\" }\n format.json { render :json=>@todo.errors, :status=>\"unprocessable_entry\" }\n end\n end\n end", "def update\n @todo.update(todo_params)\n respond_with(@user, @todo)\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n @tally = Tally.find(params[:id])\n respond_to do |format|\n if @tally.update(tally_params)\n format.html { redirect_to @tally, notice: 'Tally was successfully updated.' }\n format.json { render :show, status: :ok, location: @tally }\n else\n format.html { render :edit }\n format.json { render json: @tally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal_meeting = MealMeeting.find(params[:id])\n\n respond_to do |format|\n if @meal_meeting.update_attributes(params[:meal_meeting])\n format.html { redirect_to @meal_meeting, notice: 'Meal meeting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @meal_meeting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n if @meal.update(meal_params)\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to([@test_subject, @meal]) }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal = Meal.find(params[:id])\n recipeid = @meal.recipe_id\n respond_to do |format|\n if @meal.update_attributes(params[:meal])\n flash[:notice] = 'Meal was successfully updated.'\n format.html { redirect_to(recipe_url(recipeid)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lsit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @indication_for_meal.update(indication_for_meal_params)\n format.html { redirect_to @indication_for_meal, notice: 'Indication for meal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @indication_for_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal = @meal_recipe.meal\n @meal_plan = @meal.day.meal_plan\n @leftover = Leftover.meal_recipe(@meal_recipe).first\n @meal_ingredient = MealIngredient.new\n\n respond_to do |format|\n if params[:meal_recipe][:multiply].present?\n multiply_portions_and_ingredients(params[:meal_recipe][:multiply].to_d)\n end\n\n if params[:meal_recipe][:add].present?\n # @meal_recipe = MealRecipe.find(params[:id])\n @portions = @meal_recipe.portions\n ratio_increase = 1 + 1/@portions\n multiply_portions_and_ingredients(ratio_increase)\n end\n\n \n if @meal_recipe.update(meal_recipe_params)\n format.turbo_stream\n format.html { redirect_to @meal_recipe, notice: \"Meal recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal_recipe }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal_recipe.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def update\n note = Note.find(params[\"id\"])\n note.update_attributes(note_params)\n respond_with note, json: note\n end", "def update\n respond_to do |format|\n if @mealplan_meal.update(mealplan_meal_params)\n format.html { redirect_to @mealplan_meal, notice: 'Mealplan meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan_meal }\n else\n format.html { render :edit }\n format.json { render json: @mealplan_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n # if @bonus.update(bonus_params)\n # render :show, status: :ok, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to allies_url, notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @spoofer = Spoofer.find(params[:id])\n\n respond_to do |format|\n if @spoofer.update_attributes(params[:spoofer])\n format.html { redirect_to @spoofer, notice: 'Spoofer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @spoofer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cooked_meal.update(cooked_meal_params)\n format.html { redirect_to @cooked_meal, notice: 'Cooked meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooked_meal }\n else\n format.html { render :edit }\n format.json { render json: @cooked_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to foods_path(), notice: 'Food was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appeal.update_attributes(params[:appeal])\n format.html { redirect_to [@conference, @appeal], notice: 'Appeal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @appeal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rental = Rental.friendly.find(params[:rental_id])\n \n\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to rental_path(@rental), notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n @dental = Dental.find(params[:id])\n\n respond_to do |format|\n if @dental.update_attributes(params[:dental])\n format.html { redirect_to @dental, notice: 'Dental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dental.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n todo = get_todo(user: current_user)\n\n respond_to do |format|\n if todo.update(todo_params)\n format.html { redirect_back fallback_location: root_path }\n format.json { render :show, status: :ok, location: todo }\n else\n format.html { render :edit }\n format.json { render json: todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meal_food.update(meal_food_params)\n format.html { redirect_to @meal_food, notice: 'Meal food was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_food }\n else\n format.html { render :edit }\n format.json { render json: @meal_food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lunch.update(lunch_params)\n format.html { redirect_to @lunch, notice: 'Lunch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @lunch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:meal][:expires_at] == \"1\"\n params[:meal][:expires_at] = 1.hour.from_now\n else \n params[:meal].delete(:expires_at)\n end\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to @meal, notice: 'Meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal }\n else\n format.html { render :edit }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_meal.update(user_meal_params)\n format.html { redirect_to @user_meal, notice: 'User meal was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_meal }\n else\n format.html { render :edit }\n format.json { render json: @user_meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(params[:todo])\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ally.update(ally_params)\n format.html { redirect_to edit_ally_path(@ally), notice: 'Ally was successfully updated.' }\n format.json { render :show, status: :ok, location: @ally }\n else\n format.html { render :edit }\n format.json { render json: @ally.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n json_response(@food_item.update!(food_item_params))\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\n put :update\n end", "def put!\n request! :put\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def update\n respond_to do |format|\n if @rental.update(rental_params)\n format.html { redirect_to @rental, notice: \"Rental was successfully updated.\" }\n format.json { render :show, status: :ok, location: @rental }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @diet.update(diet_params)\n head :no_content, status: 204\n else\n render json: @diet.errors, status: 422\n end\n end", "def update\n if @todo.update(todo_params.merge!(updated_by_id: current_user.id))\n render json: @todo\n else\n render json: {errors: @todo.errors.full_messages}, status: 422\n end\n end", "def update\n @ef_mental = EfMental.find(params[:id])\n\n respond_to do |format|\n if @ef_mental.update_attributes(params[:ef_mental])\n format.html { redirect_to [@patient,@visit,@ef_mental], notice: 'Ef mental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ef_mental.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mealplan.update(mealplan_params)\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan }\n else\n format.html { render :edit }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sale = Sale.find(params[:id])\n\n if @sale.update(sale_params)\n head :no_content\n else\n render json: @sale.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_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 @meal_record.update(meal_record_params)\n format.html { redirect_to @meal_record, notice: 'Meal record was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_record }\n else\n format.html { render :edit }\n format.json { render json: @meal_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meal_plan.update(meal_plan_params)\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_plan }\n else\n format.html { render :edit }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vegetable.update(vegetable_params)\n format.html { redirect_to @vegetable, notice: 'Vegetable was successfully updated.' }\n format.json { render :show, status: :ok, location: @vegetable }\n else\n format.html { render :edit }\n format.json { render json: @vegetable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todo.update(todo_params)\n format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @todo.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 @stalkee.update(stalkee_params)\n format.html { redirect_to @stalkee, notice: 'Stalkee was successfully updated.' }\n format.json { render :show, status: :ok, location: @stalkee }\n else\n format.html { render :edit }\n format.json { render json: @stalkee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @interesting = Interesting.find(params[:id])\n\n respond_to do |format|\n if @interesting.update_attributes(params[:interesting])\n format.html { redirect_to @interesting, notice: 'Interesting was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interesting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to my_meals_path, notice: \"Chef was successfully updated.\" }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @meals_recipe = MealsRecipe.find(params[:id])\n\n respond_to do |format|\n if @meals_recipe.update_attributes(params[:meals_recipe])\n flash[:notice] = 'MealsRecipe was successfully updated.'\n format.html { redirect_to(@meals_recipe) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @meals_recipe.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n trip = Trip.find_by_id(params[:trip_id])\n trip.title = params[:title]\n trip.city = params[:city]\n trip.state = params[:state]\n trip.country = params[:country]\n trip.start_date = params[:start_date]\n trip.end_date = params[:end_date]\n trip.description = params[:description]\n trip.link = params[:link]\n if params[:photo_base]\n trip.photo = params[:photo_base]\n end\n trip.save!\n render json: trip\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal = Meal.find(params[:id])\n\n respond_to do |format|\n @guest_name = params[:meal][:guest_name]\n params[:meal].delete :guest_name\n @guest = Guest.where(:name => @guest_name).first\n if (@guest.nil?)\n @guest = Guest.new\n @guest.name = @guest_name\n end\n @meal.guest = @guest \n if @meal.update_attributes(params[:meal])\n format.html { redirect_to @meal, :notice => 'Le repas a été mis à jour avec succès.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @meal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @arsenal.update(arsenal_params)\n format.html { redirect_to @arsenal, notice: 'Arsenal was successfully updated.' }\n format.json { render :show, status: :ok, location: @arsenal }\n else\n format.html { render :edit }\n format.json { render json: @arsenal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo.update(todo_params)\n head :no_content\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(params[:food])\n format.html { redirect_to @food, notice: \"Piatto aggiornato correttamente.\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @callout.update(callout_params)\n format.html { redirect_to @callout, notice: 'Callout was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @day.update(meals: params[:meals])\n #respond_to do |format|\n #if @day.update(day_params)\n #format.html { redirect_to @day, notice: 'Day was successfully updated.' }\n #format.json { render :show, status: :ok, location: @day }\n #else\n #format.html { render :edit }\n #format.json { render json: @day.errors, status: :unprocessable_entity }\n #end\n #end\n end", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def update\n respond_to do |format|\n if @shelf.update(shelf_params)\n format.html { redirect_to house_shelves_path(params[:house_id]), notice: 'Shelf was successfully created.' } \n format.json { render :show, status: :ok, location: @shelf }\n else\n format.html { render :edit }\n format.json { render json: @shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @todo.update(todo_params)\n format.html { redirect_to @todo.list, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n format.html { redirect_to @todo.list }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def update\n respond_to do |format|\n if @lovedone.update(lovedone_params)\n format.html { redirect_to lovedones_path, notice: 'Loved one has been successfully updated.'}\n format.json { render :show, status: :ok, location: @lovedone }\n else\n format.html { render :edit }\n format.json { render json: @lovedone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with Expense.update(params[:id], expense_params), status: 204\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:id])\n\n respond_to do |format|\n if @todo.update_attributes(todo_params)\n # format.html { redirect_to @todo, notice: 'Todo was successfully updated.' }\n format.json { render :show, status: :ok, location: @todo }\n else\n # format.html { render :edit }\n format.json { render json: @todo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @goal = Goal.find(params[:id])\n\n respond_to do |format|\n if @goal.update_attributes(params[:goal])\n format.html { redirect_to @goal, notice: 'Goal was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @meal_plan = @meal.day.meal_plan\n\n respond_to do |format|\n if @meal.update(meal_params)\n format.html { redirect_to meal_path(@meal), notice: \"Meal was successfully updated.\" }\n format.json { render :show, status: :ok, location: @meal }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @meal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, attributes)\n # attributes = {name: 'chocolate and peanuts', calories: 10}\nend", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def update_deal(id:, **args)\n params = parameters(args) do\n optional_params :title, :value, :currency, :user_id, :person_id, :org_id, :stage_id, :status, :probability, :lost_reason, :visible_to\n end\n request(:put, \"deals/#{id}\", params)\n end", "def update_deal(id, params)\n put(\"deals/#{id}\", deal: params)\n end", "def update\n @journal = @journals.find(params[:id])\n\n respond_to do |format|\n if @journal.update_attributes(params[:journal])\n format.html { redirect_to @journal, notice: 'Journal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @journal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if Rental.current_user.admin?\n respond_to do |format|\n if @rental.update(rental_params)\n format.html { redirect_to rentals_path}\n format.json { render :show, status: :ok, location: @rental }\n else\n format.html { render :edit }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n else \n redirect_to rentals_path\n end\n end" ]
[ "0.67088336", "0.6597857", "0.64493227", "0.6436514", "0.64012647", "0.62966096", "0.62724805", "0.6168222", "0.61354554", "0.6129592", "0.6128159", "0.6116136", "0.60851675", "0.60556513", "0.60460365", "0.60314006", "0.6026244", "0.60146224", "0.6014291", "0.60077524", "0.5991054", "0.5988815", "0.59885323", "0.59874064", "0.5987058", "0.5984014", "0.5968803", "0.59571725", "0.59534115", "0.59455544", "0.59435064", "0.5943348", "0.5940227", "0.59382385", "0.59346324", "0.59330857", "0.5928305", "0.59280723", "0.59207565", "0.5919838", "0.5917031", "0.5915565", "0.59114546", "0.5911261", "0.5901769", "0.59017336", "0.58967173", "0.58967173", "0.5894736", "0.5893909", "0.5893157", "0.5888163", "0.5884199", "0.5877833", "0.5871661", "0.58685076", "0.58605874", "0.585872", "0.5850124", "0.58459824", "0.58448696", "0.5844465", "0.5843813", "0.58272475", "0.5821467", "0.58214", "0.5820727", "0.5817984", "0.5812843", "0.581261", "0.5810152", "0.5809747", "0.5808311", "0.5808311", "0.5806243", "0.5795146", "0.57923925", "0.5790501", "0.5790247", "0.5789743", "0.5775488", "0.5774184", "0.577182", "0.57697064", "0.57684433", "0.57684433", "0.5767405", "0.57662654", "0.57648283", "0.5758496", "0.57567734", "0.57559925", "0.57556957", "0.57545316", "0.57511723", "0.57504505", "0.5749683", "0.5748129", "0.5747674", "0.5745352" ]
0.6393831
5
DELETE /vegetals/1 DELETE /vegetals/1.json
def destroy @vegetal.destroy respond_to do |format| format.html { redirect_to vegetals_url, notice: 'Vegetal was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n meal = Meal.find(params[:id])\n meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to meals_url, notice: 'Meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dental = Dental.find(params[:id])\n @dental.destroy\n\n respond_to do |format|\n format.html { redirect_to dentals_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @indication_for_meal.destroy\n respond_to do |format|\n format.html { redirect_to indication_for_meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n render json: @goal\n end", "def destroy\n @mealplan_meal.destroy\n respond_to do |format|\n format.html { redirect_to mealplan_meals_url, notice: 'Mealplan meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n render json: nil, status: :ok\n end", "def destroy\n @rental = Rental.find(params[:id])\n @rental.destroy\n\n respond_to do |format|\n format.html { redirect_to rentals_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @todo = Todo.find_by(id: params[:id])\n Todo.delete(@todo)\n @@all = Todo.all\n render json: @@all\n end", "def destroy\n @cooked_meal.destroy\n respond_to do |format|\n format.html { redirect_to cooked_meals_url, notice: 'Cooked meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_subject_meals_url(@test_subject)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_subject_meals_url(@test_subject)) }\n format.xml { head :ok }\n end\n end", "def destroy \n\n \n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to request.env['HTTP_REFERER'] }\n format.json { head :ok }\n end\n end", "def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :ok }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tally.destroy\n respond_to do |format|\n format.html { redirect_to tallies_url, notice: 'Tally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @v_goal = VGoal.find(params[:id])\n @v_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to v_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal = Meal.find(params[:id])\n @meal.destroy\n\n respond_to do |format|\n format.js\n format.html { redirect_to list_path(@list) }\n format.json { head :ok }\n end\n end", "def destroy\n @ef_mental = EfMental.find(params[:id])\n @ef_mental.destroy\n\n respond_to do |format|\n format.html { redirect_to ef_mentals_url }\n format.json { head :no_content }\n end\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 @journal = @journals.find(params[:id])\n @journal.destroy\n\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @nail_salon = NailSalon.find(params[:id])\n @nail_salon.destroy\n\n respond_to do |format|\n format.html { redirect_to nail_salons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to leases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\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 Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end", "def destroy\n @group_meal = GroupMeal.find(params[:id])\n @group_meal.destroy\n\n respond_to do |format|\n format.html { redirect_to group_meals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_meal.destroy\n respond_to do |format|\n format.html { redirect_to user_meals_url, notice: 'User meal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy1\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to(todos_url) }\n format.xml { head :ok }\n end\n end", "def 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 delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @edital.destroy\n respond_to do |format|\n format.html { redirect_to editals_url, notice: 'Edital was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_deals(**args)\n params = parameters(args) do\n required_params :ids\n optional_params :ids\n end\n request(:delete, 'deals', params)\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @meal_food.destroy\n respond_to do |format|\n format.html { redirect_to meal_foods_url, notice: 'Meal food was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @historial = Historial.find(params[:id])\n @historial.destroy\n\n respond_to do |format|\n format.html { redirect_to historials_url }\n format.json { head :ok }\n end\n end", "def delete\n\t\trender json: Investor.delete_by_id(params[:id])\n\tend", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrival = Arrival.find(params[:id])\n @arrival.destroy\n\n respond_to do |format|\n format.html { redirect_to arrivals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_record.destroy\n respond_to do |format|\n format.html { redirect_to meal_records_url, notice: 'Meal record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id]).destroy\n if @todo.destroy\n render json: @todo\n else\n render json: @todo.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goal = Goal.find(params[:id])\n @goal.destroy\n\n respond_to do |format|\n format.html { redirect_to(goals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo = Todo.find(params[:id])\n @todo.destroy\n\n respond_to do |format|\n format.html { redirect_to todos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_meeting = MealMeeting.find(params[:id])\n @meal_meeting.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_meetings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meals_recipe = MealsRecipe.find(params[:id])\n @meals_recipe.destroy\n\n respond_to do |format|\n format.html { redirect_to(meals_recipes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @serving = Serving.find(params[:id])\n @serving.destroy\n\n respond_to do |format|\n format.html { redirect_to servings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mealplan = Mealplan.find(params[:id])\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_time = MealTime.find(params[:id])\n @meal_time.destroy\n\n respond_to do |format|\n format.html { redirect_to meal_times_url }\n format.json { head :no_content }\n end\n end", "def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end", "def delete_deal(id)\n delete(\"deals/#{id}\")\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: \"Rental was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @todo.destroy\n render json: [\"Deleted successfully.\"], status: :ok\n end", "def destroy\n @journal.destroy\n respond_to do |format|\n format.html { redirect_to journals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rental.destroy\n respond_to do |format|\n format.html { redirect_to rentals_url, notice: 'Rental was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @verse = Verse.find(params[:id])\n @verse.destroy\n\n respond_to do |format|\n format.html { redirect_to verses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @waldo.destroy\n respond_to do |format|\n format.html { redirect_to waldos_url, notice: 'Waldo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal = Meal.find(params[:id])\n recipeid = @meal.recipe_id\n @meal.destroy\n respond_to do |format|\n format.html { redirect_to(recipe_url(recipeid), :layout => false) }\n format.xml { head :ok }\n end\n end", "def destroy\n @walikela.destroy\n respond_to do |format|\n format.html { redirect_to walikelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exalt = Exalt.find(params[:id])\n @exalt.destroy\n\n respond_to do |format|\n format.html { redirect_to exalts_url }\n format.json { head :ok }\n end\n end", "def destroy\n @hotel_stay = HotelStay.find(params[:id])\n @hotel_stay.destroy\n\n respond_to do |format|\n format.html { redirect_to hotel_stays_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @diet.destroy\n head :no_content, status: 200\n else\n render json: @diet.errors, status: 405\n end\n end", "def destroy\n @arsenal.destroy\n respond_to do |format|\n format.html { redirect_to arsenals_url, notice: 'Arsenal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_dish.destroy\n respond_to do |format|\n format.html { redirect_to meal_dishes_url, notice: 'Meal dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_plan = @meal.day.meal_plan\n @meal.destroy\n respond_to do |format|\n format.turbo_stream { render turbo_stream: turbo_stream.remove(\"meal#{@meal.id}\") }\n format.html { redirect_to meal_plan_path(@meal_plan), notice: \"Meal was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_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 @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 @appraisal_fee.destroy\n respond_to do |format|\n format.html { redirect_to appraisal_fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @drip = Drip.find(params[:id])\n @drip.destroy\n\n respond_to do |format|\n format.html { redirect_to drips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foodlog = Foodlog.find(params[:id])\n @foodlog.destroy\n\n respond_to do |format|\n format.html { redirect_to foodlogs_url }\n format.json { head :ok }\n end\n end", "def destroy\n\n\n\n @vote = Vote.find(params[:id])\n\n @vote.destroy\n\n respond_to do |format|\n format.html { redirect_to votes_url }\n format.json { head :ok }\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 @essay = Essay.find(params[:id])\n @essay.destroy\n\n respond_to do |format|\n format.html { redirect_to essays_url }\n format.json { head :ok }\n end\n end", "def destroy\n @level_goal = LevelGoal.find(params[:id])\n @level_goal.destroy\n\n respond_to do |format|\n format.html { redirect_to level_goals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_item_add_on.destroy\n respond_to do |format|\n format.html { redirect_to food_item_add_ons_url, notice: 'Food item add on was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lent = Lent.find(params[:id])\n @lent.destroy\n\n respond_to do |format|\n format.html { redirect_to lents_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 @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.73275846", "0.7312232", "0.7207961", "0.7045363", "0.7031213", "0.6980636", "0.6958161", "0.6918578", "0.6908355", "0.690039", "0.6876018", "0.6874686", "0.68600106", "0.68297756", "0.6808887", "0.6807172", "0.6788572", "0.6788572", "0.6787185", "0.67865074", "0.67835486", "0.6769851", "0.6769851", "0.676966", "0.67402714", "0.67368686", "0.67240477", "0.6723454", "0.67162883", "0.6711074", "0.6711074", "0.6688776", "0.6677959", "0.6677959", "0.6672094", "0.6667348", "0.66643786", "0.66631734", "0.6660535", "0.66536057", "0.66425884", "0.6642242", "0.6639185", "0.6637892", "0.66359776", "0.66277623", "0.66231495", "0.6621741", "0.66188884", "0.661589", "0.66147006", "0.66021717", "0.6596569", "0.6596569", "0.6592391", "0.6587373", "0.6585977", "0.65858406", "0.6572874", "0.6572874", "0.6572155", "0.6569701", "0.65686363", "0.656777", "0.65665036", "0.65654415", "0.65631044", "0.6555675", "0.65542537", "0.65537536", "0.6551273", "0.6551273", "0.6540547", "0.6540547", "0.6538843", "0.653676", "0.65344805", "0.6532878", "0.6532838", "0.65324914", "0.65315723", "0.6526156", "0.65214676", "0.65147924", "0.6501226", "0.6501226", "0.6498093", "0.6496101", "0.64956295", "0.6493585", "0.6490865", "0.6489409", "0.6488923", "0.6487494", "0.6469027", "0.64685553", "0.6463429", "0.6463429", "0.6463429", "0.6463429" ]
0.6961546
6
Use callbacks to share common setup or constraints between actions.
def set_vegetal @vegetal = Vegetal.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 vegetal_params params.require(:vegetal).permit(:name, :color, :weight, :price) 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: move into resource_status.rb
def container_names (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_status\n lambda { |x| x.resource_status }\n end", "def resource_status\n lambda { |x| x[\"resource_status\"] }\n end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def statuses; end", "def retrieve_status\n \n end", "def status\n STATUSES[self.status_id]\n end", "def status_object\n @status\n end", "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def status\n super\n end", "def resource_status(resource)\n resource == current_page ? \"active\" : \"\"\n end", "def status\n status = stats.fetch @resource[:name], nil\n debug \"Got status: '#{status}'\"\n return :absent unless status\n return :present if [:present, :absent].include? @resource[:ensure]\n return :up if status == 'UP'\n return :down if status == 'DOWN'\n :present\n end", "def status(*) end", "def get_status\n\t\tstatus\n\tend", "def status\n STATUSES[self.status_id || 0]\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def last_status; end", "def resource_status_to_hash(resource_status)\n defaulted_corrective_change = defined?(resource_status.corrective_change) ? resource_status.corrective_change : nil\n index_size = resource_event_index_size(resource_status)\n\n if index_size > 2500 && index_size <= 2704\n Puppet.warning(\"resource_event on #{self.host} is very large. Values (resource timestamp + title + type) \\\nare #{index_size} bytes and the hard limit is 2704. Caused by Resource type: \\\"#{resource_status.resource_type}\\\" \\\nwith title: \\\"#{resource_status.title.to_s}\\\" in #{resource_status.file}:#{resource_status.line}\")\n end\n\n if index_size > 2704\n Puppet.warning(\"resource_event on #{self.host} could not be saved. Values (resource timestamp + title + type) are larger \\\nthan index total size of 2704. Caused by Resource type: \\\"#{resource_status.resource_type}\\\" with title: \\\n\\\"#{resource_status.title.to_s}\\\" in #{resource_status.file}:#{resource_status.line}\")\n end\n {\n \"skipped\" => resource_status.skipped,\n \"timestamp\" => Puppet::Util::Puppetdb.to_wire_time(resource_status.time),\n \"resource_type\" => resource_status.resource_type,\n \"resource_title\" => resource_status.title.to_s,\n \"file\" => resource_status.file,\n \"line\" => resource_status.line,\n \"containment_path\" => resource_status.containment_path,\n \"corrective_change\" => defaulted_corrective_change,\n \"events\" => build_events_list(resource_status.events),\n }\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n instance_get(:status)\n end", "def status\n instance.status\n end", "def status\n ::HubEdos::Common::Reference::Descriptor.new(@data['status']) if @data['status']\n end", "def status_message; end", "def getStatus\n @status\n end", "def custom_status\n {}\n end", "def status\n @status\n end", "def status\n @status\n end", "def update_status\n do_load_resource\n do_authorize_instance\n\n update_status_user_check\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status_description\n self.status::DESCRIPTION\n end", "def action_for_status status\n load_cloudflare_cookbook_gems\n ip = new_resource.ip\n\n if trust_cache? && status_from_cache(ip) == status\n Chef::Log.info \"[CF] Cache says that #{ip} is already in status #{status}, nothing to do\"\n else\n # we need to make the actual call to the API\n new_resource.set_status status\n Chef::Log.info \"[CF] #{ip}'s threat control was succesfully set to #{status}\"\n\n # no harm in caching even if the cache isn't used\n set_cache ip, status\n\n # as noted in the README, we can't know whether the status\n # really was updated with Cloudflare, so...\n new_resource.updated_by_last_action true\n end\nend", "def resource_type\n\t\t\t\t\t\traise \"Not implemented.\"\n\t\t\t\t\tend", "def status_code; end", "def retrieve\n @resource.stat\n super\n end", "def status\n\t\treturn @status\n\tend", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def status\n raise NotImplementedError\n end", "def transform_status(status); end", "def status\n Status.find(self.status_id).name\n end", "def recalculate_report_status\n self.status = 'pending' if resource_statuses.any? {|rs| rs.status == 'pending' } &&\n resource_statuses.none? {|rs| rs.status == 'failed'}\n self.status = 'failed' if self.logs.any? {|l| l.level == 'err' }\n end", "def status\n unless source.nil? or source.empty?\n refresh_status\n else\n self.description = \"Status is currently unavailable\"\n end\n self.description.first\n end", "def status_created(resource)\n respond_to do |format|\n format.json { render json: resource.to_json, status: :created, location: full_url_helper(resource), content_type: 'application/fhir+json' }\n format.fhir_json { render json: resource.to_json, status: :ok, location: full_url_helper(resource), content_type: 'application/fhir+json' }\n end\n end", "def status\n super || StatusType.active\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n original.status || nil\n end", "def status\n original.status || nil\n end", "def status\n @object.status\n end", "def status_name\n STATUS[self.status_id][0]\n end", "def map_status\n end", "def status=(status); end", "def state\n case pipeline.status\n when 'scheduled', 'created', 'pending', 'preparing', 'waiting_for_resource' then 'pending'\n when 'running' then 'in_progress'\n when 'success' then 'successful'\n when 'failed' then 'failed'\n when 'canceled', 'skipped' then 'cancelled'\n else\n 'unknown'\n end\n end", "def getStatus\n @@statuses[@status]\n end", "def is_resource\n return self.resource_type == Resource::RESOURCE;\n end", "def status\n @__status\n end", "def status\n request :get, \"_status\"\n end", "def resource_name\n @resource_name\n end", "def friendly_status\n\n case self.status\n when \"no response\"\n \"You have not responded\"\n when \"reserve\"\n \"Reserved\"\n when \"decline\"\n \"Declined\"\n else\n \"Unknown\"\n end\n\n end", "def check_status\n return if @stash_identifier.nil? || @resource.nil?\n state = @resource.current_resource_state.try(:resource_state)\n return if state == 'in_progress'\n return_error(messages: 'Your dataset cannot be updated now', status: 403) { yield } if state != 'submitted'\n duplicate_resource # because we're starting a new version\n end", "def handle\n self.status\n end", "def status\n value_for('status')\n end" ]
[ "0.7921771", "0.78456193", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68382055", "0.68320155", "0.68117785", "0.6688334", "0.66043454", "0.6593708", "0.6593708", "0.6593708", "0.6593708", "0.6590753", "0.6560165", "0.65539443", "0.6546033", "0.6503163", "0.65003425", "0.64805776", "0.64805776", "0.64805776", "0.6463702", "0.6436103", "0.64179957", "0.64179957", "0.6390861", "0.6368773", "0.6365426", "0.6321467", "0.63043743", "0.629121", "0.6286431", "0.6286431", "0.62746406", "0.6269041", "0.6269041", "0.6240947", "0.6231625", "0.62218475", "0.62204254", "0.6216044", "0.6211643", "0.62109673", "0.62109673", "0.62109673", "0.62109673", "0.61944485", "0.61905974", "0.61877614", "0.618524", "0.6153153", "0.6140696", "0.6137695", "0.6133304", "0.6120875", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6120484", "0.6114939", "0.6114939", "0.6110258", "0.61093855", "0.61069036", "0.60999703", "0.60861605", "0.6082473", "0.60747397", "0.6072175", "0.60605717", "0.60507226", "0.6045894", "0.6028263", "0.60145795", "0.6009748" ]
0.0
-1
tries to get logs from current or previous pod depending on if it restarted TODO: move into resource_status.rb
def logs(container, end_time) fetch_logs(container, end_time, previous: !!restart_details) rescue *SamsonKubernetes.connection_errors # not found or pod is initializing begin fetch_logs(container, end_time, previous: !restart_details) rescue *SamsonKubernetes.connection_errors nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_logs(container, end_time, previous:)\n name = @pod.dig_fetch(:metadata, :name)\n namespace = @pod.dig_fetch(:metadata, :namespace)\n\n if previous\n SamsonKubernetes.retry_on_connection_errors do\n tries = 3\n tries.times do |i|\n logs = @client.get_pod_log(name, namespace, container: container, previous: true)\n\n # sometimes the previous containers logs are not yet available, so we have to wait a bit\n return logs if i + 1 == tries || !logs.start_with?(\"Unable to retrieve container logs\")\n Rails.logger.error(\"Unable to find logs, retrying\")\n sleep 1\n end\n end\n else\n wait = end_time - Time.now\n if wait < 2 # timeout almost over or over, so just fetch logs\n SamsonKubernetes.retry_on_connection_errors do\n @client.get_pod_log(name, namespace, container: container)\n end\n else\n # still waiting, stream logs\n result = +\"\"\n begin\n timeout_logs(wait) do\n SamsonKubernetes.retry_on_connection_errors do\n @client.watch_pod_log(name, namespace, container: container).each do |log|\n result << log << \"\\n\"\n end\n end\n end\n rescue Timeout::Error\n result << \"... log streaming timeout\"\n end\n result\n end\n end\n end", "def running_logs()\n if @container.nil?\n 'not yet'\n else\n wait_for_start_up\n @container.logs_container\n end\n end", "def get_pods_and_start_watcher\n options = {\n resource_version: '0' # Fetch from API server cache instead of etcd quorum read\n }\n if ENV['K8S_NODE_NAME']\n options[:field_selector] = 'spec.nodeName=' + ENV['K8S_NODE_NAME']\n end\n if @last_seen_resource_version\n options[:resource_version] = @last_seen_resource_version\n else\n pods = @client.get_pods(options)\n pods[:items].each do |pod|\n cache_key = pod[:metadata][:uid]\n @cache[cache_key] = parse_pod_metadata(pod)\n @stats.bump(:pod_cache_host_updates)\n end\n\n # continue watching from most recent resourceVersion\n options[:resource_version] = pods[:metadata][:resourceVersion]\n end\n\n watcher = @client.watch_pods(options)\n reset_pod_watch_retry_stats\n watcher\n end", "def read_logs\n @@logs\n end", "def process_pod_watcher_notices(watcher)\n watcher.each do |notice|\n # store version we processed to not reprocess it ... do not unset when there is no version in response\n version = ( # TODO: replace with &.dig once we are on ruby 2.5+\n notice[:object] && notice[:object][:metadata] && notice[:object][:metadata][:resourceVersion]\n )\n @last_seen_resource_version = version if version\n\n case notice[:type]\n when 'MODIFIED'\n reset_pod_watch_retry_stats\n cache_key = notice.dig(:object, :metadata, :uid)\n cached = @cache[cache_key]\n if cached\n @cache[cache_key] = parse_pod_metadata(notice[:object])\n @stats.bump(:pod_cache_watch_updates)\n elsif ENV['K8S_NODE_NAME'] == notice[:object][:spec][:nodeName]\n @cache[cache_key] = parse_pod_metadata(notice[:object])\n @stats.bump(:pod_cache_host_updates)\n else\n @stats.bump(:pod_cache_watch_misses)\n end\n when 'DELETED'\n reset_pod_watch_retry_stats\n # ignore and let age out for cases where pods\n # deleted but still processing logs\n @stats.bump(:pod_cache_watch_delete_ignored)\n when 'ERROR'\n if notice[:object] && notice[:object][:code] == 410\n @last_seen_resource_version = nil # requested resourceVersion was too old, need to reset\n @stats.bump(:pod_watch_gone_notices)\n raise GoneError\n else\n @stats.bump(:pod_watch_error_type_notices)\n message = notice[:object][:message] if notice[:object] && notice[:object][:message]\n raise \"Error while watching pods: #{message}\"\n end\n else\n reset_pod_watch_retry_stats\n # Don't pay attention to creations, since the created pod may not\n # end up on this node.\n @stats.bump(:pod_cache_watch_ignored)\n end\n end\n end", "def test_k8s_pod_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_CUSTOM\n },\n {\n config: EMPTY_K8S_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_pod_log_entry(log_entry(0)),\n expected_params: K8S_POD_PARAMS_FROM_LOCAL\n }\n ].each do |test_params|\n new_stub_context do\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs(test_params[:setup_k8s_stub])\n setup_logging_stubs do\n d = create_driver(test_params[:config])\n d.emit(test_params[:log_entry])\n d.run\n end\n verify_log_entries(1, test_params[:expected_params],\n 'jsonPayload') do |entry|\n fields = entry['jsonPayload']\n assert_equal 2, fields.size, entry\n assert_equal 'test log entry 0', fields['log'], entry\n assert_equal K8S_STREAM, fields['stream'], entry\n end\n end\n end\n end", "def logs tail=nil\n f = tail ? '-f ' : ''\n\n if tail\n @prompter.print 'Fetching logs...'\n @prompter.print 'Use Ctrl-C to stop'\n end\n\n @cli.system_call \"kubectl logs #{f}#{self.name} --namespace=#{self.namespace} -c=#{self.app}\"\n end", "def print_pod_logs(pod)\n @output.puts \"LOGS:\"\n\n containers = (pod.containers + pod.init_containers).map { |c| c.fetch(:name) }\n containers.each do |container|\n @output.puts \"Container #{container}\" if containers.size > 1\n\n # Display the first and last n_lines of the log\n max = 50\n lines = (pod.logs(container) || \"No logs found\").split(\"\\n\")\n lines = lines.first(max / 2) + ['...'] + lines.last(max / 2) if lines.size > max\n lines.each { |line| @output.puts \" #{line}\" }\n end\n end", "def get_system_log\n if platform?('windows')\n Chef::Log.info \"#{Dir.glob(\"C:/ProgramData/RightScale/log/rs-instance*.log\")}\"\n return Dir.glob(\"C:/ProgramData/RightScale/log/rs-instance*.log\").max_by { |f| File.mtime(f)}\n\n# return Dir.glob(\"C:/ProgramData/RightScale/log/rs-instance*.log\")[0]\n else \n File.exists?(\"/var/log/syslog\") ? \"/var/log/syslog\" : \"/var/log/messages\" \n end\n end", "def reset_pod_watch_retry_stats\n Thread.current[:pod_watch_retry_count] = 0\n Thread.current[:pod_watch_retry_backoff_interval] = @watch_retry_interval\n end", "def partial_status\n get_context!\n if @backend_job\n index = params[:log_end].to_i\n @logs = @backend_job.logger.segment(index, 100)\n else\n if @backend.nil? && @frontend_job\n @logs = @frontend_job.logger.segment(index, 100)\n end\n end\n end", "def reopen_logs; end", "def print_logs(status, end_time)\n @output.puts \"\\n#{resource_identifier(status)} logs:\"\n\n containers_names = status.pod.container_names\n containers_names.each do |container_name|\n @output.puts \"Container #{container_name}\" if containers_names.size > 1\n\n # Display the first and last n_lines of the log\n max = Integer(ENV['KUBERNETES_LOG_LINES'] || '50')\n lines = (status.pod.logs(container_name, end_time) || \"No logs found\").split(\"\\n\")\n lines = lines.first(max / 2) + ['...'] + lines.last(max / 2) if lines.size > max\n lines.each { |line| @output.puts \" #{line}\" }\n end\n end", "def restart_kubelet\n cmd = ['systemctl', 'restart', 'kubelet.service']\n stdout, stderr, status = Open3.capture3(*cmd)\n raise Puppet::Error, _(\"stderr: '%{stderr}'\" % { stderr: stderr }) if status != 0\n { status: stdout.strip }\nend", "def log_rotation_checks\n detect_os\n \n # this works for php\n app_servers.each do |server|\n force_log_rotation(server)\n log_check(server, \"/mnt/log/#{server.apache_str}/access.log.1\")\n end\n end", "def pods\n retry_on_error backoff: KUBELET_ERROR_BACKOFF_SECONDS do\n throttle per_second: KUBELET_MAX_REQUESTS_PER_SECOND, throttled: [] do\n JSON.parse(http_get('https://localhost:10250/pods')).fetch(\"items\")\n end\n end\n rescue StandardError\n []\n end", "def logs(app_name)\n deprecate # 07/31/2012\n get(\"/apps/#{app_name}/logs\").to_s\n end", "def update_logger_config(service_setup_data)\n driver = VaultDriver.from_secrets_file service_setup_data[:environment]\n service_name = service_setup_data['deployment']['service_name']\n logger = Syslogger.new(driver)\n if logger.check_record_exists(self)\n puts 'record already exists'\n return\n end\n result, error = logger.add_record_to_rsyslog(self)\n if result\n puts 'syslog updated!'\n else\n puts \"error #{error}\" unless error.nil?\n puts 'not updated'\n end\n end", "def log_contents\n if API_KEYS[\"logentries\"]\n account_key = API_KEYS[\"logentries\"][Rails.env][\"account_key\"]\n log_set = API_KEYS[\"logentries\"][Rails.env][\"log_set\"]\n log_name = \"nsc\"\n url = \"https://pull.logentries.com/#{account_key}/hosts/#{log_set}/#{log_name}/?filter=#{log_prefix}\"\n Rails.logger.debug { \"Fetching log from #{url}\" }\n open(url).read\n else\n File.read(log_path)\n end\n end", "def logs(app_name)\n\t\tget(\"/apps/#{app_name}/logs\")\n\tend", "def logs_for(application)\n logs_at_url(get(\"/apps/#{application}/logs?logplex=true\", 2))\n end", "def related_logs(title, pre=false)\n\n logs = begin\n if pre\n with_cache('log-pre-file-list') {\n log_list(LOG_PRE_META[:path], LOG_PRE_META[:regex], pre)\n }\n else\n with_cache('log-file-list') {\n log_list(LOG_META[:path], LOG_META[:regex])\n }\n end\n end\n\n related_files = []\n curr_file = logs.select{|l| l[:name] == title}.first\n logs.delete(curr_file)\n top_logs = logs.select{|l| l[:date] > curr_file[:date]}.reverse\n\n if curr_file\n top_logs.each do |l|\n related_files << l if related_files.count < 3 && title != l[:name]\n end\n else\n related_files = logs.take(3)\n end\n\n if related_files.count < 3\n related_files.concat(logs.take(3 - related_files.count)).uniq!\n end\n\n related_files.sort{|a,b| b[:date] <=> a[:date]}\n end", "def test_k8s_container_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_FROM_FALLBACK\n },\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_FROM_FALLBACK\n },\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_FROM_LOCAL\n },\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_CUSTOM\n },\n {\n config: EMPTY_K8S_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_container_log_entry(log_entry(0)),\n expected_params: K8S_CONTAINER_PARAMS_FROM_LOCAL\n }\n ].each do |test_params|\n new_stub_context do\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs(test_params[:setup_k8s_stub])\n setup_logging_stubs do\n d = create_driver(test_params[:config], CONTAINER_TAG)\n d.emit(test_params[:log_entry])\n d.run\n end\n verify_log_entries(1, test_params[:expected_params],\n 'jsonPayload') do |entry|\n fields = entry['jsonPayload']\n assert_equal 2, fields.size, entry\n assert_equal 'test log entry 0', fields['log'], entry\n assert_equal K8S_STREAM, fields['stream'], entry\n end\n end\n end\n end", "def logCheckUsable(logfileTail)\n\n lastFrame = -1\n currentFrame = -1\n fileStatus = Hash[\"finishedRestartVel\" => false,\n \"wroteRestartVel\" => false,\n \"wroteRestartXsc\" => false,\n \"finishedRestartCoor\" => false,\n \"wroteRestartCoor\" => false,\n \"wroteDcd\" => false]\n \n # Use tail to get last lines of logfile \n #print \"logfileTail: #{logfileTail}\\n\"\n tailList = logfileTail.split(\"\\n\").reverse\n\n # Grab the last set of written restart files\n tailList.each do |i|\n if i =~ /FINISHED WRITING RESTART VELOCITIES/ then\n #print \" finishedRestartVel\\n\"\n fileStatus[\"finishedRestartVel\"] = true\n elsif i =~ /WRITING VELOCITIES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartVel\\n\"\n fileStatus[\"wroteRestartVel\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING EXTENDED SYSTEM TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartXsc\\n\"\n fileStatus[\"wroteRestartXsc\"] = true\n currentFrame = $1.to_i\n elsif i =~ /FINISHED WRITING RESTART COORDINATES/ then\n #print \" finishedRestartCoor\\n\"\n fileStatus[\"finishedRestartCoor\"] = true\n elsif i =~ /WRITING COORDINATES TO RESTART FILE AT STEP (\\d+)/ then\n #print \" wroteRestartCoor\\n\"\n fileStatus[\"wroteRestartCoor\"] = true\n currentFrame = $1.to_i\n elsif i =~ /WRITING COORDINATES TO DCD FILE AT STEP (\\d+)/ then\n #print \" wroteDcd\\n\"\n fileStatus[\"wroteDcd\"] = true\n currentFrame = $1.to_i\n end\n \n if (lastFrame < 0) & (currentFrame > 0) then\n lastFrame = currentFrame\n elsif lastFrame != currentFrame then\n print \" missing\\n\"\n fileStatus.each_pair do |key,val|\n if !val then\n print \" #{key}\\n\"\n end\n end\n print \" currentFrame: #{currentFrame}\\n\"\n print \" lastFrame: #{lastFrame}\\n\"\n return \"broken\"\n end\n\n fileStatusCount = 0\n fileStatus.each_value do |i|\n if i then\n fileStatusCount += 1\n end\n end\n\n if fileStatusCount == 6 then\n print \" last frame: #{lastFrame}\\n\"\n return \"usable\"\n end\n end\n \n return \"unknown\"\nend", "def check_log_messages(service, ttl)\n log_data = nil\n\n # Get service's logs string by string\n begin\n logs = get_elk_data(build_logs_query(service, @known_errors, ttl))\n\n if logs.nil?\n log_data = [UNKNOWN, \"Monitoring error\", nil]\n\n elsif logs['total'] > 0\n\n log_entry = logs['hits'][0]\n log_entry['logger_name'] = log_entry['_source']['logger_name'].split(\".\").last\n log_entry['message'] = log_entry['_source']['message'][0, 256].gsub(/\\s+/, ' ')\n\n if log_entry['_source']['level'] == 'WARN'\n log_data = [WARN, log_entry['logger_name'], log_entry['message']]\n\n else\n log_data = [ERROR, log_entry['logger_name'], log_entry['message']]\n end\n\n else\n logs = get_elk_data(build_alive_query(service, ttl))\n\n if logs['total'] > 0\n log_data = [OK, \"OK\", nil]\n else\n log_data = [UNKNOWN, \"No logs from App\", nil]\n end\n end\n\n # Handle errors\n rescue Exception => e\n log_data = [UNKNOWN, \"ES unavailable :(\", e.message]\n\n puts e.message\n puts e.backtrace.inspect\n end\n\n return log_data[0], log_data[1], log_data[2]\n end", "def logCheck(logfile)\n\n numLines = 20\n maxNumLines = 1280\n \n # Use tail to get last lines of logfile\n logfileTail = `tail -n #{numLines} #{logfile}`\n \n #print \"logfileTail: #{logfileTail}\\n\"\n\n print \" logfile: #{logfile}\\n\"\n\n logStatus = logCheckPerfect(logfileTail)\n if logStatus == \"perfect\" then\n print \"PERFECT\\n\"\n return logStatus\n end\n\n while numLines <= maxNumLines do\n\n print \" numLines: #{numLines}\\n\"\n logStatus = logCheckUsable(logfileTail)\n if logStatus == \"usable\" then\n print \"USABLE\\n\"\n return logStatus\n elsif logStatus == \"broken\" then\n print \"BROKEN\\n\"\n return logStatus\n end\n\n # Exponentially increase the tail segment until all restart files are found\n numLines *= 2\n logfileTail = `tail -n #{numLines} #{logfile}`\n end\n \n print \"UNKNOWN\\n\"\n return \"unknown\"\n \nend", "def logs_for(name = nil, options = {})\n if name.is_a?(Hash)\n options = name\n name = nil\n end\n \n name = bucket_name(name)\n logging_status = logging_status_for(name)\n return [] unless logging_status.logging_enabled?\n objects(logging_status.target_bucket, options.merge(:prefix => logging_status.target_prefix)).map do |log_object|\n Log.new(log_object)\n end\n end", "def recalculate_report_status\n self.status = 'pending' if resource_statuses.any? {|rs| rs.status == 'pending' } &&\n resource_statuses.none? {|rs| rs.status == 'failed'}\n self.status = 'failed' if self.logs.any? {|l| l.level == 'err' }\n end", "def check_log_messages(container, actual_time)\n\n last_warn = nil\n last_error = nil\n msg_pattern = /^[^\\]]*\\]\\s/ # everything from the beginning till the first ]\n\n # Get container's logs string by string\n currL = nil\n begin\n container.logs(stdout: true, stderr: true, timestamps: true, tail: 10000).each_line do |l|\n currL = l\n\n # Filter out the known errors\n next if (@known_errors.any? { |error| l.include? (error) })\n\n # A tricky way to avoid invalid symbols from Docker\n next if l.size < 30\n\n # Retrieve date (docker returns logs with a garbage before dates, so we have to workaround that - to be fixed)\n #log_time = DateTime.parse(l.gsub(/^.*(?=(20\\d{2}-))/, \"\").split(/\\s/)[0])\n log_time = DateTime.parse(l.gsub(/^[^2]*/, \"\").to_s[0, 19])\n seconds = ((DateTime.now.new_offset(0) - log_time.new_offset(0)) * 24 * 60 * 60).to_i\n\n # Check if the message is not too old\n if seconds < actual_time\n\n # Check message's loggin level\n if l.include? \" WARN \"\n last_warn = l.gsub(msg_pattern, \"\")\n elsif l.include? \" ERROR \"\n last_error = l.gsub(msg_pattern, \"\")\n end\n end\n\n end\n\n # Handle errors\n rescue Exception => e\n last_warn = \"Unparsable logs\"\n\n puts e.message\n puts currL\n puts e.backtrace.inspect\n end\n\n # Gather the results\n log_data = nil\n if !last_warn.nil? || !last_error.nil?\n log_data = Hash.new\n log_data[\"warn\"] = last_warn\n log_data[\"error\"] = last_error\n end\n\n return log_data\n end", "def logs_for_download\n retrieve_logs_for_download\n end", "def status(repo = nil, verify = nil)\n old_status = self.persisted_status\n new_status = get_status(true)\n @message = '' unless @message\n max_dead_seconds = 10\n if %w(dead starting).include?(new_status) and old_status == new_status # Restart only if you see dead status twice\n delta = Time.new - updated_at\n @message << \"Machine [#{self.nickname}] has been dead for [#{delta.to_i}] seconds. \"\n if delta > max_dead_seconds\n agent_log = get_agent_log\n if agent_log\n lines = agent_log.split \"\\r\"+$/\n if lines.last == @agent_log_last_lines\n @message << \" Will not restart the agent since last line of log did not change after previous restart:\\n #{lines.last}.\"\n else\n if RUBY_PLATFORM =~ /(mswin|mingw)/ and lines.last !~ / \\d\\d:\\d\\d:\\d\\d \\[RS/\n # long running low level Ruby ops blocks eventmachine on Windows\n @message << \" Will not restart the agent on Windows since since last line of log is:\\n #{lines.last}\"\n else\n @message << \"Restarted agent on agent #{self.nickname} \"\n @agent_log_last_lines = lines.last\n start(repo, verify)\n end\n end\n else\n @message << \" Will not restart the agent since the agent log is not accessible. \"\n end\n else\n @message << \" Will not restart the agent since it has not been #{max_dead_seconds} seconds yet. \"\n end\n Rails.logger.info @message unless @message == ''\n end\n @message = nil if @message == ''\n return new_status\n end", "def webhook_logs\r\n WebhookLogsController.instance\r\n end", "def exit_status\n status = 0\n if @metrics[\"changes\"] && @metrics[\"changes\"][TOTAL] &&\n @metrics[\"resources\"] && @metrics[\"resources\"][\"failed\"] &&\n @metrics[\"resources\"][\"failed_to_restart\"]\n status |= 2 if @metrics[\"changes\"][TOTAL] > 0\n status |= 4 if @metrics[\"resources\"][\"failed\"] > 0\n status |= 4 if @metrics[\"resources\"][\"failed_to_restart\"] > 0\n else\n status = -1\n end\n status\n end", "def index\n if get_status\n dependencies = @current_status\n\n puts \"\\nRanger Status\"\n puts \"------------------------------------------\"\n\n dependencies.each do |record|\n url = record[\"dependency\"][\"url\"]\n code = record[\"dependency\"][\"latest_response_code\"]\n puts \"#{url} #{up_or_down(code)}\"\n end\n\n watchers_list\n else\n no_domains_monitored\n end\n end", "def state_on_restart current_state\n self.statemap['on_restart'][current_state]\n end", "def status\n check_exists\n SideJob.redis.get \"#{redis_key}:status\"\n end", "def log\n Chef::Log\n end", "def get_log\n SimpleWorker.service.log(task_id)\n end", "def on_restart(&block); end", "def logs\n end", "def logs\n\n end", "def wait_for_namespace(namespace, sleep_duration=10)\n puts \"#{c_blue}# Waiting for: #{namespace}, every #{sleep_duration}s#{c_reset}\"\n loop do\n output, status = capture_with_status(\"kubectl get pods --namespace #{namespace} --no-headers\")\n ready = status.success? && !output.empty?\n if ready\n output.each_line do |line|\n name, readiness, state, restarts, age = line.split\n next if state == 'Completed'\n next if state == 'Running' && /^(\\d+)\\/\\1$/ =~ readiness\n puts \"# Waiting for: #{line}\"\n ready = false\n end\n end\n break if ready\n sleep sleep_duration\n end\nend", "def logs\n @logs.dup\n end", "def reopen_logs\n Resqued::Logging.close_log # it gets opened the next time it's needed.\n end", "def make_sessions_logs\n sessions_uuids = []\n sessions_info = []\n info = ''\n hist_file = ''\n hist_file_name = ''\n log_list = []\n\n # Create list of sessions with base info\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info[:session_type] =~ /shell/ or e.info[:session_type] =~ /meter/\n if e.info[:command] != 'load stdapi'\n if not sessions_uuids.include?(e.info[:session_uuid])\n sessions_uuids << e.info[:session_uuid]\n sessions_info << {:uuid => e.info[:session_uuid],\n :type => e.info[:session_type],\n :id => e.info[:session_id],\n :info => e.info[:session_info]}\n end\n end\n end\n end\n\n sessions_uuids.each do |su|\n sessions_info.each do |i|\n if su == i[:uuid]\n print_line(\"Exporting Session #{i[:id]} history\")\n hist_file_name = \"#{framework.db.workspace.name}_session_#{i[:id]}_#{::Time.now.strftime('%Y%m%d.%H%M%S')}.log\"\n i.each do |k, v|\n info << \"#{k.to_s}: #{v.to_s} \"\n end\n break\n end\n end\n hist_file << \"# Info: #{info}\\n\"\n info = ''\n framework.db.workspace.events.each do |e|\n if not e.info.nil? and e.info.has_key?(:command) or e.info.has_key?(:output)\n if e.info[:session_uuid] == su\n if e.info.has_key?(:command)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:command]}\\n\"\n elsif e.info.has_key?(:output)\n hist_file << \"#{e.updated_at}\\n\"\n hist_file << \"#{e.info[:output]}\\n\"\n end\n end\n end\n end\n\n # Set RC file path and file name\n session_hist_path = ::File.join(Msf::Config.log_directory, 'projects', framework.db.workspace.name)\n session_hist_fullpath = ::File.join(session_hist_path, hist_file_name)\n\n # Create folder\n ::FileUtils.mkdir_p(session_hist_path)\n\n print_line(\"Saving log file to #{session_hist_fullpath}\")\n file_write(session_hist_fullpath, hist_file)\n hist_file = ''\n print_line('Log file written')\n log_list << session_hist_fullpath\n end\n\n return log_list\n end", "def process_log\n @service.respond_to?(:process_log) ? @service.process_log : \"\"\n end", "def pods\n\nend", "def logs\n @logs ||= Logs.new(@bridge)\n end", "def logs\n @logs ||= Logs.new(@bridge)\n end", "def logs\n @logs ||= Logs.new(@bridge)\n end", "def get(cmp)\n case cmp\n when \"events\"\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME LAST&nbsp;SEEN FIRST&nbsp;SEEN COUNT KIND \"+\n \"SUBOBJECT TYPE REASON SOURCE MESSAGE\"\n\n [header] +\n (hsh[\"items\"].map do |item|\n obj = item[\"involvedObject\"]\n src = item[\"source\"]\n [ obj[\"namespace\"],\n obj[\"name\"],\n _unitsago(item[\"lastTimestamp\"]),\n _unitsago(item[\"firstTimestamp\"]),\n item[\"count\"],\n obj[\"kind\"],\n obj[\"fieldPath\"],\n item[\"type\"],\n item[\"reason\"],\n \"%s, %s\" % [src[\"component\"], src[\"host\"]],\n item[\"message\"]\n ].map{ |v| (v || \"&nbsp;\").to_s.gsub(/[[:space:]+]/, \"&nbsp;\") }.\n join(\" \")\n end)\n\n when 'nodes'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAME STATUS CPU MEMORY KUBELET&nbsp;VERSION \" +\n \"KERNEL&nbsp;VERSION CONTAINER&nbsp;VERSION ADDRESS AGE\"\n [header] +\n (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n status = st[\"conditions\"].select { |a| a[\"status\"] == \"True\" }.\n map { |a| a[\"type\"] }.join(\",\")\n ni = st[\"nodeInfo\"]\n\n [md[\"name\"],\n status,\n st[\"capacity\"][\"cpu\"],\n st[\"capacity\"][\"memory\"],\n ni[\"kubeletVersion\"],\n ni[\"kernelVersion\"],\n ni[\"containerRuntimeVersion\"],\n st[\"addresses\"].map { |a| a[\"address\"] }.join(\",\"),\n age,\n ].map{ |v| v || \"&nbsp;\" }.join(\" \")\n end)\n\n when 'ingress'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME HOSTS AGE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n [md[\"namespace\"], md[\"name\"],\n sp[\"rules\"].map{|a|a[\"host\"]}.join(\",<br>\"),\n age\n ].map{ |v| v || \"&nbsp;\" }.join(\" \")\n end)\n\n when 'pvc'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS&nbsp;MODES \"+\n \"STORAGECLASS AGE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n [md[\"namespace\"], md[\"name\"],\n st[\"phase\"],\n sp[\"volumeName\"],\n st[\"capacity\"][\"storage\"],\n st[\"accessModes\"].join(\",\"),\n sp[\"storageClassName\"],\n age\n ].map{ |v| v || \"&nbsp;\" }.join(\" \")\n end)\n\n when 'pods'\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n\n ready,not_ready =\n begin\n st[\"containerStatuses\"].partition do |cs|\n cs[\"ready\"]\n end\n rescue NoMethodError\n [[],[]]\n end\n rsc =\n begin\n st[\"containerStatuses\"].map do |cs|\n cs[\"restartCount\"]\n end.sum\n rescue NoMethodError\n 0\n end\n\n [md[\"namespace\"], md[\"name\"],\n \"#{ready.size}/#{ready.size + not_ready.size}\",\n st[\"phase\"],\n rsc,\n age,\n st[\"podIP\"],\n sp[\"nodeName\"],\n ].map{ |v| v || \"&nbsp;\" }.join(\" \")\n end)\n\n when \"daemonsets\"\n hsh = JSON(kctl(\"get #{cmp.to_s} --all-namespaces --output=json\").join)\n header = \"NAMESPACE NAME DESIRED CURRENT READY UP-TO-DATE \"+\n \"AVAILABLE NODE&nbsp;SELECTOR AGE CONTAINERS IMAGES\"\n [header] + (hsh[\"items\"].map do |item|\n md,sp,st,age = _splat(item)\n\n ndselector =\n (sp[\"template\"][\"spec\"][\"nodeSelector\"]||{}).\n map do |k,v|\n \"#{k}=#{v}\"\n end.join\n tmp = sp[\"template\"][\"spec\"][\"containers\"].map do |c|\n [c[\"name\"], c[\"image\"]]\n end\n images = tmp.map(&:last).join(\",\")\n containers = tmp.map(&:first).join(\",\")\n\n [md[\"namespace\"], md[\"name\"],\n st[\"desiredNumberScheduled\"],\n st[\"currentNumberScheduled\"],\n st[\"numberReady\"],\n st[\"updatedNumberScheduled\"] || \"0\",\n st[\"numberAvailable\"] || \"0\",\n ndselector.empty? ? nil : ndselector,\n age,\n containers,\n images,\n ].map{ |v| v || \"&nbsp;\" }.join(\" \")\n end)\n\n else\n kctl(\"get #{cmp.to_s} --all-namespaces --output=wide\")\n end\n end", "def execute\n LOGGERS.map do |logger|\n { file_name: logger.file_name, logs: logger.read_latest }\n end\n end", "def status\n service.get(\"\")\n end", "def get_logs(job_id:)\n logs = []\n xml_data = get_log_xml(job_id: job_id)\n response_code = get_log_xml_response_code(xml_data: xml_data)\n\n if response_code == \"success\"\n job_status = get_log_job_status(xml_data: xml_data)\n\n if job_status == \"FIN\"\n xml_data.xpath('//response/result/log/logs/*').each do |log_xml|\n logs << PaloAlto::Models::LogEntry.from_xml(xml_data: log_xml)\n end\n else\n raise \"Log job with ID '#{job_id}' is still in progress\"\n end\n else\n raise \"Error in response XML: #{data.inspect}\"\n end\n\n logs\n end", "def phaselog\n\tlogfile = ENV['puppet_logfile'] || '/var/log/syslog'\n\tcount,avg,day_count_unique,day_count = 0 ,0 ,0, 0\n\tt = Time.now\n\ttoday = t.strftime(\"^%b %e\")\n\thour = t.strftime(\"^%b %e %H:\")\n\tm = t.min.to_i\n\tlast5m = \"\"\n\t6.times do |i|\n\t\tlast5m += hour\n\t\tlast5m += \"0\" if (m-i) < 10\n\t\tlast5m += (m-i).to_s \n\t\tlast5m += \"|\" unless i==5\n\tend\n\thosts = Array.new\n\tregexp = \".* for (.*) in (.*) seconds\"\n\n\tFile.open(logfile).grep(/#{today}/).grep(/Compiled catalog/).each do |line|\n \t case line\n\t\t\twhen /#{last5m}/ then\n\t\t\t\tif line =~ /#{regexp}/\n\t\t\t\t\tavg += $2.to_f\n\t\t\t\t\tcount += 1\n\t\t\t\t\tunless hosts.include?($1)\n\t\t\t\t\t\thosts << $1\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\twhen /#{regexp}/ then\n\t\t\t\tday_count += 1\n\t\t\t\tunless hosts.include?($1)\n\t\t\t\t\thosts << $1 \n\t\t\t\t\tday_count_unique += 1\n\t\t\t\tend\n\t\tend\n\tend\n\tputs \"avg_compile.value #{(avg / count).to_s[0..3]}\" unless count == 0\n\tputs \"last5m_count.value #{count}\" \n\tputs \"last24h_unique_count.value #{day_count_unique}\" \nend", "def fetch_log\n raise NotImplementedError\n end", "def change_log\r\n ChangeLogController.instance\r\n end", "def syslog_servers\r\n SyslogServersController.instance\r\n end", "def _roda_before_05__common_logger\n @_request_timer = CommonLogger.start_timer\n end", "def cron_logs(app_name)\n\t\tget(\"/apps/#{app_name}/cron_logs\")\n\tend", "def list_uptime_check_configs project_id\n require \"google/cloud/monitoring\"\n\n client = Google::Cloud::Monitoring.uptime_check_service\n project_name = client.project_path project: project_id\n configs = client.list_uptime_check_configs parent: project_name\n\n configs.each { |config| puts config.name }\nend", "def restart\n if config.managed? && started?\n stop\n start\n end\n end", "def restart_category\n return @restart_category\n end", "def service_information\n path = \"#{api_root}/health/fast\"\n begin\n execute_http_request(:get, path)\n rescue RestClient::ExceptionWithResponse => e\n Rails.logger.error \"Azul service unavailable: #{e.message}\"\n ErrorTracker.report_exception(e, nil, { method: :get, url: path, code: e.http_code })\n JSON.parse(e.http_body) if e.http_body.present? # response body should have more information than error message\n end\n end", "def processing_undefined_task\n if @undefined_retries > 0\n @undefined_retries -= 1\n Astute.logger.debug \"Puppet on node has undefined status. \"\\\n \"#{@undefined_retries} retries remained. \"\\\n \"#{task_details_for_log}\"\n Astute.logger.info \"Retrying to check status for following \"\\\n \"nodes: #{@puppet_mclient.node_id}\"\n 'running'\n else\n Astute.logger.error \"Node has failed to get status. There is\"\\\n \" no more retries for status check. #{task_details_for_log}\"\n 'failed'\n end\n end", "def status\n begin\n output = adm \"-z\", @resource[:name], :list, \"-p\"\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def test_k8s_node_monitored_resource\n [\n {\n config: APPLICATION_DEFAULT_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_node_log_entry(log_entry(0)),\n expected_params: K8S_NODE_PARAMS_FROM_LOCAL\n },\n {\n config: CUSTOM_K8S_CONFIG,\n setup_k8s_stub: false,\n log_entry: k8s_node_log_entry(log_entry(0)),\n expected_params: K8S_NODE_PARAMS_CUSTOM\n },\n {\n config: EMPTY_K8S_CONFIG,\n setup_k8s_stub: true,\n log_entry: k8s_node_log_entry(log_entry(0)),\n expected_params: K8S_NODE_PARAMS_FROM_LOCAL\n }\n ].each do |test_params|\n new_stub_context do\n setup_gce_metadata_stubs\n setup_k8s_metadata_stubs(test_params[:setup_k8s_stub])\n setup_logging_stubs do\n d = create_driver(test_params[:config])\n d.emit(test_params[:log_entry])\n d.run\n end\n verify_log_entries(1, test_params[:expected_params],\n 'jsonPayload') do |entry|\n fields = entry['jsonPayload']\n assert_equal 2, fields.size, entry\n assert_equal 'test log entry 0', fields['log'], entry\n assert_equal K8S_STREAM, fields['stream'], entry\n end\n end\n end\n end", "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "def index\n if current_user.admin\n @logs = Log.all\n \n\telse\n\t@logs = Log.where(:reference_code => current_user.content_code)\n\t@clientlogs = Log.where(:client_code => current_user.client_code)\n\tend\n end", "def sparkResetLogging()\n #logNormal($sparkPrefix + \" sparkResetLogging removing all log targets\\n\");\n\n logServer = get($serverPath+'log')\n if (logServer != nil)\n logServer.removeAllStreams()\n end\nend", "def monitor\n log_opts = LogOpts.new.num(10000).tail\n log_opts = log_opts.ps(options[:ps]) if options[:ps]\n \n process_data = {}\n lines = 1\n \n heroku.read_logs(app, log_opts.to_opts) do |line|\n line.split(/\\n/).each do |real_line|\n merge_data_from_line(real_line, process_data)\n end\n metrics_table(process_data)\n end\n end", "def status\n begin\n output = adm '-z', @resource[:name], :list, '-p'\n rescue Puppet::ExecutionFailure\n return nil\n end\n\n main = self.class.line2hash(output.chomp)\n\n # Now add in the configuration information\n config_status.each do |name, value|\n main[name] = value\n end\n\n main\n end", "def logs\n @logs.count\n end", "def own_meta_log\n meta_logs.first\n end", "def logs\n help = [\n '',\n \"Use: #{me} logs\",\n '',\n \"Fetches and prints the logs of the web server (if running)\",\n ]\n if ['help','--help'].include? ARGV[1]\n show help\n exit failed\n end\n # TODO: check for unknown args\n if `docker ps --quiet --filter \"name=cdf-web\"` == ''\n puts \"FAILED: Cannot show logs - the web server is not running\"\n exit failed\n else\n puts `docker logs cdf-web`\n end\nend", "def log_startup\n log_environment\n log_dispatcher\n log_app_name\n end", "def restart(services)\n generate_config if stale_config\n update_platform_env\n services.each do |service|\n kubectl(\"rollout restart deploy #{clean_kubernetes_name(service)}\")\n end\n # down(services)\n # up(services)\n # status\n end", "def log\n @client.get(\"#{path}/log\")\n end", "def logs\n system \"tail -f ~/Library/Logs/Pow/access.log\"\n end", "def get_log!(which)\n log = _get_log(which)\n log.nil? ? [] : log.drain\n end", "def skip_logs?\n self.labels['io.kontena.container.skip_logs'] == '1'\n end", "def deploy_log\n if File.exists?(\"tmp/deploy-log.txt\")\n log = File.read(\"tmp/deploy-log.txt\")\n end\n end", "def partial_status\n get_context\n #authorize!(:read, @deployment)\n\n options = {:testament_id => @testament.id}\n @job = SimulateJob.first(options)\n if @job\n @last_log = params[:log].to_i\n @limit = (params[:limit] || 10000000).to_i # makes take(@limit) work if no limit.\n\n @logs = @job.processing_log.drop(@last_log).take(@limit)\n\n resp = { :logs => @logs, :last_log => @last_log }\n\n resp[:start] = true\n resp[:stop] = false\n\n if (@job.processing_status)\n resp[:status] = @job.processing_status\n if (@job.processing_status != \"Stopped\")\n resp[:start] = false\n resp[:stop] = true\n end\n if (@job.processing_status == \"StopRequested\")\n resp[:start] = false\n resp[:stop] = false\n end\n end\n\n if (@job.clock_mult)\n resp[:clock_mult] = @job.clock_mult\n end\n if (@job.sim_time)\n resp[:sim_time] = @job.sim_time.in_time_zone(@job.time_zone).strftime(\"%Y-%m-%d %H:%M:%S %Z\")\n end\n if (@job.processing_completed_at)\n resp[:completed_at] = @job.processing_completed_at.in_time_zone(@job.time_zone).strftime(\"%Y-%m-%d %H:%M:%S %Z\")\n end\n if (@job.processing_started_at)\n resp[:started_at] = @job.processing_started_at.in_time_zone(@job.time_zone).strftime(\"%Y-%m-%d %H:%M:%S %Z\")\n end\n else\n resp = {}\n resp[:start] = true\n resp[:stop] = false\n end\n\n respond_to do |format|\n format.json { render :json => resp.to_json }\n end\n end", "def custom_log_folders\n return @custom_log_folders\n end", "def track_status(jlh)\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n result = jle.job_result\n red = $application_properties['red']\n green = $application_properties['green']\n red_expression = Regexp.new(red,Regexp::MULTILINE)\n green_expression = Regexp.new(green,Regexp::MULTILINE)\n run_data_expression = Regexp.new($application_properties['run_data'],Regexp::MULTILINE)\n introscope_data_expression = Regexp.new($application_properties['introscope_data'],Regexp::MULTILINE)\n result_no_carriage = result.gsub(\"\\n\",'')\n result_no_carriage = result.gsub(\"\\r\\n\",'')\n match = green_expression.match(result)\n run_data_match = run_data_expression.match(result_no_carriage)\n if (run_data_match)\n state = run_data_match[1]\n jle.run_data = state\n $logger.debug(\"The current run of #{jmd.job_code} is storing the following run data state: #{state}\")\n end\n introscope_data_match = introscope_data_expression.match(result_no_carriage)\n if (introscope_data_match)\n state = introscope_data_match[1]\n jle.introscope_data = state\n $logger.debug(\"The current run of #{jmd.job_code} is storing the following introscope state: #{state}\")\n end\n\n if match\n cur_status = \"GREEN\"\n else\n match = red_expression.match(result)\n\n if match\n cur_status = \"RED\"\n else\n cur_status = \"UNKNOWN\"\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid status output!\")\n end\n end\n\n #look up the last successfully completed job log entry to see what the previous status was\n #last_log = JobLogEntry.job_log_by_jc_desc(jmd.job_code).finished(true).status_completed(true).limit(1)\n last_log = JobLogEntry.get_last_tracked_status(jmd.job_code,true)\n #if we have a last log entry to compare against then increment the status_cnt if it is the same\n #as the current run. Otherwise, the count will default to 1 as the status just changed\n #if we kill the job engine during a save or the job was never run assume green.\n last_status = last_log.nil? ? \"GREEN\" : last_log.status\n\n status_cnt = 1\n unless last_log.nil?\n if (cur_status.eql?(last_status))\n #if the last job was abandoned (reboot mongrel during execution) we might still have a null\n if (last_log.status_cnt.nil?)\n last_log.status_cnt = 0\n end\n status_cnt = last_log.status_cnt + 1\n end\n end\n #return the current status and the last log status\n {:current_status => cur_status, :last_status => last_status, :status_cnt => status_cnt}\n end", "def call_log\n @call_log ||= TermuxRubyApi::SubSystems::CallLog.new(self)\n end", "def index\n @work_logs = WorkLog.active\n end", "def list_alarms(cloudwatch_client)\n response = cloudwatch_client.describe_alarms\n if response.metric_alarms.count.positive?\n response.metric_alarms.each do |alarm|\n puts alarm.alarm_name\n end\n else\n puts \"No alarms found.\"\n end\nrescue StandardError => e\n puts \"Error getting information about alarms: #{e.message}\"\nend", "def do_ping\n\t\t\tstatus=`initctl status #{@job_name}`\n\t\t\tstatus.include?(\"running\") ? :up : :down\n\t end", "def last_syscheck_scan(agent_id)\n get \"/syscheck/#{agent_id}/last_scan\"\n end", "def call env\n began = Time.now\n s, h, b = @app.call env\n b = BodyProxy.new(b) { log(env, s, h, began, b) } if @options[:statuses].include? s.to_i\n [s, h, b]\n end", "def index\n status = get_health_status( )\n response = make_response( status )\n #render json: response, :status => response.is_healthy? ? 200 : 500\n render json: response, :status => 200 # dont want to continuously restart the container\n end", "def get_pod_name(namespace, index)\n `kubectl get pods -n #{namespace} | awk 'FNR == #{index + 1} {print $1}'`.chomp\nend", "def get_cart_status(gear, component)\n app = gear.application\n source_container = gear.get_proxy\n leave_stopped = false\n idle = false\n quota_blocks = nil\n quota_files = nil\n log_debug \"DEBUG: Getting existing app '#{app.name}' status before moving\"\n do_with_retry('status') do\n result = source_container.status(gear, component)\n result.properties[\"attributes\"][gear.uuid].each do |key, value|\n if key == 'status'\n case value\n when \"ALREADY_STOPPED\"\n leave_stopped = true\n when \"ALREADY_IDLED\"\n leave_stopped = true\n idle = true\n end\n elsif key == 'quota_blocks'\n quota_blocks = value\n elsif key == 'quota_files'\n quota_files = value\n end\n end\n end\n\n cart_name = component.cartridge_name\n if idle\n log_debug \"DEBUG: Gear component '#{cart_name}' was idle\"\n elsif leave_stopped\n log_debug \"DEBUG: Gear component '#{cart_name}' was stopped\"\n else\n log_debug \"DEBUG: Gear component '#{cart_name}' was running\"\n end\n\n return [idle, leave_stopped, quota_blocks, quota_files]\n end", "def logWatch(name, data={}, &blk); return MootLogs.logWatch(name, data, &blk); end", "def restart_fault_bucket\n return @restart_fault_bucket\n end", "def revents\n self[:revents]\n end", "def process_require_restart?(process_name, process_cmd, dep_process_cmds)\n #\n # Code to retrieve the start time of target process\n #\n target_process_pid = `pgrep -f #{process_cmd}`\n if target_process_pid != \"\"\n target_process_stime = `ps --no-header -o lstart #{target_process_pid}`\n else\n Chef::Log.info \"#{process_name} is not currently running which was the expected state\"\n return true\n end\n #\n # Code to compare the start times and return whether the target processes need to be restarted\n #\n ret = false\n restarted_processes = Array.new\n dep_process_cmds.each do |dep_process, dep_process_cmd|\n dep_process_pids = `pgrep -f #{dep_process_cmd}` \n if dep_process_pids != \"\"\n dep_process_pids_arr = dep_process_pids.split(\"\\n\")\n dep_process_pids_arr.each do |dep_process_pid| \n dep_process_stime = `ps --no-header -o lstart #{dep_process_pid}`\n if DateTime.parse(target_process_stime) < DateTime.parse(dep_process_stime)\n restarted_processes.push(dep_process)\n ret = true\n end\n end\n end\n end\n if ret\n Chef::Log.info \"#{process_name} service needs restart since #{restarted_processes.join(\",\")} process(s) got restarted\"\n end\n return ret\nend", "def log_messages\n\t\treturn Thread.current[ 'logger-output' ] ||= []\n\tend", "def load_status\n f_path = File.expand_path('daemon/status.json', project.path)\n return unless File.size? f_path\n say 'Loading previous status in daemon/status.json:'\n status = JSON.parse(File.read(f_path), symbolize_names: true)\n status.keys.each do |i|\n status[i].map! do |j|\n j.tap do |k|\n unless k[:ds].nil? or k[:ds_name] == 'miga-project'\n k[:ds] = project.dataset(k[:ds_name])\n end\n k[:job] = k[:job].to_sym unless k[:job].nil?\n end\n end\n end\n @jobs_running = status[:jobs_running]\n @jobs_to_run = status[:jobs_to_run]\n say \"- jobs left running: #{@jobs_running.size}\"\n purge!\n say \"- jobs running: #{@jobs_running.size}\"\n say \"- jobs to run: #{@jobs_to_run.size}\"\n end" ]
[ "0.6443494", "0.6362293", "0.5801088", "0.56677365", "0.5655261", "0.5635417", "0.5576907", "0.5562362", "0.54712373", "0.54684883", "0.54573697", "0.53721106", "0.5315064", "0.52745074", "0.5199533", "0.51567996", "0.512849", "0.51157093", "0.5072117", "0.5071511", "0.50423145", "0.50309944", "0.5030435", "0.50272524", "0.5026797", "0.49507976", "0.49142802", "0.49112746", "0.49106815", "0.48992607", "0.48963696", "0.48908627", "0.48867145", "0.48542702", "0.48431727", "0.48395392", "0.48329362", "0.48321545", "0.48269674", "0.48160106", "0.48075595", "0.48007753", "0.4800082", "0.47837922", "0.47807786", "0.4775859", "0.47723687", "0.47677967", "0.47677967", "0.47677967", "0.47323224", "0.4729543", "0.4720534", "0.47160766", "0.47136354", "0.471322", "0.47120118", "0.47063917", "0.47052062", "0.47001132", "0.46959624", "0.46956313", "0.46944988", "0.46897295", "0.4686479", "0.46853468", "0.46807277", "0.46804148", "0.46765766", "0.46717975", "0.46691892", "0.4667399", "0.4665569", "0.46655226", "0.4660041", "0.46405622", "0.46271616", "0.46246135", "0.46201295", "0.46155116", "0.45995453", "0.45985606", "0.4592876", "0.45885468", "0.4577328", "0.45749894", "0.4573355", "0.45719486", "0.45687658", "0.4566917", "0.4565033", "0.45582312", "0.45562512", "0.45542923", "0.4553124", "0.4549129", "0.4547066", "0.45451385", "0.45446676", "0.45424706" ]
0.7094788
0
if the pod is still running we stream the logs until it times out to get as much info as possible necessary since logs often hang for a while even if the pod is already done
def fetch_logs(container, end_time, previous:) name = @pod.dig_fetch(:metadata, :name) namespace = @pod.dig_fetch(:metadata, :namespace) if previous SamsonKubernetes.retry_on_connection_errors do tries = 3 tries.times do |i| logs = @client.get_pod_log(name, namespace, container: container, previous: true) # sometimes the previous containers logs are not yet available, so we have to wait a bit return logs if i + 1 == tries || !logs.start_with?("Unable to retrieve container logs") Rails.logger.error("Unable to find logs, retrying") sleep 1 end end else wait = end_time - Time.now if wait < 2 # timeout almost over or over, so just fetch logs SamsonKubernetes.retry_on_connection_errors do @client.get_pod_log(name, namespace, container: container) end else # still waiting, stream logs result = +"" begin timeout_logs(wait) do SamsonKubernetes.retry_on_connection_errors do @client.watch_pod_log(name, namespace, container: container).each do |log| result << log << "\n" end end end rescue Timeout::Error result << "... log streaming timeout" end result end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def running_logs()\n if @container.nil?\n 'not yet'\n else\n wait_for_start_up\n @container.logs_container\n end\n end", "def logs(container, end_time)\n fetch_logs(container, end_time, previous: !!restart_details)\n rescue *SamsonKubernetes.connection_errors # not found or pod is initializing\n begin\n fetch_logs(container, end_time, previous: !restart_details)\n rescue *SamsonKubernetes.connection_errors\n nil\n end\n end", "def print_pod_logs(pod)\n @output.puts \"LOGS:\"\n\n containers = (pod.containers + pod.init_containers).map { |c| c.fetch(:name) }\n containers.each do |container|\n @output.puts \"Container #{container}\" if containers.size > 1\n\n # Display the first and last n_lines of the log\n max = 50\n lines = (pod.logs(container) || \"No logs found\").split(\"\\n\")\n lines = lines.first(max / 2) + ['...'] + lines.last(max / 2) if lines.size > max\n lines.each { |line| @output.puts \" #{line}\" }\n end\n end", "def log_without_running\n log\n end", "def start_streaming\n info 'start streaming logs from containers'\n\n Docker::Container.all.each do |container|\n begin\n self.stream_container_logs(container) unless container.skip_logs?\n rescue Docker::Error::NotFoundError => exc\n # Could be thrown since container.skip_logs? actually loads the container details\n warn exc.message\n rescue => exc\n error exc\n end\n end\n\n @streaming = true\n end", "def print_logs(status, end_time)\n @output.puts \"\\n#{resource_identifier(status)} logs:\"\n\n containers_names = status.pod.container_names\n containers_names.each do |container_name|\n @output.puts \"Container #{container_name}\" if containers_names.size > 1\n\n # Display the first and last n_lines of the log\n max = Integer(ENV['KUBERNETES_LOG_LINES'] || '50')\n lines = (status.pod.logs(container_name, end_time) || \"No logs found\").split(\"\\n\")\n lines = lines.first(max / 2) + ['...'] + lines.last(max / 2) if lines.size > max\n lines.each { |line| @output.puts \" #{line}\" }\n end\n end", "def wait_log_event(msg_type, time_in_seconds=60, filter={})\n kafka = $logger.get_kafka\n kafka_topic = Myconfig.config[:kafka_topic]\n\n\n #\n #consumer = $logger.kafka_consumer\n #consumer.subscribe(kafka_topic, start_from_beginning: true)\n\n #\n res = nil\n\n begin\n # v1\n=begin\n timeout time_in_seconds.to_i do\n consumer.each_message do |message|\n data = (JSON.parse(message.value) rescue nil)\n next if data.nil?\n\n if data[\"type\"] == msg_type\n res = data\n break\n end\n end\n end\n=end\n\n puts \"---------- Kafka: read from offset #{$logger.offset} \"\n\n\n\n # v2\n filter_msg_types = msg_type.is_a?(String) ? [msg_type] : msg_type\n\n found = false\n Timeout.timeout time_in_seconds.to_i do\n while (true) do\n found = false\n\n begin\n kafka.fetch_messages(topic: kafka_topic, partition: 0, offset: $logger.offset).each do |message| #offset: earliest\n #\n $logger.offset = message.offset\n\n row = (JSON.parse(message.value) rescue nil)\n next if row.nil?\n\n if ['api_request_start', 'gexd_status'].include? row['type_name']\n next\n end\n\n #\n # puts \"--- offset: #{message.offset}, partition: #{message.partition}, key: #{message.key}\"\n # puts \"data: #{message.value}\"\n puts \"--- offset: #{message.offset}, partition: #{message.partition}, key: #{message.key}, type: #{row['type_name']}\"\n puts \"data: #{message.value}\"\n\n\n # date: #{row['created_at']\n\n # check msg\n next unless filter_msg_types.include?(row[\"type_name\"])\n\n # try parse data\n row['data'] = JSON.parse(row['data'])\n\n\n\n filter_ok = true\n filter.each do |k, v|\n f = k.to_s\n\n # no such field\n if row[f].nil? && row['data'][f].nil?\n filter_ok = false\n break\n end\n\n # search in columns\n if row[f]!=v && row['data'][f]!=v\n filter_ok = false\n break\n end\n\n #\n end\n\n next unless filter_ok\n\n # ok -found\n res = row\n found = true\n break\n\n end\n # / fetch_message\n\n rescue Exception => e\n puts \"exception1: #{e.message}, #{e.backtrace}\"\n\n end\n\n\n break if found\n\n sleep 5\n end\n end\n\n\n\n rescue Timeout::Error\n return nil\n rescue Exception => e\n puts \"exception: #{e.message}, #{e.backtrace}\"\n return nil\n end\n\n #\n res\n end", "def monitor\n log_opts = LogOpts.new.num(10000).tail\n log_opts = log_opts.ps(options[:ps]) if options[:ps]\n \n process_data = {}\n lines = 1\n \n heroku.read_logs(app, log_opts.to_opts) do |line|\n line.split(/\\n/).each do |real_line|\n merge_data_from_line(real_line, process_data)\n end\n metrics_table(process_data)\n end\n end", "def logs tail=nil\n f = tail ? '-f ' : ''\n\n if tail\n @prompter.print 'Fetching logs...'\n @prompter.print 'Use Ctrl-C to stop'\n end\n\n @cli.system_call \"kubectl logs #{f}#{self.name} --namespace=#{self.namespace} -c=#{self.app}\"\n end", "def reopen_logs; end", "def healthy?\n #todo: paramaterize this a bit more.\n replication_lag_bytes < 1024 && state == 'streaming'\n end", "def stop_streaming\n @streaming = false\n\n info 'stop log streaming'\n\n @workers.keys.dup.each do |id|\n self.stop_streaming_container_logs(id)\n self.mark_timestamp(id, Time.now.to_i)\n end\n end", "def run\n loop do\n File.open('logs/master_audit.log', 'a') do |log|\n log.puts message_from_queue\n end\n sleep 1.0\n end\n end", "def worker_messages(count, seconds = MAX_TIMEOUT)\n messages = []\n begin\n Timeout.timeout(seconds) do\n while messages.length < count\n messages << TomQueue.test_logger.readline\n end\n end\n rescue Timeout::Error\n end\n messages\nend", "def start!\n Thread.new {\n Docker::Container.all.each do |container|\n stream_container_logs(container, 'start')\n end\n }\n end", "def start_watchdog!\n while true\n sleep 10\n @stream_parser.begin_read unless @stream_parser.alive?\n end\n end", "def flush_log_buffer()\n APPS_LOCK.synchronize {\n loop {\n break if @@logs_buffer.empty?\n encoded_logs = JSON.dump({\n 'service_name' => 'appcontroller',\n 'host' => my_node.public_ip,\n 'logs' => @@logs_buffer.shift(LOGS_PER_BATCH),\n })\n\n begin\n url = URI.parse(\"https://#{get_login.public_ip}:\" +\n \"#{AppDashboard::LISTEN_SSL_PORT}/logs/upload\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n response = http.post(url.path, encoded_logs,\n {'Content-Type'=>'application/json'})\n rescue Exception\n # Don't crash the AppController because we weren't able to send over\n # the logs - just continue on.\n end\n }\n }\n end", "def log(message)\n puts \"resque-pool-manager[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def check_and_log_running_timeout\n if benchmark_active? && !events.last.failed?\n events.create_with_name!(:failed_on_running, 'Running timeout elapsed.')\n end\n end", "def perform(*args)\n Rails.logger.info(\"#\" * 50)\n Rails.logger.info(\"ping: #{job_id}\")\n Rails.logger.info(\"#\" * 50)\n end", "def autoflush_log; end", "def autoflush_log; end", "def log_worker(message)\n puts \"resque-pool-worker[#{Process.pid}]: #{message}\"\n #$stdout.fsync\n end", "def download_logs\n `mkdir -p tmp`\n `heroku logs -n 100000 > tmp/logs.txt`\nend", "def wait\n @log.clear\n end", "def do_tail( session, ssh_tail_command )\n session.open_channel do |channel|\n channel.on_data do |ch, data|\n puts \"Fetched SSH Log using Tail Command :\"\n puts \"[#{ssh_tail_command}] -> #{data}\"\n if \"[#{ssh_tail_command}] -> #{data}\".include? 'Completedtrue' or \"[#{ssh_tail_command}] -> #{data}\".include? @log_time_stamp.strftime('%Y-%m-%d %H:%M:%S')\n tail_log = data.scan(/.*/)\n tail_log.rindex('Completedtrue')\n completed_tail_log = tail_log[tail_log.rindex('Completedtrue') - 2]\n puts \"\\nFetched Completed Tail Log :\\nCompleted Log: #{completed_tail_log}\"\n $ssh_fetched_success_log = tail_log[tail_log.rindex('Completedtrue') - 2].scan(/Distribute.*/)[0].delete('Distribute').split(':')\n puts \"Fetched SSH ESME Address from tail log :#{$ssh_fetched_success_log[0]}\"\n puts \"Fetched SSH MID from tail log :#{$ssh_fetched_success_log[1]}\"\n else\n puts \"SSH Email File Processor is not working or FTP files are not uploaded\"\n end\n end\n sleep 5\n puts channel.exec \"tail #{ssh_tail_command}\"\n end\nend", "def daemonization_timed_out\n end", "def reset_pod_watch_retry_stats\n Thread.current[:pod_watch_retry_count] = 0\n Thread.current[:pod_watch_retry_backoff_interval] = @watch_retry_interval\n end", "def run_with_logs(job)\n capture_logs do\n job.perform\n end.map{ |log| log[:msg] }.join(\"\\n\")\n end", "def start_messages\n Server.log.info(\"* Worker count: #{@configs.count}\")\n end", "def get_logger()\n sleep $options[:log_delay]\n return $logger\nend", "def on_stream_reconnect(timeout, retries)\n puts \"reconnecting in: #{timeout} seconds\\n\"\n end", "def time_to_stream\n timeout = 0\n while true\n stream_connect_actual\n sleep 2 ** timeout\n timeout += 1\n end\n end", "def process\n client.unreliable_activity_without_retry_options\n end", "def wait_for_logs(iteration = 0, &block)\n if block_given?\n yield iteration\n end\n\n case iteration\n when 20\n event(:excessive_log_waiting)\n when 60\n raise LogsNotReceivedError.new\n end\n\n sleep 0.5\n\n res = get!(HAS_LOGS_PATH)\n\n case res.code\n when \"202\"\n wait_for_logs(iteration + 1, &block)\n when \"204\"\n true\n else\n raise UnrecognizedAPIResponse.new(res)\n end\n end", "def reader_thread_proc\n begin\n File::Tail::Logfile.tail(@path, :backward => 10) do |line|\n begin\n parse_logline(line)\n rescue Exception => e\n puts \"Malformed log line [#{line}]: #{e}\"\n end\n end\n rescue Exception => e \n puts \"LogReader is dead: #{e}\"\n end\n end", "def ping\n start = Time.now\n\n # use exclusive mode to prevent the task from suspending and causing the Timeout::Error to crash the actor thread instead\n exclusive {\n Timeout.timeout(@timeout) do\n @block.call\n end\n }\n\n rescue Timeout::Error => exc\n error exc\n abort(exc)\n rescue => exc\n error exc\n abort(exc)\n else\n delay = Time.now - start\n debug { \"watchdog delay is %.3fs\" % [delay] }\n end", "def wait_for_namespace(namespace, sleep_duration=10)\n puts \"#{c_blue}# Waiting for: #{namespace}, every #{sleep_duration}s#{c_reset}\"\n loop do\n output, status = capture_with_status(\"kubectl get pods --namespace #{namespace} --no-headers\")\n ready = status.success? && !output.empty?\n if ready\n output.each_line do |line|\n name, readiness, state, restarts, age = line.split\n next if state == 'Completed'\n next if state == 'Running' && /^(\\d+)\\/\\1$/ =~ readiness\n puts \"# Waiting for: #{line}\"\n ready = false\n end\n end\n break if ready\n sleep sleep_duration\n end\nend", "def check_log_messages(container, actual_time)\n\n last_warn = nil\n last_error = nil\n msg_pattern = /^[^\\]]*\\]\\s/ # everything from the beginning till the first ]\n\n # Get container's logs string by string\n currL = nil\n begin\n container.logs(stdout: true, stderr: true, timestamps: true, tail: 10000).each_line do |l|\n currL = l\n\n # Filter out the known errors\n next if (@known_errors.any? { |error| l.include? (error) })\n\n # A tricky way to avoid invalid symbols from Docker\n next if l.size < 30\n\n # Retrieve date (docker returns logs with a garbage before dates, so we have to workaround that - to be fixed)\n #log_time = DateTime.parse(l.gsub(/^.*(?=(20\\d{2}-))/, \"\").split(/\\s/)[0])\n log_time = DateTime.parse(l.gsub(/^[^2]*/, \"\").to_s[0, 19])\n seconds = ((DateTime.now.new_offset(0) - log_time.new_offset(0)) * 24 * 60 * 60).to_i\n\n # Check if the message is not too old\n if seconds < actual_time\n\n # Check message's loggin level\n if l.include? \" WARN \"\n last_warn = l.gsub(msg_pattern, \"\")\n elsif l.include? \" ERROR \"\n last_error = l.gsub(msg_pattern, \"\")\n end\n end\n\n end\n\n # Handle errors\n rescue Exception => e\n last_warn = \"Unparsable logs\"\n\n puts e.message\n puts currL\n puts e.backtrace.inspect\n end\n\n # Gather the results\n log_data = nil\n if !last_warn.nil? || !last_error.nil?\n log_data = Hash.new\n log_data[\"warn\"] = last_warn\n log_data[\"error\"] = last_error\n end\n\n return log_data\n end", "def get_log\n SimpleWorker.service.log(task_id)\n end", "def shutdown\n super\n $log.info 'php_fpm_status_datadog output shutting down'\n end", "def monitor( timeout: nil )\n if timeout\n begin\n Timeout::timeout( timeout ) { tail_file }\n rescue Timeout::Error\n # Do nothing\n end\n else\n tail_file\n end\n end", "def discovery_thread_runner\n while running?\n tags = ImapDaemonHeartbeat.where(\"updated_at >= ?\", 30.seconds.ago).map(&:tag)\n Log.info(\"There are #{tags.count} daemons running.\")\n\n self.server_rhash.site_tags = tags\n\n if server_rhash.size == 0\n light_sleep 1\n else\n light_sleep 10\n end\n end\n rescue Exception => e\n Log.exception(e)\n raise e\n ensure\n Log.info(\"Stopping discovery thread.\")\n end", "def sparkResetLogging()\n #logNormal($sparkPrefix + \" sparkResetLogging removing all log targets\\n\");\n\n logServer = get($serverPath+'log')\n if (logServer != nil)\n logServer.removeAllStreams()\n end\nend", "def print_reocurring_status(interval=10)\n @stats_thread = Thread.fork(0) { |tcount|\n Thread.current[:name] = 'stats'\n loop do\n sleep(interval)\n begin\n total_defers = 0\n lines = []\n sent_to = Message.to_task_count.dup\n consumers.each do |c|\n name = c.task.name\n defers = c.stats.deferred\n recv = c.stats.recv\n rcnt = c.stats.results_len\n sent = sent_to.include?(name) ? sent_to[name] : 0\n total_defers += defers\n lines << format('[%1d:%2d]%22s Defers: %5d Messages sent:recv %5d:%5d:%d', proc_id, tcount, name, defers,sent,recv,rcnt)\n end\n sent = Message.sent_messages\n recv = Message.received_messages\n lines << format(\"[%1d:%2d] %37sMessages sent:recv %5d:%5d Jobs:Queued:Results %5d:%5d:%5d\\n\",\n proc_id, tcount, ' ',sent, recv, jobq.size, thpool.job_count, thpool.result_count)\n logger.raw(lines.join(\"\\n\"))\n rescue Exception => e\n $stderr.puts e.to_s\n $stderr.puts e.backtrace.join(\"\\n\")\n end\n\n #@complete = true unless activity?(jobq.size, thpool.job_count, thpool.result_count)\n tcount += 1\n end\n }\n end", "def track_killed_by?\n false\n end", "def run\n loop { sleep 5 while @feeds.alive? }\n end", "def log_topic(msg)\n return if @stopped\n\n @filemutex.synchronize do\n log_html_topic(msg)\n end\n end", "def test_scrolls_logs_to_stream\n Scrolls.log(key: 'value')\n assert_equal(\"app=test_app key=value\", Scrolls.stream.string.strip)\n end", "def autoping\n @servers.each do |server|\n if server.last_saw_traffic_at + 300 < Time.now\n server.write(\"PING #{server.hostname}\")\n \n # Artificially set the last_saw_traffic_at value to now so that we don't flood the server\n server.last_saw_traffic_at = Time.now\n end\n end\n end", "def run!\n loop do\n begin\n job = Job.new(get_apps)\n job.fetch_targets!\n post_messages!(job.to_hash)\n sleep(@interval)\n rescue Errno::ECONNREFUSED => ce\n puts \"\"\n sleep(@interval)\n end\n\n end\n end", "def grabBounceLogs\n # If logs are fresh, skip.\n age = ((Time.now.to_i - File.mtime(\"./awsLogs/ses-logs\").to_i) / 60 / 60.0).round(1)\n if age <= 18\n STDERR.puts \"SES logs checked #{age} hours ago; skipping grab.\"\n return\n end\n\n STDERR.puts \"Grabbing SES logs.\"\n # Note: on production there's an old ~/.aws/config file that points to different AWS credentials.\n # We use an explicit \"instance\" profile (also defined in that file) to get back to plain\n # default instance credentials.\n checkOutput(\"aws s3 ls --profile instance s3://cdl-shared-logs/ses/\").split(\"\\n\").each { |line|\n next unless line =~ %r{PRE ([^ ]+@[^ ]*escholarship\\.org)/}\n dir = $1\n FileUtils.mkdir_p(\"./awsLogs/ses-logs/#{dir}\")\n checkCall(\"aws s3 sync --profile instance --quiet --delete s3://cdl-shared-logs/ses/#{dir}/ ./awsLogs/ses-logs/#{dir}/\")\n }\n FileUtils.touch(\"./awsLogs/ses-logs\")\nend", "def new_messages\n kafka_client.fetch.tap do |messages|\n log_message_stats(messages)\n end\n rescue Poseidon::Errors::UnknownTopicOrPartition\n log \"Unknown Topic: #{topic}. Trying again in 1 second.\", :warn\n sleep(1)\n return [] if stopping?\n retry\n rescue Poseidon::Connection::ConnectionFailedError\n log \"Can not connect to Kafka at #{host}:#{port}. Trying again in 1 second.\", :warn\n sleep(1)\n return [] if stopping?\n retry\n end", "def send_node_stats(node_ip)\n metrics_queue = Librato::Metrics::Queue.new\n\n cadvisor_res = Typhoeus.get(\"http://#{node_ip}:4194/api/v1.3/docker/\")\n data = Oj.load(cadvisor_res.body)\n\n data.values.each do |container|\n # Skip containers that aren't managed by kube:\n next if container['spec']['labels'].nil?\n\n # Parse the container name out of the container name auto-generated by kube\n # see https://github.com/kubernetes/heapster/blob/78ff89c01f52c0ab49dac2d356a8371e79482544/sources/datasource/kubelet.go#L156 \n container_name = container['aliases'].first.split('.').first.sub('k8s_','')\n\n # Join all of this together into a librato source name:\n source_name = ENV['CONTEXT'] + '.' + container['spec']['labels']['io.kubernetes.pod.name'].sub('/', '.') + '.' + container_name\n\n puts source_name\n\n stats = container['stats'].last\n\n # k8s_POD form the virtual network for a pod. We must collect net stats from this container,\n # since net counters for indvidual pod containers are always 0. See http://stackoverflow.com/questions/33472741/what-work-does-the-process-in-container-gcr-io-google-containers-pause0-8-0-d\n # for more info. No need to collect memory and cpu stats for this container.\n if container_name == 'POD'\n metrics_queue.add \"kube.network.tx_bytes\" => { type: :counter, value: stats['network']['tx_bytes'], source: source_name }\n metrics_queue.add \"kube.network.rx_bytes\" => { type: :counter, value: stats['network']['rx_bytes'], source: source_name }\n next\n end\n\n if stats['cpu']\n cpu_ms = stats['cpu']['usage']['total'] / 1000000\n metrics_queue.add \"kube.cpu.usage_ms\" => { type: :counter, value: cpu_ms, source: source_name }\n end\n \n if stats['memory']\n metrics_queue.add \"kube.memory.usage\" => { value: stats['memory']['usage'], source: source_name }\n metrics_queue.add \"kube.memory.rss\" => { value: stats['memory']['working_set'], source: source_name }\n end\n end\n\n metrics_queue.submit\nend", "def print_once(msg)\n @lock.synchronize do\n print \"#{msg}\\n\" if @print_count == 0\n @print_count += 1\n @print_count = 0 if @print_count == hosts.size\n end\n end", "def reopen_logs\n Resqued::Logging.close_log # it gets opened the next time it's needed.\n end", "def on_app_running(_event)\n info \"Running Karafka server #{::Process.pid}\"\n end", "def daemon_stopped?; end", "def start_messages\n Server.log.info(\"* Workers: #{@workers}\")\n Server.log.info(\"* Threads: #{@options[:queue_threads]} queue, #{@options[:retry_threads]} retry\")\n end", "def partial_status\n get_context!\n if @backend_job\n index = params[:log_end].to_i\n @logs = @backend_job.logger.segment(index, 100)\n else\n if @backend.nil? && @frontend_job\n @logs = @frontend_job.logger.segment(index, 100)\n end\n end\n end", "def def_read_loop_timeout\n 0.1\n end", "def read_logs\n @@logs\n end", "def log_start\n @notifier.log \"#{identifier}: Waiting for #{describe_query}\".strip, level: :collect\n end", "def tail_pglog(n)\n log_dir = datadir + '/pg_log'\n status, out = run 'root', \"ls -t #{log_dir}|head -1\", datadir\n if out !~ /(No such file)|^$/\n log_file = log_dir + '/' + out\n command = \"tail -#{n} #{log_file}\"\n status, out = run 'root', command, datadir\n if status\n logger.info out\n end\n end\n end", "def log\n @log || MPDClient.log\n end", "def process_log\n @service.respond_to?(:process_log) ? @service.process_log : \"\"\n end", "def skip_logs?\n self.labels['io.kontena.container.skip_logs'] == '1'\n end", "def ping\n pong = timeout 5, ENODKR do\n system 'docker info > /dev/null 2>&1'\n end\n pong or raise ENODKR\n end", "def puppetd_runonce\n started = Time.now.to_i\n while Time.now.to_i - started < Astute.config.puppet_fade_timeout\n status = puppet_status\n\n is_stopped = stopped?(status)\n is_idling = idling?(status)\n is_running = running?(status)\n\n #Try to kill 'idling' process and run again by 'runonce' call\n puppet_run if is_stopped || is_idling\n\n break if !is_running && !is_idling\n sleep Astute.config.puppet_fade_interval\n end\n\n if is_running || is_idling\n Astute.logger.warn \"Following nodes have puppet hung \" \\\n \"(#{is_running ? 'running' : 'idling'}): '#{@node['uid']}'\"\n @is_hung = true\n else\n @is_hung = false\n end\n end", "def polling\n while true do\n publish\n end\n end", "def final_metrics\n Rails.logger.info(\"\\n \\n Priority sync finished at #{Time.zone.now} \\n \\n EPs attempted to sync: #{@run_log.size} \\n EPs successfully synced: #{@run_log.size - @error_log.size} \\n EPs errored: #{@error_log.size} \\n\")\n end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def read_timeout; end", "def wait_for_jobs(namespace, delay=10)\n loop do\n success = true\n jobs = capture(\"kubectl get jobs --namespace=#{namespace} --output=name\")\n jobs.split.each do |job|\n status = JSON.load capture(\"kubectl get --namespace=#{namespace} --output=json #{job}\")\n puts status['status'].to_json\n success = false unless status['status']['succeeded']\n end\n break if success\n sleep delay\n end\nend", "def apply(iteration)\n return if @gears.empty?\n\n results, error, rc = OpenShift::Runtime::Utils.oo_spawn(%Q{/bin/grep ' killed as a result of limit of ' #{@log_file}},\n quiet: true)\n case rc\n when 1\n ; # grep found no matches\n when 0\n targets = Set.new\n results.split(\"\\n\").each do |event|\n ts = DateTime.strptime(event, '%b %d %T')\n\n # timezones are just a PITA. Syslog message doesn't include timezone so inject timezone from epoch\n timestamp = DateTime.civil(ts.year, ts.month, ts.day, ts.hour, ts.min, ts.sec, iteration.epoch.zone)\n uuid = event.scan(/[a-f0-9]{24,32}/).first\n\n # Skip any messages that occurred before we were started.\n # Assume those have been dealt with manually or on a previous run.\n # We don't want to restart any application that may already be running.\n next if iteration.last_run > timestamp\n\n # Report only last instance of gear death\n targets << uuid\n end\n\n targets.each { |u| restart(u) }\n else\n Syslog.notice(\"Watchman SyslogPlugin failed to read #{@log_file}: (#{rc}) #{error}\")\n end\n end", "def logs\n\n end", "def logs\n end", "def interactor_logging(interactor)\n Rails.logger.info \"#{self.class} START\"\n context.interactor_start_time = Time.now\n # run current interactor\n interactor.call\n rescue => exp\n Rails.logger.error \"#{self.class}.#{__method__} ERROR #{exp.message}\"\n Rails.logger.error exp.backtrace.join($/)\n\n context.fail!(errors: context.errors || :error, exp: exp)\n ensure\n context.interactor_finish_time = Time.now\n execution_time = ((context.interactor_finish_time.to_f - context.interactor_start_time.to_f) * 1000).to_i\n\n if context.success?\n Rails.logger.info(\"#{self.class} FINISH. TIME: #{execution_time}, SUCCESS: #{context.success?}\")\n else\n Rails.logger.error(\"#{self.class} FINISH. TIME: #{execution_time}, SUCCESS: #{context.success?}, ERRORS: #{context.errors}\")\n end\n end", "def maybe_print(message)\n is_status = message[\"payload\"].try(:[], \"message_type\") == \"read_status\"\n STDOUT.puts \"\\n#{message.to_yaml}\\n\" unless is_status\n end", "def ping\n exit unless status[1].to_i > 4*60 # only display if more than 5 minutes have passed\n exit if File.exists?(Path + \"/noremind\")\n\n fmt = format_status\n today = daily_tot_current_cat\n\n growl(fmt, today) if fmt.size > 0 && status[1] >> 4\nend", "def on_read_output(data)\n ::Chef::Log.info(data)\n end", "def on_stream_max_reconnects(timeout, retries)\n puts \"Failed after #{retries} failed reconnects\\n\"\n end", "def log_begin_loop_info( logger, loop_index, loop_total, meeting_id = nil )\n logger.info( \"\\r\\n<--------------------------------------------------------------------------->\" )\n if meeting_id\n logger.info( \" STARTING LOOP SCAN #{ loop_index+1 }/#{ loop_total }, MEETING #{ meeting_id }\" )\n else\n logger.info( \" STARTING LOOP SCAN #{ loop_index+1 }/#{ loop_total }\" )\n end\n logger.info( \"<--------------------------------------------------------------------------->\" )\n logger.info( \"\\r\\n\" )\n end", "def wait_for_pod_ready(name, namespace, timeout=300)\n run %W(\n kubectl wait pod/#{name}\n --for condition=Ready\n --namespace #{namespace}\n --timeout #{timeout}s\n ).join(\" \").chomp\nend", "def start_messages\n ActiveHook.log.info(\"* Workers: #{@workers}\")\n ActiveHook.log.info(\"* Threads: #{@options[:queue_threads]} queue, #{@options[:retry_threads]} retry\")\n end", "def keep_alive_time; end", "def worker_timeout(timeout); end", "def gather_logs(secret)\n if !valid_secret?(secret)\n return BAD_SECRET_MSG\n end\n\n uuid = HelperFunctions.get_random_alphanumeric()\n Djinn.log_info(\"Generated uuid #{uuid} for request to gather logs.\")\n\n Thread.new {\n # Begin by copying logs on all machines to this machine.\n local_log_dir = \"/tmp/#{uuid}\"\n remote_log_dir = \"/var/log/appscale\"\n FileUtils.mkdir_p(local_log_dir)\n @nodes.each { |node|\n this_nodes_logs = \"#{local_log_dir}/#{node.private_ip}\"\n FileUtils.mkdir_p(this_nodes_logs)\n Djinn.log_run(\"scp -r -i #{node.ssh_key} -o StrictHostkeyChecking=no \" +\n \"2>&1 root@#{node.private_ip}:#{remote_log_dir} #{this_nodes_logs}\")\n }\n\n # Next, tar.gz it up in the dashboard app so that users can download it.\n dashboard_log_location = \"/var/apps/appscaledashboard/app/static/download-logs/#{uuid}.tar.gz\"\n Djinn.log_info(\"Done gathering logs - placing logs at \" +\n dashboard_log_location)\n Djinn.log_run(\"tar -czf #{dashboard_log_location} #{local_log_dir}\")\n FileUtils.rm_rf(local_log_dir)\n }\n\n return uuid\n end", "def sub_log \n send_cmd(\"sub_log\")\n end", "def write_timeout; end", "def write_timeout; end", "def write_timeout; end", "def tail_log(quiet: false)\n log_config = {\n log_group_name: stack_name,\n log_stream_name: LOG_NAME\n }\n log_config[:next_token] = @@log_token unless @@log_token.nil?\n # Return silently if we can't get the log events for any reason.\n resp = logs.get_log_events(log_config) rescue return\n resp.events.each do |event|\n CDO.log.info(event.message) unless quiet\n end\n @@log_token = resp.next_forward_token\n end", "def log(message)\n puts \"Worker ##{@id}: #{message}\" unless ENV['RACK_ENV'] == 'test'\n end" ]
[ "0.67510223", "0.6507706", "0.58680236", "0.5797776", "0.57967514", "0.5644862", "0.5505035", "0.5498189", "0.548772", "0.5414216", "0.54120725", "0.53887165", "0.53561366", "0.5310271", "0.53012544", "0.52193516", "0.5210961", "0.5166049", "0.5161958", "0.5127103", "0.51105136", "0.51105136", "0.5099828", "0.5064674", "0.50640506", "0.5060559", "0.5049288", "0.5043219", "0.5031395", "0.502767", "0.50195783", "0.50171316", "0.5016801", "0.5014144", "0.501311", "0.50020885", "0.4995362", "0.49783248", "0.49487084", "0.49465612", "0.4945401", "0.4940317", "0.49389789", "0.49377316", "0.492447", "0.49009588", "0.48998985", "0.4887618", "0.48875558", "0.48875174", "0.48801538", "0.48660043", "0.4859091", "0.4848062", "0.48462483", "0.4835286", "0.4831536", "0.4828928", "0.48280743", "0.48264408", "0.4826336", "0.48229638", "0.48217398", "0.48078877", "0.48074815", "0.48045534", "0.4798416", "0.47981423", "0.4793747", "0.47892618", "0.4782667", "0.47822475", "0.47822475", "0.47822475", "0.47822475", "0.47822475", "0.47822475", "0.47822475", "0.47822475", "0.4781582", "0.47810075", "0.47700286", "0.47697523", "0.47533432", "0.47505176", "0.47491843", "0.47485557", "0.4740709", "0.47394994", "0.47352684", "0.4731862", "0.4721626", "0.47173172", "0.47056592", "0.47035235", "0.47016436", "0.47016436", "0.47016436", "0.47002497", "0.46968842" ]
0.65383685
1
per default is 3 by default checks every 10s so that gives us 30s to pass
def failure_threshold(event, probe_name) return unless container_name = event.dig(:involvedObject, :fieldPath).to_s[/\Aspec.containers{(.*)}\z/, 1] return unless container = @pod.dig(:spec, :containers).detect { |c| c[:name] == container_name } return unless probe = container[probe_name] probe[:failureThreshold] || 3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def throttles; end", "def worker_check_interval(interval); end", "def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkpoint_hash[30] += 1\n tab; \"#{@time_remaining} seconds left.\\n\".typing\n elsif @timer_checkpoint_hash[120] == 0 && t.between?(60, 140)\n @timer_checkpoint_hash[120] += 1\n tab; \"Cutting it close, #{codename}\".typing\n elsif @timer_checkpoint_hash[180] == 0 && t.between?(140, 180)\n @timer_checkpoint_hash[180] += 1\n tab; \"3 minutes. Finish the job.\\n\".typing\n elsif @timer_checkpoint_hash[240] == 0 && t.between?(200, 240)\n @timer_checkpoint_hash[240] += 1\n tab; \"Doing good. 4 minutes left.\\n\".typing\n end\n end", "def check_possible_times\n @possible_times = Event::POSSIBLE_TIMES_CONST\n end", "def sleeper(clock)\n n = 0\n tm = clock\n every(0.1) do\n n += 1\n break if n == tm\n end\nend", "def test_several_active\n result=[]\n at=Activity_tracker.new do\n result.push nil\n end\n 3.times do |i|\n at.active i\n end\n sleep at.timeout+at.tick_time\n assert result.size==3, 'result size is '+result.size.to_s\n end", "def test_120_tasks_every_second_with_ms_task\n min_time = 1\n rl = @testClass.new 120, min_time\n delta = timed_run(rl) { sleep 0.001 }\n # puts \"\\n#{delta} >? #{min_time}\"\n assert((delta / min_time) > TIMING_TOLERANCE)\n end", "def scan_hourly\n\n printf \"\\n%s\\n\", 'Scanning All-Users for Tasks ...'\n run_tasks_for_all_users(do_live_updates=@live_scan_updates)\n @scan_passes += 1\n printf \"%s\\n\", \"\\nPass #{@scan_passes} complete \\n\"\n\n printf \"%s\\n\", \"\\nWaiting 1 hour ... \\n\"\n sleep(60 * 60)\n\n if @scan_passes < @scan_passes_end\n printf \"%s\\n\", 'Repeating Scan'\n scan_hourly\n else\n printf \"%s\\n\", '... Exiting ...'\n end\n\nend", "def check?\n @last_time < @check_time - 100\n end", "def reset_checks\n @checks_remaining = 3\n end", "def test_start_stop\n start_time_for={}\n stop_time=nil\n at=Activity_tracker.new do |id|\n assert((Time.now-start_time_for[id]-at.timeout).to_f.abs<at.tick_time)\n end\n if at.tresholds<3\n puts \"Warning: this test supposed to run successfully\"+\n \"only wich tresholds>3\"\n end\n 4.times do\n start_time_for[1]=Time.now \n at.active 1\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n sleep at.timeout.to_f/2\n start_time_for[2]=Time.now \n at.active 2\n end\n end", "def test_refresh\n cached = TestCache.new\n 5.times do |i|\n assert_equal i, cached.m1\n assert_equal i, cached.m2\n assert_equal i, cached.m3(1)\n assert_equal i, cached.m3(2)\n sleep 1\n assert_equal i, cached.m1\n assert_equal i, cached.m2\n assert_equal i, cached.m3(1)\n assert_equal i, cached.m3(2)\n sleep 2\n assert_equal i, cached.m1\n assert_equal (i+1), cached.m2\n assert_equal i, cached.m3(1)\n assert_equal i, cached.m3(2)\n sleep 1\n end\n end", "def need_set_threshold?\n return false if self.user_id # no need for registered users\n SmsCode.where([\"phone = ? and created_at > ?\", self.phone, 30.minutes.ago]).count >= 3\n end", "def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend", "def win?\n sleep(3)\n check_points\n end", "def waitTime()\n time = Time.now().to_i / 60\n\n # Cleanup once every ten minutes\n if (@lastFloodBucketReap != time && time % 10 == 0)\n @floodControl.delete_if{|key, val| key <= (time - 5) }\n @lastFloodBucketReap = time\n end\n\n @floodControl[time] += 1\n\n count = 0\n for i in 0...5\n count += (@floodControl[time - i] * (5 - i))\n end\n\n return 0.1 + (count * 0.0393)\n end", "def learned?\n consecutive_successful_repetitions >= WhRails::Application.config.max_consecutive_successful_repetitions\n end", "def can_wait_objection?\n seconds.count >= 2\n end", "def need_tock?\n if @second == 60\n @second = 0\n tock\n end\n end", "def eu1\n # .00028s | 1000 silent iterations\n total = 0\n (1..1000).each { |i| total += i if i % 3 == 0 or i % 5 == 0 }\n return total\nend", "def tired\t\n\tif $hours_asleep >= 8 then\n\t $hours_asleep = 0\n \t\treturn false\n \telse\n \t\t$hours_asleep += 1\n \t\treturn true\n \tend \t\t\nend", "def count_ok?\n\t\tcount <= 5\n\tend", "def checks; end", "def keep_trying_till_true timeout = 30\n t_begin = Time.now\n delay = 10\n loop do\n if yield\n break\n elsif (Time.now - t_begin) > timeout\n fail \"Timeout after trying for #{timeout} seconds\"\n else\n sleep delay\n end\n delay += 1\n end\nend", "def wait_until iterations = 100\n count = 0\n loop do\n raise \"criteria not met\" if count >= iterations\n break if yield\n sleep 0.0001\n count += 1\n end\n end", "def two_factor_failure_count_exceeded?\n self.two_factor_failure_count >= 5\n end", "def optimize_every; end", "def launch\n Thread.new do\n start_time=nil\n finish_time=nil\n adjust=tick_time\n while !@hash.empty?\n @hash.synchronize do\n start_time=Time.now\n @cv.wait(adjust)\n checker\n finish_time=Time.now\n adjust=2*tick_time-(finish_time-start_time).to_f\n adjust=0 if adjust<0\n end\n end\n end\n end", "def long_planeteer_calls(calls) # code an argument here\n # Your code here\n calls.any? { |call| call.length > 4 }\nend", "def time_to_discover?\n if((@request_count%10 == 0) or (Time.now > (@last_polled_time + 10.seconds)))\n @last_polled_time = Time.now\n return true\n else\n return false\n end\n end", "def long_planeteer_calls(calls)# code an argument here\n # Your code here\n calls.any? do |call|\n call.length > 4\n end\nend", "def cpu_attempt\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET # full send\n @state[:result] = game_result\n update_game_phase(GAME_OVER)\n return true\n elsif token_placed # make sure token was placed before force delete\n board_remove_token(c)\n end\n end\n false\n end", "def _update_check_needed\n (Time.now - @last_update_check) > UPDATE_VALID_PERIOD\n end", "def long_planeteer_calls(calls) \n calls.any? do |call|\n call.length > 4 \n end\nend", "def take_passengers(n) \n return false if (n > 3 || n < 0)\n return true\n end", "def fake_cycles\n return if test?\n sleep(rand(0.25..0.75))\n end", "def while_time_remaining; end", "def perform_check?(tmp_filename, interval)\n !File.exist?(tmp_filename) || (Time.now >= (File.mtime(tmp_filename) + (interval * 60)))\nend", "def checker\n @hash.each_pair do |key, value|\n @hash[key]=value+1\n if value>=@tresholds\n @hash.delete key\n @on_expire.call key\n end\n end\n end", "def class_canceled n, array\n late = 0\n array.each do |x|\n if x > 0\n late += 1\n end\n end\n\n on_time = array.size - late\n if on_time >= n\n \"NO\"\n else\n \"YES\"\n end\nend", "def long_planeteer_calls(calls)\n calls.any? do |call|\n call.length > 4\n end\nend", "def lock_timeout_retries; end", "def sleepy_run; end", "def result_of_checking; end", "def long_planeteer_calls(calls)# code an argument here\n # Your code here\n calls.any? {|x| x.chars.length>4}\nend", "def wait_for_not_applying\n start = Time.now.to_i\n tick = 0\n\n while @manager.applying?\n @state = :waiting\n\n write_report if tick % 5 == 0\n\n if Time.now.to_i - start > (60 * 8)\n raise \"timed out waiting for an existing apply to finish.\"\n end\n\n tick += 1\n sleep 1\n end\n end", "def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n else\n end", "def wait_until_not_full; end", "def success_threshold; end", "def check_rate\n if not @intercom.rate_limit_details[:remaining].nil? and @intercom.rate_limit_details[:remaining] < 2\n sleep_time = @intercom.rate_limit_details[:reset_at].to_i - Time.now.to_i\n puts(\"Waiting for #{sleep_time} seconds to allow for rate limit to be reset\")\n sleep sleep_time\n end\n end", "def _threaded_mage_checkout\n @custom_number_of_users.times do\n start_time = Time.now\n add_to_cart @helper.get_yaml_data\n get_a_shipping_quote\n @helper.proceed_to_checkout\n # assert_section 'checkout'\n finalize_checkout_as_guest\n final_time = Time.now - start_time\n puts \"It took #{final_time} seconds to complete the order\"\n end\n end", "def num_waiting\n end", "def num_waiting\n end", "def sleep_before_retry_on_limit_error\n sleep 15\n end", "def checks_passed?\n if blacklisted_wifi?\n puts \"Blacklisted Network; Won't go online\"\n return false\n end\n\n # we don't want to spam himawari's site more than once every 10 minutes while running on a schedule\n return false if by_schedule && now.min % 10 != 1\n\n if `find #{data_path} -name \\\"t_*.png\\\"`.length.positive?\n puts 'Another himawari process is still downloading/processing files.\\n' \\\n '(There are tiles (t_*.png) in the `data` folder.) Quitting w/o overlapping.'\n return false\n end\n\n unless internet_connection?\n puts \"Not online? Can't reach #{HIMAWARI_URL}\"\n return false\n end\n true\n end", "def can_expedite?\n seconds.count >= seconds_for_expedition\n end", "def give_others_threads_a_chance_to_run\n sleep(1/(200*1e3))\n end", "def wait_trn\n $tester.cycle(repeat: trn + 1)\n end", "def snapshot_every_n_requests; end", "def needs_update\n return true if @clock == 0\n return true if sign.phrase.size > sign.letters.size && @time%(60/sign.tempo) < Manager.period - 0.001\n\n false\n end", "def sleepy_run\n cleanup if should_cleanup?\n sleep(@interval)\n increment_cycle\n end", "def ensure_rate_limits\n sleep 1 / REQUST_LIMIT_PER_MINUTE.to_f\n end", "def test_a_longer_matching_ticket_returns_false_if_matches_less_than_three\n\t\t\tmy_ticket = \"4577\"\n\t\t\twinning_tickets = [\"4577\",\"1234\"]\n\t\t\tassert_equal(winning_tickets, find_winners(my_ticket, winning_tickets))\n\tend", "def first_time(counter)\n if counter<=0\n return true\n else\n return false\n end\nend", "def increment_tries\n @tries += 1\n end", "def long_planteer_calls(calls)\n calls.any? {|call| call.length > 4} # code from lecture\nend", "def init_uptime_checks\n keys = @db[:keys].where(key_type: 'uptime').each do |k|\n name = k[:name]\n time, value = last(name)\n bump_uptime(name, get_key(name)) if value == true\n end\n end", "def long_planeteer_calls(calls)\n calls.any? {|call| call.length > 4}\nend", "def long_planeteer_calls(calls)\n\tcalls.any? {|item| item.length > 4}\nend", "def scanner_pass?(input, delay)\n scanner = PacketScanner.new(input, delay)\n scanner.length.times do |i|\n return false if scanner.caught?(i)\n end\n true\nend", "def pool_loop\n loop do\n pool_check\n sleep 5\n end\n end", "def go_faster\n ping_check \"go_faster\"\n end", "def assert_callback_times(count = 1, time = nil, message = nil)\n called_back = 0\n \n EventMachine.next_tick do\n yield(lambda { called_back += 1 })\n end\n \n start_time = Time.now.to_i\n\n while (called_back < count)\n select(nil, nil, nil, 0.1)\n \n if (time and (Time.now.to_i - start_time > time))\n flunk(message || \"assert_callback_times timed out at only #{count} times\")\n end\n end\n end", "def filter_repeated\n reset_api_settings!\n if @event['check']['name'] == 'keepalive'\n # Keepalives are a special case because they don't emit an interval.\n # They emit a heartbeat every 20 seconds per\n # http://sensuapp.org/docs/0.12/keepalives\n interval = 20\n else\n interval = @event['check']['interval'].to_i || 0\n end\n alert_after = @event['check']['alert_after'].to_i || 0\n\n if self.class.name =~ /Pagerduty/ && @event['check']['page_after']\n alert_after = @event['check']['page_after'].to_i\n end\n\n # nil.to_i == 0\n # 0 || 1 == 0\n realert_every = ( @event['check']['realert_every'] || 1 ).to_i \n # realert_every can't be 0 because of potential ZeroDivisionError below\n realert_every = -1 if realert_every == 0\n\n initial_failing_occurrences = interval > 0 ? (alert_after / interval) : 0\n number_of_failed_attempts = @event['occurrences'] - initial_failing_occurrences\n\n # sensu 0.26+ only, else never make occurrences_watermark actionable\n # https://github.com/Yelp/sensu_handlers/issues/103\n # this hack takes care of scenario\n # when event has triggered at action == create\n # but did not resolve the corresponding event when action == resolve.\n # occurrences_watermark > initial_failing_occurrences prove enough occurrences\n # of the event that triggered create and hence it is safe to filter the event to resolve handler action.\n if (@event.key?('occurrences_watermark') &&\n @event['occurrences_watermark'] > initial_failing_occurrences &&\n @event['action'] == 'resolve')\n return\n end\n\n # Don't bother acting if we haven't hit the \n # alert_after threshold\n if number_of_failed_attempts < 1\n bail \"Not failing long enough, only #{number_of_failed_attempts} after \" \\\n \"#{initial_failing_occurrences} initial failing occurrences\"\n # If we have an interval, and this is a creation event, that means we are\n # an active check\n # Lets also filter based on the realert_every setting\n elsif interval > 0 and @event['action'] == 'create' \n # Special case of exponential backoff\n if realert_every == -1\n # If our number of failed attempts is an exponent of 2\n if power_of_two?(number_of_failed_attempts)\n # Then This is our MOMENT!\n return nil\n else\n bail \"not on a power of two: #{number_of_failed_attempts}\"\n end\n elsif (number_of_failed_attempts - 1) % realert_every != 0\n # Now bail if we are not in the realert_every cycle\n bail \"only handling every #{realert_every} occurrences, and we are at\" \\\n \" #{number_of_failed_attempts}\"\n end\n end\n end", "def check ; true ; end", "def brute_wait(delay)\n sleep(delay)\n end", "def long_planeteer_calls( array )\n array.map do |call|\n if call.size > 4\n return true\n else\n return false\n end\n end\nend", "def check_priority_trigger_quick_claw(pokemon)\n return rand(100) < 20\n end", "def trythreetimes\n tries = 0\n begin\n yield\n rescue Exception => e \n tries += 1\n logger \"Error: #{e.message}\"\n if tries < 3\n logger \"Waiting 5 seconds and trying again...\"\n sleep(5)\n retry\n end\n logger \"Giving up and ending program!\"\n abort\n end\nend", "def long_planeteer_calls(calls)\n calls.each do |word|\n if word.length > 4\n return true\n else\n return false\n end\n end\nend", "def long_planeteer_calls(calls)\n res1 = calls.any? { |num| num.length>4} \n return res1\nend", "def test_load_0\n\n map = {}\n\n @engine.register_participant(\"count\") do |workitem|\n count = map[workitem.flow_id]\n count = unless count\n 1\n else\n count + 1\n end\n map[workitem.flow_id] = count\n end\n\n n = 1000\n\n n.times do |i|\n li = LaunchItem.new(TestDefinition0)\n li.flow_id = i\n @engine.launch(li)\n end\n\n #while @engine.get_expression_storage.size > 1\n # sleep 0.001\n #end\n @engine.join_until_idle\n\n good = true\n\n n.times do |i|\n c = map[i]\n if c == 2\n #if c == 1\n print \".\"\n else\n print c\n good = false\n end\n end\n\n #puts \"\\n__good ? #{good}\"\n assert good, \"missing count\"\n\n # 100 in 1s (in memory engine)\n # 1'000 in 14s (in memory engine)\n # 10'000 in 143s (in memory engine)\n # 1'000 in 31s (cache engine)\n # 10'000 in 321s (cache engine)\n # 1'000 in 113s (persistence only engine)\n # 10'000 in 1173s (persistence only engine)\n #\n #\n # ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.3]\n #\n # Machine Name: Mac\n # Machine Model: MacBook2,1\n # Processor Name: Intel Core 2 Duo\n # Processor Speed: 2 GHz\n # Number Of Processors: 1\n # Total Number Of Cores: 2\n # L2 Cache (per processor): 4 MB\n # Memory: 2 GB\n # Bus Speed: 667 MHz\n\n # Thu Sep 13 15:38:46 JST 2007\n #\n # 100 in 3s (in memory engine)\n # 1'000 in 85s (in memory engine)\n # 10'000 in s (in memory engine)\n end", "def pass?(num)\n (2..20).each do |factor|\n return false unless (num % factor).zero?\n end\n true\nend", "def limit_reached?\n end", "def check(list)\n r, e, a, d, w, i, t, s, l, k = list\n return if (r == 0 or w == 0 or t == 0 or s == 0)\n\n read = r * 1000 + e * 100 + a * 10 + d\n talk = t * 1000 + a * 100 + l * 10 + k\n write = w * 10000 + r * 1000 + i * 100 + t * 10 + e\n skill = s * 10000 + k * 1000 + i * 100 + l * 10 + l\n if (read + write + talk) == skill\n pp \"#{read} + #{write} + #{talk} = #{skill}\"\n end\nend", "def ping(t)\n @array << t \n while @array[0] < t - 3000\n \t@array.shift\n end\n return @array.length\n\n end", "def frequency_check\n return true unless Account.exists?(remote_ip: remote_ip)\n\n last_reg = Account.where(remote_ip: remote_ip).order(\"created_at desc\").first\n\n if (Time.now - last_reg.created_at) < Rails.application.secrets[:frequency_limit]\n errors[:base] << I18n.t('active_record.errors.messages.too_frequent')\n end\n end", "def perfect_test(limit)\n (0..15).each do |skill|\n gamecount = 0\n perfect_games = 0 \n until gamecount == limit\n newgame\n @players << skill\n reset_arrays\n playgame\n gamecount +=1 \n perfect_games += 1 if @game_scores[0][-1] == 300 \n end\n print skill, \"\\t\", gamecount, \"\\t\", perfect_games, \"\\n\"\n end\nend", "def test_any_chance_of_working \n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_no_statuses_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?)\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?(true))\n \n end", "def work(interval = 5.0)\n end", "def rescan\n scan if self.last_scan_at.nil? || ((self.last_scan_at.to_time + (60 * 30)) < Time.now)\n true\n end", "def get_data times=nil\n puts \"Getting getting data...\"\n if (times)\n times.times { check_data }\n else\n loop { check_data }\n end\n end", "def divisible(number)\r\n# There is no need to check all numbers from 1 to 20, since\r\n# if the number can be divided by 12, it can also be divided by 3, 4, and 6\r\n# if it can be divided by 14, it can be divided by 2 and 7, and so on.\r\n# 10 and 20 can be skipped since we iterate with step 20\r\n\r\n 11.upto(19) { |t| if number % t != 0 then return false; end }\r\n return true\r\nend", "def typhoeus_timeout\n\t \t\t10\n\t \tend", "def long_planeteer_calls(calls)\n # t_f = []\n # calls.each do |call|\n # t_f << call.include?(call.length > 4)\n # end\n # if t_f.include?(true)\n # true\n # else\n # false\n # end\n new_calls = calls.find do |call|\n (call.length > 4)\n end\n !!new_calls\nend", "def loop_threads_and_fetch_url(url_list)\n if @@url_hash.size < @@max_url\n unless url_list.empty?\n if running_thread_count() >= 5\n sleep @@sleep_timer*60\n loop_threads_and_fetch_url(url_list)\n else\n url_list = url_list.map { |url| url if get_host_without_www(url) == 'medium.com' }.compact\n save_data(url_list)\n new_urls_to_scrap = update_url_hash(url_list).compact\n @@retry_counter = 0 #setting the value for every new request\n generate_thread(new_urls_to_scrap)\n end\n end\n end\n end", "def hyperball_once\n create_workers.each(&:join)\n\n if @counters.any_changes?\n @counters.apply_changes(@ball_size)\n true\n else\n false\n end\n end", "def timer; end", "def timer; end", "def timer; end", "def timer; end" ]
[ "0.6349532", "0.62930137", "0.6247543", "0.6146383", "0.61417973", "0.6082143", "0.60600024", "0.6010581", "0.6009192", "0.5959624", "0.59469604", "0.59085053", "0.5873613", "0.5831092", "0.5830454", "0.58053994", "0.5797328", "0.57952994", "0.57734823", "0.57679296", "0.5761891", "0.57578367", "0.57493526", "0.57431555", "0.57416016", "0.57239175", "0.5721344", "0.57123584", "0.5710813", "0.57088107", "0.5693635", "0.56800383", "0.56792456", "0.5671188", "0.5668124", "0.5637335", "0.56352246", "0.56346947", "0.56342924", "0.5623749", "0.5622431", "0.56172574", "0.56159437", "0.5608845", "0.558616", "0.5582101", "0.55798334", "0.5579025", "0.55778366", "0.55763024", "0.5575037", "0.5565749", "0.5565749", "0.55651414", "0.55554736", "0.5548265", "0.5548002", "0.55425143", "0.5533485", "0.5531381", "0.5527225", "0.55260617", "0.5525797", "0.5521036", "0.55158764", "0.55145454", "0.5511244", "0.551081", "0.5503887", "0.5502992", "0.5501812", "0.5501789", "0.5495804", "0.5493935", "0.54937375", "0.54897213", "0.5483463", "0.54786813", "0.54723084", "0.54723066", "0.5466975", "0.5466124", "0.5464681", "0.5463828", "0.54637843", "0.5462882", "0.54609805", "0.5458101", "0.54573184", "0.54554147", "0.54540414", "0.54532325", "0.54457533", "0.5445074", "0.5445062", "0.5444252", "0.5442342", "0.5441989", "0.5441989", "0.5441989", "0.5441989" ]
0.0
-1
Display form for users to edit their profile information
def edit add_breadcrumb t(:'hyrax.controls.home'), root_path add_breadcrumb t(:'hyrax.dashboard.breadcrumbs.admin'), hyrax.dashboard_path add_breadcrumb t(:'hyrax.admin.sidebar.profile'), hyrax.dashboard_profile_path @trophies = Hyrax::TrophyPresenter.find_by_user(@user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n end", "def edit_profile\n @user = UserService.getUserById(params[:id])\n @profile_form = ProfileForm.new(ProfileForm.initialize(@user, :new_profile))\n end", "def edit\n render partial: \"metadata_profiles/form\",\n locals: { profile: @profile }\n end", "def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end", "def edit_profile\n end", "def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend", "def edit\n @profile = Profile.find(current_user.id)\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n # when edit profile\n when 1\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n\n # Assigning form[:user] with user object\n form[:user] = user\n\n # Returning the form\n form\n # when 2 back to view profile\n when 2\n\n view_profile(form)\n else\n form[:flash_msg] = \"Wrong option entered, please retry.\"\n edit_profile(form)\n end\n view_profile(form)\n end", "def edit\n @help = PageContent.find_by_name(\"profile-help\") # \"What to include in profile\" Content\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n end\n #displays current profile information for editing \n if !@presenter_profile.bio_edit.nil?\n if @presenter_profile.approved? && @presenter_profile.bio_edit.empty?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n else\n if @presenter_profile.approved?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n end\n end", "def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end", "def user_profile_edit\n\n\n end", "def edit\n @user = User.find(params[:user_id])\n @profile = @user.profile\n \n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n\n form[:user] = user\n view_profile(form)\n form\n when 2\n view_profile(form)\n else\n form[:flash_msg] = 'Wrong option entered, please retry.'\n edit_profile(form)\n end\n end", "def edit\n user = User.find(params[:user_id])\n @profile = user.profile\n end", "def profile_edit\n @user = User.find(current_user.id)\n end", "def edit\n @user = current_user\n @profile = current_user.profile\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n user = User.load\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password],\n gopay: user.gopay\n )\n user.save!\n form[:user] = user\n view_profile(form)\n when 2\n view_profile(form)\n else\n form[:flash_msg] = 'Wrong option entered, please retry'\n edit_profile(form)\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n valid_msg = User.validate(form)\n if !valid_msg.empty?\n form[:flash_msg] = valid_msg\n edit_profile(form)\n else\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n # Assigning form[:user] with user object\n form[:user] = user\n form[:flash_msg] = 'Your profile has been updated.'\n end\n when 2\n form[:flash_msg] = 'You canceled your profile changes.'\n else\n form[:flash_msg] = 'Wrong option entered, please retry.'\n edit_profile(form)\n end\n\n view_profile(form)\n end", "def edit\n @user.profile ||= Profile.new\n @profile = @user.profile\n end", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def edit\n @profile = User.find(params[:id])\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n\n case form[:steps].last[:option].to_i\n when 1\n error = user.validate\n if error.empty?\n user.save!\n form[:user] = user\n form[:flash_msg] = \"Your account was successfully updated\"\n view_profile(form)\n else\n form[:flash_msg] = [\"Your account was not successfully updated\"]\n form[:flash_msg] << error\n view_profile(form)\n end\n when 2\n view_profile(form)\n else\n form[:flash_msg] = \"Wrong option entered, please retry.\"\n edit_profile(form)\n end\n\n form\n end", "def edit\n @page_title = \"Edit Translation\"\n @nav = 'user/profile'\n \n end", "def edit\n #set @profile to the current profile, which was linked from the home index view\n @profile = Profile.find(params[:id]) \n end", "def edit\n\t\t#Find the Particular Profile\n\t\t@surgeon_profile = @profile\n\tend", "def edit\n\t\tRails.logger.warn(\"Rendering account settings page.\")\n\t\t@user = User.find(params[:id])\n\tend", "def edit\n redirect_to action: 'edit_profile'\n end", "def edit\n\t\t\t@user = User.find(params[:id])\n\t\t\t@jobseeker1 = Jobseeker.find_by(:user_id => @user.id)\n\n\t\tif @jobseeker1\n\t\t\t@jobseeker = @jobseeker1\n\t\t\t@title = \"Edit Profile\"\n\t\telse\n\t\t\tflash[:notice] = \"we don't have your profile yet, create one!\"\n\t\t\t#don't use render 'new' because it refers to @jobseeker from this action(and in this section of action, its nil.)\n\t\t\tredirect_to new_jobseeker_path\n\t\tend\n\t\t\n\tend", "def edit\n @title = \"sipbib: edit profile\"\n @user = User.find(session[:user_id])\n @user.spec ||= Spec.new\n @spec = @user.spec\n \n if param_posted?(:spec)\n if @user.spec.update_attributes(params[:spec])\n flash[:notice] = \"Changes saved.\"\n redirect_to :controller => \"user\", :action => \"index\"\n end\n end\n end", "def edit\n @user = User.find(params[:id])\n # just show me the form\nend", "def edit\n @user = User.find(params[:id])\n\t case params[:form]\n\t when \"email\"\n\t render 'email'\n\t when \"password\"\n\t render 'password'\n\t else\n\t render :action => :edit\n\t end\n\tend", "def edit\n @profile = @author.profile\n end", "def edit\n # Renders the edit form\n end", "def edit_profile\n @user = User.find params[:id]\n end", "def edit_profile\n \t@user = current_user\n end", "def edit\n @user.build_profile if @user.profile.blank?\n end", "def edit\n @page_title = 'Edit user'\n @user = User.find(params[:id])\n end", "def show\n\t\t# Initializing the Inivitation form from profile page\n\tend", "def update\n # Retrieve user from the database\n @user = User.find(params[:user_id])\n # Assign user profile to an instance variable\n @profile = @user.profile\n # Mass assign edited profile attributes and save. \n if @profile.update_attributes(profile_params)\n flash[:success] = \"Profile updated!\"\n # Redirect to profile page. \n redirect_to user_path(id: params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :edit\n end\n end", "def update\n if @profile.update_attributes(profile_params)\n redirect_to @profile, notice: \"Your profile has been updated\"\n else\n render :edit\n end\n end", "def update\n if @profile.update(profile_params)\n redirect_to @profile\n else\n render :edit\n end\n end", "def editProfile\n user = User.find(session[:user_id])\n user.firstName = params[:user][:firstName]\n user.lastName = params[:user][:lastName]\n user.age = params[:user][:age]\n user.about = params[:user][:about]\n user.location = params[:user][:location]\n user.save\n redirect_to :controller => :users, :action => :home\n end", "def update\n # Button press on edit page\n\n # Read the user and update the attributes (don't save at this point)\n @user = User.find(params[:id])\n render_error h \"Der Spezialbenutzer #{@user.username} kann nicht editiert werden.\" and return if @user.special?\n @user.attributes=params[:user] if params[:user]\n\n # Subpages\n select_person and return if params['select_person']\n\n if params['commit']\n # 'Save' button\n render 'edit' and return if !@user.save\n\n flash[:notice] = \"Der Benutzer #{@user.username} wurde gespeichert.\"\n redirect_to_origin(default=@user)\n return\n end\n\n render 'edit'\n end", "def edit\n # find the user we want to edit by id\n # this will send the @user to the edit page with a form\n @user = User.find(params[:id])\n end", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def update\n # Main content\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile has been updated\"\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def new\n # form where a user can fill out their own profile.\n @user = User.find( params[:user_id] )\n @profile = Profile.new\n end", "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "def edit\n #similar to the NEW action, but instead of create a empty user, we will find a user by its id and than\n # send its params to the partial form, so the params can be edited. Please note the partial form\n # for details, as the column admin can be edited only buy logged users with admin privileges.\n #@user variable will be used in the partial form, when submitted goes to UPDATE action.\n @user = User.find(params[:id])\n #only admin can edit other users information, so we first check if the user is admin.\n unless current_user.admin?\n #if the user is not admin it can edit only its own information, so we redirect to edit its own information\n unless @user.id == current_user.id\n redirect_to edit_user_path (current_user)\n end\n end\n end", "def edit\n @user.build_user_profile unless @user.user_profile\n end", "def edit(id)\n @user = flash[:form_data] || User[id]\n\n if @user.nil?\n flash[:error] = 'The specified user is invalid'\n redirect_referrer\n end\n\n @title = \"Edit #{@user.username}\"\n\n render_view(:form)\n end", "def update\n if current_user.update(user_params)\n redirect_to current_user, notice: t(\"profile.updated\")\n else\n render \"edit\"\n end\n end", "def update\n @profile = Profile.find_by_user_id params[:user_id]\n\n if @profile.update_attributes(params[:profile])\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/edit\"\n end\n\n end", "def update_user_profile(profile_form)\n isUpdateProfile = UserService.updateProfile(profile_form)\n if isUpdateProfile\n redirect_to users_path\n else\n asdasd\n render :edit_profile\n end\n end", "def update\n if current_user.update(user_params)\n redirect_to user_path(current_user), notice: 'Your profile was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend", "def edit\n\n end", "def new \n # Render black profile details form\n @profile = Profile.new\n end", "def edit\n \n end", "def edit\n if current_profile!=@profile\n redirect_to root_url, notice: 'Permission denied'\n end\n end", "def edit\n # When a http GET request to '/users/1/edit' is received, have it render:\n # a view file with a form with user 1's information in the appropriate input field.\n @id = params[:id]\n @user = User.find(@id)\n end", "def update\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\t\tif @profile.update_attributes(profile_params)\n\t\t\tflash[:success] = \"Page Updated\"\n\t\t\tredirect_to user_path(id: params[:user_id] )\n\t\telse\n\t\t\trender action: :edit\n\t\tend\n\tend", "def edit\n debugger\n flash.keep\n redirect_to(edit_user_registration_path)\n end", "def edit\n @user = current_user\n if params[:subscription].eql?('1')\n @subscription = true\n flash[:notice] = t('bulletin_subscriptions.email_needed')\n end\n @title = t('account.your_profile')\n @breadcrumbs_info = [[t('account.your_profile'), edit_account_path]]\n end", "def information_edit\n if request.post?\n if current_user.update(params.require(:user).permit(User::INFORMATION_ATTRS))\n render_success_message('Information successfully saved.', render_to_string(partial: 'information', locals:{user: current_user}))\n else\n render_error_model(curent_user)\n end\n else\n render partial: 'information_edit', locals:{user: current_user}\n end\n end", "def edit\n @user = current_user\n render 'edit'\n end", "def edit\n \n @user = User.find(params[:id])\n \n end", "def update\n @profile = User.find(params[:id])\n \n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to profile_path(@profile) }\n else\n flash[:alert] = \"unable to update. Please check the data.\"\n format.html { render 'edit' }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\n if @profile.update_attributes(params[:profile])\n redirect_to @profile, notice: 'Profile was successfully updated.'\n else\n render action: \"edit\"\n end\n end", "def edit\r\n \r\n end", "def update\n\n if @usertype == 'dataentry'\n dataentry = Dataentry.find_by_authentications_id(@id)\n dataentry.firstname = params['firstname']\n dataentry.lastname = params['lastname']\n dataentry.profile = params['profile']\n dataentry.institution = params['institution']\n dataentry.save\n redirect_to '/profile'\n #TODO: Update the flash message to show that the profile is updated or not.\n else\n redirect_to '/'\n end\n end", "def edit\n\t\t# must have admin access or be in the course\n\tend", "def edit\r\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n authorize! :edit, @profile\n end", "def edit\n @user = User.find(params[:id])\n @form_id = 'edit-form'\n \n respond_to do |fmt|\n fmt.html { render partial: 'form' }\n fmt.json { render json: @user }\n end\n end", "def update_profile\n\t@user_profile_form = UserProfileForm.new(user_profile_params)\n\tif user_profile_params[:edit_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = user_profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(user_profile_params[:edit_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(user_profile_params[:edit_profile].read)\n \tend\n\t \t@user_profile_form.profile = profilename\n\tend\n \tunless @user_profile_form.valid?\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n render :edit_profile\n else\n redirect_to :action => \"update_confirm\", id: @user_profile_form.id, name: @user_profile_form.name, email: @user_profile_form.email, role: @user_profile_form.role, phone: @user_profile_form.phone, dob: @user_profile_form.dob, address: @user_profile_form.address, profile: @user_profile_form.profile\n end\n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n set_user\n end", "def edit\n\t\tadd_breadcrumb \"Editar\"\n\t\tif @request.user_id != current_user.id\n\t\t\tredirect_to root_path, alert: \"Usted no es el creador de la solicitud, por lo que no puede modificarla. Contáctese con su administrador.\"\n\t\tend\n\tend" ]
[ "0.8063085", "0.794261", "0.7899535", "0.77232766", "0.7710353", "0.7619232", "0.76006776", "0.7592443", "0.75523394", "0.7516237", "0.7487753", "0.7461063", "0.74524486", "0.74344945", "0.74272305", "0.7426131", "0.7421678", "0.73960567", "0.73688626", "0.73624825", "0.7353232", "0.7342504", "0.7331968", "0.72874093", "0.72857034", "0.72499347", "0.72445637", "0.72427344", "0.7220093", "0.7190519", "0.7171115", "0.7106578", "0.7106382", "0.7091197", "0.7087798", "0.70606226", "0.7040414", "0.7004117", "0.6991124", "0.6977727", "0.69772726", "0.6973965", "0.69733906", "0.69696593", "0.6962158", "0.6944131", "0.6920439", "0.6920091", "0.6917216", "0.6917216", "0.6910222", "0.68943197", "0.689346", "0.68288934", "0.6827586", "0.6827405", "0.68264896", "0.6818639", "0.6816036", "0.68154156", "0.68102753", "0.6808074", "0.6781842", "0.67733485", "0.67657304", "0.6757553", "0.6750287", "0.6743637", "0.6742441", "0.6740471", "0.67393315", "0.6736355", "0.6732416", "0.67306846", "0.6729657", "0.67172486", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.6708553", "0.67042816", "0.66987073", "0.6695124", "0.66948295", "0.66948295", "0.66948295", "0.66948295", "0.66948295", "0.66948295", "0.66948295", "0.6694734", "0.66881055" ]
0.0
-1
Process changes from profile form
def update if conditionally_update handle_successful_update redirect_to hyrax.dashboard_profile_path(@user.to_param), notice: "Your profile has been updated" else redirect_to hyrax.edit_dashboard_profile_path(@user.to_param), alert: @user.errors.full_messages end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n \n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n else\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n if !new_profile.has_key?(:picture_edit)\n new_profile[:picture_edit] = nil\n end\n #submit for approval\n if params[:submit]\n if @presenter_profile.update(new_profile)\n #checks profile has been changed\n if @presenter_profile.bio != @presenter_profile.bio_edit || @presenter_profile.picture_edit_stored?\n if current_user.user_type == \"admin\"\n @presenter_profile.update_attribute(:status, :pending_presenter)\n flash[:info] = \"Profile changes submitted to presenter for approval\"\n Notification.send_message(@presenter.user, \"You have pending profile changes to review from an Admin\", presenter_profile_path(@presenter), :system)\n redirect_to admin_path\n else #current user is profile owner\n @presenter_profile.update_attribute(:status, :pending_admin)\n flash[:info] = \"Profile changes submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n end\n else # No changes were made\n @presenter_profile.bio_edit = ''\n @presenter_profile.picture_edit = nil\n flash[:warning] = 'No changes were made, please make changes before pressing submit'\n redirect_to edit_presenter_profile_path(@presenter)\n end\n else\n render 'edit'\n end\n #save draft\n elsif params[:save]\n if @presenter_profile.update(new_profile)\n if current_user.presenter?\n @presenter_profile.update_attribute(:status, :draft_presenter)\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to presenters_path\n else #current_user.admin?\n @presenter_profile.update_attribute(:status, :draft_admin)\n flash[:info] = \"Profile draft saved for #{@presenter.first_name}'s profile.\"\n redirect_to admin_path\n end\n else\n render 'edit'\n end\n end\n end\n end", "def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end", "def update_profile\n @profile_form = ProfileForm.new(profile_params)\n if !@profile_form.valid?\n render :edit_profile\n elsif profile_params[:new_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(profile_params[:new_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(profile_params[:new_profile].read)\n end\n @profile_form.profile = profilename\n update_user_profile(@profile_form)\n else\n update_user_profile(@profile_form)\n end\n end", "def update_user_profile(profile_form)\n isUpdateProfile = UserService.updateProfile(profile_form)\n if isUpdateProfile\n redirect_to users_path\n else\n asdasd\n render :edit_profile\n end\n end", "def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end", "def edit_profile\n end", "def update_profile\n @profile = @account.employee\n \n if params[:profile].present?\n @profile.assign_attributes(profile_params)\n @profile.save\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {success: 'Profile has been updated successfully.'}\n else\n redirect_to gns_core.my_profile_backend_accounts_path, flash: {error: 'Profile update failed. Please try again!'}\n end\n end", "def update_profile_for_user\n @page_controls = content_service.handle_content_profile_update(params.to_unsafe_h)\n flash[:notice] = @page_controls.message if @page_controls.message?\n redirect_to manage_content_profiles_profiles_url\n end", "def user_profile_edit\n\n\n end", "def update\n unless session[:session_admin].present?\n session[:session_admin] = current_admin.id\n end\n @not_current = 'no'\n @tab = params[:tab]\n respond_to do |format|\n if @admin_profile.update(admin_profile_params)\n Admin.find(current_admin.id).update_attributes(email: params[:admin_profile][:e_mail])\n unless params[:admin_profile][:avatar].blank?\n loaded = Cloudinary::Uploader.destroy(\"company/#{@admin_profile.id}\", :public_id => \"profiles/#{@admin_profile.id}\", :invalidate => true)\n preloaded = Cloudinary::Uploader.upload(params[:admin_profile][:avatar], :use_filename => true, :public_id => \"profiles/#{@admin_profile.id}\")\n rand = RandCloud.generated_rand(\"profile\",@admin_profile.id,\"/v2#{Random.rand(11)}\")\n end\n\n unless params[:admin_profile][:profile_skills_attributes].blank?\n params[:admin_profile][:profile_skills_attributes].each do |skill|\n unless skill[1][:id].present?\n admin_skill = Admin::ProfileSkill.create({profile_id: @admin_profile.id, name: skill[1][:name], skill: skill[1][:skill]})\n admin_skill.save\n else\n unless params[:selected].blank? \n ids_param = params[:selected]\n ids = convert_to_arr_for_query(ids_param)\n Admin::ProfileSkill.delete_all \"id in #{ids}\"\n else\n admin_skill = Admin::ProfileSkill.find(skill[1][:id]).update({name: skill[1][:name], skill: skill[1][:skill]})\n end\n end\n end\n end\n\n unless params[:admin_profile][:profile_hobbies_attributes].blank?\n params[:admin_profile][:profile_hobbies_attributes].each do |hobby|\n unless hobby[1][:id].present?\n admin_hobby = Admin::ProfileHobby.create({profile_id: @admin_profile.id, name: hobby[1][:name]})\n admin_hobby.save\n else\n unless params[:selected].blank? \n ids_param = params[:selected]\n ids = convert_to_arr_for_query(ids_param)\n Admin::ProfileHobby.delete_all \"id in #{ids}\"\n else\n admin_hobby = Admin::ProfileHobby.find(hobby[1][:id]).update({name: hobby[1][:name]})\n end\n end\n end\n end\n format.html { redirect_to admin_root_path, notice: 'Photo Profile was successfully updated.'}\n format.json { head :no_content}\n format.js\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_profile.errors, status: :unprocessable_entity }\n format.js { @admin_profile }\n end\n end\n end", "def update_profile\n\t@user_profile_form = UserProfileForm.new(user_profile_params)\n\tif user_profile_params[:edit_profile].present?\n dir = \"#{Rails.root}/app/assets/profiles/\"\n FileUtils.mkdir_p(dir) unless File.directory?(dir)\n profilename = user_profile_params[:name]+ \"_\" + Time.now.strftime('%Y%m%d_%H%M%S') + \".\" + ActiveStorage::Filename.new(user_profile_params[:edit_profile].original_filename).extension\n File.open(Rails.root.join('app/assets/', 'images', profilename ), 'wb') do |f|\n f.write(user_profile_params[:edit_profile].read)\n \tend\n\t \t@user_profile_form.profile = profilename\n\tend\n \tunless @user_profile_form.valid?\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n render :edit_profile\n else\n redirect_to :action => \"update_confirm\", id: @user_profile_form.id, name: @user_profile_form.name, email: @user_profile_form.email, role: @user_profile_form.role, phone: @user_profile_form.phone, dob: @user_profile_form.dob, address: @user_profile_form.address, profile: @user_profile_form.profile\n end\n end", "def update\n respond_to do |format|\n if @profile.update_attributes params[:profile]\n @profile.user.index!\n format.html { redirect_to get_stored_location, :notice => t('profile.profile_updated') }\n else\n format.html { render :action => :edit }\n end\n end\n end", "def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # Retrieve user from the database\n @user = User.find(params[:user_id])\n # Assign user profile to an instance variable\n @profile = @user.profile\n # Mass assign edited profile attributes and save. \n if @profile.update_attributes(profile_params)\n flash[:success] = \"Profile updated!\"\n # Redirect to profile page. \n redirect_to user_path(id: params[:user_id])\n else\n # TODO: don't dump the user's inputs if save to database fails. \n render action: :edit\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n good_change(format, :ok)\n else\n bad_change(format, :edit)\n end\n end\n end", "def edit\n\t\t#Find the Particular Profile\n\t\t@surgeon_profile = @profile\n\tend", "def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n end", "def update\n @profile = Profile.find_by_user_id(current_user.id)\n\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Personal info saved sucessfuly\"\n else\n error_messages(@profile)\n end\n\n redirect_to edit_profile_path\n end", "def update\n @user = User.find( params[:user_id] ) #establish which user profile we are editing \n @profile = @user.profile #store user profile data in @profile variable \n if @profile.update_attributes(profile_params) # checking in db if data is updated\n flash[:success] = \"Profile Updated!\"\n redirect_to user_path( params[:user_id] ) # display the edited profile\n else\n render action: :edit #redirecting user to edit page\n end\nend", "def update\n\t\t# Updating the details according the that particular profile\n\t\t@profile.update_attributes(profile_params)\n\t\t# Redirect to the particular surgeon profile show page\n\t\tredirect_to profile_path(@profile)\n\tend", "def public_profile\n if params['form_profile']\n CsApi::Member.update(current_access_token, @current_user.username, params['form_profile'])\n Resque.enqueue(UpdateBadgeVillePlayer, current_access_token, @current_user.username, 'name,first_name,last_name,profile_pic,badgeville_id') unless ENV['BADGEVILLE_ENABLED'].eql?('false')\n flash.now[:notice] = 'Your profile information has been updated.'\n # get the updated account\n get_account \n end\n @page_title = 'Public Profile'\n end", "def update\n @profile = Profile.find_by_user_id params[:user_id]\n\n if @profile.update_attributes(params[:profile])\n redirect_to user_profile_path(params[:user_id])\n else\n flash[:alert] = @profile.errors.full_messages.join(\",\")\n render :template => \"profiles/edit\"\n end\n\n end", "def edit\n @help = PageContent.find_by_name(\"profile-help\") # \"What to include in profile\" Content\n @presenter = find_presenter\n @presenter_profile = @presenter.presenter_profile\n if @presenter_profile.nil?\n redirect_to new_presenter_profile_path(@presenter)\n end\n #displays current profile information for editing \n if !@presenter_profile.bio_edit.nil?\n if @presenter_profile.approved? && @presenter_profile.bio_edit.empty?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n else\n if @presenter_profile.approved?\n @presenter_profile.bio_edit = @presenter_profile.bio\n end\n end\n end", "def edit\n @user.profile ||= Profile.new\n @profile = @user.profile\n end", "def updated_profile\n \n @user = User.find_by_id(session[:user_id])\n \n @user.name = params[:user][:name]\n @user.email = params[:user][:email]\n @user.address = params[:user][:address]\n @user.city = params[:user][:city]\n @user.pincode = params[:user][:pincode]\n @user.state = params[:user][:state]\n @user.contact_no = params[:user][:contact_no]\n\n if @user.save\n flash[:notice] = \"Changes Updated Successfully\"\n redirect_to :action => \"admin_profile\"\n else\n flash[:notice] = \"Changes are not updated\"\n end # if @user.save\n\n end", "def update_profile\n @profile = Profile.find(params[:id])\n @profile.update_attribute(:field_name,params[:field_name])\n @profile.update_attribute(:field_type,params[:field_type])\n redirect_to(\"/profiles/create_profile/#{@profile.structure_component_id}\")\n end", "def update\n @user = current_user\n @tab = params[:tab]\n @on_my_account = true\n\n # do in two steps so we can see user.changes\n @user.attributes = params[:user]\n @user.update_subscriptions('http://sowhatsthedeal.com/my_account_email', nil, true)\n\n if @user.errors.empty? and @user.save\n @user.update_cim_profile\n flash.now[:notice] = \"Your #{@tab == 'personal' ? 'account has' : 'email preferences have' } been updated!\"\n end\n \n if request.xhr?\n render :text => \"success\"\n else \n render :action => @user.errors.on(:password) ? 'change_password' : 'show'\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n valid_msg = User.validate(form)\n if !valid_msg.empty?\n form[:flash_msg] = valid_msg\n edit_profile(form)\n else\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n # Assigning form[:user] with user object\n form[:user] = user\n form[:flash_msg] = 'Your profile has been updated.'\n end\n when 2\n form[:flash_msg] = 'You canceled your profile changes.'\n else\n form[:flash_msg] = 'Wrong option entered, please retry.'\n edit_profile(form)\n end\n\n view_profile(form)\n end", "def update\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\t\tif @profile.update_attributes(profile_params)\n\t\t\tflash[:success] = \"Page Updated\"\n\t\t\tredirect_to user_path(id: params[:user_id] )\n\t\telse\n\t\t\trender action: :edit\n\t\tend\n\tend", "def update\n\n if @usertype == 'dataentry'\n dataentry = Dataentry.find_by_authentications_id(@id)\n dataentry.firstname = params['firstname']\n dataentry.lastname = params['lastname']\n dataentry.profile = params['profile']\n dataentry.institution = params['institution']\n dataentry.save\n redirect_to '/profile'\n #TODO: Update the flash message to show that the profile is updated or not.\n else\n redirect_to '/'\n end\n end", "def edit_profile\n @user = UserService.getUserById(params[:id])\n @profile_form = ProfileForm.new(ProfileForm.initialize(@user, :new_profile))\n end", "def update\n # FIXME There's probably a better way to manage STI.\n profile_params = (@profile.type == DeveloperProfile.to_s ? params[:developer_profile] : params[:contractor_profile])\n profile_params[:project_type_ids] ||= []\n\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html { redirect_to(profile_path(@profile), :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n # when edit profile\n when 1\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n\n # Assigning form[:user] with user object\n form[:user] = user\n\n # Returning the form\n form\n # when 2 back to view profile\n when 2\n\n view_profile(form)\n else\n form[:flash_msg] = \"Wrong option entered, please retry.\"\n edit_profile(form)\n end\n view_profile(form)\n end", "def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n current_user.profile.update_attributes(profile_params)\n redirect_to '/profiles'\n end", "def update\n @profile = @user.profile \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = t('profiles.new.success')\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @profile.update_attributes(profile_params)\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.reload.update(bank_id: response_bank.id)\n if @profile.recipient_id.blank?\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n else\n response_recipient = Pagarme::UpdateRecipientService.new(profile: @profile).call\n end\n if response_recipient.id.present?\n @profile.reload.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil atualizado com sucesso.'\n end\n end\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n else\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n user = User.load\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password],\n gopay: user.gopay\n )\n user.save!\n form[:user] = user\n view_profile(form)\n when 2\n view_profile(form)\n else\n form[:flash_msg] = 'Wrong option entered, please retry'\n edit_profile(form)\n end\n end", "def update\n @profile = Profile.find_by_id(params[:id])\n @updateFor = params[:type]\n @message = \"Update successfully...\"\n if @updateFor==\"ProfileInformation\"\n @profile_update=profile_params\n @profile_update[:dob] = Date.strptime(@profile_update[:dob], '%m/%d/%Y')\n \n @profile_update[:height] = CustomMethods.convert_to_float(@profile_update[:height])\n user_type=current_user.position\n if user_type != \"Member\" && @profile.gender != @profile_update[:gender]\n ProfileMatch.delete_other_user_matches(current_user.id)\n ProfileMatch.delete_matches(current_user.user_id)\n end\n #@profile_update[:height]= convert_to_float(profile_params[:height],params[:height_inch])\n if @profile.update(@profile_update)\n \n @profile.user.first_name=user_params[\"first_name\"]\n @profile.user.last_name=user_params[\"last_name\"]\n @profile.user.region=user_params[\"region\"]\n photos= @profile.user.photos\n if photos.present?\n photos.update_all(:private_pic=>@profile.photo)\n end\n @profile.user.save \n #after updation report admin\n role=UserRole.get_roles(current_user)\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyProfile\"\n @profile_update=profile_params\n if @profile.update(@profile_update) \n puts 'updated profile'\n else\n @message = \"Something went wrong\"\n end\n elsif @updateFor==\"OnlyRegion\"\n @profile.user.region=user_params[\"region\"]\n @profile.user.save \n elsif @updateFor == \"PartnerPreferences\"\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n @partner_preferences_update=partner_preferences_params\n @partner_preferences_update[:height_from] = CustomMethods.convert_to_float(@partner_preferences_update[:height_from])\n @partner_preferences_update[:height_to] = CustomMethods.convert_to_float(@partner_preferences_update[:height_to])\n if !@partner_preferences.present?\n @partner_preferences = PartnerPreference.new(@partner_preferences_update)\n @partner_preferences.user_id = @profile.user_id\n @deal_breaker = DealBreaker.new\n if @partner_preferences.save\n @deal_breaker.partner_preference_id = @partner_preferences.id\n @deal_breaker.save\n end\n end\n @partner_preferences = PartnerPreference.find_by_user_id @profile.user_id\n if @partner_preferences.update(@partner_preferences_update)\n @deal_breaker = DealBreaker.find_by_partner_preference_id @partner_preferences.id \n if @deal_breaker.present?\n @deal_breaker.update(deal_breaker_params)\n end\n end \n end\n @profile=Profile.find_by(id: @profile.id)\n User.update_elastic(@profile.user)\n render json: {\n status: 200,\n message: @message,\n profile:@profile\n }.to_json\n end", "def profiel\n if request.post? and params[:user]\n\n if @me.update_attributes(params[:user])\n # website stuff!\n if params[:user][:profile_website]\n if params[:user][:profile_website][0..6] != \"http://\" and !params[:user][:profile_website].blank?\n @me.update_attribute('profile_website', 'http://' + params[:user][:profile_website])\n end\n end\n flash.now[:notice] = \"Profiel gewijzigd\"\n end\n end\n \n end", "def update\n if @profile.update_attributes(profile_params)\n redirect_to @profile, notice: \"Your profile has been updated\"\n else\n render :edit\n end\n end", "def user_update\n \t saveupdateProfile = UsersService.updateProfile(user_profile_params)\n \t if saveupdateProfile \n \t \tredirect_to users_path, notice: \"Successfully Updated!!!.\"\n \t else\n flash[:error] = \"Something wrong in User Update Please Check again.\"\n \t \trender :edit_profile\n \t end\n end", "def update\n respond_to do |format|\n # byebug\n if @profile.update(profile_params)\n format.html { redirect_to vendor_path(current_user.username), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @title = \"sipbib: edit profile\"\n @user = User.find(session[:user_id])\n @user.spec ||= Spec.new\n @spec = @user.spec\n \n if param_posted?(:spec)\n if @user.spec.update_attributes(params[:spec])\n flash[:notice] = \"Changes saved.\"\n redirect_to :controller => \"user\", :action => \"index\"\n end\n end\n end", "def update\n @user = User.find(current_user.id)\n @profile = @user.profile\n \n if @profile = params[:profile]\n redirect_to user_profile_path(current_user.name)\n else\n redirect_to edit_user_profile_path\n end\n end", "def update_contact_profile\n contact = User.find(params[:contact_id])\n case params[:current_div]\n #======= for work eligibility ================= \n when \"work_eligibility_div\"\n contact.update_attributes(params[:user])\n #======= end work eligibility =================\n \n #======== for Employment details ============== \n when \"employment_details_div\"\n contact.user_profile.update_attributes( params[:user].present? ? params[:user][:user_profile_attributes] : nil ) \n #======== end for Employment details ==========\n \n #========== for cv ============================ \n when \"cv_div\"\n \n #============ end for Cv ======================\n \n \n #============== for it skills ================= \n when \"itskills_div\"\n user_it_skill = contact.user_itskills.build(params[:user_itskill])\n user_it_skill.experience = user_it_skill.experience * 12 if (params[:it_experience_type].present? && params[:it_experience_type].casecmp(\"year\") == 0)\n \n #============== end of it skills================\n \n \n #============== for other skills =============== \n when \"otherskills_div\"\n user_other_skill = contact.user_otherskills.build(params[:user_otherskill])\n user_other_skill.experience = user_other_skill.experience * 12 if (params[:other_experience_type].present? && params[:other_experience_type].casecmp(\"year\") == 0)\n #============== end for other skills =========== \n \n \n #=============== for contact languages ========== \n when \"languages_div\" \n user_language = contact.user_languages.build(params[:user_language])\n #============== End for contact languages ======= \n end\n contact.save\n return render :partial => \"profile\", :locals => {:contact => contact}\n end", "def update\n logger.debug '> Users: update'\n Accounts.new.update(params.merge(remember_token: rem_tokgen)) do |tmp_account|\n sign_in tmp_account\n @success = \"#{Accounts.typenum_to_s(params[:myprofile_type])} updated successfully.\"\n @error = 'Oops! Please contact support@megam.io'\n end # if current_password_ok? #removed it for now. does not work otherwise. need to come back.\n @msg = { title: 'Profiles', message: \"#{Accounts.typenum_to_s(params[:myprofile_type])} updated successfully!.\", redirect: '/', disposal_id: 'app-1' }\n respond_to do |format|\n format.js do\n respond_with(@msg, @success, @error, account: current_user, api_key: current_user.api_key, myprofile_type: params[:myprofile_type], layout: !request.xhr?)\n end\n end\n end", "def update\n @tags = params[:tags].split(',')\n @tagged = []\n for prev in Tagging.where(taggable_id: @profile.user.id, taggable_type: 'User')\n prev.destroy\n end\n @caller = params[:profile][:caller]\n @profile = current_user.profile\n if !params[:ja_birth_yyyy].blank?\n @profile.birthdate = JalaliDate.to_gregorian(params[:ja_birth_yyyy],params[:ja_birth_mm],params[:ja_birth_dd])\n end\n respond_to do |format|\n if @profile.update(profile_params)\n for tag in @tags\n if !tag.blank?\n @tag = Tag.where(title: tag).first\n if @tag.blank?\n @tag = Tag.create(title: tag, user_id: current_user.id)\n end\n @tagging = Tagging.where(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id).first\n if @tagging.blank?\n @tagging = Tagging.create(taggable_id: @profile.user.id, taggable_type: 'User', tag_id: @tag.id)\n end\n end\n end\n if params[:caller] == 'reg'\n format.html { redirect_to '/registeration_steps?step=2&name='}\n else\n if params[:profile][:avatar].blank?\n format.html { redirect_to '/profiles?profile_id='+@profile.id.to_s, notice: :Profile_was_successfully_updated }\n else\n format.html { redirect_to '/profiles/cropper/'+@profile.id.to_s}\n end\n end\n format.json { render action: 'crop' }\n if @profile.cropping?\n format.js { render action: 'crop', :locals => {:caller => @caller, :id => @profile.id} }\n else\n format.js { render action: 'update' }\n end\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n case form[:steps].last[:option].to_i\n when 1\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n user.save!\n\n form[:user] = user\n view_profile(form)\n form\n when 2\n view_profile(form)\n else\n form[:flash_msg] = 'Wrong option entered, please retry.'\n edit_profile(form)\n end\n end", "def edit\n render partial: \"metadata_profiles/form\",\n locals: { profile: @profile }\n end", "def update\n respond_to do |format|\n if @profile.update_attributes profile_params\n format.html { redirect_to(@profile, notice: 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n @original_profile = Profile.find(@profile.id)\n format.html { render action: \"edit\" }\n format.xml { render xml: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def enter_profile_info(firstname, gender, grade, month, day, year)\n # Input child profile info\n create_profile_form.first_name_txt.set firstname\n create_profile_form.gender_cbo.select gender\n create_profile_form.grade_cbo.select grade\n create_profile_form.month_cbo.select month\n create_profile_form.day_cbo.select day\n create_profile_form.year_cbo.select year\n\n # Click Save and Continue button\n create_profile_form.save_btn.click\n sleep(2)\n end", "def update\n respond_to do |format|\n @profile.slug=nil\n if @profile.update(profile_params)\n @profile.user.cedula = @profile.cedula\n @profile.user.save\n ruta = @profile==current_user.profile ? my_profile_path : @profile\n format.html { redirect_to ruta, notice: 'El perfil fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @tags_tools = Person.tool_counts.sort{|a,b| a.name<=>b.name}\n @tags_expertise = Person.expertise_counts.sort{|a,b| a.name<=>b.name}\n\n @person = Person.find(params[:id])\n\n possible_unsaved_data = \"unsaved_#{@person.class.name}_#{@person.id}\".to_sym\n if session[possible_unsaved_data]\n # if user was redirected to this 'edit' page from avatar upload page - use session\n # data; alternatively, user has followed some other route - hence, unsaved session\n # data is most probably not relevant anymore\n if params[:use_unsaved_session_data]\n # NB! these parameters are admin settings and regular users won't (and MUST NOT)\n # be able to use these; admins on the other hand are most likely to never change\n # any avatars - therefore, it's better to hide these attributes so they never get\n # updated from the session\n #\n # this was also causing a bug: when \"upload new avatar\" pressed, then new picture\n # uploaded and redirected back to edit profile page; at this poing *new* records\n # in the DB for person's work group memberships would already be created, which is an\n # error (if the following 3 lines are ever to be removed, the bug needs investigation)\n session[possible_unsaved_data][:person].delete(:work_group_ids)\n session[possible_unsaved_data].delete(:can_edit_projects)\n session[possible_unsaved_data].delete(:can_edit_institutions)\n\n # update those attributes of a person that we want to be updated from the session\n @person.attributes = session[possible_unsaved_data][:person]\n @expertise_autocompleter_selected_ids = session[possible_unsaved_data][:expertise_autocompleter_selected_ids]\n @expertise_autocompleter_unrecognized_items = session[possible_unsaved_data][:expertise_autocompleter_unrecognized_items]\n # @person.tool_list = session[possible_unsaved_data][:tool][:list]\n # @person.expertise_list = session[possible_unsaved_data][:expertise][:list]\n end\n\n # clear the session data anyway\n session[possible_unsaved_data] = nil\n end\n end", "def edit_profile(opts = {})\n clear_screen(opts)\n form = View.edit_profile(opts)\n\n user = User.new(\n name: form[:name],\n email: form[:email],\n phone: form[:phone],\n password: form[:password]\n )\n\n case form[:steps].last[:option].to_i\n when 1\n error = user.validate\n if error.empty?\n user.save!\n form[:user] = user\n form[:flash_msg] = \"Your account was successfully updated\"\n view_profile(form)\n else\n form[:flash_msg] = [\"Your account was not successfully updated\"]\n form[:flash_msg] << error\n view_profile(form)\n end\n when 2\n view_profile(form)\n else\n form[:flash_msg] = \"Wrong option entered, please retry.\"\n edit_profile(form)\n end\n\n form\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def profile\r\n if request.post?\r\n @customer.update_attributes :email => params[:customer][:email], :phone => params[:customer][:phone]\r\n @store_user.my_account_log(@customer,\"Update Profile Email: #{@customer.email} Phone: #{@customer.phone}\")\r\n @customer.update_ax\r\n end\r\n end", "def notify_admin_profile_changes(presenter)\n Notification.notify_admin(\"#{presenter.first_name} #{presenter.last_name} has submitted a profile for approval\", presenter_profile_path(presenter), :system)\n end", "def update\n @profile = current_user.profile\n respond_to do |format|\n if @profile\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n else\n format.html { render :text => \"You currently do not have a profile.\" }\n end\n end\n end", "def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end", "def update\n @profile = self.current_member.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end", "def update \n if params[:profile][:paypal_payment_token].present?\n if @profile.update_with_payment\n redirect_to @profile, notice: 'Payment was successfully updated.'\n else\n joblog params[:profile]\n redirect_to @profile, warning: 'something broke'\n end\n else\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render json: @profile.id, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n# if @profile.update(profile_params)\n# redirect_to @profile, notice: 'Profile was successfully updated.'\n# else\n# render :edit, warning: 'something dun fucked up'\n# end\n end\n end", "def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @profile = current_user.profile\n if @profile.update(profile_params)\n format.html { redirect_to '/home', notice: 'El perfil fue actualizado correctamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update_profile\n @date = Date.civil(*params[:event].sort.map(&:last).map(&:to_i))\n if current_user.user_record.update_attributes(\n :contact_number => params[:contact_number],\n :date_of_birth => @date,\n :blood_group => params[:blood][:id],\n :gender => params[:gender],\n :address => params[:address])\n flash[:notice] = \"Profile updated successfully...\"\n redirect_to (\"/patients/details_view_patient\")\n else\n flash[:notice] = \"Failed to update Profile...\"\n redirect_to :controller => :patients\n end\n end", "def update\n respond_to do |format|\n if @profile.update(pro_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n @profile.approved_by = \"#{current_user.first_name} #{current_user.last_name}\"\n else\n @profile.approved_by = \"\"\n end\n\n if profile_params[:status] == \"Pending\" # This condition sends an email if profile status is set to pending\n NotificationMailer.new_pending(@profile).deliver_now\n end\n\n respond_to do |format|\n if @profile.update(profile_params)\n if profile_params[:status] == \"Approved\"\n format.html { redirect_to profiles_url, notice: '*Profile was successfully approved.' }\n elsif profile_params[:status] == \"Rejected\"\n format.html { redirect_to profiles_url, notice: '*Profile was rejected.' }\n else\n format.html { redirect_to @profile, notice: '*Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n end\n if profile_params[:status] == \"Approved\" || profile_params[:status] == \"Rejected\"\n NotificationMailer.new_response(@profile).deliver_now\n end\n else\n @sections = Section.all\n @projects = Project.where(user_id: current_user.id)\n @employment = Employment.where(user_id: current_user.id)\n @education = Education.where(user_id: current_user.id)\n @certifications = Certification.where(user_id: current_user.id)\n @customs = Custom.where(user_id: current_user.id)\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Din profil uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @presenter = find_presenter\n if @presenter.presenter_profile.nil?\n new_profile = profile_params\n new_profile[:bio_edit] = sanitize_bio(new_profile[:bio_edit])\n @presenter_profile = @presenter.build_presenter_profile(new_profile)\n #submit to admin for approval\n if params[:submit]\n @presenter_profile.status = :pending_admin\n if @presenter_profile.save\n flash[:info] = \"Profile submitted to admin for approval\"\n notify_admin_profile_changes(@presenter)\n redirect_to root_url\n else\n render 'new'\n end\n #save draft\n else\n @presenter_profile.status = :new_profile\n if @presenter_profile.save\n flash[:info] = \"Profile draft saved. Go to edit profile to continue editing.\"\n redirect_to root_url\n else\n render 'new'\n end\n end\n else\n redirect_to edit_presenter_profile_path(@presenter)\n end \n end", "def update\n begin\n @profile.update!(metadata_profile_params)\n rescue => e\n render partial: \"shared/validation_messages\",\n locals: { object: @profile.errors.any? ? @profile : e },\n status: :bad_request\n else\n toast!(title: \"Profile updated\",\n message: \"The metadata profile \\\"#{@profile.name}\\\" has been \"\\\n \"updated.\")\n render \"shared/reload\"\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html {redirect_to payments_profiles_path}\n else\n format.html {redirect_to :back, flash: {error: \"Error saving payment profile\"}}\n end\n end\n end", "def edit\r\n jump_to(\"/profiles/#{session[:account_id]}/basic\")\r\n end", "def updateProfile\r\n errors ||= Array.new\r\n\t\tdataHash = {\r\n user_id: params[:user].id,\r\n asset_id: params[:asset_id],\r\n\t\t\tfname: params[:fname],\r\n\t\t\tlname: params[:lname],\r\n\t\t\tgender: params[:gender],\r\n\t\t\tbio: params[:bio],\r\n\t\t\tfamilyStatus: params[:familyStatus],\r\n\t\t\tbdate: params[:bdate]\r\n\t\t}\r\n\t\terrors = Api::Init.MembersControl.checkProfileParams(dataHash)\r\n\t\tif errors.count != 0 \r\n\t\t\trender :json => Api::Init.ShowErrorJson(API_CODE_ERRORS['Services']['Global']['profile_errors'],I18n.t(\"errors.messages.users.profile_errors\"), errors).to_json\r\n else\r\n \tuserProfileObject = UsersProfile.byUser(params[:user].id).first\r\n userProfileObject.updateProfile(dataHash)\t\r\n self.default_response\r\n end\r\n\tend", "def profile\n \n end", "def user_profile \n system 'clear'\n CoffeeMan.stay_logo\n choice = @prompt.select(\"~P R O F I L E~\") do |menu|\n puts \"HELLO #{@userid.username}\".colorize(:light_blue)\n menu.choice \"Update Username\", -> {change_username}\n menu.choice \"Update Password\", -> {change_password}\n menu.choice \"Delete Account\", -> {delete_profile}\n menu.choice \"Back\", -> {main_menu}\n end\n sleep 1\n end", "def profile_update(user_to_update,user_with_session_to_use)\n send_as :profile\n from user_with_session_to_use\n to user_to_update\n profile render(:action=>\"/users/profile\",:assigns=>{:user=>user_to_update})\n profile_action \"A string\"\n mobile_profile render(:partial=>\"mobile\",:assigns=>{:user=>user_to_update})\n end", "def update\n @profile = Profile.find(params[:id])\n work_name\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to(@profile, :notice => 'Profile ha sido modificado.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile_info\n info = provider_class.profile_info\n self.update_attributes(info)\n end", "def on_update_alert(profile)\n\t\t@profile = profile\n\t\tsendgrid_category 'Profile Update Alert'\n\t\tsendgrid_unique_args :profile_id => @profile.id\n\t\tmail \n\tend", "def update\n authorize @profile\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to quit_user_profile_path , notice: \"Profile: #{I18n.t('helpers.saved')}\" }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # render :text => \"<pre>#{params.to_yaml}</pre>\" and return\n @profile = Profile.find(params[:id])\n # @profile = Profile.find_or_create_by_user_id(@user.id)\n unless params.empty?\n @profile.update_attributes(params[:profile])\n @profile.user.update_attributes(params[:user])\n end\n respond_to do |format|\n if @profile.errors.empty? && @profile.user.errors.empty?\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors + @profile.user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @profile.update(req_params)\n redirect_to show_path, notice: 'Profile was successfully updated.'\n else\n respond_with_submission_error(@profile.errors.messages, edit_path)\n end\n end", "def update_profession\n @general_info = GeneralInfo.find_by(userKey: session[:current_user_key])\n \n if @general_info.update_attribute(specific_profile_id, :specific_profile_id)\n redirect_to '/show_profile'\n else\n render :action => 'edit_profession'\n end\n end", "def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to @profile, :notice => 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_profile_photo\n\t\t# checking the profile setting is present or not\n\t\tif !params[:profile_setting].present?\n\t\t\t# if present then navigate to the page\n\t\t\tredirect_to :back \n\t\telse\n\t\t# update the profile update images like cover photo and profile photo\n\t\t @profile_photos = @user.update_attributes(profile_setting_photo_params)\n\t\t # redirect to the user profile app page\n\t\t redirect_to user_profile_data_profile_path\n\t\tend\n\tend", "def update\n if @profile.update(profile_params)\n redirect_to @profile\n else\n render :edit\n end\n end", "def update\n authorize! @consumer\n\n if @consumer.update(change_params)\n redirect_to @consumer, notice: t('messages.user.profile_updated')\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n if @user.update(profile_params.except(:about_attach)) && @user.handle_about_attach(profile_params[:about_attach])\n format.html { redirect_to my_profile_path, notice: 'Profile was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: 'my_profile' }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def person_profile_edit\n @category = EventCategoryMaster.find_category\n show_interest_data();\n @state1 = State.find_state(@location.country_id)\n respond_to do |format|\n format.html {render :editing_user_profile}\n format.xml { render :xml => @user }\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to @profile, notice: t(\"controller.shared.flash.update.notice\", model: pick_model_from_locale(:profile)) }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = current_user.profile\n assign_params_to_attributes\n if @profile.update_attributes(params[:profile])\n if params[:profile][:zip].present?\n current_user.update_attribute(:zip, params[:profile][:zip])\n end\n flash[:notice] = I18n.t('profile.update.notice')\n # redirect_to user_path(current_user)\n redirect_to edit_user_profile_path(current_user, @profile)\n else\n @user = current_user\n assing_attributes_to_params\n flash.now[:error] = I18n.t('profile.update.error')\n render :action => \"edit\"\n end\n end", "def update\n respond_to do |format|\n # This must be update_attributes, to do validations\n if @profile.update(profile_params)\n format.html { redirect_to profile_home_path(@profile.site_identifier), notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to vanity_profile_path(:id => @profile.user.name), notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to edit_profile_path(current_user.profile), notice: t('controller.profiles.update.success') }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @profile = Profile.find(params[:id])\n\t\t\n\t\t# Check to see if this user matches the profile, if not don't let them do anything\n\t\tif @profile.id != Profile.find_by_user_id(current_user.id).id\n \tredirect_to :permission_error\n end\n\t\t\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Your profile was successfully updated'\n format.html { render action: 'edit', notice: 'Profile was successfully updated' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end", "def form\n convention.then(&:user_con_profile_form)\n end", "def update\n respond_to do |format|\n if @profile.update_attributes(profile_params)\n format.html {\n flash[:notice] = t('Profile was successfully update.')\n redirect_to home_path\n }\n format.json { render json: {ok: true}, status: :ok }\n else\n format.html { redirect_to profile_edit_url, notice: t('Profile not saved !') }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n \n @role = Role.find(:all)\n @current_object = Profile.find(params[:id])\n #respond_to do |format|\n @current_object.full_name_separation(params[:profile_full_name]) \n \n \n \n if @current_object.update_attributes!(params[:profile])\n\t\t\t\t@current_object.create_profile_workspace if @current_object.profile_workspace.nil?\n\t\t\t\tif user = @current_object.user\n\t\t\t\t\tuser.email = @current_object.email_address\n\t\t\t\t\tuser.system_role_id = params[:system_role_id] if params[:system_role_id]\n\t\t\t\t\tuser.save\n\t\t\t\tend\n # flash[:notice] = 'Profile was successfully updated.'\n # if format.xhr?\n \n # else\n # format.html {} #{ redirect_to admin_profile_path(@current_object.id) }\n # end\n # format.xml { head :ok }\n # p \"sssssssssssssssssss\"\n # else\n # p \"wwwwwwwwwwww\"\n # flash[:notice] = \"Problem in saving the profile \"+@current_object.errors.first[1]\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @current_object.errors, :status => :unprocessable_entity }\n # end\n \n end\n render :update do |page|\n page['fragment-1'].replace_html(:partial => 'user_information') \n # page[\"show_message_details\"].replace_html(:partial =>'message_sent_detail', :object =>@message)\n end\n \n \n end", "def update\n respond_to do |format|\n if @profile.update(profile_params)\n format.html { redirect_to [@stakeholder, @profile], notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: [@stakeholder, @profile] }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7027984", "0.68597144", "0.6850021", "0.67736727", "0.6676639", "0.66017526", "0.6590018", "0.65875506", "0.6583135", "0.65780526", "0.656813", "0.6565079", "0.6524092", "0.6472167", "0.6432418", "0.6392501", "0.6387466", "0.6374663", "0.6370971", "0.6366417", "0.6359698", "0.63084286", "0.63026106", "0.6296545", "0.6296094", "0.629385", "0.62902135", "0.62883615", "0.6278883", "0.62770647", "0.6265138", "0.6261502", "0.6256006", "0.6254539", "0.6254358", "0.623346", "0.6210607", "0.620658", "0.62063366", "0.61994386", "0.6182415", "0.618117", "0.61750835", "0.6171364", "0.61695457", "0.6167007", "0.61620235", "0.6158602", "0.6148222", "0.61470866", "0.6144942", "0.61381614", "0.611914", "0.6118021", "0.6114455", "0.60978556", "0.6095484", "0.60891193", "0.6085962", "0.60741264", "0.607201", "0.6071892", "0.6071805", "0.60714674", "0.60628927", "0.6057281", "0.60519373", "0.6042086", "0.60363007", "0.60239005", "0.6019643", "0.601695", "0.6012952", "0.60088456", "0.60030985", "0.5997176", "0.59968644", "0.5991998", "0.59896994", "0.5985236", "0.5983612", "0.59821004", "0.5976463", "0.5972678", "0.59723276", "0.596944", "0.5968776", "0.59467864", "0.5946397", "0.59437746", "0.5943686", "0.5942233", "0.5935231", "0.59308845", "0.5930539", "0.592717", "0.5919399", "0.5915535", "0.5914502", "0.59125376" ]
0.6425936
15
Update user if they sent user params, otherwise return true. This is important because this controller is also handling removing trophies. (but we should move that to a different controller)
def conditionally_update return true unless params[:user] @user.update(user_params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n\n # below line calls a function, user_param(). user_param() does the validation. it sees whether the user entered the correct params. We dont't want the current user to put any params and do a request. only correct params should be allowed\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[\"user\"].each do |key, value| \n value.strip!\n if value == \"\"\n params[\"user\"].delete(key)\n end\n end\n \n params[\"user\"][\"email\"].downcase!\n \n @prev_user_info = User.find_by_id(params[\"user\"][\"id\"])\n existing_user = User.find_by_id(params[\"user\"][\"id\"])\n \n if !params[\"user\"][\"password_hash\"].blank?\n existing_user.password = params[\"user\"][\"password_hash\"]\n end\n\n if existing_user.update_attributes(params[\"user\"])\n @object = existing_user\n \n render \"user_success\"\n\n else\n @error_messages = existing_user.errors.to_a\n @user = User.new\n @new_item = User.find_by_id(params[\"id\"])\n\n render \"edit\"\n end\n end", "def update\n check_user\n if @user.update(user_params)\n redirect_to @user, notice: 'User was successfully updated.' and return\n end\n end", "def update\n\n authorize! :manage, @user\n \n respond_to do |format|\n\n if (current_user.id == @user.id) \n # Don't let a non-administrator assign themselves admin/download/viewing priviledges.\n # (Also) Don't let the current user disable their own admin account!\n params[:user].delete \"is_administrator\"\n if ! current_user.is_administrator\n params[:user].delete \"is_data_downloader\"\n params[:user].delete \"is_data_viewer\"\n end\n end \n \n\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n # format.json { render :show, status: :ok, location: @user }\n format.json { respond_with_bip(@user) }\n else\n format.html { render :edit }\n # format.json { render json: @user.errors, status: :unprocessable_entity }\n format.json { respond_with_bip(@user) }\n end\n end\n end", "def update\n updated_user = user_params\n\n if params[:user][:do_not_email] == '1'\n updated_user[:marketing] = '0'\n updated_user[:articles] = '0'\n updated_user[:digest] = '0'\n end\n\n user = Token.consume(params[:user][:nonce])\n\n if user == nil or user.id.to_s != params[:id] or params[:user][:url_email] != user.email\n flash[:alert] = 'Access denied!'\n redirect_to action: 'edit'\n return\n elsif user.email != params[:user][:email]\n email_already_exists = email_already_exists?(params[:user][:email])\n if email_already_exists\n redirect_to action: 'edit'\n return\n end\n else\n respond_to do |format|\n if @user.update(updated_user)\n format.html { redirect_to action: 'index' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user && @user == current_user\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :_user }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to_index\n end\n end", "def update\n unless create_user\n respond_to do |format|\n format.json { render json: { error: 'User is not logged in!' }, status: :unprocessable_entity }\n end\n return\n end\n logger.debug '@user is found in db!'\n\n respond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n user == identity.user\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n @edit = true # Variable criated to differentiate edit and create when entering user edit _form.html.erb\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if check_user_write_access\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 :edit }\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def update\n authorize! if @user != current_user\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # only update the values that have things filled in\n updatedValues = params[:user]\n updatedValues.keep_if { |key, value| !value.blank? }\n\n respond_to do |format|\n if @user.update_attributes(updatedValues)\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\n if (session[:user_id] != @user.id.to_i)\n respond_to do |format|\n format.html { redirect_to users_path ,notice:\"You can't edit other user's user\" }\n format.json { head :no_content }\n end\n\n return\n\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\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", "def update\n respond_to do |format|\n if self.user_owner? && @user.update(user_params)\n format.html { redirect_to @user, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @update_success = @user.update(user_params)\n super\n end", "def update\n \tnew_params = user_params.delete_blanks!\n\n \trespond_to do |format|\n if @user.update_attributes(new_params)\n \tformat.html { redirect_to edit_user_path(@user.id), notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\nend", "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.update_attributes!(user_params)\n \n render nothing: true, status: :no_content\n end", "def update_user\n end", "def update\n if @user.update_attributes(user_params)\n head :ok\n else\n head :internal_server_error\n end\n end", "def update\n @user = find_user(params[:username])\n\n if @user.update(user_params, current_user)\n redirect_to users_path\n else\n render('edit', status: :unprocessable_entity)\n end\n end", "def update\n @user = User.find(params[:id])\n success = false\n if (session[:user] == @user || session[:user].admin == 1)\n success = @user.update_attributes(params[:user])\n if (success && session[:user].id == @user.id)\n session[:user] = @user\n end\n end\n \n respond_to do |format|\n if success\n flash[:notice] = \"User was successfully updated.\"\n if (session[:user] == @user)\n format.html { redirect_to (posts_url) }\n else\n format.html { redirect_to (users_url) }\n end\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 # Listing 9.14: Finding the correct user is now handled by the correct_user before_action.\n if @user.update_attributes(user_params)\n # Listing 9.10: Handle a succesfull update\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n\t\tif !current_user\n\t\t\tredirect_to '/'\n\t\t\treturn\n\t\tend\n\t\trespond_to do |format|\n\t\t\tif current_user && is_this_user && @user.update(user_params)\n\t\t\t\tformat.html { redirect_to @user, notice: '<span class=\"alert alert-success\">User was successfully updated.</span>' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @user }\n\t\t\telse\n\t\t\t\tformat.html { render :edit }\n\t\t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n @user = User.find_by_id(params[:id])\n if @user == @currentUser #only allow update if it is the current user editting\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = \"User #{@user.username} was updated successfully!\"\n format.html { redirect_to(:action => 'index') }\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 else\n redirect_to(:action => \"index\")\n end\n end", "def update\n if not check_logged_in then\n return\n end\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 if @current_user && @current_user.update(user_params)\n flash[:success] = \"Saved\"\n redirect_to edit_user_path(@current_user.id)\n else\n flash.now[:warning] = 'Please fill in all fields.'\n render :edit, status: :bad_request\n end\n end", "def custom_update\n user = User.find(params[:id])\n user.update_attributes(params[:user])\n render :text => true\n end", "def update\n if user_params[:password].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n\n if needs_password?(current_user, user_params)\n save = current_user.update(user_params)\n else\n save = current_user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if save\n format.html { redirect_to current_user.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: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:id] != current_user.id && current_user.is_admin == false\n \traise \"You are not authorized to access this function\"\n end \n @user = current_user\n @user.update_attributes(params[:user])\n respond_with(@user)\n end", "def update\n authorize! :update, @user\n if @user.update(user_params)\n flash.now[:notice] = '@user was successfully updated.'\n else\n flash.now[:alert] = @user.errors.full_messages.first\n end\n end", "def update\n @user = User.find(session[:user])\n\n respond_to do |format|\n if @user.update_attributes(user_params)\n session[:anon_user] = false\n format.html { redirect_to homepage_path, notice: '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 respond_to do |format|\n if session[:dual_role]\n if !params[:is_realtor] || !params[:is_hunter]\n session[:dual_role] = false\n end\n end\n if @user.update_without_password(user_update_params)\n format.html {redirect_to @user, notice: 'User was successfully updated.'}\n format.json {render :show, status: :ok, location: @user}\n else\n format.html {render :edit}\n format.json {render json: @user.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n #Changed so it stays\n\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n\n # format.html { redirect_to @user, notice: 'User was successfully updated.' }\n# format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\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 puts \"current user\"\n puts @user.id\n puts current_user.id\n if current_user.admin || @user.id == current_user.id\n if user_params['is_disabled']\n @user.tokens = nil\n end\n if @user.update(user_params)\n render json: @user\n else\n puts @user.errors.full_messages\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: @user.errors, status: :bad_request\n end\n end", "def update\n if @user.update(user_params)\n respond_with(@user, location: users_url, notice: 'User was successfully updated.')\n else\n respond_with(@user)\n end\n end", "def update \n if @user.update(user_params)\n respond_with @user,:status=> \"updated\" \n else\n respond_with @user.errors,:status=> \"failed\" \n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender :show, status: :ok, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n if (!@isLogin || !@isValidUser)\n return\n end\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @user\n if @user.update_attributes(user_params)\n redirect_to core_user_path(@user)\n else\n render :edit\n end\n end", "def update\n @houses = House.all\n\n if user_params[:password].blank?\n result = @user.update_without_password(user_params)\n else\n if current_user.id == @user.id\n result = @user.update_with_password(user_params)\n else\n result = @user.update_attributes(user_params)\n end\n end\n\n\n respond_to do |format|\n if result\n format.html { redirect_to @user, notice: 'User (' + @user.name + ') was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n if params[:id]\n @user = User.find(params[:id])\n else\n @user = current_user\n end\n\n respond_to do |format|\n if @user.id == current_user.id and @user.update_attributes(User.from_params(params))\n format.json { head :no_content }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(filter_params(user_params))\n format.html { redirect_to users_path, notice: \"User [#{@user.username}] 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 if @user.update(user_params)\n render :show, status: :ok, location: @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 :show, status: :ok, location: @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 :show, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n redirect_to edit_user_path (@user)\n end\n end", "def update\n authorize! :edit, User\n @user = User.find(params[:id])\n return_url = users_url(:use_session => true)\n respond_to do |format|\n if @user.update_attributes(params[:user])\n do_extra_actions\n format.html { redirect_to return_url }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n session[:user_username] = user_params[:username]\n session[:user_isAdmin] = user_params[:isAdmin]\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n @nav = 'show_nav'\n if (@local_manager.slave?)\n @nav = 'show_nav'\n flash[:warning] = \"This action is prohibited on slave systems.\"\n format.html { redirect_to user_url(@user) }\n format.xml { render :xml => '<errors><error>This action is prohibited on slave systems.</error></errors>', :status => :not_acceptable }\n elsif (@user.admin? && @session_user.user_admin?)\n flash[:warning] = \"You do not have permission to modify administrator accounts.\"\n format.html { redirect_to user_url(@user) }\n format.xml { render :xml => @user.errors, :status => :not_acceptable }\n elsif @user.update_attributes(params[:user])\n @local_manager.log(:username => @session_user.username, :user_id=> @user.id, :message => \"Edited user #{@user.username}.\")\n format.html { redirect_to user_url(@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 if @user.update(user_params)\n render :show\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n # check_user \n get_preferences\n include_role_name\n if @user.update(user_params)\n render json: {\n status: \"Success\",\n message: \"User updated.\",\n data: {\n user: @user,\n preferences: { \n city: @cities,\n rent: @rents,\n stay_period: @stay_periods,\n property_type: @property_types\n },\n role: @role\n }\n }, status: :ok\n else\n render json: {\n status: \"Error\",\n message: \"User not updated.\",\n data: @user.errors\n }, status: :unprocessable_entity\n end\n end", "def update\n if is_me? params[:id] || is_admin?\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 else\n redirect_to :root\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = \"updated!\"\n redirect_to @user\n else\n render 'edit'\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\n if current_user != @user\n redirect_to users_path\n end\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user_or_guest\n respond_to do |format|\n if @user.update_attributes(user_params)\n format.html { redirect_to(edit_options_path, notice: t('options.edit.updated')) }\n format.xml { head :ok }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @user.errors, status: :unprocessable_entity }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User info was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n #unless @user.update(user_params)\n #respond_to do /format/\n #format.html { render :edit }\n #format.json { render json: @user.errors, status: :unprocessable_entity }\n #end\n #else\n #redirect_to @user\n #flash[:success] = 'User Info Was Successfully Updated.'\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 respond_to do |format|\n # Controller should handle attribute whitelisting, not the Model.\n params[:user].slice!(:email, :password, :password_confirmation)\n\n if current_user.update_attributes params[:user]\n format.html { redirect_to current_user }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => :edit }\n format.json { render :json => current_user.errors, :status => :unprocessable_entity }\n format.xml { render :xml => current_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render status: :ok\n else \n render status: bad_request\n end\nend", "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 successfully_updated = if needs_password?\n @user.update(user_params)\n else\n @user.update_without_password(user_params)\n end\n\n respond_to do |format|\n if successfully_updated\n format.html { redirect_to manage_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]) <-- not needed; @user defined in correct_user \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile Updated\"\n redirect_to @user\n # handle this later\n else\n render \"edit\"\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\n @user.active = false\n @user.pending = false\n @user.save\n end\n format.json { render json: {:status => :ok}}\n end\n end", "def update\n return unless user_is_editing_self\n respond_to do |format|\n if @user.update(user_update_params)\n format.html { redirect_to dashboard_path, flash: { notice: 'Account successfuly changed' } }\n format.json { render json: @user }\n else\n respond_to_validation_error(format: format, model: @user)\n end\n end\n end", "def update\n @user = current_user\n if @user.update(user_params)\n redirect_to root_url\n else\n render 'edit'\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n #head :no_content\n render json: @user, status: :accepted, location: @user #sera? status accepted? \n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n redirect_to root_path\n else\n flash[:error] = \"bad params\"\n end\n end", "def update\n if @user.update(user_params)\n render json: {message: \"user updated successfuly\"}\n else\n render json: {message: \"Error\"}\n end\n end", "def update\n @user = @recruiter.user\n respond_to do |format|\n if @recruiter.update_attributes(params[:recruiter]) && @user.update_attributes(params[:user])\n @user.update_attribute(:is_admin, params[:user][:is_admin]) if current_user.is_admin # is_admin is non accessible\n format.html { redirect_to @recruiter, notice: 'Recruiter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recruiter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n !user.nil? and ((user.id == record.user.id) or user.admin?)\n end", "def update\n\n #Make sure only logged in admins can manipulate users\n\n if @loggedinuser && @loggedinuser.authorizationlevel >= 4\n #return render :text => params\n @user = User.find(params[:user][:id])\n if @user.update_attributes(params[:user])\n redirect_to :action => 'index'\n else\n render 'edit'\n end\n else \n redirect_to '/'\n end\n end", "def update\n if @user\n @user.update(user_params)\n render json: @user, serializer: UserSerializer, message: 'user succefully update', status: 200\n else\n render json: { error: 'unable update' }, status: 400\n end\n end", "def update\n authorize @user\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render json: @user, status: :ok }\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\n @user = User.find(params[:id])\n redirect_to user_path @user if @user.update(permit_update_params)\n end", "def update\n authorize User\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, @user \n\n respond_to do |format|\n if @user.update(allowed_params)\n format.html { redirect_to redirect_to_back, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update?\n !user.nil? && user.admin?\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n members = Member.all\n available = false\n members.each do |current_member|\n if current_member.user_id == @user.id\n available = true\n end\n end\n if available == false && @user.role != TEACHER\n @member = Member.new\n @member.user_id = @user.id\n @member.project_id = session[:selected_project_id]\n @member.is_enabled = true\n @member.section_number = params['section_number']\n @member.save\n end\n if @user.role != TEACHER\n member = Member.find_by(user_id: @user.id, project_id: get_selected_project)\n member.section_number = params['section_number']\n member.save\n end\n \n if @user.role == TEACHER\n format.html { redirect_to users_teachers_path, notice: \"#{@user.first_name} was successfully updated.\"}\n else\n format.html { redirect_to users_path, notice: \"#{@user.first_name} was successfully updated.\"}\n format.json { head :no_content }\n end\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 flash[:success] = \"Profile updated\"\n redirect_to :action => 'edit'\n else\n render 'edit'\n end \n \n end", "def update\n respond_to do |format|\n if @user_user.update(user_user_params)\n format.html { redirect_to @user_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_user }\n else\n format.html { render :edit }\n format.json { render json: @user_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if params[:user][:password].present? ? @user.update_attributes(params[:user]) : @user.update_without_password(params[:user])\n flash[:notice] = 'User was successfully updated.'\n @changed << @user.id\n \n sign_in @user, bypass: true if current_user.id == @user.id\n\n format.html { redirect_to :back }\n format.js { render 'shared/index'; flash.discard }\n format.json { head :no_content }\n else\n @edited << @user.id\n @expanded << @user.id\n\n format.html { render action: 'edit', template: 'shared/edit' }\n format.js { render 'user' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @user\n\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if session[:user_id] == @user.id or session[:uname] == \"admin@admin.com\"\n \n respond_to do |format|\n if @user.update(user_params)\n \n format.html { redirect_to dashboard_login_path, notice: \"El usuario #{@user.username} fue actualizado exitosamente.\" }\n format.json { render :show, status: :ok, location: @user }\n else\n \n format.html { redirect_to dashboard_login_path, notice: \"El usuario #{@user.username} no pudo ser actualizado.\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to root_path , notice: \" no esta autorizado para hacer esa accion\"\n end \n end", "def update\n @user = User.find(params[:id])\n u = @user\n u.assign_attributes(params[:user]);\n \n if not(check(u))\n flash.now[:error] = \"error\"# Not quite right!\n render 'new'\n end\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 if @user.update(user_params)\n flash.now[:success] = \"Edit Successed\"\n redirect_to @user\n else\n flash.now[:danger] = \"Edit Failed\"\n render \"edit\"\n end\n end", "def update\n return redirect_to :h_1 unless params[:user]\n\n if params[:user][:username]\n allow = User.username_allowed(params[:user][:username], :current_user => current_user)\n params[:user][:username] = allow[:allowed] ? allow[:regular] : \"\"\n end\n \n condition = params[:user][:username] || params[:user][:email] || params[:user][:password]\n \n updated = current_user.update_attributes params[:user] if !condition\n updated = current_user.update_with_password params[:user] if condition\n \n unless updated\n @errors = current_user.errors\n #cookies[:flavour] = current_user.flavour#why?\n end\n if updated\n set_current_locale current_user.locale\n set_current_time_zone current_user.time_zone\n end\n redirect_to request.referrer\n end", "def update\n respond_to do |format|\n if current_user.update(user_params)\n format.json {\n render json: {\n status: 'success',\n data: current_user\n },\n status: :ok\n }\n else\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorized_user_params = user_params\n authorized_user_params.delete(:role_ids) unless policy(@user).manager?\n\n if @user.update(authorized_user_params)\n respond_successfully I18n.t('integral.backend.users.notification.edit_success'), backend_user_path(@user)\n else\n respond_failure I18n.t('integral.backend.users.notification.edit_failure'), 'edit'\n end\n end", "def update\n user = User.find(params[:id])\n\n deny_wrong_user if !current_user?(user)\n\n if user.update(user_params)\n redirect_to user, notice: 'User was successfully updated.'\n else\n flash[:errors] = user.errors.full_messages\n redirect_to edit_user_path(params[:id]), alert: 'User was not updated'\n end\n end", "def update\n if @user.update(user_params_wa_np)\n flash[:info] = \"User was successfully updated.\"\n redirect_to @user\n # format.json { render :show, status: :ok, location: @user }\n else\n respond_to do |format|\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @current_user.update(user_params)\n render json: { message: 'success' }, status: :ok\n else\n render json: { message: @current_user.errors.full_messages }, status: 422\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(user_params)\n if @user.role == \"instructor\"\n format.html { redirect_to(@user.instructor, :notice => \"Successfully updated #{@user.username}.\") }\n end\n if @user.role == \"parent\"\n format.html { redirect_to(@user.family, :notice => \"Successfully updated #{@user.username}.\") }\n end\n if @user.role == \"admin\"\n format.html { redirect_to(home_path, :notice => \"Successfully updated #{@user.username}.\") }\n end\n format.json { respond_with_bip(@user) }\n else\n format.html { render :action => \"edit\" }\n format.json { respond_with_bip(@user) }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @user.update_attributes(user_params)\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 respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n @info = {:title => \"Update Profile\", :button_name => \"Save\", :new_user => false}\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7609839", "0.74431664", "0.7418892", "0.73948234", "0.736899", "0.7353197", "0.7341994", "0.7333794", "0.73275036", "0.7282859", "0.72778785", "0.7264407", "0.7263601", "0.726248", "0.7256387", "0.7224601", "0.7216373", "0.7198148", "0.7196749", "0.71924657", "0.71870023", "0.7186712", "0.71744627", "0.7171692", "0.716946", "0.7159197", "0.7154763", "0.7149945", "0.7148221", "0.71464086", "0.71321493", "0.71312654", "0.71255094", "0.7124727", "0.71232945", "0.7119806", "0.7119318", "0.7118647", "0.7114481", "0.71099377", "0.7109772", "0.71096724", "0.7109061", "0.71071625", "0.7096517", "0.7096514", "0.709611", "0.709611", "0.709611", "0.7095926", "0.70944643", "0.7090626", "0.70836", "0.7081322", "0.7076344", "0.70672524", "0.70626247", "0.7058868", "0.70586246", "0.70585346", "0.70576024", "0.70550305", "0.7053464", "0.7051493", "0.7048028", "0.7036421", "0.70352775", "0.7032505", "0.70297146", "0.70284307", "0.7025406", "0.70202166", "0.7013064", "0.7012956", "0.70119905", "0.7005559", "0.70027405", "0.69926435", "0.69908965", "0.699006", "0.698732", "0.698571", "0.69841635", "0.6984133", "0.6979125", "0.6977702", "0.6977506", "0.69747543", "0.69739527", "0.6972906", "0.6971707", "0.6971258", "0.69692", "0.6965863", "0.69637364", "0.69632286", "0.6962877", "0.69610995", "0.6960779", "0.69600177" ]
0.8410162
0
if the user wants to remove any trophies, do that here.
def process_trophy_removal params.keys.select { |k, _v| k.starts_with? 'remove_trophy_' }.each do |smash_trophy| smash_trophy = smash_trophy.sub(/^remove_trophy_/, '') current_user.trophies.where(work_id: smash_trophy).destroy_all end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tower\n end", "def remove; end", "def remove; end", "def remove; end", "def remove; end", "def remove_toy(toy)\n if toy.template.identifier != Constants::SCENE_TOY_IDENTIFIER\n undoManager.registerUndoWithTarget(self, selector: 'add_toy:', object: toy)\n @toys_in_scene.delete(toy)\n unredo\n @selected = nil #@current_tool == :grab ? @strokes.most_recent : nil\n @trash_button.enabled = false\n setNeedsDisplay\n end\n end", "def remove!; end", "def remove(*)\n super.tap do\n __debug_sim('USER initiates removal of existing entries.')\n end\n end", "def remove\n\t\tputs \"\\nWhat would you like to remove?\"\n\t\tremove_item = gets.chomp\n\t\tputs \"\\nWARNING: This will delete #{remove_item} from list...are you sure? 'y/n'\"\n\t\tconfirm = gets.chomp\n\t\tif confirm == 'n'\n\t\t\tputs \"#{remove_item} was NOT removed from your Grocery List!\"\n\t\telse\n\t\t\t@grocery_list.remove(remove_item)\n\t\t\tputs \"\\nDeleting #{remove_item} from list...\"\n\t\t\tputs \"#{remove_item.capitalize} was deleted from your Grocery List!\"\n\t\tend\n\tend", "def delete_item (unwanted_item)\r\n if $grocery_list.include? unwanted_item\r\n $grocery_list.delete(unwanted_item)\r\n else\r\n puts \"that item already is not in your list!\"\r\n end\r\nend", "def remove(grocery_list, food)\n\tgrocery_list.delete(food)\nend", "def remove_item\n\n end", "def remove_item(item)\n\t$grocery_list.delete(item)\n\tp \"You crossed off #{item} from your list.\"\nend", "def remove_toy(child_name, toy_name)\n\tchild_id = hash_query(child_name, Children[\"children\"], 'child_name', 'child_id')\n\ttoy_id = hash_query(toy_name, Toys[\"toys\"], 'toy_name', 'toy_id')\n\tLootBag.toy_bag[child_id].delete(toy_id)\n\tupdate_file('bag.yaml', LootBag.toy_bag)\nend", "def remove_item(grocery_list, item)\r\n\tgrocery_list.delete(item)\r\n\tgrocery_list\r\nend", "def remove\n __flag__ :remove\n end", "def remove_from_hot_list\n self.update_attribute(:added_to_hot_list, nil)\n end", "def remove_item_from_list(grocery_list,item_to_delete)\n grocery_list.delete(item_to_delete)\n puts \"No need to pick up #{item_to_delete} anymore.\"\nend", "def remove_item(groceries_list, item_to_remove)\n\t# remove item from list\n\tgroceries_list.delete(item_to_remove)\n\t# return updated list\n\tgroceries_list\nend", "def remove(grocery_list, item)\n grocery_list.delete(item)\nend", "def remove(item, quantity, grocery_list)\n if grocery_list.include?(item) == false \n p \"Item is not on the grocery list.\"\n else \n grocery_list.delete(item)\n end\n #print_list(grocery_list)\nend", "def remove(item, quantity, grocery_list)\n if grocery_list.include?(item) == false \n p \"Item is not on the grocery list.\"\n else \n grocery_list.delete(item)\n end\n #print_list(grocery_list)\nend", "def removeShelf(index)\n if index > @shelves.length\n print \"Please choose a proper shelf\"\n else\n @shelves[index].getCandies.each{ |candy|\n @unShelvedCandies.push(candy)\n candy.unShelf\n }\n @shelves.delete_at(index)\n @shelvesCount -= 1\n end\n end", "def remove_tributary (hose_or_hosename)\n return false if ! @_awaiter\n\n # support being passed either a hose object or a string which we\n # assume to be a hose name. in either case, we'll remove all\n # tributaries that correspond\n if hose_or_hosename.respond_to? :to_str\n name_to_find = hose_or_hosename.to_str\n hs = tributaries.select { |t| t.name == name_to_find }\n else\n hs = tributaries.select { |t| t == hose_or_hosename }\n end\n\n hs.each do |h|\n @_awaiter.remove_hose h\n tributaries.delete h\n end\n return hs.size > 0\n end", "def remove_item(grocery_list,item_name)\r\n\t \r\n\t grocery_list.delete(item_name)\r\n\r\nend", "def remove_item (grocery_list, item)\n\tif grocery_list[item] == nil\n\t\tputs \"Item not on list.\"\n\telse\n\t\tgrocery_list.delete(item)\n\tend\n\treturn grocery_list\nend", "def remove_an_item(grocery_list, item_to_be_removed)\n grocery_list.delete(item_to_be_removed)\n grocery_list\nend", "def clean_trash\n return unless self.active? == false and self.rank === MemberRank.find_by_name('Declined Applicant')\n\n # Don't care about what they want\n self.wishlists.destroy_all\n\n # Don't care about the achievements they mooched from us\n self.completed_achievements.destroy_all\n end", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def remove_item(item)\n $grocery_list.delete(item)\n # puts \"List with #{item} deleted\"\n $grocery_list\nend", "def remove\n uninstall_yri\n uninstall_yard\n end", "def remove_item(grocery_list, item)\n\tif grocery_list.include?(item.to_sym)\n\t\tgrocery_list.delete(item.to_sym)\n\telse\n\t\tputs \"item name invalid\"\n\tend\nend", "def remove_item(grocery_list, item)\r\n grocery_list.delete(item) \r\n \r\nend", "def remove_item(items, groceries_list)\n groceries_list.delete(items)\nend", "def remove_item_from_list(grocery_list, item) \n grocery_list.delete(item) \n grocery_list \nend", "def delete_other_team_if_not_needed\n t = Team.find_by(name: 'Other')\n t.delete if t && t.users.count == 0\nend", "def remove_topping(removed_topping)\n self.toppings = toppings.delete(removed_topping)\n puts \"You've removed #{removed_topping} from your burrito. Your toppings are now: #{self.toppings}.\"\n end", "def remove_object(gameobject)\n @monsters.delete gameobject\n @towers.delete_if { |a,b| b == gameobject }\n @bullets.delete gameobject\n end", "def pbRemovePokemonAt(index)\n return false if index<0 || !$Trainer || index>=$Trainer.party.length\n haveAble = false\n for i in 0...$Trainer.party.length\n next if i==index\n haveAble = true if $Trainer.party[i].hp>0 && !$Trainer.party[i].egg?\n end\n return false if !haveAble\n $Trainer.party.delete_at(index)\n return true\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\nend", "def run_on_removal(paths)\n super\n end", "def remove_item(grocery_list, item_name)\r\n\tgrocery_list.delete(item_name)\r\n\treturn grocery_list\r\nend", "def remove_groceries(list, item)\n\tlist.delete (item)\n\tp list\nend", "def remove(entry); end", "def remove(groceries_list, delete_item)\n\tgroceries_list.delete(delete_item.to_sym) {|item| puts \"#{item} not found!\"}\nend", "def remove plataform\n end", "def remove_from_gamespace\n # remove it from the room it's in.\n self.from_room \n self.recycle \n # Possibly in the future return all switches. I.e. an admin taking over an NPC body.\n end", "def remove_item (grocery_list, item)\n if grocery_list[item] == nil\n \tputs \"Item not on list.\"\n else\n \tgrocery_list.delete(item)\n end\n return grocery_list\n print_list(grocery_list)\nend", "def remove_item(item_to_be_removed)\n $groceryhash.delete(item_to_be_removed)\nend", "def manage_cars_remove_car_check\n @ui.manage_cars_remove_car_input_msg\n car_to_del_id = gets.chomp\n raise 'Unexisting car' unless cars.find { |car| car.id == car_to_del_id }\n car_del = cars.find { |car| car.car_id == car_to_del_id }\n @cars.delete(car_del)\n @cars_free.delete(car_del)\n @ui.manage_cars_remove_car_success_msg\n end", "def remove_item(grocery_hash, grocery)\n grocery_hash.delete(grocery)\nend", "def remove_should_check_existing?\n true\n end", "def check_before_remove(transport)\n \t# pokud je transport uzavřen vyvolam vyjímku\n \tif not transport.efectiveUnLoadTime.nil?\n \t\traise \"Transport is finished - you can not remove item\" \n \telse\n \t\t#Pokud jde o posledni transport daneho itemu vynuluju jeho Place_id\n \t\tif self.transports.size == 1 then\n \t\t\tself.place_id = nil\n \t\t\tself.placeSince = nil\n \t\t\tself.save\n\t\t\tend\t\n \tend\t\n end", "def remove_items(item, grocery_list)\n grocery_list.delete(item)\nend", "def remove_items\n system 'clear'\n CoffeeMan.stay_logo\n @@cart = @@cart.flatten\n cart_arr = @@cart \n if cart_arr.count == 0 \n puts \"Your cart is empty, please add items\"\n sleep 1\n view_cart\n end\n if cart_arr.count > 0 \n splitted_cart = cart_arr.split(\" \")\n selected_items = prompt.multi_select(\"Which item would you like to remove?\", splitted_cart)\n selected_items.each do |del| \n cart_arr.delete_at(cart_arr.index(del))\n end \n # @@cart = cart_arr\n sleep(0.6)\n view_cart\n end\n end", "def remove_carriage_from_train\n return remove_carriage_from_train_template('create_train') if @trains.empty?\n\n user_input = ask_choose('Train', 'to remove Carriage', @trains)\n user_train = @trains[user_input - 1]\n\n if user_train.carriages.empty?\n return remove_carriage_from_train_template('create_carriage', user_train)\n end\n\n carriage = user_train.remove_carriage\n puts \"\\n[SUCCESS] #{carriage} was removed from #{user_train}\"\n end", "def remove_superhero\n user.reload\n system 'clear'\n\n superhero_choosen?\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n puts \"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\"\n user_input=prompt.select(\"\\n\\nWhich Superhero/s Do You Want To Delete\", self.user.superheros.all_names) \n result=UserSuperhero.all.find_by(user_id: self.user.id, superhero_id: user_input)\n result.delete\n # binding.pry\n self.main_menu()\n end", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n # print_list(grocery_list)\n grocery_list\nend", "def remove_user(user_id)\n\t\treturn if is_admin?(user_id)\n\t\tparty_list.delete(user_id)\n\t\tself.update_attribute(:party_list, party_list)\n\tend", "def remove(groceries_list, delete_item)\n groceries_list.delete(delete_item.to_sym) {|item| puts \"#{item} not found!\"}\nend", "def remove_item(list, item)\n # list.delete_if do |grocery_item, qty|\n # grocery_item == item\n # end\n list.delete(item)\n\n list\nend", "def grocery_item_deleter(grocery_list, item)\n grocery_list.delete(item)\n grocery_list\nend", "def remove(found, number)\n if found\n $ballers.remove('number' => number)\n 'You were removed from the database.'\n else\n 'You are not in the database.'\n end\nend", "def do_delete\n moved = []\n # evacuate the room.\n\n if !@stuff.empty? \n moved = @stuff.dup\n moved.each do |person|\n if person.is_a?(Player)\n # send them to a safe vnum...we're going to use vnum 1\n person.go_anywhere\n end\n end\n end\n \n\n 4.times do |i|\n ex = self.exit_list[i]\n next if ex == nil\n\n log :debug, \"ex #{ex.direction} deleted\"\n\n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev] \n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].towards_room.gri == self # if it's the same room as being deleted we delete \n ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].do_delete\n end\n end\n ex.do_delete\n end\n\n moved.each do |p|\n p.execute_command(\"look\")\n end\n Tag.clear_tag(self)\n @vtag = nil\n a = @vnum / 1000\n Vnum.rooms[@vnum % 1000] = nil # unlinked from main list.\n end", "def remove_item(grocery_list, item)\n grocery_list.delete(item)\n return grocery_list\nend", "def remove(item)\r\n fail \"missing item\" if item.nil?\r\n fail \"item is not in your wish list\" unless items.include?(item)\r\n\r\n item.remove_observer(self)\r\n self.items.delete(item)\r\n end", "def remove_item(grocery_list, rem_item)\r\n grocery_list.delete(rem_item)\r\n p grocery_list\r\nend", "def remove_item(item_name, grocery_list)\n grocery_list.delete(item_name)\n grocery_list\n end", "def remove_player\n add_remove_player :remove\n end", "def can_remove?(user)\n (eql? user) || (team.team_captain.eql? self)\n end", "def teacher_remove_selected \n \n string = params[:string1].split(\",\")#Select string by adding a , to the string\n @teacher = Teacher.find(session[:teacher_id]) #Find teacher with the corresponding ID\n @teacher.reserved[params[:place].to_i] = \"Avalible\" #String maniuplation to change ,\n @teacher.save#Save teacher\n @user = User.find(string[4].to_i) #Repeat down the list\n y=0\n for x in @user.your_times#Removes selected time from your schedule\n if x.split(\",\")[1] == @teacher.name\n @user.your_times[y] = \"NA\"#Reset time to NA\n end\n y+=1\n end\n @user.save\n redirect_to student_page_url#Direct to student Home\n \n end", "def trash!\n self.public = false\n self.folded = true\n self.remove_from_list\n end", "def remove_passenger(train: nil)\n train ||= choose_train\n return unless train\n\n car = trains[train].cars.last\n return (puts 'No cars in the train') if car.nil?\n\n car.remove_passenger\n rescue RuntimeError => e\n puts e.message\n end", "def ingredient_remove_helper(recipe_id)\n new_recipe_ingredient_arr = prompt.multi_select(\"Please choose from the list, ingredients you would like to keep\") do |menu|\n menu.choices user.recipes.where(id: recipe_id)[0].ingredient.split(\", \")\n end\n ingredient_change_helper(recipe_id, new_recipe_ingredient_arr)\n end", "def drop_toy(toy_index)\n p 'drop toy'\n # get the toy\n @main_view.add_toy(ToyInScene.new(@state.toys[toy_index]))\n #add toy's actions to scene\n @state.toys[toy_index].actions.each do |action|\n @main_view.add_action(action)\n end\n close_toybox\n @main_view.addSceneToy\n grab\n end", "def remove_item(grocery_list)\n puts \"what item to remove?\"\n item = gets.chomp\n grocery_list.delete(item)\n return grocery_list\nend", "def remove_item(grocery_list, item_name)\n\tgrocery_list.delete(item_name)\n\treturn grocery_list\nend", "def remove_item(grocery_list, item_name)\n\tgrocery_list.delete(item_name)\n\treturn grocery_list\nend", "def delete_item(grocery_hash, remove_item)\n if grocery_hash.has_key?(remove_item)\n grocery_hash.delete(remove_item)\n else\n return \"Item is not on list.\"\n end\nend", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend", "def remove_item(item, grocery_list)\n grocery_list.delete(item)\n return grocery_list\nend", "def unshelf\n a_to_g = ('a'..'g').to_a\n h_to_p = ('h'..'p').to_a\n\t\tif (a_to_g.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[0].delete (self)\n\t\telsif (h_to_p.include?(self.get_title[0].downcase))\n\t\t @library.get_shelves[1].delete (self)\n\t\telse \n\t\t @library.get_shelves[2].delete (self)\n\t\tend\n\tend", "def remove!\n self.class.removed(item)\n end", "def check_food_before_destroy\n\t\tif food_items.size > 0\n\t\t\tfor i in 0..food_items.size-1\n\t\t\t\tFoodItem.destroy(food_items[i].id)\n\t\t\tend\n\t\tend\n\tend", "def remove_item(grcy_list, string)\n grcy_list.delete(string)\nend", "def remove_from_list\n empty_list if @mylist.length <= 0\n item_names = @mylist.map { |item| item['name'] }\n item_names << 'Back'\n selection = @prompt.select('Which item would you like to remove?'.colorize(:light_green), item_names)\n @menu.my_list if selection == 'Back'\n @mylist.each_with_index do |item, index|\n @mylist.delete_at(index) if item['name'] == selection\n end\n update_file\n end", "def removeHandgunItem _obj, _args\n \"_obj removeHandgunItem _args;\" \n end", "def remove_have\n if params[:id].present? and params[:remove_have].present?\n if params[:from_haves_tab] == 'true'\n @user = current_user\n # @have_items = @user.items\n item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n if item.present?\n # item.destroy\n item.update_attribute(\"status\",\"DELETED\")\n end\n flash[:info] = \"Item has been removed from your Haves Board .\"\n redirect_to haves_user_path(@user, :delete => item.id)\n # elsif params[:from_my_offers_tab] == 'true'\n # @user = current_user\n # @have_items = @user.have_items\n # item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n # item.destroy\n # params[:id] = params[:original_id]\n # @item = Item.find_by_id(params[:id])\n # @offer_ids = @item.current_offers.pluck(:offer_id)\n # @useritems = @user.items\n # @useritem_ids = @useritems.pluck(:id)\n # elsif params[:from_items_index] == 'true'\n # # item = Item.find_by_id(params[:id])\n # # item.destroy\n # respond_to do |format|\n # format.js\n # format.html { redirect_to items_path}\n # end\n end\n end\n end", "def purge\n @items.delete_if(&:is_done) \n end", "def remove_excess_entry\n TransportPassengerImport.first.destroy if TransportPassengerImport.count > 15\n end", "def remove_item(remove_item, grocery_hash) \n grocery_hash.delete(remove_item)\n return grocery_hash\nend", "def remove\n empty if @playlist.length <= 0\n item_names = @playlist.map { |item| \"#{item['name']} by #{item['artist']}\" }\n item_names << 'Back'\n selection = @prompt.select('Which track would you like to remove?', item_names).split(' by ')\n menu if selection == 'Back'\n @playlist.each_with_index do |item, index|\n @user.playlist.delete_at(index) if item['name'] == selection[0]\n end\n update_playlist\n end", "def fish_removed()\n @fish_count.pop()\n end", "def destroy\n @troop.destroy\n end", "def remove_item(list, food)\n list.delete(food)\nend", "def remove_a_hydride!(add_placeholder_hydrogens=false)\n remove_a_hydrogen!(2, add_placeholder_hydrogens)\n end", "def remove\n\t\t#Clean up unused rtwork\n\t\tif Artwork.find_by_majorpost_uuid(params[:majorpost_uuid])\n\t\t\tResque.enqueue(Image::ArtworkCleanup, params[:majorpost_uuid])\n\t\tend\n\tend" ]
[ "0.70534205", "0.6549514", "0.6549514", "0.6549514", "0.6549514", "0.6531478", "0.64298946", "0.6389774", "0.63273007", "0.63021016", "0.628997", "0.6166968", "0.61511564", "0.6116899", "0.6105573", "0.6082979", "0.6055923", "0.6039372", "0.59806645", "0.5962733", "0.59596276", "0.59596276", "0.5950573", "0.5941533", "0.5933072", "0.5921789", "0.59146494", "0.5901876", "0.5901149", "0.5901149", "0.590083", "0.59006757", "0.58970994", "0.58947486", "0.5879537", "0.58649343", "0.5863868", "0.58437246", "0.5843549", "0.5838828", "0.58301836", "0.58301836", "0.58301836", "0.5829021", "0.582714", "0.5823333", "0.5817214", "0.5799523", "0.57934916", "0.57933086", "0.5784968", "0.57725525", "0.5772269", "0.5732948", "0.57308775", "0.5724002", "0.5716791", "0.5716199", "0.57155067", "0.5714585", "0.5702863", "0.56961834", "0.56932867", "0.56930745", "0.56849706", "0.5677831", "0.5677098", "0.5673889", "0.5666816", "0.56659716", "0.5665511", "0.5665047", "0.5662832", "0.565586", "0.5646065", "0.5643707", "0.5639534", "0.56318355", "0.5628965", "0.5625006", "0.5625006", "0.56118625", "0.56018317", "0.56018317", "0.5599286", "0.5589129", "0.55866915", "0.558591", "0.5580569", "0.55797476", "0.5575508", "0.5573594", "0.55635643", "0.55594695", "0.555668", "0.5554431", "0.5551351", "0.55430496", "0.5540324", "0.5537635" ]
0.69916236
1
Override ActiveRecord::Base to_param TODO: Is there a way to make it called automatically by routes helpers?
def to_param { project_namespace: owner.username, project_slug: slug } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_param; end", "def to_param # This overwrites the 'to_param' method (That is called by default in the views with something like: 'edit_post_path(@post)'). It is overridden so that the slug can be executed.\n self.slug #.slug method comes from the 'slug' column in the 'posts' table.\n end", "def to_param\n object.to_param\n end", "def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id && id.to_s # Be sure to stringify the id for routes\n end", "def to_param\n \"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n # We can't use alias_method here, because method 'id' optimizes itself on the fly.\n id&.to_s # Be sure to stringify the id for routes\n end", "def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n \t\"#{self.id}-#{self.name.parameterize}\"\n end", "def to_param\n \"#{self.id}-#{self.name.parameterize.to_s}\"\n end", "def to_param\n \"#{id}-#{self.name.parameterize}\"\n end", "def to_param\n \"#{self.id}#{'-' + self.name.parameterize if self.name.present? }\"\n end", "def to_param\n self.url_pretty\n end", "def to_param # overridden\n slug\n end", "def to_param\n to_s\n end", "def to_param\n to_s\n end", "def to_param\n to_s\n end", "def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end", "def to_param\n nil\n end", "def to_param\n nil\n end", "def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end", "def to_param\n \"#{id}-#{name.to_safe_uri rescue nil}\"\n end", "def to_param\n name_for_url\n end", "def to_friendly_param\n to_param\n end", "def to_param\n self[self.slug_column]\n end", "def to_param\n title\nend", "def to_param\n self.id.to_s\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n if friendly_id_config.routes == :friendly\n friendly_id.presence.to_param || super\n else\n super\n end\n end", "def to_param\n \"#{id}-#{name}\".parameterize if id.present?\n end", "def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end", "def to_param\n url\n end", "def to_param\n \"#{self.id}-#{self.friendly_id}\"\n end", "def to_param\n \"#{id}-#{self.slug}\"\n end", "def to_param\n \"#{id}-#{self.slug}\"\n end", "def to_param\n \"#{id}-#{self.slug}\"\n end", "def to_param\n self.name.parameterize\n end", "def to_param\n identifier\n end", "def to_param\n @target.to_param\n end", "def to_param\n return permalink if to_param_returns_permalink\n super\n end", "def to_param\n url_name\n end", "def to_param\n \"#{id} #{name}\".parameterize\n end", "def to_param\n \"#{id} #{name}\".parameterize\n end", "def to_param\n \"#{id}-#{name.parameterize}\"\n end", "def to_param\n self.name\n end", "def to_param\n self.name\n end", "def to_param\n self.name.parameterize\n end", "def to_param\n self.name.parameterize\n end", "def to_param\n self.name.parameterize\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n name\n end", "def to_param\n id\n end", "def to_param\n name.parameterize()\n end", "def to_param\n id.to_s\n end", "def to_param\n friendly_id_config.cache_column ? to_param_from_cache : to_param_from_slug\n end", "def to_param\n \"#{title.to_url}-#{id}\"\n end", "def to_param # :nodoc:\n proxy_target.try :to_param\n end", "def to_param\n plural? ? id : model_name.param_key\n end", "def to_param\n if persisted? and k = to_key\n k.join(to_param_joiner)\n end\n end", "def to_param\n \"#{id}-#{slug}\"\n end", "def to_param\n \"#{id}-#{slug}\"\n end", "def to_param\n \"#{self.id}-#{self.match.try(:name)}\".parameterize\n end", "def to_param\n\t \"#{id} #{name}\".parameterize\n\tend", "def to_param\n \"#{id}-#{self.title}\".parameterize\n end", "def to_param\n \"#{id}-#{self.title}\".parameterize\n end", "def to_param\n \"#{id}-#{canonical_title.parameterize}\"\n end", "def to_param\n \tname\n end", "def to_param\n self.slug\n end", "def to_param\n self.slug\n end", "def to_param\n \"#{id}-#{slug}\"\n end", "def to_param\n name.parameterize\n end", "def to_param\n #'foo'\n #{id}-#{permalink}\"\n permalink\n end", "def to_param\n \"#{id}-#{title.parameterize}\"\n end", "def to_param\n \"#{id}-#{title.parameterize}\"\n end", "def to_param\n \"#{id}-#{name}\".parameterize\n #[id, name.parameterize].join(\"-\")\n end", "def to_param; self.permalink end", "def to_param\n\t\tname\n\tend", "def to_param\n\t\tname\n\tend", "def to_param\n\t\tname\n\tend", "def to_param\n slug || id\n end", "def to_param\n id\n end", "def to_param\n \"#{id} #{full_number}\".parameterize\n end", "def to_param\n \"#{id} #{title}\".parameterize\n end", "def to_param\n \"#{id} #{title}\".parameterize\n end", "def to_param\n \"#{self.id}-#{self.title.gsub(/[^a-z0-9]+/i, '-')}\"\n end", "def to_param\n permalink_was\n end", "def to_param\n permalink_was\n end", "def to_param\n (persisted? && key = to_key) ? key.join('-') : nil\n end" ]
[ "0.7565333", "0.74053246", "0.7325163", "0.72715753", "0.71727", "0.7150078", "0.70832694", "0.70832694", "0.7062183", "0.70027167", "0.69893646", "0.69714135", "0.68639123", "0.68598944", "0.68598944", "0.68598944", "0.6859206", "0.68227917", "0.68227917", "0.68196476", "0.68196476", "0.6798338", "0.67954826", "0.6763555", "0.6755792", "0.67244947", "0.668776", "0.668776", "0.668776", "0.668776", "0.66501606", "0.66490597", "0.664583", "0.6642195", "0.6622721", "0.6608946", "0.6608946", "0.6608946", "0.6591794", "0.6571441", "0.65703356", "0.6567563", "0.65568686", "0.6545103", "0.6545103", "0.6538753", "0.6526386", "0.6526386", "0.651773", "0.651773", "0.651773", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6493199", "0.6492", "0.64812624", "0.6454057", "0.64511865", "0.64481425", "0.6446451", "0.6431542", "0.6429398", "0.64007175", "0.64007175", "0.6374242", "0.63642293", "0.6341471", "0.6341471", "0.6340191", "0.63394755", "0.6336697", "0.6336697", "0.6332257", "0.6318697", "0.6306097", "0.6278383", "0.6278383", "0.6270782", "0.6264905", "0.62610954", "0.62610954", "0.62610954", "0.62493104", "0.62476736", "0.6239051", "0.6234014", "0.6234014", "0.623097", "0.6230555", "0.6230555", "0.6215752" ]
0.0
-1
To render with the distance to
def setOrigin(origin) @origin = origin end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance_measurement; end", "def distance\n self.distance_from(@origin) * 1.609344\n end", "def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end", "def distance_to_back(view)\n bb = view.model.bounds\n eye = view.camera.eye\n dir = view.camera.direction\n distance = 0.0.inch\n for i in 0..7 do\n vec = Geom::Vector3d.new(eye, bb.corner(i))\n d = vec % dir\n if( d > distance )\n distance = d\n end\n end\n if( distance == 0.0 )\n distance = eye.distance(view.camera.target)\n end\n distance\nend", "def getTotalDistance\n return @totalDistance\n end", "def setViewDistance _args\n \"setViewDistance _args;\" \n end", "def distance\n properties['distance']\n end", "def distance_to(token)\n dist = self.xloc - token.xloc\n dist.abs\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance\n if valid\n route[:distance].to_i\n end\n end", "def distance(point2)\n end", "def get_distance\n return Math.hypot($game_player.real_x * 32 -\\\n self.mapx, $game_player.real_y * 32 - self.mapy)\n end", "def distance_preceding_character\r\r\n sx = distance_x_from(@preceding_character.x)\r\r\n sy = distance_y_from(@preceding_character.y)\r\r\n return Math.hypot(sx, sy)\r\r\n end", "def length\n distance\n end", "def distance_from(char)\n return distance_x_from(char.x).abs + distance_y_from(char.y).abs\n end", "def distance obj\n\t\t\ta = obj.x-@x\n\t\t\tb = obj.y-@y\n\t\t\tc = Math.sqrt(a**2 + b**2)\t\n\t\tend", "def dist other\n case other\n when Atom\n pos = other.pos(false)\n when Surface\n return other.dist(self)\n else\n pos = pos.to_v \n end\n if @units == :angstrom\n (@pos - pos).magnitude\n else\n @cell.dist(self, other)\n end\n end", "def distance()\n return @length\n end", "def h_dist_total\n self.h_dist_start + self.h_dist_end\n end", "def update_placement\n self.x = (Graphics.width - self.width) / 2\n self.y = (Graphics.height - self.height) / 2\n end", "def distance\n self.distance_to(current_knocker)\n end", "def distance(pos2)\n return $game_map.distance(self, pos2)\n end", "def setObjectViewDistance _args\n \"setObjectViewDistance _args;\" \n end", "def distance_from shooter\n (self.position - shooter.position).length\n end", "def distance object\n GeographyHelper.distance latitude, longitude, object.latitude, object.longitude\n end", "def dist_to(other)\n (other - self).length\n end", "def distance\n @distance ||= mot_apres.offset - mot_avant.offset\n end", "def distance_to(key)\n p1 = {\n x: (row_offset.to_f*unit_width)+((width(as: :mm))/2),\n y: (row.number.to_f*unit_height)-((height(as: :mm))/2)+(height(as: :mm))\n }\n\n p2 = {\n x: (key.row_offset.to_f*unit_width)+((key.width(as: :mm))/2),\n y: (key.row.number.to_f*unit_height)-((key.height(as: :mm))/2)+(key.height(as: :mm))\n }\n\n Math.sqrt( ((p1[:x]-p2[:x])**2) + ((p1[:y]-p2[:y])**2) ).round(2)\n end", "def distance_to(cell)\n (@x - cell.x).abs + (@y - cell.y).abs\n end", "def drive(distance_to_drive)\n @cum_distance = @cum_distance + distance_to_drive\n puts \"The #{@color} #{@model} drove #{@cum_distance} miles.\"\n end", "def location(x, y, w, h)\n return x - w/2, y + 20\n end", "def distance(other)\n\t\treturn ((other.x-@x).abs + (other.y-@y).abs + (other.z-@z).abs)/2\n\tend", "def to_position\n self\n end", "def distance_to(position)\n\t\t\tMath.sqrt((position.x - x).abs ** 2 + (position.y - y).abs ** 2)\n\t\tend", "def distance_to(n)\n return 0 unless n\n @@cache[self.object_id][n.object_id] ||= Math.sqrt((n.x - @x)**2 + (n.y - @y)**2)\n end", "def nearbys(distance_in_kms)\n\t\tsuper(distance_in_kms / Constant.miles_per_kilo_meter)\n\tend", "def distance\n @data['distance']['value']\n end", "def distance_to(other)\n point.distance_to(other)\n end", "def move_dist(deltx, delty)\n @x += deltx\n @y += delty\n normalize\n end", "def direction\n\t\tpoint_x = end_junction.position.x - start_junction.position.x\n\t\tpoint_y = end_junction.position.y - start_junction.position.y\n\t\t[point_x / @length, point_y / @length]\n\tend", "def view_offset\n @position + @view.position\n end", "def relative(x); x.to_f/@game.height; end", "def farpoint() origin + size end", "def length=( length )\n self.distance = length\n end", "def distance(other_point)\n ((self.x - other_point.x) ** 2 + (self.y - other_point.y) ** 2) ** 0.5\n end", "def distance_price\n distance * price_per_km\n end", "def display_event_distance\n x = self.event_id\n y = Event.find_by_id(x)\n return y.distance\n end", "def store_miles_distance\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.className(create_ats_regex_string(\"ats-storedistance\")), format_method(__method__))\n end", "def y_distance(new_y_position)\n (new_y_position.to_i - self.y_position).abs \n end", "def size\n (@x2-@x1)*(@y2-@y1)\n end", "def original_weight\n @original_weight ||= (1.0 / (wrapper1.render.length * wrapper2.render.length))\n end", "def distance\n raise ArgumentError, \"block required\" unless block_given?\n\n beg_pos = position\n yield\n end_pos = position\n return unless end_pos && beg_pos\n\n # width, height\n [ end_pos[1] - beg_pos[1], end_pos[0] - beg_pos[0] ]\n end", "def distance_to_human\n number_to_human(distance.to_i,:units => :distance_short).to_s\n end", "def distance_to(other)\n pyth(self.x, self.y, other.x, other.y)\n \n# Math.sqrt((other.x - self.x) ** 2 + (other.y - self.y) ** 2)\n end", "def offset_large_unit\n #large unit position update\n self.x += 16*(@character.unit_size-1)\n self.y += 16*(@character.unit_size-1)\n self.y = @character.apply_float_effect(self.y)\n update_dodge_offsets\n update_shadow\n end", "def render_length; end", "def north(i=@cursor) i-width end", "def distance_per_frame\r\n 2 ** real_move_speed / 256.0\r\n end", "def x_distance(new_x_position)\n (new_x_position.to_i - self.x_position).abs \n end", "def viewDistance \n \"viewDistance\" \n end", "def retreat(distance = 1)\n # Don't let the cursor get below zero\n return if @position.x < distance\n\n @position.x -= distance\n end", "def y_offset; end", "def distance_to_line(line)\n end", "def propagate_template(distance)\n @distance = distance\n return if @path.nil?\n return unless @path.template.nil?\n @path.template = @template\n @path.propagate_template(distance + 1)\n end", "def distance x1, y1, x2, y2\n ((x1-x2)**2+(y1-y2)**2)**0.5\nend", "def x_offset; end", "def cent_x\n self.x + (@width / 2)\n end", "def distance _obj, _args\n \"_obj distance _args;\" \n end", "def decode\n \"#{@width}%x#{@height}+#{offset_x}+#{offset_y}\"\n end", "def distance(other_point)\n\t\t((@x - other_point.x)**2 + (@y - other_point.y)**2)**0.5\n\tend", "def to_s\n\t\t\"Road: #{@loc1} <--> #{@loc2}, distance = #{@distance}\"\n\tend", "def displayRoom(renderTarget)\n\t\tif @room \n\t\t\tfor x in @room[0] .. @room[0] + @room[2]\n\t\t\t\tfor y in @room[1] .. @room[1] + @room[3]\n\t\t\t\t\trenderTarget[x-1][y-1] = '.'\n\t\t\t\tend \n\t\t\tend\n\t\tend\n\t\treturn renderTarget\n\tend", "def map_to= val\n self.length= val.length\n val << dist #add me to him\n end", "def locate\n x = mouse_x + @viewport.ox\n approx = x * value.length / @sprite.bitmap.width\n match = approach(approx, x)\n @text.cursor_jump(match)\n @viewport.ox -= 10 if mouse_x < 0\n @viewport.ox += 10 if (self.width - mouse_x) < 0\n end", "def distance(other)\n (other - self).magnitude.abs\n end", "def area\n w * h\n end", "def abs_length()\n case @facing\n when :north, :south; @length\n when :east, :west; @width\n end\n end", "def run(distance=0)\n # una variable de metodo puede ocuparse en todos los metodos \n @add+=distance\n \"Corriendo #{@add} mts...\"\n end", "def render_length=(_arg0); end", "def distance( h )\n to_cube.distance(h.to_cube)\n end", "def distance( h )\n to_cube.distance(h.to_cube)\n end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def floor_area\n # what does super call here?\n super + 300\n # (@width * @length) + 300\n end", "def width\r\n return (@x2-@x1).abs\r\n end", "def distance\n # we use memoization because calculating distance is expensive\n @distance ||= begin\n self.points.inject(nil) do |a, p|\n new_pt = p\n if a\n last_pt = Ubiquity::Point.new(a[:last_lat], a[:last_lon], {'ele' => a[:last_ele]})\n d = last_pt.to new_pt\n a[:dist] += d\n else\n a=Hash.new\n a[:dist]=0\n end\n a[:last_lat]=new_pt.lat\n a[:last_lon]=new_pt.lon\n a[:last_ele]=new_pt.elems['ele']\n a\n end[:dist]\n end\n end", "def scroll_right(distance)\n if loop_horizontal?\n @display_x += distance\n @display_x %= @map.width * 256\n @parallax_x += distance\n else\n last_x = @display_x\n @display_x = [@display_x + distance, (width - 17) * 256].min\n @parallax_x += @display_x - last_x\n end\n end", "def width\n right - left\n end", "def width\n right - left\n end", "def position\n\t\treturn \"#{@x} #{@y} #{PlanetModel::ORIENTATIONS.invert[@angle.abs % 360].to_s}#{if @lost == true then ' LOST' end}\"\t\n\tend", "def distance_to(other)\n Math.sqrt((0..(self.dimension_count-1)).map {|d| (other.value(d) - self.value(d)) ** 2 }.reduce(&:+))\n end", "def view_offset\n @position + Moon::Vector3[@view.position, 0]\n end", "def display_position\n # Fill this in\n end", "def display_position\n # Fill this in\n end" ]
[ "0.6020261", "0.58282685", "0.5779742", "0.5771285", "0.5745407", "0.57192636", "0.57026416", "0.5639244", "0.56268823", "0.56268823", "0.56156003", "0.5606154", "0.56012917", "0.55733407", "0.555621", "0.5532722", "0.5525879", "0.55068237", "0.54987854", "0.549208", "0.5492027", "0.5484037", "0.54744303", "0.54619294", "0.5439199", "0.5435411", "0.54353976", "0.5434019", "0.5421229", "0.54191417", "0.54154396", "0.5410001", "0.53991216", "0.53844553", "0.5372253", "0.5356859", "0.53503364", "0.53466797", "0.53401387", "0.5334252", "0.5330408", "0.5321803", "0.53164595", "0.5312857", "0.53123575", "0.52929723", "0.5289039", "0.5285623", "0.5283778", "0.527634", "0.52712595", "0.526159", "0.5255988", "0.5252234", "0.5242839", "0.5238938", "0.5231769", "0.5226451", "0.5223753", "0.5212599", "0.52115387", "0.5210601", "0.5209049", "0.51991874", "0.519725", "0.5195687", "0.51842195", "0.51437455", "0.5143096", "0.5123882", "0.5122046", "0.5119422", "0.51162124", "0.51161915", "0.5112087", "0.51055205", "0.50947297", "0.5092622", "0.50911784", "0.50899726", "0.5082421", "0.5082421", "0.5081321", "0.5081321", "0.5081321", "0.5081321", "0.5081321", "0.5081321", "0.5081321", "0.5081321", "0.50750905", "0.5072958", "0.5072082", "0.5069606", "0.5061519", "0.5061519", "0.50552803", "0.5054973", "0.50538486", "0.5046853", "0.5046853" ]
0.0
-1
To render the distance to in json
def distance self.distance_from(@origin) * 1.609344 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distance\n @data['distance']['value']\n end", "def distance\n properties['distance']\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance\n distance_and_arc[:distance]\n end", "def distance object\n GeographyHelper.distance latitude, longitude, object.latitude, object.longitude\n end", "def distance_by_day\n result = Trip.group_by_day(:created_at).sum(:distance)\n render json: [{name: 'Distance Traveled', data: result}]\n end", "def getTotalDistance\n return @totalDistance\n end", "def distance_measurement; end", "def distance_calculator(start, destination)\n #http://forrst.com/posts/Read_JSON_data_using_Ruby-13V\n url = \"http://maps.googleapis.com/maps/api/distancematrix/json?origins=#{start}&destinations=#{destination}&mode=driving&sensor=false\"\n \n buffer = open(url).read\n result = JSON.parse(buffer)\n \n duration = result[\"rows\"].first[\"elements\"].first[\"duration\"][\"value\"]\n distance = result[\"rows\"].first[\"elements\"].first[\"distance\"][\"value\"]\n return duration.to_f/60, distance.to_f/1000\nend", "def distance\n if valid\n route[:distance].to_i\n end\n end", "def distance_price\n distance * price_per_km\n end", "def total_meters\n data[:total_meters]\n end", "def distance\n return \"\" if @establishments.empty?\n (@establishments.first[\"Distance\"].to_f * METRES_IN_A_MILE).to_i\n end", "def result_description\n \"Distance\"\n end", "def distance(start_point, end_point)\n result = prepare_url(start_point, end_point)\n return result[\"routes\"].first[\"legs\"].first[\"distance\"][\"value\"]/1000\n end", "def kilometers\n self.distance\n end", "def distance\n # we use memoization because calculating distance is expensive\n @distance ||= begin\n self.points.inject(nil) do |a, p|\n new_pt = p\n if a\n last_pt = Ubiquity::Point.new(a[:last_lat], a[:last_lon], {'ele' => a[:last_ele]})\n d = last_pt.to new_pt\n a[:dist] += d\n else\n a=Hash.new\n a[:dist]=0\n end\n a[:last_lat]=new_pt.lat\n a[:last_lon]=new_pt.lon\n a[:last_ele]=new_pt.elems['ele']\n a\n end[:dist]\n end\n end", "def to_s\n @distance_string.to_s\n end", "def distance_price\n distance * car.price_per_km\n end", "def dis\n if attributes[\"distance\"]\n @dis ||= Distance.new(attributes[\"distance\"], :meters)\n end\n end", "def distance\n return @distance if @distance\n unless @status == 'OK'\n @distance = 0\n else\n @distance = @doc.css(\"distance value\").last.text\n end\n end", "def st_distance(geo_object)\n GeographicItem.where(id: self.id).pluck(\"ST_Distance_Spheroid('#{self.geo_object}','#{geo_object}','#{Georeference::SPHEROID}') as distance\").first\n end", "def find\n x = params[:x]\n y = params[:y]\n # distance =params[:distance]\n #{distance}\n data = Wzx.where(\"pt<->point'(#{x},#{y})'<5\").order(\"pt<->point'(#{x},#{y})'\").first\n # data1 =(id: data_id)\n render json:data\n \nend", "def display_event_distance\n x = self.event_id\n y = Event.find_by_id(x)\n return y.distance\n end", "def distance_to_human\n number_to_human(distance.to_i,:units => :distance_short).to_s\n end", "def viewDistance \n \"viewDistance\" \n end", "def distance\n distance = 0\n @solution.each { |route| distance += route.distance }\n return distance\n end", "def index\n @traces = Trace.all\n url_string = ''\n data = []\n pdist = 0\n plat = @traces.first.latitude\n plon = @traces.first.longitude\n traces = @traces.pluck(:latitude, :longitude).map { |lat, lon| { latitude: lat, longitude: lon } }\n response = HTTParty.post(\n url_string,\n :body => traces.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n )\n @traces.each_with_index do |t,index|\n data << {\n \"latitude\": t.latitude,\n \"longitude\": t.longitude,\n \"distance\": distance([plat,plon],[t.latitude, t.longitude]) + pdist,\n \"elevation\": response[index]\n }\n pdist += distance([plat,plon],[t.latitude, t.longitude])\n plat = t.latitude\n plon = t.longitude\n end\n render json: data\n end", "def total_distance\n distances = self.rides.map { |ride| ride.distance }\n distances.inject(:+).to_f\n end", "def distance(point2)\n end", "def inspect\n \"<Edge distance=#{@distance.inspect}>\"\n end", "def distance(p1, p2)\n dx = ED * (p1['lat']-p2['lat'])\n dy = ED * Math::cos(Math::PI*p1['lat']/180)*(p1['lon']-p2['lon'])\n return (dx**2 + dy**2)**0.5\nend", "def gmaps_distance(row, index)\n row[:elements][index] ? row[:elements][index][:distance][:value] : 0\n end", "def total_distance\n approved_flights.sum(:distance)\n end", "def total_distance()\n self.rides().map() { | ride | ride.distance() }.reduce(:+)\n end", "def find\n render json: format_places(closest(params[:latitude], params[:longitude]).take(3))\n end", "def totalDistance\n @distanceTraveled \n @gasCost = @milage * @distanceTraveled\n @gasCost\n \"You've spent $#{@gasCost} for gas so far!\"\n end", "def totalDistance\n @distanceTraveled \n @gasCost = @milage * @distanceTraveled\n @gasCost\n \"You've spent $#{@gasCost} for gas so far!\"\n end", "def distance_to(point)\n d=Ubiquity::Geoformulas.distance self.lat, self.lon, point.lat, point.lon\n if self.elems && self.elems.has_key?('ele') && point.elems.has_key?('ele')\n d=Ubiquity::Geoformulas.distance_correction d, self.elems['ele'], point.elems['ele']\n end\n d\n end", "def stats\n @stats = {\n total_distance: CyclingEvent.sum(:distance),\n total_time: CyclingEvent.sum(:finish_time),\n average_speed: CyclingEvent.sum(:distance).to_f / CyclingEvent.sum(:finish_time).to_f\n }\n\n respond_to do |format|\n format.html # stats.html.erb\n format.json { render json: @stats, callback: params[:callback] }\n format.xml { render xml: @stats }\n end\n end", "def meters\n self\n end", "def show\n\t\trender :json => @item.to_json(methods: [:total_cost])\n\tend", "def get_distance_unit\n\t\t@kilometers\n\tend", "def distance_list\n [['5 miles', '5'], ['10 miles', '10'], ['15 miles', '15'], \n ['25 miles', '25'], ['35 miles', '35'], ['50 miles', '50'],\n ['75 miles', '75'], ['100 miles', '100']]\n end", "def text_distance_graph\n @data_location = '/text_distance_graph_data'\nend", "def totalDistance\n @gasCost = @milage * @distanceTraveled\n \"You've spent $#{@gasCost} for gas so far!\"\n end", "def distance obj\n\t\t\ta = obj.x-@x\n\t\t\tb = obj.y-@y\n\t\t\tc = Math.sqrt(a**2 + b**2)\t\n\t\tend", "def distance()\n return @length\n end", "def distance_calculator\n @trips.each do |trip|\n @total_distance += trip.distance.to_f\n end\n end", "def length\n distance\n end", "def estimated_distance\n user_location = @instance_options[:user_location]\n return '' if user_location.nil?\n\n Geo.distance_between(user_location, object)\n end", "def dis\n if attributes[\"geo_near_distance\"]\n @dis ||= Distance.new(attributes[\"geo_near_distance\"], :degrees)\n end\n end", "def total_distance_driven\n distances = rides.map{ |ride| ride.distance }\n distances.reduce(:+)\n end", "def points\n locale = Location.create( :address => params[:locale] )\n lat = locale.latitude.to_f\n lng = locale.longitude.to_f\n\n # instagram api request\n url = \"https://api.instagram.com/v1/locations/search.json?lat=#{lat.round(3)}&lng=#{lng.round(3)}&client_id=efea46f4c52542348ced4c529263cf33\"\n\n # creates an instance variable @result with the json object\n @result = HTTParty.get url\n\n # makes the json data available for ajax\n render :json => @result\n end", "def total\n user = User.find_by(uuid: params[:uuid])\n point = Point.where(user_id:user.id).select(:left_points,:right_points).first\n render json: { LP: point.left_points, RP: point.right_points }, status: :ok\n end", "def stats\n [ride_distance, ride_time]\n end", "def to_s\n\t\t\"Road: #{@loc1} <--> #{@loc2}, distance = #{@distance}\"\n\tend", "def meters\n if self.u == 'meters' # meter in meter\n self.distance\n# 1 mile = 1609.344 meters\n elsif self.u == 'miles' # meter in mile\n self.distance * 1609.34\n# 1 kilometer = 1000 meters \n elsif self.u == 'kilometers' # meter in kilometer\n self.distance * 1000\n# 1 yard = 0.9144 meters\n elsif self.u == 'yards' # meter in yard\n self.distance * 0.9144\n end\n end", "def total\n @data['total']\n end", "def nearme\n # nearby returns a location list which is then mapped through with the transform json method. if there are no entries is sends back an array\n\n nearby = Location.all.where.not(latitude: nil).near([params[:lat], params[:lng]],\n params[:distance], units: :km)\n render json: nearby.map(&:transform_json), status: 201\n end", "def h_dist_total\n self.h_dist_start + self.h_dist_end\n end", "def distance\n self.distance_to(current_knocker)\n end", "def total_distance\n rides.reduce(0) {|total, ride| total + ride.distance}\n end", "def total_distance\n rides.reduce(0) {|total, ride| total + ride.distance}\n end", "def vis_output(days)\n [\n self['geometry']['coordinates'][1],\n self['geometry']['coordinates'][0],\n self['magnitudes'][days.to_s]['mag'],\n self['magnitudes'][days.to_s]['count']\n ]\n end", "def index\n\t\trender :json => @items.to_json(methods: [:total_cost])\n\tend", "def distance(unit = :meters)\n convert_length(@distance, unit)\n end", "def distance\n distance = 0\n distance_2d = 0\n elev_change = 0\n num_waypoints = 0\n if @waypoints.nil? then self.load_processed_waypoints end\n ext_waypoints = self.extrapolated_waypoints()\n for waypoint in ext_waypoints do\n if waypoint.length < 3\n waypoint[2] = get_elevation(waypoint[0],waypoint[1])\n end\n end\n for i in 1..ext_waypoints.length-1\n waypointA = ext_waypoints[i-1]\n waypointB = ext_waypoints[i]\n #num_waypoints += 1 + sub_waypoints(waypointA, waypointB)\n elevation_diff = (waypointB[2]-waypointA[2])\n distance_flat = waypoint_distance(waypointA, waypointB)\n distance_3d = Math.sqrt(distance_flat**2 + elevation_diff**2)\n #pp [distance_3d, elevation_diff, distance_flat]\n distance += distance_3d\n distance_2d += distance_flat\n elev_change += elevation_diff.abs\n end\n return [distance, elev_change, distance_2d]\n \n end", "def nearof\n @coordenadas = [params[:longitud].to_i,params[:latitud].to_i]\n distance = 100 #km\n\n if @coordenadas\n @nearest = Rails.cache.fetch(\"reports/near/#{params[:longitud].to_i},#{params[:latitud].to_i}\", :expires_in => 8.hours) do\n Report.where(:coord => { \"$nearSphere\" => @coordenadas , \"$maxDistance\" => (distance.fdiv(6371)) }).and(:status => 1).without(:email,:description,:links,:source,:status,:reported_at,:shape,:duration).limit(50).entries\n end\n end\n\n respond_to do |format|\n format.html # nearof.html.erb\n format.json { render json: @nearest }\n end\n end", "def points\n @data['points'].to_i\n end", "def store_miles_distance\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.className(create_ats_regex_string(\"ats-storedistance\")), format_method(__method__))\n end", "def get_node_distance(node_city)\n @nodes[node_city].distance\n end", "def distance_to(loc2)\n self.point.ellipsoidal_distance(loc2.point)/1000\n end", "def radius_statistics\n super\n end", "def meters_per_skein\n data[:meters_per_skein]\n end", "def show\n @thermometer.make_temp.to_json\n end", "def total\n self.to_json[\"SearchResponse\"][\"Web\"][\"Total\"].to_i\n end", "def show\n @cultural_heritage_culture = CulturalHeritage::Culture.find(params[:id])\n points = @cultural_heritage_culture.list_point\n\n if points.length > 0\n\n count = 0\n @json = \"[[\"\n points.each do |point|\n if (count == 0)\n @json = @json << '{\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << \n ', \"strokeColor\": \"#FF0000\", \"strokeOpacity\": 0.3, \"strokeWeight\": 1, \"fillColor\": \"#FF0000\", \"fillOpacity\": 0.7}'\n else\n @json = @json << ', {\"lng\": ' << point.longitude.to_s << ', \"lat\": ' << point.latitude.to_s << '}'\n end\n count = count + 1\n end\n @json = @json << \"]]\"\n\n end \n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cultural_heritage_culture_point }\n end\n end", "def index\n @districts = District.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @districts }\n format.js {\n h = Hash.new;\n @districts.each { |c| h[c.code] = { 'code' => c.code, 'title' => c.title } }\n @some_json = h.to_json\n }\n end\n \n\n#result = @districts.map{ |c| { c.id => { 'code' => c.code, 'title' => c.title } } } \n#render :js => '<script> var dist = ' + result.to_json + '</script>' \n end", "def index\n @positives = Positive.all\n @positives_json= Positive.all.map(&:lonlat).as_json\n\n\n\n\n\n end", "def distance\n return self['d'] if self['d']\n return false if !self['user_loc']\n self['d'] = Geo.miles_between(self['user_loc'], [self.lat.to_f, self.lng.to_f])\n end", "def trip_duration(distance)\n distance/speed\n end", "def distance\n @distance ||= mot_apres.offset - mot_avant.offset\n end", "def trip_duration(distance)\n distance / @speed\n end", "def distance_to ultima_posicao_da_vitima, ultima_posicao_do_aggressor\n\n # cria dois objetos da classe location, com a posicao da vitima e agressor\n loc_agressor = Loc::Location[ultima_posicao_do_aggressor.latitude.to_d, ultima_posicao_do_aggressor.longitude.to_d]\n loc_vitima = Loc::Location[ultima_posicao_da_vitima.latitude.to_d, ultima_posicao_da_vitima.longitude.to_d]\n \n loc_vitima.distance_to loc_agressor\n\n end", "def hypotenuse\n\t\tresult = Math.hypot(@input)\n\n\t render json: result, status: 200\n\trescue\n\t\trender json: {\"message\": 'Use the format: {\"input\": [length, base]}'}, status: 400\n\tend", "def json_percent_differential(game)\n\t\tpercent_diff_map = {}\n\t\tgore = Candidate.find_by_name(\"Gore\")\n\t\tbush = Candidate.find_by_name(\"Bush\")\n\t\tpercent_diff_map['red_states'] = State.margin_map(bush)\n\t\tpercent_diff_map['blue_states'] = State.margin_map(gore)\n\n\t\tpercent_diff_map.to_json.html_safe\n\tend", "def as_json(_obj = {})\n {\n average_rating: @doctor.recent_average_rating,\n distance: @distance,\n doctor_name: @doctor.name,\n doctor_id: @doctor.id\n }\n end", "def geodist(key, from, to, unit = \"m\")\n\t\t\t\t\tcall(\"GEODIST\", key, from, to, unit)\n\t\t\t\tend", "def total_amount\n\t\t@result = (params[:words].to_i*PaymentCharge.first.per_word_amount).to_i\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render :json=>@result}\n\t\tend\n\tend", "def get_measurements\n render json: @data_source.measurements\n end", "def distance_to(key)\n p1 = {\n x: (row_offset.to_f*unit_width)+((width(as: :mm))/2),\n y: (row.number.to_f*unit_height)-((height(as: :mm))/2)+(height(as: :mm))\n }\n\n p2 = {\n x: (key.row_offset.to_f*unit_width)+((key.width(as: :mm))/2),\n y: (key.row.number.to_f*unit_height)-((key.height(as: :mm))/2)+(key.height(as: :mm))\n }\n\n Math.sqrt( ((p1[:x]-p2[:x])**2) + ((p1[:y]-p2[:y])**2) ).round(2)\n end", "def show\n @market_distance = MarketDistance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @market_distance }\n end\n end", "def nearbys(distance_in_kms)\n\t\tsuper(distance_in_kms / Constant.miles_per_kilo_meter)\n\tend", "def find_closest_stations\n\tuserLoc = [params[:lat], params[:lng]]\n\tbounds = Geokit::Bounds.from_point_and_radius(userLoc, 10) \n\t@stations = Station.in_bounds(bounds).all # get all stations within 10 miles\t\n\t@stations.each do |s| # calc distance\n\t\ts['distance'] = s.distance_from(userLoc, :units => :miles)\n\tend\n\t@stations.sort! { |a, b| a.distance <=> b.distance }\n\tputs \"num stations found: \" + @stations.size.to_s\n\trender :json => @stations.to_json\n\t#render :json => Station.find_all_by_stop_lat_and_stop_lng(params[:lat], params[:lng]).to_json #works\n\t#repond_with was not working, not sure why\n end", "def height\n @map.size\n end", "def show\n render json: @duration\n end", "def print_average_distance(graph_instance)\n ave_distance = 0\n counter = 0\n graph_instance.node_hash.each_key { |key|\n linked = graph_instance.node_hash[key].linked_cities\n linked.each{ |tuple|\n ave_distance = ave_distance + tuple.distance\n counter = counter + 1\n }\n }\n ave_distance = ave_distance/counter\n puts \"Average flight distance is #{ave_distance}\"\nend", "def distance_to(mtn)\n GeoMath.haversine_distance(\n @latitude, @longitude, \n mtn.latitude, mtn.longitude)\n end", "def to_json(*a)\n {\n :id => self.id,\n :followed_place_id => self.followed_place_id,\n :longitude => self.longitude,\n :latitude => self.latitude,\n :name => self.name,\n :postcode => self.postcode,\n :city => self.city,\n :address => self.address,\n :country => self.country,\n :icon => self.icon,\n :distance => self.distance,\n :publications => self.publications,\n :distance_boundary => 0,#self.distance_boundary,\n :can_publish => true #self.can_publish\n }.to_json(*a)\n end" ]
[ "0.7657505", "0.72963095", "0.6667321", "0.6667321", "0.66276616", "0.6533284", "0.6524538", "0.6521682", "0.6459691", "0.6397805", "0.6287605", "0.6256217", "0.62031233", "0.61791724", "0.6121099", "0.6092789", "0.6048885", "0.59147966", "0.5911462", "0.58945143", "0.5879756", "0.5861461", "0.5851937", "0.5827646", "0.5813451", "0.5797843", "0.5790383", "0.5764077", "0.57556814", "0.5753865", "0.5747193", "0.5746822", "0.57253516", "0.57190317", "0.57133526", "0.5712176", "0.56809556", "0.56809556", "0.56805545", "0.5672757", "0.5669425", "0.56605333", "0.5648405", "0.5633586", "0.5626345", "0.5617392", "0.5611248", "0.55798537", "0.55670124", "0.555568", "0.5544072", "0.55340296", "0.5519916", "0.55166036", "0.5515733", "0.55095094", "0.55049086", "0.55032194", "0.5494803", "0.5491202", "0.54802233", "0.54706776", "0.5458569", "0.5458569", "0.5454916", "0.5452903", "0.5437632", "0.54331404", "0.54319584", "0.54139906", "0.54071385", "0.54049045", "0.5396473", "0.5396299", "0.5396163", "0.5391077", "0.53897643", "0.5385815", "0.538244", "0.5380047", "0.5378841", "0.53777754", "0.5372144", "0.53712267", "0.5361605", "0.5357542", "0.535564", "0.53503436", "0.5350056", "0.5348654", "0.53416437", "0.53405315", "0.533961", "0.5338044", "0.530419", "0.52984285", "0.52965117", "0.5291177", "0.5284479", "0.5276491" ]
0.62168515
12
This will probably never change; but in cases
def grant_type "refresh_token" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def used?; end", "def same; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internship_passed; end", "def anchored; end", "def offences_by; end", "def schubert; end", "def who_we_are\r\n end", "def internal?; end", "def big_bad; end", "def internal; end", "def placebo?; false end", "def suivre; end", "def missing?; end", "def celebration; end", "def usable?; end", "def ignores; end", "def terpene; end", "def loc; end", "def loc; end", "def loc; end", "def verdi; end", "def old_value; end", "def missing; end", "def isolated; end", "def isolated; end", "def berlioz; end", "def missed?; end", "def original; end", "def custom; end", "def custom; end", "def ibu; end", "def intensifier; end", "def starting_position; end", "def original_result; end", "def stderrs; end", "def refutal()\n end", "def result_of_setting; end", "def remaining; end", "def offset; end", "def offset; end", "def offset; end", "def blg; end", "def offences_by=(_arg0); end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def final; end", "def extra; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def flag; end", "def formation; end", "def current_length; end", "def buzzword; end", "def buzzword; end", "def semact?; false; end", "def if_needs_rekey?; end", "def return_value; end", "def reserved; end", "def caveats; nil end", "def caveats; nil end", "def tell()\n #This is a stub, used for indexing\n end", "def leeway; end", "def leeway; end", "def probers=(_arg0); end", "def specialty; end", "def available; end", "def available; end", "def gounod; end", "def escaper=(_); end", "def missing?; false; end", "def malts; end", "def implementation; end", "def implementation; end", "def current_value; end", "def villian; end", "def returns; end", "def extra_state; end", "def silly_adjective; end", "def jack_handey; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end" ]
[ "0.7232065", "0.6599151", "0.6452106", "0.6353735", "0.62078017", "0.62078017", "0.62078017", "0.62078017", "0.6190773", "0.61850023", "0.616959", "0.6167359", "0.6047141", "0.5915138", "0.5903564", "0.5885422", "0.5881407", "0.5867337", "0.58647263", "0.5864641", "0.58573776", "0.5848663", "0.5824371", "0.5812542", "0.5812542", "0.5812542", "0.5796866", "0.5788733", "0.5785145", "0.576986", "0.576986", "0.576497", "0.57632256", "0.57604903", "0.5757146", "0.5757146", "0.575401", "0.57443345", "0.574029", "0.5735833", "0.57271373", "0.57241356", "0.57230675", "0.5712809", "0.57101995", "0.57101995", "0.57101995", "0.5693415", "0.5691641", "0.5689895", "0.5689895", "0.5689895", "0.5689895", "0.5689895", "0.5689895", "0.5689049", "0.5683176", "0.56793547", "0.56793547", "0.56793547", "0.56793547", "0.56793547", "0.56793547", "0.56793547", "0.56793547", "0.56688726", "0.56502646", "0.56482846", "0.5636349", "0.5636349", "0.5626358", "0.5619747", "0.56178796", "0.561754", "0.56095994", "0.56095994", "0.560757", "0.5599641", "0.5599641", "0.55977327", "0.5595398", "0.55919385", "0.55919385", "0.5582361", "0.557712", "0.557505", "0.5569343", "0.5568952", "0.5568952", "0.5563992", "0.5559924", "0.5558748", "0.5557581", "0.5556775", "0.5549442", "0.55382025", "0.55382025", "0.55382025", "0.55382025", "0.55382025", "0.55382025" ]
0.0
-1
This method is still ugly and could use some cleanup.
def api(method, url, options = {}) unless [:get, :delete, :post, :put, :patch].include? method raise "Unknown REST method: #{method}" end config = RequestConfig.new config.authorization_bearer = @authorization_bearer config.method = method config.access_token = options[:access_token] config.request_params = options[:request_params] config.request_body = options[:request_body] config.content_type = "application/json" unless url == @refresh_token_url config.form_encoding = true if url == @refresh_token_url refresh_token = options[:refresh_token] user_uid = options[:user_uid] puts "*" * 88 puts url.to_s puts method.to_s configp = config.dup puts configp.finalize!.to_hash.inspect puts "*" * 88 request = Typhoeus::Request.new url, config.finalize! request.on_complete do |response| case when response.success? puts "Success" @callback_request_made.call return Echidna::Response.new response when response.timed_out? puts "Timed out. Is google down?" return Echidna::Error.new response when response.code == 401 puts "In refresh block" if refresh_token && @client_id && @client_secret new_access_token = fetch_new_access_token(user_uid, refresh_token) options.delete(:refresh_token) options[:access_token] = new_access_token return api(method, url, options) else return Echidna::Error.new response end when response.code == 0 puts"Could not get an http response, something's wrong." return Echidna::Error.new response else puts "HTTP request failed: #{response.code}" return Echidna::Error.new response end end @hydra.queue(request) @hydra.run request end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def internal; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def continued_exception; end", "def refutal()\n end", "def escaper; end", "def used?; end", "def implementation; end", "def implementation; end", "def wrapper; end", "def original; end", "def suivre; end", "def internal?; end", "def missing?; end", "def custom; end", "def custom; end", "def escaper=(_); end", "def final; end", "def missing; end", "def anchored; end", "def original_result; end", "def next() end", "def next() end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def ignores; end", "def berlioz; end", "def fallbacks; end", "def fallbacks; end", "def identify; end", "def finalized; end", "def prepareForReuse; end", "def original_error; end", "def original_error; end", "def sitemaps; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def terpene; end", "def handle; end", "def isolated; end", "def isolated; end", "def pausable; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def big_bad; end", "def placebo?; false end", "def extra; end", "def private_method\n end", "def ignore; end", "def celebration; end", "def from; end", "def from; end", "def from; end", "def from; end", "def missed?; end", "def processor; end", "def fallbacks=(_arg0); end", "def weber; end", "def final?; end", "def issn; end", "def init; end", "def init; end", "def init; end", "def init; end", "def remaining; end", "def treat_reserved_as_conflict; end", "def incomplete\r\n\r\n end", "def offences_by; end", "def catch_exceptions; end", "def ibu; end", "def missing?; false; end", "def trd; end", "def processed_source=(_); end", "def processed_source=(_); end", "def exceptions; end", "def next()\n \n end", "def next()\n \n end", "def read_auto_clean_up; end", "def returns; end", "def expanded; end", "def post_process; 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 initialize() end", "def overrides; end", "def internship_passed; end", "def formation; end", "def semact?; false; end", "def operations; end", "def operations; end", "def overload; end", "def next!() end", "def exception; end", "def exception; end", "def exception; end" ]
[ "0.71707755", "0.58906937", "0.5710041", "0.559744", "0.55509555", "0.55509555", "0.55509555", "0.55509555", "0.55278456", "0.54767865", "0.54401076", "0.53696835", "0.53450876", "0.53450876", "0.5342907", "0.53367764", "0.5315195", "0.53122306", "0.5302294", "0.5287955", "0.5287955", "0.52867633", "0.528225", "0.52784914", "0.52573824", "0.5242106", "0.5234966", "0.5234966", "0.52137804", "0.52137804", "0.52137804", "0.5209673", "0.51642805", "0.51443535", "0.51443535", "0.51325434", "0.5128925", "0.5128161", "0.51182514", "0.51182514", "0.51103634", "0.51047146", "0.51047146", "0.51047146", "0.51047146", "0.5077552", "0.50706524", "0.5040313", "0.5040313", "0.5036669", "0.50287205", "0.5023317", "0.5022687", "0.5018444", "0.50167704", "0.5015732", "0.49972558", "0.49939921", "0.49939921", "0.49939921", "0.49939921", "0.49926263", "0.49837765", "0.4980514", "0.4979373", "0.49775782", "0.49670148", "0.49662432", "0.49662432", "0.49662432", "0.49662432", "0.49642926", "0.4953833", "0.49498537", "0.4948148", "0.49434713", "0.49426585", "0.4939251", "0.49353328", "0.49276873", "0.49276873", "0.4926027", "0.4920337", "0.4920337", "0.49181634", "0.49121457", "0.49096274", "0.49091384", "0.4904046", "0.49001592", "0.48971862", "0.4896379", "0.4895834", "0.48867154", "0.48821932", "0.48821932", "0.48804912", "0.48801208", "0.48792148", "0.48792148", "0.48792148" ]
0.0
-1
Set default balance to 0
def set_defaults self.balance ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_balance!(value)\n\t\t@balance.balance = value\n\t\t@bet = 0 \n\tend", "def update_normal_balance\n self.normal_balance = :none\n end", "def initialize\n @balance = 0\n end", "def default_values\n self.cash ||= 0.0\n end", "def private_reset!\n @balance = 0\n end", "def balance=(value)\n @balance = value\n end", "def balance\n super\n end", "def balance\n super\n end", "def set_nil_to_default_value\n self.withdraw = false if self.withdraw.nil?\n self.currency_id = Currency.first.id if self.currency_id.nil?\n end", "def balance\n @balance ||= total - amount_paid\n end", "def balance=(balance)\n @balance = balance\n end", "def balance=(amount)\n self[:balance] = amount\n end", "def initialize(starting_balance)\n @balance = starting_balance\n end", "def withdraw(amount)\n @balance = @balance - amount\n end", "def overdraft_fee\n @balance -= 30 \n end", "def setDefault\n self.monthlyCost ||= 0.0 # will set the default value only if it's nil\n self.annualCost ||= 0.0\n end", "def reset_player_balances\n update_attributes(actions: 1, treasure: 0, buys: 1, prompt: nil) \n end", "def initialize(balance)\n @balance = balance\n end", "def initialize(exisiting_savings) #This gets called when a new instance of a bank account gets created\n # @balance = 0\n @balance = exisiting_savings\n end", "def initialize(balance:)\n @balance = balance\n @change = nil\n @product = nil\n end", "def withdraw(amount)\n @balance -= amount\n end", "def balance\n @balance ||= starting_balance + transactions.inject(0) do |result, element|\n result + element.amount\n end\n end", "def withdraw!(amount)\n amount = -amount if amount > 0\n add_transaction(amount)\n\n balance\n end", "def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n self.estimated_cost ||= 0\n self.anticipated_cost ||= 0\n end", "def withdraw(amount)\n @balance -= amount\n end", "def add_to_bank\n @user.balance -= 10\n @croupier.balance -= 10\n @bank = 20\n end", "def springboard_adjust_balance!\n springboard_export_class.adjust_balance(self)\n end", "def set_defaults\n if self.has_attribute?(:extra_cost)\n self.extra_cost ||= 0.0\n end\n if self.has_attribute?(:stock)\n self.stock ||= 0.0\n end\n end", "def handle_wallet_amount\n self.wallet_amount_applied = false if self.wallet_amount_applied.nil?\n self.wallet_amount = 0.to_f if self.wallet_amount.nil?\n end", "def set_defaults\n self.rate ||= 0\n end", "def initialize(account_id, balance, opendate)\n super # or super(account_id, balance, opendate); never put super()\n @withdrawal_fee = 2\n end", "def balance\n @balance ||= starting_balance + flights.inject(0) do |result, element|\n result + element.profit\n end\n end", "def initialize\n super\n @bet_amount = 0\n end", "def update_balance(balance)\n self.balance = balance\n self.save!\n end", "def deposit(amount)\n @balance = @balance + amount\n end", "def balance=( value )\r\n @address.send( '@balance=', value )\r\n end", "def set_defaults\n super\n self.seating_capacity ||= 0\n self.standing_capacity ||= 0\n self.wheelchair_capacity ||= 0\n end", "def set_default_rate\n currency_rates[base_currency] = DEFAULT_RATE\n end", "def default_amount=(new_amount)\n new_amount = new_amount.gsub(/[^0-9.]/i, '') unless new_amount.is_a?(Numeric)\n self[:default_amount] = new_amount\n end", "def block_amount(amount)\n self.unavailable_balance += amount.to_d\n self.save!\n end", "def reset_money\n @total_rat_money = 0\n\n set_kmuddy_variable(\"total_rat_money\", 0)\n\n @inventory_rats = 0\n\n set_kmuddy_variable(\"current_rat_count\", 0)\n send_kmuddy_command(\"put sovereigns in pack\")\n end", "def assign_default_price\n self.cost_per_min = 120\n end", "def debit(amount)\n self.balance -= amount\n end", "def actualizar_balance\n @cuenta_general = Sistema::Usuario.find_by(\n numero_cuenta: Finanzas::Transaccion::CUENTA_GENERAL\n )\n @cuenta_general.update_attribute :balance, @cuenta_general.balance.to_f + @deposito.comision\n @usuario.update_attribute :balance, @usuario.balance.to_f + @deposito.monto\n end", "def set_amount_on_creation\n self.amount ||= self.initial_amount\n end", "def update_purchase_balance\n update(balance: financial_transactions.sum(:total_amount))\n end", "def withdraw(debit, fee = FEE)\n super(debit, fee)\n if @balance - debit < INITIAL_MIN_BALANCE # @balance 10, 000 - 100 <\n puts \"WARNING!\"\n @balance -= debit - fee\n return @balance\n # need to keep closed until brought back up\n elsif @balance < INITIAL_MIN_BALANCE\n puts \"Pay FEE plus balance\"\n return @balance\n else @balance - debit > INITIAL_MIN_BALANCE\n return @balance\n end\n end", "def debt_zero(chain)\n\t _chain_info = @@chain_infos[chain]\n\n\t return Amount.new([0.0, _chain_info.debt.precision, _chain_info.debt.nai], chain)\n\tend", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def balance\n Money.new(\n Revenue.to_account(self).joins(:virtual_revenues).sum('\"virtual_revenues\".\"cents\"').to_i +\n Transfer.to_account(self).sum(:cents) - Transfer.from_account(self).sum(:cents) - \n Purchase.from_account(self).joins(:virtual_purchases).sum('\"virtual_purchases\".\"cents\"').to_i +\n self.initial_balance_in_cents\n )\n end", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def adjBalance\n\t\t0\n\tend", "def sync_balance\n begin\n synced_balance = BigDecimal.new(ripple_client.xrp_balance)\n update balance: synced_balance, validated: true\n rescue => e\n nil # raise custom error here\n end\n end", "def cash\n @cash ||= Money.new(0)\n end", "def balance\n if @options[:verbose]\n warning = \"Coinbase doesn't provide a USD balance because\"\n warning << \" it connects to your bank account. Be careful, \"\n warning << \"because this will withdraw directly from your accounts\"\n warning << \"when you trade live.\"\n logger.warn warning\n end\n @balance ||= [max_float, max_float]\n end", "def payment(amount)\n @balance -= amount\n end", "def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_worth_credit ||= 0\n end", "def remaining_balance\n if self.total_amount.blank?\n balance = 0\n\t\telsif self.penalty - paid_total > 0\n\t\t\tbalance = self.total_amount\n else\n\t\t\tbalance = self.total_amount - paid_total\n end\n\n if balance <= 0\n return 0\n else\n return balance\n end\n end", "def deposit(amount)\n @balance += amount\n @balance\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(money)\n self.balance = (self.balance + money)\n end", "def price_with_default\n self.currency.nil? ? Money.new(self.price_cents || 0, self.default_currency) : self.price_without_default\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def deposit(amount)\n @balance += amount\n end", "def default_values\n \tself.total_worth ||= 0\n \tend", "def deposit(amount)\n self.balance = (self.balance + amount).round(2)\n self.save!\n end", "def set_default\n self.member.payout_methods.active_only.each do |pm|\n pm.update_attribute(:default, false) if pm.default?\n end\n self.update_attribute(:default, true)\n end", "def withdraw(amount_to_withdraw)\n @balance -= amount_to_withdraw\n end", "def starting_balance\n @balance\n end", "def deposit(deposit_amount)\n self.balance += deposit_amount\n end", "def deposit(deposit_amount)\n if deposit_amount <= 0\n puts \"dummy.\"\n else\n @balance += deposit_amount\n end\n show_current_balance\n end", "def actual_balance\n if previous.present?\n previous.balance_amount_with_sign\n else\n 0\n end\n end", "def reset\r\n @spend = 0\r\n end", "def modify_wallet(bet)\n $wallet -= bet\n if $wallet < 0\n $wallet += bet\n puts \"Oops! Looks like you do not have enough money for that.\".red\n first_spin\n end\n end", "def deposit(deposit_amt = 0)\n @balance = @balance + deposit_amt\n return @balance\n end", "def update_balance\n if(@transaction.sender)\n @transaction.sender.balance -= @transaction.amount\n @transaction.sender.save\n end\n\n if(@transaction.receiver)\n @transaction.receiver.balance += Monetize.parse(convert(Money.new(@transaction.amount,findCurrency(@transaction.sender_id, @transaction.receiver_id, 'sent')), @transaction.receiver.currency)).fractional\n @transaction.receiver.save\n end\n end", "def valores_por_default\n \t\tself.costo ||= 0\n \tend", "def deposit(cash)\n @balance += cash\n end", "def balance\n if self.normal_balance.debit?\n self.amounts.balance\n elsif self.normal_balance.credit?\n - self.amounts.balance\n else\n nil\n end\n end", "def deposit(amount)\n result = BigDecimal.new(balance) + BigDecimal.new(amount)\n update_attributes(balance: result)\n end", "def initialize(id, balance, open_date)\n\t\t# ruby dosen't like constants in intialize values, lowercase it\n\t\t\t@id = id\n\t\t\t@balance = balance\n\t\t\t@open_date = open_date\n\t\t\t# pretty_initial_balance = (@initial_balance / 100).to_f\n\t\t\tis_negative # method to determine if transaction would lead to overdraft\n\t\tend", "def initialize(notes = DEFAULT_BALANCE)\n @balance = {}\n deposit(notes)\n end", "def initialize_account\n self.credits = 0\n end", "def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end", "def balance(ending_at=nil)\n return @balance if !!@balance && !ending_at\n if ending_at\n balance_cents = self.transactions.sum(:cents,\n :conditions => [\"created_at < ? AND action NOT IN (?)\", ending_at, ['authorize', 'void']]\n )\n @balance = nil\n Money.new(balance_cents || 0, self.currency)\n else\n @balance = Money.new(self.cents, self.currency)\n end\n end", "def set_estimated_amount\n estimated_amount = self.amortization.nil? ? 0 : (self.amortization/self.trust_fund.broadcast_cost)\n if estimated_amount < 0\n self.estimated_amount = 0\n else\n self.estimated_amount = estimated_amount\n end\n end", "def deduct(amount)\n @balance -= amount\n end", "def set_defaults\n if self.has_attribute?(:hidden) && self.hidden.nil?\n self.hidden = true\n end\n if self.has_attribute?(:base_price)\n self.base_price ||= 0.0\n end\n end", "def withd amount\n unless amount > @savings_account_balance\n @savings_account_balance -= amount\n \n else\n end\n end", "def initialize(id, balance)\n raise ArgumentError.new \"Money Market Accounts must\n have at least $10,000\" if balance < 10000\n super(id, balance)\n @transactions = 6\n end", "def withdraw(name, amount)\n a = find_account(name)\n a[:balance] < amount ? a[:balance] -= 30 : a[:balance] -= amount\n end", "def set_prepaid\n credit = 0\n postpaid = 0\n end", "def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end", "def withdraw(amount)\n amount += TRANSACTION_FEE\n super(amount)\n end", "def initialize(amount, currency)\n @amount = amount.to_f.round(2)\n @base_currency = currency\n @bank = Bank.instance\n end" ]
[ "0.74693877", "0.74277264", "0.74271846", "0.70978135", "0.69049", "0.68594307", "0.6772159", "0.6772159", "0.67370886", "0.6696416", "0.66454554", "0.6548945", "0.6536703", "0.65297747", "0.6502492", "0.6451147", "0.64247555", "0.6390928", "0.63666725", "0.6363551", "0.6356434", "0.63513345", "0.63380075", "0.63371295", "0.63340116", "0.63236934", "0.63082135", "0.6298891", "0.62952584", "0.6283186", "0.6254922", "0.6228371", "0.6220669", "0.6213308", "0.62101704", "0.61970645", "0.618381", "0.61811537", "0.6177288", "0.6141255", "0.6140533", "0.6125468", "0.6121563", "0.61152184", "0.6089399", "0.60809976", "0.6080384", "0.60785294", "0.60702085", "0.6046299", "0.6044018", "0.6039931", "0.60334474", "0.6024004", "0.6018271", "0.599979", "0.59952855", "0.5995173", "0.5993604", "0.5991116", "0.5985106", "0.5985106", "0.598425", "0.59800863", "0.5979259", "0.5979035", "0.5978387", "0.5978387", "0.5978387", "0.5978187", "0.5977848", "0.59761554", "0.5969116", "0.5965019", "0.59586966", "0.59534913", "0.59491265", "0.59470975", "0.593368", "0.5925548", "0.59108627", "0.5910819", "0.5908133", "0.5908121", "0.58898145", "0.5886146", "0.58667344", "0.58599055", "0.5859304", "0.5837147", "0.5824625", "0.58180875", "0.581187", "0.58054197", "0.5805313", "0.5800726", "0.5797553", "0.5784523", "0.5784523", "0.5781129" ]
0.8344647
0
Get All Product in Wishlist for User
def index @wishlist = Wishlist.where(:user_id => current_user.id) @wishlist_items = Wishitem.where(:wishlist_id => @wishlist) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wishers\n @items = UserProductWish.includes(:account).where({product: @product}).all\n end", "def index\n @wishlists = Wishlist.where(user_id: current_user.id)\n end", "def wishlist\n @lineItems = LineItem.where(\"user_id = ? AND line_item_type = ?\", current_user.id, 1)\n @items = Array.new\n @lineItems.each do |lineItem|\n @items.push(lineItem.item)\n end\n end", "def index\n set_user\n @wishlists = Wishlist.where(user_id: @user.id) || []\n end", "def index\n @wishlists = Wishlist.all\n @mywishlists = Wishlist.where('user_id' => current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end", "def show\n @current_wishlist = Wishlist.find(params[:id])\n @wishlist_items = @current_wishlist.wishlist_items\n @order_item = current_order.order_items.new\n @users = User.all\n \n end", "def set_wish_list\n @wish_list = WishList.where(user_id: current_user_id)\n end", "def index\n @wish_list_items = WishListItem.all\n end", "def index\n if current_user.present?\n @wishlists1 = current_user.wishlists\n end\n @wishlists2 = Wishlist.where(\"shared =?\", 'public')\n @users = current_users\n end", "def wish_list(options={})\n get('/wish_list', options)\n end", "def favorited_items\n User.first.favorites.map {|fi| fi.product}\n end", "def index\n @wish_lists = WishList.all\n end", "def index\n\t@wishlist = Wishlist.all\n\t@client = Client.all\n\t#@product = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wishlists }\n end\n end", "def activate\n\n User.class_eval do\n has_many :wishlists\n \n def wishlist\n default_wishlist = self.wishlists.first(:conditions => [\"is_default = ?\", true]) \n default_wishlist ||= self.wishlists.first\n default_wishlist ||= self.wishlists.create(:name => \"My wishlist\", :is_default => true)\n default_wishlist.update_attribute(:is_default, true) unless default_wishlist.is_default?\n default_wishlist\n end\n end\n\n ProductsController.class_eval do \n \n private\n \n def handle_wishlists\n if params[:wishlist_ids]\n current_user.wishlists.map{ |l| l.wished_products.delete(@product) }\n wishlists = params[:wishlist_ids].map { |id| Wishlist.user_id_equals( current_user.id ).find( id ) }\n wishlists.map { |l| l.wished_products << @product }\n end\n end\n end\n end", "def find_wishlist\n @wishlist = Spree::Wishlist.find_by!(access_hash: params[:id])\n end", "def index\n @my_products = current_user.products.includes(:tweets)\n end", "def bring_products_from_wardrobe\n wardrobe_products = []\n current_user.products.order(:created_at => 'ASC').each do |product|\n wardrobe_products << search_by_id(product.id)\n end\n\n render json: {status: 0, data:{wardrobe_products: wardrobe_products}}\n end", "def wishlist_params\n params.require(:wishlist).permit(:product_id, :user_id)\n end", "def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end", "def wish_list_params\n params.require(:wish_list).permit(:product_id, :user_id)\n end", "def find_wishlist\n @wishlist = Spree::Wishlist.find_by_access_hash!(params[:id])\n end", "def shopping_products items\n\titems.select do |item|\n\t\titem['kind']=='shopping#product'\n\tend\nend", "def show\n @products = current_user.products\n @products_bidded = []\n bids = current_user.bids\n bids.each { |bid| @products_bidded.push(Product.find_by(id: bid.product_id)) }\n end", "def check_wishlist(item)\n #Query wish lists to see if the criteria matches\n @wish_list = search_wishlist(item)\n @notify_list = Array.new\n @wish_list.each do |wish_list_item|\n if @notify_list.size == 0\n @notify_list.push wish_list_item\n else \n @inList = false\n #Checks to see if the user of the wish list is already in the notificaiton list \n @notify_list.each do|notify_list_item| \n \t\tif notify_list_item.user_id == wish_list_item.user_id\n\t\t\t\t\t\t\t@inList = true \n\t\t\t\t\t\t\tbreak \n end \n end \n if @inList == false \n\t\t\t\t\t@notify_list.push wish_list_item \n end\n end\t\n end\n alert_user(item, @notify_list)\n end", "def add_to_wishlist(product)\n wishlist.products << product unless wishlist.products.include?(product)\n wishlist.save\n end", "def show\n authorize! :read, @user\n # since wishlist items are added from the user profile, a blank one is initialised here\n # (though the form won't be displayed if the user isn't authorised to add wishlist items)\n @wishlist_item = WishlistItem.new(user: @user)\n end", "def index\n @wishes = Wish.valid_wish.all\n end", "def set_wishlist\n @wishlist = current_user.wishlists.find(params[:id])\n end", "def create\n @wish_list = WishList.new(\n product_id: params[:product_id],\n user_id: params[:user_id]\n )\n respond_to do |format|\n if @wish_list.save\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { render :show, status: :created, location: @wish_list }\n else\n format.html { render :new }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @basket_items = current_user.basket_items.includes(:product)\n @user = current_user\n end", "def index\n @wishes = Wish.all\n end", "def index\n @wishes = Wish.all\n end", "def index\n @products = current_user.products.all\n end", "def set_products_wish\n @products_wish = ProductsWish.find(params[:id])\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \t@wish.save\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def all\n @favourites = Favourite.get_all(@user.id, 'Product').page(params[:page]).per(10)\n end", "def show\n Wishlist.all.each do |wishlist| \n if wishlist.email == current_user.email\n if (Application.where(id: wishlist.app_id)).exists?\n @application = Application.find (wishlist.app_id)\n end\n end\n end\n end", "def index\n @products = current_user.products\n end", "def user_favorite_wrestlers\n FavoriteWrestler.all.select do |fav|\n fav.user == self \n end \n end", "def product_like\n if user_signed_in?\n ProductLike.create_like(@product.productId, current_user_columns.id, cookies[:user_id])\n else\n ProductLike.create_like(@product.productId, 4, cookies[:user_id])\n end\n render layout: false\n end", "def index\n @granted_wishes = GrantedWish.all.page(params[:page])\n end", "def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n\tif @wishlist.save\n \t\tparams[:product_id].each do |product|\n \t\t\t@wishlist.products << Product.find(product)\n \t\n \tend\n \tredirect_to :action => \"show\", :id => @wishlist#.client.id\n else\n \trender action: \"new\"\n end\n \n end", "def get_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: Product.order(created_at: :desc).limit(20).map(&:simple_info.with(follower)),\n status: :ok\n end", "def products()\n return filter_products()\n end", "def index\n @shopping_lists = ShoppingList.where(user_id: current_user.id)\n end", "def product_list\n current_user.products.order('name').collect {|p| [ p.name, p.ticket_project_id, p.id ]}\n end", "def user_favourites(current_user, product)\n Favourite.where(user_id: current_user, product_id: product) > 0\n end", "def set_wish_list\n @wish_list = current_user.wish_lists.find(params[:id])\n end", "def show\n @favorite_products = Product.where(id: @client.favorites.pluck(:product_id))\n #@restock_products = Variant.where(id: @client.restocks.pluck(:variant_id))\n end", "def show\n @item = Item.find_by_slug!(params[:slug])\n @item_ass = Item.joins(:category).where('categories.name' => \"Accessories\").limit(4).order(\"RANDOM()\")\n @items = Item.where(:category_id => @item.category_id).where.not(:id => @item.id).limit(4).order(\"RANDOM()\")\n # @wishlists_count=Wishlist.where(:item_id =>@item).count\n end", "def new\n @wishlist = Wishlist.new\n \t@client = Client.find(params[:client_id])\n @wishlist.client_id = @client.id\n\n @category = Category.where(:wishlist => true).first\n @product = Product.where(:category_id => @category.id).order(:category_id)\n end", "def donor_wishes\n conns=connections_as_friend-[base_connection]\n dls=DonorLink.where(connection_id: (conns.collect{|c| c.id}) )\n Wish::FromDonor.where(id: (dls.collect {|dl| dl.wish_id}).uniq ).order(\"updated_at DESC\")\n end", "def user_products\n @products = current_user.products\n\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end", "def show_favorites\n authenticate_rem\n follower = @current_user || User.find_by_id(params[:user_id])\n render json: follower.favorite_products.map(&:simple_info.with(follower)), status: :ok\n end", "def index\n @wishlists = Wishlist.all\n @authors = Author.all.order(:name)\n @publishers = Publisher.all.order(:name)\n end", "def index\n @products = current_user.products.all\n @products_approved_false = current_user.products.where(approve: false)\n @products_approved = current_user.products.where(approve: true)\n @cancelled = current_user.products.where(cancelled: true)\n end", "def set_wish_list\n @wish_list = WishList.find(params[:id])\n end", "def set_wish_list\n @wish_list = WishList.find(params[:id])\n end", "def wish_list_params\n params.require(:wish_list).permit(:product_id)\n end", "def add\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n (wishlist.products << product) unless wishlist.products.include?(product)\n render :update do |page| \n page.replace_html(\"current_wish_list\",render(:partial => \"/wishlists/album\", \n :locals => {:owner => current_user}))\n end\n end", "def wishlist_params\n params.require(:wishlist).permit(:userId)\n end", "def donor_wishes\n conns = connections_as_friend - [base_connection]\n dls = DonorLink.where(connection_id: conns.collect(&:id))\n Wish::FromDonor.where(id: dls.collect(&:wish_id).uniq).order('updated_at DESC')\n end", "def product_list\n a = selectable_products\n l = products a\n l\n end", "def create\n @wishlist = Wishlist.find_by(:user_id => current_user.id)\n @wishlist_items = Wishitem.new(:wishlist_id => @wishlist.id, :product_id => params[:prod_id])\n @wishlist_items.save\n if @wishlist_items.save\n redirect_to \"/products?page=#{params[:page]}\"\n end\n end", "def list_favourites(user_id)\n @favourites_store.where(user_id)\n end", "def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list,\n :notice => 'Wish list item was successfully created.') }\n format.json { render :show, status: :created, location: @wish_list_item }\n else\n format.html { render :new }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to wish_list_path(@wish_list)\n end\n end", "def index\n @products = @user.products\n # was @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def list_products_stored\n list = DATABASE.execute(\"SELECT name FROM products WHERE shelf_id = #{@id}\")\n end", "def set_wishlist\n # @wishlist = Wishlist.find(params[:id])\n end", "def show_product_warehouse\n @products = Product.where(:warehouse_id=>2)\n end", "def update\n @wishlist = Wishlist.find(params[:id])\n @product = Product.all\n\n if @wishlist.update_attributes(params[:wishlist])\n \t\tparams[:product_id].each do |product|\n \t\t\tif @wishlist.products.where(:id => product).count == 0\n \t\t\t @wishlist.products << Product.find(product)\n \t\t\tend\n \t\tend\n\t\t\n \tredirect_to :action => \"show\", :id => @wishlist\n \t\tend\n\n# if @wishlist.update_attributes(params[:wishlist])\n# format.html { redirect_to Wishlist, notice: 'Pickup list was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: Wishlist.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def getZapposSvpplyWants\n\n zapposSvpplyWants = Array.new()\n \n begin\n svpplyUserId = self.svpplyUserId\n productsResponse = JSON.parse(HTTParty.get(\"https://api.svpply.com/v1/users/#{svpplyUserId}/wants/products.json\").response.body)[\"response\"][\"products\"]\n \n #filter out products for sale at Zappos\n productsResponse.each do |p|\n if p[\"store\"].to_s.include?(\"Zappos\")\n zapposSvpplyWants.push(p)\n end\n end\n rescue\n #do nothing - will send error email to user \n end\n \n zapposSvpplyWants\n end", "def wishlist\n @wishlists = Wishlist.all.order('id DESC')\n render :template => \"backend/Wishlist/wishlist\"\n end", "def index\n\n if params[:user_id].present?\n # @products = Product.all\n @products = Product.where(user_id: params[:user_id])\n else\n @products = Product.all\n # search_product = params[:products][:search]\n # @products = Product.where(user_id: params[:user_id])\n end\n end", "def show\n \t@wishlist = Wishlist.find(params[:id])\n \t@client = @wishlist.client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def user_product_listings\n render json: @user.product_listings\n end", "def wishlist_params\n params.require(:wishlist).permit(:name, :user_id, :shared)\n end", "def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_sells << product_to_check\n end#of if\n end#of do\n return products_this_vendor_sells\n end", "def create\n authorize! :create, WishlistItem.new\n\n @spree_variant=Spree::Variant.find(params[:wishlist_item][:spree_variant_id])\n @product=current_site.contents.find_by({:spree_product_id=>@spree_variant.product_id, _type: \"Product\"})\n @wishlist_item = spree_current_user.wishlist_items.build(:spree_variant_id=>@spree_variant.id)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { render action: \"show\", notice: 'Wishlist item was successfully created.' }\n format.json { render json: @wishlist_item, status: :created, location: @wishlist_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if current_user.admin?\n @products = Product.all\n else\n if current_user.private?\n @products = Product.where(owner_id: current_user.private_id)\n elsif current_user.business?\n @products = Product.where(owner_id: current_user.business_id)\n end\n\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end", "def get_favorites\n @user = User.find(self.id)\n return Shop.where(id: \n { :$in => @user.favorite_places })\n .each { |shop| pp \"#{shop.picture}, #{shop.name}, #{shop.email}, #{shop.city}, #{shop.location}\"}\n end", "def search_wishlist(item) \n \n # Go through the wish lists in the data base and search for matching criteria\n \n if(item.description != nil)\n @description_match = WishList.where('description ILIKE ? ', \"%#{item.description}%\")\n @wish_list = @wish_list | @description_match\n end\n \n if(item.condition)\n @condition_match = Array.new\n if(item.condition == '%' || item.condition == 'Rough') \n @condition_match = WishList.where('condition LIKE ?','Rough')\n elsif(item.condition == 'Fair')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ?','Rough','Fair')\n elsif(item.condition == 'Good')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good')\n elsif(item.condition == 'Excellent')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good', 'Excellent')\n elsif(item.condition == 'Like New')\n @condition_match = WishList.where('condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ? OR condition LIKE ?','Rough','Fair', 'Good', 'Excellent', 'Like New')\n end\n @wish_list = @wish_list & @condition_match\n end \n \n if(item.price != nil)\n @price_match = WishList.where('price IS NOT NULL AND price >= ?', item.price)\n @wish_list = @wish_list & @price_match \n end\n \n if(item.weight != nil)\n @weight_match = WishList.where('weight IS NOT NULL AND weight >= ?', item.weight)\n @wish_list = @wish_list & @weight_match \n end\n \n if(item.location != nil)\n @location = WishList.where('location ILIKE ?',item.location.address )\n @wish_list = @wish_list & @location \n end\n \n if(item.length != nil)\n @length = WishList.where('length >= ?',item.length )\n @wish_list = @wish_list & @length \n end\n \n if(item.width != nil)\n @width = WishList.where('width >= ?',item.width )\n @wish_list = @wish_list & @width \n end\n \n if(item.height != nil)\n @height = WishList.where('height >= ?',item.height )\n @wish_list = @wish_list & @height \n end\n \n @wish_list = WishList.where('user_id != ? AND name ILIKE ? AND category LIKE ? AND quantity <= ? AND available_until >= ?', item.user_id, \"%#{item.name}%\",item.category, item.quantity, item.available_from)\n \n return @wish_list\n\tend", "def wish_list_item_params\n params.require(:wish_list_item).permit(:wishlist_id, :product_id)\n end", "def show\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wish_list_item }\n end\n end", "def show\n redirect_to root_url && return unless user_signed_in?\n @added_to_watchlist = current_user.wishlist_items.where(opportunity_id: params[:id]).exists?\n end", "def index\n\t\t@cart_items = current_user.shoppingkarts \n\t\t#Shoppingkart.find(current_user)\n\tend", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def update\n @wishlist = Wishlist.where(:user_id => current_user.id)\n @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id])\n @wishlist_item.destroy\n if params.has_key?(:page)\n redirect_to \"/products?page=#{params[:page]}\"\n else\n redirect_to mywishlist_path\n end\n end", "def add_to_wishlist product, options = {}\n options.reverse_merge! default_wishlist_options(product)\n wishlist_id = options[:wishlist_id].present? ? options[:wishlist_id] : @front_presenter.user_wishlist[product.id]\n\n link_body, link_path, link_options =\n if current_user.wishes.product_exists?(product.id)\n [I18n.t('delete'), product_wishlist_path(product, wishlist_id), options.merge!(wishlist_delete_options)]\n else\n [I18n.t('i_like'), product_wishlists_path(product), options.merge!(method: :post)]\n end\n\n link_to link_path, link_options do\n [make_tag, content_tag(:span, link_body)].join('').html_safe\n end\n end", "def index\n @products = current_seller.product.all\n end", "def products\n Product.find_all_by_vendor_id(@id)\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def set_wishlist\n @wishlist = Wishlist.find(params[:id])\n end", "def set_is_wishlist(venues, user_id)\n return venues if user_id.nil?\n\n if venues.respond_to?(:each)\n venue_ids = Wish.where(user_id: user_id).pluck(:venue_id)\n venues.each do |v|\n v.is_wishlist = venue_ids.include?(v.id)\n end\n else\n venues.is_wishlist = is_wish?(venues.id, user_id)\n end\n venues\n end", "def show\n @wishlist = Wishlist.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlist }\n end\n end", "def shop_products\n products.shop_products\n end" ]
[ "0.8161806", "0.7293703", "0.70846957", "0.7038927", "0.6913601", "0.6867886", "0.6767524", "0.6754371", "0.6741246", "0.66906977", "0.662427", "0.66124076", "0.6609344", "0.6594031", "0.6560187", "0.65120506", "0.6508213", "0.6504744", "0.6483553", "0.64579093", "0.643969", "0.64047164", "0.636679", "0.6346754", "0.6333398", "0.62415826", "0.62173027", "0.62005246", "0.6185276", "0.61825067", "0.61529386", "0.61529386", "0.6131147", "0.6105265", "0.60936654", "0.6083024", "0.6080085", "0.6064777", "0.60375273", "0.60360247", "0.60298675", "0.6027195", "0.6026562", "0.6007903", "0.59996164", "0.5997745", "0.5981561", "0.5979176", "0.59780675", "0.5977705", "0.5969425", "0.5955242", "0.592202", "0.5912911", "0.58970135", "0.5882788", "0.58795875", "0.58795875", "0.5877688", "0.58739203", "0.58604693", "0.58568937", "0.5852022", "0.58438045", "0.5835854", "0.5815707", "0.5809916", "0.5808114", "0.5800888", "0.5796358", "0.5787686", "0.57787234", "0.57759106", "0.57739127", "0.5763424", "0.5752828", "0.5751784", "0.5751586", "0.57349944", "0.5729592", "0.57271624", "0.5717123", "0.5713395", "0.57126254", "0.5711737", "0.57025045", "0.57000244", "0.56985414", "0.5692263", "0.56872565", "0.5685793", "0.56802136", "0.56801873", "0.56801873", "0.56801873", "0.56801873", "0.56801873", "0.5674724", "0.56621903", "0.56602126" ]
0.73153555
1
Add new Product to User Wishlist
def create @wishlist = Wishlist.find_by(:user_id => current_user.id) @wishlist_items = Wishitem.new(:wishlist_id => @wishlist.id, :product_id => params[:prod_id]) @wishlist_items.save if @wishlist_items.save redirect_to "/products?page=#{params[:page]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @wish_list = current_user.wish_list\n product = Product.find(params[:product_id])\n @wish_list_item = @wish_list.add_product(product.id, @wish_list)\n\n if @wish_list_item.present?\n respond_to do |format|\n if @wish_list_item.save\n format.html { redirect_to(@wish_list,\n :notice => 'Wish list item was successfully created.') }\n format.json { render :show, status: :created, location: @wish_list_item }\n else\n format.html { render :new }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to wish_list_path(@wish_list)\n end\n end", "def add_to_wishlist(product)\n wishlist.products << product unless wishlist.products.include?(product)\n wishlist.save\n end", "def add\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n (wishlist.products << product) unless wishlist.products.include?(product)\n render :update do |page| \n page.replace_html(\"current_wish_list\",render(:partial => \"/wishlists/album\", \n :locals => {:owner => current_user}))\n end\n end", "def add_product(product_params)\n\n\t\tcurrent_item = wish_items.find_by(variant_id: product_params[:product][:variant_id])\n\n\t\tif current_item\n\t\t\tcurrent_item.destroy\n\t\telse\n\t\t\tnew_item = wish_items.create(product_id: product_params[:product][:product_id],variant_id: product_params[:product][:variant_id], wish_id: self.id)\n\t\tend\n\t\t\n\t\tnew_item\n\tend", "def create\n @wish_list = WishList.new(\n product_id: params[:product_id],\n user_id: params[:user_id]\n )\n respond_to do |format|\n if @wish_list.save\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { render :show, status: :created, location: @wish_list }\n else\n format.html { render :new }\n format.json { render json: @wish_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_wishlist product, options = {}\n options.reverse_merge! default_wishlist_options(product)\n wishlist_id = options[:wishlist_id].present? ? options[:wishlist_id] : @front_presenter.user_wishlist[product.id]\n\n link_body, link_path, link_options =\n if current_user.wishes.product_exists?(product.id)\n [I18n.t('delete'), product_wishlist_path(product, wishlist_id), options.merge!(wishlist_delete_options)]\n else\n [I18n.t('i_like'), product_wishlists_path(product), options.merge!(method: :post)]\n end\n\n link_to link_path, link_options do\n [make_tag, content_tag(:span, link_body)].join('').html_safe\n end\n end", "def create\n @product = Product.new(params[:product])\n @category = @product.category\n \n if @product.category.wishlist?\n \t@product.status = \"0\"\n \t@product.status_date = Time.now\n \t\n \t#we are a wish list item... check to see if anybody is looking for us.\n \t#maybe we ignore this step here and leave it to daily processing.\n end\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlist = Wishlist.new(params[:wishlist])\n\n\tif @wishlist.save\n \t\tparams[:product_id].each do |product|\n \t\t\t@wishlist.products << Product.find(product)\n \t\n \tend\n \tredirect_to :action => \"show\", :id => @wishlist#.client.id\n else\n \trender action: \"new\"\n end\n \n end", "def create\n @wishlist = current_wishlist\n product = Product.find(params[:product_id])\n @wishlist_item = @wishlist.wishlist_items.build(:product => product)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { redirect_to(@wishlist, :notice => 'Wishlist item was successfully created.') }\n format.xml { render :xml => @wishlist_item, :status => :created, :location => @wishlist_item }\n else\n format.html { redirect_to(store_url, :notice => 'Item already added to wishlist') }\n format.xml { render :xml => @wishlist_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_product_to_wardrobe\n if current_user.products.find_by_id(params[:product_id]) == nil\n\n current_user.products << Product.find(params[:product_id])\n product = search_by_id(params[:product_id])\n\n render json: {status: 0, data: {product: product}}\n else\n\n render json: {status: 1, data: nil}\n end\n\n end", "def create\n @product = Product.new(params[:product])\n respond_to do |format|\n if @product.save\n current_user.user_info.products.push @product\n Shopify.create @product\n format.html { redirect_to :action => 'index' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :create, WishlistItem.new\n\n @spree_variant=Spree::Variant.find(params[:wishlist_item][:spree_variant_id])\n @product=current_site.contents.find_by({:spree_product_id=>@spree_variant.product_id, _type: \"Product\"})\n @wishlist_item = spree_current_user.wishlist_items.build(:spree_variant_id=>@spree_variant.id)\n\n respond_to do |format|\n if @wishlist_item.save\n format.html { render action: \"show\", notice: 'Wishlist item was successfully created.' }\n format.json { render json: @wishlist_item, status: :created, location: @wishlist_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlist_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlist = Wishlist.new(name: params[:wishlist][:name],\n user_id: current_user.email,\n shared: params[:wishlist][:shared])\n current_user.wishlists << @wishlist\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully created.' }\n format.json { render :index, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n products << product\n # save\n end", "def wishlist_params\n params.require(:wishlist).permit(:product_id, :user_id)\n end", "def product_like\n if user_signed_in?\n ProductLike.create_like(@product.productId, current_user_columns.id, cookies[:user_id])\n else\n ProductLike.create_like(@product.productId, 4, cookies[:user_id])\n end\n render layout: false\n end", "def add_new_product\n array_product = @view.new_product_info\n new_product = Product.new(array_product[0],array_product[1],array_product[2])\n @seller.save_product_info(new_product)\n input = @view.menu(\"2\")\n seller_actions(input)\n end", "def wish_list_params\n params.require(:wish_list).permit(:product_id, :user_id)\n end", "def set_products_wish\n @products_wish = ProductsWish.find(params[:id])\n end", "def add_to_wishlist\n if params[:id]\n if item = Item.find_by_id(params[:id])\n @customer.add_item_to_wishlist(item)\n else\n flash[:notice] = \"Sorry, we couldn't find the item that you wanted to add to your wishlist. Please try again.\" \n end\n else\n flash[:notice] = \"You didn't specify an item to add to your wishlist...\"\n end\n redirect_to :action => 'wishlist' and return\n end", "def create\n @shopping_list = ShoppingList.create(product_id: params[:product_id],\n user_id: current_user.id)\n\n respond_to do |format|\n if @shopping_list.save\n format.json { render json: {statue: 'Add successfully.'}}\n else\n format.json { render json: {statue: 'Something Wrong.'}}\n end\n end\n end", "def create\n @product = Product.new(product_params)\n @product.user_id = current_user.id\n @product.location = current_user.location\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n\n if current_user.products.count == 5 && current_user.badges(name: \"Super Producer\").blank?\n Badge.create(user_id: current_user.id, name: \"Super Producer\")\n end\n\n if current_user.products.where(perishables: true).count == 5 && current_user.badges(name: \"Green Thumb\").blank?\n Badge.create(user_id: current_user.id, name: \"Green Thumb\")\n end\n end", "def create\n @wishlist = current_user.wishlists.build(wishlist_params)\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { render :show, status: :created, location: @wishlist }\n else\n format.html { render :new }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_list(product)\n button_to(\"Add to shopping list\",\n increment_user_products_path(product_id: product.id),\n method: :post,\n remote: true,\n class: \"btn btn-success\")\n end", "def update\n @wishlist = Wishlist.find(params[:id])\n @product = Product.all\n\n if @wishlist.update_attributes(params[:wishlist])\n \t\tparams[:product_id].each do |product|\n \t\t\tif @wishlist.products.where(:id => product).count == 0\n \t\t\t @wishlist.products << Product.find(product)\n \t\t\tend\n \t\tend\n\t\t\n \tredirect_to :action => \"show\", :id => @wishlist\n \t\tend\n\n# if @wishlist.update_attributes(params[:wishlist])\n# format.html { redirect_to Wishlist, notice: 'Pickup list was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: Wishlist.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def create\n @wish = Wish.new(wish_params)\n if Wishlist.find(@wish.wishlist_id).user_id == current_user.id\n @wish.save \n end\n redirect_to wishlist_path(@wish.wishlist_id)\n end", "def create\n @product = Product.find(params[:product_id])\n @item = current_user.items.new(item_params)\n if @item.save\n redirect_to @product, success: 'Item was successfully created.'\n else\n redirect_to @product, alert: 'Все проебал'\n end\n end", "def add_product product\n\t\t@products.push product\n\t\tproduct\n\tend", "def add(product)\n items.create(product: product)\n end", "def create\n @wishlist = current_user.wishlists.build(params[:wishlist])\n\n respond_to do |format|\n if @wishlist.save\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully created.' }\n format.json { redirect_to wishlists_url }\n else\n format.html { render action: \"new\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # user_id: current_user[:id], item_description: params[:item_description], item_link: params[:item_link], item_rank: params[:item_rank], item_image: params[:item_image], item_price: params[:item_price]\n \t@wish = Wish.new(wish_params)\n @wish.user = current_user\n \t@wish.save\n\n wishList = Wish.where(\"user_id = #{@wish.user_id}\")\n render json: wishList\n\n end", "def create\n favory = current_user.favories.create(product_id: params[:id], user_id: current_user.id)\n redirect_to products_path()\n end", "def create\n # Get the product id\n watchlist_item = params.require(:watchlist)[:product_id]\n # Find the product id\n product = Product.find(watchlist_item)\n # Find the watchlist\n @watchlist = current_user.watchlist unless current_user.watchlist.blank?\n if current_user.watchlist.blank?\n @watchlist = Watchlist.new(buyer: current_user)\n end\n # Add product to watchlist\n @watchlist.add_product(product)\n\n redirect_to watchlists_url\n end", "def add_product(product)\r\n\t\t@shopping_cart << product\r\n\t\t@item_count +=1\t\t# add one to the item counter\r\n\tend", "def wish_list_params\n params.require(:wish_list).permit(:product_id)\n end", "def activate\n\n User.class_eval do\n has_many :wishlists\n \n def wishlist\n default_wishlist = self.wishlists.first(:conditions => [\"is_default = ?\", true]) \n default_wishlist ||= self.wishlists.first\n default_wishlist ||= self.wishlists.create(:name => \"My wishlist\", :is_default => true)\n default_wishlist.update_attribute(:is_default, true) unless default_wishlist.is_default?\n default_wishlist\n end\n end\n\n ProductsController.class_eval do \n \n private\n \n def handle_wishlists\n if params[:wishlist_ids]\n current_user.wishlists.map{ |l| l.wished_products.delete(@product) }\n wishlists = params[:wishlist_ids].map { |id| Wishlist.user_id_equals( current_user.id ).find( id ) }\n wishlists.map { |l| l.wished_products << @product }\n end\n end\n end\n end", "def create\n \n @wish = current_user.wishes.build(params[:wish])\n if @wish.save\n flash[:success] = \"Wish created!\"\n redirect_to root_url\n else\n @feed_items = []\n render 'static_pages/home'\n end\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_product(product)\n\t\tcurrent_item = line_items.find_by(product_id: product.id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product.id)\n\t\tend\n\t\tcurrent_item\n\tend", "def send_product(product)\n request(product, \"product\", :post, {method: \"add\"})\n end", "def addRef\n\t\t@favorite = current_client.favorite\n\t\tp = Product.find(params[:product_id])\n\t\tif (p!=@favorite.products.find_by_id(params[:product_id]))\n\t\t\t@favorite.products << p\n\t\t\tredirect_to home_url\n\t\telse redirect_to store_index_url, notice: 'Товар уже добавлен в избранное' \n\t\tend\n\t\t\n end", "def add_product(product, quantity)\n current_item = OrderItem.find_by(product_id: product.id, order_id: self.id )\n\n if current_item\n current_item.quantity = quantity\n current_item.save\n else\n new_item = OrderItem.new(product_id: product.id, quantity: quantity, order_id: self.id)\n new_item.save\n end\n end", "def create\n @product = current_user.products.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product.id)\n end\n current_item\n end", "def add_new_product\n aProduct = Product.new(@product_title, @product_price, @customer_id)\n aProduct.create_new_product\n end", "def set_wish_list\n @wish_list = WishList.where(user_id: current_user_id)\n end", "def create\n @product = Product.new(product_params)\n @product.user_id = current_user._id\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @wishlist = Wishlist.new\n \t@client = Client.find(params[:client_id])\n @wishlist.client_id = @client.id\n\n @category = Category.where(:wishlist => true).first\n @product = Product.where(:category_id => @category.id).order(:category_id)\n end", "def add_product(product)\n current_item = line_items.where(:product_id => product.id).first\n if current_item\n current_item.quantity += 1\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item\n end\n current_item\n end", "def add_product(product)\n current_item = cart_items.find_by(product_id: product.id)\n if current_item.present?\n current_item.increment(:quantity)\n product.decrement!(:inventory_count)\n render json: {\n status: :ok,\n message: 'Product added to cart!'\n }\n else\n current_item = cart_items.build(product_id: product.id)\n end\n end", "def create\n @product = Product.new(params[:product].merge :user_id => current_user.id)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to root_url, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product = current_user.products.build(product_params)\n if @product.save\n flash[:success] = 'Contato criado com sucesso.'\n redirect_to user_products_path\n else\n render 'new'\n end\n end", "def add_product(name, price)\n new_product = Product.new(name, price)\n @products_in_cart << new_product\n new_product\nend", "def wish_list_item_params\n params.require(:wish_list_item).permit(:wishlist_id, :product_id)\n end", "def create\n if user_signed_in?\n @product = current_user.products.new(product_params)\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def products_wish_params\n params.require(:products_wish).permit(:wish_id, :product_id)\n end", "def create\n # @current_user ||= User.find(session[:user_id]) if session[:user_id]\n @current_user = current_user\n\n # @product = Product.new(product_params)\n @product = @current_user.products.new(product_params)\n\n if @product.save\n redirect_to @product\n else\n render 'new'\n end\n end", "def add_product(products, new_product)\n products.push(new_product)\nend", "def create\n @product_list.user = current_user\n respond_to do |format|\n if @product_list.save\n format.html { redirect_to @product_list, notice: \"#{t('activerecord.models.product_list.one')} criado com sucesso\" }\n format.json { render action: 'show', status: :created, location: @product_list }\n else\n format.html { render action: 'new' }\n format.json { render json: @product_list.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @basket = Basket.new(user_id: current_user.id, product_id: params[:product_id])\n @basket.save\n\n redirect_to root_url\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def add_product (product_id)\n current_item = line_items.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n # The default quantity is 1. \n current_item = line_items.build(product_id: product_id)\n end\n current_item\n end", "def create\n if (product = Product.find_by(id: params[:product])).nil?\n render json: { message: \"Invaild product_id\" }, status: :bad_request\n else\n cart = Cart.find_or_create_by(user: current_user)\n cart.products << product\n render json: { message: \"Item added to cart\" }\n end\n end", "def create\n @product = current_user.products.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: \"Product was successfully created.\" }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product_id)\n \t#current_item = line_items.where(product_id: product_id).first\n\n \t# if current_item\n \t# if (current_item.quantity == nil) \n # current_item.quantity = 0\n # end\n # current_item.quantity = 1\n \t# else\n \t# current_item = line_items.build(:product_id => product_id)\n # current_item.quantity += 1\n # end\n #current_item\n line_items.create(:product_id => product_id, :quantity => 1)\n end", "def set_wishlist_item\n @wishlistitem = Wishlistitem.find(params[:id])\n end", "def create\n @product = Product.new(params[:product])\n @product.user_id=current_user.id\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to root_path, notice: 'Product was successfully created.' }\n # format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product)\n\t\titem_to_add = line_items.find_by(product_id: product.id)\n\t\tif item_to_add\n\t\t\titem_to_add.quantity += 1\n\t\telse\n\t\t\t# in this case we create the line_item, the quantity default is 1\n\t\t\titem_to_add = line_items.build(product_id: product.id)\n\t\t\titem_to_add.order = nil\n\t\tend\n\t\titem_to_add\n\tend", "def create\n @product = Product.new(product_params)\n @product.user_id = current_user.id\n @product.rented = false\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Your product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product_to_order\n prod_id = params[:id].to_i\n qty_to_order = params[:qty].to_i\n\n add_or_update_product_qty(prod_id, qty_to_order)\n\n flash[:notice] = 'Product added to cart'\n redirect_back(fallback_location: root_path)\n end", "def add_product(product)\n item = @items.find {|i| i.product_id == product.id}\n if item\n item.quantity += 1\n else\n item = LineItem.for_product(product)\n @items << item\n end\n @total_price += product.price\n end", "def create\n @product = Product.new(product_params)\n @product.user = current_user\n\n if @product.save\n redirect_to admin_products_path, notice: 'Product was successfully created.'\n else\n render admin_products_path, alert: \"Product not created\"\n end\n rescue StandardError => e\n Airbrake.notify(e)\n end", "def create\n @my_product = current_user.products.new(my_product_params)\n\n if @my_product.save\n render :show, status: :created\n else\n render json: @my_product.errors, status: :unprocessable_entity\n end\n end", "def create_wishlist\n self.build_wishlist(:user_id => self.id)\n end", "def create\n @product = Product.new(product_params)\n @product.user = current_user\n\n if @product.save\n redirect_to [:edit, current_role, @product],\n notice: 'Product was created.'\n else\n render :new\n end\n end", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by(product_id: product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(product_id: product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product_id)\n\t\tcurrent_item = line_items.find_by_product_id(product_id)\n\t\tif current_item\n\t\t\tcurrent_item.quantity += 1\n\t\telse\n\t\t\tcurrent_item = line_items.build(:product_id => product_id)\n\t\tend\n\t\tcurrent_item\n\tend", "def add_product(product)\n current_item = line_items.find_by(product_id: product.id) # find the current item in the line items. find_by() returns an existing LineItem or nil.\n if current_item # if the current item is present...\n current_item.quantity += 1 # ...increment by one.\n else\n current_item = line_items.build(product_id: product.id) # If the item isn't present then build the line_item.\n current_item.price = product.price # Take the current_item and capture the price attribute.\n end\n current_item # Return the current item.\n end", "def addProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.new(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id], picture_list: '[]')\n status = p.save\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def set_wishlist\n @wishlist = current_user.wishlists.find(params[:id])\n end", "def add_product(product,quant=1)\n\t\tproduct_id = product.id\n\t\tif exist?(product_id)\n\t\t\tproducts[product_id] += quant\n\t\telse\n\t\t\tproducts[product_id] = quant \n\t\tend\n\t\tsave\n\tend", "def set_wish_list_item\n @wish_list_item = WishListItem.find(params[:id])\n end", "def add_to_products\n \t@@products << self\n \tend", "def create\n @product = current_user.products.build(product_params)\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_product(product_id)\n \tcurrent_item = line_items.find_by(product_id: product_id)\n \tif current_item\n \t\tcurrent_item.quantity += 1\n \telse\n \t\tcurrent_item = line_items.build(product_id: product_id)\n current_item.product_price = Product.find(product_id).price\n \tend\n \tcurrent_item\n end", "def add_product(product_id)\n current_item = line_items.where(:product_id => product_id).first\n if current_item\n current_item.quantity += 1\n # Otherwise create a new line_item\n else\n current_item = LineItem.new(:product_id => product_id)\n line_items << current_item # add the current_item to the end of the line_items\n end\n current_item\n end", "def create\n @wish = Wish.new(wish_params)\n @wish.user = current_user\n\n respond_to do |format|\n if @wish.save\n format.html { redirect_to @wish, notice: 'Wish was successfully created.' }\n format.json { render action: 'show', status: :created, location: @wish }\n else\n format.html { render action: 'new' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wishlistitem = Wishlistitem.new(params[:wishlistitem])\n\n respond_to do |format|\n if @wishlistitem.save\n format.html { redirect_to @wishlistitem, notice: 'Wishlistitem was successfully created.' }\n format.json { render json: @wishlistitem, status: :created, location: @wishlistitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wishlistitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_wishlist(char_id)\n CharactersWishlist.create(character_id: char_id, wishlist_id: id)\n self \n end", "def add_to_product\n\t\tif product_title_exists?(@title)\n\t\t\thandle_dup_prod_err(@title)\n\t\telse\n\t\t\t@@products << self\n\t\tend\n\tend", "def add_product(product_id)\n current_item = line_item.find_by_product_id(product_id)\n if current_item\n current_item.quantity += 1\n else\n current_item = line_items.build(product_id: product_id)\n end\t\n current_item\nend", "def add_product_to_cart(product_id)\n product = look_up_product(reference_number)\n if product != nil\n @shopping_cart << product\n puts \"Yay! Your #{product[:name]} has been added to your cart.\"\n else\n puts \"We don't have that\"\n end\nend", "def product\n if PRODUCT_UPDATE_MUST_HAVE.include?(Employee.where(id: session[\"found_user_id\"]).first.admin_rights)\n id = params[\"product_id\"]\n if id == \"new\"\n @product = Product.new\n @product.items_per_bunch = 100\n @product.markup = 100\n else\n @product = Product.where(florist_id: session[\"found_florist_id\"]).where(id: id).first\n end\n render(:product_updates) and return\n else\n redirect_to \"/products\" and return\n end\n end", "def create\n @page_title = \"Sell your product\"\n @product = Product.new(params[:product])\n @product.user = current_user\n\n if @product.valid?\n @product.force_save\n return product_success\n else\n flash[:error_stay] = @product.errors.full_messages\n @product.force_save\n redirect_to edit_product_path(@product)\n end\n end", "def create_product(id)\n item = DirectedEdge::Item.new(@database, \"product#{id}\")\n item.add_tag('product')\n item.save\n end", "def create\n unread\n\n @product = Product.new(params[:product])\n @sellers = Seller.all\n @branches = Branch.all\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n logger.debug(current_user.count)\n if current_user.private? && current_user.count >= 5\n logger.debug(\"EXPIRED USER\")\n respond_to do |format|\n flash[:notice] = 'You has exceed the limit of 5 products.\n Upgrade your account to business!'\n format.html { redirect_to account_manager_account_path, notice: 'You has exceed the limit of 5 products.\n Upgrade your account to business!' }\n format.json { render json: @product, status: :created, location: @product }\n end\n return\n end\n @product = Product.new(params[:product])\n @product.category_id = params[:category_id]\n if current_user.private?\n @product.owner_id = current_user.private_id\n elsif current_user.business?\n @product.owner_id = current_user.business_id\n end\n @user = User.find_by_id(current_user.id)\n @user.count += 1\n @user.save\n respond_to do |format|\n if @product.save\n format.html { redirect_to products_path, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_to_cart(product_id)\n $redis.hincrby current_user_cart, product_id, 1\n end", "def create\n @product = @user.products.build(params[:product])\n # was @product = Product.new(params[:product])\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to user_products_url(@user), notice: 'Product was successfully created.' }\n # format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def wishlist_params\n params.require(:wishlist).permit(:userId)\n end" ]
[ "0.8237866", "0.8101148", "0.780466", "0.77029306", "0.76179504", "0.75451744", "0.747445", "0.73972887", "0.73569447", "0.73048335", "0.727487", "0.72177535", "0.7107785", "0.7104456", "0.70695543", "0.69813377", "0.69730824", "0.6944625", "0.68806237", "0.68629426", "0.6836782", "0.6816951", "0.6787384", "0.67865044", "0.67777973", "0.6770026", "0.67660356", "0.6765685", "0.67409253", "0.67383033", "0.6736395", "0.67362875", "0.67321986", "0.67181283", "0.6689179", "0.66755426", "0.66662526", "0.6599851", "0.65970576", "0.6593019", "0.6587875", "0.657578", "0.6554865", "0.65518886", "0.65335286", "0.6526311", "0.65258193", "0.6520905", "0.6519979", "0.65170014", "0.65081507", "0.64989835", "0.64959306", "0.6492526", "0.64905643", "0.64723074", "0.64589137", "0.64579034", "0.64570576", "0.64511395", "0.6449851", "0.64436066", "0.64372957", "0.64371824", "0.64325535", "0.64203423", "0.64101744", "0.6409165", "0.6405747", "0.6400441", "0.63996416", "0.6396518", "0.63937074", "0.63904256", "0.6377433", "0.63730633", "0.637018", "0.6369788", "0.6365799", "0.6363078", "0.63605016", "0.63545096", "0.63512534", "0.6346998", "0.63464016", "0.63290185", "0.63271475", "0.6323273", "0.6302047", "0.6293158", "0.62822807", "0.6276071", "0.62743586", "0.627353", "0.6267646", "0.6265213", "0.6264626", "0.6256874", "0.62564945", "0.6246376" ]
0.74407613
7
Delete Product from User Wishlist and My Wishlist
def update @wishlist = Wishlist.where(:user_id => current_user.id) @wishlist_item = Wishitem.find_by(:wishlist_id => @wishlist, :product_id => params[:id]) @wishlist_item.destroy if params.has_key?(:page) redirect_to "/products?page=#{params[:page]}" else redirect_to mywishlist_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove\n product = Product.find(params[:id])\n wishlist = Wishlist.get_current(current_user, session)\n wishlist.products.delete(product)\n render :update do |page| \n page.remove(\"dg_#{product.id}\")\n end\n end", "def destroy\n user = current_user\n item_id = Sneaker.find(params[:id])\n Wishlist.where(sneaker_id: params[:id]).destroy_all\n item_id.destroy\n redirect_to user_path(user)\n end", "def destroy\n @wish_list = WishList.find(params[:wish_list_id])\n @item = @wish_list.items.find(params[:item_id])\n\n if @item.purchased_by == current_user\n @item.purchased_by = nil\n @item.save\n else\n flash[:alert] = \"You do not have permission to unpurchase this Item.\"\n end\n head 200\n end", "def destroy\n @wishlist.destroy\n\n redirect_back(fallback_location: root_path , alert: 'Product was successfully removed from wishlist.')\n end", "def destroy\n if @wish.user_id == current_user.id\n @wish = Wish.find(params[:id])\n @wish.destroy\n render json: {}, status: :no_content\n end\n end", "def delete_product\n product_to_delete = @view.delete_product\n @seller.delete_product(product_to_delete)\n input = @view.menu(\"2\")\n seller_actions(input) \n end", "def destroy\n @wish.destroy\n redirect_to wishlist_path(@wish.wishlist_id)\n end", "def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n redirect_to welcome_homepage_url\n end", "def destroy\n @wishlistitem = Wishlistitem.find(params[:id])\n @wishlistitem.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlistitems_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @product = current_user.user_info.products.find(params[:id])\n Shopify.delete @product\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist_item = WishlistItem.find(params[:id])\n @wishlist_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(store_path, :notice => 'Item has been removed from your wishlist.') }\n format.xml { head :ok }\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to wish_list_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @w = Wishlist.find_by_vendor_id(params[:id])\n if @w.destroy\n\t redirect_to wishlist_list_path\n end\n \n end", "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n if @item.container_type == 'Wishlist'\n @wishlist = Wishlist.find(@item.container_id)\n @wishlist.items.delete_if{|o| o.id == @item.id}\n @wishlist.save\n elsif @item.container_type == 'Store'\n @store = Store.find(@item.container_id)\n @store.items.delete_if{|o| o.id == @item.id}\n @store.save\n end\n\n @item.destroy\n respond_to do |format|\n @wishlist = Wishlist.find(session[:wishlist_id])\n format.html { redirect_to edit_wishlist_url(@wishlist) }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish.destroy\n redirect_to root_url\n end", "def destroy\n @product = current_user.products.find(params[:id])\n if @product.destroy\n flash[:success] = 'Contato removido com sucesso'\n redirect_to user_products_path\n else\n flash[:danger] = 'Contato não encontrado.'\n redirect_to user_products_path(current_user)\n end\n end", "def destroy\n @wish_list_item = WishListItem.find(params[:id])\n @wish_list_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(wish_list_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wish_list_item.destroy\n respond_to do |format|\n format.html { redirect_to wish_list_url(@wish_list_item.wish_list), notice: 'Wish list item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist = Wishlist.find(params[:id])\n @wishlist.destroy\n\n respond_to do |format|\n format.html { redirect_to wishlists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n redirect_to user_products_path\n end", "def destroy\n if @shop.user_id == current_user.id\n @shop.destroy\n end\n respond_to do |format|\n format.html { redirect_to shops_url, notice: 'お手続きした商品を削除致しました。今後とも『オトクーナ』をどうぞ宜しくお願い致します。' }\n format.json { head :no_content }\n end\n end", "def destroy\n LocationsWish.where('wish_id = ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n WishLog.where('wish_by_id= ?', @wish.id).all.each do |wish|\n wish.destroy\n end\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @product.vendor == current_user\n @product.deleted = true\n @product.image1 = nil # Depending on paperclip settings, this may delete image off disk.\n @product.image2 = nil\n @product.image3 = nil\n if @product.save\n redirect_to vendor_products_path, notice: 'This product has been deleted'\n else\n redirect_to vendor_products_path, alert: 'Error deleting product'\n end\n else\n # Deleting someone elses product.\n raise NotAuthorized\n end\n end", "def remove_product(product)\n products.delete(product)\n # save\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Záznam vo wishliste bol úspešne zmazaný.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @favory = current_user.favories.find_by(user_id: current_user.id, id: params[:id])\n if @favory.present?\n @favory.destroy\n end\n redirect_to products_path()\n end", "def remove_shopping_list\n user_id = current_user.id\n yummly_id = params[:yummly_id]\n\n shopping_list = ShoppingList.find_by(yummly_id: yummly_id, user_id: user_id)\n shopping_list.destroy\n\n redirect_to recipes_url, notice: \"Removed recipe from your shopping lists\"\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_destroy\n shared_wish=create_shared_wish\n\n delete :destroy, {user_id: @current_user.id, id: shared_wish.id}\n \n assert_response :redirect\n assert_redirected_to user_my_wishes_path(@current_user)\n assert_equal \"Byli jste odebráni z obdarovaných u přání '#{shared_wish.title}'.\", flash[:notice]\n \n refute Wish.where(id: shared_wish.id).blank?\n refute @current_user.donee_wishes.include?(shared_wish)\n end", "def remove_wishlist_item\n if item = Item.find_by_id(params[:id])\n @customer.remove_item_from_wishlist(item)\n end\n render :text => ''\n end", "def destroy\n # Get the product id\n watchlist_item = params[:watchlist][:product_id]\n # Find the product id\n product = Product.find(watchlist_item)\n # Delete product id from watchlist\n current_user.watchlist.remove_product(product)\n\n respond_to do |format|\n format.html { redirect_to watchlists_url, notice: 'Watchlist was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @users_products_wanted_action = UsersProductsWantedAction.find(params[:id])\n @users_products_wanted_action.destroy\n\n respond_to do |format|\n format.html { redirect_to users_products_wanted_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = @user.products.find(params[:id])\n #was @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to (user_products_path(@user)) }\n #was format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = @like.product\n @like.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wish_list.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"account\", action: \"wishlist\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_product.destroy\n end", "def destroy\n authenticate!\n if Dislike.find(params[:id]).user_id == current_user.id\n Dislike.destroy(params[:id])\n render json: { message: 'Item deleted' }\n else\n render:json => { :msg => \"Dislike deletion failed..\" }, :status => :bad_request\n end\n end", "def destroy\n @grocery_list_products = GroceryListProduct.find(params[:id])\n @grocery_list_products.destroy\n redirect_to grocery_list_path(@grocery_list), notice: 'Product deleted'\n end", "def destroy\n @wish.destroy\n respond_to do |format|\n format.html { redirect_to wishes_url, notice: 'Wish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_products_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted product: #{@product.name}\")\n end", "def delete\n self.class.delete_product_by_id(self.id)\n end", "def destroy\n @pro_wmall_product = Wmall::Product.find(params[:id])\n @pro_wmall_product.destroy\n\n respond_to do |format|\n format.html { redirect_to pro_wmall_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if current_user.try(:admin?)\n @custom_product.destroy\n respond_to do |format|\n format.html { redirect_to custom_products_url } #, notice: 'Custom product was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n redirect_to root_path\n end \n end", "def destroy\n if current_user.id == 1\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n else\n respond_to do |format|\n format.html { render :index }\n # format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end", "def remove(params, userid)\n id = params[\"product_id\"]\n db = connect()\n result = db.execute(\"DELETE FROM ProduCart WHERE product_id = ? AND user_id = ?\",id,userid)\n end", "def destroy\n # @howtolist = @product.howtolists.find(params[:id])\n @howtolist.destroy\n flash[:notice] = \"List has been deleted.\"\n redirect_to @product\n\n # respond_to do |format|\n # format.html { redirect_to product_howtolists_path(@product) }\n # format.json { head :no_content }\n # end\n end", "def destroy\n unread\n\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find params[:id]\n @product.destroy\n flash[:success] = \"Product deleted\"\n redirect_to admin_products_path\n end", "def destroy\n @product.destroy\n redirect_to [current_role, :products],\n notice: 'Product was destroyed.'\n end", "def destroy\n current_user.selecteditems.destroy_all\n redirect_to display_cart_user_path(current_user.id)\n end", "def destroy\n @product.destroy\n set_products\n end", "def destroy\n @product = Product.find(params[:product_id]) \n @product_option = ProductOption.find(params[:id])\n @product.product_options.delete(@product_option)\n \n @available_options = ProductOption.find(:all, :order => 'name') \n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def test_destroy\n delete :destroy, params: { user_id: @bart.id, id: @shared_wish.id }\n\n assert_response :redirect\n assert_redirected_to user_my_wishes_path(@bart)\n assert_equal \"Byli jste odebráni z obdarovaných u přání '#{@shared_wish.title}'.\", flash[:notice]\n\n assert_not Wish.where(id: @shared_wish.id).blank?\n assert_not @bart.donee_wishes.include?(@shared_wish)\n end", "def remove_from_favourites\n user_id = current_user.id\n yummly_id = params[:yummly_id]\n\n user_favourite_recipe = UserFavouriteRecipe.find_by(yummly_id: yummly_id, user_id: user_id)\n user_favourite_recipe.destroy\n\n redirect_to recipes_url, notice: \"Removed recipe from your list of favourite recipes\"\n end", "def destroy\n OrderItem.find_by(product: Product.find_by_title(params[:product_title]))\n .destroy_product(params[:quantity_of_products])\n order = Order.find_by_user_session_id(session['session_id'])\n if order.present?\n order.update_total_price_cents(nil)\n end\n redirect_to cart_path, notice: \"Вы убрали из корзины #{params[:product_title]}\"\n end", "def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def remove_product(name)\n @products_in_cart.delete(Product)\nend", "def remove_have\n if params[:id].present? and params[:remove_have].present?\n if params[:from_haves_tab] == 'true'\n @user = current_user\n # @have_items = @user.items\n item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n if item.present?\n # item.destroy\n item.update_attribute(\"status\",\"DELETED\")\n end\n flash[:info] = \"Item has been removed from your Haves Board .\"\n redirect_to haves_user_path(@user, :delete => item.id)\n # elsif params[:from_my_offers_tab] == 'true'\n # @user = current_user\n # @have_items = @user.have_items\n # item = Item.find_by_id_and_user_id(params[:id],current_user.id)\n # item.destroy\n # params[:id] = params[:original_id]\n # @item = Item.find_by_id(params[:id])\n # @offer_ids = @item.current_offers.pluck(:offer_id)\n # @useritems = @user.items\n # @useritem_ids = @useritems.pluck(:id)\n # elsif params[:from_items_index] == 'true'\n # # item = Item.find_by_id(params[:id])\n # # item.destroy\n # respond_to do |format|\n # format.js\n # format.html { redirect_to items_path}\n # end\n end\n end\n end", "def destroy\n @food_product.destroy\n end", "def destroy\n @product = Product.find(params[:id])\n drop_rs(current_user.id, params[:id], \"uploaded\")\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to uploaded_products_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_interactive_product = UserInteractiveProduct.find(params[:id])\n @user_interactive_product.destroy\n\n respond_to do |format|\n format.html { redirect_to user_interactive_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n\n redirect_to root_url, :notice => \"Sorry, that isn't your product\" unless current_user == @product.user\n\n # else, it is our product\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was destroyed' }\n format.json { head :no_content }\n end\n end", "def destroy\n @star_product = Star::Product.find(params[:id])\n @star_product.destroy\n\n respond_to do |format|\n format.html { redirect_to star_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Inventory.where(product: @product).delete_all\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_merchandise_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n end", "def delete\n Product.destroy(params[:id])\n redirect_to dashboard_path\n end", "def destroy\n @product_buy_click.destroy\n\n head :no_content\n end", "def add_to_wishlist(product)\n wishlist.products << product unless wishlist.products.include?(product)\n wishlist.save\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to site_path(@site), notice: '商品を削除しました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product.destroy\n end", "def destroy\n @product_promotion.destroy\n @promotion=session[:promotion]\n respond_to do |format|\n \n format.html { redirect_to edit_promotion_path(@promotion), notice: 'Product was removed from the promotion' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wishlist_project.destroy\n authorize! :destroy, @wishlist_project\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Wishlist project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shopifyproduct = Shopifyproduct.find(params[:id])\n @shopifyproduct.destroy\n\n respond_to do |format|\n format.html { redirect_to shopifyproducts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, @product, :message => 'Not authorized as an administrator'\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end", "def destroy \n if user_signed_in? && owner_or_admin?(@product)\n session[:return_to] ||= request.referer\n @product.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n redirect_to :action => 'list'\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_products_url, notice: 'Product has been deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \t@user = User.find(params[:user_id])\n \t@item = @user.items.find(params[:id])\n \t@item.destroy\n \tredirect_to @user\n \tend", "def destroy\n @product_family_product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_product_family_products_url) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Removed #{@product_family_product.product.name} from #{@product_family_product.product_family.name}\")\n end", "def destroy\n @admin_product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def update\n @wishlist = Wishlist.find(params[:id])\n @product = Product.all\n\n if @wishlist.update_attributes(params[:wishlist])\n \t\tparams[:product_id].each do |product|\n \t\t\tif @wishlist.products.where(:id => product).count == 0\n \t\t\t @wishlist.products << Product.find(product)\n \t\t\tend\n \t\tend\n\t\t\n \tredirect_to :action => \"show\", :id => @wishlist\n \t\tend\n\n# if @wishlist.update_attributes(params[:wishlist])\n# format.html { redirect_to Wishlist, notice: 'Pickup list was successfully updated.' }\n# format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: Wishlist.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def add_to_wishlist product, options = {}\n options.reverse_merge! default_wishlist_options(product)\n wishlist_id = options[:wishlist_id].present? ? options[:wishlist_id] : @front_presenter.user_wishlist[product.id]\n\n link_body, link_path, link_options =\n if current_user.wishes.product_exists?(product.id)\n [I18n.t('delete'), product_wishlist_path(product, wishlist_id), options.merge!(wishlist_delete_options)]\n else\n [I18n.t('i_like'), product_wishlists_path(product), options.merge!(method: :post)]\n end\n\n link_to link_path, link_options do\n [make_tag, content_tag(:span, link_body)].join('').html_safe\n end\n end", "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_url }\n format.json { head :no_content }\n end\n end", "def product_delete\n\t\t@task_data = Product.find(params[:id])\n\t\t@task_data.destroy\n\t\tredirect_to product_index_path\n\tend", "def delete_item\n if current_user\n @item = Item.find(params[:id].to_i)\n current_cart.items.delete(@item)\n redirect_to cart_path\n else\n delete_item_in_guest_cart(params[:id].to_i)\n redirect_to cart_path\n end\n end", "def delete\r\n Marketplace::Database.instance.call_users(self)\r\n Marketplace::Database.instance.delete_user(self)\r\n ImageUploader.delete_image(self.picture, settings.root) if self.picture != nil\r\n items = Marketplace::Database.instance.items_by_user(self)\r\n items.each{ |item| item.delete }\r\n end", "def destroy\n authorize! :manage, @product , :message => \"Access denied.\"\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n Product.find(@params[:id]).destroy\n redirect_to :action => 'list'\n end", "def destroy\n authorize @product\n if @product.update(published: false)\n redirect_to products_path\n else\n products_path\n end\n end", "def destroy\n @own_product.destroy\n respond_to do |format|\n format.html { redirect_to own_products_url, notice: 'Own product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n \n redirect_to :action => 'index'\n \n end", "def destroy\n @product_review_product.destroy\n respond_to do |format|\n format.html { redirect_to(admin_product_review_products_url) }\n format.xml { head :ok }\n format.js\n end\n website.add_log(user: current_user, action: \"Removed review from #{@product_review_product.product.name}\")\n end" ]
[ "0.77121717", "0.7423772", "0.73557127", "0.7291427", "0.7243399", "0.7198574", "0.71544874", "0.7057266", "0.6974991", "0.69495976", "0.6948526", "0.69247", "0.6922548", "0.6922494", "0.6891624", "0.68876725", "0.6872537", "0.68624336", "0.6834646", "0.6803184", "0.6803184", "0.68027645", "0.6801762", "0.676767", "0.6759316", "0.6758642", "0.6754591", "0.6752575", "0.67386067", "0.6682944", "0.6682944", "0.66751826", "0.66599405", "0.66546816", "0.6652581", "0.66500103", "0.6647392", "0.6634169", "0.6591392", "0.65736246", "0.6559337", "0.6534544", "0.65283096", "0.65283096", "0.6515333", "0.64990634", "0.6470871", "0.6458137", "0.64245015", "0.642108", "0.6420743", "0.640849", "0.6406323", "0.6404318", "0.63869727", "0.6382539", "0.6380322", "0.6372359", "0.6365168", "0.63616043", "0.6335285", "0.6333898", "0.6320052", "0.62962574", "0.62959117", "0.62732935", "0.6270629", "0.62375456", "0.6236172", "0.6229159", "0.6229159", "0.62290376", "0.62258255", "0.6224438", "0.6221279", "0.6219934", "0.6219275", "0.6203249", "0.61986226", "0.61982906", "0.61933863", "0.6191226", "0.6175414", "0.6164102", "0.61638665", "0.6161085", "0.61597097", "0.6158675", "0.61559665", "0.6152954", "0.6150813", "0.6148777", "0.61465", "0.6141552", "0.61412764", "0.6138013", "0.6136819", "0.61366355", "0.6126576", "0.6124016" ]
0.70712453
7
GET /deweys_power_panels/1 GET /deweys_power_panels/1.xml
def show @deweys_power_panel = DeweysPowerPanel.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @deweys_power_panel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def show\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end", "def show\n @power = Power.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power }\n end\n end", "def index\n @port_panels = PortPanel.all\n end", "def index\n @panels = Panel.all\n end", "def show\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power_unit }\n end\n end", "def show\n @power_factor = Power::Factor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power_factor }\n end\n end", "def destroy\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n @deweys_power_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(deweys_power_panels_url) }\n format.xml { head :ok }\n end\n end", "def show\n @pnl = Pnl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pnl }\n end\n end", "def index\n @page_title = \"Power Units\"\n @power_units = PowerUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @power_units }\n end\n end", "def update\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n if @deweys_power_panel.update_attributes(params[:deweys_power_panel])\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel])\n\n respond_to do |format|\n if @deweys_power_panel.save\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') }\n format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @links = @panel.links\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @links }\n end\n end", "def show\n @panel = Panel.find(params[:id])\n @contents = @panel.contents.all(:order => '\"order\"')\n @links = @panel.links.all(:order => '\"order\"')\n @links_count = @panel.links.count\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def index\n @powerline_adapters = PowerlineAdapter.all\n end", "def show\r\n SignalStrength.switch_data(params[:connection], \"daily\")\r\n #@signal_strengths = SignalStrength.find(params[:id])\r\n #@signal_strengths = SignalStrength.find(:all, :origin=>'94531', :within=>10)\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @signal_strengths.to_xml(:dasherize => false) }\r\n end\r\n end", "def show\n @power_total = Power::Total.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @power_total }\n end\n end", "def index\n\n if @user.admin == false\n @panels = Panel.all(:order => 'date_made DESC', :conditions => {:live_state => \"Live\"})\n else\n @panels = Panel.all(:order => 'date_made DESC')\n end\n @visuals = Visualization.find_all_by_user_id(@user)\n @compiles = Compilation.find_all_by_user_id(@user)\n @links = Linkalation.find_all_by_user_id(@user)\n\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @panels }\n end\n end", "def new\n @control_panel = ControlPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def show_panel\n @tab_name = params[:panel_name]\n @panel_name = params[:panel_name] == \"properties\" ? \"prop_sheet\" : params[:panel_name]\n @all_pages = @question_sheet.pages # for pages_list\n @page = @question_sheet.pages.find(params[:id])\n\n respond_to do |format|\n format.js # load panel\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def show\n @devices = @box.devices.order(:name)\n\n @patchpanels = @box.patchpanels.order(:name)\n end", "def show\n @lookup_switchboard = LookupSwitchboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lookup_switchboard }\n end\n end", "def show\r\n Connection.switch_data(params[:connection], \"daily\")\r\n @connections = Connection.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @connections.to_xml(:root => 'records', :children => 'record', :dasherize => false) }\r\n end\r\n end", "def port_panel_params\n params[:port_panel]\n end", "def wizard_panel(params)\n left = params[:wizard_panel_left] || \"0\"\n top = params[:wizard_panel_top] || \"0\"\n\n style = \"left:#{left};top:#{top};\"\n\n panel = '\n <div id=\"wizard_panel\" class=\"rounded\" style=\"'+style+'\">\n <div id=\"wizard_panel_content\" class=\"rounded\">\n \t<div id=\"wizard_panel_handle\" class=\"rounded handle\">\n \t</div>\n \t<ul id=\"wizard_list\">'\n \t @links.each do |link_name, link_url| \n panel += \"<li><a href=\\\"#{link_url}\\\">#{link_name}</a></li>\"\n end\n \tpanel += ' </ul>\n </div>\n </div>'\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 show\n @wklysum = Wklysum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wklysum }\n end\n end", "def run_list_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_run_list.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def show\n @link = @panel.links.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @link }\n end\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n return json(@collections, to_json_opts: {\n only: [:token, :http_method, :http_status, :url, :ip]\n }) if prefer_json?\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def static\n\t\t@scroll = Scroll.find(params[:id])\n\t\t@panels = Panel.find_all_by_scroll_id(params[:id],:order => \"panel_id\")\n\tend", "def show\n @portal = Portal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @portal }\n end\n end", "def show\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def index\n @power_outlets = PowerOutlet.all\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def show\n @get_started_panel = GetStartedPanel.new(get_started_page: @get_started_page)\n @get_started_page_product = GetStartedPageProduct.new(get_started_page: @get_started_page)\n @products = Product.all_for_website(website)\n respond_to do |format|\n format.html { render_template } # show.html.erb\n format.xml { render xml: @get_started_page }\n end\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def index\n @panel_models = PanelModel.all\n end", "def new\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_unit }\n end\n end", "def equipment_gauge_panel(equipment)\n render 'batches/gauge_panel',\n gauge: {\n title: equipment.panel_title,\n display: equipment\n }\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def show\n @drum_machine = DrumMachine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @drum_machine }\n end\n end", "def show\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lab_rack }\n end\n end", "def index \n\t\t#check_threads\n\t\tlogger.debug DEVICES.to_yaml\n\t\t# collect modes\n\t\t@modes = Mode.find(:all)\n\t\t@mode = Mode.find(1)\n\t\t# assign client id - how to differentiate between a touch panel and a connected laptop? how to stop other computers from accessing controls? force a local IP somehow?\n\t\t@client_id = \"central\"\n\tend", "def show\n @sleep = Sleep.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sleep }\n end\n end", "def show\n @powerchip = Powerchip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @powerchip }\n end\n end", "def show\n if @power_supply.nil?\n head :not_found\n else\n render json: @power_supply.properties\n end\n end", "def show\n @protocol = Protocol.find(params[:id])\n @title = \"Protocols\"\n\n @s = Sampling.find(@protocol.sampling_id)\n @pt = Partner.find(@s.partner_id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @protocol }\n end\n end", "def demos\n get_records \"demo\", \"/demos\"\n end", "def index\n\n wfid = params[:wfid]\n\n expid = params[:id]\n expid = expid.gsub /\\_/, '.'\n\n env = (expid[-1, 1] == 'e')\n expid = expid[0..-2] if env\n\n #format = params[:format] || \"yaml\"\n\n fexp = $openwferu_engine.process_stack(wfid, true).find do |fe|\n fe.fei.expid == expid and ((not env) or fe.is_a?(OpenWFE::Environment))\n end\n\n response.headers['Content-Type'] = \"application/x-yaml\"\n render :text => fexp.to_yaml\n end", "def index\n @collections = Rack::WebProfiler::Model::CollectionRecord.order(Sequel.desc(:created_at))\n .limit(20)\n\n erb \"panel/index.erb\", layout: \"panel/layout.erb\"\n end", "def show\n @sleep = Sleep.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sleep }\n end\n end", "def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def index\n @wx_configs = WxConfig.all\n end", "def index\n @evil_wizards = EvilWizard.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @evil_wizards }\n end\n end", "def show\n @car_power = CarPower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @car_power }\n end\n end", "def show\n @dashboard = Account.find(session[:account_id]).dashboards.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def window\n\t\t@scroll = Scroll.find(params[:id])\n\t\t@panels = Panel.find_all_by_scroll_id(params[:id],:conditions => [\"id > ?\",params[:panel_id]],:limit => 10,:order => \"panel_id\")\n\t\trender :template => \"scrolls/static\", :layout => false\n\tend", "def index\n @power_supplies = PowerSupply.all\n end", "def index\n @power_supplies = PowerSupply.all\n end", "def show\n @groundwater_control = GroundwaterControl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @groundwater_control }\n end\n end", "def new\n @power_factor = Power::Factor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_factor }\n end\n end", "def index\n @power_supplies = PowerSupply.all.to_a\n render(json: @power_supplies.map do |power_supply|\n setup_power_supply_properties power_supply\n power_supply.properties\n end)\n end", "def index\n @powe_factor_nozzle_xes = PoweFactorNozzleX.all\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 @wod\n end", "def live\n\t\t@scroll = Scroll.find(params[:id])\n\t\t@panels = Panel.find_all_by_scroll_id(params[:id],:order => \"panel_id DESC\",:limit => 10)\n\tend", "def show\n dashboard_4\n end", "def show\n dashboard_4\n end", "def index\n @softwares = Software.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @softwares }\n end\n end", "def show\n @powiadomienie = Powiadomienie.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @powiadomienie }\n end\n end", "def get_power_state\n response = @client.rest_get(@data['uri'] + '/powerState')\n response.body\n end", "def show\n @paper_flow = PaperFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paper_flow }\n end\n end", "def show\n @paper_flow = PaperFlow.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @paper_flow }\n end\n end", "def index\n @mdps = Mdp.all\n end", "def ward_info\n Windy.app_token = \"SzhuGRMWyG4gCUf08KDa693CK\"\n Windy.views.find_by_id('htai-wnw4').rows\n\tend", "def show\n @bowling_performance = BowlingPerformance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bowling_performance }\n end\n end", "def panel\r\n \t@authq = params[:authq] || \"\"\r\n \t@auth_type = params[:type] || \"\"\r\n \t# This should return the JSON for solr documents\r\n results = get_browse_info(@authq, @auth_type)\r\n @data = results[0]\r\n heading = @data[\"heading\"]\r\n #Call helper method to see whether external data should or should not be included within panel\r\n #This used to be @authq but changing it because the parameter from the link may have different\r\n #ending punctuation than the heading in the browse. Relying entirely on heading now\r\n permissions_key = heading.delete_prefix('\"').delete_suffix('\"')\r\n @exclusions = check_permissions(permissions_key)\r\n render \"panel\"\r\n \r\n end", "def show\n if params[:format] == 'xml'\n send_file @test_plan.jmx.path, :type => 'application/xml', :disposition => 'attachment'\n end\n end", "def show\n @actuator = Actuator.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @actuator }\n end\n end", "def show\n #@noami = Noami.find(params[:id])\n @us = [\n {:label => \"Inventory\", :url => \"/tabs/show2\"},\n {:label => \"Order Information\", :url => \"/tabs/show2\"},\n {:label => \"Account\", :url => \"/tabs/show2\"},\n {:label => \"Shipers\", :url => \"/tabs/show2\"},\n {:label => \"Suppliers\", :url => \"/tabs/show2\"},\n {:label => \"Show2\", :url => \"/tabs/show2\"}\n ]\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @noami }\n end\n end", "def show\n @port_info = PortSummary.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @port_info }\n end\n end", "def show\n @sleep_log = SleepLog.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end", "def show\n @swlist_blacklist = SwlistBlacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @swlist_blacklist }\n end\n end", "def index\n @sw_devs = SwDev.all\n end", "def show\n @msshiplot = Msshiplot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @msshiplot }\n end\n end", "def show(token)\n @collection = Rack::WebProfiler::Model::CollectionRecord[token: token]\n return error404 if @collection.nil?\n\n @collectors = Rack::WebProfiler.config.collectors.all\n\n # @todo return json if request.content_type ask json (same for xml?)\n # @example json {} if @request.media_type.include? \"json\"\n\n erb \"panel/show.erb\", layout: \"panel/layout.erb\"\n end", "def user_data_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_user_data.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def dashboard\n self.root\n self.follow('dtime:dashboard')\n self.get\n self\n end", "def show\n @dashboard = Dashboard.find(params[:id])\n @chart_selectors_data = {}\n \n tables = [] \n (ActiveRecord::RdsDb.connection.tables - ['schema_migrations']).each do |table_name|\n next unless ar_class_exist?(table_name)\n \n table = {\n name: table_name.titleize,\n value: table_name,\n dimensions: [],\n metrics: [],\n dates: []\n }\n \n table_class = table_name.classify.constantize\n table_class.columns.each do |column|\n next unless [:string, :integer, :datetime].include?(column.type)\n \n # TODO: Dimension can be either string field or belongs_to association\n \n if [:string, :integer].include?(column.type)\n table[:dimensions] << prepare_column(column)\n table[:metrics] << prepare_column(column) \n elsif column.type == :datetime\n table[:dates] << prepare_column(column)\n end\n \n end \n \n tables << table \n end\n \n \n \n @chart_selectors_data[:tables] = tables\n @dashboard_modules = @dashboard.dashboard_modules.order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dashboard }\n end\n end", "def show\n respond_to do |format|\n format.html { render partial: 'show', layout: 'admin/admin_show' }\n format.xml { render xml: @poll_question.to_xml(include: :poll_options) }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @evil_wizard }\n end\n end", "def show\n @power_assignment = PowerAssignment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @power_assignment }\n end\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end" ]
[ "0.68875563", "0.6160967", "0.6099372", "0.6072872", "0.6007726", "0.595271", "0.5877756", "0.58201545", "0.5772484", "0.5761619", "0.5709142", "0.56904787", "0.55829525", "0.5543981", "0.55125684", "0.5498244", "0.549163", "0.54705864", "0.54200953", "0.5403486", "0.53592336", "0.53474283", "0.52992404", "0.52992404", "0.5290834", "0.52491564", "0.52419025", "0.52368295", "0.52091205", "0.5198974", "0.517998", "0.5150664", "0.5146971", "0.51379263", "0.51237196", "0.51164055", "0.51063204", "0.51055443", "0.510042", "0.5098732", "0.5077216", "0.5065693", "0.50647503", "0.5058813", "0.5057719", "0.5055211", "0.50459635", "0.5037579", "0.5037293", "0.5036641", "0.5033559", "0.50319546", "0.502676", "0.5017995", "0.5015787", "0.50128394", "0.5011467", "0.5006422", "0.49898687", "0.4981125", "0.49731824", "0.49632055", "0.49570376", "0.49552706", "0.49442562", "0.49442562", "0.4941609", "0.49393436", "0.49387577", "0.49377248", "0.49340916", "0.49280772", "0.4927008", "0.4925535", "0.4923108", "0.49230605", "0.49226078", "0.49122888", "0.49120075", "0.49120075", "0.49114764", "0.49081317", "0.49034742", "0.49025646", "0.49018958", "0.49016812", "0.48975998", "0.48943555", "0.48942947", "0.48922423", "0.48890257", "0.4888117", "0.48801553", "0.4878495", "0.48745492", "0.4874106", "0.4868555", "0.4865456", "0.48643234", "0.486371" ]
0.74794734
0
GET /deweys_power_panels/new GET /deweys_power_panels/new.xml
def new @deweys_power_panel = DeweysPowerPanel.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @deweys_power_panel } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @control_panel = ControlPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def create\n @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel])\n\n respond_to do |format|\n if @deweys_power_panel.save\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') }\n format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_unit }\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 create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully created.') }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n flash[:notice] = 'Panel was successfully created.'\n format.html { redirect_to(@panel) }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @portal = Portal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @portal }\n end\n end", "def new\n @power_factor = Power::Factor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_factor }\n end\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def create\n @control_panel = ControlPanel.new(params[:control_panel])\n\n respond_to do |format|\n if @control_panel.save\n flash[:notice] = 'ControlPanel was successfully created.'\n format.html { redirect_to(@control_panel) }\n format.xml { render :xml => @control_panel, :status => :created, :location => @control_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lookup_switchboard = LookupSwitchboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_switchboard }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\n end\n end", "def new\n @dashboard = Dashboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dashboard }\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 @panel = Panel.new( :status => Status.active )\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel }\n end\n end", "def new\n @pwebsite = Pwebsite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pwebsite }\n end\n end", "def new\n @player=Player.find(params[:player_id])\n\n @pnl = Pnl.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pnl }\n end\n end", "def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pool }\n end\n end", "def new\n @panel_plan = Panel::Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tool_part }\n format.xml { render xml: @tool_part }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software_training_module }\n end\n end", "def new\n @website = Website.new params[:website]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @website }\n end\n end", "def new\n @evil_wizard = EvilWizard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @evil_wizard }\n end\n end", "def new\n @plantilla = Plantilla.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @plantilla }\n end\n end", "def show\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @software }\n end\n end", "def new\n @pscreen = Pscreen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pscreen }\n end\n end", "def new\n @suite = Suite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @suite }\n end\n end", "def new\n @lab_rack = LabRack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lab_rack }\n end\n end", "def new\n @paper_flow = PaperFlow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @paper_flow }\n end\n end", "def create\n @admin_panel = AdminPanel.new(admin_panel_params)\n\n respond_to do |format|\n if @admin_panel.save\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\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 @modes = Mode.all\n @mode = Mode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mode }\n end\n end", "def new\n @freecycle = Freecycle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @freecycle }\n end\n end", "def new\n @lesson_plan = LessonPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lesson_plan }\n end\n end", "def new\n @selector_site = SelectorSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @selector_site }\n end\n end", "def new\n @stage = Stage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @stage }\n end\n end", "def new\n @protocol = Protocol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocol }\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 respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @page_module = PageModule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_module }\n end\n end", "def new\n @permiso = Permiso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @permiso }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @recycling_site = RecyclingSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recycling_site }\n end\n end", "def new\n @powiadomienie = Powiadomienie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @powiadomienie }\n end\n end", "def create\n @power = Power.new(params[:power])\n\n respond_to do |format|\n if @power.save\n format.html { redirect_to(@power, :notice => 'Power was successfully created.') }\n format.xml { render :xml => @power, :status => :created, :location => @power }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @power.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lane = Lane.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lane }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def create\n @panel = Panel.new(panel_params)\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to @panel, notice: 'Panel was successfully created.' }\n format.json { render :show, status: :created, location: @panel }\n else\n format.html { render :new }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @title = \"New Networks\"\n @network = Network.new\n @computers = Computer.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @network }\n end\n end", "def new\n @newspapper = Newspapper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newspapper }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @software = Software.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @software }\n end\n end", "def new\n @hops_addition = HopsAddition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hops_addition }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @board }\n end\n end", "def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @board }\n end\n end", "def new\n # need root plug to start the system\n if Plug.where(\"legend='Root'\").length == 0\n @root = Plug.new({:tab_name => \"root_no_tab\", :legend => \"Root\"});\n @root.save\n end\n @plug = Plug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plug }\n end\n end", "def new\n @test_plant = TestPlant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @test_plant }\n end\n end", "def new\n @rails_url = RailsUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rails_url }\n end\n end", "def new\n @node = Node.new(:displayed => true)\n @node.template = Template.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\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 @page = @site.pages.new\n @page.parts << PagePart.new(:name => \"body\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @auditflows_flownode = AuditflowsFlownode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @auditflows_flownode }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @system }\n end\n end", "def new\n @tps_report = TpsReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tps_report }\n end\n end", "def new\n\t\t@website = Website.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @website }\n\t\tend\n\tend", "def new\n @wklysum = Wklysum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wklysum }\n end\n end", "def new\n @drum_machine = DrumMachine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drum_machine }\n end\n end", "def new\n @msshiplot = Msshiplot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @msshiplot }\n end\n end", "def new\n @protocol = Protocol.new\n @title = \"Protocol\"\n\n @s_c = Sampling.count()\n if @s_c.nil? or @s_c == 0\n flash[:error] = \"No sampling found! create first some...\"\n redirect_to :action => \"index\"\n return\n end\n\n @pt = get_partner\n if @pt.nil?\n @s = Sampling.all()\n else\n @s = Sampling.all(:conditions => [ \"partner_id = ?\", @pt.id])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @protocol }\n end\n end", "def new\n @sleep_log = SleepLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sleep_log }\n end\n end", "def new\n @drop = @npc.drops.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @drop }\n end\n end", "def create\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.new(params[:power_unit])\n\n respond_to do |format|\n if @power_unit.save\n flash[:notice] = 'PowerUnit was successfully created.'\n format.html { redirect_to(@power_unit) }\n format.xml { render :xml => @power_unit, :status => :created, :location => @power_unit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @power_unit.errors, :status => :unprocessable_entity }\n end\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 respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tunning_diagram }\n format.xml { render xml: @tunning_diagram }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html { render :template => \"admin_sites/new\" }\n format.xml { render :xml => @site }\n end\n end", "def new\n @pm_element = PmElement.new(params[:pm_element])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pm_element }\n end\n end", "def new\n @user_addon = UserAddon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_addon }\n end\n end", "def new\n @window = Window.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @window }\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 @pwidget = Pwidget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pwidget }\n end\n end", "def new\n @page = @offering.pages.new\n session[:breadcrumbs].add \"New\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n @site = Site.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @site }\n end\n end", "def new\n respond_to do |format|\n format.html { render_template } # new.html.erb\n format.xml { render xml: @product_software }\n end\n end", "def new\n @page = Page.new\n @pagelist = @club.all_pages\n \n @page_title = \"New Page\"\n @site_section = \"admin\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end", "def new\n @components_saddle = Components::Saddle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @components_saddle }\n end\n end", "def new\n @hostel = Hostel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @hostel }\n end\n end", "def new\n @appmodule = Appmodule.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @appmodule }\n end\n end", "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end" ]
[ "0.7264215", "0.7264215", "0.7020272", "0.7006462", "0.67583954", "0.6717895", "0.6667412", "0.6500836", "0.64193964", "0.6327084", "0.62764204", "0.6251684", "0.6240131", "0.6238065", "0.6238065", "0.62156534", "0.62051886", "0.6195547", "0.61909485", "0.61761475", "0.61734784", "0.6171341", "0.61634284", "0.6158467", "0.61573917", "0.61555415", "0.6146873", "0.61292726", "0.6124705", "0.6113362", "0.6109058", "0.61000925", "0.60715646", "0.6069489", "0.6057658", "0.60536265", "0.6050395", "0.6044997", "0.60347515", "0.6033914", "0.6032346", "0.60169494", "0.60017467", "0.5995565", "0.59862804", "0.5985446", "0.59796", "0.59790087", "0.5968651", "0.5967013", "0.59665686", "0.59629905", "0.5961915", "0.5951245", "0.5951245", "0.5951245", "0.593603", "0.5925172", "0.5925172", "0.5923292", "0.59223926", "0.5916092", "0.59141046", "0.5912542", "0.59118533", "0.5909674", "0.59006333", "0.58947194", "0.58939767", "0.58899814", "0.58888793", "0.58865446", "0.5885908", "0.5884336", "0.5881691", "0.58810824", "0.58804816", "0.5880153", "0.587725", "0.58770066", "0.5875994", "0.58735234", "0.5871689", "0.58714026", "0.5870162", "0.58676934", "0.58676934", "0.58676934", "0.58676934", "0.58676934", "0.58676934", "0.58676934", "0.58676934", "0.5866786", "0.58660233", "0.5865605", "0.5864517", "0.5863787", "0.5858997", "0.58555245" ]
0.77730215
0
POST /deweys_power_panels POST /deweys_power_panels.xml
def create @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel]) respond_to do |format| if @deweys_power_panel.save format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') } format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel } else format.html { render :action => "new" } format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def update\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n if @deweys_power_panel.update_attributes(params[:deweys_power_panel])\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def destroy\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n @deweys_power_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(deweys_power_panels_url) }\n format.xml { head :ok }\n end\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully created.') }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def port_panel_params\n params[:port_panel]\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n flash[:notice] = 'Panel was successfully created.'\n format.html { redirect_to(@panel) }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_empty_panel\n\n # Lookup panel meta\n path = \"/slm/panel/getCatalogPanels.sp\"\n params = {:cpoid => @project_oid,\n :_slug => \"/custom/#{@page_oid}\",\n :ignorePanelDefOids => ''} # empty ignorePanelDefOids apparently is required\n response = rally_get(path, params)\n\n panels = JSON.parse(response.body)\n custom_html_panel_oid = nil\n panels.each do |panel|\n custom_html_panel_oid = panel['oid'] if panel['title'] == \"Custom HTML\"\n end\n \n # Create new panel\n request_path = \"/slm/dashboard/addpanel.sp\"\n params = {:cpoid => @project_oid, :_slug => \"/custom/#{@page_oid}\"}\n path = construct_get(request_path, params)\n\n form_data = {\"panelDefinitionOid\" => custom_html_panel_oid,\n \"dashboardName\" => \"#{@tab_name}#{@page_oid}\",\n \"col\" => 0,\n \"index\" => 0}\n response = rally_post(path, form_data)\n\n # response is json that just contains oid e.g. {\"oid\": \"1234556\"}\n panel_oid = JSON.parse(response.body)['oid']\n\n return panel_oid\n end", "def create\n @admin_panel = AdminPanel.new(admin_panel_params)\n\n respond_to do |format|\n if @admin_panel.save\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @admin_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @control_panel = ControlPanel.new(params[:control_panel])\n\n respond_to do |format|\n if @control_panel.save\n flash[:notice] = 'ControlPanel was successfully created.'\n format.html { redirect_to(@control_panel) }\n format.xml { render :xml => @control_panel, :status => :created, :location => @control_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @port_panel = PortPanel.new(port_panel_params)\n\n respond_to do |format|\n if @port_panel.save\n format.html { redirect_to @port_panel, notice: 'Port panel was successfully created.' }\n format.json { render action: 'show', status: :created, location: @port_panel }\n else\n format.html { render action: 'new' }\n format.json { render json: @port_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def power_params\n params.require(:power).permit(:ninventary, :nserie, :brand, :model, :nfactura, :buy_date, :no_break, :operational, :reazon, :notes, :Delegation_id, :Dependency_id)\n end", "def create\n @panel = Panel.new(panel_params)\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to @panel, notice: 'Panel was successfully created.' }\n format.json { render :show, status: :created, location: @panel }\n else\n format.html { render :new }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @power = Power.new(params[:power])\n\n respond_to do |format|\n if @power.save\n format.html { redirect_to(@power, :notice => 'Power was successfully created.') }\n format.xml { render :xml => @power, :status => :created, :location => @power }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @power.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n \n \n @sold_panel = SoldPanel.new(:buyer_id=> params[:buyer_id],:totalPrice=> params[:totalPrice],:totalPower=>params[:totalPower])\n\n respond_to do |format|\n if @sold_panel.save\n \n params[:solar_panel_id].each_with_index do |item,i|\n SolarPanel.where(\"id = ? \", params[:solar_panel_id][i]).update_all(:sold_panel_id => @sold_panel.id )\n @solarpanel=SolarPanel.where(\"id = ? \", params[:solar_panel_id][i])\n @container=Container.find(@solarpanel.first.container_id)\n \t @power=@container.total_power-@solarpanel.first.power \n \t @container.update_attributes(:total_power => @power)\n if @container.total_power == 0\n @container.update_attributes(:sold => true)\n end\n end\n format.html { redirect_to @sold_panel, notice: 'Sold panel was successfully created.' }\n format.json { render :show, status: :created, location: @sold_panel }\n else\n \n format.html { render :new }\n format.json { render json: @sold_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.new(params[:power_unit])\n\n respond_to do |format|\n if @power_unit.save\n flash[:notice] = 'PowerUnit was successfully created.'\n format.html { redirect_to(@power_unit) }\n format.xml { render :xml => @power_unit, :status => :created, :location => @power_unit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @power_unit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def admin_panel_params\n params[:admin_panel]\n end", "def create\n @powerline_adapter = PowerlineAdapter.new(powerline_adapter_params)\n\n respond_to do |format|\n if @powerline_adapter.save\n format.html { redirect_to @powerline_adapter, notice: 'Powerline adapter was successfully created.' }\n format.json { render :show, status: :created, location: @powerline_adapter }\n else\n format.html { render :new }\n format.json { render json: @powerline_adapter.errors, status: :unprocessable_entity }\n end\n end\n end", "def wizard_panel(params)\n left = params[:wizard_panel_left] || \"0\"\n top = params[:wizard_panel_top] || \"0\"\n\n style = \"left:#{left};top:#{top};\"\n\n panel = '\n <div id=\"wizard_panel\" class=\"rounded\" style=\"'+style+'\">\n <div id=\"wizard_panel_content\" class=\"rounded\">\n \t<div id=\"wizard_panel_handle\" class=\"rounded handle\">\n \t</div>\n \t<ul id=\"wizard_list\">'\n \t @links.each do |link_name, link_url| \n panel += \"<li><a href=\\\"#{link_url}\\\">#{link_name}</a></li>\"\n end\n \tpanel += ' </ul>\n </div>\n </div>'\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def create\n @power_rack = PowerRack.new(power_rack_params)\n\n respond_to do |format|\n if @power_rack.save\n format.html { redirect_to @power_rack, notice: \"Power rack was successfully created.\" }\n format.json { render :show, status: :created, location: @power_rack }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @power_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @control_panel = ControlPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def new\n @panel = Panel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @panel }\n end\n end", "def create\n @evil_wizard = EvilWizard.new(params[:evil_wizard])\n\n respond_to do |format|\n if @evil_wizard.save\n format.html { redirect_to(@evil_wizard, :notice => 'Evil wizard was successfully created.') }\n format.xml { render :xml => @evil_wizard, :status => :created, :location => @evil_wizard }\n else\n fetch_dungeons\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evil_wizard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @port_panels = PortPanel.all\n end", "def post\n frm.button(:name=>\"post\").click\n AssignmentsList.new(@browser)\n end", "def create\n @powe_factor_nozzle_x = PoweFactorNozzleX.new(powe_factor_nozzle_x_params)\n\n respond_to do |format|\n if @powe_factor_nozzle_x.save\n format.html { redirect_to @powe_factor_nozzle_x, notice: 'Powe factor nozzle x was successfully created.' }\n format.json { render :show, status: :created, location: @powe_factor_nozzle_x }\n else\n format.html { render :new }\n format.json { render json: @powe_factor_nozzle_x.errors, status: :unprocessable_entity }\n end\n end\n end", "def sold_panel_params\n params.require(:sold_panel).permit(:buyer_id, :totalPrice, :totalPower)\n end", "def panel_params\n params.require(:panel).permit(:panel_id, :teacher_1, :teacher_2)\n end", "def equipment_gauge_panel(equipment)\n render 'batches/gauge_panel',\n gauge: {\n title: equipment.panel_title,\n display: equipment\n }\n end", "def panel_model_params\n params.require(:panel_model).permit(:name, :numberOfPort, :category)\n end", "def save\n #10.times {frm.button(:id=>\"questionpool:submit\").flash}\n frm.button(:id=>\"questionpool:submit\").click\n #sleep 180\n #frm.button(:value=>\"Create\").wait_until_present(120)\n QuestionPoolsList.new(@browser)\n end", "def create\n @power = Power.new(power_params)\n\n respond_to do |format|\n if @power.save\n set_me\n format.html { redirect_to @power, notice: 'Fuente creada satisfactoriamente.' }\n format.json { render :show, status: :created, location: @power }\n else\n format.html { render :new }\n format.json { render json: @power.errors, status: :unprocessable_entity }\n end\n end\n end", "def _draw_panel\n @apotomo_emit_raw_view = true\n render :view => param(:panel)\n end", "def power_params\n params.require(:power).permit(:powernum)\n end", "def index\n @control_panels = ControlPanel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @control_panels }\n end\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def sendDataFromSketchup()\r\n puts \"running sendDataFromSketchup from render settings editor\"\r\n\t\tsettings = @lrs.get_names_render\r\n\t\tsettings.each { |setting|\r\n #puts \"\"\r\n #puts setting\r\n #puts @lrs.send(setting)\r\n #updateSettingValue(setting) \r\n\t\t\tsetValue(setting, @lrs[setting]) # gets setting from @lrs\r\n\t\t\t\r\n\t\t}\r\n # set setting areas based on dropdown settings\r\n subfield_categories = [\"sampler_type\", \"sintegrator_type\", \"pixelfilter_type\", \"accelerator_type\"]\r\n subfield_categories.each{|fieldname|\r\n update_subfield = 'update_subfield(\"' + fieldname + '\")'\r\n #puts update_subfield\r\n @render_settings_dialog.execute_script(update_subfield)\r\n }\r\n # show/hide SPPM integrator field\r\n if (@lrs.renderer==\"sppm\")\r\n showintegrator='$(\"#sppm\").show();'\r\n hideintegrator='$(\"#integratorsection\").hide();'\r\n else\r\n showintegrator='$(\"#integratorsection\").show();'\r\n hideintegrator='$(\"#sppm\").hide();'\r\n \r\n end\r\n @render_settings_dialog.execute_script(hideintegrator)\r\n @render_settings_dialog.execute_script(showintegrator)\r\n \r\n # show preset name in dropdown value\r\n setdropdown = '$(\"#renderpreset\").val(\"' + @lrs.renderpreset + '\");'\r\n @render_settings_dialog.execute_script(setdropdown)\r\n\r\n \r\n\tend", "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 power_supply_params\n params.require(:power_supply).permit(:name, :price, :code, :brand, :model, :series, :powertype, :maxpower, :fans, :pfc, :mainconnector, :twelvevrails, :pci, :sata, :efficiency, :voltageprotection, :inputvoltage, :inputfrequency, :inputcurrent, :output, :dimensions, :features)\n end", "def stepPlus()\r\n visData=@visDataModel.stepPlus()\r\n return createUpdateXML(visData)\r\n end", "def create\n params.permit!\n @power_factor = Power::Factor.new(params[:power_factor])\n\n respond_to do |format|\n if @power_factor.save\n format.html { redirect_to(@power_factor, :notice => 'Factor was successfully created.') }\n format.xml { render :xml => @power_factor, :status => :created, :location => @power_factor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @power_factor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def powerline_adapter_params\n params.require(:powerline_adapter).permit(:name, :price, :code, :brand, :brandmodel, :standards, :encryption, :ports, :led, :certifications, :powerlinespeeds, :connectiontype, :connectionspeeds, :kittype, :systemrequirements, :temperature, :humidity, :features, :dimensions, :weight, :other, :warranty)\n end", "def post\n frm.button(:value=>\"Post\").click\n AssignmentsList.new(@browser)\n end", "def create\n @power_rack_type = PowerRackType.new(power_rack_type_params)\n\n respond_to do |format|\n if @power_rack_type.save\n format.html { redirect_to @power_rack_type, notice: \"Power rack type was successfully created.\" }\n format.json { render :show, status: :created, location: @power_rack_type }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @power_rack_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @link = @panel.links.build(params[:link])\n\n @reset_unread = params[:unread]\n if @reset_unread == \"Yes\"\n @seen_panels = Visualization.find_all_by_panel_id(@panel.id)\n for panel in @seen_panels do\n panel.destroy\n end\n end\n \n respond_to do |format|\n if @link.save\n format.html { redirect_to(@panel) }\n format.xml { render :xml => @link, :status => :created, :location => @link }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @link.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel_model = PanelModel.new(panel_model_params)\n\n respond_to do |format|\n if @panel_model.save\n format.html { redirect_to @panel_model, notice: 'Panel model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @panel_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @panel_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_plan_units\n save_plan_btn.click\n end", "def create\n @powiadomienie = Powiadomienie.new(params[:powiadomienie])\n\n respond_to do |format|\n if @powiadomienie.save\n format.html { redirect_to @powiadomienie, notice: 'Powiadomienie was successfully created.' }\n format.json { render json: @powiadomienie, status: :created, location: @powiadomienie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @powiadomienie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @power_supply = PowerSupply.new(power_supply_params)\n\n respond_to do |format|\n if @power_supply.save\n format.html { redirect_to @power_supply, notice: 'Power supply was successfully created.' }\n format.json { render :show, status: :created, location: @power_supply }\n else\n format.html { render :new }\n format.json { render json: @power_supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def create\n @super_power = SuperPower.new(super_power_params)\n\n respond_to do |format|\n if @super_power.save\n format.html { redirect_to @super_power, notice: 'Super power was successfully created.' }\n format.json { render :show, status: :created, location: @super_power }\n else\n format.html { render :new }\n format.json { render json: @super_power.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_unit }\n end\n end", "def dashboard_params\n params.require(:dashboard).permit(:widgets, :name, :show)\n end", "def create\n @sw_dev = SwDev.new(sw_dev_params)\n\n respond_to do |format|\n if @sw_dev.save\n format.html { redirect_to @sw_dev, notice: 'Sw dev was successfully created.' }\n format.json { render :show, status: :created, location: @sw_dev }\n else\n format.html { render :new }\n format.json { render json: @sw_dev.errors, status: :unprocessable_entity }\n end\n end\n end", "def dashboard_params\n params.require(:dashboard).permit(\"hostname\", \"kernel_version\", \"ipaddress\", \"macaddress\", \"cpuidle\", \"total_memory\", \"used_memory\", \"free_memory\", \"total_swap\", \"used_swap\", \"free_swap\", \"userslist\", \"disk_free_space\", \"disk_Used_space\",\"stat\",\"search\")\n end", "def create\n @power_supply = PowerSupply.new(power_supply_params)\n\n respond_to do |format|\n if @power_supply.save\n format.html { redirect_to power_supplies_url }\n else\n format.html { render :new }\n end\n end\n end", "def qos_add_traffic_shaping(rule_name, data, info)\n \n # Note: To prevent error on multiple call, you should go back the main.\n \n # Go to the advanced page.\n self.goto_advanced(rule_name, info)\n \n # Go to the qos page.\n begin\n @ff.link(:text, 'Quality of Service(QoS)').click\n self.msg(rule_name, :info, 'Qos', 'Reached page Qos')\n rescue\n self.msg(rule_name, :error, 'Qos', 'Did not reach Qos page')\n return\n end\n \n # Go to the \"Traffic Shaping\" page.\n begin\n @ff.link(:href,'javascript:mimic_button(\\'btn_tab_goto: 9056..\\', 1)').click\n self.msg(rule_name,:info,'Traffic Shaping','Reached page: Traffic Priority')\n rescue\n self.msg(rule_name,:error,'Traffic Shaping','Did not reach the page')\n return\n end\n \n # \n # Note: Now,we are under the page of traffic shaping.\n #\n \n # Step One: Check if the device has been added, if so delete it.\n \n # Step Two: Add Device Traffic Shaping.\n \n # Click the \"add\" button.\n @ff.link(:name,'add').click\n # Confirm it.\n if not @ff.text.include? 'Add Device Traffic Shaping'\n self.msg(rule_name,:error,'QoS Add Traffic Shaping','Did not reach the page')\n return\n end\n \n # Choose the device.\n if data.has_key?('device')\n \n # Note: This name should be correspondent with the web.\n case data['device'] \n when \"network\" \n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('br0') \n when \"ethernet\" \n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('eth0') \n when \"broadband_ethernet\" \n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('eth1') \n when \"coax\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('clink0')\n when \"broadband_coax\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('clink1')\n when \"wireless\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('ath0')\n when \"wan_pppoe\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('ppp0')\n when \"wan_pppoe2\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('ppp1')\n when \"default_lan\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('Default LAN')\n when \"default_wan\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('Default WAN')\n when \"default_DMZ\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('Default DMZ')\n when \"all\"\n @ff.select_list(:name,'sym_qos_traffic_device_combo').select_value('All Devices')\n else\n # Whenever come here, there is something wrong with the program.\n self.msg(rule_name,:error,'Add Device','Device name unmatched.')\n puts \"Add Traffic Shaping: Device name unmatched.\"\n return\n end # end of case\n \n #Go to the 'Edit Device Traffic Shaping page'.\n @ff.link(:text,'Apply').click\n # Confirm it.\n if not @ff.text.include? 'Tx Traffic Shaping'\n self.msg(rule_name,:error,'QoS Add Traffic Shaping','Did not reach the page')\n return\n end\n \n end # end of if\n \n # Step Three: Edit Device Traffic Shaping\n \n # Setup the bandwidth.\n if data.has_key?('tx_bandwidth')\n \n case data['tx_bandwidth']\n when \"Unlimited\"\n # Unlimited \n @ff.select_list(:name,'qos_tx_shaping_bandwidth_mode').select_value('2')\n else\n # Specify\n @ff.select_list(:name,'qos_tx_shaping_bandwidth_mode').select_value('0')\n \n # Fill in the bandwidth value\n # *** Note: ***\n # Here you MUST wait until the new page come out, so to confirm it.\n if not @ff.text.include? 'Kbps'\n self.msg(rule_name,:error,'QoS set bandwidth','Did not fill in the bandwidth')\n return\n end\n \n @ff.text_field(:name,'sym_qos_shaping_tx_bandwidth').set(data['tx_bandwidth'])\n end\n \n # Apply for the change.\n @ff.link(:text,'Apply').click\n # Confirm it.\n if not @ff.text.include? 'DSCP Settings'\n self.msg(rule_name,:error,'Setup Bandwidth','Did not succeed.')\n return\n end\n \n end # end of if data...\n \n # Output one message to confirm one traffic shaping.\n self.msg(rule_name,:info,'Add one traffic shapping','OK')\n \n end", "def show_panel\n @tab_name = params[:panel_name]\n @panel_name = params[:panel_name] == \"properties\" ? \"prop_sheet\" : params[:panel_name]\n @all_pages = @question_sheet.pages # for pages_list\n @page = @question_sheet.pages.find(params[:id])\n\n respond_to do |format|\n format.js # load panel\n end\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_new_pool\n #puts \"clicking add new pool...\"\n #10.times {frm.link(:text=>\"Add New Pool\").flash}\n frm.link(:text=>\"Add New Pool\").click\n #puts \"clicked...\"\n #frm.text_field(:id=>\"questionpool:namefield\").wait_until_present(200)\n AddQuestionPool.new(@browser)\n end", "def create\n #Create switch and ports\n @switch = Switch.create(switch_params)\n redirect_to switches_path\n end", "def view_pdt_logs_details_form(pdt_log,action)\n\n field_configs = Array.new\n\n field_configs << {:field_type => 'LabelField', :field_name => 'user_name'}\n\n field_configs << {:field_type => 'LabelField', :field_name => 'created_on'}\n\n field_configs << {:field_type => 'LabelField', :field_name => 'menu_item'}\n\n field_configs << {:field_type => 'LabelField', :field_name => 'ip'}\n\n field_configs << {:field_type => 'LabelField', :field_name => 'mode'}\n\n# field_configs << {:field_type => 'LabelField', :field_name => 'input_xml',\n# :settings => {:css_class => 'xml_input_label', :show_label => true,\n# :static_value => pdt_log.input_xml.gsub(\"<\", \"&lt;\").gsub(\">\",\"&gt;\") }}\n#\n# field_configs << {:field_type => 'LabelField',:field_name =>'output_xml',\n# :settings => {:css_class => 'xml_output_label', :show_label => true,\n# :static_value => pdt_log.output_xml.gsub(\"<\", \"&lt;\").gsub(\">\",\"&gt;\") }}\n\n\n build_form(pdt_log,field_configs,nil,'pdt_logs',\"back\")\n end", "def create\n @power_transformer = PowerTransformer.new(power_transformer_params)\n\n respond_to do |format|\n if @power_transformer.save\n format.html { redirect_to @power_transformer, notice: 'Power transformer was successfully created.' }\n format.json { render :show, status: :created, location: @power_transformer }\n else\n format.html { render :new }\n format.json { render json: @power_transformer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @power = current_user.powers.build(power_params)\n\n respond_to do |format|\n if @power.save\n format.html { redirect_to @power, notice: 'Power was successfully created.' }\n format.json { render :show, status: :created, location: @power }\n else\n format.html { render :new }\n format.json { render json: @power.errors, status: :unprocessable_entity }\n end\n end\n end", "def prfExport_neu()\n @view.centralWidget = PrfExpWindow.new(self,@view)\n reset_elements(:excel => nil)\n end", "def render_chart_get_xml_from_action(chart_swf,controller_name,action_name,params,chart_id,chart_width,chart_height,debug_mode,register_with_js,&block)\n logger.info(\"The controller to be contacted is \" + controller_name)\n logger.info(\"The action to be performed is \" + action_name)\n str_xml= render_component(:action=>action_name,:controller=>controller_name,:params=>params)\n logger.info(\"The xml obtained from the given action is \" + str_xml)\n render_chart(chart_swf,\"\",str_xml,chart_id,chart_width,chart_height,debug_mode,register_with_js,&block)\n end", "def index\n @panels = Panel.all\n end", "def new\n @power_factor = Power::Factor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @power_factor }\n end\n end", "def create\n @widget_layout = WidgetLayout.new(params[:widget_layout])\n respond_to do |format|\n if @widget_layout.save\n flash[:notice] = 'WidgetLayout was successfully created.'\n format.html { \n if params['admin_page']\n redirect_to('/admin/modules')\n else\n redirect_to(@widget_layout) \n end \n }\n format.xml { render :xml => @widget_layout, :status => :created, :location => @widget_layout }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @widget_layout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def sendDataFromSketchup()\r\n puts \"running sendDataFromSketchup from scene settings editor\"\r\n\t\t@lrs.fleximage_xresolution = Sketchup.active_model.active_view.vpwidth unless @lrs.fleximage_xresolution\r\n\t\t@lrs.fleximage_yresolution = Sketchup.active_model.active_view.vpheight unless @lrs.fleximage_yresolution\r\n\t\tsettings = @lrs.get_names_scene\r\n\t\tsettings.each { |setting|\r\n #puts \"\"\r\n #puts setting\r\n #puts @lrs.send(setting)\r\n updateSettingValue(setting) # gets setting from @lrs\r\n\t\t}\r\n # update interface for resolution section\r\n updateResolutionGUI()\r\n if (@lrs.aspectratio_type == \"aspectratio_fixed\")\r\n setFixedResValue(@lrs.aspectratio_fixed_ratio)\r\n end\r\n \r\n # update subsections based on active dropdown values\r\n @scene_settings_dialog.execute_script('update_subfield(\"environment_light_type\")')\r\n @scene_settings_dialog.execute_script('update_boxfield(\"use_environment_infinite_sun\")')\r\n @scene_settings_dialog.execute_script('update_subfield(\"fleximage_colorspace_wp_preset\")')\r\n @scene_settings_dialog.execute_script('update_subfield(\"fleximage_tonemapkernel\")')\r\n @scene_settings_dialog.execute_script('update_subfield(\"fleximage_render_time\")')\r\n \r\n \r\n\tend", "def create\n @panel = Panel.new(params[:panel])\n @place = Place.find(params[:place_id])\n @panel.user = \"user test\"\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(place_panel_url(@place, @panel), :notice => 'Panel was successfully created.') }\n format.json { render :json => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => :new }\n format.json { render :json => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel_plan = Panel::Plan.new(params[:panel_plan])\n\n respond_to do |format|\n if @panel_plan.save\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully created.') }\n format.json { render :json => @panel_plan, :status => :created, :location => @panel_plan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n flash[:notice] = 'Panel was successfully updated.'\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def switch_params\n params.require(:switch).permit(:name, :reference, :price, :nports, :port, :numerodepuertos,\n :puerto1,:puerto2,:puerto3,:puerto4,:puerto5,:puerto6,:puerto7,:puerto8,:puerto9,:puerto10,:puerto11,\n :idpuerto1,:idpuerto2,:idpuerto3,:idpuerto4,:idpuerto5,:idpuerto6,:idpuerto7,:idpuerto8,:idpuerto9,:idpuerto10,:idpuerto11\n \n )\n end", "def create\n \t@dpm = Dpm.new(dpm_params)\n \t#todo @user = User.find_by(current_user[:id])\n \t#@user.dpms << @dpm\n \t\n respond_to do |format|\n if @dpm.save\n format.html { render '/dpms/step1', notice: 'Dpm was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dpm }\n else\n format.html { render action: 'new' }\n format.json { render json: @dpm.errors, status: :unprocessable_entity }\n end\n end\n end", "def superpower_params\n params.require(:superpower).permit(:name, :id)\n end", "def create\n @sw_dev_type = SwDevType.new(sw_dev_type_params)\n\n respond_to do |format|\n if @sw_dev_type.save\n format.html { redirect_to @sw_dev_type, notice: 'Sw dev type was successfully created.' }\n format.json { render :show, status: :created, location: @sw_dev_type }\n else\n format.html { render :new }\n format.json { render json: @sw_dev_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wide_puppet = WidePuppet.new(wide_puppet_params)\n\n respond_to do |format|\n if @wide_puppet.save\n format.html { redirect_to action: \"index\", notice: 'Wide puppet was successfully created.' }\n format.json { render :show, status: :created, location: @wide_puppet }\n else\n format.html { render :new }\n format.json { render json: @wide_puppet.errors, status: :unprocessable_entity }\n end\n end\n end", "def previews\n @session_user = User.find(session[:user_id])\n @page = @session_user.page\n panels = Array.new\n for panel in @page.panels.order(:created_at)\n fields = get_panel_preview(panel) \n panels.push(fields)\n end\n render json: panels\n end", "def admin_panel_tag_params\n params.require(:admin_panel_tag).permit(:name, :description)\n end", "def create\n @switch_port = SwitchPort.new(switch_port_params)\n\n respond_to do |format|\n if @switch_port.save\n format.html { redirect_to @switch_port, notice: 'Switch port was successfully created.' }\n format.json { render :show, status: :created, location: @switch_port }\n else\n format.html { render :new }\n format.json { render json: @switch_port.errors, status: :unprocessable_entity }\n end\n end\n end", "def showpiece_params\n params.require(:showpiece).permit(:name, :creation_century, :description, :insurance, :height, :width, :length, :temperature_control, :wet_control, :people_protection, :collection_id_id)\n end", "def test_add_switch_port\n login_as make_admin_user\n @switch = Node.make(:switch)\n @nsp = NetworkSwitchPort.plan(:switch_id => @switch.id)\n @node = Node.make(:physical, :datacenter_id => @switch.datacenter_id)\n Capybara::visit \"/node/show/#{@node.id}\"\n assert_difference('@node.network_switch_ports.count', 1) do\n Capybara::within(:css, '#add_switch_port_node') do\n Capybara::select @switch.to_label, :from => 'switch_port_switch_id'\n Capybara::fill_in 'switch_port_port', :with => @nsp[:port]\n Capybara::click 'Plug'\n end\n assert Capybara::has_xpath?(\"//td[.='#{@nsp[:port]}']\")\n end\n end", "def digital_ship_group_panel\n\t\t$tracer.trace(__method__)\n return GameStopDigitalShipGroupPanel.new(div.className(create_ats_regex_string(\"ats-digitalshipgrppanel\")), __method__)\n\tend", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @admin_decp_module = Admin::DecpModule.new(params[:admin_decp_module])\r\n\r\n @data_types = %w[boolean date datetime decimal integer string time]\r\n\r\n respond_to do |format|\r\n format.html { render action: \"create_form\" }\r\n # format.json { render json: @admin_decp_module.errors, status: :unprocessable_entity }\r\n end\r\n end", "def html_actions_panel(node, output)\n return nil unless node.is_a?(ICollection)\n\n # We also know fairly certain that if an object is a non-extended\n # SimpleCollection, we won't need to show the panel either.\n return nil if node.class == Tilia::Dav::SimpleCollection\n\n output.value << <<FORM\n<form method=\"post\" action=\"\">\n <h3>Create new folder</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"mkcol\" />\n <label>Name:</label> <input type=\"text\" name=\"name\" /><br />\n <input type=\"submit\" value=\"create\" />\n</form>\n<form method=\"post\" action=\"\" enctype=\"multipart/form-data\">\n <h3>Upload file</h3>\n <input type=\"hidden\" name=\"sabreAction\" value=\"put\" />\n <label>Name (optional):</label> <input type=\"text\" name=\"name\" /><br />\n <label>File:</label> <input type=\"file\" name=\"file\" /><br />\n <input type=\"submit\" value=\"upload\" />\n</form>\nFORM\n end", "def create\n @wepon = Wepon.new(wepon_params)\n\n respond_to do |format|\n if @wepon.save\n format.html { redirect_to @wepon, notice: '追加されました' }\n format.json { render :show, status: :created, location: @wepon }\n else\n format.html { render :new }\n format.json { render json: @wepon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n show_windows_for_period\n @start_date = get_date_for(RegistrationWindowsConstants::DATE_BOUND_START, @start_date, @period_key)\n @end_date = get_date_for(RegistrationWindowsConstants::DATE_BOUND_END, @end_date, @period_key)\n\n puts \"Adding Registration Window #{@appointment_window_info_name} for Period #{@period_key}. Start Date = #{@start_date} and End Date = #{@end_date}\"\n on RegistrationWindowsCreate do |page|\n page.appointment_window_info_name.set @appointment_window_info_name\n if (page.period_key.exists?)\n page.period_key.select @period_key\n end\n page.assigned_population_name.set @assigned_population_name\n #page.start_date.set get_date_for(RegistrationWindowsConstants::DATE_BOUND_START, @start_date, @period_key)\n page.start_date.set @start_date\n page.start_time.set @start_time\n page.start_time_am_pm.select @start_time_am_pm\n #page.end_date.set get_date_for(RegistrationWindowsConstants::DATE_BOUND_END, @end_date, @period_key)\n page.end_date.set @end_date\n page.end_time.set @end_time\n page.end_time_am_pm.select @end_time_am_pm\n page.window_type_key.select @window_type_key\n page.loading.wait_while_present\n if (page.max_appointments_per_slot.present?)\n page.max_appointments_per_slot.set @max_allocation\n end\n if (page.slot_rule_enum_type.present?)\n page.slot_rule_enum_type.select @slot_rule_enum_type\n end\n page.add\n while true\n begin\n sleep 1\n wait_until { page.window_collection_table.exists? }\n break\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n puts \"rescued StaleElementReferenceError\"\n end\n end\n end\n\n end", "def create\n @wypozyczenium = Wypozyczenium.new(wypozyczenium_params)\n\n respond_to do |format|\n if @wypozyczenium.save\n format.html { redirect_to @wypozyczenium, notice: 'Wypozyczenium was successfully created.' }\n format.json { render :show, status: :created, location: @wypozyczenium }\n else\n format.html { render :new }\n format.json { render json: @wypozyczenium.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n params[:elements].values.each do |elem|\n puts 'el', elem\n elem_to_save = Element.create (elem)\n @design.elements << elem_to_save\n end\n\n\n respond_to do |format|\n if @design.id\n format.html { redirect_to edit_design_path(@design), notice: 'Design was successfully created.' }\n format.json { render :json => @design}\n else\n format.html { render :new }\n format.json { render json: @design.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def show\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @control_panel }\n end\n end", "def sort_panels!\n dashboard[:panel_groups].each do |group|\n missing_panels! unless group[:panels].is_a? Array\n\n group[:panels] = group[:panels].sort_by { |panel| -panel[:weight].to_i }\n end\n end", "def create\n @power_outlet_group = PowerOutletGroup.new(power_outlet_group_params)\n\n respond_to do |format|\n if @power_outlet_group.save\n format.html { redirect_to @power_outlet_group, notice: 'Power outlet group was successfully created.' }\n format.json { render :show, status: :created, location: @power_outlet_group }\n else\n format.html { render :new }\n format.json { render json: @power_outlet_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n if @control_panel.update_attributes(params[:control_panel])\n flash[:notice] = 'ControlPanel was successfully updated.'\n format.html { redirect_to(@control_panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_elements\n programme_id = params[:programme][:id]\n ProgrammeElement.destroy_all ['programme_id = ?', programme_id ]\n logger.info(\"programme=#{programme_id}\");\n logger.info(params.inspect);\n \n pelist = params[:programme_elements]\n # Add in the new items. From params return if OK. \n index=0;\n while ( pelist[index.to_s] )\n cn=pelist[index.to_s][:column_name]\n unless cn.blank?\n pe=ProgrammeElement.new( pelist[index.to_s] )\n pe.programme_id = programme_id\n pe.position = index\n # pe.column_name = cn # assigned in the new above !!\n pe.save!\n end\n index += 1;\n end\n redirect_to :action => 'show', :id => programme_id\n end", "def save_and_publish\n frm.button(:value=>\"Save Settings and Publish\").click\n PublishAssessment.new(@browser)\n end", "def create\n @pledgenewee = Pledgenewee.new(pledgenewee_params)\n\n respond_to do |format|\n if @pledgenewee.save\n format.html { redirect_to @pledgenewee, notice: 'Pledgenewee was successfully created.' }\n format.json { render :show, status: :created, location: @pledgenewee }\n else\n format.html { render :new }\n format.json { render json: @pledgenewee.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6466403", "0.5780193", "0.577855", "0.5748411", "0.5694396", "0.54189277", "0.54148465", "0.5409598", "0.53909653", "0.53635186", "0.52615803", "0.5254718", "0.52017796", "0.5157608", "0.5105268", "0.5103327", "0.5099746", "0.5090005", "0.50723594", "0.5055526", "0.5022072", "0.5021899", "0.49595556", "0.49595556", "0.49246734", "0.4923839", "0.49077123", "0.48793617", "0.4853246", "0.48340014", "0.48281193", "0.48154396", "0.47955072", "0.47903666", "0.47898647", "0.47869694", "0.47820488", "0.4781093", "0.4772423", "0.4759061", "0.47472015", "0.47471768", "0.47461212", "0.47345456", "0.47338748", "0.47070417", "0.4704386", "0.46844143", "0.468431", "0.46698555", "0.46585003", "0.46528214", "0.4649607", "0.4637262", "0.46366927", "0.46215716", "0.4618215", "0.46155235", "0.4613029", "0.4611058", "0.4606966", "0.46043193", "0.46033823", "0.45991305", "0.45789072", "0.45759973", "0.45577925", "0.4550876", "0.45320964", "0.4522188", "0.45190826", "0.45117676", "0.45008135", "0.44924754", "0.44844434", "0.44699508", "0.44687063", "0.44670638", "0.44644088", "0.4458069", "0.4454963", "0.44496167", "0.44477165", "0.444709", "0.444428", "0.4442174", "0.44385687", "0.44375718", "0.44331378", "0.4427691", "0.4426867", "0.44259593", "0.44128722", "0.44123328", "0.44023144", "0.43977267", "0.43931067", "0.43914455", "0.43897748", "0.43837923" ]
0.67720073
0
PUT /deweys_power_panels/1 PUT /deweys_power_panels/1.xml
def update @deweys_power_panel = DeweysPowerPanel.find(params[:id]) respond_to do |format| if @deweys_power_panel.update_attributes(params[:deweys_power_panel]) format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n flash[:notice] = 'Panel was successfully updated.'\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @control_panel = ControlPanel.find(params[:id])\n\n respond_to do |format|\n if @control_panel.update_attributes(params[:control_panel])\n flash[:notice] = 'ControlPanel was successfully updated.'\n format.html { redirect_to(@control_panel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @control_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panel.update(panel_params)\n format.html { redirect_to @panel, notice: 'Panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @panel }\n else\n format.html { render :edit }\n format.json { render json: @panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n @deweys_power_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(deweys_power_panels_url) }\n format.xml { head :ok }\n end\n end", "def show\n @deweys_power_panel = DeweysPowerPanel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def update\n respond_to do |format|\n if @admin_panel.update(admin_panel_params)\n format.html { redirect_to @admin_panel, notice: 'Admin panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @deweys_power_panel = DeweysPowerPanel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @deweys_power_panel }\n end\n end", "def editStage(nostage, name, desc)\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStages']\").set name\n find(:xpath, \"//*[@id='config-array-#{nostage.to_i-1}-com.spigit.idea.IdeaConfig.lifecycleStageDescriptions']\").set desc\n sleep 3\n end", "def update\n @power = Power.find(params[:id])\n\n respond_to do |format|\n if @power.update_attributes(params[:power])\n format.html { redirect_to(@power, :notice => 'Power was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @power.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @panel = Panel.find(params[:id])\n @place = Place.find(params[:place_id])\n\n respond_to do |format|\n if @panel.update_attributes(params[:panel])\n format.html { redirect_to(place_panel_url(@place, @panel), :notice => 'Panel was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.find(params[:id])\n\n respond_to do |format|\n if @power_unit.update_attributes(params[:power_unit])\n flash[:notice] = 'PowerUnit was successfully updated.'\n format.html { redirect_to(@power_unit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @power_unit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @port_panel.update(port_panel_params)\n format.html { redirect_to @port_panel, notice: 'Port panel was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @port_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @deweys_power_panel = DeweysPowerPanel.new(params[:deweys_power_panel])\n\n respond_to do |format|\n if @deweys_power_panel.save\n format.html { redirect_to(@deweys_power_panel, :notice => 'Deweys power panel was successfully created.') }\n format.xml { render :xml => @deweys_power_panel, :status => :created, :location => @deweys_power_panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @deweys_power_panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @power_rack.update(power_rack_params)\n format.html { redirect_to @power_rack, notice: \"Power rack was successfully updated.\" }\n format.json { render :show, status: :ok, location: @power_rack }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @power_rack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @panel_model.update(panel_model_params)\n format.html { redirect_to @panel_model, notice: 'Panel model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @panel_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_panel\n @panel = Panel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @power.update(power_params)\n format.html { redirect_to @power, notice: 'Power was successfully updated.' }\n format.json { render :show, status: :ok, location: @power }\n else\n format.html { render :edit }\n format.json { render json: @power.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @power_factor = Power::Factor.find(params[:id])\n\n respond_to do |format|\n if @power_factor.update_attributes(params[:power_factor])\n format.html { redirect_to(@power_factor, :notice => 'Factor was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @power_factor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @power.update(power_params)\n set_me\n format.html { redirect_to @power, notice: 'Fuente actualizada satisfactoriamente.' }\n format.json { render :show, status: :ok, location: @power }\n else\n format.html { render :edit }\n format.json { render json: @power.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @powerline_adapter.update(powerline_adapter_params)\n format.html { redirect_to @powerline_adapter, notice: 'Powerline adapter was successfully updated.' }\n format.json { render :show, status: :ok, location: @powerline_adapter }\n else\n format.html { render :edit }\n format.json { render json: @powerline_adapter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pnl = Pnl.find(params[:id])\n\n respond_to do |format|\n if @pnl.update_attributes(params[:pnl])\n format.html { redirect_to(@pnl, :notice => 'Pnl was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pnl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sold_panel.update(sold_panel_params)\n format.html { redirect_to @sold_panel, notice: 'Sold panel was successfully updated.' }\n format.json { render :show, status: :ok, location: @sold_panel }\n else\n format.html { render :edit }\n format.json { render json: @sold_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_port_panel\n @port_panel = PortPanel.find(params[:id])\n end", "def set_admin_panel\n @admin_panel = AdminPanel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @dashboard.update(dashboard_params)\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n end\n\n enabled_widgets = params[:widgets] || {}\n Dashboard.available_widgets.each do |(feature,_)|\n if enabled_widgets.include?(feature)\n @dashboard.widgets.merge!({feature => true})\n else\n @dashboard.widgets.except!(feature)\n end\n @dashboard.save\n end\n end", "def set_sold_panel\n @sold_panel = SoldPanel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @power_rack_type.update(power_rack_type_params)\n format.html { redirect_to @power_rack_type, notice: \"Power rack type was successfully updated.\" }\n format.json { render :show, status: :ok, location: @power_rack_type }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @power_rack_type.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# Rails.logger.info\n# Rails.logger.info params[:whitelabel][:w_markup]\n# Rails.logger.info params[:id]\n# white_label_params = params\n Rails.logger.info white_label_params\n respond_to do |format|\n if @white_label.update(white_label_params)\n# Whitelabel.update_attributes(:w_markup => params[:whitelabel] )\n format.html { redirect_to white_label_dashboard_path, notice: 'White label was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @white_label.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stepsix = Stepsix.find(params[:id])\n\n respond_to do |format|\n if @stepsix.update_attributes(params[:stepsix])\n format.html { redirect_to(root_path, :notice => 'Stepsix was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @stepsix.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @page_layout = PageLayout.find(params[:id])\n\n respond_to do |format|\n if @page_layout.update_attributes(params[:page_layout].permit(:content_type, :name, :num_panels, :html_content, :preview_content))\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_layout.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab_rack = LabRack.find(params[:id])\n\n respond_to do |format|\n if @lab_rack.update_attributes(params[:lab_rack])\n format.html { redirect_to(@lab_rack, :notice => 'Lab rack was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lab_rack.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sw_dev.update(sw_dev_params)\n format.html { redirect_to @sw_dev, notice: 'Sw dev was successfully updated.' }\n format.json { render :show, status: :ok, location: @sw_dev }\n else\n format.html { render :edit }\n format.json { render json: @sw_dev.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @panel_plan = Panel::Plan.find(params[:id])\n\n respond_to do |format|\n if @panel_plan.update_attributes(params[:panel_plan])\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @powerchip = Powerchip.find(params[:id])\n\n respond_to do |format|\n if @powerchip.update_attributes(params[:powerchip])\n format.html { redirect_to @powerchip, notice: 'Powerchip was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @powerchip.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @super_power.update(super_power_params)\n format.html { redirect_to @super_power, notice: 'Super power was successfully updated.' }\n format.json { render :show, status: :ok, location: @super_power }\n else\n format.html { render :edit }\n format.json { render json: @super_power.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @msshiplot = Msshiplot.find(params[:id])\n\n respond_to do |format|\n if @msshiplot.update_attributes(params[:msshiplot])\n format.html { redirect_to(@msshiplot, :notice => 'Msshiplot was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @msshiplot.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @widget_layout = WidgetLayout.find(params[:id])\n respond_to do |format|\n if @widget_layout.update_attributes(params[:widget_layout])\n flash[:notice] = 'WidgetLayout was successfully updated.'\n format.html { \n if params['admin_page']\n redirect_to('/admin/modules')\n else\n redirect_to(@widget_layout) \n end \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @widget_layout.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @panel_id = args[:panel_id] if args.key?(:panel_id)\n @panel_position = args[:panel_position] if args.key?(:panel_position)\n @total_panels = args[:total_panels] if args.key?(:total_panels)\n end", "def edit_dimension_usages_open\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n raise \"***** error #{dimension_id.inspect} == #{dimension.inspect}\" unless dimension\n render :update do |page|\n page.replace_html(\"div_dimension_extra_#{dimension.id}\", :partial => \"/knowledges/dimension_usages\", :locals => { :dimension => dimension })\n end\n end", "def update\n set_wine_app_description\n set_wine_app_screenshot\n respond_to do |format|\n if @wine_app.update(wine_app_params)\n format.html { redirect_to @wine_app, notice: 'App was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wine_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_sw_dev\n @sw_dev = SwDev.find(params[:id])\n end", "def set_power_rack\n @power_rack = PowerRack.find(params[:id])\n end", "def update\n @powiadomienie = Powiadomienie.find(params[:id])\n\n respond_to do |format|\n if @powiadomienie.update_attributes(params[:powiadomienie])\n format.html { redirect_to @powiadomienie, notice: 'Powiadomienie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @powiadomienie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lookup_price.update(lookup_price_params)\n @unsoldpanels=SolarPanel.where(\"sold_panel_id is NULL\")\n \n for i in 0...(@unsoldpanels).length\n\n @unsoldpanels[i].update_attributes(:price=>(LookupPrice.where(\"name=?\",\"watt\").first.value)*@unsoldpanels[i][:power].to_f)\n end\n format.html { redirect_to lookup_prices_path , notice: 'Lookup price was successfully updated.' }\n format.json { render :show, status: :ok, location: @lookup_price }\n else\n format.html { render :edit }\n format.json { render json: @lookup_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @evil_wizard.update_attributes(params[:evil_wizard])\n format.html { redirect_to(@evil_wizard, :notice => 'Evil wizard was successfully updated.') }\n format.xml { head :ok }\n else\n fetch_dungeons\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @evil_wizard.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n \n \n @sold_panel = SoldPanel.new(:buyer_id=> params[:buyer_id],:totalPrice=> params[:totalPrice],:totalPower=>params[:totalPower])\n\n respond_to do |format|\n if @sold_panel.save\n \n params[:solar_panel_id].each_with_index do |item,i|\n SolarPanel.where(\"id = ? \", params[:solar_panel_id][i]).update_all(:sold_panel_id => @sold_panel.id )\n @solarpanel=SolarPanel.where(\"id = ? \", params[:solar_panel_id][i])\n @container=Container.find(@solarpanel.first.container_id)\n \t @power=@container.total_power-@solarpanel.first.power \n \t @container.update_attributes(:total_power => @power)\n if @container.total_power == 0\n @container.update_attributes(:sold => true)\n end\n end\n format.html { redirect_to @sold_panel, notice: 'Sold panel was successfully created.' }\n format.json { render :show, status: :created, location: @sold_panel }\n else\n \n format.html { render :new }\n format.json { render json: @sold_panel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @widget = Widget.find(params[:id])\n respond_to do |format|\n if @widget.update_attributes(params[:widget])\n flash[:notice] = 'Widget was successfully updated.'\n format.html { \n if params['admin_page']\n redirect_to('/admin/modules')\n else\n redirect_to(@widget) \n end \n }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @widget.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 @power_outlet.update(power_outlet_params)\n format.html { redirect_to @power_outlet, notice: 'Power outlet was successfully updated.' }\n format.json { render :show, status: :ok, location: @power_outlet }\n else\n format.html { render :edit }\n format.json { render json: @power_outlet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sw_dev_type.update(sw_dev_type_params)\n format.html { redirect_to @sw_dev_type, notice: 'Sw dev type was successfully updated.' }\n format.json { render :show, status: :ok, location: @sw_dev_type }\n else\n format.html { render :edit }\n format.json { render json: @sw_dev_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @power_supply.update(power_supply_params)\n format.html { redirect_to power_supplies_url }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @techaxis = Techaxis.find(params[:id])\n\n respond_to do |format|\n if @techaxis.update_attributes(params[:techaxis])\n format.html { redirect_to techaxis_type_techaxis_path, :notice => t('controllermessage.update') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @techaxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interface = SWUI::Interface.find(params[:id])\n\t\tcurrent_panel = params.delete(:current_panel)\n\t\tparams.delete(:highlight)\n respond_to do |format|\n if @interface.update_attributes(params[:interface])\n flash[:notice] = 'Interface was successfully updated.'\n\t\t\t\tformat.html { redirect_to( params[:commit] == 'Save' ? interfaces_url : current_panel ) }\n\t\t\t\tformat.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @interface.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @power_supply.update(power_supply_params)\n format.html { redirect_to @power_supply, notice: 'Power supply was successfully updated.' }\n format.json { render :show, status: :ok, location: @power_supply }\n else\n format.html { render :edit }\n format.json { render json: @power_supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @components_saddle = Components::Saddle.find(params[:id])\n\n respond_to do |format|\n if @components_saddle.update_attributes(params[:components_saddle])\n format.html { redirect_to(@components_saddle, :notice => 'Saddle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @components_saddle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @panel = Panel.new(params[:panel])\n\n respond_to do |format|\n if @panel.save\n format.html { redirect_to(admin_panel_path(@panel), :notice => 'Panel was successfully created.') }\n format.xml { render :xml => @panel, :status => :created, :location => @panel }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @panel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @node_rack = @object\n\n respond_to do |format|\n if @node_rack.update_attributes(params[:node_rack])\n flash[:notice] = 'NodeRack was successfully updated.'\n format.html { redirect_to node_rack_url(@node_rack) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_rack.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @go_slim = GoSlim.find(params[:id])\n\n respond_to do |format|\n if @go_slim.update_attributes(params[:go_slim])\n format.html { redirect_to @go_slim, notice: 'Go slim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @go_slim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clapme_stage.update(website_stage_params)\n format.html { redirect_to website_stage_url(@clapme_stage.id), notice: 'Stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clapme_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @white_paper = WhitePaper.find(params[:id])\n\n respond_to do |format|\n if @white_paper.update_attributes(params[:white_paper])\n format.html { redirect_to @white_paper, notice: 'White paper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @white_paper.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n @power_assignment = PowerAssignment.find(params[:id])\n\n respond_to do |format|\n if @power_assignment.update_attributes(params[:power_assignment])\n format.html { redirect_to @power_assignment.game, notice: 'Power assignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @power_assignment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @switch.update(switch_params)\n format.html { redirect_to @switch, notice: 'Switch was successfully updated.' }\n format.json { render :show, status: :ok, location: @switch }\n else\n format.html { render :edit }\n format.json { render json: @switch.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_dimension_opinions_open\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n raise \"***** error #{dimension_id.inspect} == #{dimension.inspect}\" unless dimension\n render :update do |page|\n page.replace_html(\"div_dimension_extra_#{dimension.id}\", :partial => \"/knowledges/dimension_opinions\", :locals => { :dimension => dimension })\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\n if @wod.update(wod_params)\n render json: @wod\n else\n render json: @wod.errors, status: :unprocessable_entity\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 @power_transformer.update(power_transformer_params)\n format.html { redirect_to @power_transformer, notice: 'Power transformer was successfully updated.' }\n format.json { render :show, status: :ok, location: @power_transformer }\n else\n format.html { render :edit }\n format.json { render json: @power_transformer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wise.update(wise_params)\n format.html { redirect_to @wise, notice: 'Wise was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @wikipage.update(wikipage_params)\n save_version\n format.html { redirect_to @wikipage, notice: 'Wikipage was successfully updated.' }\n format.json { render :show, status: :ok, location: @wikipage }\n else\n format.html { render :edit }\n format.json { render json: @wikipage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if panel_params[:panel_number] and panel_params[:panel_location]\n Panel.assign(@ann, panel: panel_params[:panel_number], to: panel_params[:panel_location])\n end\n\n @panel = @ann.panel\n\n respond_to do |format|\n if @ann.update(ann_params)\n format.html { redirect_to @ann, notice: 'Ann was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ann.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_swot\n @swot = Swot.find(params[:id])\n end", "def edit\n Log.add_info(request, params.inspect)\n\n @yaml = ApplicationHelper.get_config_yaml\n end", "def update_dimension\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n if parent_id = params[:dimension][:parent_id]\n params[:dimension][:parent_id] = BSON::ObjectID.from_string(parent_id)\n end\n dimension.update_attributes(params[:dimension])\n render :update do |page|\n page.replace_html(\"list_dimensions\", :partial => \"dimensions\",\n :locals => { :dimensions => [@current_knowledge.dimension_root] })\n end\n end", "def update\n respond_to do |format|\n if @wide_puppet.update(wide_puppet_params)\n format.html { redirect_to action: \"index\", notice: 'Wide puppet was successfully updated.' }\n format.json { render :show, status: :ok, location: @wide_puppet }\n else\n format.html { render :edit }\n format.json { render json: @wide_puppet.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_dimension_open\n dimension_id = BSON::ObjectID.from_string(params[:id])\n dimension = @current_knowledge.get_dimension_by_id(dimension_id)\n raise \"***** error #{dimension_id.inspect} == #{dimension.inspect}\" unless dimension\n render :update do |page|\n page.replace_html(\"div_dimension_extra_#{dimension.id}\", :partial => \"/knowledges/dimension_edit\", :locals => { :dimension => dimension })\n end\n end", "def update\n @jetty = Jetty.find(params[:id])\n\n respond_to do |format|\n if @jetty.update_attributes(params[:jetty])\n format.html { redirect_to @jetty, notice: 'Jetty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @jetty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sesiune.update(sesiune_params)\n format.html { redirect_to controlPanel_path, notice: 'Sesiune was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: controlPanel_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wklysum = Wklysum.find(params[:id])\n\n respond_to do |format|\n if @wklysum.update_attributes(params[:wklysum])\n flash[:notice] = 'Wklysum was successfully updated.'\n format.html { redirect_to(@wklysum) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wklysum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lab_flow = LabFlow.find(params[:id])\n\n respond_to do |format|\n if @lab_flow.update_attributes(params[:lab_flow])\n format.html { redirect_to @lab_flow, notice: 'lab flow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_flow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n\n respond_to do |format|\n if @dashboard.update(dashboard_params )\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @dashboard }\n else\n format.html { render :edit }\n format.json { render json: @dashboard.errors, status: :unprocessable_entity }\n end\n\n dashboard_data # this from the help controller -> DataDashboard.new => collected the update value and create a new Data\n #\n mailer_array # application controll => limits the number Dashboard Update\n end\n end", "def update\n @techaxis_type = TechaxisType.find(params[:id])\n\n respond_to do |format|\n if @techaxis_type.update_attributes(params[:techaxis_type])\n format.html { redirect_to @techaxis_type, :notice => t('controllermessage.update')}\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @techaxis_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n save_setting('program_name', Setting::NAME_CURR_PROGRAM_NAME)\n save_setting('timelapse_mode', Setting::NAME_TIMELAPSE_MODE)\n save_setting('interval', Setting::NAME_INTERVAL)\n save_setting_with('sensor_proximity', Setting::NAME_SENSOR_PROXIMITY, params['sensor_proximity'].include?('active') ? \"1\" : \"0\") if params['sensor_proximity']\n save_setting_with('sensor_vibration', Setting::NAME_SENSOR_VIBRATION, params['sensor_vibration'].include?('active') ? \"1\" : \"0\") if params['sensor_vibration']\n save_setting('sensor_time_between_photos', Setting::NAME_SENSOR_TIME_BETWEEN_PHOTOS)\n\n head :ok\n end", "def update\n respond_to do |format|\n if @wireless.update(wireless_params)\n format.html { redirect_to @wireless, notice: 'Rede Wireless atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @wireless }\n else\n format.html { render :edit }\n format.json { render json: @wireless.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params.permit!\n @power_total = Power::Total.find(params[:id])\n\n respond_to do |format|\n if @power_total.update_attributes(params[:power_total])\n format.html { redirect_to(@power_total, :notice => 'Total was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @power_total.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_panel_model\n @panel_model = PanelModel.find(params[:id])\n end", "def update\n respond_to do |format|\n if @phenological_stage.update(phenological_stage_params)\n format.html { redirect_to @phenological_stage, notice: 'Phenological stage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @phenological_stage.errors, status: :unprocessable_entity }\n end\n end\n end", "def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "def update\n @pwidget = Pwidget.find(params[:id])\n\n respond_to do |format|\n if @pwidget.update_attributes(params[:pwidget])\n format.html { redirect_to @pwidget, notice: 'Pwidget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pwidget.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @showpiece.update(showpiece_params)\n format.html { redirect_to @showpiece, notice: 'Showpiece was successfully updated.' }\n format.json { render :show, status: :ok, location: @showpiece }\n else\n format.html { render :edit }\n format.json { render json: @showpiece.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wx_config.update(wx_config_params)\n format.html { redirect_to @wx_config, notice: 'Wx config was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wx_config.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @shower.update(shower_params)\n format.html { redirect_to @shower, notice: 'Shower was successfully updated.' }\n format.json { render :show, status: :ok, location: @shower }\n else\n format.html { render :edit }\n format.json { render json: @shower.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @stage = Stage.find(params[:id])\n\n if @stage.update_attributes(params[:stage])\n head :no_content\n else\n format.json { render json: @stage.errors, status: :unprocessable_entity }\n end\n end", "def update\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n\n respond_to do |format|\n if @quality_lot_gauge_dimension.update_attributes(params[:quality_lot_gauge_dimension])\n format.html { redirect_to([@quality_lot_gauge_dimension.quality_lot_gauge, @quality_lot_gauge_dimension], :notice => 'Quality lot gauge dimension was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @quality_lot_gauge_dimension.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @poll_options_set = PollOptionsSet.find(params[:id])\n\n respond_to do |format|\n if @poll_options_set.update_attributes(params[:poll_options_set])\n format.html { redirect_to @poll_options_set, notice: 'Poll options set was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @poll_options_set.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_admin_panel_tag\n @admin_panel_tag = AdminPanel::Tag.find_by(name: params[:id])\n @admin_panel_tag_id = AdminPanel::Tag.find(params[:id])\n end", "def update\n @lens = Lens.find(params[:id])\n attrb = select_params(lens_params)\n # linear_data is an array of Objects of Components Properties\n # that needs to be deserialized correctly\n attrb[\"linear_data\"] = JSON.parse(attrb[\"linear_data\"])\n lens = Lens.update(attrb)\n \n # @lens.update(lens_params)\n # render inline: \"<%= @lens.id %>\"\n end" ]
[ "0.6222639", "0.60940707", "0.59898514", "0.57851976", "0.57086146", "0.56935716", "0.5675835", "0.56312835", "0.5628273", "0.56208944", "0.56162226", "0.55742097", "0.5571035", "0.554381", "0.5540606", "0.54907674", "0.5459304", "0.545275", "0.5413396", "0.5346857", "0.5317839", "0.53032255", "0.5293025", "0.5287898", "0.5261571", "0.52306837", "0.5216405", "0.52055395", "0.5204887", "0.5181793", "0.5167403", "0.5162866", "0.51401865", "0.51317847", "0.5100153", "0.5100152", "0.5091255", "0.5081503", "0.5081367", "0.5081069", "0.5070378", "0.50679773", "0.50649107", "0.5062942", "0.5057423", "0.5043836", "0.5030654", "0.5020622", "0.50154746", "0.50015515", "0.50003755", "0.49969134", "0.49893612", "0.49881932", "0.49682322", "0.49637577", "0.49498162", "0.49437737", "0.4925876", "0.4916497", "0.49158528", "0.49139974", "0.4908558", "0.4906799", "0.49027392", "0.4902668", "0.49025866", "0.4896597", "0.48965582", "0.48910192", "0.48887926", "0.48862427", "0.48845443", "0.48810372", "0.48744997", "0.48738006", "0.48716334", "0.48685858", "0.4867498", "0.4864054", "0.48618123", "0.4861297", "0.48578033", "0.48573986", "0.4857112", "0.4849681", "0.48478058", "0.484693", "0.4845997", "0.48425037", "0.48311204", "0.48281902", "0.48259878", "0.4825782", "0.48255524", "0.48139355", "0.48119956", "0.48107016", "0.4810367", "0.48083133" ]
0.69261694
0
DELETE /deweys_power_panels/1 DELETE /deweys_power_panels/1.xml
def destroy @deweys_power_panel = DeweysPowerPanel.find(params[:id]) @deweys_power_panel.destroy respond_to do |format| format.html { redirect_to(deweys_power_panels_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_panels_url) }\n format.xml { head :ok }\n end\n end", "def db_delete\n assert_privileges(\"db_delete\")\n db = MiqWidgetSet.find(params[:id]) # temp var to determine the parent node of deleted items\n process_elements(db, MiqWidgetSet, \"destroy\")\n g = MiqGroup.find(@sb[:nodes][2].split('_').first)\n # delete dashboard id from group settings and save\n db_order = g.settings && g.settings[:dashboard_order] ? g.settings[:dashboard_order] : nil\n db_order&.delete(db.id)\n g.save\n nodes = x_node.split('-')\n self.x_node = \"#{nodes[0]}-#{nodes[1]}-#{nodes[2].split('_').first}\"\n replace_right_cell(:replace_trees => [:db])\n end", "def destroy\n @panel = Panel.find(params[:id])\n @panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(panels_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 @control_panel = ControlPanel.find(params[:id])\n @control_panel.destroy\n\n respond_to do |format|\n format.html { redirect_to(control_panels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n conf.delete 'dashboard'\n end", "def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end", "def destroy\n @admin_panel.destroy\n respond_to do |format|\n format.html { redirect_to admin_panels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_title = \"Power Units\"\n @power_unit = PowerUnit.find(params[:id])\n @power_unit.destroy\n\n respond_to do |format|\n format.html { redirect_to(power_units_url) }\n format.xml { head :ok }\n end\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def del_panel\n Panel.del_panel(pointer)\n end", "def destroy\n @power = Power.find(params[:id])\n @power.destroy\n\n respond_to do |format|\n format.html { redirect_to(powers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @stepsix = Stepsix.find(params[:id])\n @stepsix.destroy\n\n respond_to do |format|\n format.html { redirect_to(stepsixes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @addon.drop\n @addon.save(isinstall: 0)\n respond_to do |format|\n format.html { redirect_to xmt_addons_url, notice: '卸载成功.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @link = @panel.links.find(params[:id])\n @link.destroy\n\n respond_to do |format|\n format.html { redirect_to(@panel) }\n format.xml { head :ok }\n end\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 destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @pnl = Pnl.find(params[:id])\n @pnl.destroy\n\n respond_to do |format|\n format.html { redirect_to(pnls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @power_factor = Power::Factor.find(params[:id])\n @power_factor.destroy\n\n respond_to do |format|\n format.html { redirect_to(power_factors_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @node_config = NodeConfig.destroy(params[:id])\n xml=@node_config.to_xml\n json=@node_config.to_json\n @node_config.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_configs_url) }\n format.json { render :json => json}\n format.xml { render :xml => xml}\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @wklysum = Wklysum.find(params[:id])\n @wklysum.destroy\n\n respond_to do |format|\n format.html { redirect_to(wklysums_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @port_panel.destroy\n respond_to do |format|\n format.html { redirect_to port_panels_url }\n format.json { head :no_content }\n end\n end", "def delete_assignment(assignment_name)\n check_assignment(assignment_name)\n frm.button(:value=>\"Update\").click\n sleep 0.2\n frm.button(:value=>\"Delete\").click\n end", "def destroy\n @wx_config.destroy\n respond_to do |format|\n format.html { redirect_to wx_configs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @descriptor_especifico = DescriptorEspecifico.find(params[:id])\n @descriptor_especifico.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_descriptor_especificos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = @club.pages.find(params[:id])\n\t\t#destroy settings\n\t\t@settings = @club.settings.find(:all, :conditions => ['name = ? AND value = ?', 'pages', @page.id]);\n\t\t@settings.each do |setting|\n\t\t\tsetting.destroy\n\t\tend\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_club_pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @custom_definition.destroy\n redirect_to @site\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 @diagram = Diagram.find(params[:id])\n @diagram.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagrams_url) }\n format.xml { head :ok }\n end\n end", "def delete( )\n File.delete(@configFileDNE)\n self.clear\n self\n end", "def destroy\n @exp = Exp.find(params[:id])\n @exp.destroy\n\n respond_to do |format|\n format.html { redirect_to(exps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @powerline_adapter.destroy\n respond_to do |format|\n format.html { redirect_to powerline_adapters_url, notice: 'Powerline adapter was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@power.destroy\n @power.operational = false if @power.operational\n @power.save!\n respond_to do |format|\n format.html { redirect_to powers_url, notice: 'Fuente eliminada satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @power_supply.destroy\n respond_to do |format|\n format.html { redirect_to power_supplies_url }\n end\n end", "def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboards_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @diagramm = Diagramm.find(params[:id])\n @diagramm.destroy\n\n respond_to do |format|\n format.html { redirect_to(diagramme_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def cmd_delete argv\n setup argv\n e = @hash['element']\n response = @api.delete(e)\n msg response\n return response\n end", "def delete\n ruta = \"/actions/#{action_id}\"\n client.delete(ruta)\n end", "def delete_all(xpath); end", "def destroy\n @widget_layout = WidgetLayout.find(params[:id])\n @widget_layout.destroy\n respond_to do |format|\n format.html { redirect_to(widget_layouts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wp_dyna_config = WpDynaConfig.find(params[:id])\n @wp_dyna_config.destroy\n\n respond_to do |format|\n format.html { redirect_to wp_dyna_configs_url }\n format.json { head :no_content }\n end\n end", "def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxml=nessus_request('report/delete', post)\r\n\t\treturn docxml\r\n\tend", "def destroy\n @wellist.destroy\n\n head :no_content\n end", "def destroy\n @auditflows_flownode = AuditflowsFlownode.find(params[:id])\n @auditflows_flownode.destroy\n\n respond_to do |format|\n format.html { redirect_to(auditflows_flownodes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @pm_element = PmElement.find(params[:id])\n @pm_element.destroy\n redirect_to pm_element_path(@pm_element.parent)\n \n end", "def destroy\n @demo_host_setting = Demo::HostSetting.find(params[:id])\n @demo_host_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to(demo_host_settings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @edge_configuration = model.find(params[:id])\n if @edge_configuration.destroy\n flash[:notice] = \"Configuration Variable Deleted\"\n redirect_to :action => :index\n else\n flash[:notice] = \"Failed to delete configuration variable\"\n redirect_to :action => :index\n end\n end", "def destroy\n @paper_flow = PaperFlow.find(params[:id])\n @paper_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to(paper_flows_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @paper_flow = PaperFlow.find(params[:id])\n @paper_flow.destroy\n\n respond_to do |format|\n format.html { redirect_to(paper_flows_url) }\n format.xml { head :ok }\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n # binding.pry\n @website.destroy\n end", "def destroy\n @dpm.destroy\n respond_to do |format|\n format.html { redirect_to dpms_url }\n format.json { head :no_content }\n end\n end", "def delete_dashboards\n Dashboard.all.map { |data| Dashboard[data['link']] }.each { |d| d.delete }\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy\n @evil_wizard.destroy\n\n respond_to do |format|\n format.html { redirect_to(evil_wizards_url) }\n format.xml { head :ok }\n end\n end", "def deleteEntityWebsite( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/website\",params)\n end", "def delete\n delete_from_server single_url\n end", "def destroy\n @layout_field = LayoutField.find(params[:id])\n l = Layout.find(@layout_field.layout_id)\n @layout_field.destroy \n\n respond_to do |format|\n format.html { redirect_to(layout_layout_fields_url(l)) }\n format.xml { head :ok }\n end\n end", "def deletesms\n assert_privileges(\"storage_manager_delete\")\n sm_button_operation('destroy', 'deletion')\n end", "def destroy\n @admin_categoryall = Categoryall.find(params[:id])\n @admin_categoryall.destroy\n respond_with(@admin_categoryall, :location => admin_panels_url)\n end", "def destroy\n @expertise.destroy\n\n head :no_content\n end", "def destroy\n @poll = Poll.find(params[:id])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wpolls_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @panel_model.destroy\n respond_to do |format|\n format.html { redirect_to panel_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cpanel_mall.destroy\n respond_to do |format|\n format.html { redirect_to cpanel_malls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @website_use = WebsiteUse.find(params[:id])\n @website_use.destroy\n\n respond_to do |format|\n format.html { redirect_to(website_uses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_websites_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @power_total = Power::Total.find(params[:id])\n @power_total.destroy\n\n respond_to do |format|\n format.html { redirect_to(power_totals_url) }\n format.xml { head :ok }\n end\n end", "def delete_data\n Report.plugin_matrix.each do |resource_name, measurements|\n model = Object.const_get((resource_name + 'Resource').camelcase(:upper))\n model.dataset.all.each(&:delete)\n\n measurements.each do |measurement_name|\n table = Plugin.where(name: measurement_name).first.storage_table\n Iam.settings.DB[table.to_sym].delete\n end\n end\n Iam.settings.DB[:projects].delete\n Iam.settings.DB[:clients].delete\n end", "def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to(snaps_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page_title = \"Data Points\"\n @data_point = DataPoint.find(params[:id])\n @data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(data_points_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n if @site.columns.size > 0\n flash[:error] = \"该站点存在多个栏目,不能删除\"\n else\n delete_file(@site.logo_file) if !@site.logo_file.blank?\n @site.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to cms.sites_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @components_saddle = Components::Saddle.find(params[:id])\n @components_saddle.destroy\n\n respond_to do |format|\n format.html { redirect_to(components_saddles_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 @wod.destroy\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 delete_pxe_image_types\n pxe_image_type_button_operation('destroy', 'deletion')\n end", "def destroy\n @sidecfg.destroy\n respond_to do |format|\n format.html { redirect_to sidecfgs_url, notice: 'Sidecfg was successfully destroyed.' }\n format.json { head :no_content }\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 @design_detail_data_point = DesignDetailDataPoint.find(params[:id])\n @design_detail_data_point.destroy\n\n respond_to do |format|\n format.html { redirect_to(design_detail_data_points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n onesecgroup('delete', resource[:name])\n @property_hash.clear\n end", "def deleteSite _args\n \"deleteSite _args;\" \n end", "def test_delete_Port\n printf \"\\n@T:#{__method__}\\n\"\n @root_org = XMLParse.read(\"./tp/test_simple.xml\")\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n\n @root = XMLParse.read(\"./tp/test_simple.xml\")\n golden = [\"CLK2\",\"RST\",\"DIN2\",\"IO_PORT1\"]\n golden.each do |signal|\n @root = XMLParse::delete_Port(@root,\"test\",signal)\n end\n# p XMLParse::get_PortList(@root_org,\"test\").keys\n# XMLParse::save(@root_org,\"mod.xml\")\n# `XMLtoVerilog mod.xml > tp/mod.v`\n# exit\n \n diff = port_diff(@root_org,@root,\"test\")\n revised = Array.new\n diff.each do |signal|\n revised << signal.Name\n end\n assert_equal(golden,revised)\n end", "def destroy\n @crop_definition = CropDefinition.find(params[:id])\n @crop_definition.destroy\n\n respond_to do |format|\n flash[:success] = 'Crop definition was successfully deleted.'\n format.html { redirect_to(admin_crop_definitions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @click_data.destroy\n\n head :no_content\n end", "def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteFlatpackAds( flatpack_id, adblock, serpAds, serpAdsBottom, bdpAds)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n params['adblock'] = adblock\n params['serpAds'] = serpAds\n params['serpAdsBottom'] = serpAdsBottom\n params['bdpAds'] = bdpAds\n return doCurl(\"delete\",\"/flatpack/ads\",params)\n end", "def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stores_url) }\n format.xml { head :ok }\n end\n end", "def deletinfo\n SiteInfo.find(params[:id]).destroy\n redirect_to \"/admin\"\n end", "def destroy\n # set_chef\n @chef.destroy\n redirect_to chefs_path\n end" ]
[ "0.66161394", "0.6483721", "0.6431325", "0.64098597", "0.6353968", "0.6326145", "0.61060643", "0.6058511", "0.60335845", "0.60222405", "0.59469676", "0.59414166", "0.59278786", "0.59043276", "0.5904092", "0.5876605", "0.5857822", "0.5848203", "0.58439285", "0.5841582", "0.57874584", "0.57638955", "0.5721338", "0.5720828", "0.5702443", "0.57009155", "0.5683366", "0.5665044", "0.5661767", "0.5658326", "0.5658283", "0.565754", "0.56554013", "0.5651655", "0.5642913", "0.56417", "0.5636068", "0.56313115", "0.56258714", "0.5613337", "0.5613337", "0.5613337", "0.5613337", "0.5610186", "0.56028193", "0.55997217", "0.5595454", "0.55880207", "0.5587369", "0.55847746", "0.55834657", "0.5567149", "0.55638564", "0.5561643", "0.55590236", "0.5555273", "0.5555273", "0.5549956", "0.5546909", "0.5531543", "0.55289114", "0.5528424", "0.5528424", "0.55279726", "0.5526023", "0.5509807", "0.55066186", "0.54989433", "0.54956335", "0.54940253", "0.5492563", "0.5492246", "0.5492049", "0.54890287", "0.54882276", "0.54853237", "0.5482869", "0.5480833", "0.5476551", "0.54758775", "0.5474852", "0.547205", "0.54662037", "0.54653424", "0.546485", "0.54636806", "0.5459588", "0.545655", "0.5456509", "0.54549146", "0.54524124", "0.5451573", "0.5451495", "0.54506", "0.5449794", "0.5447613", "0.544513", "0.5444882", "0.54426897", "0.54397357" ]
0.7286688
0
called by insurance_billing/sidebar_right also called by _patient_claim partial sums the eob payments
def ins_billing_eob_payments(billing) payment = 0 billing.eobs.each do |eob| payment += eob.payment_amount end return payment end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_payment_amount\n sum = 0.00\n unless self.insurance_payment_eobs.blank?\n self.insurance_payment_eobs.each do |eob|\n (sum = sum + eob.total_amount_paid_for_claim) unless eob.total_amount_paid_for_claim.nil?\n end\n end\n sum\n end", "def total_paid\n payments.collect{|i| i.total_amount or i.calculate_total_amount}.sum + credit_notes.collect{|i| i.total_amount or i.calculate_total_amount}.sum\n end", "def total_payments\n\t\tammortization * 12\n\tend", "def second_payment_sum\n total_sum - first_payment_sum\n end", "def generate_total_billing\n total = 0\n self.ur_invoices.each do |ur_invoice|\n total += ur_invoice.final_total\n end\n\n self.invoice_items.each do |invoice_item|\n total += invoice_item.charges\n end\n\n total\n end", "def test_payment_amount_for_output_with_sum_of_interest_and_payment\n eob = insurance_payment_eobs(:eob_57)\n facility = facilities(:facility_94)\n facility_output_config = facility_output_configs(:facility_config_226)\n total_payment_amount_for_output = eob.payment_amount_for_output(facility, facility_output_config)\n assert_equal(total_payment_amount_for_output, 48.00)\n end", "def calculate_total\n sub_total = 0\n\n if size\n sub_total += Config.booths[size][:price]\n end\n\n self.add_ons.each do |add_on|\n sub_total += add_on.total\n end\n sub_total += industries.length * 35000\n sub_total += fees.pluck(:amount).reduce(0, &:+)\n\n self.total = sub_total\n self.balance = total - payments.paid.map(&:amount_paid).reduce(0, &:+)\n self\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n \n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total + gift_packaging_total\n end", "def sum_835_amount (opt=true)\n net_835_amt = 0\n if @client.name.upcase == \"GOODMAN CAMPBELL\"\n @checks.each do |check|\n total_835_amt = 0\n get_gcbs_insurance_eobs(check)\n total_835_amt = complete_check_amount_condition ? check.check_amount.to_f : check.eob_amount_calculated(@eobs, @nextgen_insurance)\n net_835_amt += total_835_amt.to_f\n end\n else\n @checks.each do |check|\n total_835_amt = 0\n insurance_payment_eobs = check.insurance_payment_eobs\n patient_pay_eobs = check.patient_pay_eobs\n unless insurance_payment_eobs.blank?\n insurance_payment_eobs.each do |ins_pay_eob|\n total_835_amt += ins_pay_eob.total_amount_paid_for_claim.to_f\n total_835_amt += ins_pay_eob.late_filing_charge.to_f\n if facility.details[:interest_in_service_line].blank?\n total_835_amt += ins_pay_eob.claim_interest.to_f\n end\n end\n end\n unless patient_pay_eobs.blank?\n patient_pay_eobs.each do |pat_pay_eob|\n total_835_amt += pat_pay_eob.stub_amount.to_f\n end\n end\n unless config.content_layout.downcase == \"eob\"\n total_835_amt += check.provider_adjustment_amount.to_f\n end\n if !check.job.provider_adjustments.blank? && config.content_layout.downcase == \"eob\" &&\n config.print_plb == \"print plb\"\n total_835_amt += check.job.provider_adjustments.sum('amount').to_f\n end\n net_835_amt += total_835_amt.to_f\n end\n end\n @total_835_amount = @total_835_amount + net_835_amt if opt\n sprintf(\"%.2f\", net_835_amt) \n end", "def total_paid_amount(facility)\n eobs = InsurancePaymentEob.select(\"SUM(total_amount_paid_for_claim) AS total_payment, \\\n SUM(claim_interest) AS total_interest, \\\n SUM(late_filing_charge) AS total_filing_charge, \\\n SUM(fund) AS total_fund, \\\n SUM(over_payment_recovery) AS total_over_payment_recovery\").\n where(\"check_information_id = #{id}\")\n eob = eobs.first if !eobs.blank?\n if !eob.blank?\n total_over_payment_recovery = facility.details[:over_payment_recovery] ? eob.total_over_payment_recovery : 0\n payment_amount = eob.total_payment.to_f\n net_payment_amount = payment_amount.to_f - total_over_payment_recovery.to_f\n total_paid_amount = net_payment_amount.to_f + eob.total_filing_charge.to_f + eob.total_fund.to_f\n if !facility.details[:interest_in_service_line]\n total_paid_amount += eob.total_interest.to_f\n end\n else\n total_paid_amount = PatientPayEob.where(\"check_information_id = #{id}\").sum('stub_amount')\n end\n job_ids = job.job_ids_for_check\n if !job_ids.blank?\n total_provider_amount = ProviderAdjustment.where(\"job_id in (#{job_ids.join(',')})\").sum('amount')\n end\n total_paid_amount += total_provider_amount.to_f\n total_paid_amount.to_f.round(2)\n end", "def total_sum\n sum = if @payment.respond_to?(:total_sum)\n # use this first, because once the owner has set a specific sum\n # that becomes the final sum to be payed\n @payment.total_sum\n elsif @cart.total_sum\n # if owner has not yet set final sum, see if a cart has been\n # allready saved and use that to calculate\n @cart.total_sum\n else\n # while a transaction and it's cart still has not been stored in\n # db calculate the sum on the fly\n sum = @transaction.unit_price * @transaction.listing_quantity\n sum += @cart.cart_sum if @cart\n sum\n end\n end", "def claim_payment_amount(*options)\n @eob.amount('total_amount_paid_for_claim')\n end", "def total_pay\n total = 0\n @serie_items.each do |item|\n # next if item.quantity.nil?\n total += item.quantity * item.creation.price\n end\n return total\n end", "def pay_targeted_invoices_first!\n payments.each do |pm|\n if pm.invoice\n @remaining_amounts[pm.invoice.fy_year] ||= Hash.new(0)\n if pm.invoice.canceled?\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount\n else\n paid_amount = [[pm.amount, pm.invoice.missing_amount].min, 0].max\n pm.invoice.increment!(:paid_amount, paid_amount)\n @remaining_amounts[pm.invoice.fy_year][pm.invoice.object_type] += pm.amount - paid_amount\n end\n else\n @remaining_amount += pm.amount\n end\n end\n end", "def sum_payments\n contracts.sum{ |c| c.payments.sum(&:amount)}\n end", "def total_payments\n total = 0\n payments.each{|payment| total += payment.amount}\n total\n end", "def paid_total\n paid_total = 0\n unless self.payments.blank?\n for payment in self.payments\n paid_total += payment.amount.blank? ? 0 : payment.amount\n end\n end\n return paid_total\n end", "def subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:debt)\n end", "def billing_amount\n self.net_amount + self.taxes_amount\n end", "def billing_amount\n self.net_amount + self.taxes_amount\n end", "def total_payout\n # make sure we have rep_parent\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n \n # multiply complete * reward and expired * penalty\n payout = node.repititions.\n where(:state => Activity::COMPLETE).size * node.reward\n payout = payout -\n node.repititions.\n where(:state => Activity::EXPIRED).size *\n node.penalty\n return payout + child_payout\n \n end", "def total_paid\n self.user_expenses.reduce(0) { |sum, user_expense| user_expense.paid + sum }\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n \n self.item_total = order_items.map(&:amount).sum\n self.billing_total = order_items.map(&:cost).sum\n self.customer_total = item_total\n self.full_total = order_items.map(&:full).sum\n end", "def total_amount\n \t amount = 0\n \t operation_items.each do | oi |\n \t\tamount = amount + oi.amount\n end\n amount\n end", "def total_expenses\n binding.pry\n self.total_rent + self.total_pay\n end", "def calculate_invoice_total\n res = [ ]\n self.line_items.each do |item|\n res.push(item.qty * item.price)\n end\n # Return the sum of the items\n self.total = res.inject(:+) \n end", "def expense_total_by_party party, invoiced=nil, document_id=nil\n expense_subtotal_by_party(party, invoiced, document_id) + expense_general_tax_by_party(party, invoiced, document_id) + expense_after_subtotal_by_party(party, invoiced, document_id)\n end", "def calculate\n=begin\n self.net_amount = nil\n self.tax_amount = nil\n self.gross_amount = nil\n=end\n self.total\n end", "def total_item\n @items.reject {|item| item.quantity == 0}\n invoice_total = @items.sum {|item| item.sale_price * item.quantity}\n\n end", "def total_payment\r\n checks.inject(0.00){|sum, check| sum += check.check_amount.to_f}\r\n end", "def calc_total\n (@total_after_tax * @gratuity) + @total_after_tax\n end", "def total\n total_invoice_items_price(invoice_items)\n end", "def payment_amount\n convert_email_to_user && save\n return override_cost if override_cost.present?\n\n event&.get_cost(member: user&.present?)\n end", "def calculate_totals\n subtotal_collector = 0\n active_contracts.each do |active_contract|\n subtotal_collector += active_contract.subtotal\n end\n\n self.subtotal = subtotal_collector\n self.tax = subtotal * 0.09\n self.total = subtotal + tax\n save\n end", "def claim_payment_loop\n claim_payment_segments = []\n service_eob = nil\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n eob.service_payment_eobs.collect{|service| service_eob=service if service.adjustment_line_is?}\n if !service_eob.blank?\n cas_segments, @clp_pr_amount = Output835.cas_adjustment_segments(service_eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << claim_interest_information_bac # _bac methods are used for dynamic output section it will be bypassed for non_banks\n if claim_level_eob?\n cas_segments, @clp_05_amount = Output835.cas_adjustment_segments(eob,\n client, facility, payer, @element_seperator)\n claim_payment_segments << cas_segments\n end \n claim_payment_segments << patient_name\n claim_payment_segments << reference_identification_qualifier_bac\n claim_payment_segments << reference_identification_bac if !@reason_codes.blank?\n unless eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier_bac\n claim_payment_segments << reference_id_bac\n claim_payment_segments << image_page_name_bac\n claim_payment_segments << other_claim_related_id\n claim_payment_segments = claim_payment_segments.compact\n claim_payment_segments unless claim_payment_segments.blank?\n end", "def recalc_totals_from_db!\n self.subtotal = self.time_entries.sum(:total_amount) + self.expense_entries.sum(:total_amount)\n self.paid = self.payment_allocates.sum(:amount)\n self.save!\n end", "def amount_owed\n invoice_total - total_amount_paid\n end", "def final_bill\n total + tax + @tip_amount\n end", "def set_amounts\n super\n self.paid_amount = 0\n payments.each do |payment|\n self.paid_amount += payment.amount\n end\n end", "def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n self.adjustment_total = adjustments.eligible.map(&:amount).sum\n self.total = item_total + adjustment_total\n end", "def amount\n estimate_total = self.estimate_line_items.sum(:amount)\n if self.tax_inclusive? \n tax_total = 0 \n else\n tax_total = 0 \n tax_line_items.each do |line_item|\n tax_account = line_item.account\n next if (tax_account.accountable_type=='DutiesAndTaxesAccounts' && tax_account.accountable.calculation_method==4 && tax_account.accountable.split_tax == 0) \n tax_total += line_item.amount\n end\n end\n ship_charge = self.shipping_line_items.sum(:amount)\n estimate_total + tax_total + ship_charge\n end", "def actual_income\n outgoing_invoices.where(:status => \"deposited\").inject(0) do |mem, invoice|\n mem += invoice.amount\n end # inject invoice\n end", "def sum_attorney_fees\n (invoice_lines.sum(:total_attorney_fee)).round(2)\n end", "def current_subtotal\n debt_claim_items.reject(&:marked_for_destruction?).sum(&:current_debt)\n end", "def value_paid\n self.sale.bitcoin_payments.select{|x| x.confirmations >= 6}.map{|x| x['value']}.sum\n end", "def total_payments\n Payment.total_for_tenant(self)\n end", "def amount_available\n # puts \"------------ A boo at InvoiceAllocations -------------------------\"\n # InvoiceAllocation.all.each { |ia|\n # puts \"id: #{ia.id} cf0925_id: #{ia.cf0925_id} invoice_id: #{ia.invoice_id} cf0925_type: #{ia.cf0925_type} amount: #{ia.amount}\"\n #\n # }\n # puts \"-------------------------------------------------------------------\"\n res = requested_amount - cf0925\n .invoice_allocations\n .select { |ia| ia.cf0925_type == cf0925_type && ia.amount }\n .sum(&:amount)\n # puts \"!!!!!invoice_allocation.rb:#{__LINE__} - amount_available: #{res} cf0925.id #{cf0925.id} amount: #{amount}\"\n # puts \"invoice_allocation.id: #{id}\"\n # puts \"-------------------------------------------------------------------\"\n # puts \"This: id: #{id} cf0925_id: #{cf0925_id} invoice_id: #{invoice_id} cf0925_type: #{cf0925_type} amount: #{amount}\"\n # puts \"-------------------------------------------------------------------\"\n # puts cf0925.invoice_allocations.inspect\n # puts \"-------------------------------------------------------------------\"\n # partb = cf0925\n # .invoice_allocations\n # .select { |ia| ia.cf0925_type == cf0925_type && ia.amount }\n # .sum(&:amount)\n #\n # puts \"requested_amount: #{requested_amount} partb: #{partb}\"\n # puts \"-------------------------------------------------------------------\"\n # cf0925.invoice_allocations.each { |ia|\n # yeah = false\n # if (ia.cf0925_type == cf0925_type && amount)\n # yeah = true\n # end\n # yeah1 = false\n # if (ia.cf0925_type == cf0925_type)\n # yeah1 = true\n # end\n # yeah2 = false\n # if (amount)\n # yeah2 = true\n # end\n # puts \"Line #{__LINE__}: amount: #{ia.amount} cf0925_type #{cf0925_type} true?: #{yeah} part1?: #{yeah1} part2?: #{yeah2} class: #{amount.class}\"\n #\n # }\n # puts \"-------------------------------------------------------------------\"\n res\n end", "def total_fee\n fee + fee2 + fee3 + fee4\n end", "def get_total_apply_amount\n total=0\n if self.doc_type==1\n total+= amount_for :borrow_doc_details\n end\n if doc_type==2\n total+= amount_for :pay_doc_details\n end\n if doc_type==3\n total+= amount_for :rec_notice_details\n end\n if doc_type==4 and inner_remittance!=nil\n total=inner_remittance.amount || 0\n end\n if doc_type==5 and inner_transfer !=nil\n total=inner_transfer.amount || 0\n end\n if doc_type==6 and inner_cash_draw!=nil\n inner_cash_draw.cash_draw_items.each do |c_item|\n next if c_item.apply_amount==nil or c_item.marked_for_destruction?\n total+=c_item.apply_amount\n end\n end\n if doc_type==7 and buy_finance_product!=nil\n total=buy_finance_product.amount\n end\n if doc_type==8 and redeem_finance_product!=nil\n total=redeem_finance_product.amount\n end\n if doc_type==9\n %w(rd_travels rd_transports rd_lodgings other_riems).each do |rd|\n total+=amount_for rd \n end\n end\n if doc_type==10\n total+=amount_for :rd_communicates\n end\n if doc_type==11\n %w(rd_extra_work_cars rd_extra_work_meals).each do |rd|\n total+=amount_for rd\n end\n end\n if doc_type==12\n %w(rd_common_transports rd_work_meals common_riems).each do |rd|\n total+=amount_for rd\n end\n end\n if doc_type==13\n total+= amount_for :rd_benefits\n end\n if doc_type==14\n # todo\n # total+=amount_for :fixed_properties\n end\n total\n end", "def payment_method_sums\n sums = Hash.new\n self.payment_methods.each do |pm|\n s = pm.internal_type.to_sym\n next if s.nil?\n sums[s] = 0 if sums[s].nil?\n pm.amount = 0 if pm.amount.nil?\n sums[s] += pm.amount\n end\n log_action \"payment_method_sums #{sums.inspect}\"\n return sums\n end", "def total_value\r\n return 0 if self.value.nil?\r\n self.value + self.expenses.includes(:expense).map{ |e|\r\n (e.quantity || 0) * (e.expense.signed_price || 0)\r\n }.sum\r\n end", "def revenue_total_by_party party, invoiced=nil, document_id=nil\n revenue_subtotal_by_party(party, invoiced, document_id) + revenue_general_tax_by_party(party, invoiced, document_id) + revenue_after_subtotal_by_party(party, invoiced, document_id)\n end", "def total_to_be_disbursed_savings\n member_id_list = self.preserved_active_group_loan_memberships.map{|x| x.member_id }\n \n SavingBook.where(:member_id => member_id_list).sum(\"total_extra_savings\")\n end", "def paid_sum\n paid = Money.new(0, 'USD')\n paid += @paid_splits.inject(Money.new(0, 'USD')){ |memo, split| memo + split.sum } if @paid_splits.present?\n paid\n end", "def expense_after_subtotal_by_party party, invoiced=nil, document_id=nil\n sub_total = expense_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum -= li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum += li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n end\n\n end\n accum\n end", "def amount_payment_outstanding\n capital_required - amount_payment_collected\n end", "def order_expenses\n total_expenses_per_subsection = {}\n total_expenses_per_subsection.default = 0.0\n details = self.order_details\n details.each do |detail|\n total_expenses_per_subsection[detail.subsection] += detail.last_value.amount\n end\n total_expenses_per_subsection\n end", "def total_copay_amount\n sum = self.insurance_payment_eobs.sum(:total_co_pay)\n sum.to_f\n end", "def invoice_total\n self.invoices.sum(:total).to_f\n end", "def invoice_total\n self.invoices.sum(:total).to_f\n end", "def pay_remaining_amounts_to_same_object_type_invoices!\n @remaining_amounts.each do |year, type_amounts|\n type_amounts.each do |object_type, rem_amount|\n invoices.before_or_during_year(year).where(object_type: object_type).each do |invoice|\n if invoice.missing_amount.positive? && rem_amount.positive?\n paid_amount = [rem_amount, invoice.missing_amount].min\n invoice.increment!(:paid_amount, paid_amount)\n rem_amount -= paid_amount\n end\n invoice.reload.close_or_open!\n end\n @remaining_amount += rem_amount\n end\n end\n end", "def create\n @invoice = Invoice.find(params[:invoice_id])\n @payment = Payment.new(payment_params)\n respond_to do |format|\n if @invoice.payments << @payment\n total = @invoice.payments.sum(\"price\")\n if total == @invoice.total || total > @invoice.total\n res = total - @invoice.total if total > @invoice.total\n @invoice.member.update_attributes(payment_add: res)\n @invoice.update_attributes(status: 2)\n end\n format.html { redirect_to @invoice, notice: 'Payment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @payment }\n else\n format.html { render action: 'new' }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_total\n counts = convert_to_hash(@item_list)\n uniq_items = @item_list.uniq\n\n final = (@total - @sale.apply(uniq_items, counts)).round(2) # Used round for precision\n puts get_invoice + final.to_s\n final\n end", "def claim_payment_loop\n claim_payment_segments = []\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n claim_payment_segments << quantity\n service_eob = @services.detect{|service| service.adjustment_line_is? }\n if service_eob\n cas_segments, @clp_pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(service_eob,\n @client, @facility, @payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n if @is_claim_eob\n cas_segments, @clp_05_amount, crosswalked_codes = Output835.cas_adjustment_segments(@eob,\n @client, @facility, @payer, @element_seperator)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << service_prov_identifier\n if @is_claim_eob\n claim_payment_segments << Output835.claim_level_remark_code_segments(@eob, @element_seperator, crosswalked_codes)\n end\n claim_payment_segments << image_page_name\n claim_payment_segments << medical_record_number\n claim_payment_segments << other_claim_related_id\n claim_payment_segments.compact\n end", "def total_payout\n # make sure we have rep_parent\n node = self.get_rep_parent\n \n # get total payout of children\n child_payout = 0\n node.children.each do |child|\n child_payout = child_payout + child.total_payout\n end\n\n # if no week requirement then number reward - penalty\n if node.is_infinite?\n rewards = node.get_weeks_complete\n penalties = node.get_weeks_expired\n return (rewards * node.reward) - (penalties * node.penalty) + child_payout\n end\n\n # if COMPLETE add reward, if EXPIRED subtract penalty\n if node.state == Activity::COMPLETE\n return child_payout + node.reward\n elsif node.state ==Activity::EXPIRED\n reuturn child_payout - node.penalty\n else\n return child_payout\n end\n end", "def total_price\n total = total_price_without_installments\n if promotions.any?\n adjustment = adjustments.eligible.map(&:amount).sum\n\n (total += adjustment).to_f\n end\n if line_items.any? { |li| li.request_installments == true }\n total = total / 5\n end\n total\n end", "def total_pay\n total_pay = self.employees.map do |employee|\n employee.pay\n end\n total_pay.inject(:+)\n end", "def claim_payment_loop\n claim_payment_segments = []\n @clp_pr_amount = nil\n claim_payment_segments << claim_payment_information\n service_eob = @services.detect{|service| service.adjustment_line_is? }\n if service_eob\n cas_segments, @clp_pr_amount, crosswalked_codes = Output835.cas_adjustment_segments(service_eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n if @is_claim_eob\n cas_segments, @clp_05_amount, crosswalked_codes = Output835.cas_adjustment_segments(@eob,\n @client, @facility, @payer, @element_seperator, @eob, @batch, @check)\n claim_payment_segments << cas_segments\n end\n claim_payment_segments << patient_name\n unless @eob.pt_name_eql_sub_name?\n claim_payment_segments << insured_name\n end\n claim_payment_segments << service_prov_name\n claim_payment_segments << service_prov_identifier\n if @is_claim_eob\n claim_payment_segments << Output835.claim_level_remark_code_segments(@eob, @element_seperator, crosswalked_codes)\n end\n claim_payment_segments << image_page_name\n claim_payment_segments << medical_record_number\n claim_payment_segments << claim_uid if @client_name == \"QUADAX\"\n claim_payment_segments << other_claim_related_id\n claim_payment_segments.compact\n end", "def all_expense_items\n owing_expense_items + paid_expense_items\n end", "def index\n @payments = Payment.all\n \n @unit = current_user.unit\n \n @utility = UtilityCharge.all\n \n @utility_charge = current_user.unit.present? ? current_user.unit.latest_utility_charge : 0\n \n #Find the next month due from the paid_rents Table\n @paid_rent = PaidRent.all\n last_unpaid_rent_for_unit = PaidRent.where(paid: false, unit_id: @unit).first\n @current_due_date = last_unpaid_rent_for_unit.present? ? last_unpaid_rent_for_unit.date_due : nil\n \n #determine if security deposit has been paid and assign it a variable for use in the view \n @security_amount = current_user.unit.present? ? @unit.security_charge : 0\n \n end", "def payment_adjustment\n @payment_adjustment ||= 0\n end", "def booking_amount\n self.charges.booking.inject(0){|sum, charge| sum + charge.amount}\n end", "def revenue_after_subtotal_by_party party, invoiced=nil, document_id=nil\n sub_total = revenue_subtotal_by_party(party)\n accum = Money.new(0)\n\n filter_invoiced(line_items, invoiced, document_id).each do |li|\n if li.after_subtotal\n\n if li.billable_party == party\n accum += li.percentage_of_subtotal ? li.revenue_total_with_percentage(sub_total) : li.revenue_total\n end\n\n if li.payable_party == party\n accum -= li.percentage_of_subtotal ? li.expense_total_with_percentage(sub_total) : li.expense_total\n end\n\n end\n\n end\n accum\n end", "def total_raised\n payments.inject(0) { |sum, p| sum + p.amount.to_f }\n end", "def test_credit_note_sub_total_calculation2\n credit_note = create_test_credit_note\n line_item = credit_note.line_items.first\n\n # Make sure that everything adds up to begin with.\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n\n # Change the tax_amount of the first line item and make sure that\n # everything still continues to add up.\n line_item.tax_amount = line_item.tax_amount + 10\n assert_not_equal(expected_total_tax, credit_note.total_tax)\n expected_total_tax = credit_note.line_items.inject(BigDecimal('0')) { | sum, l | l.tax_amount }\n assert_equal(expected_total_tax, credit_note.total_tax)\n end", "def subtotal\n order_items.collect{|order_item| order_item.valid? ? order_item.price.to_d * order_item.quantity.to_i : 0}.sum\n end", "def paid_principal(amortization=self.amortization, duration=self.holding_period_mth)\n total_payment = -amortization.payments[0...duration].sum\n total_interest = amortization.interest[0...duration].sum\n\n total_payment - total_interest\n end", "def final_price\n base_markup_price + add_markup_person + add_markup_materials\n end", "def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end", "def subtotal\n order_items.collect { |oi| oi.valid? ? (oi.quantity * oi.unit_price) : 0 }.sum\n end", "def other_business_expenses\n return forms(\"Unreimbursed Partnership Expense\") { |f|\n f.line[:ssn] == @ho_form.line[:ssn]\n }.lines(:amount, :sum)\n end", "def get_total_expense\n\t\tbills.pluck(:amount).inject(:+) rescue 0\n\tend", "def total_unpaid_visits\n next_cutoff_date = Claim.order(date_paid: :desc).limit(1).pluck(:date_paid).first + 3.days rescue Date.today \n prev_cutoff_date = next_cutoff_date - 45.days \n @total_unpaid = Visit.where(status: BILLED).where(\"entry_ts > ?\", prev_cutoff_date).where(\"entry_ts <?\", next_cutoff_date).sum{|v| v.total_fee}\n flash[:info] = \"Current total of billed claims for all doctors for period ending #{next_cutoff_date} is: #{ sprintf \"$%.0f\", @total_unpaid}\"\n end", "def calculate_total_payment\n\t\tif self.total_amount.blank?\n\t\t\tbalance = 0\n\t\telse\n\t\t\tbalance = (self.total_amount + self.penalty) - paid_total\n\t\tend\n\n\t\tif balance <= 0\n return 0\n else\n return balance\n end\n\tend", "def paid_quantity\n map(&:paid_quantity).sum\n end", "def investment_return_from_ownership\n @initial_costs = {}\n @recuring_costs = {}\n @closing_costs = {}\n @home_appreciation = {}\n @costs_compare_sum = {}\n\n @rent_security_deposit = (@home_price/(12*@price_to_rent_ratio))*-1\n @costs_of_buying_house = {}\n @costs_of_buying_house[:rent] = (@home_price/(12*@price_to_rent_ratio)*0.25)*-1\n @costs_of_buying_house[:buy] = (@home_price*0.02467)*-1\n\n @initial_costs[:rent] = (@home_price/(12*@price_to_rent_ratio))*-1 + (@home_price/(12*@price_to_rent_ratio)*0.25)*-1\n @initial_costs[:buy] = @down_payment*-1 + (@home_price*0.02467)*-1\n\n @recuring_costs[:rent] = (@home_price/@price_to_rent_ratio*@mortgage_term*(1+0.025)**@mortgage_term+@home_price/@price_to_rent_ratio*@mortgage_term*0.0132)*-1\n @recuring_costs[:buy] =\n ((@monthly_exp_breakdown[:mortgage_principal][:total] + @monthly_exp_breakdown[:mortgage_interest][:total])*-1) + (@monthly_exp_breakdown[:property_tax][:total]*-1) + (@monthly_exp_breakdown[:home_insurance][:total]*-1) + (@monthly_exp_breakdown[:pmi_insurance][:total]*-1) + ((((1+0.054/12)**@number_of_payments-1)*@down_payment)*-1)\n\n @total_monthly_rents = (@home_price/@price_to_rent_ratio*@mortgage_term*(1+0.025)**@mortgage_term)\n @mortgage_payments = (@monthly_exp_breakdown[:mortgage_principal][:total] + @monthly_exp_breakdown[:mortgage_interest][:total])*-1\n @renter_insurance = (@home_price/@price_to_rent_ratio*@mortgage_term*0.0132)*-1\n @returns_for_investment = ((((1+0.054/12)**@number_of_payments-1)*@down_payment)*-1)\n\n @closing_costs[:rent] = 0.0\n @closing_costs[:buy] = (@home_price*0.03)*-1\n\n @home_appreciation[:rent] = @initial_costs[:rent]*-1\n @home_appreciation[:buy] = @home_price*(1.054)**@mortgage_term*0.85\n\n @costs_compare_sum[:rent] =(@initial_costs[:rent] + @recuring_costs[:rent] + @closing_costs[:rent] + @home_appreciation[:rent])\n @costs_compare_sum[:buy] = @initial_costs[:buy] + @recuring_costs[:buy] + @closing_costs[:buy] + @home_appreciation[:buy]\n\n if (@calculate_loan_payment<=750000)\n @mortgage_interest_deduction = (@calculate_monthly_payment*@number_of_payments-@calculate_loan_payment)/@mortgage_term\n else\n @mortgage_interest_deduction = ((@calculate_monthly_payment*@number_of_payments-@calculate_loan_payment)/@mortgage_term)*750000/@calculate_loan_payment\n end\n\n if (@costs_compare_sum[:buy].abs <=0)\n @costs_compare_sum[:benifit] = \"Buying is better than renting even if you could rent for free! In addition, you can save average #{ ActionController::Base.helpers.number_to_currency(@mortgage_interest_deduction.round(2)) } per year from your federal taxable income. Increase your profit by visiting our <a href='JavaScript:void(0);'>mortgage rates</a> and getting a more favorable mortgages.\"\n else\n if (@costs_compare_sum[:buy].abs >0 && @costs_compare_sum[:rent].abs > @costs_compare_sum[:buy].abs)\n @costs_compare_sum[:benifit] = \"Buying is cheaper than renting! You’ll earn an extra #{ActionController::Base.helpers.number_to_currency(((@costs_compare_sum[:buy] - @costs_compare_sum[:rent]).round(2)))} after #{@mortgage_term} years of buying a house. In addition, you can save average #{ActionController::Base.helpers.number_to_currency(@mortgage_interest_deduction.round(2))} per year from your federal taxable income. If you lower your mortgage interest rate, you could save more! Come to visit our <a href='JavaScript:void(0);'>mortgage rates</a> and find other favorable mortgages.\"\n else\n if (@costs_compare_sum[:buy].abs >0 && @costs_compare_sum[:rent].abs == @costs_compare_sum[:buy].abs )\n @costs_compare_sum[:benifit] = \"The cost of buying a house is about the same as renting a house for #{@mortgage_term} years! However, you could save more through lowering your mortgage interest rate. Come to visit our <a href='JavaScript:void(0);'>mortgage rates</a> to get more favorable mortgages.\"\n else\n @costs_compare_sum[:benifit] = \"You'd better to rent a house instead pf buying. Or you could lower your mortgage interest rate to save the cost of buying. Come to visit our <a href='JavaScript:void(0);'>mortgage rates</a> to get more favorable mortgages.\"\n end\n end\n end\n end", "def get_grand_total_one_month\n\t$pokitdok_call.each do |drug|\n\t$total_cost << drug['retail']['total_cost_30_day']['amount'].to_f\n\tend\n\t\n\tsum_total_cost = $total_cost.inject(:+)\nend", "def calculate_totals\n totals = {}\n if self.amount_due.nil?\n total = 0.00\n order_products.each do |order_product|\n price = order_product.unit_price\n price = order_product.product.price if price.nil?\n total = total + (price * order_product.quantity)\n end\n totals[:product_total] = total\n totals[:tax] = total * 0.055\n totals[:amount_due] = total + totals[:tax]\n else\n totals[:product_total] = self.product_total\n totals[:tax] = self.tax\n totals[:amount_due] = self.amount_due\n end\n return totals\n end", "def update_defaultee_savings_deduction\n default_payment = self.default_payment \n total_compulsory_savings = self.total_compulsory_savings\n total_voluntary_savings = self.total_voluntary_savings\n total_deductible_member_savings = total_compulsory_savings + total_extra_savings\n \n # refresh the state \n default_payment.compulsory_savings_deduction_amount = BigDecimal(\"0\")\n default_payment.voluntary_savings_deduction_amount = BigDecimal(\"0\")\n default_payment.amount_to_be_shared_with_non_defaultee = BigDecimal(\"0\")\n \n total_amount = default_payment.outstanding_grace_period_amount \n \n if total_amount <= total_compulsory_savings\n default_payment.compulsory_savings_deduction_amount = total_amount \n elsif total_amount > total_compulsory_savings && total_amount <= total_deductible_member_savings \n default_payment.amount_of_compulsory_savings_deduction = total_compulsory_savings \n default_payment.voluntary_savings_deduction_amount = total_amount - total_compulsory_savings\n elsif total_amount > total_deductible_member_savings \n default_payment.compulsory_savings_deduction_amount = total_compulsory_savings \n default_payment.voluntary_savings_deduction_amount = total_extra_savings\n default_payment.amount_to_be_shared_with_non_defaultee = total_amount - total_deductible_member_savings\n end \n \n default_payment.save\n end", "def fees(period = (Time.now.beginning_of_month - 1).beginning_of_month .. (Time.now.beginning_of_month - 1).end_of_month)\n subscription_payments.all(:conditions => { :created_at => period }).collect(&:affiliate_amount).sum \n end", "def total_payout\n # calculate children payout\n count = 0\n self.children.each do |child|\n count = count + child.total_payout\n end\n \n # calculate payout of this ativity\n if self.state == COMPLETE\n return count + self.reward\n elsif self.state == EXPIRED\n return count - self.penalty\n else \n return count\n end\n\n end", "def calculate_payment\n x = @periodic_rate * @principal * ((1 + @periodic_rate)**@periods)\n y = ((1 + @periodic_rate)**@periods) - 1\n (x / y).round(2)\n end", "def amount_paid\n accepted_payments.sum(:amount).to_f\n end", "def total(bill)\n sum=0.0\n bill.items.each do |i|\n sum += i.price\n end\n return sum\n end", "def calculate_total\n order_items.sum(:total)\n end", "def total\n total_amount = 0\n @order.each do |product, quantity|\n prod_price = PRODUCTS[product]\n if @pricing_rules.key?(product)\n rule = @pricing_rules[product]\n n = rule[1]\n type = rule[0]\n case type\n when \"Nx1\"\n total_amount += prod_price*( quantity/n + quantity%n )\n when \"BULK\"\n disccount_price = rule[2]\n total_amount += quantity * (quantity < n ? prod_price : disccount_price) #disccount price\n end\n else\n total_amount += prod_price * quantity\n end\n end\n total_amount\n end", "def amount\n self.payout_amount\n end", "def total_affiliate_fee\n total = 0.0\n @lines.each {|line| total += (line.li_aff_fee * line.li_qty) }\n total\n end", "def set_expense_entry_billing_amount\n data=params\n @tne_invoice_expense_entry = TneInvoiceExpenseEntry.find(data[:id])\n @previous_final_billed_amount = @tne_invoice_expense_entry.final_expense_amount\n @tne_invoice_expense_entry.update_attributes({:final_expense_amount => data[:value], :billing_percent => \"\", :billing_method_type => 3})\n @final_expense_amount = @tne_invoice_expense_entry.calculate_final_expense_amount\n end", "def cash\n # Set active_tab to use in view filters\n session[:active_tab] = \"pendings-tab\"\n\n invoice_ids = params[:client_payment][:invoices_ids].split(\",\")\n instalment_ids = params[:client_payment][:ids].split(\",\")\n amount = BigDecimal.new(params[:client_payment][:amount]) rescue 0 # 0 if error beause :amount is null and debt negative\n payment_method = params[:client_payment][:payment_method_id]\n redirect_to client_payments_path + \"#tab_pendings\", alert: I18n.t(\"ag2_gest.client_payments.generate_error_payment\") and return if payment_method.blank?\n # If these are instalments, call cash_instalments & exit\n if !instalment_ids.blank?\n cash_instalments(instalment_ids, amount, payment_method)\n return\n end\n # If these are invoices, go on from here\n client_payment = nil\n invoices = Invoice.find_all_by_id(invoice_ids).sort_by {|a| a[:created_at]}\n created_by = current_user.id if !current_user.nil?\n acu = amount\n # Receipt No.\n receipt_no = receipt_next_no(invoices.first.invoice_no[3..4]) || '0000000000'\n invoices.each do |i|\n if amount > 0\n if acu > 0\n if acu >= i.debt\n amount_paid = i.debt\n acu -= i.debt\n invoice_status = InvoiceStatus::CASH\n else\n amount_paid = acu\n acu = 0\n invoice_status = InvoiceStatus::PENDING\n end\n else\n break\n end # acu > 0\n else\n amount_paid = i.debt\n invoice_status = InvoiceStatus::CASH\n end # amount > 0\n client_payment = ClientPayment.new(receipt_no: receipt_no, payment_type: ClientPayment::CASH, bill_id: i.bill_id, invoice_id: i.id,\n payment_method_id: payment_method, client_id: i.bill.client_id, subscriber_id: i.bill.subscriber_id,\n payment_date: Time.now, confirmation_date: nil, amount: amount_paid, instalment_id: nil,\n client_bank_account_id: nil, charge_account_id: i.charge_account_id, created_by: created_by)\n if client_payment.save\n i.invoice_status_id = invoice_status\n i.save\n end\n end # invoices.each do\n redirect_to client_payments_path + \"#tab_pendings\", notice: (I18n.t('ag2_gest.client_payments.index.cash_ok') + \" #{view_context.link_to I18n.t('ag2_gest.client_payments.index.click_to_print_receipt'), payment_receipt_client_payment_path(client_payment, :format => :pdf), target: '_blank'}\").html_safe\n # redirect_to client_payments_path, notice: \"Recibo/Factura/s traspasados/as a Caja.\"\n rescue\n redirect_to client_payments_path + \"#tab_pendings\", alert: I18n.t('ag2_gest.client_payments.index.cash_error')\n end" ]
[ "0.7652741", "0.67494065", "0.6648929", "0.6575665", "0.6561365", "0.6505679", "0.6489193", "0.64879656", "0.64559513", "0.64511836", "0.6368417", "0.63551235", "0.63456786", "0.633976", "0.63067675", "0.6282871", "0.6269264", "0.6218245", "0.6212941", "0.6212941", "0.6187269", "0.61769825", "0.6174843", "0.61682016", "0.6135822", "0.6131403", "0.61279386", "0.61247194", "0.6122482", "0.6117885", "0.6113462", "0.6109674", "0.6106393", "0.60868746", "0.60807735", "0.6080402", "0.607471", "0.6074315", "0.6051447", "0.60499924", "0.6029424", "0.6010173", "0.6003135", "0.6001005", "0.5997473", "0.59917766", "0.5980948", "0.59796983", "0.5973783", "0.5966717", "0.5944297", "0.59422886", "0.59403175", "0.5936957", "0.5935579", "0.59313655", "0.5926713", "0.5925323", "0.59212697", "0.59212697", "0.5910336", "0.5899416", "0.5892651", "0.58873606", "0.5878932", "0.58760786", "0.5874806", "0.5853922", "0.58515435", "0.5849817", "0.584911", "0.5842135", "0.5840319", "0.5836223", "0.583351", "0.58275366", "0.5808259", "0.5800305", "0.579765", "0.57965595", "0.57946795", "0.57912296", "0.5785377", "0.57809705", "0.57799846", "0.57798296", "0.5777345", "0.57703906", "0.57685727", "0.5766199", "0.5766059", "0.5747312", "0.5740461", "0.57377267", "0.573534", "0.573212", "0.57302874", "0.5728581", "0.5727174", "0.57262874" ]
0.68316364
1
Display the dashboard No special parameters required.
def show @hooks = Hook.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dashboard\r\n end", "def show\n dashboard_4\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard\n end", "def dashboard; end", "def dashboard\n\n end", "def dashboard\n\n end", "def dashboard\n\tend", "def show\n dashboard_4\n end", "def dashboard\n #sendEmailTest('ratinahirana@gmail.com', 'Blou Ratinahirana', 'M03200202', 'Arrivé au centre de dépot')\n load_dashboard(nil, nil)\n\n render 'dashboard'\n end", "def dashboard\n # dashboard.html.erb\n end", "def set_dashboard\n end", "def dashboard\n @title = 'Admin'\n render 'admin/dashboard', :layout => 'layouts/main', :cachable => true\n end", "def dashboard_1\n end", "def dashboard\n self.root\n self.follow('dtime:dashboard')\n self.get\n self\n end", "def show\n render :layout => 'hrmdashboard'\n add_breadcrumb \"Event\"\n end", "def show\n \n end", "def show\n \n end", "def show\n\t end", "def show\n @dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)\n # @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID\n find_params_for_data_dashboard # calls @dashboard params to Application\n \n end", "def dashboard\n __log_activity\n __debug_route\n opt = url_parameters\n fast = opt.key?(:fast) ? true?(opt[:fast]) : Rails.env.test?\n @item, @preferences, @history = get_account_details(fast: fast)\n response.status =\n case flash.now[:alert]\n when '', nil then 200 # OK\n when /already signed in/ then 403 # Forbidden\n else 401 # Unauthorized\n end\n respond_to do |format|\n format.html\n format.json { render_json show_values }\n format.xml { render_xml show_values(nil, as: :array) }\n end\n end", "def dashboard_params\n end", "def show\n\t\t end", "def show\n \t\n end", "def show\n \t\n end", "def show\n render locals: {\n page: Administrate::Page::Show.new(dashboard, requested_resource)\n }\n end", "def show \r\n end", "def show\n render \"dashboards/detail\"\n end", "def show() end", "def show() end", "def show() end", "def dashboard\n 'dashboard'\n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def show\r\n\r\n end", "def show\n content = User.all\n render response: { dashboard: content }\n end", "def show\n\t\t#no need b/c we just show all at once\n\tend", "def show\t\t\t\t\n\t\t\tend", "def show_admin\n screen_name(\"Inicial-Admin\")\n\n distribute_ots\n\n respond_to do |format|\n format.html { render action: \"show_admin\" }\n format.json { head :ok }\n end\n end", "def display\r\n end", "def show\n\t\t\n\tend", "def show\n\t\t\n\tend", "def show\n\t\t\n\tend", "def show\n @summary = {}\n # cash flow info\n @summary[\"cash_flow_domestic\"] = domestic_cash_flow_info\n # sell info\n @summary[\"domestic\"] = domestic_sold_info\n @summary[\"offshore\"] = offshore_sold_info\n # by date\n @summary[\"auction\"] = auction_info\n @summary[\"custom\"] = custom_info\n @summary[\"shipment\"] = shipment_info\n # undeal\n @summary[\"undeal_product\"] = undeal_product_info\n @summary[\"undeal_auction\"] = undeal_auction_info\n @summary[\"undeal_custom\"] = undeal_custom_info\n @summary[\"shipment_status\"] = shipment_status_info\n render 'dashboard'\n end", "def dashboard\n # displays the admin dashboard if current user is admin\n if current_user.is_admin\n # retrieves a list of all users, ordered by username\n @users = User.order(\"username\")\n render :admin_dashboard\n # sold parameter can be toggled on the dashboard to display either sold or unsold listings\n elsif params[:sold]\n @sold = true\n # retrieves a paginated list of all of the users SOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is true\").order(\"created_at desc\").page params[:page]\n else\n @sold = false\n # retrieves a paginated list of all of the users UNSOLD listings, ordered by date posted (descending)\n @listings = current_user.listings.where(\"is_sold is false\").order(\"created_at desc\").page params[:page]\n end\n end", "def dashboard\n service_response = AdminManagement::AdminUser::Dashboard.new(params).perform\n render_api_response(service_response)\n end", "def show\n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def show\n \n end", "def dashboard\n # render :partial =>'dashboard'\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n end", "def show\n \n \n end", "def show\n \n \n end", "def show\n \n \n end" ]
[ "0.7972295", "0.78707045", "0.7781308", "0.7781308", "0.7781308", "0.7781308", "0.7781308", "0.7756131", "0.7733077", "0.7733077", "0.76448286", "0.7567058", "0.7245519", "0.71104765", "0.70144916", "0.6953155", "0.69396025", "0.69349486", "0.6761453", "0.67217267", "0.67217267", "0.67189664", "0.67158073", "0.6670947", "0.66702867", "0.6655015", "0.665122", "0.665122", "0.66478336", "0.664167", "0.66258293", "0.6625676", "0.6625676", "0.6625676", "0.66213", "0.66035587", "0.66035587", "0.66035587", "0.6594861", "0.6588332", "0.65845007", "0.6580305", "0.6580134", "0.6567189", "0.6567189", "0.6567189", "0.6559527", "0.6557599", "0.65526384", "0.6539824", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.65344965", "0.6501076", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64947134", "0.64606905", "0.64606905", "0.64606905" ]
0.0
-1
Simulation for 16Bit ALU and 16Bit Multiplier By Kenneth Willeford This simulation imitates the two titled modules by copying them structurally. This program handles the structuring with more of a functional approach than object oriented. My signals and registers are represented with numbered arrays ie: [0,1,0,0] is the same as 0100 Due to this I made my own shift functions so that they can have the functionality of the shift registers. Just run the code in a ruby interpreter and it will run on it's own, the test cases are already in, you just have to press enter when prompted. ======================================================================= Logic Gates Computes &,|,^,!
def AND(x,y); if x==1 && y==1 then 1 else 0 end; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0])\n\tputs \"press enter to exit the program...\"\n\twait = gets\nend", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def defsignals(asm)\n # Define signals and default values\n\n # ROM 1 (LSB to MSB)\n asm.defsig 'rdGP', Bitstring.new(0)\n asm.defsig 'rdGPAddr', Bitstring.new('00')\n asm.defsig 'rdPC', Bitstring.new(0)\n asm.defsig 'rwMem', Bitstring.new(0)\n asm.defsig 'memDir', Bitstring.new(0) # 0=read, 1=write\n asm.defsig 'driveAddr', Bitstring.new(0)\n asm.defsig 'extRW', Bitstring.new(0) # 1=assert external read/write\n\n # ROM 2 (LSB to MSB)\n asm.defsig 'wrGPLo', Bitstring.new(0)\n asm.defsig 'wrGPHi', Bitstring.new(0)\n asm.defsig 'wrGPAddr', Bitstring.new('00')\n asm.defsig 'wrPCLo', Bitstring.new(0)\n asm.defsig 'wrPCHi', Bitstring.new(0)\n asm.defsig 'unused2', Bitstring.new('00')\n\n # ROM 3 (LSB to MSB)\n asm.defsig 'aluOut', Bitstring.new(0)\n asm.defsig 'pcClk', Bitstring.new(0)\n asm.defsig 'aluOp', Bitstring.new('000000')\n\n # ROM 4 (LSB to MSB)\n asm.defsig '-endIfEq', Bitstring.new(1)\n asm.defsig '-endIfNew', Bitstring.new(1)\n asm.defsig '-endIfNoCarry', Bitstring.new(1)\n asm.defsig 'endIfNeqCarry', Bitstring.new(0)\n asm.defsig 'endIfNeqNoCarry', Bitstring.new(0)\n asm.defsig '-endUncond', Bitstring.new(1)\n asm.defsig 'latchAddr', Bitstring.new(0)\n asm.defsig 'latchCC', Bitstring.new(0)\n\n # Assign indices to signals\n asm.assign_indices\nend", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def run\n inputA = 0\n ampA = Intcode::Computer.new(@program, [@phaseA, inputA])\n outputA = ampA.run\n\n inputB = outputA\n ampB = Intcode::Computer.new(@program, [@phaseB, inputB])\n outputB = ampB.run\n\n inputC = outputB\n ampC = Intcode::Computer.new(@program, [@phaseC, inputC])\n outputC = ampC.run\n\n inputD = outputC\n ampD = Intcode::Computer.new(@program, [@phaseD, inputD])\n outputD = ampD.run\n\n inputE = outputD\n ampE = Intcode::Computer.new(@program, [@phaseE, inputE])\n outputE = ampE.run\n end", "def run(instruction)\n case instruction\n\n # add\n when /add (#{REG}) (#{INT})/\n @registers[$1] += $2.to_i\n when /add (#{REG}) (#{REG})/\n @registers[$1] += @registers[$2]\n\n # jgz\n when /jgz (#{REG}) (#{INT})/\n @ic += $2.to_i - 1 unless @registers[$1] <= 0\n when /jgz (#{INT}) (#{INT})/\n @ic += $2.to_i - 1 unless $1.to_i <= 0\n when /jgz (#{REG}) (#{REG})/\n @ic += @registers[$2] - 1 unless @registers[$1] <= 0\n\n # mod\n when /mod (#{REG}) (#{INT})/\n @registers[$1] %= $2.to_i\n when /mod (#{REG}) (#{REG})/\n @registers[$1] %= @registers[$2]\n\n # mul\n when /mul (#{REG}) (#{INT})/\n @registers[$1] *= $2.to_i\n when /mul (#{REG}) (#{REG})/\n @registers[$1] *= @registers[$2]\n\n # set\n when /set (#{REG}) (#{INT})/\n @registers[$1] = $2.to_i\n when /set (#{REG}) (#{REG})/\n @registers[$1] = @registers[$2]\n\n # snd\n when /snd (#{INT})/\n @parent.send(@target, $1.to_i)\n when /snd (#{REG})/\n @parent.send(@target, @registers[$1])\n\n # rcv\n when /rcv (#{REG})/\n @waiting = true\n @receiver = $1\n when /rcv (#{INT})/\n @waiting = true\n @receiver = $1\n end\n end", "def solve_amp(phase, signal)\n if @feedback\n program = @program\n else\n program = @program.dup\n end\n opcode = 0\n\n while (opcode != @STOP && pointer < program.length) do \n puts \"pointer: #{pointer}\" if @DEBUG\n opcode = program[pointer]\n a = 0\n b = 0\n c = 0\n\n # Check Immeidate Mode\n if(opcode.to_s.length > 2)\n opcode = opcode.to_s\n # need to parse that fancy code\n instruction = opcode[-2..-1].to_i\n puts \"instruction: #{instruction}\\nopcode: #{opcode}\" if @DEBUG\n \n if (opcode.length == 3)\n puts \"length: 3\" if @DEBUG\n c = opcode[0].to_i\n elsif (opcode.length == 4)\n puts \"length: 4\" if @DEBUG\n b = opcode[0].to_i\n c = opcode[1].to_i\n elsif (opcode.length == 5)\n puts \"length: 5\" if @DEBUG\n a = opcode[0].to_i\n b = opcode[1].to_i\n c = opcode[2].to_i\n end\n else\n puts \"opcode only: #{opcode}\" if @DEBUG\n instruction = opcode.to_i\n end\n\n if(instruction == @STOP)\n puts \"STOP\"\n @stopped = true\n break\n end\n\n puts \"a: #{a}\\nb: #{b}\\nc: #{c}\\n\" if @DEBUG\n \n if(instruction == @ADD || instruction == @MULTIPLY)\n position_a = program[pointer + 1].to_i\n position_a = program[position_a].to_i if c == 0\n\n position_b = program[pointer + 2].to_i\n position_b = program[position_b].to_i if b == 0\n\n position_c = program[pointer + 3].to_i #if a == 0\n #position_c = program[pointer + 3].to_i if a == 1\n \n if(instruction == @ADD)\n program[position_c] = position_a + position_b\n elsif(instruction == @MULTIPLY)\n program[position_c] = position_a * position_b\n end\n pointer += 4\n puts \"incrementing pointer by 4\" if @DEBUG\n end\n\n if(instruction == @READ)\n if (c == 0)\n # puts \"\\nSTATUS: #{program[program[pointer + 1].to_i]}\\n\"\n return program[program[pointer + 1].to_i]\n else\n # puts \"\\nSTATUS: #{program[pointer + 1]}\\n\"\n return program[pointer + 1]\n end\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n if(instruction == @STORE)\n #print \"input: \"\n if @input_times == 0\n number = phase\n @input_times += 1\n else\n number = signal\n end\n target = program[pointer + 1].to_i\n program[target] = number.to_i\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n # only two params\n if(instruction == @JUMP_IF_TRUE)\n puts \"Jump if true\" if @DEBUG\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n unless program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # only two params\n if(instruction == @JUMP_IF_FALSE)\n puts \"Jump if false\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n \n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n if program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # four parameters\n if(instruction == @LESS)\n puts \"Less\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n if(program[first].to_i < program[second].to_i)\n program[third] = 1\n else\n program[third] = 0\n end\n\n pointer += 4\n end\n\n if(instruction == @EQUALS)\n puts \"Equals\" if @DEBUG\n\n first = pointer + 1\n first = program[pointer + 1].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n puts \"first: #{program[first]}, second: #{program[second]}\" if @DEBUG\n\n if(program[first].to_i == program[second].to_i)\n puts \"Setting #{third} to 1\" if @DEBUG\n program[third] = 1\n else\n puts \"Setting #{third} to 0\" if @DEBUG\n program[third] = 0\n end\n\n pointer += 4\n end\n gets if @DEBUG\n end\n end", "def mov_macros_2b(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 5\n sample :bd_klub, rate: 1 - 0.25 * i, amp: 5\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :elec_soft_kick, pan: pan, rate: 1, amp: 1\n end\n sleep 0.25\n\n sleep 0.125\n # play chord(:f2, :major), amp: 3 * i, release: 0.25\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 5\n sleep 0.125\n\n n = [3, 4, 8].choose\n with_fx :echo, phase: 0.5 / n, mix: 0.1 do\n sample :elec_soft_kick, rate: 1, amp: 2\n end\n sleep 0.25\n\n sample :bd_haus, rate: 1 - 0.25 * i, amp: 2\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :elec_soft_kick, pan: pan, rate: 1, amp: 2\n # sample :elec_triangle\n end\n sleep 0.25\n end\n end\n end\nend", "def mov_macros_2s(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n s = :elec_tick\n\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rrand(1,4), amp: 1\n end\n\n pan = rrand(-1,1)\n rate = 2\n amp = 0.5\n n = [2, 4].choose\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n use_synth :cnoise\n play :e5, release: 0.125, amp: 1\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: 1\n end\n\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :drum_cymbal_closed, pan: -pan, rate: rrand(1,4), amp: 1\n end\n sleep 0.125\n sleep 0.125\n end\n end\n end\nend", "def disassemble memory \n #we're going to be parsing 16-bit instructions. these masks will allow us to\n #get meaningful data out of out of those 16 bits\n #to use: (instruction & mask) >> x, where x is the index of the\n #least-significant bit of of the mask\n #e.g (0x00011011000001100 & opcode mask) >> 12 = 0001\n\n #opcode mask\n opcode_mask = 0xF000\n\n #destination/base and source register masks\n reg1_mask = 0xE00 #the register found at bits 11 through 9\n reg2_mask = 0x1C0 #the register found at bit 8 through 6\n reg3_mask = 0x7 #the register found at bits 2 through 0\n\n #condition code masks\n br_cc_mask = 0xE00 #the whole kitten kaboodle, >> 9\n br_n_mask = 0x800 # >> 11\n br_z_mask = 0x400 # >> 10\n br_p_mask = 0x200 # >> 9\n\n #imm5 vs source register flag mask\n #if 0, using 2 registers. if 1, using a register and a imm5\n operand2_flag_mask = 0x20 # >> 5\n\n #jsr vs jsrr flag mask\n #if 0, jsrr. if 1, jsr\n jsr_flag_mask = 0x800 # >> 7\n\n #offset masks\n #offset masks are always the least significant x bits\n offset9_mask = 0x1FF\n offset11_mask = 0x7FF\n offset6_mask = 0x3f\n\n #imm5 mask\n #always lsb\n imm5_mask = 0x1F\n\n #trap vector mask\n #always lsb\n trap_vector_mask = 0xFF\n\n \n #opcodes\n add_code = 0x1\n and_code = 0x5\n br_code = 0x0\n jmp_code = 0xC\n jsr_code = 0x4\n ld_code = 0x2\n ldi_code = 0xA\n ldr_code = 0x6\n lea_code = 0xE\n not_code = 0x9\n rti_code = 0x8\n st_code = 0x3\n sti_code = 0xB\n str_code = 0x7\n #trap_code = 0xF\n halt_code = 0xF025 # we only have 1 trap (0xF---), and thats halt\n\n\n #opcode strings\n add_string = \"ADD\"\n and_string = \"AND\"\n br_string = \"BR\"\n jmp_string = \"JMP\"\n jsr_string = \"JSR\"\n jsrr_string = \"JSRR\"\n ld_string = \"LD\"\n ldi_string = \"LDI\"\n ldr_string = \"LDR\"\n lea_string = \"LEA\"\n not_string = \"NOT\"\n nop_string = \"NOP\"\n ret_string = \"RET\"\n rti_string = \"RTI\"\n st_string = \"ST\"\n sti_string = \"STI\"\n str_string = \"STR\"\n trap_string = \"TRAP\"\n\n #other strings\n n_string = \"N\"\n z_string = \"Z\"\n p_string = \"P\"\n comma_string = \",\"\n halt_string = \"HALT\"\n space_string = \" \"\n r_string = \"R\" #as in register, R1, R2, ...\n error_string = \"ERROR\"\n hash_string = \"#\"\n \n #sign extension addends\n #we can encounter 2's complement numbers that are negative in x number of\n #bits, but not y number.\n #\n #for example: (binary) 0000 0101\n #in 3-bit 2's comp, this number is -3\n #in 8-bit 2's comp, this number is 5\n #\n #since ruby and lc3 have no (primitive) understanding of numbers with smaller \n #bit lengths than the system default (32 and 16 respectively), we need to sign\n #extend these numbers so that the system also conveys bit these lengths.\n #\n #for negative 2's complement numbers, if we assume that the msb == the desired\n #bit length (ie, the number has been masked so that it contains no other data\n #beyond the desired bit length) then we can simply add an appropriate addend\n #constructed of all 1's in all places beyond the msb.\n #\n #extending our previous example: \n #-3 = 1111 1101 = 1111 1000 + 0000 0101\n #\n #the following are these addends for various desired bit lengths\n #\n #NOTE: this is a system-dependent implementation. on this dev machine, the\n #integers we get by default are 32 bits. on lc3, its 16, and it could be\n #anything else for other machines. proceed with caution.\n# bit5_extender = 0xFFFFFFE0\n# bit6_extender = 0xFFFFFFC0\n# bit9_extender = 0xFFFFFE00\n# bit11_extender = 0xFFFFF800\n\n \n #a more asm way of saying index counter\n instruction_ptr = 0x0\n\n while memory[instruction_ptr] - 0xFFFF != 0\n this_instruction = memory[instruction_ptr]\n \n this_opcode = (this_instruction & opcode_mask) >> 12\n\n #we'll force the opcode code to turn this on\n #if we get down to the bottom, and this hasn't been set, we've encountered\n #one of the no-no opcodes for this homework, such as RTI, (reserved \n #opcode),or traps other thanHALT. in that case, write ERROR\n valid_instruction = 0\n \n #ADD\n #example: ADD R0, R0, R5\n #example: ADD R0, R3, #17\n if this_opcode - add_code == 0\n print add_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n \n #immediate more or source register 2 mode?\n flag = (this_instruction & operand2_flag_mask) >> 5\n if flag == 0\n print r_string\n reg = (this_instruction & reg3_mask)\n print reg\n end\n if flag == 1\n imm5 = (this_instruction & imm5_mask)\n print hash_string\n print imm5\n end\n\n valid_instruction = 1\n end\n \n #AND\n #example: AND R0, R0, R5\n #example: AND R0, R3, #17\n if this_opcode - and_code == 0\n print and_string\n print space_string\n \n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n \n flag = (this_instruction & operand2_flag_mask) >> 5\n if flag == 0\n print r_string\n reg = (this_instruction & reg3_mask)\n print reg\n end\n if flag == 1\n imm5 = (this_instruction & imm5_mask)\n print hash_string\n print imm5\n end\n\n valid_instruction = 1\n end\n \n #BR and NOP\n #example: BR NZP #4\n #example: NOP\n if this_opcode - br_code == 0\n cc = (this_instruction & br_cc_mask) >> 9\n if cc == 0\n print nop_string\n else\n print br_string\n \n #n set?\n n = (this_instruction & br_n_mask) >> 11\n if n > 0\n print n_string\n end\n \n #z set?\n z = (this_instruction & br_z_mask) >> 10\n if z > 0\n print z_string\n end\n \n #p set?\n p = (this_instruction & br_p_mask) >> 9\n if p > 0\n print p_string\n end\n \n print space_string\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n end\n\n valid_instruction = 1\n end\n\n #JMP and RET\n #example: JMP R5\n #example: RET\n if this_opcode - jmp_code == 0\n #ret and jmp share the same opcode\n reg = (this_instruction & reg2_mask) >> 6\n if reg - 7 == 0\n print ret_string\n else\n print jmp_string\n print space_string\n\n print r_string\n print reg\n end\n \n valid_instruction = 1\n end\n\n #JSR and JSRR\n #example: JSR #123\n #example: JSRR R3\n if this_opcode - jsr_code == 0\n #jsr and jsrr share the same opcode\n jsr_flag = (this_instruction & jsr_flag_mask) >> 11\n if jsr_flag > 0\n offset = (this_instruction & offset11_mask)\n print jsr_string\n print space_string\n\n print hash_string\n print offset\n else\n print jsrr_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n end\n\n valid_instruction = 1\n end\n\n #LD\n #example: LD R3, #5\n if this_opcode - ld_code == 0\n print ld_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LDI\n #example: LDI R2, #22\n if this_opcode - ldi_code == 0\n print ldi_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LDR\n #example: LDR R0, R4, #5\n if this_opcode - ldr_code == 0\n print ldr_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset6_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #LEA\n #example: LEA R3, #2\n if this_opcode - lea_code == 0\n print lea_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n \n valid_instruction = 1\n end\n\n #NOT\n #example: NOT R0, R0\n if this_opcode - not_code == 0\n print not_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n \n valid_instruction = 1\n end\n\n #ST\n #example: ST R1, #46\n if this_opcode - st_code == 0\n print st_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n end\n\n #STI\n #example: STI R0, #128\n if this_opcode - sti_code == 0\n print sti_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset9_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n end\n\n #STR\n #example STR R0, R1, #3\n if this_opcode - str_code == 0\n print str_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg1_mask) >> 9\n print reg\n print comma_string\n print space_string\n\n print r_string\n reg = (this_instruction & reg2_mask) >> 6\n print reg\n print comma_string\n print space_string\n\n offset = (this_instruction & offset6_mask)\n print hash_string\n print offset\n\n valid_instruction = 1\n\n end\n\n #HALT\n #example: HALT\n if this_instruction - halt_code == 0\n print halt_string\n\n valid_instruction = 1\n end\n\n #ERROR (for all not accepted instructions)\n #example: ERROR\n if valid_instruction == 0\n print error_string\n end\n\n print \"\\n\"\n\n instruction_ptr += 1\n end\nend", "def writeArithmetic(command)\n assembly_builder = []\n # Add\n if command == 'add'\n assembly_builder.push(\n '@SP',# A=0\n 'AM=M-1',# A=RAM[0]=M[0]-1\n 'D=M',# D=RAM[257]\n 'A=A-1',# A=257-1=256\n 'M=M+D'# RAM[256]=RAM[256]+D\n )\n\n elsif command == 'sub'\n assembly_builder.push(\n '@SP',\n 'AM=M-1',\n 'D=M',\n 'A=A-1',\n 'M=M-D'\n )\n\n # y = -y\n elsif command == 'neg'\n assembly_builder.push(\n '@SP',\n 'A=M-1',\n 'M=-M',\n )\n\n # x == y ? -1 : 0\n elsif command == 'eq'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@EQEND', # if D == 0 → EQEND\n 'D;JEQ', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(EQEND)'\n )\n\n # x > y ? -1 : 0\n elsif command == 'gt'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@GTEND', # if D == 0 → EQEND\n 'D;JGT', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(GTEND)'\n )\n # x < y ? -1 : 0\n elsif command == 'lt'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'D=M-D', # D = 5 - 4 = 1\n 'M=-1', # M[256] = -1\n '@LTEND', # if D == 0 → EQEND\n 'D;JLT', #\n '@SP',\n 'A=M-1',\n 'M=0',\n '(LTEND)'\n )\n # x & y\n elsif command == 'and'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'M=D&M'\n )\n # x | y\n elsif command == 'or'\n assembly_builder.push(\n '@SP',\n 'AM=M-1', # M = 257\n 'D=M', # D = 4\n 'A=A-1', # @256\n 'M=D|M'\n )\n # not y\n elsif command == 'not'\n assembly_builder.push(\n '@SP',\n 'A=M-1', # M = 257\n 'M=!M'\n )\n end\n return assembly_builder\n end", "def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end", "def adc_a_d8\n end", "def run\n ip = 0\n while ip < @instructions.length\n op = Opcode.find_by_ord(@instructions[ip])\n\n case op\n when Opcode::CONSTANT\n const_index = read_uint16(@instructions[ip + 1...ip + 3])\n ip += 2\n push(@constants[const_index])\n when Opcode::TRUE\n push(TRUE)\n when Opcode::FALSE\n push(FALSE)\n when Opcode::ADD, Opcode::SUB, Opcode::MUL, Opcode::DIV\n execute_binary_operation(op)\n when Opcode::POP\n pop\n end\n\n ip += 1\n end\n end", "def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end", "def minilang(commands)\n stack = []\n register = 0\n command_arr = commands.split\n\n command_arr.each do |command|\n case command\n when \"PUSH\"\n stack.push(register)\n when \"ADD\"\n register += stack.pop\n when \"SUB\"\n register -= stack.pop\n when \"MULT\"\n register *= stack.pop\n when \"DIV\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"DIV\\\" command.\"\n else\n register /= stack.pop\n end\n when \"MOD\"\n if stack.last == 0\n puts \"Divide by zero error. Can't perform \\\"MOD\\\" command.\"\n else\n register %= stack.pop\n end\n when \"POP\"\n register = stack.pop\n when \"PRINT\"\n puts register\n else\n register = command.to_i\n end\n end\nend", "def set_register\n # set config registers\n config_reg = 0xF5 # Register address for config settings\n t_sb = 0b000 # Standby time = 0.5ms (0b000)\n filter = 0b100 # filter coefficient = 16\n spi3w_en = 0 # Disable SPI\n config_val = (t_sb << 5) | (filter << 2) | spi3w_en\n write(config_reg, config_val)\n\n # set ctrl_meas registers\n tp_reg = 0xF4 # Register address for temperature/pressure settings\n osrs_t = 0b010 # Temperature oversampling = x2 (0b010)\n osrs_p = 0b101 # Pressure oversampling = x16 (0b101)\n mode = 0b11 # Normal mode (0b11)\n tp_val = (osrs_t << 5) | (osrs_p << 2) | mode\n write(tp_reg, tp_val)\n\n # set ctrl_hum registers \n hum_reg = 0xF2 # Register address for humidity settings \n osrs_h = 0b001 # Humidity oversampling = x1 (0b001)\n hum_val = osrs_h\n write(hum_reg, hum_val)\n end", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def smc(a, b)\n a_i = a.map { |i| i > 0 ? 1 : 0 }\n b_i = b.map { |i| i > 0 ? 1 : 0 }\n m00 = (0 .. (a.size - 1)).map { |i| a_i[i] == 0 && b_i[i] == 0 ? 1 : 0 }\n m11 = (0 .. (a.size - 1)).map { |i| a_i[i] == 1 && b_i[i] == 1 ? 1 : 0 }\n return (m00 + m11).to_f / a.size\n end", "def add_reg_with_block_format\n # ** Data Register 3 **\n # This is dreg\n add_reg :dreg, 0x1000, size: 16 do |reg|\n # This is dreg bit 15\n reg.bit 15, :bit15, reset: 1\n # **Bit 14** - This does something cool\n #\n # 0 | Coolness is disabled\n # 1 | Coolness is enabled\n reg.bits 14, :bit14\n # This is dreg bit upper\n reg.bits 13..8, :upper\n # This is dreg bit lower\n # This is dreg bit lower line 2\n reg.bit 7..0, :lower, writable: false, reset: 0x55\n end\n\n # This is dreg2\n reg :dreg2, 0x1000, size: 16 do\n # This is dreg2 bit 15\n bit 15, :bit15, reset: 1\n # This is dreg2 bit upper\n bits 14..8, :upper\n # This is dreg2 bit lower\n # This is dreg2 bit lower line 2\n bit 7..0, :lower, writable: false, reset: 0x55\n end\n\n # Finally a test that descriptions can be supplied via the API\n reg :dreg3, 0x1000, size: 16, description: \"** Data Register 3 **\\nThis is dreg3\" do\n bit 15, :bit15, reset: 1, description: 'This is dreg3 bit 15'\n bit 14, :bit14, description: \"**Bit 14** - This does something cool\\n\\n0 | Coolness is disabled\\n1 | Coolness is enabled\"\n bits 13..8, :upper, description: 'This is dreg3 bit upper'\n bit 7..0, :lower, writable: false, reset: 0x55, description: \"This is dreg3 bit lower\\nThis is dreg3 bit lower line 2\"\n end\n\n reg :dreg4, 0x1000, size: 8, description: \"** Data Register 4 **\\nThis is dreg4\" do\n bit 7..0, :busy, reset: 0x55, description: \"**Busy Bits** - These do something super cool\\n\\n0 | Job0\\n1 | Job1\\n10 | Job2\\n11 | Job3\\n100 | Job4\\n101 | Job5\\n110 | Job6\\n111 | Job7\\n1000 | Job8\\n1001 | Job9\\n1010 | Job10\\n1011 | Job11\\n1100 | Job12\\n1101 | Job13\\n1110 | Job14\\n1111 | Job15\\n10000 | Job16\\n10001 | Job17\\n10010 | Job18\"\n end\n end", "def compute_ruby\n check_frequencies\n #\n # INITIALIZATION\n #\n @r = 0\n sdzero = 0\n @sdr = 0\n @itype = 0\n @ifault = 0\n delta = 0\n \n\n # GOTO (4, 1, 2 , 92), kdelta\n #\n # delta IS 0.0, 0.5 OR -0.5 ACCORDING TO WHICH CELL IS 0.0\n #\n\n if(@kdelta==2)\n # 1\n delta=0.5\n @r=-1 if (@a==0 and @d==0)\n elsif(@kdelta==3)\n # 2\n delta=-0.5\n @r=1 if (@b==0 and @c==0)\n end\n # 4\n if @r!=0\n @itype=3\n end\n\n #\n # STORE FREQUENCIES IN AA, BB, CC AND DD\n #\n @aa = @a + delta\n @bb = @b - delta\n @cc = @c - delta\n @dd = @d + delta\n @tot = @aa+@bb+@cc+@dd\n #\n # CHECK IF CORRELATION IS NEGATIVE, 0.0, POSITIVE\n # IF (AA * DD - BB * CC) 7, 5, 6\n\n corr_dir=@aa * @dd - @bb * @cc\n if(corr_dir < 0)\n # 7\n @probaa = @bb.quo(@tot)\n @probac = (@bb + @dd).quo(@tot)\n @ksign = 2\n # -> 8\n else\n if (corr_dir==0)\n # 5\n @itype=4\n end\n # 6\n #\n # COMPUTE PROBABILITIES OF QUADRANT AND OF MARGINALS\n # PROBAA AND PROBAC CHOSEN SO THAT CORRELATION IS POSITIVE.\n # KSIGN INDICATES WHETHER QUADRANTS HAVE BEEN SWITCHED\n #\n\n @probaa = @aa.quo(@tot)\n @probac = (@aa+@cc).quo(@tot)\n @ksign=1\n end\n # 8\n\n @probab = (@aa+@bb).quo(@tot)\n\n #\n # COMPUTE NORMAL DEVIATES FOR THE MARGINAL FREQUENCIES\n # SINCE NO MARGINAL CAN BE 0.0, IE IS NOT CHECKED\n #\n @zac = Distribution::Normal.p_value(@probac.to_f)\n @zab = Distribution::Normal.p_value(@probab.to_f)\n @ss = Math::exp(-0.5 * (@zac ** 2 + @zab ** 2)).quo(TWOPI)\n #\n # WHEN R IS 0.0, 1.0 OR -1.0, TRANSFER TO COMPUTE SDZERO\n #\n if (@r != 0 or @itype > 0)\n compute_sdzero\n return true\n end\n #\n # WHEN MARGINALS ARE EQUAL, COSINE EVALUATION IS USED\n #\n if (@a == @b and @b == @c)\n calculate_cosine\n return true\n end\n #\n # INITIAL ESTIMATE OF CORRELATION IS YULES Y\n #\n @rr = ((Math::sqrt(@aa * @dd) - Math::sqrt(@bb * @cc)) ** 2) / (@aa * @dd - @bb * @cc).abs\n @iter = 0\n begin\n #\n # IF RR EXCEEDS RCUT, GAUSSIAN QUADRATURE IS USED\n #\n #10\n if @rr>RCUT\n gaussian_quadrature\n return true\n end\n #\n # TETRACHORIC SERIES IS COMPUTED\n #\n # INITIALIZATION\n #\n va=1.0\n vb=@zac.to_f\n wa=1.0\n wb=@zab.to_f\n term = 1.0\n iterm = 0.0\n @sum = @probab * @probac\n deriv = 0.0\n sr = @ss\n #15\n begin\n if(sr.abs<=CONST)\n #\n # RESCALE TERMS TO AVOID OVERFLOWS AND UNDERFLOWS\n #\n sr = sr / CONST\n va = va * CHALF\n vb = vb * CHALF\n wa = wa * CHALF\n wb = wb * CHALF\n end\n #\n # FORM SUM AND DERIVATIVE OF SERIES\n #\n # 20\n dr = sr * va * wa\n sr = sr * @rr / term\n cof = sr * va * wa\n #\n # ITERM COUNTS NO. OF CONSECUTIVE TERMS < CONV\n #\n iterm+= 1\n iterm=0 if (cof.abs > CONV)\n @sum = @sum + cof\n deriv += dr\n vaa = va\n waa = wa\n va = vb\n wa = wb\n vb = @zac * va - term * vaa\n wb = @zab * wa - term * waa\n term += 1\n end while (iterm < 2 or term < 6)\n #\n # CHECK IF ITERATION CONVERGED\n #\n if((@sum-@probaa).abs <= CITER)\n @itype=term\n calculate_sdr\n return true\n end\n #\n # CALCULATE NEXT ESTIMATE OF CORRELATION\n #\n #25\n @iter += 1\n #\n # IF TOO MANY ITERATlONS, RUN IS TERMINATED\n #\n delta = (@sum - @probaa) / deriv\n @rrprev = @rr\n @rr = @rr - delta\n @rr += 0.5 * delta if(@iter == 1)\n @rr= RLIMIT if (@rr > RLIMIT)\n @rr =0 if (@rr < 0.0)\n end while @iter < NITER\n raise \"Too many iteration\"\n # GOTO 10\n end", "def execute()\n create_amplifiers()\n i = 0\n j = 0\n\n until @intcode[@amplifiers[i][:pointer]] == STOP_CODE\n\n instruction = @amplifiers[i][:intcode][@amplifiers[i][:pointer]].digits\n\n parameters = InstructionParameters.new.identify(\n instruction,\n @amplifiers[i][:pointer],\n @amplifiers[i][:intcode]\n )\n\n results = IntcodeInstructions.new.execute(instruction[0],@amplifiers[i][:pointer],@amplifiers[i][:intcode],parameters)\n\n @amplifiers[i][:intcode] = results[:intcode]\n\n @amplifiers[i][:pointer] = results[:pointer]\n\n if instruction[0] == 3\n @amplifiers[i][:intcode][parameters[0]] = @signals[j]\n elsif instruction[0] == 4\n #@signals.push(@amplifiers[i][:intcode][parameters[0]])\n puts parameters[0]\n i += 1\n j += 1\n end\n\n i = 0 if i == @amplifiers.length\n\n end\n\n\n puts @signals\n end", "def buy_power_3 d0, d1, s0, s1\n next_condition = @battery - (d0 - s0) - (d1 - s1) # 未来の条件式\n crnt_condition = @battery - (d0 - s0) # 現在の条件式\n result = 0.0 # 結果値\n\n if crnt_condition < @target # 現時点で目標値よりバッテリー残量が少ないとき\n if next_condition < @target # 次の時刻でも目標値が達成できないとき\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n # 買った分で最大容量を超えてしまったときは超えないようにする\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻では目標値が達成できるとき\n # 買わない 売るかどうかは保留したほうがいい?ただし0にはしないようにする\n result = 1.0 if crnt_condition == 0.0\n sell_power_2\n end\n else # 現時点では目標値は達成しているとき\n if next_condition < @target # 次の時刻で目標値が達成できない\n # 達成できなくなる分の電力を買っておく\n if @target - next_condition > 500.0 # 15分に受け取れる電力量は500wと想定する\n result = 500.0\n else\n result = @target - next_condition\n end\n next_battery = crnt_condition + result # 次の時刻でのバッテリー残量予測\n result = next_battery > @max_strage ? result - (next_battery - @max_strage) : result\n else # 次の時刻でも目標値が達成できるとき\n # Don't buy power.\n # むしろ売る\n sell_power_2\n end\n end\n @battery = crnt_condition + result # バッテリー残量の状態遷移\n @battery = @max_strage if @battery > @max_strage\n return result\n end", "def minilang(program)\n register = 0\n stack = []\n\n program.split.each do |step|\n p step\n case step\n when 'PUSH' then stack.push(register)\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register *= stack.pop\n when 'DIV' then register /= stack.pop\n when 'MOD' then register %= stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = step.to_i\n end\n p stack\n end\nend", "def gpioinit yabm\n yabm.gpiosetdat(1 << 3 | 1 << 4)\nend", "def process(samples)\r\n @v_n_1, @v_n_2 = kernel(samples, @koef, @v_n_1, @v_n_2)\r\n dBm(@koef, @v_n_1, @v_n_2, samples.length)\r\n end", "def getsimm(op)\n o = field_o(op);\n m = 1 << (16 - 1);\n\n (o ^ m) - m;\nend", "def outputMnemonicDefinition(row)\n # Get the variable data type\n dataType = ccdd.getStructureDataType(row)\n\n # Get the single character ITOS encoded form of the data type\n itosEncode = ccdd.getITOSEncodedDataType(dataType, \"SINGLE_CHAR\")\n\n # Check if this data type is a recognized base type, and not a structure\n if itosEncode != nil && itosEncode != dataType\n # Check if the encoding is 'raw' (unrecognized)\n if itosEncode == \"R\"\n # Default to \"unsigned\"\n itosEncode = \"U\"\n end\n\n # Get the variable name and array size\n variableName = ccdd.getStructureVariableName(row)\n arraySize = ccdd.getStructureArraySize(row)\n\n # Check if the variable is not an array definition\n isVar = isVariable(variableName, arraySize)\n\n # Check if the variable is a string\n isString = itosEncode == \"S\" && arraySize\n\n # Set the output flag if this is a non-string variable\n isOutputMnemonic = isVar && !isString\n\n # Check if this is a string definition\n if isString && !isVar\n # Set the flag if the string is not telemetered (if the first\n # member has no non-blank rate)\n isOutputMnemonic = !isTelemetry(row + 1)\n end\n\n # Only output non-array variables or array members (i.e., skip array\n # definitions)\n if isOutputMnemonic\n structurePath = ccdd.getFullVariableName(row, \".\")\n\n # Get the full variable name for this variable, which includes all\n # of the variable names in its structure path\n fullVariableName = ccdd.getFullVariableName(row)\n\n enumeration = nil\n\n # Get the enumeration(s)\n enumerations = ccdd.getStructureEnumerations(row)\n\n # Check if any enumeration exists\n if enumerations != nil && enumerations.length != 0\n # Store the first enumeration\n enumeration = enumerations[0]\n end\n\n # Get the polynomial conversion and limit sets columns (if extant)\n polynomial = ccdd.getStructureTableData(\"polynomial coefficients\", row)\n limitSet = ccdd.getStructureTableData(\"limit sets\", row)\n\n # Step through each flight computer\n for fcIndex in 0..$numFlightComputers - 1\n # Output the mnemonic\n ccdd.writeToFile($tlmFile, itosEncode + \" \" + $fcNames[fcIndex] + fullVariableName + \" {sourceFields = {\" + $fcNames[fcIndex] + structurePath + \"}\")\n\n isConversion = false\n isMultiple = false\n\n # Check if the parameter includes an enumeration\n if enumeration != nil && !enumeration.empty?\n isConversion = true\n isMultiple = false\n end\n\n # Check if this parameter includes a discrete or polynomial\n # conversion\n if polynomial != nil && !polynomial.empty?\n isConversion = true\n isMultiple = polynomial.split(\"\\\\;\").length > 1\n end\n\n # Check if there is an enumeration or polynomial conversion\n if isConversion\n # Check if there are conversions specific to each flight\n # computer\n if isMultiple\n # Output the flight computer-specific conversion\n # reference\n ccdd.writeToFile($tlmFile, \" conversion = \" + $fcNames[fcIndex] + fullVariableName + \"_CONVERSION\")\n # There is only a single conversion\n else\n # Output the conversion reference\n ccdd.writeToFile($tlmFile, \" conversion = \" + fullVariableName + \"_CONVERSION\")\n end\n end\n\n # Check if this parameter includes a limit or limit set\n if limitSet != nil && !limitSet.empty?\n # Output the limit reference\n ccdd.writeToFile($tlmFile, \" limits = \" + fullVariableName + \"_LIMIT\")\n end\n\n ccdd.writeToFileLn($tlmFile, \"}\")\n end\n end\n end\nend", "def solution(n)\n n & 15\nend", "def ore_to_fuel(filename)\n\n book = Formulas.new(filename)\n formula = book.rewrite(\"FUEL\").react.react\n puts \"###############\"*10\n puts formula\n puts \"###############\"*10\n puts\n\n stock = 1000000000000\n fuel_produced = 0\n # leftover = []\n # other_inputs = []\n 1000.times do |index|\n\n puts \"STOCK: #{stock}\"\n # produce the maximum batch\n quantity = stock / formula.inputs.first.quantity\n used = quantity * formula.inputs.first.quantity\n left = stock - used\n\n fuel_produced += quantity # derived.output.quantity\n puts \"FUEL @#{index} #{fuel_produced}\"\n\n derived = formula.times(quantity)\n # puts \"times **** #{derived}\"\n # derived.add_leftover(leftover)\n # derived.add_leftover(other_inputs)\n # puts \"withlo *** #{derived}\"\n puts \"react **** #{derived}\"\n\n # # calculate the actual amount of ORE left using the leftovers\n derived.inputs.first.quantity = left\n derived.output.quantity = 0\n derived.reuse\n derived.react.react.react.react\n puts \"next1 **** #{derived}\"\n\n # other_inputs = derived.inputs.reject { |i| i.element == \"ORE\" }\n # leftover = derived.leftover\n stock = derived.inputs.first.quantity\n break if stock < formula.inputs.first.quantity\n puts\n puts\n end\n puts\n puts \"FUEL #{fuel_produced}\"\nend", "def initialize(options = {})\n add_reg :test, 0\n\n reg :test2, 0 do |reg|\n reg.bit 31, :msb\n reg.bit 30..1, :data\n reg.bit 0, :lsb\n end\n end", "def sh4LowerShiftOps(list)\n newList = []\n list.each {\n | node |\n if node.is_a? Instruction\n case node.opcode\n when \"ulshifti\", \"ulshiftp\", \"urshifti\", \"urshiftp\", \"lshifti\", \"lshiftp\", \"rshifti\", \"rshiftp\"\n if node.opcode[0, 1] == \"u\"\n type = \"l\"\n direction = node.opcode[1, 1]\n else\n type = \"a\"\n direction = node.opcode[0, 1]\n end\n if node.operands[0].is_a? Immediate\n maskedImm = Immediate.new(node.operands[0].codeOrigin, node.operands[0].value & 31)\n if maskedImm.value == 0\n # There is nothing to do here.\n elsif maskedImm.value == 1 or (type == \"l\" and [2, 8, 16].include? maskedImm.value)\n newList << Instruction.new(node.codeOrigin, \"sh#{type}#{direction}x\", [maskedImm, node.operands[1]])\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n if direction == \"l\"\n newList << Instruction.new(node.codeOrigin, \"move\", [maskedImm, tmp])\n else\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, -1 * maskedImm.value), tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n tmp = Tmp.new(node.codeOrigin, :gpr)\n newList << Instruction.new(node.codeOrigin, \"move\", [Immediate.new(node.operands[0].codeOrigin, 31), tmp])\n newList << Instruction.new(node.codeOrigin, \"andi\", [node.operands[0], tmp])\n if direction == \"r\"\n newList << Instruction.new(node.codeOrigin, \"negi\", [tmp, tmp])\n end\n newList << Instruction.new(node.codeOrigin, \"sh#{type}d\", [tmp, node.operands[1]])\n end\n else\n newList << node\n end\n else\n newList << node\n end\n }\n newList\nend", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def solve(a=nil, b=nil)\n program = @program.dup\n pointer = 0\n opcode = 0\n program[1] = a if a\n program[2] = b if b\n\n while (opcode != @STOP && pointer < program.length) do \n puts \"pointer: #{pointer}\" if @DEBUG\n opcode = program[pointer]\n a = 0\n b = 0\n c = 0\n\n # Check Immeidate Mode\n if(opcode.to_s.length > 2)\n opcode = opcode.to_s\n # need to parse that fancy code\n instruction = opcode[-2..-1].to_i\n puts \"instruction: #{instruction}\\nopcode: #{opcode}\" if @DEBUG\n \n if (opcode.length == 3)\n puts \"length: 3\" if @DEBUG\n c = opcode[0].to_i\n elsif (opcode.length == 4)\n puts \"length: 4\" if @DEBUG\n b = opcode[0].to_i\n c = opcode[1].to_i\n elsif (opcode.length == 5)\n puts \"length: 5\" if @DEBUG\n a = opcode[0].to_i\n b = opcode[1].to_i\n c = opcode[2].to_i\n end\n else\n puts \"opcode only: #{opcode}\" if @DEBUG\n instruction = opcode.to_i\n end\n\n if(instruction == @STOP)\n puts \"STOP\"\n break\n end\n\n puts \"a: #{a}\\nb: #{b}\\nc: #{c}\\n\" if @DEBUG\n \n if(instruction == @ADD || instruction == @MULTIPLY)\n position_a = program[pointer + 1].to_i\n position_a = program[position_a].to_i if c == 0\n\n position_b = program[pointer + 2].to_i\n position_b = program[position_b].to_i if b == 0\n\n position_c = program[pointer + 3].to_i #if a == 0\n #position_c = program[pointer + 3].to_i if a == 1\n \n if(instruction == @ADD)\n program[position_c] = position_a + position_b\n elsif(instruction == @MULTIPLY)\n program[position_c] = position_a * position_b\n end\n pointer += 4\n puts \"incrementing pointer by 4\" if @DEBUG\n end\n\n if(instruction == @READ)\n if (c == 0)\n puts \"\\nSTATUS: #{program[program[pointer + 1].to_i]}\\n\"\n else\n puts \"\\nSTATUS: #{program[pointer + 1]}\\n\"\n end\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n if(instruction == @STORE)\n print \"input: \"\n number = gets.strip\n target = program[pointer + 1].to_i\n program[target] = number.to_i\n pointer += 2\n puts \"incrementing pointer by 2\" if @DEBUG\n end\n\n # only two params\n if(instruction == @JUMP_IF_TRUE)\n puts \"Jump if true\" if @DEBUG\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n unless program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # only two params\n if(instruction == @JUMP_IF_FALSE)\n puts \"Jump if false\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n \n if @DEBUG\n puts \"first: #{first}\\nsecond: #{second}\"\n puts \"first_value: #{program[first]}\\nsecond_value: #{program[second]}\"\n end\n\n if program[first].to_i == 0\n pointer = program[second].to_i\n puts \"assigning pointer to #{pointer}\" if @DEBUG\n else\n pointer += 3\n puts \"incrementing pointer by 3\" if @DEBUG\n end\n end\n\n # four parameters\n if(instruction == @LESS)\n puts \"Less\" if @DEBUG\n\n first = pointer + 1\n first = program[first].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n if(program[first].to_i < program[second].to_i)\n program[third] = 1\n else\n program[third] = 0\n end\n\n pointer += 4\n end\n\n if(instruction == @EQUALS)\n puts \"Equals\" if @DEBUG\n\n first = pointer + 1\n first = program[pointer + 1].to_i if c == 0\n\n second = pointer + 2\n second = program[second].to_i if b == 0\n\n third = pointer + 3\n third = program[third].to_i if a == 0\n\n puts \"first: #{program[first]}, second: #{program[second]}\" if @DEBUG\n\n if(program[first].to_i == program[second].to_i)\n puts \"Setting #{third} to 1\" if @DEBUG\n program[third] = 1\n else\n puts \"Setting #{third} to 0\" if @DEBUG\n program[third] = 0\n end\n\n pointer += 4\n end\n gets if @DEBUG\n end\n return program[0]\n end", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def to_vhdl(level = 0)\n # The resulting string.\n res = \"\"\n\n # Generate the architecture's header\n # The instances' headers\n self.each_systemI do |systemI|\n systemT = systemI.systemT\n # Its entity\n res << (\" \" * level*3)\n res << \"component #{Low2VHDL.entity_name(systemT.name)}\\n\"\n res << (\" \" * (level+1)*3)\n # Its ports\n res << \"port(\\n\"\n # Inputs\n systemT.each_input do |input|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(input.name) << \": in \" \n res << input.type.to_vhdl << \";\\n\"\n end\n # Outputs\n systemT.each_output do |output|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(output.name) << \": out \" \n res << output.type.to_vhdl << \";\\n\"\n end\n # Inouts\n systemT.each_inout do |inout|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(inout.name) << \": inout \" \n res << inout.type.to_vhdl << \";\\n\"\n end\n # Remove the last \";\" for conforming with VHDL syntax.\n res[-2..-1] = \"\\n\" if res[-2] == \";\"\n res << \" \" * ((level+1)*3)\n # Close the port declaration.\n res << \");\\n\"\n # Close the component.\n res << \" \" * (level*3)\n res << \"end component;\\n\\n\" \n end\n\n # Generate the architecture's type definition.\n # It is assumed that these types are all TypeDef.\n self.each_type do |type|\n res << (\" \" * level*3)\n res << \"type #{Low2VHDL.vhdl_name(type.name)} is \"\n res << type.def.to_vhdl(level+1)\n res << \";\\n\"\n end\n\n ## Generates the required mux functions.\n mtps = [] # The mux functions to generate by type.\n # Gather the mux functions to generate.\n self.each_scope_deep do |scope|\n # Checks the connections.\n scope.each_connection do |connection|\n connection.right.each_node_deep do |node|\n if node.is_a?(Select) then\n mtps << [node.type,node.each_choice.to_a.size]\n end\n end\n end\n # Checks the statements.\n scope.each_behavior do |behavior|\n behavior.block.each_node_deep do |node|\n if node.is_a?(Select) then\n mtps << [node.type,node.each_choice.to_a.size]\n end\n end\n end\n end\n # Generate the gathered functions (only one per type).\n mtps.uniq!\n mtps.each do |type,num|\n res << Low2VHDL.mux_function(type,num,\" \" * level*3)\n end\n\n # Generate the inner signals declaration.\n self.each_inner do |inner|\n res << \" \" * (level * 3)\n # General signal or constant signal?\n res << (inner.is_a?(SignalC) ? \"constant \" : \"signal \")\n # Signal name.\n res << Low2VHDL.vhdl_name(inner.name) << \": \"\n # Signal type.\n res << inner.type.to_vhdl(level) \n # Signal value.\n if inner.value then\n if inner.value.is_a?(Concat) then\n # Concat are to be given the expected type of the\n # elements for casting them equally.\n # res << \" := \" << inner.value.to_vhdl(inner.type.base,level)\n res << \" := \" << inner.value.to_vhdl(level,inner.type.base)\n else\n res << \" := \" << inner.value.to_vhdl(level)\n end\n end\n res << \";\\n\"\n end\n\n # Generate the architecture's content.\n res << \" \" * ((level-1)*3) << \"begin\\n\"\n\n # Generate the instances connections.\n self.each_systemI do |systemI| \n # Its Declaration.\n res << \" \" * (level*3)\n res << Low2VHDL.vhdl_name(systemI.name) << \": \"\n systemT = systemI.systemT\n res << Low2VHDL.entity_name(systemT.name).to_s << \"\\n\"\n res << \" \" * ((level+1)*3)\n # Its ports\n res << \"port map(\\n\"\n # Inputs\n systemT.each_input do |input|\n ref = self.extract_port_assign!(systemI,input)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(input.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Outputs\n systemT.each_output do |output|\n ref = self.extract_port_assign!(systemI,output)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(output.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Inouts\n systemT.each_inout do |inout|\n ref = self.extract_port_assign!(systemI,inout)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(inout.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Remove the last \";\" for conforming with VHDL syntax.\n res[-2..-1] = \"\\n\" if res[-2] == \",\"\n # Close the port map declaration.\n res << \" \" * ((level+1)*3)\n res << \");\\n\"\n end\n # Generate the connections.\n res << \"\\n\" if self.each_scope.any?\n self.each_scope_deep do |scope|\n scope.each_connection do |connection|\n res << connection.to_vhdl([],level)\n end\n end\n\n # Generate the behaviors.\n # Current scope's\n res << \"\\n\" if self.each_connection.any?\n self.each_scope_deep do |scope|\n scope.each_behavior do |behavior|\n res << behavior.to_vhdl(level)\n end\n end\n return res\n end", "def ate_hardware(options = {})\n options = {\n chanmapname: $tester.default_channelmap, # Default is to use default_channelmap\n site: 0, # Default is to use site 0.\n testerconfigname: $tester.default_testerconfig # Default is to use default_testerconfig\n }.merge(options)\n\n unless $tester.channelmap[options[:chanmapname]]\n fail \"You must first import the tester channel map (e.g. $tester.channelmap = \\\"probe_x32\\\") before calling pin.channel\"\n end\n unless $tester.testerconfig[options[:testerconfigname]]\n fail \"You must first import the tester configuration (e.g. $tester.testerconfig = \\\"UflexConfigA\\\") before calling pin.instrument_type\"\n end\n if Origen.top_level.power_pin_groups.keys.include?(name) # Power Pin Groups do not need :ppmu, but need :supply\n instrumentinfo = Struct.new(:channel, :instrument, :chanmapname, :site, :testerconfigname, :supply)\n @channel = $tester.get_tester_channel(options[:chanmapname], name, options[:site])\n @instrument = $tester.get_tester_instrument(options[:testerconfigname], $tester.get_tester_channel(options[:chanmapname], name, options[:site]).split('.')[0].to_i) + $tester.is_vhdvs_hc(options[:chanmapname], name, options[:site]).to_s + $tester.is_hexvs_plus(options[:testerconfigname], @channel.split('.')[0].to_i).to_s + $tester.is_vhdvs_plus(options[:testerconfigname], @channel.split('.')[0].to_i).to_s + $tester.merged_channels(options[:chanmapname], name, options[:site]).to_s\n @supply = $tester.ate_hardware(@instrument).supply\n instrumentinfo.new(@channel, @instrument, options[:chanmapname], options[:site], options[:testerconfigname], @supply)\n else\n if $tester.get_tester_channel(options[:chanmapname], name, options[:site]).split('.')[0].to_i == 24\n instrumentinfo = Struct.new(:channel, :instrument, :chanmapname, :site, :testerconfigname)\n instrumentinfo.new($tester.get_tester_channel(options[:chanmapname], name, options[:site]), $tester.get_tester_instrument(options[:testerconfigname], $tester.get_tester_channel(options[:chanmapname], name, options[:site]).split('.')[0].to_i), options[:chanmapname], options[:site], options[:testerconfigname])\n else\n instrumentinfo = Struct.new(:channel, :instrument, :chanmapname, :site, :testerconfigname, :ppmu)\n instrumentinfo.new($tester.get_tester_channel(options[:chanmapname], name, options[:site]), $tester.get_tester_instrument(options[:testerconfigname], $tester.get_tester_channel(options[:chanmapname], name, options[:site]).split('.')[0].to_i), options[:chanmapname], options[:site], options[:testerconfigname], $tester.ate_hardware($tester.get_tester_instrument(options[:testerconfigname], $tester.get_tester_channel(options[:chanmapname], name, options[:site]).split('.')[0].to_i)).ppmu)\n end\n end\n end", "def ec2(amp = 0.2, tonics = [:e2], num = 4, synth = :fm)\n num.times do\n synth synth, note: chord(tonics.choose, [:m11, :m9, :major, :major7].choose),\n attack: [1, 0.75, 1.25, 1.5, 2].choose, cutoff: 80,\n amp: amp, pan: rrand(-0.2,0.2)\n sleep 1\n end\nend", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def generate_numbers\n (0...ARRAY_LENGTH).each do |i|\n y = ((1 << 31) & @mt[i]) + ((2**31 -1) & (@mt[(i+1)%ARRAY_LENGTH] % ARRAY_LENGTH))\n @mt[i] = @mt[(i + 397) % ARRAY_LENGTH] ^ (y >> 1)\n if (y % 2) != 0\n @mt[i] = @mt[i] ^ GENERATE_CONST\n end\n end\n end", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def conversion_steps(a, b)\n xor = a ^ b\n count = 0\n until xor.zero?\n count += 1 if xor & 1 == 1\n xor >>= 1\n end\n count\nend", "def euclides_extendido(a,b)\n #condicion para comprobar si el numero b es mayor que a si es asi se hace un swap\n x,z=[],[]\n t_primo=false\n if(b.to_i>a.to_i)\n x[1],x[2]=b.to_i,a.to_i\n else\n x[1],x[2]=a.to_i,b.to_i\n end\n z[0],z[1]=0,1\n i=1\n r=x[1]%x[2]\n #puts \"resto al comienzo: #{r}\"\n if r==0\n t_primo=false\n else\n while(r>0)\n #puts \"#{\"=\"*30}\"\n #puts \"ITERACION #{i}\"\n #puts \"x[i-1]=#{x[i-1]}\"\n #puts \"x[i]=#{x[i]}\"\n #puts \"z[i-1]=#{z[i-1]}\"\n #puts \"z[i]=#{z[i]}\"\n if(i>=2)\n #puts \"entre...\"\n z[i]=(-1*((x[i-1]/x[i]).to_i))*z[i-1]+z[i-2]\n x[i+1]=x[i-1]%x[i]\n #puts \"z[i]=#{z[i]}\"\n #puts \"x[i+1]=#{x[i+1]}\"\n end\n r=x[i+1]\n mcd=x[i]\n if(mcd==1)\n t_primo=true\n #en caso de que el inverso de negativo, se suma al numero mayor que se paso a la función.\n if(z[i-1]<0)\n @inverso=z[i-1]+x[1]\n else\n @inverso=z[i-1]\n end\n end\n i+=1\n #puts \"#{\"=\"*30}\"\n end\n\n end\n puts \"MCD: #{mcd}\"\n puts \"INVERSO: #{@inverso}\"\n t_primo\n end", "def test_007_indexing()\n TestVals.each do |sVal|\n lVal = sVal.length\n iVal_a_r = sVal.reverse.split(//).map { |bit| bit.to_i }\n bs = BitString.new(sVal)\n #\n # Let's try fetching each bit.\n #\n lVal.times do |i|\n assert_equal(iVal_a_r[i],\n bs[i],\n \"Test fetching index [#{i}] => #{iVal_a_r[i]}\")\n end\n\n #\n # Try setting each bit to its value.\n #\n bs = BitString.new(sVal)\n lVal.times do |i|\n bs[i] = iVal_a_r[i]\n assert_equal(iVal_a_r[i],\n bs[i],\n \"Test setting bit to itself \" +\n \"[#{i}] = #{iVal_a_r[i]}; [#{i}] => #{iVal_a_r[i]}\")\n end\n\n #\n # Try setting each bit to its complement.\n #\n bs = BitString.new(sVal)\n lVal.times do |i|\n pre = bs.to_s\n bs[i] = ~ bs[i]\n post = bs.to_s\n assert_not_equal(iVal_a_r[i],\n bs[i],\n \"Test setting bit to its complement \" +\n \"[#{i}] = ~[#{i}] != #{iVal_a_r[i]}\\n\" +\n \"pre=[#{pre}] post=[#{post}] sVal=[#{sVal}]\")\n end\n\n #\n # Try fetching with indices beyond the bounds.\n #\n msg = \"Test no exception from unbounded '#{sVal}'[#{lVal + 10}]\"\n assert_nothing_raised(msg) do\n bs[lVal + 10]\n end\n msg = \"Test IndexError exception from unbounded '#{sVal}'[-1]\"\n assert_raise(IndexError, msg) do\n bs[-1]\n end\n bs = BitString.new(sVal, lVal)\n msg = \"Test IndexError exception from bounded '#{sVal}'[#{lVal + 10}]\"\n assert_raise(IndexError, msg) do\n bs[lVal + 10]\n end\n msg = \"Test IndexError exception from bounded '#{sVal}'[-1]\"\n assert_raise(IndexError, msg) do\n bs[-1]\n end\n end\n end", "def ex1\n WaveFile::Reader.new(\n File.expand_path('../440Hz,441samples.wav', File.dirname(__FILE__))\n ) do |reader|\n samples = reader.read(441).samples.to_a\n #puts samples.map(&:inspect).join(\",\")\n samples_to_graph!(samples, '440constant')\n embiggen_and_imgcat!('440constant')\n end\nend", "def to_compress\n a = lx.dup\n b = rx.dup\n ts = transcript.dup\n w = ts.challenge_scalar(\"w\")\n q = GENERATOR_BJ * w\n\n a_sum = a.dup\n b_sum = b.dup\n g_sum = vec_g.dup\n h_sum = vec_h2.dup\n\n terms = []\n until a_sum.length == 1\n a_lo = []\n b_lo = []\n g_lo = []\n h_lo = []\n a_hi = []\n b_hi = []\n g_hi = []\n h_hi = []\n half = a_sum.length / 2\n a_sum.each.with_index do |_, i|\n if i < half\n a_lo << a_sum[i]\n b_lo << b_sum[i]\n g_lo << g_sum[i]\n h_lo << h_sum[i]\n else\n a_hi << a_sum[i]\n b_hi << b_sum[i]\n g_hi << g_sum[i]\n h_hi << h_sum[i]\n end\n end\n alo_bhi = a_lo.zip(b_hi).map { |x, y| FIELD.mod(x * y) }.sum\n ahi_blo = a_hi.zip(b_lo).map { |x, y| FIELD.mod(x * y) }.sum\n\n l_k =\n g_hi.zip(a_lo).map { |x, y| x * y }.sum(INFINITY_J) +\n h_lo.zip(b_hi).map { |x, y| x * y }.sum(INFINITY_J) + q * alo_bhi\n r_k =\n g_lo.zip(a_hi).map { |x, y| x * y }.sum(INFINITY_J) +\n h_hi.zip(b_lo).map { |x, y| x * y }.sum(INFINITY_J) + q * ahi_blo\n\n ts.points << l_k\n ts.points << r_k\n uk = ts.challenge_scalar(\"uk\")\n uk_inv = FIELD.inverse(uk)\n terms << { L: l_k, R: r_k }\n\n a_sum = []\n b_sum = []\n g_sum = []\n h_sum = []\n a_lo.each.with_index do |_, i|\n a_sum << (a_lo[i] * uk + a_hi[i] * uk_inv)\n b_sum << (b_lo[i] * uk_inv + b_hi[i] * uk)\n g_sum << (g_lo[i] * uk_inv + g_hi[i] * uk)\n h_sum << (h_lo[i] * uk + h_hi[i] * uk_inv)\n end\n end\n\n a0 = a_sum.first\n b0 = b_sum.first\n\n Compressed.new(v, p_a, p_s, p_t1, p_t2, tx, tx_bf, e, a0, b0, terms)\n end", "def leapfrog\n @u[0] = @mx.times.map { |j| self.ic(@x[j]) } # IC: u(x,0)\n alpha = @a*@dt/@dx\n @u[1] = (1.upto(@mx-3)).to_a # u(x, t1)\n @u[1].map! { |j| 0.5*(@u[0][j+1]+u[0][j-1])-0.5*alpha*(@u[0][j+1]-@u[0][j-1]) }\n @u[1].unshift 0.5*(@u[0][1]+u[0][@mx-2])-0.5*alpha*(@u[0][1]-@u[0][@mx-2]) # u(0,t1)\n @u[1].push 0.5*(@u[0][0]+u[0][@mx-3])-0.5*alpha*(@u[0][0]-@u[0][@mx-3]) # u(max(x), t1)\n @u[1].push @u[1][0] # periodic BC\n 1.upto(@mt-2) do |n|\n @u[n+1] = (1.upto(@mx-3)).to_a\n @u[n+1].map! { |j| @u[n-1][j]-alpha*(@u[n][j+1]-@u[n][j-1])}\n @u[n+1].unshift @u[n-1][0]-alpha*(@u[n][1]-@u[n][@mx-2]) # u(0,t)\n @u[n+1].push @u[n-1][@mx-2]-alpha*(@u[n][0]-@u[n][@mx-3]) # u(max(x), t)\n @u[n+1].push @u[n+1][0] # periodic BC\n end\n end", "def MUX2X1(x,y) XOR(x,y); end", "def adc_a_b\n end", "def add_mul\n\t\tpos = 0\n\t\twhile pos < @instructions.length - 6\n\t\t\tsix = @instructions[pos, 6]\n\t\t\tif six.map { |instr| instr[:type] } == CONST_MULT &&\n\t\t\t\t\t[six[0][1], six[0][2], six[1][1], six[4][1]].uniq.length == 4 &&\n\t\t\t\t\t[six[0][2], six[2][1], six[2][1]].uniq.length == 1 &&\n\t\t\t\t\tsix[4][1] == six[5][1] &&\n\t\t\t\t\tsix[3][2] == -2 && six[5][2] == -5\n\t\t\t\t@instructions[pos] = {:type => :mul, 1 => six[0][1], 2 => six[4][1], 3 => six[1][1]}\n\t\t\t\t@instructions[pos + 1] = {:type => :cpy, 1 => 0, 2 => six[2][1]}\n\t\t\t\t@instructions[pos + 2] = {:type => :cpy, 1 => 0, 2 => six[4][1]}\n\t\t\t\t((pos + 3)..(pos + 5)).each do |i|\n\t\t\t\t\t@instructions[i] = {:type => :none}\n\t\t\t\tend\n\t\t\tend\n\t\t\tpos += 1\n\t\tend\n\tend", "def and_mhl\n value = @mmu[hl]\n and_to_a value\n @clock += 2\n end", "def minilang(program)\n stack = []\n register = 0\n commands = program.split\n commands.each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += stack.pop\n when 'SUB' then register -= stack.pop\n when 'MULT' then register = register * stack.pop\n when 'DIV' then register = register / stack.pop\n when 'MOD' then register = register % stack.pop\n when 'POP' then register = stack.pop\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\n nil\nend", "def integrations; end", "def integrations; end", "def make_landau(chan)\n fr_binning = \"10,12,15,20,25,30,40,50,70,100\" #ruby does not seem to see global variables\n landau = \"scale*TMath::Landau(x,mu,sigma,0)+offset\"\n landau_vars = \"scale[0.5, 0, 15],mu[5, 0, 30],sigma[1.9, 0.1, 20],offset[1e-2, 0, 0.5]\"\n return Hash[\n \"samples\" => Array[\"diboson\", \"data_#{chan.downcase}\"],\n \"analyzer\" => \"FakeRates#{chan.upcase}\",\n \"function\" => landau,\n \"variables\" => landau_vars,\n \"rebin\" => fr_binning,\n \"range\" => \"10 100\",\n ]\nend", "def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend", "def minilang(instructions)\n stack = []\n register = 0\n functions = {\n 'PUSH' => Proc.new { stack.push(register) },\n 'ADD' => Proc.new { register += stack.pop },\n 'SUB' => Proc.new { register -= stack.pop },\n 'MULT' => Proc.new { register = stack.pop * register },\n 'DIV' => Proc.new { register = register / stack.pop },\n 'MOD' => Proc.new { register = register % stack.pop },\n 'POP' => Proc.new { register = stack.pop },\n 'PRINT'=> Proc.new { puts register },\n 'STACK'=> Proc.new { puts stack }\n }\n\n instructions = instructions.split\n instructions.map! do |instruction|\n if instruction.to_i != 0\n instruction.to_i\n else\n instruction\n end\n end\n\n instructions.each do |instruction|\n if instruction.is_a?(Integer)\n register = instruction\n next\n end\n functions[instruction].call\n end\nend", "def main\n sei\n set 0xdc0d, 0x7f #shortcut for lda 0x7f; sta 0xdc0d\n set 0xdd0d #without second argument its simply a sta 0xdd0d\n lda 0xdc0d\n lda 0xdd0d\n set 0xd01a, 1\n set 0xd012, 20\n set 0xd011, 0x1b\n lda 0x35\n sta 0x01, :zeropage => true #TODO: this is not so pretty\n irq #shortcut for: address :irq, :irq\n cli\n label :self\n jmp :self\n \n label :irq\n border 0\n lda 22\n label :raster_fix\n cmp 0xd012\n bne :raster_fix\n nop 27\n [:darkgrey, :red, :grey, :pink, :lightgrey, :white, :lightgrey, :pink, :grey, :red, :darkgrey, :black].each do |color|\n border color\n nop 60\n end\n border 0\n set 0xd019, 0xff\n rti\n end", "def named_bits(options = {})\n options = {\n include_spacers: false\n }.merge(options)\n result = []\n\n # Shows the bits that have changed from the reset value of the register/bits.\n # Currently logs it to the console window using Origen logger.\n def changed_bits(options = {})\n temp = named_bits.select { |name, bits| bits.data != bits.reset_val }\n temp.each do |r|\n Origen.log.info \"\\t\\t#{self.name}.#{r[0]} : #{r[1].value.to_hex}\".bold.blue\n end\n Origen.log.info ' '\n end\n\n # test if @lookup has any values stored as an array\n # if so it means there is a split group of bits\n # process that differently to a single bit or continuous range of bits\n # which are typically stored in a hash\n\n split_bits = false\n @lookup.each { |_k, v| split_bits = true if v.is_a? Array }\n\n if split_bits == false\n current_pos = size\n\n # Sort by position\n @lookup.sort_by { |_name, details| -details[:pos] }.each do |name, details|\n pos = details[:bits] + details[:pos]\n if options[:include_spacers] && (pos != current_pos)\n collection = BitCollection.dummy(self, nil, size: current_pos - pos, pos: pos)\n unless collection.size == 0\n if block_given?\n yield nil, collection\n else\n result << [nil, collection]\n end\n end\n end\n collection = BitCollection.new(self, name)\n details[:bits].times do |i|\n collection << @bits[details[:pos] + i]\n end\n unless collection.size == 0\n if block_given?\n yield name, collection\n else\n result << [name, collection]\n end\n end\n current_pos = details[:pos]\n end\n if options[:include_spacers] && (current_pos != 0)\n collection = BitCollection.dummy(self, nil, size: current_pos, pos: 0)\n unless collection.size == 0\n if block_given?\n yield nil, collection\n else\n result << [nil, collection]\n end\n end\n end\n elsif split_bits == true # if there are split bits, need to convert all register bit values to array elements to allow sorting\n\n # if the register has bits split up across it, then store the bits in order of decreasing reg position\n # but first, stuff all the bits in a simple array, as single bits, or ranges of bits\n\n @lookup_splits = []\n @lookup.each do |k, v|\n tempbit = {}\n bitcounter = {}\n if v.is_a? Hash\n # then this is already a single bit or a continuous range so just stuff it into the array\n tempbit[k] = v\n @lookup_splits << tempbit.clone\n elsif v.is_a? Array\n # if the bitgroup is split, then decompose into single bits and continuous ranges\n v.each_with_index do |bitdetail, _i|\n if bitcounter.key?(k)\n bitcounter[k] = bitcounter[k] + bitdetail[:bits]\n else\n bitcounter[k] = bitdetail[:bits]\n end\n tempbit[k] = bitdetail\n @lookup_splits << tempbit.clone\n end\n end\n if v.is_a? Array\n @lookup_splits.each_with_index do |_e, q|\n groupname = @lookup_splits[q].to_a[0][0]\n if groupname == k\n @lookup_splits[q][groupname][:bitgrouppos] = bitcounter[groupname] if groupname == k\n bitcounter[groupname] = bitcounter[groupname] - @lookup_splits[q][groupname][:bits]\n end\n end\n end\n end\n # Now sort the array in descending order\n # Does adding the bitgrouppos need to happen after the sort ?\n @lookup_splits = @lookup_splits.sort do |a, b|\n b.to_a[0][1][:pos] <=> a.to_a[0][1][:pos]\n end\n\n current_pos = size\n countbits = {} # if countbits.method == nil\n\n @master = {}\n bitgroup = {}\n bitinfo = {}\n info = {}\n\n @lookup_splits.each_with_index do |hash, _i|\n name = hash.to_a[0][0]\n details = hash.to_a[0][1]\n bitcounter = hash.to_a[0][1][:bitgrouppos]\n pos = details[:bits] + details[:pos]\n if options[:include_spacers] && (pos != current_pos)\n collection = BitCollection.dummy(self, nil, size: current_pos - pos, pos: pos)\n unless collection.size == 0\n if block_given?\n yield nil, collection, bitcounter\n else\n result << [nil, collection, bitcounter]\n end\n end\n end\n collection = BitCollection.new(self, name)\n details[:bits].times do |i|\n collection << @bits[details[:pos] + i]\n end\n unless collection.size == 0\n if block_given?\n yield name, collection, bitcounter\n else\n result << [name, collection, bitcounter]\n end\n end\n current_pos = details[:pos]\n end\n if options[:include_spacers] && current_pos != 0\n collection = BitCollection.dummy(self, nil, size: current_pos, pos: 0)\n unless collection.size == 0\n if block_given?\n yield nil, collection, bitcounter\n else\n result << [nil, collection, bitcounter]\n end\n end\n end\n end\n unless block_given?\n result\n end\n end", "def euclides_extendido(a,b)\n\n x,z=[],[]\n t_primo=false\n #condicion para comprobar si el numero b es mayor que a si es asi se hace un swap\n if(b.to_i>a.to_i)\n x[1],x[2]=b.to_i,a.to_i\n else\n x[1],x[2]=a.to_i,b.to_i\n end\n z[0],z[1]=0,1\n i=1\n r=x[1]%x[2]\n #puts \"resto al comienzo: #{r}\"\n if r==0\n t_primo=false\n else\n while(r>0)\n #puts \"#{\"=\"*30}\"\n if(i>=2)\n #puts \"entre...\"\n z[i]=(-1*((x[i-1]/x[i]).to_i))*z[i-1]+z[i-2]\n x[i+1]=x[i-1]%x[i]\n end\n r=x[i+1]\n mcd=x[i]\n if(mcd==1)\n t_primo=true\n #en caso de que el inverso de negativo, se suma al numero mayor que se paso a la función.\n if(z[i-1]<0)\n @inverso=z[i-1]+x[1]\n else\n @inverso=z[i-1]\n end\n end\n i+=1\n #puts \"#{\"=\"*30}\"\n end\n\n end\n #puts \"MCD: #{mcd}\"\n t_primo\n end", "def SS2_1 args\r\n\targs.state.tick_timer ||= args.state.tick_count\r\n\r\n\tif args.state.tick_count >= (args.state.tick_timer + 20) && args.state.tick_count < (args.state.tick_timer + 40)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"3\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 40) && args.state.tick_count < (args.state.tick_timer + 60)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"3\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 60) && args.state.tick_count < (args.state.tick_timer + 80)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"3\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 80) && args.state.tick_count < (args.state.tick_timer + 100)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"3\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 100) && args.state.tick_count < (args.state.tick_timer + 120)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"2\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 120) && args.state.tick_count < (args.state.tick_timer + 140)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"2\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 140) && args.state.tick_count < (args.state.tick_timer + 160)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"2\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 160) && args.state.tick_count < (args.state.tick_timer + 180)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"2\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 180) && args.state.tick_count < (args.state.tick_timer + 200)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"1\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 200) && args.state.tick_count < (args.state.tick_timer + 220)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"1\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 220) && args.state.tick_count < (args.state.tick_timer + 240)\r\n\t\t#white screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 255, 255, 255]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"1\")\r\n\tend\r\n\tif args.state.tick_count >= (args.state.tick_timer + 240) && args.state.tick_count < (args.state.tick_timer + 260)\r\n\t\t#black screen\r\n\t\targs.outputs.solids << [0, 0, 1280, 720, 0, 0, 0]\r\n\t\targs.outputs.labels << my_red_label(args, 605, 14, \"1\")\r\n\tend\r\n\r\n\t#After moving characters finished, transition to SS2_2\r\n\tif args.state.tick_count >= (args.state.tick_timer + 260)\r\n\t\targs.state.tick_timer = nil\r\n\t\targs.state.screen_select = 2.2\r\n\tend\r\nend", "def run_intcode(input, output, *program)\n index = 0\n sda_base = 0\n while (program[index] % 100) != 99\n instruction = program[index]\n opcode = instruction % 100\n param1_mode = (instruction / 100) % 10\n param2_mode = (instruction / 1_000) % 10\n param3_mode = (instruction / 10_000) % 10\n\n # p [index, opcode, param1_mode, param2_mode, param3_mode, sda_base]\n\n case opcode\n when 1 # +\n sum = read_param(1, program, index, param1_mode, sda_base) + read_param(2, program, index, param2_mode, sda_base)\n write_param(3, program, index, param3_mode, sda_base, sum)\n index += 4\n when 2 # *\n prod = read_param(1, program, index, param1_mode, sda_base) * read_param(2, program, index, param2_mode, sda_base)\n write_param(3, program, index, param3_mode, sda_base, prod)\n index += 4\n when 3 # Store input\n value = input.shift\n write_param(1, program, index, param1_mode, sda_base, value)\n index += 2\n when 4 # output first parameter\n value = read_param(1, program, index, param1_mode, sda_base)\n output << value\n index += 2\n when 5 # is jump-if-true\n # if the first parameter is non-zero, it sets the instruction pointer to the value from the second parameter. Otherwise, it does nothing.\n value = read_param(1, program, index, param1_mode, sda_base)\n if value.zero?\n index += 3\n else\n index = read_param(2, program, index, param2_mode, sda_base)\n end\n when 6 # is jump-if-false\n # if the first parameter is zero, it sets the instruction pointer to the value from the second parameter. Otherwise, it does nothing.\n value = read_param(1, program, index, param1_mode, sda_base)\n if value.zero?\n index = read_param(2, program, index, param2_mode, sda_base)\n else\n index += 3\n end\n when 7 # less than\n # if the first parameter is less than the second parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.\n value = if read_param(1, program, index, param1_mode, sda_base) < read_param(2, program, index, param2_mode, sda_base)\n 1\n else\n 0\n end\n write_param(3, program, index, param3_mode, sda_base, value)\n index += 4\n when 8 # equals\n # if the first parameter is equal to the second parameter, it stores 1 in the position given by the third parameter. Otherwise, it stores 0.\n value = if read_param(1, program, index, param1_mode, sda_base) == read_param(2, program, index, param2_mode, sda_base)\n 1\n else\n 0\n end\n write_param(3, program, index, param3_mode, sda_base, value)\n index += 4\n when 9 # adjusts the relative base\n value = read_param(1, program, index, param1_mode, sda_base)\n sda_base += value\n index += 2\n else\n puts\n puts \"Invalid OP #{program[index]} at #{index}\"\n exit(1)\n end\n end\n # p [index, opcode, param1_mode, param2_mode, param3_mode, sda_base]\n\n program\nend", "def bits\n\t\t# Get a safe copy of the @bits array\n\t\tbts = @bits.clone\n\t\t##\n\t\t# If carrying and not [HACK catch the pattern tha breaks it by adding an extrax 1]\n\t\t##\n\t\tif @carrying && @bits[0,4] != [1, 0, 0, 0]\n\t\t\tbts\t\t= [1].concat @bits\n\t\tend\n\t\t# Return to the caller\n\t\tbts\n\tend", "def run_program(input, intcodes)\n relative_base = 0\n pointer = 0\n instruction = intcodes[pointer]\n opcode = instruction % 100\n modes = (instruction / 100).digits\n\n while opcode != 99\n mode1 = modes[0] || 0\n mode2 = modes[1] || 0\n mode3 = modes[2] || 0\n input_param1 = intcodes[pointer + 1]\n input_param2 = intcodes[pointer + 2]\n input_param3 = intcodes[pointer + 3]\n\n case mode1\n when 0\n # position mode\n param1 = intcodes[input_param1]\n when 1\n # immediate mode\n param1 = input_param1\n when 2\n # relative mode\n param1 = intcodes[relative_base + input_param1]\n end\n\n case mode2\n when 0\n # position mode\n param2 = intcodes[input_param2]\n when 1\n # immediate mode\n param2 = input_param2\n when 2\n # relative mode\n param2 = intcodes[input_param2 + relative_base]\n end\n\n case mode3\n when 0, 1\n param3 = input_param3\n when 2\n param3 = input_param3 + relative_base\n end\n\n param1 = 0 if param1.nil?\n\n param2 = 0 if param2.nil?\n\n param3 = 0 if param3.nil?\n\n case opcode\n when 1\n intcodes[param3] = param1 + param2\n pointer += 4\n when 2\n intcodes[param3] = param1 * param2\n pointer += 4\n when 3\n if mode1 == 2\n intcodes[relative_base + input_param1] = input\n else\n intcodes[input_param1] = input\n end\n\n pointer += 2\n when 4\n puts \"OUTPUT: #{param1}\"\n\n pointer += 2\n when 5\n if param1.zero?\n pointer += 3\n else\n pointer = param2\n end\n when 6\n if param1.zero?\n pointer = param2\n else\n pointer += 3\n end\n when 7\n intcodes[param3] = if param1 < param2\n 1\n else\n 0\n end\n\n pointer += 4\n when 8\n intcodes[param3] = if param1 == param2\n 1\n else\n 0\n end\n\n pointer += 4\n when 9\n # adjusts the relative base by the value of its only parameter\n relative_base += param1\n\n pointer += 2\n else\n break\n end\n\n instruction = intcodes[pointer]\n opcode = instruction % 100\n modes = (instruction / 100).digits\n end\nend", "def gpioinit yabm\n yabm.gpiosetdat(1 << 6)\nend", "def virtual_computer(memory, registers)\n # Loop will continue until we reach the point in our memory array that\n # contains the halt instruction.\n while memory[registers[PC]] != HALT do\n puts \"============================\", \"No HALT yet\", \"============================\"\n puts \"PC: \", PC\n puts \"registers[PC]: \", registers[PC]\n puts \"memory[registers[PC]]: \", memory[registers[PC]]\n puts\n op = memory[registers[PC]]\n registers[PC] += 1\n case op\n when LOAD\n puts \"============================\", \"IN LOAD\", \"============================\"\n puts \"PC: \", PC\n puts \"registers[PC]: \", registers[PC]\n puts \"memory[registers[PC]]: \", memory[registers[PC]]\n register_address = memory[registers[PC]]\n puts \"register_address: \", register_address\n puts\n registers[PC] += 1\n word_address = memory[registers[PC]]\n puts \"word_address: \", word_address\n puts\n registers[PC] += 1\n # load both bytes in word\n # Have to add the 2 bytes together to get the \"full value\" if the value is greater than 1 byte.\n # Ex: 3 can be represeted in one byte, so we have 3 + 0 = 3\n # Ex: 5281 is too big for one byte, so we have 161 + (256 * 20) = 161 + 5120 = 5281\n # memory[word_address] is the least significant byte\n # memory[word_address + 1] is the most significant byte\n registers[register_address] = memory[word_address] + (256 * memory[word_address + 1])\n puts \"memory[word_address]: \", memory[word_address]\n puts \"(256 * memory[word_address + 1]) : \", (256 * memory[word_address + 1])\n puts \"registers[register_address]: \", registers[register_address]\n puts\n when STORE\n puts \"============================\", \"IN STORE\", \"============================\"\n puts \"PC: \", PC\n puts \"registers[PC]: \", registers[PC]\n puts \"memory[registers[PC]]: \", memory[registers[PC]]\n register_address = memory[registers[PC]]\n puts \"register_address: \", register_address\n puts\n registers[PC] += 1\n word_address = memory[registers[PC]]\n puts \"word_address: \", word_address\n puts\n registers[PC] += 1\n # We have to split our value so that it's represented by two bytes\n # write first (low order) byte\n # This will be the least significant byte so we find the value modulo 256\n memory[word_address] = registers[register_address] % 256\n puts \"memory[word_address]: \", memory[word_address]\n puts\n # write second (high order) byte\n # This will be the most significant byte so we find the value divided by 256,\n # which is the reverse of when we multiplied by 256\n memory[word_address + 1] = registers[register_address] / 256\n puts \"memory[word_address + 1]: \", memory[word_address + 1]\n puts\n when ADD\n puts \"============================\", \"IN ADD\", \"============================\"\n puts \"PC: \", PC\n puts \"registers[PC]: \", registers[PC]\n puts \"memory[registers[PC]]: \", memory[registers[PC]]\n register_address_a = memory[registers[PC]]\n puts \"register_address_a: \", register_address_a\n puts\n registers[PC] += 1\n register_address_b = memory[registers[PC]]\n puts \"register_address_b: \", register_address_b\n puts\n registers[PC] += 1\n # peform computation on values in registers\n registers[register_address_a] = registers[register_address_a] + registers[register_address_b]\n puts \"registers[register_address_a]: \", registers[register_address_a]\n puts\n end\n end\nend", "def compute\n loop do\n nargs = nil # force handling every case\n\n insn = mem[@ip]\n case insn % 100\n # ADD\n when 1\n nargs = 3\n write(2, read(0) + read(1))\n # MUL\n when 2\n nargs = 3\n write(2, read(0) * read(1))\n # INPUT\n when 3\n nargs = 1\n # puts \"#{name}: INqsize #{inq.size}\"\n val = inq.pop\n write(0, val)\n # puts \"#{name}: IN #{val}\"\n # OUTPUT\n when 4\n nargs = 1\n val = read(0)\n # puts \"#{name}: OUTqsize #{outq.size}\"\n outq.push(val)\n # puts \"#{name}: OUT #{val}\"\n # JUMP-IF-TRUE\n when 5\n nargs = 2\n if read(0) != 0\n @ip = read(1)\n nargs = -1\n end\n # JUMP-IF-FALSE\n when 6\n nargs = 2\n if read(0).zero?\n @ip = read(1)\n nargs = -1\n end\n # LESS-THAN\n when 7\n nargs = 3\n value = read(0) < read(1) ? 1 : 0\n write(2, value)\n # EQUALS\n when 8\n nargs = 3\n value = read(0) == read(1) ? 1 : 0\n write(2, value)\n # ADJRBASE\n when 9\n nargs = 1\n @rbase += read(0)\n when 99\n break\n else\n raise \"Unexpected opcode #{mem[@ip].inspect} at position #{@ip}\"\n end\n\n @ip += 1 + nargs\n end\n\n mem[0]\n end", "def run!\n program.each do |instruction|\n next if instruction.chomp.strip.length.zero?\n\n if /^mask/.match?(instruction)\n mask.change instruction[7..]\n else\n parts = instruction.split(' = ')\n slot = parts.first.match(/\\d+/)[0]\n input_value = parts.last.to_i\n mask.apply(memory, slot: slot, input_value: input_value)\n end\n end\n end", "def greatDiagonalForward numba\n movenum = 3\n greatproduct = 0\n suppression = [20, 21, 22, 40, 41, 42, 60, 61, 62, 80, 81, 82, 100, 101, 102, 120, 121, 122, 140, 141, 142, 160, 161, 162, 180, 181, 182, 200, 201, 202, 220, 221, 222, 240, 241, 242, 260, 261, 262, 280, 281, 282, 300, 301, 302, 320, 321, 322, 340, 341, 342, 360, 361, 362, 380, 381, 382]\n while movenum < numba.length-60 do\n if suppression.include?(movenum) == false\n production = numba[movenum].to_i\n 1.upto(3) do |i|\n production *= numba[movenum+20*i-i].to_i\n end\n end\n greatproduct = production if production > greatproduct\n movenum+=1\n end\n return greatproduct\nend", "def xor_d8\n end", "def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\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__, 53 )\n\n end\n \n return return_value\n end", "def make_data\n Array.new(2**15) { |i| (i / 16 % 256) }\n end", "def bitodec(bi)\n\tbistring = bi.to_s\n\tturnbi = bistring.chars.reverse.map{|i| i.to_i}\n\tfor index in (0...turnbi.length)\n\t\tturnbi[index] = turnbi[index]*(2**index)\n\tend\n\tdec = turnbi.sum\n\treturn dec\nend", "def clk\n case [@c2, @c1, @c0]\n when [0,0,0] then do_nothing;\n when [0,0,1] then x_add_y\n when [0,1,0] then rotate_x\n when [0,1,1] then x_and_y\n when [1,0,0] then x_or_y\n when [1,0,1] then x_xor_y\n when [1,1,0] then not_x\n when [1,1,1] then x_equal_y\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n @z\n end", "def single_number_32bit(nums)\n bits = 4\n arr = Array.new(bits, 0) # constant space\n\n for i in 0...bits\n nums.each do |num|\n n = (num >> i) & 1 # moving bit at most significant place, anding with 1 so that last bit will just give 1 or 0, because 1 is 0...00001\n arr[bits-i-1] += n\n end\n arr[bits-i-1] %= 3\n end\n\n result = 0\n puts arr.to_s\n for i in 0...bits\n result += (arr[i] << (bits-i-1))\n end\n result\nend", "def mutiply_all_element_of_an_array_excep_itself2(array_n)\n total_mutiplication_value = 1\n result_array = []\n \n array_n.each do |elm|\n total_mutiplication_value = elm * total_mutiplication_value\n end\n \n puts \"Total mutiplication : #{total_mutiplication_value}\"\n \n array_n.each do |elm|\n result = divide_by_bit_shift(total_mutiplication_value, elm)\n result_array.push(result[0])\n end\n \n\n return result_array\nend", "def initialize\n @global = Hash.new\n @procedures = Hash.new\n @operands_stack = Stack.new\n @operations_stack = Stack.new\n @jumps_stack = Stack.new\n @lines_counter = 0\n @cuadruples_array = Array.new\n @scope_location = nil\n @sing_variable = nil\n @arguments = Array.new\n @data_type = nil\n @is_ref = false\n @has_return = false\n @exp_call = false\n @arg_stack = Stack.new\n @call_stack = Stack.new\n @addr_const_val = nil\n @filename = \"output.txt\"\n # Change to 'true' to see verbose in cuadruples\n @debug = false\n # Memory scheme:\n # Global address -> direction 1000, with 1000 directions for every data type\n # -> Total width: 4000\n # Local address -> direction 5000, with 1000 directions for every data type\n # in the normal and temporal addresses\n # -> Total width: 8000\n # Constant address -> direction 13000, with 1500 directions for integers and\n # floats, but 2 directions for boolean and the rest for strings\n # -> Total width: 6000\n # Pointers addresses -> direction 19000, with 1000 directions for every data type\n # -> Total width: 4000\n @global_memory = Memory.new(1000, 4000)\n @local_memory = LocalMemory.new(5000, 8000)\n @const_memory = ConstantMemory.new(13000, 6000, [0.25, 0.25, 0.0005, 0.4995])\n @pointer_memory = Memory.new(19000, 4000)\n\n @semanthic_cube = {\n 'int' => {\n 'int' => {\n\t'=' => 'int',\n\t'+' => 'int',\n\t'-' => 'int',\n\t'*' => 'int',\n\t'/' => 'int',\n\t'and' => 'boolean',\n\t'or' => 'boolean',\n\t'>' => 'boolean',\n\t'>=' => 'boolean',\n\t'<' => 'boolean',\n\t'<=' => 'boolean',\n\t'==' => 'boolean',\n\t'!=' => 'boolean'\n },\n 'float' => {\n\t'=' => 'int',\n\t'+' => 'float',\n\t'-' => 'float',\n\t'*' => 'float',\n\t'/' => 'float',\n\t'and' => 'boolean',\n\t'or' => 'boolean',\n\t'>' => 'boolean',\n\t'>=' => 'boolean',\n\t'<' => 'boolean',\n\t'<=' => 'boolean',\n\t'==' => 'boolean',\n\t'!=' => 'boolean'\n },\n 'boolean' => {\n\t'=' => 'int',\n\t'and' => 'boolean',\n\t'or' => 'boolean'\n },\n 'not' => 'boolean'\n },\n 'float' => {\n 'int' => {\n\t'=' => 'float',\n\t'+' => 'float',\n\t'-' => 'float',\n\t'*' => 'float',\n\t'/' => 'float',\n\t'and' => 'boolean',\n\t'or' => 'boolean',\n\t'>' => 'boolean',\n\t'>=' => 'boolean',\n\t'<' => 'boolean',\n\t'<=' => 'boolean',\n\t'==' => 'boolean',\n\t'!=' => 'boolean'\n },\n 'float' => {\n\t'=' => 'float',\n\t'+' => 'float',\n\t'-' => 'float',\n\t'*' => 'float',\n\t'/' => 'float',\n\t'and' => 'boolean',\n\t'or' => 'boolean',\n\t'>' => 'boolean',\n\t'>=' => 'boolean',\n\t'<' => 'boolean',\n\t'<=' => 'boolean',\n\t'==' => 'boolean',\n\t'!=' => 'boolean'\n },\n 'boolean' => {\n\t'=' => 'float',\n\t'and' => 'boolean',\n\t'or' => 'boolean'\n },\n 'not' => 'boolean'\n },\n 'string' => {\n 'string' => {\n\t'=' => 'string',\n\t'+' => 'string'\n }\n },\n 'boolean' => {\n 'int' => {\n\t'=' => 'boolean',\n },\n 'float' => {\n\t'=' => 'boolean',\n },\n 'boolean' => {\n\t'=' => 'boolean',\n\t'and' => 'boolean',\n\t'or' => 'boolean'\n },\n 'not' => 'boolean'\n }\n }\n end", "def compute(array)\n\n index = 0\n while index < array.length\n code = array[index]\n instruction = code % 100\n case instruction\n when 1\n add(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 2\n multiply(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 3\n # Input\n consume_input(code, array, array[index + 1])\n index += 2\n when 4\n # Output\n write_to_output(code, array, array[index + 1])\n index += 2\n when 5\n bool, new_index = jump_if_true(code, array, array[index + 1], array[index + 2])\n\n index = bool ? new_index : index + 3\n when 6\n bool, new_index = jump_if_false(code, array, array[index + 1], array[index + 2])\n\n index = bool ? new_index : index + 3\n when 7\n less_than(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 8\n equals(code, array, array[index + 1], array[index + 2], array[index + 3])\n index += 4\n when 9\n add_to_relative_base(code, array, array[index + 1])\n index += 2\n when 99\n break\n else\n break\n end\n end\nend", "def test_pv_1\n pv = make_phase_vocoder(false, 512, 4, 128, 1.0, false, false, false)\n rd = make_sampler(0)\n map_channel(lambda do |y| phase_vocoder(pv, lambda do |dir| next_sample(rd) end) end)\n free_sampler(rd)\nend", "def compute\n loop do\n nargs = nil # force handling every case\n\n insn = @m[@ip]\n case insn % 100\n # ADD\n when 1\n nargs = 3\n write(2, read(0) + read(1))\n # MUL\n when 2\n nargs = 3\n write(2, read(0) * read(1))\n # INPUT\n when 3\n nargs = 1\n # puts \"#{name}: INqsize #{inq.size}\"\n val = inq.pop\n write(0, val)\n # puts \"#{name}: IN #{val}\"\n # OUTPUT\n when 4\n nargs = 1\n val = read(0)\n # puts \"#{name}: OUTqsize #{outq.size}\"\n outq.push(val)\n # puts \"#{name}: OUT #{val}\"\n # JUMP-IF-TRUE\n when 5\n nargs = 2\n if read(0) != 0\n @ip = read(1)\n nargs = -1\n end\n # JUMP-IF-FALSE\n when 6\n nargs = 2\n if read(0).zero?\n @ip = read(1)\n nargs = -1\n end\n # LESS-THAN\n when 7\n nargs = 3\n value = read(0) < read(1) ? 1 : 0\n write(2, value)\n # EQUALS\n when 8\n nargs = 3\n value = read(0) == read(1) ? 1 : 0\n write(2, value)\n when 99\n break\n else\n raise \"Unexpected opcode #{@m[@ip].inspect} at position #{@ip}\"\n end\n\n @ip += 1 + nargs\n end\n\n m[0]\n end", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def test_part1\n seed = [0, 1, 0, -1]\n signal = '59775675999083203307460316227239534744196788252810996056267313158415747954523514450220630777434694464147859581700598049220155996171361500188470573584309935232530483361639265796594588423475377664322506657596419440442622029687655170723364080344399753761821561397734310612361082481766777063437812858875338922334089288117184890884363091417446200960308625363997089394409607215164553325263177638484872071167142885096660905078567883997320316971939560903959842723210017598426984179521683810628956529638813221927079630736290924180307474765551066444888559156901159193212333302170502387548724998221103376187508278234838899434485116047387731626309521488967864391'.each_char.map(&:to_i)\n\n result = signal\n patterns = fft_patterns(signal, seed)\n 100.times do\n result = fft_phase(result, patterns)\n end\n assert_equal [2, 5, 1, 3, 1, 1, 2, 8], result[0..7] # <- correct\n # 25131128\n end", "def resolveXCH\r\n puts \"Before Swap, Register A: \" + @RegA.to_s + \"\\tRegister B: \" + @RegB.to_s\r\n temp = @RegA\r\n @RegA = @RegB\r\n @RegB = temp\r\n puts \"After Swap, Register A: \" + @RegA.to_s + \"\\tRegister B: \" + @RegB.to_s\r\n end", "def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end", "def cellon(start, dur, pitch0, amp, ampfun, betafun,\n beta0, beta1, betaat, betadc, ampat, ampdc, dis, pcrev, deg, pitch1,\n glissfun = [0, 0, 100, 0], glissat = 0.0, glissdc = 0.0,\n pvibfreq = 0.0, pvibpc = 0.0,\n pvibfun = [0, 1, 100, 1], pvibat = 0.0, pvibdc = 0.0,\n rvibfreq = 0.0, rvibpc = 0.0, rvibfun = [0, 1, 100, 1])\n\n pit1 = pitch1.zero? ? pitch0 : pitch1\n car = make_oscil(:frequency, pitch0)\n low = make_one_zero(0.5, -0.5)\n fmosc = make_oscil(:frequency, pitch0)\n fm = 0.0\n dur = dur.to_f\n pitch0 = pitch0.to_f\n pvib = make_triangle_wave(:frequency, pvibfreq, :amplitude, 1.0)\n rvib = make_rand_interp(:frequency, rvibfreq, :amplitude, 1.0)\n ampap = (ampat > 0.0 ? (100 * (ampat / dur)) : 25)\n ampdp = (ampdc > 0.0 ? (100 * (1.0 - ampdc / dur)) : 75)\n glsap = (glissat > 0.0 ? (100 * (glissat / dur)) : 25)\n glsdp = (glissdc > 0.0 ? (100 * (1.0 - glissdc / dur)) : 75)\n betap = (betaat > 0.0 ? (100 * (betaat / dur)) : 25)\n betdp = (betadc > 0.0 ? (100 * (1.0 - betadc / dur)) : 75)\n pvbap = (pvibat > 0.0 ? (100 * (pvibat / dur)) : 25)\n pvbdp = (pvibdc > 0.0 ? (100 * (1.0 - pvibdc / dur)) : 75)\n pvibenv = make_env(:envelope,\n stretch_envelope(pvibfun, 25, pvbap, 75, pvbdp),\n :scaler, hz2radians(pvibpc * pitch0),\n :duration, dur)\n rvibenv = make_env(:envelope, stretch_envelope(rvibfun),\n :duration, dur,\n :scaler, hz2radians(rvibpc * pitch0))\n glisenv = make_env(:envelope,\n stretch_envelope(glissfun, 25, glsap, 75, glsdp),\n :scaler, hz2radians(pit1 - pitch0),\n :duration, dur)\n amplenv = make_env(:envelope, stretch_envelope(ampfun, 25, ampap, 75, ampdp),\n :scaler, amp,\n :duration, dur)\n betaenv = make_env(:envelope, stretch_envelope(betafun, 25, betap, 75, betdp),\n :scaler, beta1 - beta0,\n :offset, beta0,\n :duration, dur)\n run_instrument(start, dur,\n :degree, deg,\n :distance, dis,\n :reverb_amount, pcrev) do\n vib = env(pvibenv) * triangle_wave(pvib) +\n env(rvibenv) * rand_interp(rvib) +\n env(glisenv)\n fm = one_zero(low, env(betaenv) * oscil(fmosc, fm + vib))\n env(amplenv) * oscil(car, fm + vib)\n end\nend", "def cycle_level_arduino_code\n []\n end", "def vox(start, dur, freq, amp, ampfun, freqfun, freqscl, voxfun, index, vibscl)\n f1 = []\n f2 = []\n f3 = []\n (voxfun.length - 1).step(1, -2) do |i|\n phon = Formants[voxfun[i]]\n x = voxfun[i - 1]\n f1.unshift(phon[0])\n f1.unshift(x)\n f2.unshift(phon[1])\n f2.unshift(x)\n f3.unshift(phon[2])\n f3.unshift(x)\n end\n car_os = make_oscil(:frequency, 0)\n of0 = make_oscil(:frequency, 0)\n of1 = make_oscil(:frequency, 0)\n of2 = make_oscil(:frequency, 0)\n of3 = make_oscil(:frequency, 0)\n of4 = make_oscil(:frequency, 0)\n of5 = make_oscil(:frequency, 0)\n ampf = make_env(:envelope, ampfun, :scaler, amp, :duration, dur)\n frmf1 = make_env(:envelope, f1, :duration, dur)\n frmf2 = make_env(:envelope, f2, :duration, dur)\n frmf3 = make_env(:envelope, f3, :duration, dur)\n freqf = make_env(:envelope, freqfun, :duration, dur, :scaler, freqscl * freq, :offset, freq)\n per_vib = make_triangle_wave(:frequency, 6, :amplitude, freq * vibscl)\n ran_vib = make_rand_interp(:frequency, 20, :amplitude, freq * 0.01)\n run_instrument(start, dur) do\n frq = env(freqf) + triangle_wave(per_vib) + rand_interp(ran_vib)\n car = index * oscil(car_os, hz2radians(frq))\n frm = env(frmf1)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq0 = hz2radians(frm_int * frq)\n frq1 = hz2radians((frm_int + 1) * frq)\n amp1 = frm0 - frm_int\n amp0 = 1.0 - amp1\n else\n frq1 = hz2radians(frm_int * frq)\n frq0 = hz2radians((frm_int + 1) * frq)\n amp0 = frm0 - frm_int\n amp1 = 1.0 - amp0\n end\n frm = env(frmf2)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq2 = hz2radians(frm_int * frq)\n frq3 = hz2radians((frm_int + 1) * frq)\n amp3 = frm0 - frm_int\n amp2 = 1.0 - amp3\n else\n frq3 = hz2radians(frm_int * frq)\n frq2 = hz2radians((frm_int + 1) * frq)\n amp2 = frm0 - frm_int\n amp3 = 1.0 - amp2\n end\n frm = env(frmf3)\n frm0 = frm / frq.to_f\n frm_int = frm0.floor\n if frm_int.even?\n frq4 = hz2radians(frm_int * frq)\n frq5 = hz2radians((frm_int + 1) * frq)\n amp5 = frm0 - frm_int\n amp4 = 1.0 - amp5\n else\n frq5 = hz2radians(frm_int * frq)\n frq4 = hz2radians((frm_int + 1) * frq)\n amp4 = frm0 - frm_int\n amp5 = 1.0 - amp4\n end\n env(ampf) * (0.8 * (amp0 * oscil(of0, frq0 + 0.2 * car) +\n amp1 * oscil(of1, frq1 + 0.2 * car)) +\n 0.15 * (amp2 * oscil(of2, frq2 + 0.5 * car) +\n amp3 * oscil(of3, frq3 + 0.5 * car)) +\n 0.05 * (amp4 * oscil(of4, frq4 + car) +\n amp5 * oscil(of5, frq5 + car)))\n end\nend", "def phase_one\n 8.times do\n @borneo.immunity_challenge.tribal_council()\n puts\n end\nend", "def calc_client_S(bb, a, k, x, u, n, g)\n modpow((bb - k * modpow(g, x, n)) % n, (a+ x * u), n)\n end", "def nrev_rb(*args)\n reverb_factor, lp_coeff, volume = nil\n optkey(args, binding,\n [:reverb_factor, 1.09],\n [:lp_coeff, 0.7],\n [:volume, 1.0])\n next_prime = lambda do |val|\n if val.prime?\n val\n else\n next_prime.call(val + 2)\n end\n end\n srscale = @srate / 25641\n dly_len = [1433, 1601, 1867, 2053, 2251, 2399,\n 347, 113, 37, 59, 53, 43, 37, 29, 19]\n dly_len.map! do |x|\n val = (x * srscale).round\n val += 1 if val.even?\n next_prime.call(val)\n end\n comb1 = make_comb(0.822 * reverb_factor, dly_len[0])\n comb2 = make_comb(0.802 * reverb_factor, dly_len[1])\n comb3 = make_comb(0.773 * reverb_factor, dly_len[2])\n comb4 = make_comb(0.753 * reverb_factor, dly_len[3])\n comb5 = make_comb(0.753 * reverb_factor, dly_len[4])\n comb6 = make_comb(0.733 * reverb_factor, dly_len[5])\n low = make_one_pole(lp_coeff, lp_coeff - 1.0)\n chan2 = (@channels > 1)\n chan4 = (@channels == 4)\n allpass1 = make_all_pass(-0.7, 0.7, dly_len[6])\n allpass2 = make_all_pass(-0.7, 0.7, dly_len[7])\n allpass3 = make_all_pass(-0.7, 0.7, dly_len[8])\n allpass4 = make_all_pass(-0.7, 0.7, dly_len[9]) # 10 for quad\n allpass5 = make_all_pass(-0.7, 0.7, dly_len[11])\n allpass6 = (chan2 ? make_all_pass(-0.7, 0.7, dly_len[12]) : nil)\n allpass7 = (chan4 ? make_all_pass(-0.7, 0.7, dly_len[13]) : nil)\n allpass8 = (chan4 ? make_all_pass(-0.7, 0.7, dly_len[14]) : nil)\n reverb_frame = make_frame(@channels)\n run_reverb() do |val, i|\n rev = volume * val\n outrev = all_pass(allpass4,\n one_pole(low,\n all_pass(allpass3,\n all_pass(allpass2,\n all_pass(allpass1,\n comb(comb1, rev) +\n comb(comb2, rev) +\n comb(comb3, rev) +\n comb(comb4, rev) +\n comb(comb5, rev) +\n comb(comb6, rev))))))\n frame_set!(reverb_frame, 0, all_pass(allpass5, outrev))\n frame_set!(reverb_frame, 1, all_pass(allpass6, outrev)) if chan2\n frame_set!(reverb_frame, 2, all_pass(allpass7, outrev)) if chan4\n frame_set!(reverb_frame, 3, all_pass(allpass8, outrev)) if chan4\n reverb_frame\n end\nend", "def rev(target)\n res = Array(32)\n 16.times do |i|\n a = target[i].ord ^ i ^ (16 * i)\n res[2*i+1] = a & 0xf\n res[2*(15-i)] = a >> 4\n end\n res.map{|c|c.to_s(16)}.join\nend", "def test_constants_mode_bit_combination\n 3.times.each do |j|\n 6.times.each do |i|\n if i < 3 then\n min_mode, max_mode = 2, 4\n else\n min_mode, max_mode = 3, 6\n end\n modes = ::Malody::Mode.constants.sample(rand(min_mode..max_mode))\n conv_index = (0...modes.size).to_a.sample(modes.size * j / 2)\n conv_index.each do |idx| modes[idx] = ::Malody::Mode.const_get(modes[idx]) end\n bits = modes.map do |mode| Symbol === mode ? ::Malody::Mode.get_bit(mode) : (1 << mode) end\n mode_sum = bits.inject(0, :+)\n mode_value = ::Malody::Mode.get_mode_value(*modes)\n refute_nil mode_value, \"Empty modes are not supposed to be allowed.\"\n assert_equal mode_sum, mode_value, \"Bits are expected to add each other as well.\"\n end\n end\n end", "def doubler(numbers)\n # Write your code here\n array=[]\n numbers.each do |num|\n array << num *= 2\n end\n array\nend", "def conn_graph_create(filename) \n ### Making the filename \n newfilename=make_filename(filename)\n\n tmpInpHash=Hash.new\n tmpOutHash=Hash.new\n commonSet = Array.new \n commonSet =commonSet.push(\"clk\") \n commonSet =commonSet.push(\"reset\") \n zero = '0'\n load_cycloHash() \n @block.each do |key,val|\n a = Array.new \n b = Array.new\n val.each_input() { |i| a.push(i)} \n tmpInpHash[key] = a\n val.each_output() { |x| b.push(x)}\n tmpOutHash[key] = b\n end # end for @block.....\n keys = @block.keys \n \n count = 0\n \n primaryKey = keys[count]\n ### connectivity hash -- where the modules are connected by common input port names\t\n @connInpHash = Hash.new { |k,v| v=Array.new}\n while (count <= keys.length) do\n for secondKey in 0... keys.length do\n tmp1 =Array.new\n tmpA = Array.new\n \n #### Uncomment the following 4 lines to get Input-Output connectivity \n # if (primaryKey != keys[secondKey]) then \n # if (tmpOutHash[primaryKey] & tmpInpHash[keys[secondKey]])then\n # tmp1 =tmpOutHash[primaryKey] & tmpInpHash[keys[secondKey]] ### Set intersection operator\n # end \n # end\n #### Uncomment the following 4 lines for Output-Output connetivity\n if (primaryKey != keys[secondKey] ) then \n if (tmpOutHash[primaryKey] & tmpOutHash[keys[secondKey]])then\n tmp1 =tmpOutHash[primaryKey] & tmpOutHash[keys[secondKey]]\n end \n end \n ####Uncomment the following 4 lines to get Input-Input connectivity \n #if (primaryKey != keys[secondKey])\n #if (tmpInpHash[primaryKey] & tmpInpHash[keys[secondKey]])then\n # tmp1 =tmpInpHash[primaryKey] & tmpInpHash[keys[secondKey]]\n #end \n #end\n ##### \n \n if (tmp1.length != 0 ) then \n tmpA = tmp1 - commonSet ## Set difference operator\n end\n if ( tmpA.length !=0 ) then \n @connInpHash[primaryKey] = @connInpHash[primaryKey].push(keys[secondKey])\n end # end of if\n end # end of for\n \n\n count = count+1\n primaryKey = keys[count] \n end # end of while\n @connInpHash.each{|h,k| puts h, k.inspect, \"\\n\"}\n #write_cyclo()\n write_und_file(newfilename) ## drawing undirected graphs\n end", "def minilang(program_str)\n register = 0\n stack = []\n commands = program_str.split(' ')\n\n commands.each do |command|\n case command\n when 'PUSH' then stack << register\n when 'ADD' then register += (stack.pop).to_i\n when 'SUB' then register -= (stack.pop).to_i\n when 'MULT' then register *= (stack.pop).to_i\n when 'DIV' then register /= (stack.pop).to_i\n when 'MOD' then register %= (stack.pop).to_i\n when 'POP' then register = (stack.pop).to_i\n when 'PRINT' then puts register\n else register = command.to_i\n end\n end\nend", "def basic_3\n x_range = (1..255)\n sum = 0\n x_range.step(1) { |n| sum = sum + n; print \"New number: #{n} Sum: #{sum}\\n\"; }\n puts\nend", "def pre_build (x4,x5)\n\t$assem [$prog_c][$byte_c[$prog_c]]=x5\n\tputs \"#{x5}\\t byte: #{$byte_c[$prog_c]}\\t cycles: #{x4}\\t total cycles: #{$cycle_c[$prog_c]}\\t address: #{$s_start+$byte_c[$prog_c]}\" \n\t$byte_c[$prog_c]+=1\n\tend", "def do_instruction(opcode)\n sym_op = get_opcode(opcode)\n\n # Byte components\n b1 = (opcode & 0xf000) >> 12\n b2 = (opcode & 0x0f00) >> 8\n b3 = (opcode & 0x00f0) >> 4\n b4 = (opcode & 0x000f)\n\n # print \"Op: \", sym_op, \" | \"\n # print \"Desc: \", get_opcode_desc(opcode), \"\\n\"\n\n # Massive opcode conditional incoming.\n case sym_op\n\n when \"00E0\"\n # Clear the screen.\n @display.each do |row|\n row.each do |col|\n col = 0\n end\n end\n\n when \"00EE\"\n # Return from a subroutine.\n @instruction_ptr = @stack[@stack_ptr]\n @stack_ptr -= 1;\n\n when \"0NNN\"\n # This one isn't actually used by games. Skip it.\n\n when \"1NNN\"\n # Jump to address NNN.\n @instruction_ptr = opcode & 0x0fff\n\n when \"2NNN\"\n # Call subroutine at NNN.\n @stack_ptr += 1\n @stack[@stack_ptr] = @instruction_ptr\n @instruction_ptr = opcode & 0x0fff\n\n when \"3XNN\"\n # Skips next instruction if VX == NN.\n if @registers[b2] == opcode & 0x00ff\n @instruction_ptr += 2\n end\n\n when \"4XNN\"\n # Skips next instruction if VX != NN.\n if @registers[b2] != opcode & 0x00ff\n @instruction_ptr += 2\n end\n\n when \"5XY0\"\n # Skips next instruction if VX == VY.\n if @registers[b2] == @registers[b3]\n @instruction_ptr += 2\n end\n\n when \"6XNN\"\n # Sets VX to NN.\n @registers[b2] = opcode & 0x00ff\n\n when \"7XNN\"\n # Adds NN to VX.\n @registers[b2] += opcode & 0x00ff\n\n when \"8XY0\"\n # Sets VX to VY.\n @registers[b2] += @registers[b3]\n\n when \"8XY1\"\n # Sets VX to (VX or VY).\n @registers[b2] |= @registers[b3]\n\n when \"8XY2\"\n # Sets VX to (VX and VY).\n @registers[b2] &= @registers[b3]\n\n when \"8XY3\"\n # Sets VX to (VX xor VY).\n @registers[b2] ^= @registers[b3]\n\n when \"8XY4\"\n # Adds VY to VX. Sets VF to 1 when carry, 0 otherwise.\n # Only keep lowest 8 bits.\n @registers[b2] += @registers[b3]\n if @registers[b2] > 0xff\n @registers[0xf] = 1\n else\n @registers[0xf] = 0\n end\n @registers[b2] &= 0xff\n\n when \"8XY5\"\n # Subtracts VY from VX. Sets VF to 0 when borrow, 1 otherwise.\n # Only keep lowest 8 bits.\n @registers[b2] -= @registers[b3]\n if @registers[b2] < 0\n @registers[0xf] = 0\n else\n @registers[0xf] = 1\n end\n @registers[b2] &= 0xff\n\n when \"8XY6\"\n # Shifts VX right by one. Sets VF to the LSB of VX before the shift.\n @registers[0xf] = @registers[b2] % 2\n @registers[b2] >>= 1\n\n when \"8XY7\"\n # Sets VX to (VY - VX). Sets VF to 0 when borrow, otherwise 1.\n # Only keep lowest 8 bits.\n @registers[b2] = @registers[b3] - @registers[b2]\n if @registers[b2] < 0\n @registers[0xf] = 0\n else\n @registers[0xf] = 1\n end\n @registers[b2] &= 0xff\n\n when \"8XYE\"\n # Shifts VX left by one. Sets VF to the MSB of VX before the shift.\n @registers[0xf] = (@registers[b2] / 0b1000 > 0 ? 1 : 0)\n @registers[b2] = @registers[b2] << 1 & 0b0111\n\n when \"9XY0\"\n # Skips next instruction if VX == VY.\n if @registers[b2] != @registers[b3]\n @instruction_ptr += 2\n end\n\n when \"ANNN\"\n # Set address register to NNN.\n @addr_register = opcode & 0x0fff\n\n when \"BNNN\"\n # Set instruction pointer to address NNN + V0\n @instruction_ptr = (opcode & 0x0fff) + @registers[0]\n\n when \"CXNN\"\n # Set VX to a random number and NN.\n @registers[b2] = [*0..(opcode & 0x00ff)].sample\n\n when \"DXYN\"\n # TODO this should draw sprites, not just memory bits.\n # Draw N bytes of sprites starting from address register I,\n # at coordinates VX, VY. XORd onto screen. If any sprites overwritten,\n # set VF to 1, otherwise, 0. Wrap sprites if they go outside coordinates.\n overwritten = 0\n for i in 0..b4\n col_offset = (b2 + i) / 0x40\n new_row = (b3 + col_offset) % 0x20\n new_col = b2 % 0x40\n old_pixel = @display[new_row][new_col]\n new_pixel = @memory[@addr_register+i]\n result = old_pixel ^ new_pixel\n\n @display[new_row][new_col] = result\n if old_pixel == 1 and new_pixel == 0\n overwritten = 1\n end\n end\n\n @registers[0xf] = overwritten\n\n when \"EX9E\"\n # Skip the next instruction if the key stored in VX is pressed.\n if keypad[b2] == 1\n @instruction_ptr += 2\n end\n\n when \"EXA1\"\n # Skip the next instruction if the key stored in VX isn't pressed.\n if keypad[b2] == 0\n @instruction_ptr += 2\n end\n\n when \"FX07\"\n # Set VX to the value of the delay timer.\n @registers[b2] = @timers[:delay]\n\n # TODO\n when \"FX0A\"\n # A key press is awaited, and then stored in VX.\n\n when \"FX15\"\n # Sets the delay timer to VX.\n @timers[:delay] = b2\n\n when \"FX18\"\n # Sets the sound timer to VX.\n @timers[:sound] = b2\n\n when \"FX1E\"\n # Adds VX to I\n @instruction_ptr += b2\n\n # TODO\n when \"FX29\"\n # Set I to the location of the sprite for the character in VX. Characters\n # 0-F (in hexadecimal) are represented by a 4x5 font.\n\n # TODO\n when \"FX33\"\n # Store the BCD representation of Vx in memory locations I, I+1, and I+2.\n # The interpreter takes the decimal value of Vx, and places the hundreds\n # digit in memory at location in I, the tens digit at location I+1, and\n # the ones digit at location I+2.\n\n when \"FX55\"\n # Store V0 to VX in memory starting at address I.\n for i in 0..b2\n @memory[@instruction_ptr + i] = @registers[i]\n end\n\n when \"FX65\"\n # Fill V0 to VX with values from memory starting at address I.\n for i in 0..b2\n @registers[i] = @memory[@instruction_ptr + i]\n end\n end\n end", "def instrument(midiIn, duration: 1.0, gmBank: \"000\", gmPatch: \"000\", gmPathDir: \"C:/Users/Michael Sutton/Midiloop/default/\", amp: 1.0, attack: 0.01, decay: 0.3, sustain: 0.5, release: 1.0, lpf: 128, hpf: 1, bpm: 60, pan: 0.0, glIn: \"none\", glFunc: \"none\", midiFlag: \"N\") \r\n\r\n #puts \"xgmPathDir: \" + gmPathDir.to_s\r\n if gmPathDir[0] == \"'\"\r\n testPathDir = gmPathDir[1...-1].to_s\r\n #puts \"testPathDir: \" + testPathDir.to_s\r\n #puts \"in 1\"\r\n end\r\n if gmBank[0] == \"'\"\r\n testBank = gmBank[1...-1]\r\n else\r\n testBank = gmBank\r\n end\r\n if gmPatch[0] == \"'\"\r\n testPatch = gmPatch[1...-1]\r\n else\r\n testPatch = gmPatch\r\n end\r\n if gmPathDir[0] == \"'\" \r\n sMixerPresetArray = buildGMSampleArray(testPathDir, testBank, testPatch)\r\n #puts \"using testPathDir\"\r\n else\r\n sMixerPresetArray = buildGMSampleArray(gmPathDir, testBank, testPatch)\r\n end\r\n presetMixerLineForPatch = sMixerPresetArray[0]\r\n presetMixerLineForPatchLength = presetMixerLineForPatch.length\r\n presetSettings = presetMixerLineForPatch[8..presetMixerLineForPatch.length].partition(\",\").last\r\n \r\n sampleToPlay = presetSettings.split(\",\")[7]\r\n if gmPathDir[0] == \"'\" \r\n sampleFileName = gmPathDir + sampleToPlay + \".pisf\"\r\n sampleArray = getSample(sampleFileName, gmPathDir) \r\n else\r\n sampleFileName = gmPathDir + sampleToPlay + \".pisf\"\r\n #puts \"sampleFileName: \" + sampleFileName.to_s\r\n sampleArray = getSample(sampleFileName, gmPathDir) \r\n end\r\n\r\n \r\n if lpf.to_i > 128 # override Frequency is not set so use the FC in the preset file\r\n lpfFreqCutoff = presetSettings.split(\",\")[4].to_f.floor\r\n else\r\n lpfFreqCutoff = lpf\r\n end\r\n if hpf.to_i < 2 # override Frequency is not set so use the FC in the preset file\r\n #hpfFreqCutoff = presetSettings.split(\",\")[4].to_f.floor\r\n hpfFreqCutoff = hpf\r\n else\r\n hpfFreqCutoff = hpf\r\n end\r\n\r\n ### Dead cide\r\n if midiIn.instance_of? Array \r\n if midiIn[0].instance_of? String\r\n midiSamplePlayer gmPathDir, midiIn, sampleArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, glIn, glFunc, midiFlag\r\n end\r\n end\r\n ##### \r\n\r\n if midiIn.instance_of? Symbol\r\n midiArray = []\r\n midiInStr = midiIn\r\n if gmPathDir[0] == \"'\" \r\n samplePlayer midiIn.to_i, duration, testPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n else\r\n samplePlayer midiIn.to_i, duration, gmPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n end\r\n if midiIn.kind_of? Integer\r\n if gmPathDir[0] == \"'\"\r\n if midiIn.to_i != -1 \r\n samplePlayer midiIn.to_i, duration, testPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n else\r\n if midiIn.to_i != -1\r\n samplePlayer midiIn.to_i, duration, gmPathDir, sampleArray, midiArray, presetSettings, attack, decay, sustain, release, lpfFreqCutoff, hpfFreqCutoff, amp, bpm, pan, midiFlag\r\n end\r\n end\r\n end\r\nend" ]
[ "0.6594194", "0.65275806", "0.5700699", "0.56970227", "0.5559927", "0.53669065", "0.53423995", "0.52245045", "0.5219603", "0.52098453", "0.51473993", "0.5113223", "0.50927085", "0.5054392", "0.50006187", "0.49979654", "0.49350786", "0.49280348", "0.49208134", "0.48980668", "0.4895669", "0.48847237", "0.48768488", "0.48606482", "0.4844259", "0.48156282", "0.48013058", "0.47997236", "0.4799263", "0.4763818", "0.47584167", "0.47473004", "0.4742473", "0.47408736", "0.47405767", "0.47341332", "0.47237754", "0.4721427", "0.47123638", "0.4681434", "0.46797368", "0.46786124", "0.46753561", "0.4671503", "0.46655884", "0.46640944", "0.46524957", "0.4651937", "0.4649812", "0.4645142", "0.46413675", "0.4639818", "0.4637709", "0.46024892", "0.46024692", "0.46024692", "0.46018627", "0.4588936", "0.45856097", "0.45806655", "0.45804897", "0.45729914", "0.45590696", "0.4558325", "0.45572668", "0.45527253", "0.45510986", "0.45484424", "0.4532092", "0.45311987", "0.45311674", "0.45197797", "0.45153034", "0.4502262", "0.44938266", "0.4492092", "0.44913256", "0.4490916", "0.4490287", "0.44841036", "0.4480509", "0.44789347", "0.4478114", "0.44752893", "0.44706333", "0.44657972", "0.44653603", "0.44643947", "0.44576743", "0.44576296", "0.44514823", "0.44499215", "0.44433048", "0.44401914", "0.44377625", "0.44344702", "0.4433357", "0.44331306", "0.44326225", "0.44306841", "0.44188282" ]
0.0
-1
2x1 MUX for the Signal Inverter Demonstrated The correctness of it in the VHDL programs. Essentially the logic table overlapped with XOR.
def MUX2X1(x,y) XOR(x,y); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def MUX4X1(x,y,a,b,op1,op0)\n\td = DECODER2(op1,op0)\n\tOR(OR(AND(x,d[0]),AND(y,d[1])),OR(AND(a,d[2]),AND(b,d[3])))\nend", "def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end", "def xor_d8\n end", "def invert() end", "def pattern_bits\n str = bits.to_s(2)\n str = str.rjust(self.step_count, '0')\n str.chars.collect{|x|x=='1'}\n end", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def encode_2d(n)\n n = (n ^ (n << 8)) & 0x00ff00ff\n n = (n ^ (n << 4)) & 0x0f0f0f0f\n n = (n ^ (n << 2)) & 0x33333333\n n = (n ^ (n << 1)) & 0x55555555\n return n\n end", "def invert; end", "def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend", "def invert\n end", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def DECODER2(x,y) \n\t#Sends out an array of decoded values\n\treturn AND(NOT(x),NOT(y)),AND(NOT(x),y),AND(x,NOT(y)),AND(x,y)\nend", "def multiplex\n\t\t\t\t\t1\n\t\t\t\tend", "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0])\n\tputs \"press enter to exit the program...\"\n\twait = gets\nend", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def c2= c; @c2 = (c == 1) ? 1 : 0; end", "def circuit_definitions\n split_lines.map do |line|\n input_definition, wire_id = line.split('->').map(&:strip)\n\n input_type, input_1, input_2 = if input_definition =~ /^\\d+$/\n ['SIGNAL', input_definition, nil]\n elsif input_definition =~ /^[a-z]{2}$/\n ['WIRE', input_definition, nil]\n else\n if input_definition.start_with?('NOT')\n input_definition.split(' ')\n else\n left_input_name, op_name, right_input_name = input_definition.split(' ')\n [op_name, left_input_name, right_input_name]\n end\n end\n\n [wire_id, input_type, input_1, input_2]\n end\n end", "def to_vhdl(level = 0)\n # The resulting string.\n res = \"\"\n\n # Generate the architecture's header\n # The instances' headers\n self.each_systemI do |systemI|\n systemT = systemI.systemT\n # Its entity\n res << (\" \" * level*3)\n res << \"component #{Low2VHDL.entity_name(systemT.name)}\\n\"\n res << (\" \" * (level+1)*3)\n # Its ports\n res << \"port(\\n\"\n # Inputs\n systemT.each_input do |input|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(input.name) << \": in \" \n res << input.type.to_vhdl << \";\\n\"\n end\n # Outputs\n systemT.each_output do |output|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(output.name) << \": out \" \n res << output.type.to_vhdl << \";\\n\"\n end\n # Inouts\n systemT.each_inout do |inout|\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(inout.name) << \": inout \" \n res << inout.type.to_vhdl << \";\\n\"\n end\n # Remove the last \";\" for conforming with VHDL syntax.\n res[-2..-1] = \"\\n\" if res[-2] == \";\"\n res << \" \" * ((level+1)*3)\n # Close the port declaration.\n res << \");\\n\"\n # Close the component.\n res << \" \" * (level*3)\n res << \"end component;\\n\\n\" \n end\n\n # Generate the architecture's type definition.\n # It is assumed that these types are all TypeDef.\n self.each_type do |type|\n res << (\" \" * level*3)\n res << \"type #{Low2VHDL.vhdl_name(type.name)} is \"\n res << type.def.to_vhdl(level+1)\n res << \";\\n\"\n end\n\n ## Generates the required mux functions.\n mtps = [] # The mux functions to generate by type.\n # Gather the mux functions to generate.\n self.each_scope_deep do |scope|\n # Checks the connections.\n scope.each_connection do |connection|\n connection.right.each_node_deep do |node|\n if node.is_a?(Select) then\n mtps << [node.type,node.each_choice.to_a.size]\n end\n end\n end\n # Checks the statements.\n scope.each_behavior do |behavior|\n behavior.block.each_node_deep do |node|\n if node.is_a?(Select) then\n mtps << [node.type,node.each_choice.to_a.size]\n end\n end\n end\n end\n # Generate the gathered functions (only one per type).\n mtps.uniq!\n mtps.each do |type,num|\n res << Low2VHDL.mux_function(type,num,\" \" * level*3)\n end\n\n # Generate the inner signals declaration.\n self.each_inner do |inner|\n res << \" \" * (level * 3)\n # General signal or constant signal?\n res << (inner.is_a?(SignalC) ? \"constant \" : \"signal \")\n # Signal name.\n res << Low2VHDL.vhdl_name(inner.name) << \": \"\n # Signal type.\n res << inner.type.to_vhdl(level) \n # Signal value.\n if inner.value then\n if inner.value.is_a?(Concat) then\n # Concat are to be given the expected type of the\n # elements for casting them equally.\n # res << \" := \" << inner.value.to_vhdl(inner.type.base,level)\n res << \" := \" << inner.value.to_vhdl(level,inner.type.base)\n else\n res << \" := \" << inner.value.to_vhdl(level)\n end\n end\n res << \";\\n\"\n end\n\n # Generate the architecture's content.\n res << \" \" * ((level-1)*3) << \"begin\\n\"\n\n # Generate the instances connections.\n self.each_systemI do |systemI| \n # Its Declaration.\n res << \" \" * (level*3)\n res << Low2VHDL.vhdl_name(systemI.name) << \": \"\n systemT = systemI.systemT\n res << Low2VHDL.entity_name(systemT.name).to_s << \"\\n\"\n res << \" \" * ((level+1)*3)\n # Its ports\n res << \"port map(\\n\"\n # Inputs\n systemT.each_input do |input|\n ref = self.extract_port_assign!(systemI,input)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(input.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Outputs\n systemT.each_output do |output|\n ref = self.extract_port_assign!(systemI,output)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(output.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Inouts\n systemT.each_inout do |inout|\n ref = self.extract_port_assign!(systemI,inout)\n if ref then\n res << \" \" * ((level+2)*3)\n res << Low2VHDL.vhdl_name(inout.name) << \" => \" \n res << ref.to_vhdl(level) \n res << \",\\n\"\n end\n end\n # Remove the last \";\" for conforming with VHDL syntax.\n res[-2..-1] = \"\\n\" if res[-2] == \",\"\n # Close the port map declaration.\n res << \" \" * ((level+1)*3)\n res << \");\\n\"\n end\n # Generate the connections.\n res << \"\\n\" if self.each_scope.any?\n self.each_scope_deep do |scope|\n scope.each_connection do |connection|\n res << connection.to_vhdl([],level)\n end\n end\n\n # Generate the behaviors.\n # Current scope's\n res << \"\\n\" if self.each_connection.any?\n self.each_scope_deep do |scope|\n scope.each_behavior do |behavior|\n res << behavior.to_vhdl(level)\n end\n end\n return res\n end", "def c1= c; @c1 = (c == 1) ? 1 : 0; end", "def toBinary (x)\n if (x>1)\n toBinary(x/2) + (x%2).to_s\n elsif x==1\n return x.to_s\n end\nend", "def mux\n raise \"not implemented yet\"\n end", "def interpret\r\n return __________________ # <<2\r\n end", "def clk\n case [@c2, @c1, @c0]\n when [0,0,0] then do_nothing;\n when [0,0,1] then x_add_y\n when [0,1,0] then rotate_x\n when [0,1,1] then x_and_y\n when [1,0,0] then x_or_y\n when [1,0,1] then x_xor_y\n when [1,1,0] then not_x\n when [1,1,1] then x_equal_y\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n @z\n end", "def bit_xor\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 52 )\n return_value = BitXorReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal238 = nil\n bit_and237 = nil\n bit_and239 = nil\n\n tree_for_char_literal238 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 593:5: bit_and ( '^' bit_and )*\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3918 )\n bit_and237 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and237.tree )\n end\n # at line 593:13: ( '^' bit_and )*\n while true # decision 55\n alt_55 = 2\n look_55_0 = @input.peek( 1 )\n\n if ( look_55_0 == HAT )\n alt_55 = 1\n\n end\n case alt_55\n when 1\n # at line 593:16: '^' bit_and\n char_literal238 = match( HAT, TOKENS_FOLLOWING_HAT_IN_bit_xor_3923 )\n if @state.backtracking == 0\n\n tree_for_char_literal238 = @adaptor.create_with_payload( char_literal238 )\n root_0 = @adaptor.become_root( tree_for_char_literal238, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_and_IN_bit_xor_3927 )\n bit_and239 = bit_and\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_and239.tree )\n end\n\n else\n break # out of loop for decision 55\n end\n end # loop for decision 55\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__, 52 )\n\n end\n \n return return_value\n end", "def invert(tape)\n\tm = SubMachine.empty \"invert-#{tape}\"\n\tm.states[m.first] = State.new([\n\t\tTransition.new( {tape => 0}, [Action.new(1, tape), Action.new(:right, tape)], m.first),\n\t\tTransition.new( {tape => 1}, [Action.new(0, tape), Action.new(:right, tape)], m.first),\n\t\tTransition.new( Hash.new, [Action.new(:left, tape), Action.new(:left, tape)], m.last)])\n\n\trewind = SubMachine.empty \"invert2-#{tape}\"\n\trewind.states[rewind.first].transitions = [\n\t\tTransition.new( {tape=>0}, [Action.new(:left, tape)], rewind.first),\n\t\tTransition.new( {tape=>1}, [Action.new(:left, tape)], rewind.first),\n\t\tTransition.new( Hash.new, [Action.new(:right, tape)], rewind.last)\n\t]\n\n\tm.simpleMerge rewind\n\tm.simpleMerge writeConstant(:ra, 1)\n\tm.simpleMerge add(tape, :ra)\n\n\tm\nend", "def state\n case [@c2, @c1, @c0]\n when [0,0,0] then \"Z -> Z\"\n when [0,0,1] then \"X + Y\"\n when [0,1,0] then \"rotate x\"\n when [0,1,1] then \"x & y\"\n when [1,0,0] then \"x | y\"\n when [1,0,1] then \"x ^ y\"\n when [1,1,0] then \"~ x\"\n when [1,1,1] then \"x == y\"\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n end", "def op2(interp, c1, c2, c3, c4)\n interp.stack.push([(((c1 << 24) | c2 << 16) | c3 << 8) | c4].pack('I').unpack('i').first)\n end", "def ein; end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def binary!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 7)\n\n type = BINARY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33:5: ( '-' )? '0b' ( '0' .. '1' )+\n # at line 33:5: ( '-' )?\n alt_13 = 2\n look_13_0 = @input.peek(1)\n\n if (look_13_0 == ?-) \n alt_13 = 1\n end\n case alt_13\n when 1\n # at line 33:5: '-'\n match(?-)\n\n end\n match(\"0b\")\n # at file 33:15: ( '0' .. '1' )+\n match_count_14 = 0\n loop do\n alt_14 = 2\n look_14_0 = @input.peek(1)\n\n if (look_14_0.between?(?0, ?1)) \n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 33:16: '0' .. '1'\n match_range(?0, ?1)\n\n else\n match_count_14 > 0 and break\n eee = EarlyExit(14)\n\n\n raise eee\n end\n match_count_14 += 1\n end\n\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__, 7)\n\n end", "def bit_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 51 )\n return_value = BitOrReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal235 = nil\n bit_xor234 = nil\n bit_xor236 = nil\n\n tree_for_char_literal235 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 589:5: bit_xor ( '|' bit_xor )*\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3894 )\n bit_xor234 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor234.tree )\n end\n # at line 589:13: ( '|' bit_xor )*\n while true # decision 54\n alt_54 = 2\n alt_54 = @dfa54.predict( @input )\n case alt_54\n when 1\n # at line 589:15: '|' bit_xor\n char_literal235 = match( PIPE, TOKENS_FOLLOWING_PIPE_IN_bit_or_3898 )\n if @state.backtracking == 0\n\n tree_for_char_literal235 = @adaptor.create_with_payload( char_literal235 )\n root_0 = @adaptor.become_root( tree_for_char_literal235, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_bit_xor_IN_bit_or_3902 )\n bit_xor236 = bit_xor\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, bit_xor236.tree )\n end\n\n else\n break # out of loop for decision 54\n end\n end # loop for decision 54\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__, 51 )\n\n end\n \n return return_value\n end", "def mixer_solve(a, b)\n val = invert_matrix(a, b)\n val and val[1]\n end", "def flip_bit(integer)\n binary = integer.to_s(2)\n max = 0\n current = 0\n prev = 0\n gap = 0\n\n binary.each_char do |char|\n if char == '1'\n current += 1\n gap = 0\n elsif char == '0'\n prev = current unless gap > 1\n current = 0\n gap += 1\n end\n max = [prev + current + 1, max].max\n end\n\n max\nend", "def xor_mhl\n value = @mmu[hl]\n xor_to_a value\n @clock += 2\n end", "def bits\n\t\t# Get a safe copy of the @bits array\n\t\tbts = @bits.clone\n\t\t##\n\t\t# If carrying and not [HACK catch the pattern tha breaks it by adding an extrax 1]\n\t\t##\n\t\tif @carrying && @bits[0,4] != [1, 0, 0, 0]\n\t\t\tbts\t\t= [1].concat @bits\n\t\tend\n\t\t# Return to the caller\n\t\tbts\n\tend", "def inverted; invert = true; self; end", "def translate_binary(bin)\n expr(BinaryExpression, lhs: visit(bin[0]), op: bin[1], rhs: visit(bin[2]), loc: bin)\n end", "def pushBit bit1, bit2\n\t\t# Round inputs to 0/1 just in case\n\t\tbit1, bit2 = bit1.round.to_i, bit2.round.to_i\n\t\t##\n\t\t# Bit selection : [0, 0] = 0, [1, 0] or [0, 1] = [0, 1], [1, 1] = carry the 1\n\t\t##\n\t\t# when [1, 1]\n\t\tif bit1 == 1 && bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\telse\n\t\t\t\t@carrying \t= true\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\t# when [0, 1] or [1, 0]\n\t\telsif bit1 == 1 || bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [0].concat @bits\n\t\t\telse\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\tend\n\t\t# when [0, 0]\n\t\telse\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\t\t@carrying = false\n\t\t\telse\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\tend\n\tend", "def xor_l\n end", "def pattern_indexes=(indexes)\n p_bits = ('0' * step_count)\n indexes.each do |index|\n p_bits[index] = '1'\n end\n self.bits = p_bits.rjust(self.step_count, '0').to_i(2)\n end", "def field_bc2(op)\n (op & 0x0000ffc0) >> 6\nend", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def reverse_bits_efficient(x)\n puts \"%032d\" % x.to_s(2)\n # //swap each two bits\n # //10101010...\n tmp1 = (x&0xAAAAAAAA)>>1; # 0xAAAAAAAA = \"101010...10\" 32 bit notation with all even positions as 1's\n # //010101010..\n tmp2 = (x&0x55555555)<<1; # 0x55555555 = \"010101...01\" 32 bit notation with all odd positions as 1's\n x = tmp1|tmp2\n # //swap each four bits\n # //11001100 \n tmp1 = (x&0xCCCCCCCC)>>2;\n # //0011\n tmp2 = (x&0x33333333)<<2;\n x = tmp1|tmp2\n # //swap every eight bits\n # //1111000011110000\n tmp1 = (x&0xF0F0F0F0)>>4;\n tmp2 = (x&0x0F0F0F0F)<<4;\n x = tmp1|tmp2\n # //swap every 8 bits\n tmp1 = (x&0xFF00FF00)>>8;\n tmp2= (x&0x00FF00FF)<<8;\n x = tmp1|tmp2\n # //swap every 16 bits\n tmp1 = (x&0xFFFF0000)>>16;\n tmp2 = (x&0x0000FFFF)<<16;\n x = tmp1|tmp2\n puts x.to_s(2)\nend", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def conversion_steps(a, b)\n xor = a ^ b\n count = 0\n until xor.zero?\n count += 1 if xor & 1 == 1\n xor >>= 1\n end\n count\nend", "def logical(input)\n if @invert\n if input == 0\n return true\n else\n return false\n end\n else\n if input == 0\n return false\n else\n return true\n end\n end\n end", "def invert\n self.class.new(type, -power, prefix)\n end", "def m85\n a = [0, 1, source(85)]\n a.one? do |x|\n sink x # $ hasValueFlow=85\n end\nend", "def board_to_nn_inputs(state)\n result = [0] * 27\n state.each.with_index {|v, i| result[3 * i + v + 1] = 1.0}\n result\n end", "def symmetrize(array)\n\t\tfirst_matrix = Matrix.rows(array)\n\t\tfirst_matrix.each_with_index do |e, row, col|\n\n\t\t\tunless e == first_matrix[col, row]\n\t\t\t\tif e == 0\n\t\t\t\t\t# puts row, col\n\t\t\t\t\t# puts our_matrix[col,row]\n\t\t\t\t\tarray[col][row] = 0\n\t\t\t\telsif e == 1\n\t\t\t\t\tarray[row][col] = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tsecond_matrix = Matrix.rows(array)\n\t\treturn second_matrix\n\tend", "def powers_of_2\r\n\t\tunless $powers_of_2\r\n\t\t\t$powers_of_2 = [1]\r\n\t\t\t((BASE_BYTE << 3) - 1).times do |i|\r\n\t\t\t\t$powers_of_2[i + 1] = $powers_of_2[i] << 1\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn $powers_of_2\r\n\tend", "def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end", "def eth_sw_en; eth_ctrl_bit(0); end", "def swap_bits_even_odd(x)\n puts \"#{x} --> #{x.to_s(2)}\"\n # Bitwise AND of a number with 0xAAAAAAAA gives all even bits of that number\n tmp1 = (x&0xAAAAAAAA)>>1; # 0xAAAAAAAA = \"101010...10\" 32 bit notation with all even positions as 1's\n # //010101010..\n # Bitwise AND of a number with 0x55555555 gives all odd bits of that number\n tmp2 = (x&0x55555555)<<1; # 0x55555555 = \"010101...01\" 32 bit notation with all odd positions as 1's\n x = tmp1|tmp2\n puts \"#{x} --> #{x.to_s(2)}\"\nend", "def mix_cols_inv(state)\n mixed_cols = state.column_vectors.map do |a|\n [\n GALIOS_MUL_14[a[0]] ^ GALIOS_MUL_11[a[1]] ^\n GALIOS_MUL_13[a[2]] ^ GALIOS_MUL_9[a[3]],\n\n GALIOS_MUL_9[a[0]] ^ GALIOS_MUL_14[a[1]] ^\n GALIOS_MUL_11[a[2]] ^ GALIOS_MUL_13[a[3]],\n\n GALIOS_MUL_13[a[0]] ^ GALIOS_MUL_9[a[1]] ^\n GALIOS_MUL_14[a[2]] ^ GALIOS_MUL_11[a[3]],\n\n GALIOS_MUL_11[a[0]] ^ GALIOS_MUL_13[a[1]] ^\n GALIOS_MUL_9[a[2]] ^ GALIOS_MUL_14[a[3]]\n ]\n end\n state = Matrix.columns(mixed_cols)\n print_state(state, __method__) if DEBUG\n state\n end", "def state2\n if current_tk.tag == :OPERATOR then\n if @op.size == 0 then\n @op.push current_tk.value\n elsif priority(current_tk.value) >= priority(@op.last)\n @op.push current_tk.value\n elsif priority(current_tk.value) < priority(@op.last)\n make_op\n @op.push current_tk.value\n end\n else\n @error = true\n end\n return :state0_1\n end", "def simplify(wire, value)\n values.unshift(value) if input_wires.delete(wire)\n end", "def xor_hl\n end", "def xor_d\n end", "def twist(x)\n hi_x = x >> 8\n lo_x = (x & 0xFF)\n (rlc8(hi_x) << 8) + (rlc8 lo_x)\n end", "def t__82!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 27)\n\n type = T__82\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33: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__, 27)\n\n end", "def demux\n x = []\n y = []\n self.each { |inz| raise \"wrong size (!= 2) - #{inz.inspect}\" if inz.size != 2; x << inz[0] ; y << inz[1] }\n [x,y]\n end", "def xor_b\n end", "def transmogrifier (a,b,c)\n (a*b)^c\n end", "def make_one_pole_swept\n y1 = 0.0\n lambda do |input, coef|\n y1 = (coef + 1) * input - coef * y1\n end\n end", "def emit\n # emit LHS, RHS, opcode\n @first.emit << @second.emit << OPCODES[@op]\n end", "def xor_e\n end", "def multiply_by_2(input)\n output = []\n input.reverse!\n input.each_with_index do |value, index|\n if index % 2 == 0\n output << value * 2\n else\n output << value\n end\n end\n output.reverse!\n end", "def to_db(ex,db)\n begin\n db_val1, hop_val1 = @expr1.to_db(ex,db)\n db_val2, hop_val2 = @expr2.to_db(ex,db)\n if @short\n #short-circuit\n if not db_val1.nil? and not db_val2.nil?\n #all calculated\n\n case op\n when 'and'\n db_cond=db.and(db_val1, db_val2)\n db_cond=db_val1 if db_cond.nil?\n return db_cond, self\n when 'or'\n return db.or(db_val1, db_val2), self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, self\n end\n else\n # sometnig cannot be calculated\n case op\n when 'or'\n # 8( all DB must be searched...\n return nil, self\n when 'and'\n return db_val2, self if(db_val1.nil?)\n return db_val1, self\n else\n hop_warn \"#{op}: unsupported short-cirtuit binary operator\"\n return nil, nil\n end\n end #if calculated\n elsif op == 'ins'\n # nodeset\n res = nil\n db_res = db.inset db_val1, db_val2\n return db_res, self\n else\n #full evaluation\n #if @pre_conv\n # hop_val1 = hop_val1.to_f\n # hop_val2 = hop_val2.to_f\n #end\n res = nil\n db_res = db.binary(db_val1,db_val2,@op)\n\n #res = res.to_s if @post_conv\n\n return db_res, self\n end\n rescue => e\n raise #e.message+' at line '+@code_line.to_s\n end\n end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def ^(p0) end", "def number_of_flipping_slots(integer1, integer2)\n (integer1 ^ integer2).to_s(2).count('1')\nend", "def interseccion(op_izq, op_der)\n op_izq & op_der # ese & es el mensaje (interseccion) entre arrays, no confundir con los & entre JPs y PCs\n end", "def xor_c\n end", "def transformation_into_apnf\n self.simplification\n unless @operator.nil?\n old_left = ( @left_sentence ? Sentence.new(@left_sentence) : nil )\n old_right = ( @right_sentence ? Sentence.new(@right_sentence) : nil )\n\n if @operator.is_negation?\n unless @right_sentence.operator.nil?\n case @right_sentence.operator.type\n when :implication\n apnf_rules_for_negated_implication\n\n # ******* NEW APNF RULES FOR NEGATED IMPLICATION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_implication()\n\n when :conjunction\n apnf_rules_for_negated_conjunction\n\n # ******* NEW APNF RULES FOR NEGATED CONJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_conjunction()\n\n when :disjunction\n apnf_rules_for_negated_disjunction\n\n # ******* NEW APNF RULES FOR NEGATED DISJUNCTION FORMULA CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_negated_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_negated_new_operator()\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n else\n case @operator.type\n when :implication\n apnf_rules_for_implication\n\n # ******* NEW APNF RULES FOR IMPLICATION CAN BE ADDED HERE AS A METHOD JUST LIKE THE METHOD ABOVE *******\n # ******* FOR EXAMPLE:\n new_apnf_rules_for_implication()\n\n # ******* OR NEW RULES FOR CONJUNCTION AND DISJUNCTION CAN BE ADDED TOO, IN A NEW OPTION FOR THE CASE\n # ******* FOR EXAMPLE:\n when :conjunction\n new_apnf_rules_for_conjunction()\n\n when :disjunction\n new_apnf_rules_for_disjunction()\n\n when :new_operator\n # ******* OR A NEW OPERATOR NOT USED BEFORE CAN BE ADDED IN THE SIMPLIFICATION - LIKE NEGATION FOR EXAMPLE *******\n\n # ******* AND A NEW SIMPLIFICATION RULE CAN BE ADDED TO THIS OPERATOR *******\n # ******* FOR EXAMPLE: *******\n apnf_rules_for_new_operator()\n\n end\n @left_sentence.transformation_into_apnf if @left_sentence\n @right_sentence.transformation_into_apnf if @right_sentence\n end\n\n unless Sentence.equals?(old_left, @left_sentence) && Sentence.equals?(old_right, @right_sentence)\n update\n end\n end\n self.simplification\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 decoder_stub(state)\n\n\t\t# add one xor operation for the key (see comment below)\n\t\tnumber_of_passes=state.buf.length/4+1\n\t\traise InvalidPayloadSizeException.new(\"The payload being encoded is too long (#{state.buf.length} bytes)\") if number_of_passes > 10240\n\t\traise InvalidPayloadSizeException.new(\"The payload is not padded to 4-bytes (#{state.buf.length} bytes)\") if state.buf.length%4 != 0\n\t\t\n\t\t# 16-bits not (again, see below)\n\t\treg_14 = (number_of_passes+1)^0xFFFF\n\t\tdecoder = Metasm::Shellcode.assemble(Metasm::MIPS.new(:little), <<EOS).encoded.data\n;\n; MIPS nul-free xor decoder\n;\n; (C) 2006 Julien TINNES\n; <julien at cr0.org>\n;\n; The first four bytes in encoded shellcode must be the xor key\n; This means that you have to put the xor key right after\n; this xor decoder\n; This key will be considered part of the encoded shellcode\n; by this decoder and will be xored, thus becoming 4NULs, meaning nop\n;\n; This is Linux-only because I use the cacheflush system call\n;\n; You can use shellforge to assemble this, but be sure to discard all\n; the nul bytes at the end (everything after x01\\\\x4a\\\\x54\\\\x0c)\n;\n; change 2 bytes in the first instruction's opcode with the number of passes\n; the number of passes is the number of xor operations to apply, which should be\n; 1 (for the key) + the number of 4-bytes words you have in your shellcode\n; you must encode ~(number_of_passes + 1) (to ensure that you're nul-free)\n\n\n;.text\n;.align\t2\n;.globl\tmain\n;.ent\tmain\n;.type\t\t main,@function\n\nmain:\n\nli macro reg, imm\n;\tlui reg, ((imm) >> 16) & 0ffffh\n;\tori reg, reg, (imm) & 0ffffh\n\taddiu reg, $0, imm\t\t; sufficient if imm.abs <= 0x7fff\nendm\n\n\tli(\t$14, #{reg_14})\t\t; 4 passes\n\tnor\t$14, $14, $0\t\t; put number of passes in $14\n\n\tli(\t$11,-73)\t\t; addend to calculated PC is 73\n;.set noreorder\nnext:\n\tbltzal $8, next\n;.set reorder\n\tslti $8, $0, 0x8282\n\tnor $11, $11, $0\t\t; addend in $9\t\n\taddu\t$25, $31, $11\t\t; $25 points to encoded shellcode +4 \n;\taddu\t$16, $31, $11\t\t; $16 too (enable if you want to pass correct parameters to cacheflush\n\n;\tlui\t$2, 0xDDDD \t\t; first part of the xor (old method)\n\tslti\t$23, $0, 0x8282 \t; store 0 in $23 (our counter)\n;\tori\t$17, $2, 0xDDDD \t; second part of the xor (old method)\n\tlw\t$17, -4($25)\t\t; load xor key in $17 \n\n\n\tli(\t$13, -5)\n\tnor\t$13, $13, $0\t\t; 4 in $13\n\n\taddi\t$15, $13, -3\t\t; 1 in $15\nloop:\n\tlw\t$8, -4($25)\n\n\taddu\t$23, $23, $15\t\t; increment counter\n\txor\t$3, $8, $17\n\tsltu\t$30, $23, $14\t\t; enough loops?\n\tsw\t$3, -4($25)\n\taddi\t$6, $13, -1\t\t; 3 in $6 (for cacheflush)\n\tbne\t$0, $30, loop\n\taddu\t$25, $25, $13\t\t; next instruction to decode :)\n\n\n;\taddiu\t$4, $16, -4\t \t; not checked by Linux\n;\tli $5,40 \t; not checked by Linux\n;\tli $6,3 \t; $6 is set above\n\n;\t.set noreorder\n\tli( $2, 4147) ; cacheflush\n\t;.ascii \"\\\\x01JT\\\\x0c\"\t\t; nul-free syscall\n\tsyscall 0x52950\n;\t.set reorder\n\n\n\t\t\t\t\t; write last decoder opcode and decoded shellcode\n;\tli $4,1 \t; stdout\n;\taddi\t$5, $16, -8\n;\tli $6,40 \t; how much to write \n;\t.set noreorder\n;\tli $2, 4004 ; write\n;\tsyscall\n;\t.set reorder\n\t\n\n\tnop\t\t\t\t; encoded shellcoded must be here (xor key right here ;)\n; $t9 (aka $25) points here\n\nEOS\n\t\t# put the key at the end of the decoder\n\t\tstate.decoder_key_offset = decoder.length - 4\n\n\t\treturn decoder\n\tend", "def bitwise_xor(num1, num2)\n bnum1 = num1.to_s(2)\n bnum2 = num2.to_s(2)\n band = (num1 | num2).to_s(2)\n puts \"num1 = \" + ( ' ' * bnum2.length ) + num1.to_s(2)\n puts \"num2 = \" + ( ' ' * bnum1.length ) + num2.to_s(2)\n puts \"b|& = \" + ( ' ' * ([bnum1.length, bnum2.length].min ) + band)\nend", "def input1\n [\n [1, 0, 0, 0, 1],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 4],\n [0, 0, 0, 1, 3]\n ]\nend", "def to_sxp_bin\n @operands.map(&:to_sxp_bin)\n end", "def matrix_power(n)\n base = [1, 1, 1, 0]\n res = [1, 0, 0, 1]\n matrix_2n = base\n \n while n > 0 do\n if n % 2 == 1\n res = mul(res, matrix_2n)\n end\n \n matrix_2n = mul(matrix_2n, matrix_2n)\n n >>= 1\n end\n \n res\nend", "def pattern_indexes\n self.bits ||= 0\n array = bits.to_s(2).rjust(self.step_count, '0').chars.each_with_index.map do |value, index|\n index if value == '1'\n end\n array.compact\n end", "def type\n if direction == \"output\" and width == 1\n return \"logic\"\n elsif direction == \"output\"\n return \"logic [#{lhs}:#{rhs}]\"\n elsif direction == \"input\" and not scalar? \n return \"[#{lhs}:#{rhs}]\"\n else\n return \"\"\n end\n end", "def simplify\n super\n return @x.x if @x.is_a? CAS::Invert\n return self.simplify_dictionary\n end", "def converse_bit(pixel) \n\t\tpixel.red /= 257\n\t\tpixel.green /= 257\n\t\tpixel.blue /= 257\n\t\t\n\tend", "def xor_a\n end", "def eth_sw_en=(val); eth_ctrl_bit(0, val); end", "def c0= c; @c0 = (c == 1) ? 1 : 0; end", "def not_r(idx)\n fail unless 2 <= idx and idx <= 13\n r = Reg.new(idx)\n tmp = Reg.new(idx + 1)\n # r = r & -r\n alu32to(:-, 0, r, tmp)\n alu32to(:&, r, tmp, r)\n # r %= 3\n alu32to(:/, r, 3, tmp)\n alu32to(:*, tmp, 3, tmp)\n alu32to(:-, r, tmp, r)\n # r = (2 ^ r) / 2\n alu32to(:^, 2, r, r)\n alu32to(:>>, r, 1, r)\nend", "def bothV\n [outV, inV]\n end", "def opposite_ssex\n OPPOSITESEX[ssex]\n end", "def bit_and\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 53 )\n return_value = BitAndReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n char_literal241 = nil\n equality240 = nil\n equality242 = nil\n\n tree_for_char_literal241 = nil\n\n begin\n root_0 = @adaptor.create_flat_list\n\n\n # at line 597:5: equality ( '&' equality )*\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3943 )\n equality240 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality240.tree )\n end\n # at line 597:14: ( '&' equality )*\n while true # decision 56\n alt_56 = 2\n look_56_0 = @input.peek( 1 )\n\n if ( look_56_0 == AMP )\n alt_56 = 1\n\n end\n case alt_56\n when 1\n # at line 597:17: '&' equality\n char_literal241 = match( AMP, TOKENS_FOLLOWING_AMP_IN_bit_and_3948 )\n if @state.backtracking == 0\n\n tree_for_char_literal241 = @adaptor.create_with_payload( char_literal241 )\n root_0 = @adaptor.become_root( tree_for_char_literal241, root_0 )\n\n end\n @state.following.push( TOKENS_FOLLOWING_equality_IN_bit_and_3952 )\n equality242 = equality\n @state.following.pop\n if @state.backtracking == 0\n @adaptor.add_child( root_0, equality242.tree )\n end\n\n else\n break # out of loop for decision 56\n end\n end # loop for decision 56\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__, 53 )\n\n end\n \n return return_value\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def to_expr\n return @signal.to_expr\n end" ]
[ "0.61308324", "0.60354596", "0.56096935", "0.49807534", "0.48948556", "0.48775753", "0.48574287", "0.48422933", "0.48116565", "0.48076978", "0.48066938", "0.47816104", "0.4742279", "0.47189614", "0.46197274", "0.46128288", "0.4603881", "0.46037883", "0.45805857", "0.45781627", "0.45754156", "0.45571637", "0.45434472", "0.45358616", "0.45345846", "0.45286617", "0.45112616", "0.4492414", "0.44900075", "0.44569027", "0.44562292", "0.44524822", "0.4427796", "0.44141033", "0.44123027", "0.44062728", "0.4406106", "0.43947867", "0.43847793", "0.4381874", "0.4379859", "0.4378907", "0.43767774", "0.43727854", "0.43715784", "0.4367052", "0.4352036", "0.43387353", "0.43302497", "0.4328751", "0.43256226", "0.43248686", "0.4318793", "0.43092838", "0.43018672", "0.42922843", "0.42913938", "0.42859307", "0.4284879", "0.42833692", "0.42816818", "0.4276007", "0.42737755", "0.42697078", "0.42638034", "0.42570442", "0.42555", "0.42424902", "0.42376828", "0.42368126", "0.4214453", "0.41901952", "0.41901952", "0.41901952", "0.41901952", "0.41901952", "0.41887784", "0.41887105", "0.41880322", "0.41877842", "0.41798073", "0.41798073", "0.41662467", "0.41625768", "0.4161058", "0.41607583", "0.41557804", "0.41530508", "0.41490257", "0.41474786", "0.41468796", "0.41396165", "0.41390184", "0.41381937", "0.41274214", "0.4126751", "0.41261658", "0.41251376", "0.41214055", "0.4120932" ]
0.7046255
0
1Bit FullAdder Built Structurally, it outputs sum and carry out as a 2 element array
def ADDER(a,b,cin) return XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summing_method\n @summed_array = @single_digit_array.sum\n end", "def full_adder (p, q, carry_in=0)\n first_adder = half_adder(p,q)\n second_adder = half_adder(first_adder[0],carry_in)\n carry_out = first_adder[1] | second_adder[1]\n sum_out = second_adder[0]\n return sum_out, carry_out\nend", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def n_bit_adder (p,q)\n result=[]\n p_array = p.to_s(2).split(\"\")\n q_array = q.to_s(2).split(\"\")\n p_array.map! {|digit| digit.to_i}\n q_array.map! {|digit| digit.to_i}\n padded_input = even_the_bit_lengths(p_array,q_array)\n p_array = padded_input[0]\n q_array = padded_input[1]\n carry_in = 0\n while p_array.length != 0\n full_adder_out = full_adder(p_array.pop, q_array.pop, carry_in)\n result.unshift(full_adder_out[0])\n carry_in = full_adder_out[1]\n end\n result.unshift(carry_in)\n result\nend", "def summing_method(single_digit_array)\n summed_array = single_digit_array.sum\nend", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def sum_machine(input_array)\n\toutput = input_array[0] + input_array[1]\n\treturn output\nend", "def sum1(array)\n# array.each do |i|\n# array[i].concat\n# end\n# end\n\nholder = 0\narray.each {|a| holder+=a }\nend", "def running_total1(array)\n array_new = []\n loop do\n break if array.empty?\n array_new << array[0]\n array[1] = array[0] + array[1] if array.size >= 2\n array.shift\n end\n array_new\nend", "def arraysum\n return self.inject(0){|acc,i|acc +i}\n end", "def sum(array)\n out = 0\n i = 0\n while i < array.length\n out += array[i]\n i += 1\n end\n return out\nend", "def naive_parts_sums(ls)\n out_array = []\n while ls.length > 0\n current_sum = ls.sum\n out_array << current_sum\n ls.shift\n end\n out_array << 0\n return out_array\nend", "def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend", "def sum(array)\n return 0 if array.empty?\n sum(array.drop(1)) + array.first\nend", "def sum1(array)\r\n sum = 0\r\n array.each do |number|\r\n sum += number\r\n end\r\n sum\r\nend", "def simpleArraySum(ar)\n ar.sum\nend", "def add_binary a, b\n return_arr = con_to_binary(a + b)\n return_arr.shift if return_arr[0] == \"0\"\n return_arr.join\nend", "def ary_add(array)\n if array.length.even?\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n end\n return final_ary\n else\n last_obj = array.pop\n ary_couples = array.each_slice(2)\n final_ary = []\n ary_couples.each do |duo|\n ary_sum = duo[0] + duo[-1]\n final_ary << ary_sum \n \n end\n return final_ary << last_obj\n end \nend", "def add_binary(a, b)\n ca = a.size - 1\n cb = b.size - 1\n carry = 0\n ans = ''\n while ca >= 0 && cb >= 0 do \n diga = a[ca].to_i\n digb = b[cb].to_i\n sum = diga + digb + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n ca -= 1\n cb -= 1\n end\n \n while ca >= 0\n diga = a[ca].to_i\n sum = diga + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n ca -= 1\n end \n\n while cb >= 0\n digb = b[cb].to_i\n sum = digb + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n cb -= 1\n end\n\n carry > 0 ? ans.prepend(carry.to_s) : ans\n ans\nend", "def part1AccumulatorFunction()\n ->(acc,digest) { acc + [digest] }\nend", "def simpleArraySum(ar)\n ar.sum\nend", "def sum(array)\n output = 0\n i = 0\n while i < array.length\n output += array[i]\n i += 1\n end\n return output\nend", "def sum(array)\n i = 0\n output = 0\n\n while i < array.length \n output += array[i]\n i += 1\n end\n return output\nend", "def parts_sums(input_array)\n total = input_array.sum\n output = [total]\n input_array.size.times do \n total = total - input_array.shift\n output << total\n end\n output\nend", "def sum(array)\n return array.inject(0, &:+)\nend", "def array_sum(array)\r\n array.inject(0, :+)\r\nend", "def sum(array)\n array.reduce(0) {|base, ele|\n base+=ele\n }\n end", "def two1 a; a[0] + a[1] end", "def sum_array( numbers )\r\n numbers.inject(0, :+)\r\nend", "def prefix_sums(arr)\n arr_size = arr.size\n p_arr = Array.new(arr_size, 0)\n p_arr[0] = arr[0]\n\n (1...arr.size).each do |k|\n p_arr[k] = p_arr[k - 1] + arr[k]\n end\n\n p_arr\nend", "def doubler(array)\r\n res = []\r\n array.each do |ele|\r\n res << ele * 2\r\n end\r\n res\r\nend", "def sum(array)\n array.inject(0, :+)\nend", "def main(arr, mod_len)\n arr.sum.to_s[0...mod_len].to_i\nend", "def partial_sums(array)\n new_list = [0]\n array.each_with_index do |num, i|\n new_list.push(num + new_list[0 + i])\n end\n return new_list\nend", "def single_number_32bit(nums)\n bits = 4\n arr = Array.new(bits, 0) # constant space\n\n for i in 0...bits\n nums.each do |num|\n n = (num >> i) & 1 # moving bit at most significant place, anding with 1 so that last bit will just give 1 or 0, because 1 is 0...00001\n arr[bits-i-1] += n\n end\n arr[bits-i-1] %= 3\n end\n\n result = 0\n puts arr.to_s\n for i in 0...bits\n result += (arr[i] << (bits-i-1))\n end\n result\nend", "def sum(arr)\n return 0 if arr.empty?\n el = arr.shift\n total = sum(arr)\n total + el\nend", "def total(array)\n \n len = array.length\n i = 0\n sum = 0\n \n while i < len do\n sum = sum + array[i]\n i = i + 1\n end\n return sum\nend", "def total(array)\n\tx = array.length\n\tsum = 0\n\t\twhile x > 0\n\t\t\tsum += array[x-1]\n\t\t\tx -= 1\n\t\tend\n\n\treturn sum\n\nend", "def sum_of_sums(array)\r\nend", "def alt_adder(*args)\n\targs.inject(0){|total, num| total + num if num.is_a? Fixnum}\nend", "def add_binary(a,b)\r\n sum = a + b\r\n arr = []\r\n if sum == 1\r\n p \"1\"\r\n else #if sum != 1\r\n arr.push(sum % 2) \r\n while sum / 2 != 0\r\n sum = sum / 2\r\n arr.push(sum % 2)\r\n end\r\n p arr.reverse.join\r\n end\r\nend", "def to_a(bits_per_element)\n out_array = Array.new\n for ptr in 0.step(@fuse_data.length, bits_per_element) do\n out_element = 0\n @fuse_data[ptr..ptr+bits_per_element-1].each { |bit|\n out_element = out_element << 1\n out_element |= 1 if bit == 1\n }\n out_array.push out_element\n end\n out_array\n end", "def simpleArraySum(ar)\n #\n # Write your code here.\n #\n ar.reduce(&:+)\nend", "def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend", "def sum(array)\n return 0 if array.empty?\n array.first + sum(array[1..-1])\nend", "def sum(array)\n\tarray.reduce(:+)\nend", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def sum(*array)\n i = 0\n sum = 0\n array=[]\n while i < array.length do\n sum += sum[i]\n #array.push\n i += 1\n# puts(\"Inside the loop sum = #{sum}\") \n end\n return sum\nend", "def sum(array)\n return 0 if array.empty?\n return array.first if array.length == 1\n\n array.inject(:+)\nend", "def two_sum\n output = []\n \n i = 0\n while i < self.length - 1\n j = i + 1\n while j < self.length\n output << [i, j] if self[i] + self[j] == 0\n j += 1 \n end\n i += 1\n end\n\n output.empty? ? nil : output\n end", "def total(array)\n a = 0\n for i in 0...array.length\n a = a + array[i]\n end\n return a\nend", "def add_binary(a, b)\n n = a.size \n m = b.size \n return add_binary(b,a) if n<m\n l = [n,m].max \n j = m-1\n i = l-1\n carry = 0\n sb = \"\"\n i.downto(0) do |i|\n carry +=1 if a[i] == \"1\"\n carry +=1 if b[j] == \"1\" && j>-1\n if (carry%2) == 1\n sb += \"1\"\n else\n sb += \"0\"\n end\n\n carry = carry/2 \n j-=1 \n end\n sb += \"1\" if carry == 1 \n return sb.reverse!\nend", "def simple_array_sum arr\n arr.reduce(:+)\n end", "def sum (arr)\n\treturn arr.inject(0, :+)\nend", "def total(array)\n\tsum = array.inject(0, :+)\nend", "def fib(length)\n# The original array\n array = [0, 1]\n# i-counter will always be one ahead of the length(input) parameter\n i = 1 \n# Taking care of the edge cases\n if length == 0\n array = []\n elsif length == 1\n array = [0]\n elsif length == 2\n array\n else \n# Take array[i] + array[i-1] then add to the original array\n while i < length - 1\n array.push(array[i] + array[i-1])\n i += 1\n end\n array\n end\nend", "def sum(array)\n sum = 0\n i = 0\n while i < array.length\n sum = sum + array[i]\n i = i + 1\n end\n return sum\nend", "def partialSums(arr)\n sums = [0]\n arr.inject(0) do |memo,x|\n sums.push(memo+x)\n memo+x\n end\n sums\nend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def sum(array)\n sum = 0\n i = 0\n while i < array.length\n sum += array[i]\n i += 1\n end\n return sum\nend", "def sum(array)\n s = 0\n\tarray.each {|x| s+= x}\n\ts\nend", "def sum arr\n arr.inject(0, :+) \nend", "def sum_array(array)\n array.inject(0) {|result_memo, element| result_memo + element}\nend", "def multi_dimensional_sum(array)\n while !array.all? { |el| el.is_a?(Numeric) }\n array = unpack(array)\n end\n return array.sum\nend", "def sum(arr)\r\n output = 0\r\n i = 0\r\n while i < arr.length\r\n output = output + arr[i]\r\n i += 1\r\n end\r\n return output\r\nend", "def direct_run_length_encode\n self.inject([[0, nil]]) do |array, current|\n if array[-1][-1] == current or array[-1][-1].nil?\n array[-1][-1] = current\n array[-1][0] += 1 \n else\n array[-1] = array[-1][-1] if array[-1][0] == 1\n array << [1, current]\n end\n array\n end\n end", "def partial_sums(arr)\n sums = [0]\n arr.inject(0) do |memo,x|\n sums.push(memo+x)\n memo+x\n end\n sums\nend", "def sum_array_rec(array_to_sum)\n if(array_to_sum.length > 0)\n sum = array_to_sum[0]\n sum += sum_array_rec(array_to_sum[1..-1])\n else\n 0\n end\nend", "def sum_an_array(arr)\n p arr\n return 0 if arr.empty?\n return arr[0] if arr.length == 1\n # first = arr[0]\n # rest = sum_an_array(arr[1..-1])\n # total = first + rest\n left = arr[0...arr.length/2]\n right = arr[arr.length/2..-1]\n p left\n p right\n left_sum = sum_an_array(left)\n right_sum = sum_an_array(right)\n total = left_sum + right_sum\nend", "def sum(arr)\n\tarr.inject (:+)\n\nend", "def total(array)\n\tlength = array.length\n\tsum = 0 \n\tfor i in 0...length\n\tsum = sum + array[i]\n\tend\n\tsum\nend", "def sum_of_sums(array)\n size = array.size \n index = 0\n sum = 0\n \n while index < array.size\n sum += (array[index] * size)\n index += 1\n size -= 1\n end\n \nsum\n \nend", "def sum(array)\n return array[0] if array.length == 1\n return array[0] + sum(array[1, array.length - 1])\nend", "def sum(array)\n\treturn array.reduce(:+)\nend", "def sum_array(int_array)\n int_array.reduce(:+)\nend", "def array_transform(array)\n\tb = []\n\tarray.each_index do |i|\n\t\tb.push(array[i]+array[i-1])\tif i > 0\n\tend\n\treturn b.unshift(1).push(1)\nend", "def prefix_sum(counts_array)\n prefix_sum = counts_array\n 1.upto(prefix_sum.size - 1) do |indx|\n prefix_sum[indx] = prefix_sum[indx] + prefix_sum[indx - 1]\n end\n prefix_sum\nend", "def _reduce_341(val, _values, result)\n result = val[1]\n \n result\nend", "def sum arr\n arr.inject(0,:+)\nend", "def sum arr\n arr.inject(0,:+)\nend", "def sum arr\n arr.reduce 0, :+ # reduce method is clearlier than inject. from 0 add to +:\nend", "def running_total(array1)\n array2 = []\n sum = 0\n array1.each do |num|\n array2 << sum += num \n end\n puts \"running_total(#{array1}) == #{array2}\"\nend", "def sum_array(any_array)\n any_array.inject(:+)\n end", "def FFT4(in_signal, in_step)\n the_signal_size = in_signal.size\n phase_array = phase_array_for_step(in_step)\n phase_array_size = phase_array.size\n\n the_start_index = in_step - 1 # skip the leading zeros\n sum = 0\n phase_array[the_start_index..-1].each_with_index do |val, i|\n if val != 0 && i < the_signal_size\n the_index = i + the_start_index\n part_sum = 0\n while the_index < the_signal_size\n part_sum += in_signal[the_index]\n the_index += phase_array_size\n end\n sum += (val * part_sum)\n end\n end\n sum.abs % 10\nend", "def double_array(array)\n array + array\nend", "def total(array)\n i = 0\n answer = 0\n\n while i < array.length\n answer += array[i]\n i += 1\n end\n return answer\nend", "def total(array)\n i = 0\n answer = 0\n\n while i < array.length\n answer += array[i]\n i += 1\n end\n return answer\nend", "def total (array)\n\tindex = 0\n\tsum = 0\n\twhile index < array.length\n\t\tsum = sum + array[index]\n\t\tindex += 1\n\tend\n\treturn sum\nend", "def total array\n array.inject(0){|sum,x| sum + x }\nend", "def one(array)\n array.shift\n array << 6\nend", "def sum(array)\n i = 0\n output = 0\n while i < array.length\n output += array[i].to_int\n i += 1\n end\n return output\nend", "def sum_upon_sums(array)\n\nend", "def sum_array(array)\n #array.inject(0){|sum,x| sum + x }\n array.inject(0){|sum,x| sum + x }\nend", "def sum_array(array)\nsum = 0\n for i in 0..array.length-1\n sum = sum+ array[i]\n end\n return sum\nend", "def running_total(array)\n output = []\n return output if array.empty?\n output[0] = array[0]\n counter = 1\n\n while counter < array.size\n output << (output[counter - 1] + array[counter])\n counter += 1\n end\n output\n end", "def sum(arr)\n output = 0\n i = 0\n while i < arr.length\n output += arr[i]\n i += 1\n end\n return output\nend", "def calculate_doubles(arr)\n array = []\n arr.each {|x| array << x + x}\n array\n\nend", "def my_sum(arr)\n accumulator = arr.first # store first element as accumulator\n\n arr.each_index do |idx|\n next if idx == 0 # skip first element: it's already the accumulator\n accumulator += arr[idx] # increment accumulator by current element\n end\n\n accumulator\nend", "def sum (array)\n y=array.inject(:+).to_i\nend", "def add_binary(a, b)\n if a.length != b.length\n raise(ArgumentError, 'A and B are not equal length')\n end\n\n c = []\n carry = 0\n\n (a.length - 1).downto(0) do |i|\n int_a = a[i].to_i\n int_b = b[i].to_i\n\n c[i + 1] = (int_a + int_b + carry) % 2\n\n if int_a + int_b + carry >= 2\n carry = 1\n else\n carry = 0\n end\n end\n\n c[0] = carry\n c\nend", "def add_binary(a,b)\n return nil if( a.nil? && b.nil?)\n return a if( b.nil? || b.empty?)\n return b if( a.nil? || a.empty?)\n a_n = a.size\n b_n = b.size\n i = 0\n carry = 0\n result = ''\n while(i < a_n || i < b_n)\n if i >= a_n\n a_i = 0\n b_i = b[b_n - i -1].to_i\n elsif i >= b_n\n b_i = 0\n a_i = a[a_n - i - 1].to_i\n else\n b_i = b[b_n - i -1].to_i\n a_i = a[a_n - i - 1].to_i\n end\n add = a_i + b_i + carry\n result.prepend(add == 0 ? '0' : '1')\n carry = add < 2 ? 0 : 1\n i = i + 1\n end\n result.prepend('1') if carry == 1\n return result\nend" ]
[ "0.6483883", "0.6384265", "0.616403", "0.6076779", "0.6051895", "0.6030464", "0.60271865", "0.5995438", "0.5946434", "0.58819675", "0.57304466", "0.5717562", "0.5693188", "0.5693188", "0.5688276", "0.56681", "0.5656483", "0.5644136", "0.5634154", "0.5622131", "0.56212807", "0.5618961", "0.5596861", "0.5592657", "0.55920506", "0.5577803", "0.557281", "0.55634844", "0.5562636", "0.5541079", "0.552706", "0.55154264", "0.5504371", "0.549664", "0.54954386", "0.54829764", "0.5482963", "0.548132", "0.54634297", "0.5460964", "0.5450557", "0.544822", "0.5447677", "0.54461086", "0.5439451", "0.5429769", "0.54262227", "0.542098", "0.5419669", "0.5419114", "0.5419084", "0.54186285", "0.54044247", "0.540106", "0.5401004", "0.5400864", "0.5400577", "0.53959084", "0.53954023", "0.53882027", "0.53880036", "0.5371018", "0.5368091", "0.53654724", "0.53611165", "0.53581405", "0.535062", "0.53442603", "0.5336822", "0.53343976", "0.53335816", "0.5333501", "0.53216654", "0.5318636", "0.53182876", "0.531152", "0.5309506", "0.53084356", "0.53074986", "0.53074986", "0.53024685", "0.5297413", "0.5291353", "0.5288982", "0.52872205", "0.5286492", "0.5286492", "0.52863765", "0.5276657", "0.5275888", "0.52729326", "0.52709997", "0.52704006", "0.52642983", "0.5262865", "0.52613914", "0.52583164", "0.5257668", "0.52484226", "0.5244174", "0.5242346" ]
0.0
-1
2BitDecoder Maps a 2bit op signal into a size 4 array of signals. Only one of which are true.
def DECODER2(x,y) #Sends out an array of decoded values return AND(NOT(x),NOT(y)),AND(NOT(x),y),AND(x,NOT(y)),AND(x,y) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decoder_stub(state)\n\t\t[\n\t\t\t0x7ca52a79, # 0x1da4 <main>: xor. r5,r5,r5\n\t\t\t0x4082fffd, # 0x1da8 <main+4>: bnel+ 0x1da4 <main>\n\t\t\t0x7fe802a6, # 0x1dac <main+8>: mflr r31\n\t\t\t0x3bffd00c, # 0x1db0 <main+12>: addi r31,r31,-12276\n\t\t\t0x38a53030, # 0x1db4 <main+16>: addi r5,r5,12336\n\t\t\t0x3cc00102, # 0x1db8 <main+20>: lis r6, hi16(key)\n\t\t\t0x60c60304, # 0x1dbc <main+24>: ori r6,r6, lo16(key)\n\t\t\t0x811f3030, # 0x1dc0 <main+28>: lwz r8,12336(r31)\n\t\t\t0x7d043279, # 0x1dc4 <main+32>: xor. r4,r8,r6\n\t\t\t0x909f3030, # 0x1dc8 <main+36>: stw r4,12336(r31)\n\t\t\t0x7c05f8ac, # 0x1dcc <main+40>: dcbf r5,r31\n\t\t\t0x7cff04ac, # 0x1dd0 <main+44>: sync\n\t\t\t0x7c05ffac, # 0x1dd4 <main+48>: icbi r5,r31\n\t\t\t0x3bc5cfd4, # 0x1dd8 <main+52>: addi r30,r5,-12332\n\t\t\t0x7ffff214, # 0x1ddc <main+56>: add r31,r31,r30\n\t\t\t0x4082ffe0, # 0x1de0 <main+60>: bne+ 0x1dc0 <main+28>\n\t\t\t0x4cff012c, # 0x1de4 <main+64>: isync\n\t\t].pack(\"N*\")\n\tend", "def demux\n x = []\n y = []\n self.each { |inz| raise \"wrong size (!= 2) - #{inz.inspect}\" if inz.size != 2; x << inz[0] ; y << inz[1] }\n [x,y]\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def decodeBits(bits)\n array_of_bits = bits.each_char.slice_when(&:!=).map(&:join)\n array_of_bits.shift if bits[0] == \"0\"\n array_of_bits.pop if bits[bits.length-1] == \"0\"\n rate_of_transmission = array_of_bits.min {|elem1,elem2| elem1.size <=> elem2.size}.length\n bit_to_morse_dict = {\n \".\": \"1\"*rate_of_transmission,\n \"-\": \"1\"*3*rate_of_transmission,\n \"\": \"0\"*rate_of_transmission,\n \" \": \"0\"*3*rate_of_transmission,\n \" \": \"0\"*7*rate_of_transmission\n }\n array_of_bits.map {|str| bit_to_morse_dict.key(str)}.join().to_s\nend", "def shift_bits(buffer)\n buffer.slice!(0...1).unpack('b8').first.split('').map {|b| b == '1'}\n end", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def bits\n\t\t# Get a safe copy of the @bits array\n\t\tbts = @bits.clone\n\t\t##\n\t\t# If carrying and not [HACK catch the pattern tha breaks it by adding an extrax 1]\n\t\t##\n\t\tif @carrying && @bits[0,4] != [1, 0, 0, 0]\n\t\t\tbts\t\t= [1].concat @bits\n\t\tend\n\t\t# Return to the caller\n\t\tbts\n\tend", "def boolean_to_binary(array)\nend", "def pairing_to_waveletpairs(masks)\n (masks.count / 2).times do |i|\n @wavelet_pairs << [masks[i*2],masks[i*2+1]]\n end\n end", "def i16s\n little? ? BinUtils.get_sint16_le(read(2)) : BinUtils.get_sint16_be(read(2))\n end", "def read_bit_array(num_bits)\n size = (num_bits + 7) / 8\n data = read_and_advance(size)\n bit_array = BinData::Array.new(type: :bit1, initial_length: size * 8)\n bit_array.read(data).to_ary\n end", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def to_bit_array\n BitMapping.number_to_bit_array(number)\n end", "def flags_and_opcode\n # 0 \n # 0 1 2 3 4 5 6 7\n # +-+-+-+-+-------\n # |F|R|R|R| opcode\n # |I|S|S|S| (4) \n # |N|V|V|V| \n # | |1|2|3| \n byte = get(@need).bytes.first\n @opcode = byte & 0xF # last 4 bites\n @fin = (byte & 0x80 == 0x80)# first bit\n\n #p :byte => byte, :bits => byte.to_s(2), :opcode => @opcode, :fin => @fin\n # mask_and_payload_length has a minimum length\n # of 1 byte, so start there.\n transition(:mask_and_payload_init, 1)\n\n # This state yields no output.\n return nil\n end", "def decode_iseq(iseq, symbols_only=true)\n @iseq = iseq\n @offset = 0\n stream = []\n\n last_good = [nil, 0]\n\n begin\n while @offset < @iseq.size\n inst = decode\n stream << inst\n op = inst.first\n last_good = [op, stream.size] unless op.opcode == :noop\n end\n rescue InstructionSet::InvalidOpCode => ex\n # Because bytearrays and iseqs are allocated in chunks of 4 or 8 bytes,\n # we can get junk at the end of the iseq\n unless last_good.first and last_good.first.flow == :return\n ex.message << \" at byte #{@offset} of #{@iseq.size} [IP:#{@offset}]\"\n raise ex\n end\n end\n # Remove any noops or other junk at the end of the iseq\n # HACK Removed for now due to splat handling bug... is this still even necessary?\n #stream.slice! last_good.last, stream.size\n if symbols_only\n stream.each {|i| i[0] = i[0].opcode}\n end\n\n return stream\n end", "def MUX4X1(x,y,a,b,op1,op0)\n\td = DECODER2(op1,op0)\n\tOR(OR(AND(x,d[0]),AND(y,d[1])),OR(AND(a,d[2]),AND(b,d[3])))\nend", "def data_b\n ~data & ((1 << size) - 1)\n end", "def read(bits=nil)\n bits ||= word_size\n binary = []\n\n bits.times do |i|\n block_index, bit_index = @pointer.divmod(8)\n data = @blocks[block_index] || 0\n binary << (((data >> (7 - bit_index)) & 1) == 1)\n @pointer += 1\n end\n\n binary.map{|b| b ? '1' : '0' }.join.to_i(2)\n end", "def bitmap\n bit_table.flatten.each_with_index.map do |bit, index|\n [index, bit_table.transpose.flatten.index(bit)]\n end.to_h\nend", "def midi_encoder(bytes)\n raise \"Invalid data length #{bytes.size}\" unless bytes.size % 7 == 0\n result = []\n (0...bytes.size).step(7).each do |start|\n chunk = bytes[start, 7]\n msbits = 0\n chunk.each_with_index do |b, i|\n msbits |= (b & 0x80) >> (7 - i)\n end\n result << msbits\n result += chunk.map{|b| b & 0x7F}\n end\n result\nend", "def decode(data)\n null = data.index(0x00)\n value = data.unpack(\"a#{null}\")[0]\n data = data.slice(null+1, data.length)\n \n n = 0\n types = []\n @lengths.each do |l|\n types[n] = data.unpack(\"#{punpack_string(l)}\")[0]\n data = data.slice(l, data.length)\n n += 1\n end\n\n [value, types, data]\n end", "def decode(bytecodes = @iseq)\n require 'compiler/iseq'\n\n decoder = Rubinius::InstructionDecoder.new(bytecodes)\n stream = decoder.decode(false)\n ip = 0\n\n stream.map do |inst|\n instruct = Instruction.new(inst, self, ip)\n ip += instruct.size\n instruct\n end\n end", "def op2(interp, c1, c2, c3, c4)\n interp.stack.push([(((c1 << 24) | c2 << 16) | c3 << 8) | c4].pack('I').unpack('i').first)\n end", "def poly8_types\n [\\\n [ 1 ], # 0 core\n [ 2, 65, 17, 5, 3, 33, 9, 129 ], # 1 centers 2^8\n [ 4, 97, 25, 7, 130, 193, 49, 13 ], # 2, 2 grips adjacent. Even Permutation. Factorial(8)/2. No orientation.\n [ 6, 81, 21, 66, 11, 41, 131, 161], # 3 -- 2 grips spaced out by 1. Two orbits. In each orbit: even perm. No flip. (Factorial(4)/2)^2\n [ 10, 73, 19, 133, 34, 67, 145, 37 ], # 4 -- 2 grips spaced out by 2. Even permutation. No flip. (Factorial(8)/2)\n [ 18, 69, 35, 137 ], # 5 -- 2 grips spaced out by 3 aka center bars. Tied to type 1\n [ 8, 113, 29, 194, 15, 57, 132, 225 ], # 6 -- 3 grips adjacent, two orbits. Perm tied to type 3, double flip in each orbit. (2^3)^2\n [ 22, 85, 70, 82, 43, 139, 163, 169 ], # 7 -- 3 grips with one grip between each. Two orbits. Each orbit contributes two. Just like 4-axis. 4\n [ 42, 75, 147, 165, 38, 83, 149, 74 ], # 8 -- 3 grips with two grips between each. Two orbits, perm tied to type 3 and 6. Double flip in each orbit. (2^3)^2\n [ 12, 105, 27, 135, 162, 195, 177, 45, 14, 89, 23, 134, 98, 68, 209, 53 ], # 9 -- 3 grips (chiral pieces with 1-wide gap). 16 pieces in two orbits. Even perm in each orbit. No flip (Factorial(8)/2)^2\n [ 20, 101, 26, 71, 146, 197, 50, 77, 36, 99, 153, 39, 138, 201, 51, 141 ], # 10 -- 3 grips (chiral pieces with 2-wide gap). 16 pieces in two orbits. Even perm in each orbit. No flip (Factorial(8)/2)^2\n [ 16, 121, 31, 136, 226, 196, 241, 61 ], # 11 -- 4 grips adjacent. Even perm, no flip. (Factorial(8)/2)\n [ 46, 91, 151, 166, 106, 76, 211, 181 ], # 12 -- 4 grips in one 1-gap two 1-gap one. Self-anti. Even perm. no flip. (Factorial(8)/2)\n [ 28, 109, 199, 178, 55, 142, 100, 217 ], # 13 -- 4 grips split into 2 groups seperated by a 1-wide gap. Two orbits. In each orbit, even perm, double flip. (Factorial(4)/2 * 2^3)^2\n [ 52, 103, 154, 205 ], # 14 -- 4 grips split into 2 groups separated by a 2-wide gap. Self-anti. Even perm. double flip: remote flip, flipping with antipode. (Factorial(4)/2 * 2^3)\n [ 40, 115, 157, 202, 58, 79, 148, 229 ], # 15 -- 4 grips, three adjacent on top, loner on bottom. Two orbits, perm tied to type 3. In each orbit: no more perm, no flip (orientation tied to center bars?). REDUNDANT\n [ 24, 117, 30, 72, 210, 198, 114, 93, 47, 59, 143, 164, 233, 140, 227, 185 ], # 16 -- 4 grips, three, 1-gap, one. Two orbits. Even perm in each. No flip. (Factorial(8)/2)^2\n [ 44, 107, 155, 167, 170, 203, 179, 173, 54, 87, 150, 102, 90, 78, 84, 213 ], # 17 -- 4 grips, two, 1-gap, one, 1-gap, one. Two orbits. Even perm in each. No flip. (Factorial(8)/2)^2\n [ 86, 171 ], # 18 -- 4 grips, windmill. [One, one gap] * 4. Self-anti. REDUNDANT\n [ 60, 111, 156, 231, 186, 207, 180, 237, 56, 119, 158, 104, 218, 206, 116, 221 ], # 19 -- 5 grips, anti-3 grips (chiral pieces with 2-wide gap). anti type 10. 16 pieces in two orbits. Even perm in each orbit. No flip (Factorial(8)/2)^2\n [ 62, 95, 152, 230, 122, 80, 212, 245, 48, 123, 159, 168, 234, 204, 243, 189 ], # 20 -- 5-grips, anti-3 grips (chiral pieces with 1-wide gap). anti type 9. 16 pieces in two orbits. Even perm in each orbit. No flip (Factorial(8)/2)^2\n [ 92, 110, 215, 182, 108, 219, 183, 174 ], # 21 -- 5-grips, anti-3 grips with two grips between each. anti type 8. Two orbits. Perm tied to type 13. double flip in each orbit. (2^3)^2\n # jump to type 29 to continue analysis\n\n [ 172, 235, 187, 175, 88, 118, 94, 214 ], # 22 -- 5-grips, anti-3 grips with one grip between each. anti type 7. Two orbits. Factor of 2. Don't understand.\n [ 32, 125, 200, 242, 63, 144, 228, 249 ], # 23 -- 5-grips, anti-3 grips adjacent, anti type 6, Two orbits. Perm tied to type 13. no flip given inner rings. redundant\n [ 188, 239, 120, 222 ], # 24 -- 6-grips, anti-2 grips spaced out by 3, anti type 5. anti center bars. redundant\n [ 112, 124, 223, 184, 238, 220, 247, 190 ], # 25 -- 6-grips, anti-2 grips spaced out by 2, anti type 4. Even Permutation. Factorial(8)/2. No flip.\n [ 176, 251, 191, 236, 96, 126, 216, 246 ], # 26 -- 6-grips, anti-2 grips spaced out by 1, anti type 3. Perm tied to type 13, no flip (flip tied to center bars), redundant.\n [ 64, 127, 160, 232, 250, 208, 244, 253 ], # 27 -- 6-grips, anti-2 grips adjacent, anti type 2. Even Permutation. Factorial(8)/2. No flip.\n [ 128, 224, 248, 254, 192, 255, 240, 252 ], # 28 -- 7-grips, anti-1 grip, anti type 1. Two orbits. Given type 29 and type 1, each orbit has 2^2. total factor 2^4\n [ 256 ]] # 29 anti core. Only two rotational states, given that type 1 pieces are solved.\n end", "def input4\n [\n [1, 0, 0, 0, 1],\n [0, 0, 0, 1, 3],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 8]\n ]\nend", "def shift_bits(buffer)\n buffer.slice!(0...1).unpack('b8').first.split('').map { |b| b == '1' }\n end", "def i8s\n BinUtils.get_sint8(read(1))\n end", "def create_filtered_signal(a, b, c)\n s = Marshal.load(Marshal.dump(a))\n filter = Array.new(s.length) { 1 }\n (b...c).each do |i|\n filter[i] = 0\n end\n (0...s.length).each do |i|\n s[i] *= filter[i]\n end\n s\n end", "def decode(data)\n # Fin and Opcode\n byte_tmp = data.getbyte\n fin = byte_tmp & 0b10000000\n @opcode = byte_tmp & 0b00001111\n # NOT Support Multiple Fragments\n raise Midori::Error::ContinuousFrame unless fin\n raise Midori::Error::OpCodeError unless [0x1, 0x2, 0x8, 0x9, 0xA].include?opcode\n close if @opcode == 0x8 # Close Frame\n # return if @opcode == 0x9 || @opcode == 0xA # Ping Pong\n decode_mask(data)\n end", "def filter\n @filter ||= BitArray.new(m)\n end", "def field_bc2(op)\n (op & 0x0000ffc0) >> 6\nend", "def generate(size)\r\n if self.bits_per_symbol == 1\r\n return self.class.bitstream(size: size, p_0: @p_0, p_1: @p_1, random_generator: @random_generator)\r\n else\r\n signal = []\r\n size.times do \r\n signal << self.class.bitstream(size: @bits_per_symbol, p_0: @p_0, p_1: @p_1, random_generator: @random_generator)\r\n end\r\n return signal\r\n end\r\n end", "def read_packet_2 tag=nil\n len = self.read_two_bytes_big\n read_len len, tag\n end", "def decode(c)\n i = interlace(c)\n a = i >> @b_size\n b = (i ^ (a << @b_size))\n [a, b]\n end", "def bits_to_numbers(bits)\n (0..8).select { |n| (bits & (1 << n)) != 0 }\n end", "def assign_indices\n index = 0\n @signals.each do |sig|\n sig.index = index\n index += sig.nbits\n end\n end", "def protocol_bits\n raise NotImplementedError\n end", "def binrec\n\t\t\trec2 = pop\n\t\t\trec1 = pop\n\t\t\t_then = pop\n\t\t\t_if = pop\n\t\t\traise ArgumentError, \"BINREC: first element is not an Array.\" unless _if.is_a? Array\n\t\t\traise ArgumentError, \"BINREC: second element is not an Array.\" unless _then.is_a? Array\n\t\t\traise ArgumentError, \"BINREC: third element is not an Array.\" unless rec1.is_a? Array\n\t\t\traise ArgumentError, \"BINREC: fourth element is not an Array.\" unless rec2.is_a? Array\n\t\t\tsave_stack\n\t\t\t~_if\n\t\t\tcondition = pop\n\t\t\trestore_stack\n\t\t\tif condition then\n\t\t\t\t~_then\n\t\t\telse\n\t\t\t\t~rec1\n\t\t\t\ta = pop\n\t\t\t\tb = pop\n\t\t\t\t[b, _if, _then, rec1, rec2].each {|e| push e }\n\t\t\t\tbinrec\n\t\t\t\t[a, _if, _then, rec1, rec2].each {|e| push e }\n\t\t\t\tbinrec\n\t\t\t\t~rec2\n\t\t\tend\n\t\tend", "def test_decode_streaming_array_4\n assert_decode(\"83019f0203ff820405\", [1, [2, 3], [4, 5]])\n end", "def test_decode_streaming_array_1\n assert_decode(\"9f018202039f0405ffff\", [1, [2, 3], [4, 5]])\n end", "def booleans#:doc:\n barcode.encoding.split(//).map{|c| c == '1' }\n end", "def bitarray(n) \n b=Array::new \n i=0 \n v=n\n while v > 0\n b[i] = (0x1 & v)\n v = v/2\n i = i + 1\n end\n return b\n end", "def MUX2X1(x,y) XOR(x,y); end", "def unpack(p0) end", "def getB72bandNums(bandsArray)\n b7_2bandNumsArray = bandsArray.collect {|x| x.newBandNumbsb7_2} \nend", "def read_bit\n @buffer.shift if @buffer.length >= 1\n end", "def _int4b(data)\n data.unpack('V').first\n end", "def parse_record_packet\n @packet.utiny # skip first byte\n null_bit_map = @packet.read((@fields.length+7+2)/8).unpack(\"b*\").first\n rec = @fields.each_with_index.map do |f, i|\n if null_bit_map[i+2] == ?1\n nil\n else\n unsigned = f.flags & Field::UNSIGNED_FLAG != 0\n v = Protocol.net2value(@packet, f.type, unsigned)\n if v.nil? or v.is_a? Numeric or v.is_a? Time\n v\n elsif f.type == Field::TYPE_BIT or f.charsetnr == Charset::BINARY_CHARSET_NUMBER\n Charset.to_binary(v)\n else\n Charset.convert_encoding(v, @encoding)\n end\n end\n end\n rec\n end", "def decode_parts(raw_instruction)\n nnn = raw_instruction & 0x0fff\n kk = raw_instruction & 0x00ff\n x = (raw_instruction >> 8) & 0xf\n y = (raw_instruction >> 4) & 0xf\n n = raw_instruction & 0x000f\n {\n nnn: nnn,\n kk: kk,\n x: x,\n y: y,\n n: n\n }\nend", "def decode(data)\n s = \"#{punpack_string(@ts)}#{punpack_string(@ls)}\"\n type, length, tmp = data.unpack(\"#{s}a*\")\n value, rest = tmp.unpack(\"a#{length}a*\")\n [type, length, value, rest]\n end", "def mono_files2stereo(new_name, chan1_name, chan2_name)\n ind1 = open_sound(chan1_name)\n ind2 = open_sound(chan2_name)\n ind3 = mono2stereo(new_name, ind1, 0, ind2, 0)\n close_sound(ind1)\n close_sound(ind2)\n ind3\n end", "def mark_IV_decoder(first_wheel_index,second_wheel_index,encoded_message)\n input_array = encoded_message.split(//)\n wheel_three_index=[0]\n output_array=[]\n for i in 0...input_array.length\n output_char = mark_I_encoder(-2 *Integer(wheel_three_index[i]),input_array[i]).to_s\n output_array.push mark_II_encoder(-first_wheel_index,-second_wheel_index,output_char).to_s\n wheel_three_index[i+1]=$keyboard.index(output_array[i])\n end\n mark_IV_decoded_message = output_array.join\n return mark_IV_decoded_message\nend", "def test_decode_streaming_array_2\n assert_decode(\"9f01820203820405ff\", [1, [2, 3], [4, 5]])\n end", "def decode_resistor_colors(bands)\n Decoder.new(bands.split).call\nend", "def i16s\n r = little? ? BinUtils.get_sint16_le(@data, @pos) : BinUtils.get_sint16_be(@data, @pos)\n @pos += 2\n r\n end", "def convert_to_tpr(a)\n result = [0, 0, 0]\n tmp_hash = {}\n $tpr_bitfields.each_index {|i|\n $tpr_bitfields[i].each {|v|\n tmp_hash[v[3]] = [i, v[1], v[2]]\n }\n }\n a.each {|k, v|\n result[tmp_hash[k][0]] |= (v - tmp_hash[k][2]) << tmp_hash[k][1]\n }\n return result\nend", "def encodeing(array)\n i = 0\n freq = 0\n value = 0\n encoding = []\n while i < array.length\n freq = array[i]\n value = array[i + 1]\n freq.times { encoding << value }\n i += 2\n end\n encoding\nend", "def decode(e)\n current = e[0]\n if current != \"1\" or current != \"0\"\n return \"Could not decode, malformed encoded input\"\n end\n\n final = []\n\n e[1..e.length].split(\"\").each do |r|\n r.to_i.times { final.push current } \n current = (current == \"0\") ? \"1\" : \"0\"\n end\n final.join\nend", "def decrypt_byte\n temp = (@key2 | 2) & 0x0000ffff\n ((temp * (temp ^ 1)) >> 8) & 0x000000ff\n end", "def decode_new_multi(block)\n\t\t\n\t\tnot_found = []\n\t\tblock.blocks.each do |bl_id|\n\t\t\tif @decoded[bl_id].nil?\n\t\t\t\tnot_found << bl_id\n\t\t\telse\n\t\t\t\tblock.data ^= @decoded[bl_id]\n\t\t\tend\n\t\tend\n\t\tblock.blocks = not_found\n\t\treturn block\n\tend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def get_data\n dat = @data.unpack(\"C*\")\n num_frames = Shared::interpret_bytes_4(dat[0..3])\n num_plays = Shared::interpret_bytes_4(dat[4..7])\n return [num_frames, num_plays]\n end", "def decoder_stub(state)\n\n\t\t# add one xor operation for the key (see comment below)\n\t\tnumber_of_passes=state.buf.length/4+1\n\t\traise InvalidPayloadSizeException.new(\"The payload being encoded is too long (#{state.buf.length} bytes)\") if number_of_passes > 10240\n\t\traise InvalidPayloadSizeException.new(\"The payload is not padded to 4-bytes (#{state.buf.length} bytes)\") if state.buf.length%4 != 0\n\t\t\n\t\t# 16-bits not (again, see below)\n\t\treg_14 = (number_of_passes+1)^0xFFFF\n\t\tdecoder = Metasm::Shellcode.assemble(Metasm::MIPS.new(:little), <<EOS).encoded.data\n;\n; MIPS nul-free xor decoder\n;\n; (C) 2006 Julien TINNES\n; <julien at cr0.org>\n;\n; The first four bytes in encoded shellcode must be the xor key\n; This means that you have to put the xor key right after\n; this xor decoder\n; This key will be considered part of the encoded shellcode\n; by this decoder and will be xored, thus becoming 4NULs, meaning nop\n;\n; This is Linux-only because I use the cacheflush system call\n;\n; You can use shellforge to assemble this, but be sure to discard all\n; the nul bytes at the end (everything after x01\\\\x4a\\\\x54\\\\x0c)\n;\n; change 2 bytes in the first instruction's opcode with the number of passes\n; the number of passes is the number of xor operations to apply, which should be\n; 1 (for the key) + the number of 4-bytes words you have in your shellcode\n; you must encode ~(number_of_passes + 1) (to ensure that you're nul-free)\n\n\n;.text\n;.align\t2\n;.globl\tmain\n;.ent\tmain\n;.type\t\t main,@function\n\nmain:\n\nli macro reg, imm\n;\tlui reg, ((imm) >> 16) & 0ffffh\n;\tori reg, reg, (imm) & 0ffffh\n\taddiu reg, $0, imm\t\t; sufficient if imm.abs <= 0x7fff\nendm\n\n\tli(\t$14, #{reg_14})\t\t; 4 passes\n\tnor\t$14, $14, $0\t\t; put number of passes in $14\n\n\tli(\t$11,-73)\t\t; addend to calculated PC is 73\n;.set noreorder\nnext:\n\tbltzal $8, next\n;.set reorder\n\tslti $8, $0, 0x8282\n\tnor $11, $11, $0\t\t; addend in $9\t\n\taddu\t$25, $31, $11\t\t; $25 points to encoded shellcode +4 \n;\taddu\t$16, $31, $11\t\t; $16 too (enable if you want to pass correct parameters to cacheflush\n\n;\tlui\t$2, 0xDDDD \t\t; first part of the xor (old method)\n\tslti\t$23, $0, 0x8282 \t; store 0 in $23 (our counter)\n;\tori\t$17, $2, 0xDDDD \t; second part of the xor (old method)\n\tlw\t$17, -4($25)\t\t; load xor key in $17 \n\n\n\tli(\t$13, -5)\n\tnor\t$13, $13, $0\t\t; 4 in $13\n\n\taddi\t$15, $13, -3\t\t; 1 in $15\nloop:\n\tlw\t$8, -4($25)\n\n\taddu\t$23, $23, $15\t\t; increment counter\n\txor\t$3, $8, $17\n\tsltu\t$30, $23, $14\t\t; enough loops?\n\tsw\t$3, -4($25)\n\taddi\t$6, $13, -1\t\t; 3 in $6 (for cacheflush)\n\tbne\t$0, $30, loop\n\taddu\t$25, $25, $13\t\t; next instruction to decode :)\n\n\n;\taddiu\t$4, $16, -4\t \t; not checked by Linux\n;\tli $5,40 \t; not checked by Linux\n;\tli $6,3 \t; $6 is set above\n\n;\t.set noreorder\n\tli( $2, 4147) ; cacheflush\n\t;.ascii \"\\\\x01JT\\\\x0c\"\t\t; nul-free syscall\n\tsyscall 0x52950\n;\t.set reorder\n\n\n\t\t\t\t\t; write last decoder opcode and decoded shellcode\n;\tli $4,1 \t; stdout\n;\taddi\t$5, $16, -8\n;\tli $6,40 \t; how much to write \n;\t.set noreorder\n;\tli $2, 4004 ; write\n;\tsyscall\n;\t.set reorder\n\t\n\n\tnop\t\t\t\t; encoded shellcoded must be here (xor key right here ;)\n; $t9 (aka $25) points here\n\nEOS\n\t\t# put the key at the end of the decoder\n\t\tstate.decoder_key_offset = decoder.length - 4\n\n\t\treturn decoder\n\tend", "def edge_array\n\t\t\t to_return = @responses.collect { |item| item.sollutions }\n\t\t\t return to_return\n\t\tend", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def is_two_pair( hand )\n\tpair = check_pair( 2, hand )\n\treturn 2 == pair.length ? pair.map{ | e | card_value( e ) }.sort.reverse :\n\t\t\t\t\t\t\t [ 0 ]\nend", "def encode_to_array\n components = []\n components << [self.class.id, @channel, @payload.bytesize].pack(PACK_CHAR_UINT16_UINT32)\n components << self.class.encoded_payload(@payload)\n components << FINAL_OCTET\n components\n end", "def pattern_bits\n str = bits.to_s(2)\n str = str.rjust(self.step_count, '0')\n str.chars.collect{|x|x=='1'}\n end", "def encode_2d(n)\n n = (n ^ (n << 8)) & 0x00ff00ff\n n = (n ^ (n << 4)) & 0x0f0f0f0f\n n = (n ^ (n << 2)) & 0x33333333\n n = (n ^ (n << 1)) & 0x55555555\n return n\n end", "def test_decode_streaming_array_3\n assert_decode(\"83018202039f0405ff\", [1, [2, 3], [4, 5]])\n end", "def test_decode_streaming_array_5\n assert_decode(\"9f0102030405060708090a0b0c0d0e0f101112131415161718181819ff\", [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25])\n end", "def twodip\n\t\t\tprogram = pop\n\t\t\traise ArgumentError, \"2DIP: first element is not an Array.\" unless program.is_a? Array\n\t\t\titems = []\n\t\t\t2.times { items << pop }\n\t\t\t~program\n\t\t\titems.reverse.each {|i| push i }\n\t\tend", "def i8s\n r = BinUtils.get_sint8(@data, @pos)\n @pos += 1\n r\n end", "def to_a(bits_per_element)\n out_array = Array.new\n for ptr in 0.step(@fuse_data.length, bits_per_element) do\n out_element = 0\n @fuse_data[ptr..ptr+bits_per_element-1].each { |bit|\n out_element = out_element << 1\n out_element |= 1 if bit == 1\n }\n out_array.push out_element\n end\n out_array\n end", "def variant_bits\n @variant_bits ||= @clock_seq_hi_and_reserved >> 5\n end", "def reg_to_pair(reg)\n rnum = reg[1].to_i\n rnum -= 1 if rnum.odd?\n return $pairs['r' + rnum.to_s + (rnum+1).to_s]\nend", "def bits\n self.class.bits.select { |bit, _| include? bit }.keys\n end", "def two_pair(ranks)\n pair = kind(2, ranks)\n lowpair = kind(2, ranks.reverse)\n return [pair, lowpair] if pair && lowpair != pair\n return nil\nend", "def test_pv_1\n pv = make_phase_vocoder(false, 512, 4, 128, 1.0, false, false, false)\n rd = make_sampler(0)\n map_channel(lambda do |y| phase_vocoder(pv, lambda do |dir| next_sample(rd) end) end)\n free_sampler(rd)\nend", "def xor_d8\n end", "def pushBit bit1, bit2\n\t\t# Round inputs to 0/1 just in case\n\t\tbit1, bit2 = bit1.round.to_i, bit2.round.to_i\n\t\t##\n\t\t# Bit selection : [0, 0] = 0, [1, 0] or [0, 1] = [0, 1], [1, 1] = carry the 1\n\t\t##\n\t\t# when [1, 1]\n\t\tif bit1 == 1 && bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\telse\n\t\t\t\t@carrying \t= true\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\t# when [0, 1] or [1, 0]\n\t\telsif bit1 == 1 || bit2 == 1\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [0].concat @bits\n\t\t\telse\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\tend\n\t\t# when [0, 0]\n\t\telse\n\t\t\tif @carrying\n\t\t\t\t@bits\t= [1].concat @bits\n\t\t\t\t@carrying = false\n\t\t\telse\n\t\t\t\t@bits\t\t= [0].concat @bits\n\t\t\tend\n\t\tend\n\tend", "def opcode8\n if value_by_mode(1) == value_by_mode(2)\n update_value(1, 3)\n else\n update_value(0, 3)\n end\n move_pointer(4)\n end", "def reverse_named_bits(_options = {})\n bits = []\n named_bits { |name, bit| bits << [name, bit] }\n bits.each do |bit|\n yield bit[0], bit[1]\n end\n end", "def reverse_byte_pairs!\n w = \"\"\n w.force_encoding(\"BINARY\") if w.respond_to?(:force_encoding)\n (0...@bytes.size).step(2) do |i|\n w << @bytes[i+1]\n w << @bytes[i]\n end\n @bytes = w\n __setobj__ @bytes\n self\n end", "def flatten_voice(voice_data)\n modulating = (voice_data[6] & 0x01) == 0;\n\n # Voices 1 and 2 (for OPL3)\n voice_data[6] |= 0x30;\n\n # 2nd op always has level set to max \n voice_data[12] |= 0x3f;\n\n # 1st op has level set to max if not modulating\n if !modulating\n voice_data[5] |= 0x3f;\n end\nend", "def mask_array\n @mask.split('')\n end", "def parse_response_packet(data_received)\n begin\n answers_received = Array.new\n transaction_ID, flags, questions, answers, authority_rrs, additional_rrs, lookup_host, query_type, query_class = data_received.unpack(\"S>S>S>S>S>S>Z*S>S>\")\n \n offset = (2 * 6) + (lookup_host.length + 1) + (2 * 2)\n answer_offset = offset\n\n for answer_index in 1..answers \n answer_name, answer_type, answer_class, answer_time_to_live, answer_data_length = data_received.slice(answer_offset, data_received.length - offset).unpack(\"S>S>S>L>S>\")\n answer_offset += (2 * 3) + (1 * 4) + (2 * 1)\n answer_host = parse_answer_host(data_received, answer_offset, answer_data_length, answer_type)\n answer_offset += answer_data_length\n\n answer = OpenStruct.new\n answer.type = answer_type\n answer.time_to_live = answer_time_to_live\n answer.address = answer_host\n answers_received.push(answer)\n end\n \n rescue\n puts \"Unable to parse response\"\n return nil\n end\n return answers_received\nend", "def make_data\n Array.new(2**15) { |i| (i / 16 % 256) }\n end", "def decode\n state = :normal\n decoded = buffer.reduce [] do |acc, byte|\n case state\n when :normal\n if byte == 0x7d\n state = :special\n else\n acc << byte\n end\n when :special\n state = :normal\n acc << (byte ^ 0x20)\n end\n acc\n end\n Packet.new decoded\n end", "def ping_pong_filter(arr)\n result = arr.dup\n while result.length > 1\n result = result.select.with_index do |el, idx|\n el if idx % 2 != 0\n end\n result = result.reverse\n end\n result\nend", "def circuit_definitions\n split_lines.map do |line|\n input_definition, wire_id = line.split('->').map(&:strip)\n\n input_type, input_1, input_2 = if input_definition =~ /^\\d+$/\n ['SIGNAL', input_definition, nil]\n elsif input_definition =~ /^[a-z]{2}$/\n ['WIRE', input_definition, nil]\n else\n if input_definition.start_with?('NOT')\n input_definition.split(' ')\n else\n left_input_name, op_name, right_input_name = input_definition.split(' ')\n [op_name, left_input_name, right_input_name]\n end\n end\n\n [wire_id, input_type, input_1, input_2]\n end\n end", "def BitwiseTwo(strArr)\n result = strArr[0].to_i(2) & strArr[1].to_i(2)\n format(\"%0#{strArr[0].size}b\", result)\nend", "def binary(array)\n @reactor.schedule { @driver.binary(array.to_a) }\n end", "def bitstreams(bundleName = 'ORIGINAL')\n bits = []\n\n iter = @obj.getItems\n while (i = iter.next)\n bits += DSpace.create(i).bitstreams(bundleName)\n end\n\n bits\n end", "def band2\n @ole.Band2\n end", "def _unpack(bytes)\n if bytes.is_a?(Array) then bytes = bytes.join end\n bytes.unpack('H*')[0].scan(/../).reverse.join.to_i(16)\nend", "def mark_IV_encoder(first_wheel_index,second_wheel_index,message_to_encode)\n input_array = message_to_encode.split(//)\n wheel_three_index= message_to_encode.split(//).map{|z|[$keyboard.index(z)]}.flatten!\n wheel_three_index.insert(0,0)\n output_array=[]\n for i in 0...input_array.length\n output_char = mark_II_encoder(first_wheel_index,second_wheel_index,input_array[i])\n output_array.push mark_I_encoder(2 * Integer(wheel_three_index[i]),output_char)\n end\n mark_IV_encoded_message = output_array.join\n return mark_IV_encoded_message\nend", "def decode(encoded)\n encoded.map { |n, e| e.nil? ? n : [e] * n }.flatten\nend", "def split_triangle_2(e1,e2)\n\tif (sig = e1|e2).count == 3\n\t\ths = Hash.new ; keys = %w(a b c d e)\n\t\tkeys.zip(sig+['p','q']).each { |i,e| hs[i]=e }\n\t\t%w(adc dec dbe).map { |a| a.split('').map { |i| hs[i] } }\n\tend\nend" ]
[ "0.5091598", "0.50061184", "0.4942068", "0.48001218", "0.47916391", "0.47879806", "0.47845063", "0.4766525", "0.4737892", "0.4711896", "0.47009572", "0.46803588", "0.466656", "0.4640637", "0.46343356", "0.4631657", "0.4624498", "0.46098036", "0.4607275", "0.4586002", "0.4582695", "0.4573299", "0.45668194", "0.45521963", "0.45471352", "0.4528816", "0.45115164", "0.45112202", "0.45004603", "0.44976532", "0.4492724", "0.44887882", "0.448254", "0.4482361", "0.4454516", "0.44422016", "0.4434222", "0.44228867", "0.44095308", "0.4402637", "0.43878406", "0.4385961", "0.4383775", "0.43833515", "0.43802986", "0.43795338", "0.43624133", "0.43558478", "0.4354055", "0.43532687", "0.43515018", "0.43486938", "0.4345861", "0.43451622", "0.4341909", "0.43368566", "0.43355444", "0.43291336", "0.43239325", "0.43132544", "0.43094382", "0.43089697", "0.4286549", "0.4285785", "0.42841217", "0.42731297", "0.4273046", "0.4267916", "0.4266732", "0.42663893", "0.42648104", "0.42532238", "0.42407843", "0.4221275", "0.42193404", "0.42039955", "0.42016035", "0.42013693", "0.4190652", "0.41862935", "0.41756746", "0.41721308", "0.41667005", "0.4166286", "0.4149746", "0.41468313", "0.4140596", "0.41400182", "0.41364884", "0.41237724", "0.41215575", "0.41179293", "0.41131368", "0.4110375", "0.41058064", "0.41032305", "0.4097255", "0.40970278", "0.40909827", "0.40898514" ]
0.58601004
0
4X1 MUX Utilizes the 2BitDecoder to map the op signal to the correct ALU output.
def MUX4X1(x,y,a,b,op1,op0) d = DECODER2(op1,op0) OR(OR(AND(x,d[0]),AND(y,d[1])),OR(AND(a,d[2]),AND(b,d[3]))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def mux\n raise \"not implemented yet\"\n end", "def MUX2X1(x,y) XOR(x,y); end", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend", "def op2(interp, c1, c2, c3, c4)\n interp.stack.push([(((c1 << 24) | c2 << 16) | c3 << 8) | c4].pack('I').unpack('i').first)\n end", "def opcode_8XY4(helper)\n\t\tresult = helper.registry_X + helper.registry_Y\n\n\t\tif result > 255\n\t\t\tself.VF = 1\n\t\telse\n\t\t\tself.VF = 0\n\t\tend\t\n\n\t\thelper.registry_X = result\n\tend", "def lookahead_u4(start_ofs, end_ofs)\n lookahead_data(start_ofs, end_ofs, 4).unpack1(\"V\")\n end", "def read_u4\n (read_u1 << 24) | read_u3\n end", "def k_union!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 57 )\n\n\n\n type = K_UNION\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 481:3: 'union'\n match( \"union\" )\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__, 57 )\n\n\n end", "def band4(value)\n @ole.Band4 = value\n nil\n end", "def h_4!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n type = H4\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 331:5: 'h4'\n match( \"h4\" )\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__, 8 )\n\n end", "def v4_1=(value)\n @v4_1 = value\n end", "def mux(options={})\n if File.file?(options[:output])\n File.delete(options[:output])\n end\n\n create do |mp4creator|\n mp4creator.create = options[:audio]\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.create = options[:video]\n mp4creator.rate = options[:frame_rate].to_f\n mp4creator.file = options[:output]\n end\n\n if options[:hint]\n create do |mp4creator|\n mp4creator.hint = 1\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.hint = 2\n mp4creator.file = options[:output]\n end\n\n create do |mp4creator|\n mp4creator.optimize = true\n mp4creator.file = options[:output]\n end\n end\n end", "def on_union(plan, expr, left, right)\n rewrite(plan, expr, left, Processor::Merge, [:union, right.sexpr])\n end", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def input4\n [\n [1, 0, 0, 0, 1],\n [0, 0, 0, 1, 3],\n [0, 1, 0, 0, 5],\n [0, 0, 1, 0, 8]\n ]\nend", "def div4(context)\n compiler = compiler_for(:Integer,:div4 ,{})\n builder = compiler.builder(compiler.source)\n integer_tmp = builder.allocate_int\n builder.build do\n integer_self! << message[:receiver]\n integer_self.reduce_int\n integer_1! << 2\n integer_self.op :>> , integer_1\n integer_tmp[Parfait::Integer.integer_index] << integer_self\n message[:return_value] << integer_tmp\n end\n compiler.add_mom( Mom::ReturnSequence.new)\n return compiler\n end", "def sub_demux _value=0\n send_cmd(\"sub_demux #{_value}\")\n end", "def multiplex\n\t\t\t\t\t1\n\t\t\t\tend", "def ldd_a_mhl\n @a = @mmu[hl]\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def demux\n x = []\n y = []\n self.each { |inz| raise \"wrong size (!= 2) - #{inz.inspect}\" if inz.size != 2; x << inz[0] ; y << inz[1] }\n [x,y]\n end", "def pipeline_operator!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 11 )\n\n type = PIPELINE_OPERATOR\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 55:3: ( '&&' | '||' | '|' | '&' )\n alt_17 = 4\n look_17_0 = @input.peek( 1 )\n\n if ( look_17_0 == 0x26 )\n look_17_1 = @input.peek( 2 )\n\n if ( look_17_1 == 0x26 )\n alt_17 = 1\n else\n alt_17 = 4\n end\n elsif ( look_17_0 == 0x7c )\n look_17_2 = @input.peek( 2 )\n\n if ( look_17_2 == 0x7c )\n alt_17 = 2\n else\n alt_17 = 3\n end\n else\n raise NoViableAlternative( \"\", 17, 0 )\n end\n case alt_17\n when 1\n # at line 55:5: '&&'\n match( \"&&\" )\n\n when 2\n # at line 55:12: '||'\n match( \"||\" )\n\n when 3\n # at line 55:19: '|'\n match( 0x7c )\n\n when 4\n # at line 55:25: '&'\n match( 0x26 )\n # --> action\n @cmd_start = true \n # <-- action\n\n end\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__, 11 )\n\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def transformation_device(*eras); end", "def update_phase4\r\n case @phase4_step\r\n when 1\r\n update_phase4_step1\r\n when 2\r\n update_phase4_step2\r\n when 3\r\n update_phase4_step3\r\n when 4\r\n update_phase4_step4\r\n when 5\r\n update_phase4_step5\r\n when 6\r\n update_phase4_step6\r\n end\r\n end", "def flatten_voice(voice_data)\n modulating = (voice_data[6] & 0x01) == 0;\n\n # Voices 1 and 2 (for OPL3)\n voice_data[6] |= 0x30;\n\n # 2nd op always has level set to max \n voice_data[12] |= 0x3f;\n\n # 1st op has level set to max if not modulating\n if !modulating\n voice_data[5] |= 0x3f;\n end\nend", "def band4\n @ole.Band4\n end", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def update_phase4\n case @phase4_step\n when 1\n update_phase4_step1\n when 2\n update_phase4_step2\n when 3\n update_phase4_step3\n when 4\n update_phase4_step4\n when 5\n update_phase4_step5\n when 6\n update_phase4_step6\n end\n end", "def ldi_a_mhl\n @a = @mmu[hl]\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def ConvertA2X\n # a2x options\n if not @FullOpts.nil?\n opts = @FullOpts + \" \"\n else\n opts = self.getOptionsA2X()\n end\n\n opts += @Opts + \" \" if not @Opts.nil?\n\n opts += \"-v \" if $debug2\n \n # Execute pre actions\n self.ExecuteAction(:pre)\n \n cmd = \"a2x -D #{@outdir} #{opts} #{@doc.filename}\"\n puts \"Generating (#{@Type}) #{@outfile}\\n\"\n puts \"Executing : #{cmd}\" if $verbose\n res = %x[#{cmd}]\n puts res if res != \"\"\n \n if $? == 0\n # Execute post actions\n self.ExecuteAction(:post)\n end\n\n end", "def to_m4a(options={})\n options[:quality] ||= 320\n options[:output] ||= self.basename_with_path + '.m4a'\n cmd = \"afconvert -v \\\"#{self.path}\\\" -o \\\"#{options[:output]}\\\" -f m4af -d aac -b #{options[:quality]}000 -s 0\"\n system(cmd)\n end", "def v4_1\n return @v4_1\n end", "def read_u1\n read(1).first & 0xff\n end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def _lex_trans_actions; end", "def mul!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 42 )\n\n\n\n type = MUL\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 63:6: '*'\n match( 0x2a )\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__, 42 )\n\n\n end", "def alu_op(instr)\n add call(instr.result, instr.operand1, instr.oper, instr.operand2)\n end", "def adc_a_d8\n end", "def emit\n # emit LHS, RHS, opcode\n @first.emit << @second.emit << OPCODES[@op]\n end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 336:7: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n # at line 336:31: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) || look_4_0.between?( 0x41, 0x5a ) || look_4_0 == 0x5f || look_4_0.between?( 0x61, 0x7a ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\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__, 32 )\n\n end", "def t__16!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 7)\n\n type = T__16\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 22: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__, 7)\n\n end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def ldd_mhl_a\n @mmu[hl] = @a\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def packet_in datapath_id, message\n match = ExactMatch.from( message )\n action, log = lookup_rules( datapath_id, match )\n info \"action=#{ action }, datapath_id=#{ datapath_id.to_hex }, message={#{ match.to_s }}\" if log\n if action == :allow\n #set rules in the switch\n #please fill up the following blank ****** user input from here ******\n send_flow_mod_add( datapath_id,\n :match => match,\n :idle_timeout => 300,\n :hard_timeout => 300,\n :actions => ActionOutput.new( (match.in_port == 1)? 2 : 1 )\n )\n #set rules in the switch for reverse path\n #please fill up the following blank ****** user input from here ******\n # reverse flow has the same attributes, but with source/destination\n # swapped\n reverse_match = Match.new(\n :in_port => (match.in_port == 1)? 2 : 1,\n :dl_src => match.dl_dst, # swapping source and dest\n :dl_dst => match.dl_src, # MAC addresses\n :dl_type => match.dl_type,\n :dl_vlan => match.dl_vlan,\n :dl_vlan_pcp => match.dl_vlan_pcp,\n :nw_tos => match.nw_tos,\n :nw_proto => match.nw_proto,\n :nw_src => match.nw_dst, # swapping source and dest\n :nw_dst => match.nw_src, # IP addresses\n :tp_src => match.tp_dst, # swapping source and dest\n :tp_dst => match.tp_src # TCP ports\n )\n info \"reverse flow: {#{ reverse_match.to_s }}\"\n send_flow_mod_add( datapath_id,\n :match => reverse_match,\n :idle_timeout => 300,\n :hard_timeout => 300,\n :actions => ActionOutput.new( (reverse_match.in_port == 1)? 2 : 1 )\n )\n else \n #set drop rule in the switch\n #please fill up the following blank ****** user input from here ******\n send_flow_mod_add( datapath_id,\n :match => match,\n :idle_timeout => 300,\n :hard_timeout => 300\n )\n end\n end", "def union_step2_part1(active)\n if cant_use_action(active)\n reset_atb(active) if $atoa_script['Atoa ATB']\n active.current_phase = 'Phase 5-1'\n return\n end\n now_action(active)\n active.union = Combination_Skill['Union'][[active.type_name, active.combination_id]].dup\n active.combination_battlers.clear\n active.current_move = 0\n for id in active.union\n battlers = active.actor? ? $game_party.actors : $game_troop.enemies\n for battler in battlers\n if id[0] == battler.id\n active.combination_battlers << battler \n size = active.union[battler.id].size\n active.move_size = size if active.move_size.nil? or size > active.move_size\n end\n end\n end\n sort_combination_battlers(active)\n end", "def t__6!\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_in( __method__, 1 )\r\n\r\n type = T__6\r\n channel = ANTLR3::DEFAULT_CHANNEL\r\n\r\n \r\n # - - - - main rule block - - - -\r\n # at line 7:8: '+'\r\n match( 0x2b )\r\n\r\n \r\n @state.type = type\r\n @state.channel = channel\r\n\r\n ensure\r\n # -> uncomment the next line to manually enable rule tracing\r\n # trace_out( __method__, 1 )\r\n\r\n end", "def i4( num ) ## integer (4 byte / 32bit) to binary (in little endian)\r\n [num].pack( 'V' )\r\n end", "def band1(value)\n @ole.Band1 = value\n nil\n end", "def test_pv_1\n pv = make_phase_vocoder(false, 512, 4, 128, 1.0, false, false, false)\n rd = make_sampler(0)\n map_channel(lambda do |y| phase_vocoder(pv, lambda do |dir| next_sample(rd) end) end)\n free_sampler(rd)\nend", "def t__16!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = T__16\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 25:9: 'D'\n match( 0x44 )\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 multiplex(movie, video_file, audio_file)\n codecs = ['xvid', 'mpeg2', 'mp4']\n codec = 'xvid'\n if codecs.include?(movie.format)\n codec = movie.format\n end\n \n if(codec == \"xvid\")\n multiplexer = XvidMultiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n elsif(codec == \"mpeg2\")\n multiplexer = Mpeg2Multiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n elsif(codec == \"mp4\")\n multiplexer = Mp4Multiplexer.new\n multiplexer.multiplex(movie, video_file, audio_file)\n end\n \n end", "def output\n return nil if input_wires.any?\n\n case gate\n when \"AND\"\n values[0] & values[1]\n when \"OR\"\n values[0] | values[1]\n when \"NOT\"\n ~values[0]\n when \"LSHIFT\"\n values[0] << values[1]\n when \"RSHIFT\"\n values[0] >> values[1]\n else\n values[0]\n end\n end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def _lex_trans_actions=(_arg0); end", "def permutation_four(m1, m2)\n m1.judges[0], m2.judges[0] = m2.judges[0], m1.judges[0]\n end", "def t__82!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 27)\n\n type = T__82\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33: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__, 27)\n\n end", "def ldi_mhl_a\n @mmu[hl] = @a\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def mul!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 50 )\n\n type = MUL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 376:7: '*'\n match( 0x2a )\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__, 50 )\n\n end", "def punto!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 10 )\n\n\n\n type = PUNTO\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 293:3: '.'\n match( 0x2e )\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 ident!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 47 )\n\n\n\n type = IDENT\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 226:8: ( 'a' .. 'z' | 'A' .. 'Z' | '_' ) ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at line 226:40: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '_' )*\n while true # decision 4\n alt_4 = 2\n look_4_0 = @input.peek( 1 )\n\n if ( look_4_0.between?( 0x30, 0x39 ) || look_4_0.between?( 0x41, 0x5a ) || look_4_0 == 0x5f || look_4_0.between?( 0x61, 0x7a ) )\n alt_4 = 1\n\n end\n case alt_4\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 4\n end\n end # loop for decision 4\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__, 47 )\n\n\n end", "def opcode\n if @extended\n return 0x00 | (@op << 5) | (a_param.mode_bits << 10)\n else\n return @op | (a_param.mode_bits << 10) | (b_param.mode_bits << 5)\n end\n end", "def unaExp_Handler(expr)\n\ttypeExpr = expression_Handler(expr.elem)\n\tcase expr.op\n\twhen /^[$']/\n\t\tif typeExpr == :CANVAS\n\t\t\treturn :CANVAS\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /\\^/\n\t\tif typeExpr == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /-/\n\t\tif typeExpr == :NUMBER\n\t\t\treturn :NUMBER\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend\nend", "def unaExp_Handler(expr)\n\ttypeExpr = expression_Handler(expr.elem)\n\tcase expr.op\n\twhen /^[$']/\n\t\tif typeExpr == :CANVAS\n\t\t\treturn :CANVAS\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /\\^/\n\t\tif typeExpr == :BOOLEAN\n\t\t\treturn :BOOLEAN\n\t\telse\n\t\t\treturn nil\n\t\tend\n\twhen /-/\n\t\tif typeExpr == :NUMBER\n\t\t\treturn :NUMBER\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend\nend", "def clk\n case [@c2, @c1, @c0]\n when [0,0,0] then do_nothing;\n when [0,0,1] then x_add_y\n when [0,1,0] then rotate_x\n when [0,1,1] then x_and_y\n when [1,0,0] then x_or_y\n when [1,0,1] then x_xor_y\n when [1,1,0] then not_x\n when [1,1,1] then x_equal_y\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n @z\n end", "def id!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n\n\n\n type = ID\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 49:5: ( 'a' .. 'z' | 'A' .. 'Z' ) ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n if @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n # at line 49:33: ( ( 'a' .. 'z' | 'A' .. 'Z' ) | '_' | ( '0' .. '9' ) )*\n while true # decision 8\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0.between?( 0x30, 0x39 ) || look_8_0.between?( 0x41, 0x5a ) || look_8_0 == 0x5f || look_8_0.between?( 0x61, 0x7a ) )\n alt_8 = 1\n\n end\n case alt_8\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n\n end\n\n\n\n else\n break # out of loop for decision 8\n end\n end # loop for decision 8\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__, 28 )\n\n\n end", "def _reduce_54(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def reduce_simple_expression_1(_production, _range, _tokens, theChildren)\n reduce_binary_operator(theChildren)\n end", "def v4_2=(value)\n @v4_2 = value\n end", "def udid2(udid2)\n tab_hash = udid2.split(';')\n @type = tab_hash[0]\n\n return 'error_type' if @type != @@type\n\n @mode = tab_hash[1]\n\n if @mode == 'h' && tab_hash.length == 4\n @hash = tab_hash[2]\n @number = tab_hash[3]\n elsif @mode == 'c' && tab_hash.length == 8\n to_udid2 tab_hash[2],tab_hash[3], tab_hash[4], tab_hash[5][1..6], tab_hash[6]\n else\n return 'error mode'\n end\n\n end", "def test_add_field_to_union_forward_ok\n a = V1::DeviceEvent.new()\n a.payload = V1::DeviceEventPayload.new()\n a.payload.state_changed = lambda {\n e = V1::DeviceStateChanged.new()\n e.device_name = \"bar\"\n e.state = V1::State::On\n return e\n }.call\n a.write(@protocol)\n b = V2::DeviceEvent.new()\n b.read(@protocol)\n assert_equal(a.payload.state_changed.device_name, b.payload.state_changed.device_name)\n assert_equal(a.payload.state_changed.state, b.payload.state_changed.state)\n assert_equal(b.payload.get_set_field, :state_changed)\n end", "def binary!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 7)\n\n type = BINARY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 33:5: ( '-' )? '0b' ( '0' .. '1' )+\n # at line 33:5: ( '-' )?\n alt_13 = 2\n look_13_0 = @input.peek(1)\n\n if (look_13_0 == ?-) \n alt_13 = 1\n end\n case alt_13\n when 1\n # at line 33:5: '-'\n match(?-)\n\n end\n match(\"0b\")\n # at file 33:15: ( '0' .. '1' )+\n match_count_14 = 0\n loop do\n alt_14 = 2\n look_14_0 = @input.peek(1)\n\n if (look_14_0.between?(?0, ?1)) \n alt_14 = 1\n\n end\n case alt_14\n when 1\n # at line 33:16: '0' .. '1'\n match_range(?0, ?1)\n\n else\n match_count_14 > 0 and break\n eee = EarlyExit(14)\n\n\n raise eee\n end\n match_count_14 += 1\n end\n\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__, 7)\n\n end", "def or_mhl\n value = @mmu[hl]\n or_to_a value\n @clock += 2\n end", "def reducer; end", "def handle_dispatch(payload)\n LOGGER.debug { \"Emitting #{payload[:t]}\" }\n emit(payload[:t], payload[:d])\n end", "def v4_0=(value)\n @v4_0 = value\n end", "def opcode_8XY6(helper)\n\t\tbinary = helper.registry_X.to_s(2)\n\n\t\tself.VF = binary.split('').last.to_i\n\t\thelper.registry_X = helper.registry_X / 2\n\tend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def _reduce_1(val, _values, result)\n self.lexer.lex_state = EXPR_BEG\n\n result\nend", "def register_for_alpha4\n service_response = UserManagement::Alpha4Registration.new(params).perform\n render_api_response(service_response)\n end" ]
[ "0.58622676", "0.5829425", "0.55989224", "0.54765165", "0.45580408", "0.45497286", "0.44815424", "0.4452793", "0.43854693", "0.43729267", "0.43053705", "0.4270969", "0.42696092", "0.42582706", "0.41968408", "0.41244057", "0.4109976", "0.4109244", "0.4109063", "0.40523973", "0.40390164", "0.39751628", "0.39542058", "0.39237782", "0.39152098", "0.39057153", "0.39019895", "0.39004582", "0.38910747", "0.38841155", "0.38838604", "0.3879542", "0.38794762", "0.38794416", "0.38693988", "0.38607043", "0.38475013", "0.38469344", "0.38469344", "0.38469344", "0.38469344", "0.38415974", "0.38364872", "0.3835233", "0.38352025", "0.38325873", "0.38156912", "0.3814586", "0.38083458", "0.3800918", "0.38001", "0.37983105", "0.37926134", "0.37888387", "0.37881", "0.3786462", "0.37846825", "0.3776753", "0.37689564", "0.37689564", "0.37689564", "0.37689564", "0.37688804", "0.37684822", "0.3765564", "0.37644634", "0.37617293", "0.3759634", "0.3753504", "0.37434652", "0.37434652", "0.3726617", "0.3717782", "0.3702097", "0.370176", "0.36922935", "0.36824098", "0.3677619", "0.36720866", "0.3667759", "0.3665012", "0.36648706", "0.365643", "0.36494762", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36434263", "0.36406168" ]
0.73065
0
1Bit ALU Computes and,or,sum and sends out the overflow, result and a carry out.
def ALU1BIT(a,b,cin,binv,op1,op2) b = MUX2X1(b,binv) sUM_RESULT = ADDER(a,b,cin) #Send out an array pair of result, cout return MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def alu_op(instr)\n add call(instr.result, instr.operand1, instr.oper, instr.operand2)\n end", "def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end", "def sum_of_2int a, b\n (b == 0) ? a : (sum_of_2int (a^b),((a&b)<< 1))\nend", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def _reduce_258(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_258(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def resolveADD\r\n newVal = @RegA + @RegB\r\n if(newVal == 0)\r\n @ZRBit = true\r\n @OFBit = false\r\n puts \"Zero bit true. Overflow bit false.\"\r\n elsif(checkOverflow(newVal) == true)\r\n @OFBit = true\r\n @ZRBit = false\r\n puts \"Overflow bit true. Zero bit false.\"\r\n else\r\n @ZRBit = false\r\n @OFBit = false\r\n puts \"Zero and overflow bits are false.\"\r\n end\r\n @RegA = newVal\r\n puts \"Registers added.\"\r\n end", "def asum()\n _asum()\n end", "def add_binary(a, b)\n ca = a.size - 1\n cb = b.size - 1\n carry = 0\n ans = ''\n while ca >= 0 && cb >= 0 do \n diga = a[ca].to_i\n digb = b[cb].to_i\n sum = diga + digb + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n ca -= 1\n cb -= 1\n end\n \n while ca >= 0\n diga = a[ca].to_i\n sum = diga + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n ca -= 1\n end \n\n while cb >= 0\n digb = b[cb].to_i\n sum = digb + carry\n ans.prepend((sum % 2).to_s)\n carry = sum / 2\n cb -= 1\n end\n\n carry > 0 ? ans.prepend(carry.to_s) : ans\n ans\nend", "def ADDER(a,b,cin)\n\treturn XOR(XOR(a,b),cin) , OR(AND(a,b),AND(cin,XOR(a,b)))\nend", "def func_one()\n\tsum, values = 0, [100, 123, 1023, 10]\n\tcatch :invalid_value do\n\t\tvalues.each do |val|\n\t\t\tsum += func_two(val)\n\t\tend\n\tend\n\tsum\nend", "def _reduce_247(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def shl1(e)\n ((1 << 64) - 1) & (eval_ex(e) << 1)\n end", "def _reduce_248(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def add_binary(a,b)\n return nil if( a.nil? && b.nil?)\n return a if( b.nil? || b.empty?)\n return b if( a.nil? || a.empty?)\n a_n = a.size\n b_n = b.size\n i = 0\n carry = 0\n result = ''\n while(i < a_n || i < b_n)\n if i >= a_n\n a_i = 0\n b_i = b[b_n - i -1].to_i\n elsif i >= b_n\n b_i = 0\n a_i = a[a_n - i - 1].to_i\n else\n b_i = b[b_n - i -1].to_i\n a_i = a[a_n - i - 1].to_i\n end\n add = a_i + b_i + carry\n result.prepend(add == 0 ? '0' : '1')\n carry = add < 2 ? 0 : 1\n i = i + 1\n end\n result.prepend('1') if carry == 1\n return result\nend", "def _reduce_7(val, _values, result)\n return val[0] + val[1] \n result\nend", "def icmp_calc_sum\n checksum = (icmp_type.to_i << 8)\t+ icmp_code.to_i\n chk_body = (body.to_s.size % 2 == 0 ? body.to_s : body.to_s + \"\\x00\")\n if 1.respond_to? :ord\n chk_body.split(\"\").each_slice(2).map { |x| (x[0].ord << 8) + x[1].ord }.each { |y| checksum += y }\n else\n chk_body.split(\"\").each_slice(2).map { |x| (x[0] << 8) + x[1] }.each { |y| checksum += y }\n end\n checksum = checksum % 0xffff\n checksum = 0xffff - checksum\n checksum == 0 ? 0xffff : checksum\n end", "def _reduce_245(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def _reduce_263(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n\n result\nend", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def execute_ADD(destination, source)\n\t\tset_auxiliary_carry_flag_from destination.value.lowest_4_bits + source.value.lowest_4_bits\n\t\tperform_arithmetic_operation_storing_result(source, destination, destination.value + source.value)\n\tend", "def _reduce_244(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def add_binary a, b\n return_arr = con_to_binary(a + b)\n return_arr.shift if return_arr[0] == \"0\"\n return_arr.join\nend", "def suppremum(d0, d1)\n d0 | d1\n end", "def icmp_calc_sum\n\t\t\tchecksum = (icmp_type.to_i << 8)\t+ icmp_code.to_i\n\t\t\tchk_body = (body.to_s.size % 2 == 0 ? body.to_s : body.to_s + \"\\x00\")\n\t\t\tif 1.respond_to? :ord\n\t\t\t\tchk_body.scan(/../).map { |x| (x[0].ord << 8) + x[1].ord }.each { |y| checksum += y }\n\t\t\telse\n\t\t\t\tchk_body.scan(/../).map { |x| (x[0] << 8) + x[1] }.each { |y| checksum += y }\n\t\t\tend\n\t\t\tchecksum = checksum % 0xffff\n\t\t\tchecksum = 0xffff - checksum\n\t\t\tchecksum == 0 ? 0xffff : checksum\n\t\tend", "def execute_SHL(operand) # Same instruction as SAL\n\t\t# all flags are affected except AF is undefined\n\t\tbit_moves = bit_shift_count_for(operand, operand.size)\n\t\texpected_value = operand.value << bit_moves\n\t\toperand.value = expected_value\n\t\tsize = operand.size\n\t\tmsb = size - 1\n\t\tset_shift_flags_from(operand.value, expected_value, expected_value[size], size)\n\t\tif bit_moves == 1\n\t\t\t@flags.set_bit_at(OVERFLOW_FLAG, operand.value[msb] != @flags.value[CARRY_FLAG] ? 1 : 0)\n\t\tend\n\tend", "def _reduce_255(val, _values, result)\n lexer.cmdarg_push 1\n \n result\nend", "def add_to_a(to_add)\n sum = @a + to_add\n @f = 0x00\n @f |= Z_FLAG if sum & 0xFF == 0x00\n @f |= H_FLAG if (@a & 0x0F) + (to_add & 0x0F) > 0x0F\n @f |= C_FLAG if sum > 0xFF\n @a = sum & 0xFF\n end", "def full_adder (p, q, carry_in=0)\n first_adder = half_adder(p,q)\n second_adder = half_adder(first_adder[0],carry_in)\n carry_out = first_adder[1] | second_adder[1]\n sum_out = second_adder[0]\n return sum_out, carry_out\nend", "def sum_machine(input_array)\n\toutput = input_array[0] + input_array[1]\n\treturn output\nend", "def onemax(bitstring)\n sum = 0\n bitstring.each_char {|x| sum+=1 if x=='1'}\n return sum\nend", "def ADC(address:)\n signed_a = signed_int(@accumulator)\n signed_m = signed_int(@ram[address])\n signed_sum = signed_a + signed_m\n (signed_sum > 127 || signed_sum < -128) ? set_flag(SR_OVERFLOW) : clear_flag(SR_OVERFLOW)\n\n sum = @accumulator + @ram[address] + (set?(SR_CARRY) ? 1 : 0)\n sum > 0xff ? set_flag(SR_CARRY) : clear_flag(SR_CARRY)\n @accumulator = sum & 0xff\n\n ZN_flags(@accumulator)\n end", "def compute_sum(int)\n sum = 0\n 1.upto(int) { |i| sum += i }\n sum\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_501(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n \n result\nend", "def _reduce_242(val, _values, result)\n result = @builder.binary_op(val[0], val[1], val[2])\n \n result\nend", "def SimpleAdding(num\n total = 1.upto(num).reduce(&:+)\n total \nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def _reduce_48(val, _values, result)\n result = @builder.logical_op(:and, val[0], val[1], val[2])\n \n result\nend", "def add(value)\n @sum ||= 0\n match value,\n None >> @sum,\n Some.(~any) >-> int { @sum += int }\nend", "def add(value)\n @sum ||= 0\n match value,\n None >> @sum,\n Some.(~any) >-> int { @sum += int }\nend", "def _reduce_36(val, _values, result)\n result = logop(:and, val[0], val[2])\n \n result\nend", "def add_binary(a,b)\n #your code here\n sum = a + b\n return sum.to_s(2)\nend", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def _reduce_36(val, _values, result)\n result = logical_op :and, val[0], val[2]\n \n result\nend", "def onemax(bitstring)\n sum = 0\n bitstring.size.times {|i| sum+=1 if bitstring[i].chr=='1'}\n return sum\nend", "def reduce\n @reduce_secpack = Tem::Assembler.assemble do |s|\n s.label :_secret\n s.label :_key\n s.data :tem_ubyte, @query_key.to_tem_key\n s.label :_check\n s.data :tem_ubyte, @check_bytes\n \n s.label :_signed\n # User-provided comparison procedure (signed).\n s.label :_comparison_proc\n yield s\n s.ret\n \n s.entry\n s.ldbc :const => 24\n s.outnew \n # Decrypt inputs.\n s.ldwc :const => :_key\n s.rdk\n s.stw :_key_id\n [1, 2].each do |i|\n s.ldw :_key_id\n s.kdfxb :from => :\"_output#{i}\", :to => :\"_id#{i}\", :size => 24\n \n # Compare the check bytes and abort if the inputs were tampered with.\n s.mcmpfxb :op1 => :\"_check#{i}\", :op2 => :\"_check\",\n :size => @check_bytes.length\n s.jz :\"_check_#{i}_ok\"\n s.halt\n s.label :\"_check_#{i}_ok\"\n end\n \n # Compare and output.\n s.call :_comparison_proc\n s.ldw :comparison\n s.jae :_output1_wins\n s.mcfxb :from => :_id2, :to => :_id1, :size => 16\n s.jmp :_output\n s.label :_output1_wins\n # Still do a memcpy, to prevent timing attacks.\n s.mcfxb :from => :_id2, :to => :_id2, :size => 16\n s.jmp :_output\n # Refresh the nonce to prevent learning about the comparison criteria.\n s.label :_output\n s.ldbc 3\n s.ldwc :_nonce1\n s.rnd\n # Encrypt output.\n s.ldwc :const => :_key\n s.rdk\n s.kefxb :from => :_id1, :size => 23, :to => 0xFFFF\n s.halt\n \n s.label :_plain\n # The comparison result produced by the user comparison procedure.\n s.label :comparison\n s.zeros :tem_short, 1\n s.label :_key_id\n s.zeros :tem_short, 1\n \n # The two inputs to reduce.\n [1, 2].each do |i|\n # Encrypted map/reduce output.\n s.label :\"_output#{i}\" \n s.zeros :tem_ubyte, 24\n # Unencrypted input (decrypted inside TEM).\n s.label :\"_id#{i}\"\n s.zeros :tem_ubyte, 8\n s.label :\"score#{i}\"\n s.zeros :tem_short, 1\n s.label :\"_nonce#{i}\"\n s.zeros :tem_ubyte, 3 \n s.label :\"_check#{i}\"\n s.zeros :tem_ubyte, @check_bytes.length\n end\n s.stack 16\n end\n end", "def add_binary(a, b)\n if a.length != b.length\n raise(ArgumentError, 'A and B are not equal length')\n end\n\n c = []\n carry = 0\n\n (a.length - 1).downto(0) do |i|\n int_a = a[i].to_i\n int_b = b[i].to_i\n\n c[i + 1] = (int_a + int_b + carry) % 2\n\n if int_a + int_b + carry >= 2\n carry = 1\n else\n carry = 0\n end\n end\n\n c[0] = carry\n c\nend", "def _reduce_522(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def add_binary(a,b)\r\n sum = a + b\r\n arr = []\r\n if sum == 1\r\n p \"1\"\r\n else #if sum != 1\r\n arr.push(sum % 2) \r\n while sum / 2 != 0\r\n sum = sum / 2\r\n arr.push(sum % 2)\r\n end\r\n p arr.reverse.join\r\n end\r\nend", "def sum(array)\n\tanswer = 0\n\tif array.length > 0 then\n\t\tarray.each {|x| answer += x}\n\telse\n\t\treturn 0\n\tend\n\treturn answer\nend", "def is_auxillary_carry?(a, b, op)\n a <<= 4;\n a >>= 4;\n b <<= 4;\n b >>= 4;\n\n if (op == :+)\n return !((a + b) < 16)\n else\n return !((a - b) <= a)\n end\n end", "def compute_sum(number)\n total = 0\n 1.upto(number) { |value| total += value }\n total\nend", "def _reduce_524(val, _values, result)\n result = -val[1] # TODO: pt_testcase\n\n result\nend", "def sum(array)\n array.reduce(0, :+)\n=begin\n res =0\n array.each { |a| res += a }\n res.to_i\n=end\nend", "def sum(a)\n return a.length == 0 ? 0 : a.inject(:+)\nend", "def _reduce_384(val, _values, result)\n result = args val\n result = 0 if result == s(:args)\n \n result\nend", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n \n result\nend", "def binary_integer_addition(b1, b2)\n\tr = []\n\tcarry = 0\n\t(b1.length-1).downto(0).each { |i|\n\t\tif b1[i] + b2[i] == 0\n\t\t\tr << 0 + carry\n\t\t\tcarry = 0\n\t\telsif b1[i] + b2[i] == 1\n\t\t\tcarry == 0 ? r << 1 : (r << 0; carry = 1)\n\t\telsif b1[i] + b2[i] == 2\n\t\t\tcarry == 0 ? r << 0 : r << 1\n\t\t\tcarry = 1\n\t\tend\n\t}\n\tif carry == 1\n\t\tr << 1\n\tend\n\tr.reverse\nend", "def uplus\n sprintf('U+%04X', @int)\n end", "def total\n sum = 0\n 64.times do |counter|\n sum += (2**counter)\n end\n sum\n end", "def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end", "def _reduce_58(val, _values, result)\n lhs, _, rhs = val\n result = logical_op :and, lhs, rhs\n\n result\nend", "def _reduce_257(val, _values, result)\n result = val[0] << @builder.associate(nil, val[2], nil)\n \n result\nend", "def _reduce_32(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def single_number(nums)\n sum = 0\n nums.each do |num|\n sum ^= num\n end\n\n sum\nend", "def SimpleAdding(num)\nsum=0\n 1.upto(num) do |x|\n\tsum+=x\n\tend\n\t\nreturn sum\nend", "def alt_adder(*args)\n\targs.inject(0){|total, num| total + num if num.is_a? Fixnum}\nend", "def compute_amount(calculable)\n 0\n #self.calculator.compute(calculable, self)\n end", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def _reduce_659(val, _values, result)\n result = [ @builder.kwnilarg(val[0], val[1]) ]\n \n result\nend", "def OF_CHECKING(a,b,sum) \n\tAND(XOR(sum,a),NOT(XOR(a,b)))\nend", "def _reduce_63(val, _values, result)\n @lexer.cond.push(true)\n\n result\nend", "def sum(a)\n a.length > 0 ? a.inject(:+) : 0\nend", "def add_binary(a,b)\n #your code here\n binary = a + b\n binary.to_s(2) # Convert um inteiro para string na base 2(base binária)\nend", "def _reduce_127(val, _values, result); end", "def _reduce_127(val, _values, result); end", "def add_binary(a, b)\n n = a.size \n m = b.size \n return add_binary(b,a) if n<m\n l = [n,m].max \n j = m-1\n i = l-1\n carry = 0\n sb = \"\"\n i.downto(0) do |i|\n carry +=1 if a[i] == \"1\"\n carry +=1 if b[j] == \"1\" && j>-1\n if (carry%2) == 1\n sb += \"1\"\n else\n sb += \"0\"\n end\n\n carry = carry/2 \n j-=1 \n end\n sb += \"1\" if carry == 1 \n return sb.reverse!\nend", "def ordv\n large = Array.new([0,0,0,0,0,0,0,0,0,1])\n (1..7830457).each do |n|# digit represents ,2^n\n passover = 0\n 9.downto(0).each do |i|\n large[i] *= 2\n large[i] += passover\n if large[i] >= 10\n large[i] %= 10\n passover = 1\n else\n passover = 0\n end\n end\n end\n (28433 * large.join.to_i + 1)%100000000000\nend", "def _reduce_659(val, _values, result)\n result = [ @builder.kwnilarg(val[0], val[1]) ]\n\n result\nend", "def _reduce_599(val, _values, result)\n yyerrok\n \n result\nend", "def hand_value\n\t\tadd_card_value(all_sums = [[]])\n\t\tconvert_aces(all_sums)\n\t\tall_sums.map! do |value_set|\n\t\t\tvalue_set.inject :+\n\t\tend\n\t\treturn_sum(all_sums)\n\tend", "def safe_add(x, y)\n v = (x + y) % (2**32)\n v > 2**31 ? v - 2**32 : v\n end", "def calculate_sum\n 1000000000000\n end", "def sum(a)\n a.reduce(0) {|b,c| b + c}\nend", "def _reduce_2(_val, _values, _result)\n 0\n end", "def plus_one(digits)\n sum, carry = [], 1\n\n digits.reverse_each do |digit|\n if carry.nonzero?\n value = digit + carry\n carry, value = value.divmod(10)\n else\n value = digit\n end\n\n sum.insert(0, value)\n end\n sum.insert(0, carry) if carry.nonzero?\n\n sum\nend", "def addMalus(val)\n\t\t@malus += val\n\tend", "def _reduce_63(val, _values, result); end", "def _reduce_63(val, _values, result); end" ]
[ "0.73391306", "0.6301429", "0.56117994", "0.5508578", "0.5476454", "0.54740465", "0.54649043", "0.5460478", "0.5322453", "0.5322453", "0.5267645", "0.5259907", "0.5227519", "0.52066934", "0.52048963", "0.520191", "0.517917", "0.517917", "0.514145", "0.5128445", "0.51220125", "0.51170945", "0.5110148", "0.5099369", "0.50913775", "0.5073072", "0.5069453", "0.50577724", "0.5035805", "0.50274175", "0.5024121", "0.50219023", "0.49952394", "0.49853176", "0.4983797", "0.49798238", "0.49795687", "0.49730125", "0.49461946", "0.49345988", "0.49316418", "0.49316418", "0.49316418", "0.49316418", "0.4923998", "0.49106055", "0.4902324", "0.4902324", "0.48981288", "0.48981288", "0.48916376", "0.48909238", "0.4876533", "0.4876533", "0.48761857", "0.4872191", "0.48560277", "0.485", "0.48464006", "0.48438242", "0.48419434", "0.48393834", "0.4837179", "0.48319572", "0.48308116", "0.48228073", "0.48168382", "0.4815985", "0.48133868", "0.48132455", "0.48112234", "0.48096237", "0.4799844", "0.47890958", "0.47890958", "0.47859892", "0.47808877", "0.47699565", "0.47697037", "0.47652346", "0.47647047", "0.47602838", "0.4747968", "0.47438273", "0.47403345", "0.47376126", "0.47376126", "0.47345483", "0.47317344", "0.47274327", "0.47177678", "0.4716897", "0.47116125", "0.47089624", "0.4704578", "0.47031564", "0.47017798", "0.4699446", "0.46981144", "0.46981144" ]
0.719777
1
OF_CHECKING for special 1Bit ALU Determines the overflow structurally.
def OF_CHECKING(a,b,sum) AND(XOR(sum,a),NOT(XOR(a,b))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkOverflow(testee)\r\n if(testee > ((2**32) - 1)/2 )\r\n return true\r\n elsif(testee < (-1) * 2**31)\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def can_overflow?\n false\n end", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def compute_need_bits; end", "def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end", "def set_overflow_flag_from(source_value, destination_value, expected_value, actual_value, msb)\n\t\tflag = ( ((expected_value - destination_value)[msb] == destination_value[msb]) && (actual_value[msb] != destination_value[msb]) ? 1 : 0 )\n\t\t@flags.set_bit_at(OVERFLOW_FLAG, flag)\n\tend", "def verify_ref_1l_condition\n Unified835Output::BenignNull.new\n end", "def shl1(e)\n ((1 << 64) - 1) & (eval_ex(e) << 1)\n end", "def bit_small; @bit_small ||= gbit(8) end", "def analysis_overflowed\n return @state_to_recursion_overflow_configurations_map.size > 0\n end", "def test_get_coord_from_bv_should_fail_when_more_than_one_bit_set\n assert_raises(ArgumentError) {RulesEngine.get_coord_for_bv(0x03)}\n end", "def test_005_bounded?()\n TestVals.each do |sVal|\n bs = BitString.new(sVal)\n assert(! bs.bounded?)\n bs = BitString.new(sVal, sVal.length)\n assert(bs.bounded?)\n bs = BitString.new(sVal.length) { |i| sVal.reverse[i,1].to_i }\n assert(bs.bounded?)\n end\n end", "def test_check_hex_upper_bound\r\n assert_nil @g.check_hex('01efg')\r\n end", "def check(number)\n \n end", "def check_for_implication_loops\n # actually this is tricky\n end", "def test_check_hex_upper_bound_num\r\n assert_nil @g.check_hex(':1efg')\r\n end", "def test_021_empty()\n TestVals.each do |sVal|\n bs = BitString.new(sVal)\n assert_equal(sVal.to_i.eql?(0),\n bs.empty?,\n \"Test unbounded '#{sVal}'.empty?\")\n #\n # Now bounded.\n #\n bs = BitString.new(sVal, sVal.length)\n assert_equal(sVal.to_i.eql?(0),\n bs.empty?,\n \"Test bounded '#{sVal}'.empty?\")\n end\n end", "def test_check_hex_lower_bound\r\n assert_nil @g.check_hex('/1efg')\r\n end", "def check_overflow\r\n if @depth >= 100\r\n msgbox(Vocab::EventOverflow)\r\n exit\r\n end\r\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def verify\n if (@_buffer.offset + fbe_offset + fbe_size) > @_buffer.size\n return FBE::Integer::MAX\n end\n\n fbe_size\n end", "def defensive\n return (self.offensive && self.offensive < 8)\n end", "def valid? _e = self.e\n _e and _e.between?(2, self.p-2) and _e.bits_set > 1\n end", "def win_checker\n @board.flatten.max == 16_384\n end", "def check_error_no\n @error_no = 0\n if @err_bit\n if @data != nil && @data.size > 0\n @error_no = (0x0 - 0xFFFFFFFF + (BioPacket.swap_dword(@data.first) - 1)).to_i\n @error_desc = BioPacket.format_err_desc(@error_no)\n $test_logger.log(\"Error#{(\" in ACK\" if @ack_bit)}: #{@error_no} #{@error_desc}\")\n else \n $test_logger.log(\"Error bit is set but error code not found!!\")\n end\n end\n end", "def result_of_checking; end", "def _anc\n @_p_nz = @_a &= @data\n @_p_c = @_p_nz >> 7\n end", "def test_int_check_pass\n assert_equal int_check([]), true # EDGE CASE\n assert_equal int_check(['1']), true # pass\n assert_equal int_check(['1', '1']), true # pass\n assert_equal int_check(['1', '1', '1']), true # pass\n end", "def overflow\n @funcT.overflow\n end", "def _low_byte(operand)\n # operand & 255\n -> { _eval_byte(operand) & 255 }\nend", "def poopy?\n\t\t@stuff_in_intestine >= 8\n\tend", "def zu_kalt?(in_temp)\n\tcheck_pre((in_temp.int?))\n\tin_temp < ANGENEHM_LOWER\nend", "def nonzero?; end", "def elv_armulys\n ((@code & 0xFFFF) % 10) <= 4\n end", "def test_011_msb()\n TestVals.each do |sVal|\n bs = BitString.new(sVal)\n msg = \"Test RuntimeError raised by unbounded msb()\"\n assert_raise(RuntimeError, msg) do\n bs.msb\n end\n bs = BitString.new(sVal, sVal.length)\n assert_equal(sVal[0,1].to_i,\n bs.msb,\n \"Test bounded msb(#{sVal}) => #{sVal[0,1].to_i}\")\n end\n end", "def alto?\n @cr[0xb][7] == 1\n end", "def check ; true ; end", "def unangenehm?(in_temp)\n\tcheck_pre((in_temp.int?))\n\tnot angenehm?(in_temp)\nend", "def test_that_unmasking_works\n end", "def nonzero?() end", "def next_word_for_a?\n # See DCPU16::ValueSet and DCPU-16 specification for more information about these values\n [0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x1E, 0x1F].include? @a\n end", "def get_perlin_bool_1d(x, chance=1, outof=2)\n throw Exception.new(\"chance must be less than outof\") if chance >= outof\n get_perlin_int_1d(x, 1, outof) <= chance\n end", "def get_perlin_bool_1d(x, chance=1, outof=2)\n throw Exception.new(\"chance must be less than outof\") if chance >= outof\n get_perlin_int_1d(x, 1, outof) <= chance\n end", "def angenehm?(in_temp)\n\tcheck_pre((in_temp.int?))\n#\tANGENEHM_RANGE === in_temp\n in_temp.in?(ANGENEHM_RANGE)\nend", "def chkall\n (1..@@pow2_N).to_a.each do |i|\n h = sha32b(\"#{i}\")\n @allhash[h] = 0 if !@allhash[h]\n @allhash[h] += 1\n end\n @allhash.size\n end", "def used_bits?(_options = {})\n used_bits.size > 0\n end", "def check_value(v, options = {:length => 0x1})\n array :initial_length => options[:length] do\n uint32 :check_value => lambda { value == v }\n end\n end", "def valid? _e = self.e\n _e and _e.between?(2, self.p-2) and _e.bits_set > 1\n end", "def check_offset(io)\n if has_param?(:check_offset)\n actual_offset = io.offset\n expected = eval_param(:check_offset, :offset => actual_offset)\n\n if not expected\n raise ValidityError, \"offset not as expected\"\n elsif actual_offset != expected and expected != true\n raise ValidityError, \"offset is '#{actual_offset}' but \" +\n \"expected '#{expected}'\"\n end\n elsif has_param?(:adjust_offset)\n actual_offset = io.offset\n expected = eval_param(:adjust_offset)\n if actual_offset != expected\n begin\n seek = expected - actual_offset\n io.seekbytes(seek)\n warn \"adjusting stream position by #{seek} bytes\" if $VERBOSE\n rescue\n # could not seek so raise an error\n raise ValidityError, \"offset is '#{actual_offset}' but \" +\n \"couldn't seek to expected '#{expected}'\"\n end\n end\n end\n end", "def one_bit?\n identify.include?('1-bit')\n end", "def not(e)\n ((1 << 64) - 1) & (~eval_ex(e))\n end", "def test_004_length()\n TestVals.each do |sVal|\n #\n # The length() method returns either the size of a bounded\n # bitstring, or the number of digits from the most significant\n # 1.\n #\n uLength = sVal.sub(/^0+(.)/, '\\1').length\n bLength = sVal.length\n bs = BitString.new(sVal)\n assert_equal(uLength,\n bs.length,\n \"Test unbounded '#{sVal}'.length => #{uLength}\")\n #\n # Now do the same check for the bounded version.\n #\n bs = BitString.new(sVal, sVal.length)\n bLength = sVal.length\n assert_equal(bLength,\n bs.length,\n \"Test bounded '#{sVal}'.length => #{bLength}\")\n end\n end", "def execute_SHL(operand) # Same instruction as SAL\n\t\t# all flags are affected except AF is undefined\n\t\tbit_moves = bit_shift_count_for(operand, operand.size)\n\t\texpected_value = operand.value << bit_moves\n\t\toperand.value = expected_value\n\t\tsize = operand.size\n\t\tmsb = size - 1\n\t\tset_shift_flags_from(operand.value, expected_value, expected_value[size], size)\n\t\tif bit_moves == 1\n\t\t\t@flags.set_bit_at(OVERFLOW_FLAG, operand.value[msb] != @flags.value[CARRY_FLAG] ? 1 : 0)\n\t\tend\n\tend", "def check32_bit_on64_system\n return @check32_bit_on64_system\n end", "def chk_config(frame)\n\t#i=0\n calc_chk=0\n \n raw = frame.to_binary_s\n if @checksum_comments\n puts raw.inspect\n end\n\n raw[3..33].split(//).each do |b|\n calc_chk = 0xFF & (calc_chk+BinData::Int8.read(b))\n end\n if @checksum_comments\n puts \"_______________\"\n puts \"CHECKSUM RETURN\"\n puts calc_chk.to_s\n end\n return calc_chk\n end", "def supports_check_constraints?\n false\n end", "def checks; end", "def check_offset(*)\n false\n end", "def test_018_each()\n TestVals.each do |sVal|\n bs = BitString.new(sVal)\n pos = 0\n bs.each do |val|\n assert_equal(val,\n bs[pos],\n \"Test unbounded each block(#{val}) (for #{pos})\")\n pos += 1\n end\n #\n # And again for a bounded value.\n #\n bs = BitString.new(sVal, sVal.length)\n pos = 0\n bs.each do |val|\n assert_equal(val,\n bs[pos],\n \"Test bounded each block(#{val}) (for #{pos})\")\n pos += 1\n end\n end\n end", "def validate_check_flap_detection(check)\n if either_are_set?(check[:low_flap_threshold], check[:high_flap_threshold])\n must_be_an_integer(check[:low_flap_threshold]) ||\n invalid(check, \"check low flap threshold must be an integer\")\n must_be_an_integer(check[:high_flap_threshold]) ||\n invalid(check, \"check high flap threshold must be an integer\")\n end\n end", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def verify_fields\n fbe_current_offset = 0\n\n byte0.fbe_offset = fbe_current_offset\n fbe_field_size = byte0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte1.fbe_offset = fbe_current_offset\n fbe_field_size = byte1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte2.fbe_offset = fbe_current_offset\n fbe_field_size = byte2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte3.fbe_offset = fbe_current_offset\n fbe_field_size = byte3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte4.fbe_offset = fbe_current_offset\n fbe_field_size = byte4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n byte5.fbe_offset = fbe_current_offset\n fbe_field_size = byte5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char0.fbe_offset = fbe_current_offset\n fbe_field_size = char0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char1.fbe_offset = fbe_current_offset\n fbe_field_size = char1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char2.fbe_offset = fbe_current_offset\n fbe_field_size = char2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char3.fbe_offset = fbe_current_offset\n fbe_field_size = char3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char4.fbe_offset = fbe_current_offset\n fbe_field_size = char4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n char5.fbe_offset = fbe_current_offset\n fbe_field_size = char5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar0.fbe_offset = fbe_current_offset\n fbe_field_size = wchar0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar1.fbe_offset = fbe_current_offset\n fbe_field_size = wchar1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar2.fbe_offset = fbe_current_offset\n fbe_field_size = wchar2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar3.fbe_offset = fbe_current_offset\n fbe_field_size = wchar3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar4.fbe_offset = fbe_current_offset\n fbe_field_size = wchar4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n wchar5.fbe_offset = fbe_current_offset\n fbe_field_size = wchar5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b0.fbe_offset = fbe_current_offset\n fbe_field_size = int8b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b1.fbe_offset = fbe_current_offset\n fbe_field_size = int8b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b2.fbe_offset = fbe_current_offset\n fbe_field_size = int8b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b3.fbe_offset = fbe_current_offset\n fbe_field_size = int8b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b4.fbe_offset = fbe_current_offset\n fbe_field_size = int8b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int8b5.fbe_offset = fbe_current_offset\n fbe_field_size = int8b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint8b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint8b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b0.fbe_offset = fbe_current_offset\n fbe_field_size = int16b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b1.fbe_offset = fbe_current_offset\n fbe_field_size = int16b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b2.fbe_offset = fbe_current_offset\n fbe_field_size = int16b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b3.fbe_offset = fbe_current_offset\n fbe_field_size = int16b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b4.fbe_offset = fbe_current_offset\n fbe_field_size = int16b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int16b5.fbe_offset = fbe_current_offset\n fbe_field_size = int16b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint16b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint16b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b0.fbe_offset = fbe_current_offset\n fbe_field_size = int32b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b1.fbe_offset = fbe_current_offset\n fbe_field_size = int32b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b2.fbe_offset = fbe_current_offset\n fbe_field_size = int32b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b3.fbe_offset = fbe_current_offset\n fbe_field_size = int32b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b4.fbe_offset = fbe_current_offset\n fbe_field_size = int32b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int32b5.fbe_offset = fbe_current_offset\n fbe_field_size = int32b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint32b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint32b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b0.fbe_offset = fbe_current_offset\n fbe_field_size = int64b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b1.fbe_offset = fbe_current_offset\n fbe_field_size = int64b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b2.fbe_offset = fbe_current_offset\n fbe_field_size = int64b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b3.fbe_offset = fbe_current_offset\n fbe_field_size = int64b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b4.fbe_offset = fbe_current_offset\n fbe_field_size = int64b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n int64b5.fbe_offset = fbe_current_offset\n fbe_field_size = int64b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b0.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b0.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b1.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b1.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b2.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b2.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b3.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b3.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b4.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b4.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n uint64b5.fbe_offset = fbe_current_offset\n fbe_field_size = uint64b5.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_offset\n end", "def check(word)\n bloom_filter(word).inject(true) { |is_real, i| is_real && @bitmap[i] }\n end", "def masking?; false; end", "def valid_primitive?\n # \n return m > n && (m - n) % 2 == 1 \n end", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + byte0.fbe_size) > fbe_struct_size\n return true\n end\n unless byte0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte0.fbe_size\n\n if (fbe_current_size + byte1.fbe_size) > fbe_struct_size\n return true\n end\n unless byte1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte1.fbe_size\n\n if (fbe_current_size + byte2.fbe_size) > fbe_struct_size\n return true\n end\n unless byte2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte2.fbe_size\n\n if (fbe_current_size + byte3.fbe_size) > fbe_struct_size\n return true\n end\n unless byte3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte3.fbe_size\n\n if (fbe_current_size + byte4.fbe_size) > fbe_struct_size\n return true\n end\n unless byte4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte4.fbe_size\n\n if (fbe_current_size + byte5.fbe_size) > fbe_struct_size\n return true\n end\n unless byte5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += byte5.fbe_size\n\n if (fbe_current_size + char0.fbe_size) > fbe_struct_size\n return true\n end\n unless char0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char0.fbe_size\n\n if (fbe_current_size + char1.fbe_size) > fbe_struct_size\n return true\n end\n unless char1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char1.fbe_size\n\n if (fbe_current_size + char2.fbe_size) > fbe_struct_size\n return true\n end\n unless char2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char2.fbe_size\n\n if (fbe_current_size + char3.fbe_size) > fbe_struct_size\n return true\n end\n unless char3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char3.fbe_size\n\n if (fbe_current_size + char4.fbe_size) > fbe_struct_size\n return true\n end\n unless char4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char4.fbe_size\n\n if (fbe_current_size + char5.fbe_size) > fbe_struct_size\n return true\n end\n unless char5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += char5.fbe_size\n\n if (fbe_current_size + wchar0.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar0.fbe_size\n\n if (fbe_current_size + wchar1.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar1.fbe_size\n\n if (fbe_current_size + wchar2.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar2.fbe_size\n\n if (fbe_current_size + wchar3.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar3.fbe_size\n\n if (fbe_current_size + wchar4.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar4.fbe_size\n\n if (fbe_current_size + wchar5.fbe_size) > fbe_struct_size\n return true\n end\n unless wchar5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += wchar5.fbe_size\n\n if (fbe_current_size + int8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b0.fbe_size\n\n if (fbe_current_size + int8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b1.fbe_size\n\n if (fbe_current_size + int8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b2.fbe_size\n\n if (fbe_current_size + int8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b3.fbe_size\n\n if (fbe_current_size + int8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b4.fbe_size\n\n if (fbe_current_size + int8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int8b5.fbe_size\n\n if (fbe_current_size + uint8b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b0.fbe_size\n\n if (fbe_current_size + uint8b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b1.fbe_size\n\n if (fbe_current_size + uint8b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b2.fbe_size\n\n if (fbe_current_size + uint8b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b3.fbe_size\n\n if (fbe_current_size + uint8b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b4.fbe_size\n\n if (fbe_current_size + uint8b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint8b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint8b5.fbe_size\n\n if (fbe_current_size + int16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b0.fbe_size\n\n if (fbe_current_size + int16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b1.fbe_size\n\n if (fbe_current_size + int16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b2.fbe_size\n\n if (fbe_current_size + int16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b3.fbe_size\n\n if (fbe_current_size + int16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b4.fbe_size\n\n if (fbe_current_size + int16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int16b5.fbe_size\n\n if (fbe_current_size + uint16b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b0.fbe_size\n\n if (fbe_current_size + uint16b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b1.fbe_size\n\n if (fbe_current_size + uint16b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b2.fbe_size\n\n if (fbe_current_size + uint16b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b3.fbe_size\n\n if (fbe_current_size + uint16b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b4.fbe_size\n\n if (fbe_current_size + uint16b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint16b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint16b5.fbe_size\n\n if (fbe_current_size + int32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b0.fbe_size\n\n if (fbe_current_size + int32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b1.fbe_size\n\n if (fbe_current_size + int32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b2.fbe_size\n\n if (fbe_current_size + int32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b3.fbe_size\n\n if (fbe_current_size + int32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b4.fbe_size\n\n if (fbe_current_size + int32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int32b5.fbe_size\n\n if (fbe_current_size + uint32b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b0.fbe_size\n\n if (fbe_current_size + uint32b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b1.fbe_size\n\n if (fbe_current_size + uint32b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b2.fbe_size\n\n if (fbe_current_size + uint32b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b3.fbe_size\n\n if (fbe_current_size + uint32b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b4.fbe_size\n\n if (fbe_current_size + uint32b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint32b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint32b5.fbe_size\n\n if (fbe_current_size + int64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b0.fbe_size\n\n if (fbe_current_size + int64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b1.fbe_size\n\n if (fbe_current_size + int64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b2.fbe_size\n\n if (fbe_current_size + int64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b3.fbe_size\n\n if (fbe_current_size + int64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b4.fbe_size\n\n if (fbe_current_size + int64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless int64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += int64b5.fbe_size\n\n if (fbe_current_size + uint64b0.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b0.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b0.fbe_size\n\n if (fbe_current_size + uint64b1.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b1.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b1.fbe_size\n\n if (fbe_current_size + uint64b2.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b2.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b2.fbe_size\n\n if (fbe_current_size + uint64b3.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b3.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b3.fbe_size\n\n if (fbe_current_size + uint64b4.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b4.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b4.fbe_size\n\n if (fbe_current_size + uint64b5.fbe_size) > fbe_struct_size\n return true\n end\n unless uint64b5.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += uint64b5.fbe_size\n\n true\n end", "def unit_compatibility(source_unit, desired_unit)\n return Unitwise(1, source_unit).compatible_with?Unitwise(1, desired_unit)\nend", "def elv_blindalys\n !elv_armulys\n end", "def check_and_emend_edrpou\n self.edrpou_balance_holder = correct_edrpou(edrpou_balance_holder) if edrpou_length_short?(edrpou_balance_holder)\n self.edrpou_renter = correct_edrpou(edrpou_renter) if edrpou_length_short?(edrpou_renter)\n end", "def test_should_detect_simple_check\n e = RulesEngine.new\n place_pieces(e, \"\n - - - - - - - K\n - - - - - - - -\n - - - - - - - -\n - - - R - - - -\n - - - - - - - - \n - - - - - - - - \n - - - - - - - - \n - - - k - - - - \n \")\n e.calculate_colour_attack(Colour::BLACK)\n assert(e.in_check?(Colour::WHITE))\n end", "def isBusted\n\t\tif @value > 21\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend", "def big_bad; end", "def check_taxonomic_length(tax)\n !tax_too_short(tax) && !tax_too_long(tax)\nend", "def verify_fields\n fbe_current_offset = 0\n\n id.fbe_offset = fbe_current_offset\n fbe_field_size = id.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n symbol.fbe_offset = fbe_current_offset\n fbe_field_size = symbol.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n side.fbe_offset = fbe_current_offset\n fbe_field_size = side.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n type.fbe_offset = fbe_current_offset\n fbe_field_size = type.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n price.fbe_offset = fbe_current_offset\n fbe_field_size = price.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n volume.fbe_offset = fbe_current_offset\n fbe_field_size = volume.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_offset\n end", "def processor64_bit_check_failed_percentage\n return @processor64_bit_check_failed_percentage\n end", "def is_apocalyptic(number)\n num_str = (2**number).to_s\n array_of_instances = num_str.scan /666/\n times = array_of_instances.length\n case times\n when 0\n \"Safe\"\n when 1\n \"Single\"\n when 2\n \"Double\"\n when 3\n \"Triple\"\n else\n \"Fucked\"\n end\nend", "def verify_fields(fbe_struct_size)\n fbe_current_size = 4 + 4\n\n if (fbe_current_size + id.fbe_size) > fbe_struct_size\n return true\n end\n unless id.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += id.fbe_size\n\n if (fbe_current_size + symbol.fbe_size) > fbe_struct_size\n return true\n end\n unless symbol.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += symbol.fbe_size\n\n if (fbe_current_size + side.fbe_size) > fbe_struct_size\n return true\n end\n unless side.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += side.fbe_size\n\n if (fbe_current_size + type.fbe_size) > fbe_struct_size\n return true\n end\n unless type.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += type.fbe_size\n\n if (fbe_current_size + price.fbe_size) > fbe_struct_size\n return true\n end\n unless price.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += price.fbe_size\n\n if (fbe_current_size + volume.fbe_size) > fbe_struct_size\n return true\n end\n unless volume.verify\n return false\n end\n # noinspection RubyUnusedLocalVariable\n fbe_current_size += volume.fbe_size\n\n true\n end", "def can_afford_insurance\n return 1 if (@bet / 2) <= @bankroll\n return nil\n end", "def checked?; end", "def correct?\n total = 0\n @element_list.each do |element|\n total += element[1]\n end\n total == @target && @element_list.size >= @minimum_size\n end", "def seuil()\n\t\treturn 0\n\tend", "def add_wrong(high_bit, input_array)\n\tnum = (2..high_bit).to_a.sample # rand(2..high_bit)\n\tuntil good_wrong?(num, input_array)\n\t\tnum = (2..high_bit).to_a.sample #rand(2..high_bit)\n\tend\n\treturn num\nend", "def sanity_check\n @raw_barcode.include?(0) && @raw_barcode.include?(Barcode_Columns-1)\n end", "def execute_JO(operand)\n\t\tjump_conditionally_to_signed_displacement(operand, @flags.value[OVERFLOW_FLAG] == 1) # Non-zero means set\n\tend", "def check(x)\r\n a0 = a = Math.sqrt(x).floor\r\n return 0 if a * a == x\r\n h = kp = d = 1\r\n k = hp = m = 0\r\n loop do\r\n h, hp = h * a + hp, h\r\n k, kp = k * a + kp, k\r\n m = d * a - m\r\n d = (x - m * m) / d\r\n a = (a0 + m) / d\r\n return h if h * h - x * k * k == 1\r\n end\r\n 0\r\nend", "def verify_fields\n fbe_current_offset = 0\n\n currency.fbe_offset = fbe_current_offset\n fbe_field_size = currency.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n amount.fbe_offset = fbe_current_offset\n fbe_field_size = amount.verify\n if fbe_field_size == FBE::Integer::MAX\n return FBE::Integer::MAX\n end\n fbe_current_offset += fbe_field_size\n\n # noinspection RubyUnnecessaryReturnValue\n fbe_current_offset\n end", "def _nbits(x)\n raise TypeError, \"The argument to _nbits should be nonnegative.\" if x < 0\n # Ruby 2.1 introduced Integer#bit_length\n return x.bit_length if x.respond_to? :bit_length\n if x <= MAXIMUM_SMALLISH_INTEGER\n return 0 if x==0\n x.to_s(2).length\n elsif x <= NBITS_LIMIT\n Math.frexp(x).last\n else\n n = 0\n while x!=0\n y = x\n x >>= NBITS_BLOCK\n n += NBITS_BLOCK\n end\n n += y.to_s(2).length - NBITS_BLOCK if y!=0\n n\n end\n end", "def aligned_ok(size)\n (size & (2 * size_t - 1)).zero?\n end" ]
[ "0.6399198", "0.63429314", "0.59655744", "0.577092", "0.5697214", "0.5576874", "0.54894495", "0.53329", "0.5220747", "0.5174487", "0.5170145", "0.51628995", "0.51388925", "0.5131029", "0.5130343", "0.51157725", "0.5109279", "0.50655705", "0.5053869", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.5045028", "0.502002", "0.5012089", "0.501008", "0.5004158", "0.50023675", "0.5001716", "0.50003487", "0.49983877", "0.49974865", "0.49804056", "0.49772212", "0.49625194", "0.4954268", "0.49538514", "0.4953149", "0.49492124", "0.4927091", "0.4924726", "0.4910428", "0.49073336", "0.49056834", "0.49056834", "0.48817378", "0.48786378", "0.48755765", "0.48707193", "0.48567316", "0.4853256", "0.484448", "0.48424244", "0.48410845", "0.484034", "0.48348576", "0.48345438", "0.48311397", "0.48219454", "0.48208818", "0.48196453", "0.48141906", "0.48117223", "0.48065096", "0.48037684", "0.48033813", "0.48010194", "0.48003536", "0.47993082", "0.47974083", "0.47931433", "0.4792064", "0.47909856", "0.47902358", "0.47888005", "0.4785901", "0.4784111", "0.47833794", "0.47812256", "0.47696298", "0.47691768", "0.476299", "0.47623727", "0.4759345", "0.47565535", "0.47520626", "0.47492886", "0.47485387", "0.4746863", "0.47444546" ]
0.52185214
9
1Bit ALU with Overflow Checking Same as ALU but with Overflow Checking
def ALU1BIT_OF (a,b,cin,binv,op1,op2) b = MUX2X1(b,binv) sUM_RESULT = ADDER(a,b,cin) puts sUM_RESULT[0] ovf = OF_CHECKING(a,b,sUM_RESULT[0]) #Send out an array triple of result, cout, overflow return MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def shl1(e)\n ((1 << 64) - 1) & (eval_ex(e) << 1)\n end", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def a(value)\n value & 0x000000ff\n end", "def a(value)\n value & 0x000000ff\n end", "def aes_bit(vector, n)\n (vector >> n) & 1\n end", "def onemax(bitstring)\n sum = 0\n bitstring.each_char {|x| sum+=1 if x=='1'}\n return sum\nend", "def onemax(bitstring)\n sum = 0\n bitstring.size.times {|i| sum+=1 if bitstring[i].chr=='1'}\n return sum\nend", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def solution(a)\n # write your code in Ruby 2.2\n \n return 0 if a.empty?\n \n # decode\n bits = []\n a.each_with_index do |bit, i|\n bits << bit*((-2)**i)\n end\n \n changed_bits = bits.map { |el| -el }\n answer = []\n changed_bits.each_with_index do |changed_bit, i|\n answer\n end\n # number = bits.inject(:+)\n \n # change number\n # number = -number\n \n # encode\n \n end", "def _low_byte(operand)\n # operand & 255\n -> { _eval_byte(operand) & 255 }\nend", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def read_u1\n read(1).first & 0xff\n end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def find_fast(u)\n u += 0xe91aaa35\n u ^= u >> 16\n u += (u << 8) & 0xFFFFFFFF\n u &= 0xFFFFFFFF\n u ^= u >> 4\n b = (u >> 8) & 0x1ff\n a = ((u + ((u << 2) & 0xFFFFFFFF)) & 0xFFFFFFFF) >> 19\n a ^ Arrays::HASH_ADJUST[b]\n end", "def masked_value_v1(value)\n # Int masks for one and zero chars\n ones_mask = @mask.chars.map { |c| c == \"1\" ? \"1\" : \"0\" }.join.to_i(2)\n zeros_mask = @mask.chars.map { |c| c == \"0\" ? \"1\" : \"0\" }.join.to_i(2)\n\n result = (ones_mask | value) & ~zeros_mask\n\n if DEBUG\n puts \" Mask: #{@mask}\" \n puts \" Ones Mask: #{padded_binary_string(ones_mask)}\" \n puts \" Zeros Mask: #{padded_binary_string(zeros_mask)}\" \n puts \"Initial value: #{padded_binary_string(value)} (decimal #{value})\"\n puts \" Masked value: #{padded_binary_string(result)} (decimal #{result})\"\n end\n\n result\n end", "def expo(x) ([x].pack(\"G\")[0..1].unpack(\"S>\")[0] & 0b0111111111110000) >> 4; end", "def bit_small; @bit_small ||= gbit(8) end", "def ordv\n large = Array.new([0,0,0,0,0,0,0,0,0,1])\n (1..7830457).each do |n|# digit represents ,2^n\n passover = 0\n 9.downto(0).each do |i|\n large[i] *= 2\n large[i] += passover\n if large[i] >= 10\n large[i] %= 10\n passover = 1\n else\n passover = 0\n end\n end\n end\n (28433 * large.join.to_i + 1)%100000000000\nend", "def to_vui(ary,ofs)\n b0=ary[ofs]\n return [b0,1] if b0 <128\n b0&=0x7f\n b1=ary[ofs+1]\n return [b0+(b1<<7),2] if b1<128\n b1&=0x7f\n b2=ary[ofs+2]\n return [b0+(b1<<7)+(b2<<14),3] if b2<128\n b2&=0x7f \n b3=ary[ofs+3]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21),4] if b3<128\n b3&=0x7f \n b4=ary[ofs+4]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28),5]\n throw \"error\"\nend\n# buf to varlong\ndef to_vul(ary,ofs)\n b0=ary[ofs]\n return [b0,1] if b0 <128\n b0&=0x7f\n b1=ary[ofs+1]\n return [b0+(b1<<7),2] if b1<128\n b1&=0x7f\n b2=ary[ofs+2]\n return [b0+(b1<<7)+(b2<<14),3] if b2<128\n b2&=0x7f \n b3=ary[ofs+3]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21),4] if b3<128\n b3&=0x7f \n b4=ary[ofs+4]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28),5]\n b4&=0x7f\n b5=ary[ofs+5]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35),6]\n b5&=0x7f\n b6=ary[ofs+6]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42),7]\n b6&=0x7f\n b7=ary[ofs+7]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49),8]\n b7&=0x7f\n b8=ary[ofs+8]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49)+(b8<<56),9]\n b8&=0x7f\n b9=ary[ofs+9]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49)+(b8<<56)+(b9<<63),10]\n throw \"error\"\nend\n\ndef to_l(ary,ofs)\n return ary[ofs+7]+(ary[ofs+6]<<8)+(ary[ofs+5]<<16)+(ary[ofs+4]<<24)+(ary[ofs+3]<<32)+(ary[ofs+2]<<40)+(ary[ofs+1]<<48)+(ary[ofs]<<56)\nend\n\n\ndef bm2ary(bm)\n out=[0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]\n out[0]=1 if bm & 1 == 1\n out[1]=1 if bm & 2 == 2\n out[2]=1 if bm & 4 == 4\n out[3]=1 if bm & 8 == 8\n out[4]=1 if bm & 16 == 16\n out[5]=1 if bm & 32 == 32\n out[6]=1 if bm & 64 == 64\n out[7]=1 if bm & 128 == 128\n out[8]=1 if bm & 256 == 256\n out[9]=1 if bm & 512 == 512\n out[10]=1 if bm & 1024 == 1024\n out[11]=1 if bm & 2048 == 2048\n out[12]=1 if bm & 4096 == 4096\n out[13]=1 if bm & 8192 == 8192\n out[14]=1 if bm & 16384 == 16384\n out[15]=1 if bm & 32768 == 32768\n return out\nend\n\n\n# long \ndef i32_to_bitary(v)\n out=[]\n 32.times do |i|\n out[31-i]=v&1\n v=v>>1\n end\n return out\nend\n\ndef bitary_to_i(ba)\n out=0\n v=1\n ba.size.times do |i|\n out+=v if ba[ba.size-1-i]==1 \n v=v<<1\n end\n return out\nend\n\n# [25215072,806882310],[25215072,806882310],[25215072,806882310], ...\n#\n# 9 bits * 256 = 2304 bits, 36 longs\n# irb(main):002:0> printf(\"%b\",25215072)\n# 1100000001100000001100000\n# 110000000 110000000 1100000\n# 000011000 000011000 000011000\n\n# [[25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215328,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215073,-2145907706],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [0,806882310]]\n\n#\n# 19200, 11488\n# {\"x\":1200,\"z\":718,\"groundUp\":true,\"bitMap\":15,\"heightmaps\":{\"type\":\"compound\",\"name\":\"\",\"value\":{\"MOTION_BLOCKING\":{\"type\":\"longArray\",\"value\":[[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[1,-117670337]]},\"WORLD_SURFACE\":{\"type\":\"longArray\",\"value\":[[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[1,-117670337]]}}}\n\n# MSB - LSB\n# 0 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee fffffffff ggggggggg hhhhhhhhh iiiiiiiii\n# \ndef la2hm(la)\n outhm=[]\n ba=[]\n la.each do |pair|\n ba0=i32_to_bitary(pair[0])\n ba1=i32_to_bitary(pair[1])\n ba63=ba0[1..-1]+ba1 # 9*7\n slices=[]\n ba63.each_slice(9) do |slice|\n slices.push(slice)\n end\n slices.reverse.each do |slice|\n outhm.push(bitary_to_i(slice))\n end\n end\n return outhm\nend\n\n# ul:uint64_t\ndef ul2blocks(ul,bit_depth)\n \n if bit_depth==4 then\n # 1ULに16個入ってる\n s0=(ul>>48)&0xffff\n s1=(ul>>32)&0xffff\n s2=(ul>>16)&0xffff\n s3=ul&0xffff\n return [\n (s0>>12)&0xf,(s0>>8)&0xf,(s0>>4)&0xf,s0&0xf,\n (s1>>12)&0xf,(s1>>8)&0xf,(s1>>4)&0xf,s1&0xf,\n (s2>>12)&0xf,(s2>>8)&0xf,(s2>>4)&0xf,s2&0xf,\n (s3>>12)&0xf,(s3>>8)&0xf,(s3>>4)&0xf,s3&0xf\n ]\n elsif bit_depth==5 then\n # 1ULに12個はいっててMSBが0000\n return [\n (ul>>55)&0x1f,(ul>>50)&0x1f,(ul>>45)&0x1f,(ul>>40)&0x1f,(ul>>35)&0x1f,\n (ul>>30)&0x1f,(ul>>25)&0x1f,(ul>>20)&0x1f,(ul>>15)&0x1f,(ul>>10)&0x1f,\n (ul>>5)&0x1f,(ul&0x1f)\n ]\n elsif bit_depth==6 then\n # 1ULに10個 MSBは0000\n return [\n (ul>>54)&0x3f,(ul>>48)&0x3f,(ul>>42)&0x3f,(ul>>36)&0x3f,(ul>>30)&0x3f,\n (ul>>24)&0x3f,(ul>>18)&0x3f,(ul>>12)&0x3f,(ul>>6)&0x3f,ul&0x3f\n ]\n elsif bit_depth==7 then\n # 1ULに9個 MSBは0\n return [\n (ul>>56)&0x7f,(ul>>49)&0x7f,(ul>>42)&0x7f,(ul>>35)&0x7f,(ul>>28)&0x7f,\n (ul>>21)&0x7f,(ul>>14)&0x7f,(ul>>7)&0x7f,ul&0x7f\n ]\n elsif bit_depth==8 then\n # 1ULに8個\n return [\n (ul>>56)&0xff,(ul>>48)&0xff,(ul>>40)&0xff,(ul>>32)&0xff,(ul>>24)&0xff,\n (ul>>16)&0xff,(ul>>8)&0xff,ul&0xff\n ]\n elsif bit_depth==9 then\n # 1ULに7個\n return [\n (ul>>54)&0x1ff,(ul>>45)&0x1ff,(ul>>36)&0x1ff,(ul>>27)&0x1ff,(ul>>18)&0x1ff,\n (ul>>9)&0x1ff,ul&0x1ff\n ]\n elsif bit_depth==10 then\n # 1ULに6個, MSBは0000\n return [\n (ul>>50)&0x3ff,(ul>>40)&0x3ff,(ul>>30)&0x3ff,(ul>>20)&0x3ff,(ul>>10)&0x3ff,\n ul&0x3ff\n ]\n else\n throw \"bit depth not supported\"\n end\n\nend\n\n#\n#\n#\n\na=JSON.parse(File.open(\"pkt6.txt\").read())\n\nprint \"x:\", a[\"x\"], \" z:\", a[\"z\"], \" gu:\", a[\"groundUp\"], \"\\n\"\nbitmap = a[\"bitMap\"]\nbit_ary = bm2ary(bitmap)\nsection_num = bit_ary.count(1)\nprint \"bit_ary:\", bit_ary.join(\",\"),\" section_num:\",section_num, \"\\n\"\nouthm=la2hm(a[\"heightmaps\"][\"value\"][\"MOTION_BLOCKING\"][\"value\"])\nouthm.each_slice(16) do |row| print \"hm:\", row, \"\\n\" end\n\ndata=a[\"chunkData\"][\"data\"]\nprint \"ary size:\",data.size,\"\\n\"\n\n# [5, 234, 4, 14, [ 0, 33, 1, 2, vi(174, 30), 6, vi(154, 26), 70, vi(186, 61), 14, vi(243, 15), vi(255, 15), vi(226, 65), vi(157, 65), vi(128, 2), 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1\n\n# java -cp server_1.16.5.jar net.minecraft.data.Main --all\n\nblocks=JSON.parse(File.open(\"blocks_1.16.5.json\").read())\n$id2key={}\nblocks.keys.each do |key|\n blocks[key][\"states\"].each do |state|\n $id2key[state[\"id\"]]=key\n end\nend\n\ndef readChunkArray(data,secnum)\n ofs=0\n\n secnum.times do |si|\n print \"reading section #{si}\\n\"\n\n block_num=to_s16(data,ofs)\n print \"#{ofs} block num:\",block_num,\"\\n\"\n ofs+=2\n\n bit_depth=data[ofs]\n print \"#{ofs} bit_depth:\",bit_depth,\"\\n\"\n ofs+=1\n \n palette_len,inc = to_vui(data,ofs)\n print \"#{ofs} palette_len:\",palette_len,\", inc:\",inc,\"\\n\"\n ofs+=inc\n\n palette_len.times do |i|\n ui,inc=to_vui(data,ofs)\n print \"#{ofs} palette[#{i}]:\",ui,\" key:\",$id2key[ui], \", inc:\",inc,\"\\n\"\n ofs+=inc\n end\n\n # 4bitのときは256 (64x256/4=4096)\n # 5bitのときは342 (64x342/4=5472)だいぶオーバーしてる。 https://wiki.vg/Protocolによると頭の4ビットは0だと。\n # 60ビットだけが使われるので、 long1個あたりでは 12ブロック。よって、342*12=4104.\n # 6bitのときは410. long1個あたりでは10ブロック。よって4100\n # ルールは一応わかったかな。\n data_array_len_long,inc = to_vui(data,ofs) \n print \"#{ofs} data_array_len_long:\",data_array_len_long,\", inc:\",inc,\"\\n\"\n ofs+=inc\n\n blocks=[]\n data_array_len_long.times do |i|\n ul=to_l(data,ofs) # sprintf(\"%016x\",ul)\n blocks+=ul2blocks(ul,bit_depth)\n ofs+=8\n end\n blocks=blocks.slice(0,4096)\n print \"#{ofs} blocks:\", blocks.size, \" \", blocks, \"\\n\"\n end\n print \"final ofs:\",ofs, \"\\n\"\n throw \"bug!!\" if ofs != data.size\nend\n\nreadChunkArray(data,section_num)\n \n#print data\n\n\n", "def _anc\n @_p_nz = @_a &= @data\n @_p_c = @_p_nz >> 7\n end", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def ldi_a_mhl\n @a = @mmu[hl]\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def ldi_mhl_a\n @mmu[hl] = @a\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def add(a,b)\n ret1 = a + b\n ret = ret1 & 0xff\n self[0xF] = (ret1!=ret)?1:0\n ret\n end", "def onemax(bitstring)\n sum = 0 \n bitstring.size.times { |i| sum += 1 if bitstring[i].chr == '1' }\n return sum\n end", "def ldd_a_mhl\n @a = @mmu[hl]\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def ins_find_initial_exponent(nbits)\n nbits = nbits / 2 + 2 while nbits > 53\n nbits\nend", "def bit_length\n (negative? ? -self : self + ONE).log2.ceil\n end", "def bits_set\n (\"%b\" % self).count('1')\n #to_s(2).count('1') # alternative\n #count = 0 # alternative\n #byte = self.abs\n #count += byte & 1 and byte >>= 1 until byte == 0 # cf. http://snippets.dzone.com/posts/show/4233\n #count\n end", "def not_r(idx)\n fail unless 2 <= idx and idx <= 13\n r = Reg.new(idx)\n tmp = Reg.new(idx + 1)\n # r = r & -r\n alu32to(:-, 0, r, tmp)\n alu32to(:&, r, tmp, r)\n # r %= 3\n alu32to(:/, r, 3, tmp)\n alu32to(:*, tmp, 3, tmp)\n alu32to(:-, r, tmp, r)\n # r = (2 ^ r) / 2\n alu32to(:^, 2, r, r)\n alu32to(:>>, r, 1, r)\nend", "def ldd_mhl_a\n @mmu[hl] = @a\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def sum_of_2int a, b\n (b == 0) ? a : (sum_of_2int (a^b),((a&b)<< 1))\nend", "def fermat_little(p, a)\n begin\n if(p%(ui_pow(a, (p-1))-1) == 0)\n return 0\n else\n return 1\n end\n end\nrescue\n begin\n ArgumentError.new(\"High load. Terminated.\")\n end\nend", "def ui_pow(base, exp)\n result = 1;\n while (exp)\n if (exp & 1)\n result *= base\n end\n exp >>= 1;\n base *= base\n end\n if(exp==0)\n result=base\n end\n return result\nend", "def adjust(type)\n case type\n when :Byte, :byte, :b, :B\n primitive_max = 2**7 - 1\n primitive_min = -2**7\n when :Short, :short, :s, :S\n primitive_max = 2**15 - 1\n primitive_min = -2**15\n when :Integer, :Int, :int, :i, :I\n primitive_max = 2**31 - 1\n primitive_min = -2**31\n when :Long, :long, :l, :L\n primitive_max = 2**63 - 1\n primitive_min = -2**63\n when :Nibble, :nibble, :n, :N\n primitive_max = 2**4 - 1\n primitive_min = -2**4\n else\n primitive_max = 2**31 - 1\n primitive_min = -2**31\n end\n self < -primitive_max ? -1 * (-self & primitive_max) : self\n self > primitive_min ? (self & primitive_max) : self\n end", "def BIT(address:)\n tmp = @accumulator & @ram[address]\n tmp.zero? ? set_flag(SR_ZERO) : clear_flag(SR_ZERO)\n (tmp & SR_NEGATIVE).zero? ? clear_flag(SR_NEGATIVE) : set_flag(SR_NEGATIVE)\n (tmp & SR_OVERFLOW).zero? ? clear_flag(SR_OVERFLOW) : set_flag(SR_OVERFLOW)\n end", "def or_mhl\n value = @mmu[hl]\n or_to_a value\n @clock += 2\n end", "def checkOverflow(testee)\r\n if(testee > ((2**32) - 1)/2 )\r\n return true\r\n elsif(testee < (-1) * 2**31)\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def add_wrong(high_bit, input_array)\n\tnum = (2..high_bit).to_a.sample # rand(2..high_bit)\n\tuntil good_wrong?(num, input_array)\n\t\tnum = (2..high_bit).to_a.sample #rand(2..high_bit)\n\tend\n\treturn num\nend", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def numberOf1Bits(n)\n res = 0\n while n != 0\n n &= (n - 1)\n res += 1\n end\n return res\nend", "def fixedXOR(a = 0x1c0111001f010100061a024b53535009181c, b = 0x686974207468652062756c6c277320657965)\n if a.to_s(16).length == b.to_s(16).length\n res = a ^ b\n else\n # TODO: raise error\n res = 0\n puts \"error: diff size arguments\"\n end\n res\nend", "def xor_mhl\n value = @mmu[hl]\n xor_to_a value\n @clock += 2\n end", "def check_raw_value(value)\n check(value, {\n :type => :uint8,\n :count => (size < 1 ? 1 : size),\n :length => 1,\n :bit_length => 8,\n :sign => :unsigned,\n :default_value => 0,\n })\n end", "def compute_need_bits; end", "def uint32(i)\n i & 0xffffffff\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def and_mhl\n value = @mmu[hl]\n and_to_a value\n @clock += 2\n end", "def ADC(address:)\n signed_a = signed_int(@accumulator)\n signed_m = signed_int(@ram[address])\n signed_sum = signed_a + signed_m\n (signed_sum > 127 || signed_sum < -128) ? set_flag(SR_OVERFLOW) : clear_flag(SR_OVERFLOW)\n\n sum = @accumulator + @ram[address] + (set?(SR_CARRY) ? 1 : 0)\n sum > 0xff ? set_flag(SR_CARRY) : clear_flag(SR_CARRY)\n @accumulator = sum & 0xff\n\n ZN_flags(@accumulator)\n end", "def to_i\n\t\tbits.map(&:to_s).join.to_i(2)\n\tend", "def sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if t < 20\n return b ^ c ^ d if t < 40\n return (b & c) | (b & d) | (c & d) if t < 60\n b ^ c ^ d\n end", "def set_auxiliary_carry_flag_from(expected_value)\n\t\t@flags.set_bit_at(AUX_CARRY_FLAG, (expected_value & 0xFFFFFFFF) > 0xF ? 1 : 0)\n\tend", "def vampire_test(a,b)\n if a <= 0 and b <= 0\n false\n elsif \n \n else\n arr = (a*b).to_s.chars.map(&:to_i)\n [arr.include?(a), arr.include?(b), (arr.last != 0)].include?(false)\n end\nend", "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 sha1_ft(t, b, c, d)\n return (b & c) | ((~b) & d) if(t < 20) \n return b ^ c ^ d if(t < 40)\n return (b & c) | (b & d) | (c & d) if(t < 60)\n return b ^ c ^ d;\n end", "def encode_uleb128(value)\n raise ArgumentError, \"Signed integers are not supported\" if value < 0\n return \"\\x00\" if value == 0\n bytes = []\n while value != 0\n byte = value & 0b01111111 # 0x7f\n value >>= 7\n if value != 0\n byte |= 0b10000000 # 0x80\n end\n bytes << byte\n end\n return BTC::Data.data_from_bytes(bytes)\n end", "def add_to_a(to_add)\n sum = @a + to_add\n @f = 0x00\n @f |= Z_FLAG if sum & 0xFF == 0x00\n @f |= H_FLAG if (@a & 0x0F) + (to_add & 0x0F) > 0x0F\n @f |= C_FLAG if sum > 0xFF\n @a = sum & 0xFF\n end", "def to_i\n bitmask\n end", "def luma(value)\n if value < 0\n 0\n elsif value > 255\n 255\n else\n value\n end\n end", "def cvrt_a_ins(a)\n \"%016b\" % a\n end", "def c0= c; @c0 = (c == 1) ? 1 : 0; end", "def execute_SHL(operand) # Same instruction as SAL\n\t\t# all flags are affected except AF is undefined\n\t\tbit_moves = bit_shift_count_for(operand, operand.size)\n\t\texpected_value = operand.value << bit_moves\n\t\toperand.value = expected_value\n\t\tsize = operand.size\n\t\tmsb = size - 1\n\t\tset_shift_flags_from(operand.value, expected_value, expected_value[size], size)\n\t\tif bit_moves == 1\n\t\t\t@flags.set_bit_at(OVERFLOW_FLAG, operand.value[msb] != @flags.value[CARRY_FLAG] ? 1 : 0)\n\t\tend\n\tend", "def is_auxillary_carry?(a, b, op)\n a <<= 4;\n a >>= 4;\n b <<= 4;\n b >>= 4;\n\n if (op == :+)\n return !((a + b) < 16)\n else\n return !((a - b) <= a)\n end\n end", "def succ\n PowerOfTwo.new( @value + @value )\n end", "def adler32(s)\n s = s.inspect unless s.is_a?(String)\n h = 0\n m = 99999\n s.unpack(\"c*\").each{ |c| h = (128 * h + c).modulo(m)}\n return h\n end", "def encode_unsigned_varint(value, appender)\n while value > 0x1F\n pos = (value & 0x1F) | 0x20\n appender.call(ENCODING_TABLE[pos])\n value >>= 5\n end\n appender.call(ENCODING_TABLE[value])\n end", "def flip_bit(integer)\n binary = integer.to_s(2)\n max = 0\n current = 0\n prev = 0\n gap = 0\n\n binary.each_char do |char|\n if char == '1'\n current += 1\n gap = 0\n elsif char == '0'\n prev = current unless gap > 1\n current = 0\n gap += 1\n end\n max = [prev + current + 1, max].max\n end\n\n max\nend", "def aphash( key, len=key.length )\n state = 0xAAAAAAAA\n len.times{ |i|\n if (i & 1) == 0\n state ^= (state << 7) ^ key[i] * (state >> 3)\n else\n state ^= ~( (state << 11) + key[i] ^ (state >> 5) )\n end\n }\n return state\nend", "def bit(y)\n bit?(y) ? ONE : ZERO\n end", "def get_number_of_1s(number)\n if number < 0\n sign = -1\n number = number * -1\n end\n count = 0\n while (number>0)\n number = (number & number-1)\n count += 1\n end\n count\nend", "def decimal_to_binary (decimal)\r\n\t\t# ruby inbuilt method - see other files\r\n\t # divide number by 2 and log remainders?\r\n\r\n\t# get length of number\r\n\t# determine biggest power of 2 that fits into number\r\n\t# see keefer and thom solutions - built with remainders maths\r\n\r\n\r\n\r\nend", "def _high_byte(operand)\n # operand >> 8\n -> { _eval_byte(operand) >> 8 }\nend", "def _nbits(x)\n raise TypeError, \"The argument to _nbits should be nonnegative.\" if x < 0\n # Ruby 2.1 introduced Integer#bit_length\n return x.bit_length if x.respond_to? :bit_length\n if x <= MAXIMUM_SMALLISH_INTEGER\n return 0 if x==0\n x.to_s(2).length\n elsif x <= NBITS_LIMIT\n Math.frexp(x).last\n else\n n = 0\n while x!=0\n y = x\n x >>= NBITS_BLOCK\n n += NBITS_BLOCK\n end\n n += y.to_s(2).length - NBITS_BLOCK if y!=0\n n\n end\n end", "def uimm val\n val = val.to_i\n\n if val < 0\n raise ArgumentError, \"#{val} is negative\"\n elsif val <= 0xFF\n imm8 val\n elsif val <= 0xFFFF\n imm16 val\n elsif val <= 0xFFFFFFFF\n imm32 val\n elsif val <= 0xFFFFFFFFFFFFFFFF\n imm64 val\n else\n raise ArgumentError, \"#{val} is too large for a 64 bit int\"\n end\n end", "def convert_binary_to_signed_negative(address)\n twos_compliment = convert_to_signed_twos_complement address.to_i(2)\n HumanComputer::Processor.eight_bitify twos_compliment\n end", "def resolveADD\r\n newVal = @RegA + @RegB\r\n if(newVal == 0)\r\n @ZRBit = true\r\n @OFBit = false\r\n puts \"Zero bit true. Overflow bit false.\"\r\n elsif(checkOverflow(newVal) == true)\r\n @OFBit = true\r\n @ZRBit = false\r\n puts \"Overflow bit true. Zero bit false.\"\r\n else\r\n @ZRBit = false\r\n @OFBit = false\r\n puts \"Zero and overflow bits are false.\"\r\n end\r\n @RegA = newVal\r\n puts \"Registers added.\"\r\n end", "def single_number_32bit(nums)\n bits = 4\n arr = Array.new(bits, 0) # constant space\n\n for i in 0...bits\n nums.each do |num|\n n = (num >> i) & 1 # moving bit at most significant place, anding with 1 so that last bit will just give 1 or 0, because 1 is 0...00001\n arr[bits-i-1] += n\n end\n arr[bits-i-1] %= 3\n end\n\n result = 0\n puts arr.to_s\n for i in 0...bits\n result += (arr[i] << (bits-i-1))\n end\n result\nend", "def uniq_integer(input_array)\n unique = 0\n input_array.each do |num|\n unique = unique ^ num\n end\n\n unique\nend", "def radix_mask\n (\"1\"*self.class.bit_density).to_i(2)\n end", "def xor_a\n end", "def raise_to_power(x, y)\n #every shift left is like a * 2\n #11000\nend", "def _int1b(data)\n data.unpack('C').first\n end", "def invert?() k >= 128; end", "def c1= c; @c1 = (c == 1) ? 1 : 0; end", "def binary_to_int(n)\n bitset = Array.new()\n while (n > 0) do\n x = largest_power_of_2(n)\n if (x != nil)\n bitset[x] = 1\n n -= BASE ** x\n end\n end\n bitset.map! { |x| \n if (x == nil) \n x = 0\n else\n x = 1\n end\n }\n return bitset\nend", "def convert(value)\n byteshift = (value+3)/8\n bitshift = value-byteshift*8\n# printf(\"%d --> %d,%d\\n\", value,byteshift,bitshift)\n if bitshift<0\n bitshift *= -1\n bitshift += 0x08\n end\n ret = byteshift*16+bitshift\n return ret\nend", "def decode_uinteger_value(value)\n build_integer(value, 0, value.length)\n end", "def bitodec(bi)\n\tbistring = bi.to_s\n\tturnbi = bistring.chars.reverse.map{|i| i.to_i}\n\tfor index in (0...turnbi.length)\n\t\tturnbi[index] = turnbi[index]*(2**index)\n\tend\n\tdec = turnbi.sum\n\treturn dec\nend", "def safe_add(x, y)\n v = (x+y) % (2**32)\n return v > 2**31 ? v- 2**32 : v\n end", "def safe_add(x, y)\n v = (x + y) % (2**32)\n v > 2**31 ? v - 2**32 : v\n end", "def seuil()\n\t\treturn 0\n\tend", "def dl_bignum_to_ulong(x)\n if x.class == Fixnum\n return DL::PtrData.new(x)\n else\n # shut up\n c = x / 4\n e = x - (c * 4)\n v = DL::PtrData.new 0\n v += c\n v += c\n v += c\n v += c\n v += e\n return v\n end\n end", "def _map_tint(value)\n return 0.0 if value.zero? # save a few cycles\n result = (value < 0) ? (value / 32768.0) : (value / 32767.0)\n result.round(2)\n end", "def hack_byte(box, b1, b0, found)\n padding_target = 1 + found.size\n postmask = found.map{|f| f ^ padding_target}.pack(\"C*\")\n\n if found.empty?\n premask = ([0] * (16 - found.size - 2)).pack(\"C*\")\n\n (0..255).each do |i|\n maska = premask + [0, i ^ padding_target].pack(\"CC\") + postmask\n maskb = premask + [128, i ^ padding_target].pack(\"CC\") + postmask\n if box.valid?(b1.xor(maska) + b0) and box.valid?(b1.xor(maskb) + b0)\n return i\n end\n end\n else\n premask = ([0] * (16 - found.size - 1)).pack(\"C*\")\n\n (0..255).each do |i|\n maska = premask + [i ^ padding_target].pack(\"C\") + postmask\n if box.valid?(b1.xor(maska) + b0)\n return i\n end\n end\n end\n\n raise \"Attack failed\"\n end", "def xor_d8\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 <<(bits)\n value = @value * (2**bits.to_i)\n if (bounded?)\n self.class.new(value & self.mask, @length)\n else\n self.class.new(value)\n end\n end" ]
[ "0.69342935", "0.69096833", "0.6019998", "0.58267874", "0.5818347", "0.5818347", "0.5772398", "0.56728095", "0.55925494", "0.55873275", "0.558292", "0.5573747", "0.5526309", "0.5522666", "0.5484536", "0.5483262", "0.5482124", "0.5469806", "0.5417867", "0.53806317", "0.5374884", "0.5356853", "0.533066", "0.53252983", "0.5288415", "0.52721864", "0.5249451", "0.5235543", "0.5232313", "0.5225314", "0.5224308", "0.52117044", "0.520563", "0.51726884", "0.5169286", "0.51687247", "0.5150396", "0.5136312", "0.51299506", "0.51280737", "0.51273346", "0.51153415", "0.5115275", "0.51043326", "0.5102792", "0.5100564", "0.509362", "0.5061248", "0.5049624", "0.5019904", "0.5015692", "0.50105745", "0.5008613", "0.50037014", "0.50035304", "0.50007045", "0.4998301", "0.4997495", "0.49968147", "0.49889094", "0.49840787", "0.497971", "0.4963679", "0.49396455", "0.49391276", "0.49388236", "0.4937168", "0.49360535", "0.49334785", "0.49246413", "0.49203378", "0.4919691", "0.49088416", "0.49017787", "0.48983023", "0.48958722", "0.4884259", "0.48808214", "0.48801586", "0.48746344", "0.48610806", "0.48537704", "0.48498964", "0.48469922", "0.48465648", "0.4836854", "0.4834597", "0.48257092", "0.48162284", "0.48138413", "0.48122334", "0.4802211", "0.47961065", "0.47951594", "0.47929457", "0.47902295", "0.47883928", "0.47865814", "0.4782317", "0.47720757" ]
0.7322821
0
16Bit ALU Connects 16 1Bit ALUs to create a 16 bit result. The last ALU checks for overflow.
def ALU16BIT(a,b,cin,binv,op1,op2) result = [nil]*16 15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)} result[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2) #Send out our result, carry out, and overflow return result,cout,ovf end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uint16()\n _uint16(\"uint16\")\n end", "def u16\n next_bytes(2).unpack(\"S>\").first\n end", "def uint16(*payloads)\n fixnums(2, FormatStrings::UINT16, payloads)\n end", "def i16u\n little? ? BinUtils.get_int16_le(read(2)) : BinUtils.get_int16_be(read(2))\n end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def i16u\n r = little? ? BinUtils.get_int16_le(@data, @pos) : BinUtils.get_int16_be(@data, @pos)\n @pos += 2\n r\n end", "def word16(a, b)\n (a << 8) | b\n end", "def i16s\n little? ? BinUtils.get_sint16_le(read(2)) : BinUtils.get_sint16_be(read(2))\n end", "def i16s\n r = little? ? BinUtils.get_sint16_le(@data, @pos) : BinUtils.get_sint16_be(@data, @pos)\n @pos += 2\n r\n end", "def word16(bytes_a, bytes_b)\n (bytes_a << 8) | bytes_b\n end", "def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\", self).first + \"\\x00\\x00\"\r\n end", "def i16\n i16s\n end", "def ALU1BIT(a,b,cin,binv,op1,op2) \n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\t#Send out an array pair of result, cout\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1]\nend", "def adc_a_d8\n end", "def i16\n next_bytes(2).unpack(\"s>\").first\n end", "def write16(val)\n\tval = (-val) | 0x8000 if val < 0\n\tputc((val >> 8) & 0xff)\n\tputc(val & 0xff)\n end", "def to_signed_short n\n length = 16 # bits\n max = 2**length-1\n mid = 2**(length-1)\n n>=mid ? -((n ^ max) + 1) : n\nend", "def ALU1BIT_OF (a,b,cin,binv,op1,op2)\n\tb = MUX2X1(b,binv)\n\tsUM_RESULT = ADDER(a,b,cin)\n\tputs sUM_RESULT[0]\n\tovf = OF_CHECKING(a,b,sUM_RESULT[0])\n\t#Send out an array triple of result, cout, overflow\n\treturn MUX4X1(AND(a,b),OR(a,b),sUM_RESULT[0],0,op1,op2), sUM_RESULT[1], ovf\nend", "def read_uint16(position = nil)\n seek(position)\n data = read_and_advance(2)\n BinData::Uint16be.read(data).to_i\n end", "def read_sint16(position = nil)\n seek(position)\n data = read_and_advance(2)\n BinData::Int16be.read(data).to_i\n end", "def shr16(e)\n eval_ex(e) >> 16\n end", "def get_U16_field(field_name)\n\t\tend", "def adc_a_h\n end", "def ldi_a_mhl\n @a = @mmu[hl]\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def read16\n\tval = (getc() << 8) + getc()\n\tval = -(val & 0x7fff) if (val & 0x8000).nonzero?\n\treturn val\n end", "def ldd_a_mhl\n @a = @mmu[hl]\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def read_int16\n read('n', 2)\n end", "def from_utf16\r\n ret = Iconv.iconv(\"utf-8\", \"utf-16le\", self).first\r\n if ret[-1] == 0\r\n ret = ret[0..-2]\r\n end\r\n end", "def adc_a_a\n end", "def ldi_mhl_a\n @mmu[hl] = @a\n self.hl = (hl + 1) & 0xFFFF\n @clock += 2\n end", "def read16(data, options = {})\n read_memory(extract_address(data, options), number: 2)\n end", "def adc_a_b\n end", "def ldd_mhl_a\n @mmu[hl] = @a\n self.hl = (hl - 1) & 0xFFFF\n @clock += 2\n end", "def write16(data, options = {})\n dw \"w2 0x#{extract_address(data, options).to_s(16).upcase}, 0x#{extract_data(data, options).to_s(16).upcase}\"\n end", "def adc_a_hl\n end", "def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end", "def adc_a_l\n end", "def crc16(data)\n crc = CRC16INIT\n data.each_byte {|byte|\n crc = _crc16(crc, byte)\n }\n crc\nend", "def write_word16_native(val)\n pw(val, 'S')\n end", "def category16=(value)\n @category16 = value\n end", "def adc_a_d\n end", "def write_int16(int)\n write([int].pack(\"s>\"))\n end", "def short\n Util.from_bytes :short, value\n end", "def toutf16; Kconv.toutf16(self) end", "def convert_and_write_float_sample_16bit(float_sample, mode='file')\n\t\t# converts sample to 16-bit integer and calls encode-and-write method\n\t\t# positive values have one conversion equation...\n\t\tif float_sample >= 0\n\t\t\tint_sample = (float_sample * 32767.to_f).round\n\t\t\t# write rounded value to file\n\t\t\tencode_and_write_int16(int_sample, mode)\n\t\t# ...negative values have another\n\t\telsif float_sample < 0\n\t\t\tint_sample = (((float_sample + 1.to_f) * 32767.to_f) +\n\t\t\t\t32768.to_f).round\n\t\t\t# write rounded value to file\n\t\t\tencode_and_write_int16(int_sample, mode)\n\t\tend\n\tend", "def adc_a_c\n end", "def short(*shorts)\n format = ( little_endian? ? 'v*' : 'n*') \n return string(shorts.pack(format)) \n end", "def adler32(s)\n s = s.inspect unless s.is_a?(String)\n h = 0\n m = 99999\n s.unpack(\"c*\").each{ |c| h = (128 * h + c).modulo(m)}\n return h\n end", "def get_utf16_of(character)\n character.encode('UTF-16BE').unpack('H*').first.upcase\nend", "def adc_a_e\n end", "def jp_a16\n @pc = $mmu.read_word @pc\n end", "def uC\n self.force_encoding('UTF-16LE').encode('UTF-8').strip\n end", "def convert(value)\n byteshift = (value+3)/8\n bitshift = value-byteshift*8\n# printf(\"%d --> %d,%d\\n\", value,byteshift,bitshift)\n if bitshift<0\n bitshift *= -1\n bitshift += 0x08\n end\n ret = byteshift*16+bitshift\n return ret\nend", "def jp_nc_a16\n if (@f & C_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end", "def decode(base16_string)\n base16_string.to_i(BASE)\n end", "def encode_short(val)\n raise 'Value too big for short' if val > 0xffff\n [val.to_i].pack('n')\n end", "def and_mhl\n value = @mmu[hl]\n and_to_a value\n @clock += 2\n end", "def call_nc_a16\n if (@f & C_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "def toutf16(str)\n ::NKF::nkf('-w16m', str)\n end", "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0])\n\tputs \"press enter to exit the program...\"\n\twait = gets\nend", "def make_data\n Array.new(2**15) { |i| (i / 16 % 256) }\n end", "def or_mhl\n value = @mmu[hl]\n or_to_a value\n @clock += 2\n end", "def crc16(msg)\n crc_lo = 0xff\n crc_hi = 0xff\n\n msg.unpack('c*').each do |byte|\n i = crc_hi ^ byte\n crc_hi = crc_lo ^ CrcHiTable[i]\n crc_lo = CrcLoTable[i]\n end\n\n return ((crc_hi << 8) + crc_lo)\n end", "def to_i\n handle.to_i(16)\n end", "def append_unsigned_short(s=nil)\n if s.class == Fixnum && !block_given?\n @j_del.java_method(:appendUnsignedShort, [Java::int.java_class]).call(s)\n return self\n end\n raise ArgumentError, \"Invalid arguments when calling append_unsigned_short(s)\"\n end", "def t__16!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 7)\n\n type = T__16\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 22: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__, 7)\n\n end", "def _crc16(crc, byte)\n crc ^= byte\n 8.times {|bit|\n x = (crc & 0x0001) != 0\n crc >>= 1\n crc ^= CRC16BIT if x\n }\n crc\nend", "def activation_system(input)\n b = input\n\n a = b | 65536\n b = 13159625\n\n while a > 0\n b += a & 255\n b &= 16777215\n\n b *= 65899\n b &= 16777215\n\n a /= 256\n end\n\n b\nend", "def sku_combination_creation\n end", "def a785274d_dccb_53f1_8262_012d28b070ec\n hex = self.abs.to_s(16)\n if self >= 0\n STROKEDB_D1 + [ hex.size ].pack(STROKEDB_N).unpack(STROKEDB_Ha)[0] + hex\n else\n s = hex.size\n STROKEDB_D0 + [ 2**32 - s ].pack(STROKEDB_N).unpack(STROKEDB_Ha)[0] + (16**s + self).to_s(16)\n end\n end", "def discover_uaa\n info = server\n links = info['links'] || info[:links]\n uaa = links && (links['uaa'] || links[:uaa])\n\n uaa || target\n end", "def short\n\t\tSecureRandom.hex(3.5) # 2 * n\n\tend", "def flatten_voice(voice_data)\n modulating = (voice_data[6] & 0x01) == 0;\n\n # Voices 1 and 2 (for OPL3)\n voice_data[6] |= 0x30;\n\n # 2nd op always has level set to max \n voice_data[12] |= 0x3f;\n\n # 1st op has level set to max if not modulating\n if !modulating\n voice_data[5] |= 0x3f;\n end\nend", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def calc_u(xaa, xbb, n)\n H(n, xaa, xbb)\n end", "def t__16!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 5 )\n\n type = T__16\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 21:9: 'T'\n match( 0x54 )\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__, 5 )\n\n end", "def t__16!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n type = T__16\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 25:9: 'D'\n match( 0x44 )\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 jp_nz_a16\n if (@f & Z_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end", "def pad_for_negative_twos_comp\n case mode\n when :'16_BIT_REAL'\n 0xffff # ('1'*16).to_i(2)\n else\n raise UnknownModeError, \"Unknown pad for two complement on #{mode} mode.\"\n end\n end", "def test_short\n LinuxFortune.short = true\n assert LinuxFortune.short # short should be set to true\n assert LinuxFortune.long == false # long to false\n assert LinuxFortune.fortune_options.include?(\"-s\")\n assert LinuxFortune.fortune_options.include?(\"-n\") || LinuxFortune.short_length == 160\n 10.times do # check multiple times if the generated length is ok\n lf = LinuxFortune.generate\n assert lf.body.size*0.9 < LinuxFortune.short_length # check if actual size is less than the max. short length\n end\n end", "def to_vui(ary,ofs)\n b0=ary[ofs]\n return [b0,1] if b0 <128\n b0&=0x7f\n b1=ary[ofs+1]\n return [b0+(b1<<7),2] if b1<128\n b1&=0x7f\n b2=ary[ofs+2]\n return [b0+(b1<<7)+(b2<<14),3] if b2<128\n b2&=0x7f \n b3=ary[ofs+3]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21),4] if b3<128\n b3&=0x7f \n b4=ary[ofs+4]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28),5]\n throw \"error\"\nend\n# buf to varlong\ndef to_vul(ary,ofs)\n b0=ary[ofs]\n return [b0,1] if b0 <128\n b0&=0x7f\n b1=ary[ofs+1]\n return [b0+(b1<<7),2] if b1<128\n b1&=0x7f\n b2=ary[ofs+2]\n return [b0+(b1<<7)+(b2<<14),3] if b2<128\n b2&=0x7f \n b3=ary[ofs+3]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21),4] if b3<128\n b3&=0x7f \n b4=ary[ofs+4]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28),5]\n b4&=0x7f\n b5=ary[ofs+5]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35),6]\n b5&=0x7f\n b6=ary[ofs+6]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42),7]\n b6&=0x7f\n b7=ary[ofs+7]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49),8]\n b7&=0x7f\n b8=ary[ofs+8]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49)+(b8<<56),9]\n b8&=0x7f\n b9=ary[ofs+9]\n return [b0+(b1<<7)+(b2<<14)+(b3<<21)+(b4<<28)+(b5<<35)+(b6<<42)+(b7<<49)+(b8<<56)+(b9<<63),10]\n throw \"error\"\nend\n\ndef to_l(ary,ofs)\n return ary[ofs+7]+(ary[ofs+6]<<8)+(ary[ofs+5]<<16)+(ary[ofs+4]<<24)+(ary[ofs+3]<<32)+(ary[ofs+2]<<40)+(ary[ofs+1]<<48)+(ary[ofs]<<56)\nend\n\n\ndef bm2ary(bm)\n out=[0,0,0,0, 0,0,0,0, 0,0,0,0, 0,0,0,0]\n out[0]=1 if bm & 1 == 1\n out[1]=1 if bm & 2 == 2\n out[2]=1 if bm & 4 == 4\n out[3]=1 if bm & 8 == 8\n out[4]=1 if bm & 16 == 16\n out[5]=1 if bm & 32 == 32\n out[6]=1 if bm & 64 == 64\n out[7]=1 if bm & 128 == 128\n out[8]=1 if bm & 256 == 256\n out[9]=1 if bm & 512 == 512\n out[10]=1 if bm & 1024 == 1024\n out[11]=1 if bm & 2048 == 2048\n out[12]=1 if bm & 4096 == 4096\n out[13]=1 if bm & 8192 == 8192\n out[14]=1 if bm & 16384 == 16384\n out[15]=1 if bm & 32768 == 32768\n return out\nend\n\n\n# long \ndef i32_to_bitary(v)\n out=[]\n 32.times do |i|\n out[31-i]=v&1\n v=v>>1\n end\n return out\nend\n\ndef bitary_to_i(ba)\n out=0\n v=1\n ba.size.times do |i|\n out+=v if ba[ba.size-1-i]==1 \n v=v<<1\n end\n return out\nend\n\n# [25215072,806882310],[25215072,806882310],[25215072,806882310], ...\n#\n# 9 bits * 256 = 2304 bits, 36 longs\n# irb(main):002:0> printf(\"%b\",25215072)\n# 1100000001100000001100000\n# 110000000 110000000 1100000\n# 000011000 000011000 000011000\n\n# [[25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215328,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215073,-2145907706],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [25215072,806882310],[25215072,806882310],[25215072,806882310],[25215072,806882310],\n# [0,806882310]]\n\n#\n# 19200, 11488\n# {\"x\":1200,\"z\":718,\"groundUp\":true,\"bitMap\":15,\"heightmaps\":{\"type\":\"compound\",\"name\":\"\",\"value\":{\"MOTION_BLOCKING\":{\"type\":\"longArray\",\"value\":[[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[1,-117670337]]},\"WORLD_SURFACE\":{\"type\":\"longArray\",\"value\":[[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[264758257,-117670337],[1,-117670337]]}}}\n\n# MSB - LSB\n# 0 aaaaaaaaa bbbbbbbbb ccccccccc ddddddddd eeeeeeeee fffffffff ggggggggg hhhhhhhhh iiiiiiiii\n# \ndef la2hm(la)\n outhm=[]\n ba=[]\n la.each do |pair|\n ba0=i32_to_bitary(pair[0])\n ba1=i32_to_bitary(pair[1])\n ba63=ba0[1..-1]+ba1 # 9*7\n slices=[]\n ba63.each_slice(9) do |slice|\n slices.push(slice)\n end\n slices.reverse.each do |slice|\n outhm.push(bitary_to_i(slice))\n end\n end\n return outhm\nend\n\n# ul:uint64_t\ndef ul2blocks(ul,bit_depth)\n \n if bit_depth==4 then\n # 1ULに16個入ってる\n s0=(ul>>48)&0xffff\n s1=(ul>>32)&0xffff\n s2=(ul>>16)&0xffff\n s3=ul&0xffff\n return [\n (s0>>12)&0xf,(s0>>8)&0xf,(s0>>4)&0xf,s0&0xf,\n (s1>>12)&0xf,(s1>>8)&0xf,(s1>>4)&0xf,s1&0xf,\n (s2>>12)&0xf,(s2>>8)&0xf,(s2>>4)&0xf,s2&0xf,\n (s3>>12)&0xf,(s3>>8)&0xf,(s3>>4)&0xf,s3&0xf\n ]\n elsif bit_depth==5 then\n # 1ULに12個はいっててMSBが0000\n return [\n (ul>>55)&0x1f,(ul>>50)&0x1f,(ul>>45)&0x1f,(ul>>40)&0x1f,(ul>>35)&0x1f,\n (ul>>30)&0x1f,(ul>>25)&0x1f,(ul>>20)&0x1f,(ul>>15)&0x1f,(ul>>10)&0x1f,\n (ul>>5)&0x1f,(ul&0x1f)\n ]\n elsif bit_depth==6 then\n # 1ULに10個 MSBは0000\n return [\n (ul>>54)&0x3f,(ul>>48)&0x3f,(ul>>42)&0x3f,(ul>>36)&0x3f,(ul>>30)&0x3f,\n (ul>>24)&0x3f,(ul>>18)&0x3f,(ul>>12)&0x3f,(ul>>6)&0x3f,ul&0x3f\n ]\n elsif bit_depth==7 then\n # 1ULに9個 MSBは0\n return [\n (ul>>56)&0x7f,(ul>>49)&0x7f,(ul>>42)&0x7f,(ul>>35)&0x7f,(ul>>28)&0x7f,\n (ul>>21)&0x7f,(ul>>14)&0x7f,(ul>>7)&0x7f,ul&0x7f\n ]\n elsif bit_depth==8 then\n # 1ULに8個\n return [\n (ul>>56)&0xff,(ul>>48)&0xff,(ul>>40)&0xff,(ul>>32)&0xff,(ul>>24)&0xff,\n (ul>>16)&0xff,(ul>>8)&0xff,ul&0xff\n ]\n elsif bit_depth==9 then\n # 1ULに7個\n return [\n (ul>>54)&0x1ff,(ul>>45)&0x1ff,(ul>>36)&0x1ff,(ul>>27)&0x1ff,(ul>>18)&0x1ff,\n (ul>>9)&0x1ff,ul&0x1ff\n ]\n elsif bit_depth==10 then\n # 1ULに6個, MSBは0000\n return [\n (ul>>50)&0x3ff,(ul>>40)&0x3ff,(ul>>30)&0x3ff,(ul>>20)&0x3ff,(ul>>10)&0x3ff,\n ul&0x3ff\n ]\n else\n throw \"bit depth not supported\"\n end\n\nend\n\n#\n#\n#\n\na=JSON.parse(File.open(\"pkt6.txt\").read())\n\nprint \"x:\", a[\"x\"], \" z:\", a[\"z\"], \" gu:\", a[\"groundUp\"], \"\\n\"\nbitmap = a[\"bitMap\"]\nbit_ary = bm2ary(bitmap)\nsection_num = bit_ary.count(1)\nprint \"bit_ary:\", bit_ary.join(\",\"),\" section_num:\",section_num, \"\\n\"\nouthm=la2hm(a[\"heightmaps\"][\"value\"][\"MOTION_BLOCKING\"][\"value\"])\nouthm.each_slice(16) do |row| print \"hm:\", row, \"\\n\" end\n\ndata=a[\"chunkData\"][\"data\"]\nprint \"ary size:\",data.size,\"\\n\"\n\n# [5, 234, 4, 14, [ 0, 33, 1, 2, vi(174, 30), 6, vi(154, 26), 70, vi(186, 61), 14, vi(243, 15), vi(255, 15), vi(226, 65), vi(157, 65), vi(128, 2), 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 1\n\n# java -cp server_1.16.5.jar net.minecraft.data.Main --all\n\nblocks=JSON.parse(File.open(\"blocks_1.16.5.json\").read())\n$id2key={}\nblocks.keys.each do |key|\n blocks[key][\"states\"].each do |state|\n $id2key[state[\"id\"]]=key\n end\nend\n\ndef readChunkArray(data,secnum)\n ofs=0\n\n secnum.times do |si|\n print \"reading section #{si}\\n\"\n\n block_num=to_s16(data,ofs)\n print \"#{ofs} block num:\",block_num,\"\\n\"\n ofs+=2\n\n bit_depth=data[ofs]\n print \"#{ofs} bit_depth:\",bit_depth,\"\\n\"\n ofs+=1\n \n palette_len,inc = to_vui(data,ofs)\n print \"#{ofs} palette_len:\",palette_len,\", inc:\",inc,\"\\n\"\n ofs+=inc\n\n palette_len.times do |i|\n ui,inc=to_vui(data,ofs)\n print \"#{ofs} palette[#{i}]:\",ui,\" key:\",$id2key[ui], \", inc:\",inc,\"\\n\"\n ofs+=inc\n end\n\n # 4bitのときは256 (64x256/4=4096)\n # 5bitのときは342 (64x342/4=5472)だいぶオーバーしてる。 https://wiki.vg/Protocolによると頭の4ビットは0だと。\n # 60ビットだけが使われるので、 long1個あたりでは 12ブロック。よって、342*12=4104.\n # 6bitのときは410. long1個あたりでは10ブロック。よって4100\n # ルールは一応わかったかな。\n data_array_len_long,inc = to_vui(data,ofs) \n print \"#{ofs} data_array_len_long:\",data_array_len_long,\", inc:\",inc,\"\\n\"\n ofs+=inc\n\n blocks=[]\n data_array_len_long.times do |i|\n ul=to_l(data,ofs) # sprintf(\"%016x\",ul)\n blocks+=ul2blocks(ul,bit_depth)\n ofs+=8\n end\n blocks=blocks.slice(0,4096)\n print \"#{ofs} blocks:\", blocks.size, \" \", blocks, \"\\n\"\n end\n print \"final ofs:\",ofs, \"\\n\"\n throw \"bug!!\" if ofs != data.size\nend\n\nreadChunkArray(data,section_num)\n \n#print data\n\n\n", "def rev(target)\n res = Array(32)\n 16.times do |i|\n a = target[i].ord ^ i ^ (16 * i)\n res[2*i+1] = a & 0xf\n res[2*(15-i)] = a >> 4\n end\n res.map{|c|c.to_s(16)}.join\nend", "def crc16(bytes)\n crc = 0\n bytes.each_byte do |b|\n crc = ((crc << 8) & 0xffff) ^ XMODEM_CRC16_LOOKUP[((crc >> 8) ^ b) & 0xff]\n end\n crc\n end", "def hex_to_u32(s)\n s.hex\nend", "def h(number)\n number.to_s(16)\n end", "def get_unsigned_short(pos=nil)\n if pos.class == Fixnum && !block_given?\n return @j_del.java_method(:getUnsignedShort, [Java::int.java_class]).call(pos)\n end\n raise ArgumentError, \"Invalid arguments when calling get_unsigned_short(pos)\"\n end", "def converse_bit(pixel) \n\t\tpixel.red /= 257\n\t\tpixel.green /= 257\n\t\tpixel.blue /= 257\n\t\t\n\tend", "def generate_short_payload_singlesig_address\n warn \"[DEPRECATION] `generate_short_payload_singlesig_address` is no longer recommended.\"\n return unless CKB::ScriptHashType::TYPE == script.hash_type && script.has_args? && SHORT_PAYLOAD_AVAILABLE_ARGS_LEN.include?(CKB::Utils.hex_to_bin(script.args).bytesize)\n\n ConvertAddress.encode(prefix, short_payload(CODE_HASH_INDEX_SINGLESIG), Bech32::Encoding::BECH32)\n end", "def read_short(data, offset)\n out = data[offset,2].unpack('v').first rescue 0\n return out\n end", "def aes_bit(vector, n)\n (vector >> n) & 1\n end", "def bit_add(a, b)\n\t(7).downto(0).each do |x|\n\tend\nend", "def single_number_32bit(nums)\n bits = 4\n arr = Array.new(bits, 0) # constant space\n\n for i in 0...bits\n nums.each do |num|\n n = (num >> i) & 1 # moving bit at most significant place, anding with 1 so that last bit will just give 1 or 0, because 1 is 0...00001\n arr[bits-i-1] += n\n end\n arr[bits-i-1] %= 3\n end\n\n result = 0\n puts arr.to_s\n for i in 0...bits\n result += (arr[i] << (bits-i-1))\n end\n result\nend", "def short_binary_type; end", "def src_reg_to_alu_op(reg)\n rnum = reg[1].to_i\n return rnum.even? ? $alu_ops['alu_logic_A'] : $alu_ops['alu_logic_B']\nend", "def dither24to16(source_path, destination_path, files, sample_rate)\n files.each do |file|\n Open3.popen2('sox', '-V3', '-S', '--buffer', '131072', '--multi-threaded', \"#{source_path}/#{file}\", '-G', '-b', '16', \"#{destination_path}/#{file}\", 'rate', '-v', '-L', sample_rate, 'dither') do |stdin, stdout, status_thread|\n stdout.each_line do |line|\n puts \"LINE: #{line}\"\n end\n raise \"failed\" unless status_thread.value.success?\n end\n end\nend", "def field_bc1(op)\n (op & 0x03ff0000) >> 16\nend", "def case_16(value, method)\n count = 0\n\n while value >= BASE[0]\n value -= BASE[0];\n count += 1\n end\n\n count % 2 == 1 && (method = :push)\n\n [value, method]\n end", "def read_u3\n (read_u1 << 16) | read_u2\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def from_utf16_buffer\r\n self[0..index(\"\\0\\0\\0\")+2].from_utf16\r\n end" ]
[ "0.65374905", "0.640786", "0.63783634", "0.6296515", "0.627977", "0.6131336", "0.5857883", "0.5770558", "0.5723808", "0.5638667", "0.5562039", "0.5472757", "0.5449914", "0.5394178", "0.5371754", "0.530306", "0.52883154", "0.52779806", "0.527611", "0.5251712", "0.5246984", "0.52309686", "0.51858324", "0.51839703", "0.5173693", "0.51093006", "0.5029202", "0.49852014", "0.49843833", "0.49828947", "0.4975621", "0.49653745", "0.49461555", "0.49172586", "0.4882161", "0.48660532", "0.48519433", "0.4836334", "0.48327133", "0.48105633", "0.4799406", "0.47802588", "0.4778666", "0.47434163", "0.4735695", "0.4704017", "0.46960583", "0.4693752", "0.46845415", "0.4617995", "0.46168873", "0.4557056", "0.4546828", "0.45377317", "0.4516575", "0.44793782", "0.44619504", "0.44474274", "0.44315082", "0.44312957", "0.4428606", "0.44266483", "0.4376681", "0.43762195", "0.4358375", "0.43580103", "0.43496978", "0.43420842", "0.43415096", "0.43371454", "0.4324677", "0.43244803", "0.43026447", "0.4302325", "0.42871928", "0.427877", "0.42653754", "0.42621034", "0.4247617", "0.42266345", "0.4219032", "0.4216496", "0.42155707", "0.42042476", "0.42019713", "0.41843742", "0.4180781", "0.4162169", "0.41402602", "0.41378886", "0.41349533", "0.41339606", "0.41183308", "0.41154215", "0.41143295", "0.41121128", "0.41088223", "0.41079968", "0.41016328", "0.40960196" ]
0.800406
0
Prints the State of the 16Bit Multiplier
def printState(count,md,mq,ac) puts(count.to_s(2)) puts("MD:" + md.join) puts("AC:" + ac.join) puts("MQ:" + mq.join) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_state\n @@rows.times do |row|\n @@columns.times do |column|\n print '%4.4s' % @state_array[row * @@columns + column].to_s,\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def MULTIPLIER16BIT(multiplicand,multiplier)\n\taccumulator = ([0]*16)+multiplier\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize Concatenated Register [AC]+[MQ]\n\tcount = 16\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Initialize n-bit count.\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\twhile(count>=0)\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Start:\n\t\tif shiftRight(accumulator) == 1\t\t\t\t\t\t\t\t\t\t\t\t\t#Shiftout rightmost bit of [AC|MQ] and test it.\n\t\t\taccumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0]\t\t#If it's 1 then AC = AC+MD\n\t\tend\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\t\tcount -=1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#Decrement n-bit count by 1.\n\tend\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t#If count >= 0 then goto Start\n\tcount = 0\t\t\t\t\t\t\t\t\n\tprintState(count,multiplicand,accumulator[16,32],accumulator[0,16])\n\taccumulator+multiplier\nend", "def current_state_string\n string = \"\"\n\n (@size * @size).times{ |i|\n if i % @size == 0\n string << \"\\n\\t\"\n end\n if @state[i]\n string << \"1 \"\n else\n string << \"0 \"\n end\n }\n string << \"\\n\"\n\n return string\n end", "def print_state(machine)\n puts \"[#{machine[:stack]}, #{machine[:register]}]\"\nend", "def show_state\n\t\tputs \"#{self.name} a #{self.life_points} points de vie et une arme de niveau #{self.weapon_level}.\"\n\tend", "def show_state\n\t\tputs \"#{@name} a #{life_points} de points de vie et une arme de niveau #{weapon_level}\"\n\tend", "def show_state\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def show_state\n\t\tputs \"#{@name} a #{@life_points} points de vie.\"\n\tend", "def show_state\n puts \"#{name} a #{life_points} points de vie !!\"\n end", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\r\n end", "def show_state\n puts \"#{name} a #{life_points} points de vie!\"\n end", "def show\n \"$#{total} #{@state[0]} #{@state[1]} #{@state[2]} #{@state[3]} #{@state[4]}\"\n end", "def show_state\n \tputs \"#{@name} a #{life_points} points de vie\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} de PV\"\n end", "def changed_bits(options = {})\n temp = named_bits.select { |name, bits| bits.data != bits.reset_val }\n temp.each do |r|\n Origen.log.info \"\\t\\t#{self.name}.#{r[0]} : #{r[1].value.to_hex}\".bold.blue\n end\n Origen.log.info ' '\n end", "def show_state\n puts \"#{@names} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def print_values\n print \"\\nRegister A: #{@register_a}\\tRegister B: #{@register_b}\\n\"\n print \"Zero Bit: #{@zero_bit}\\tOverflow Bit: #{@overflow}\\n\"\n print \"Program Counter: #{@pc}\\n\"\n print \"Memory: #{@memory}\\n\"\n end", "def show\n closed!\n if @debug\n ary = @leds.map { |value| Rainbow(@debug).color(*to_rgb(value)) }\n $stdout.print \"\\r#{ary.join}\"\n end\n self\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie et son arme est de niveau #{self.weapon_level}.\"\n end", "def dump_registers\n registers.each do |name, register|\n puts \"#{name.to_s.rjust(6)}: \" +\n \"0x#{register.value.to_s(16).rjust(register.size, \"0\")} \" +\n \"(#{register.value})\"\n end\n end", "def show_state\r\n puts \"#{@name} à #{@life_points} points de vie\"\r\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state \n puts \"#{@name} a #{@life_points} points de vie et une arme au niveau #{@weapon_level}.\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{name} à #{life_points} points de vie\"\n end", "def info\n return 'STATE=d' if @state == 'd'\n\n str_info = \"\"\n\n str_info << \"STATE=\" << @state << \" \"\n str_info << \"USEDCPU=\" << @used_cpu.to_s << \" \"\n str_info << \"USEDMEMORY=\"<< @used_memory.to_s << \" \"\n str_info << \"NETRX=\" << @net_rx.to_s << \" \"\n str_info << \"NETTX=\" << @net_tx.to_s\n end", "def to_s\n \"state: #{@symbol} (options=#{options})\"\n end", "def show_state\n return \"#{@name} a #{life_points} points de vie et une amre de niveau #{weapon_level}\"\n end", "def show_state\n\t\treturn \"#{self.name} a #{self.life_points} points de vie.\"\n\tend", "def show_state\n return \"#{@name} a #{@life_points} points de vie\"\n end", "def show_state\n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def dump_state\n $log.debug \"State: [#{state.to_pretty_s}]\"\n end", "def show_state\n puts \"#{self.name} a #{self.life_points} points de vie.\"\n end", "def show_state\n puts \"#{names} a #{life_points} points de vie\"\n end", "def show_state\n puts \"#{@name} a #{@life_points} de vie\"\n end", "def show_state \n puts \"#{@name} a #{@life_points} points de vie.\"\n end", "def show_state \n puts \"#{@name} à #{@life_points} points de vie\"\n end", "def show_binstring()\n @values.values.map do |v|\n v ? \"1\" : \"0\"\n end.join\n end", "def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end\n end", "def report_state_to_spectators\n\t\tgs = game_state\n\t\t@spectators.each{|s| s.puts(gs)}\n\tend", "def show_state\n if @life_points < 0\n @life_points = 0\n end\n puts \"#{@name} a #{@life_points} points de vie et une arme de niveau #{@weapon_level}\"\n end", "def display ( )\n puts 'Parser states: ' + @states.size.to_s\n\n @states.each do |st|\n\tputs\n\tputs '*' * 80\n\tputs 'state: ' + st.statename\n\tputs 'branches: '\n\tst.branches.each do |br|\n\t puts ' ' + @states[br].statename\n\tend\n end\n end", "def intro\r\n puts \"+----------------------------- RUBY CALCULATOR -------------------------------+\"\r\n puts \"| 0b - Binary .b - To Binary Constants: e, pi ln(e), lg(2), log(10)|\"\r\n puts \"| 0x - Hex .h - To Hex _ gives last result |\"\r\n puts \"| 0 - Octal .o - To Octal q quits |\"\r\n puts \"+-----------------------------------------------------------------------------+\"\r\n puts \"| Window closes after 10 minutes of inactivity. Type 'keepalive' to disable. |\"\r\n puts \"+-----------------------------------------------------------------------------+\"\r\nend", "def show_state\n return puts \"#{super} et une arme de niveau \\\"#{@weapon_level}\\\"\"\n end", "def show\n # TODO put computation here for displaying alternate values?\n end", "def show_state\n puts \"#{@name} has #{@life_points} life points\"\n end", "def show_state\n\t\tputs \"#{@name} n'a plus qu'un point de vie !\" if @life_points == 1\n\n\t\tputs \"#{@name} est mort\" if @life_points == 0\n\n\t\tputs \"#{@name} a #{life_points} points de vie\" if @life_points.between?(2,10)\n\tend", "def print_game_state\n puts \"Players hand is #{@player_hand} Value: #{get_hand_value(@player_hand)}\".colorize(:light_blue)\n puts \"Dealer hand is #{@dealer_hand} Value: #{get_hand_value(@dealer_hand)}\".colorize(:light_blue)\nend", "def show_state\n if @life_points <= 0\n puts \">>> #{@name} a 0 points de vie\"\n else\n puts \">>> #{@name} a #{@life_points} points de vie\"\n end\n end", "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0])\n\tputs \"press enter to exit the program...\"\n\twait = gets\nend", "def dumpDebugState\n\t\tif(@hasMore)\n\t\t\tputs 'Has more solutions\\n'\n\t\telse\n\t\t\tputs 'No more solutions\\n'\n\t\tend\n\n\t\tputs \"availProofs #{@availProofs}\\n\"\n\t\tputs \"pengine #{@p.getID}\"\n\tend", "def describe_state(state)\n $states[state.to_sym].last.join(' ,')\nend", "def tick\n\t\t# what_it_is >> 11\n\t\ts = \"\"\n\t\tb=1;(1..32).each {|i| s += \"<label><input type='checkbox' checked><span class='checkable'>#{SYMBOL[b]}</span></label>\" if (self.what_it_is.to_i&b)==b; b = b << 1}\n\t\ts\n\tend", "def print_tile\n if @value == \"0\"\n print \"\"\n elsif @value != \"0\" && @given == false\n print @value.to_s.colorize(:blue)\n else\n print @value.to_s.colorize(:red)\n end\n end", "def shownumber_hash\n\t\tmult = @no1 * @no2 * @no3\n\t\tputs \"With hash #{@no1} * #{@no2} * #{@no3} = #{mult}\"\n\tend", "def to_s\r\n s = StringIO.new\r\n newstate = map\r\n @initstate.each_with_index do |sum, i|\r\n if sum != newstate[i]\r\n s.write \"*\"\r\n @initstate[i] = newstate[i]\r\n else\r\n s.write \".\"\r\n end\r\n end\r\n s.rewind;s.read()\r\n end", "def to_s\n @bits.to_s(2)\n end", "def show!\n Spi.begin do |s|\n s.clock(@spi_hz)\n s.write(START_FRAME + @led_frames + @end_frame)\n end\n end", "def printMultTable()\n print \" \"\n @validCharacters.each do |x|\n print x + \" \"\n \n end\n\n puts\n\n @validCharacters.each do |x|\n xBin = @encoder.encode(x)\n print x\n @validCharacters.each do |y|\n yBin = @encoder.encode(y)\n product = multiplyEncoded(xBin, yBin)\n print \" \" + @encoder.decode(product).chr\n end\n\n puts\n end\n end", "def description\n \"#{@number}, #{@symbol}, #{@color}, #{@shading}\"\n end", "def format_state(state)\n formated = \"\"\n for y in 1..$size # Builds line by line, so \"y\" comes first\n for x in 1..$size\n state[[x, y]]? (formated << \"#\") : (formated << \".\")\n end\n formated << \"\\n\"\n end\n return formated\nend", "def write_state(new_state)\n inputs_mask = 0\n @pins.each_with_index do |pin, i|\n inputs_mask = inputs_mask | 1 << i if pin.input?\n end\n # We use inputs_mask to make sure input pins are always set high\n # (even if they are reading low at the moment)\n @state = new_state\n ex \"i2cset -y #{@i2cbus} #{@addr} 0x#{(@state | inputs_mask).to_s(16)}\"\n end", "def to_s\n\t\tputs(\"States: #{@states}\")\n\t\tputs(\"Input Symbols: #{@input_symbols}\")\n\t\tputs(\"Output_symbols: #{@output_symbols}\")\n\t\tputs(\"Left Marker: #{@left_marker}\")\n\t\tputs(\"Blank Symbol: #{@blank_symbol}\")\n\t\tputs(\"Start State: #{@start_state}\")\n\t\tputs(\"Accept State: #{@accept_state}\")\n\t\tputs(\"Reject State: #{@reject_state}\")\n\t\tputs(\"Function Map: #{@function_map}\")\n\t\treturn \"\"\n\tend", "def poweron(s, level)\n sleep 0.1\n s.puts \"PD#{level.to_i()};\"\nend", "def echo_state(state)\n if String.disable_colorization\n case state\n when 'running' then '+ ' \n when 'stopped' then '- '\n when 'terminated' then 'X '\n when 'pending' then 'O '\n when 'shutting-down' then '\\\\_'\n when 'stopping' then '~-'\n else '??'\n end\n else\n case state\n when 'running' then '✅ ' \n when 'stopped' then '❙❙'\n when 'terminated' then '⚫ '\n when 'pending' then '⚪ '\n when 'shutting-down' then '♺ '\n when 'stopping' then '⌛ '\n else '??'\n end\n end\nend", "def displayState(position)\n print \"\\n\"\n for x in 0..2\n for y in 0..2\n print position[x][y].to_s+\" \"\n end\n print \"\\n\"\n end\n print \"\\n\"\n end", "def content\n [ppux, ppuy, unit == :meters ? 1 : 0].pack(\"NNC\")\n end", "def ascii_bit_stream\n @screen.flatten.inject(\"\") { |r, p| r << (p ? \"1\" : \"0\") }\n end", "def g(value)\n (value & 0x00ff0000) >> 16\n end", "def g(value)\n (value & 0x00ff0000) >> 16\n end", "def eth_gpu_en; eth_ctrl_bit(1); end", "def print_info\n self.values.each do |value|\n puts value\n end\n end", "def render_State s\n return if @rendered[s]\n @rendered[s] = true\n\n stream.puts \"\\n// #{s.inspect}\"\n \n sequence = [ ]\n \n if options[:history]\n options[:history].each_with_index do | hist, i |\n if hist[:new_state] && s.is_a_superstate_of?(hist[:new_state])\n sequence << i + 1\n end\n end\n end\n\n dot_opts = {\n :label => dot_label(s),\n :shape => :box,\n :style => \"filled\",\n }\n\n case\n when s.end_state?\n dot_opts[:label] = \"\" # DONT BOTH LABELING END STATES.\n dot_opts[:shape] = :doublecircle\n end\n\n dot_opts = dot_opts_for s, dot_opts\n\n hide_decomposition = dot_opts.delete(:hide_decomposition)\n stream.puts \" // hide_decomposition = #{hide_decomposition.inspect}\"\n\n if (hs = options[:highlight_states]) && hs.include?(s)\n dot_opts[:style] += ',bold'\n end\n\n unless sequence.empty?\n if options[:highlight_state_history] && (s.submachine ? hide_decomposition : true)\n dot_opts[:fillcolor] = :grey\n end\n if options[:show_state_sequence] \n dot_opts[:label] += \"\\\\n(#{sequence_to_s(sequence)})\\\\r\"\n end\n else\n if options[:highlight_state_label_history]\n dot_opts[:fontcolor] = :grey\n end\n if options[:highlight_state_border_history]\n dot_opts[:color] = :grey\n end\n end\n\n dot_opts[:color] ||= :black\n dot_opts[:fontcolor] ||= :black\n dot_opts[:fillcolor] ||= :white\n\n # Dont label FinalStates, it causes too much clutter.\n # Invert the colors to be more like UML.\n case\n when s.end_state?\n dot_opts[:label] = \"\" \n dot_opts[:fillcolor], dot_opts[:fontcolor] =\n dot_opts[:fontcolor], dot_opts[:fillcolor]\n end\n\n if ssm = s.submachine\n # Composite States are rendered as\n # a subgraph cluster with a target and source \"connection point\" for external connections.\n # This is where the dot_name(s, :source || :target) is defined.\n # Subsequence Transitions edges will used these connnection points.\n implicit_dot_opts = dot_opts.dup\n dot_opts[:hide_decomposition] = hide_decomposition\n render_StateMachine(ssm, dot_opts) do\n dot_opts = implicit_dot_opts\n dot_opts[:shape] = :point\n dot_opts[:label] = \"[]\"\n\n stream.puts %Q'\\n subgraph cluster_#{dot_name(s, :source)} {'\n stream.puts %Q{ color=none;}\n stream.puts %Q{ fillcolor=none;}\n stream.puts %Q{ fontcolor=none;}\n stream.puts %Q{ label=\"\";}\n stream.puts %Q{ shape=\"plaintext\";}\n stream.puts %Q{ style=\"none\";}\n\n dot_opts[:color] = :black\n dot_opts[:fillcolor] = :black\n stream.puts \"\\n// Implicit target point for State #{s.to_s}\"\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :target)};}\n\n dot_opts[:color] = :black\n dot_opts[:fillcolor] = :white\n stream.puts \"\\n// Implicit source point for State #{s.to_s}\"\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, :source)};}\n stream.puts \"\\n }\\n\"\n end\n return self\n end\n\n # Non-composite States are rendered as simple nodes.\n # In this case dot_name(s, :source || :target) == dot_name(s).\n dot_opts[:style] += ',rounded'\n stream.puts %Q{ node [ #{render_opts(dot_opts)} ] #{dot_name(s, [:source, :target])};}\n\n return self\n end", "def log(bit)\n puts \"\\033[35m#{bit} \\033[0m\"\nend", "def pattern_bits\n str = bits.to_s(2)\n str = str.rjust(self.step_count, '0')\n str.chars.collect{|x|x=='1'}\n end", "def ShowCurrentValue()\n # Print out the new value\n puts 'The amount now is ' + self.value.to_s\n end", "def print\n\t\t\tputs \"F: \" + toFahrenheit(@degrees, @scale).to_s + \" C: \" + toCelsius(@degrees, @scale).to_s + \" K: \" + toKelvin(@degrees, @scale).to_s\n\t\tend", "def short\n quality + number.to_s \n end", "def displayTemp()\n print \"\\t\" + '%.5f' % @myDegree + \" \" + @myScale + \"\\t\"\n end", "def print\r\n\t\t\tputs \"F: \" + toFahrenheit(@degrees, @scale).to_s + \" C: \" + toCelsius(@degrees, @scale).to_s + \" K: \" + toKelvin(@degrees, @scale).to_s\r\n\t\tend", "def ipb_usage\n puts \"Available Options for I.P.B. Menu: \".underline.white\n puts \"back \".light_yellow + \" => \".white + \"Return to Main Menu\".light_red\n puts \"check\".light_yellow + \" => \".white + \"IPB <= 3.3.4 Unserialized RCE Check\".light_red\n puts \"exploit\".light_yellow + \" => \".white + \"IPB <= 3.3.4 Unserialized RCE Exploit\".light_red\nend", "def shownumbers_mand\n\t\tmult = @num1 * @num2 * @num3\n\t\tputs \"With Mandtory #{@num1} * #{@num2} * #{@num3} = #{mult}\"\n\tend", "def print_instruction(instruction, idx)\n puts bold { \"[\" } + blue { idx.to_s } + bold { \"]\" } + \": \" + green { instruction.first } + \" \" + bold { instruction[1..-1].map(&:inspect) }\n end", "def print_instr_debug\n instructions.each do |instr|\n instr_bytes = instr.words\n fstr = \"%x \" * instr_bytes.size\n puts \"#{instr.to_s_eval} \\t ;#{fstr % instr_bytes}\"\n end\n end", "def prn\n puts \" #{(0..8).to_a.join(\" \")}\"\n puts \" #{'-' * (2 * 9)}\"\n g.each_with_index do |v, i|\n # ERROR: print function doesn't display values and doesn't use colors\n # puts \"#{i} #{v.join(\" \")}\"\n puts \"#{i} | #{v.map{|t| t.n.to_s.colorize(t.c) }.join(' ')}\"\n end\n end", "def handle_bit (num)\n num2str=''\n num2str+=NUM_MAP[num]\n return num2str\nend", "def print_centralities\n values = @counters.all_counters\n .map(&:centrality)\n .map(&:to_i)\n .inject(Hash.new(0)) { |hash, value| hash[value] += 1 ; hash }\n\n values.each do |value|\n puts value.join(',')\n end\n end", "def eth_gpu_en=(val); eth_ctrl_bit(1, val); end", "def statecolor(state)\n\t\tif state == \"running\"\n\t\t\t\"color: green;\".html_safe\n\t\telsif state == \"poweroff\"\n\t\t\t\"color: gray;\".html_safe\n\t\telse\n\t\t\t\"color: yellow;\".html_safe\n\t\tend\n\tend", "def state_to_c(state)\n case state\n when 'poweredOn'\n 'a'\n when 'suspended'\n 'p'\n else\n 'd'\n end\n end", "def to_pretty_s\n \"#{type}:#{name} is #{state}\"\n end", "def to_s\n\t\treturn \"#@num/#@den\"\n\tend", "def display_future\n print \"\\n\"\n @x.times{ |r|\n @y.times{|c| \n print @mat[r][c].next_generation ? \"X \" : \"- \"\n }\n print \"\\n\"\n }\n end", "def inspect\n self.each_pair do |k, v|\n print \"%-40s\" % k.to_s.yellow unless k == :mbr\n case k\n when :crc, :version then puts \"0x%08x\" % v\n when :mbr\n v.each_pair do |i, j|\n next if i == :reserved\n print \"%-40s\" % i.to_s.yellow unless i == :part\n case i\n when :part\n puts \"Partitions:\".light_blue\n c = 'a'\n j.each do |p|\n break if p.name.empty?\n print \"%-40s\" % p.name.yellow\n puts \"(nand%s) @ 0x%08x [% 5d MB] [0x%08x]\" % [c,\n p.address_low, p.lenlo/2048, p.keydata]\n c.next!\n end\n else\n puts \"#{j}\"\n end\n end\n else\n puts \"#{v}\"\n end\n end\n end", "def eth_sw_en; eth_ctrl_bit(0); end", "def toggle_state\n puts \"******* toggle_state *******\"\n end", "def show_radio_info()\n if $kx_model==2\n puts \"KX2 Detected\"\n elsif $kx_model==3\n puts \"KX3 Detected\"\n else\n puts \"Unsupported radio model.\"\n $all_done=true\n end\n if $kx_atu\n puts \"KXAT2/KXAT3 Internal ATU Detected\"\n end\n if $kx_pa\n puts \"KXPA100 External PA Detected\"\n end\n if $kx_filter\n puts \"KXFL3 Roofing Filter Detected\"\n end\n if $kx_extatu\n puts \"KXAT100 External ATU Detected\"\n end\n if $kx_charger\n puts \"XKBC3 Charger/RTC Detected\"\n end\n if $kx_transverter\n puts \"KX3-2M/KX3-4M Transverter Detected\"\n end\n if $kx_rtcio\n puts \"KXIO2 RTC I/O Module Detected\"\n end\nend", "def shiny_rate\n 16\n end", "def value\n return 15*level\n end", "def show\n @promotions = @condition.promotions\n @coefficients = @condition.coefficients\n end" ]
[ "0.61566436", "0.58458483", "0.5801427", "0.5730938", "0.5717868", "0.5710503", "0.5687146", "0.568005", "0.5645783", "0.5645231", "0.5641426", "0.5633778", "0.5554697", "0.5550404", "0.55499506", "0.5548444", "0.5537471", "0.55129886", "0.5502262", "0.54755956", "0.5473547", "0.54674804", "0.54459614", "0.543388", "0.5418218", "0.54077846", "0.54036194", "0.53983235", "0.53778434", "0.5372522", "0.5359245", "0.53546655", "0.5352636", "0.53505427", "0.53501815", "0.53305626", "0.53004616", "0.5288598", "0.5274598", "0.5271969", "0.52630246", "0.5161775", "0.5136761", "0.5130422", "0.51238275", "0.51226526", "0.51122546", "0.5102478", "0.50966626", "0.50949585", "0.5090638", "0.50842685", "0.5077336", "0.5068888", "0.50632054", "0.5021168", "0.50185347", "0.5010372", "0.4997989", "0.49842796", "0.49783552", "0.49736822", "0.49723563", "0.4965648", "0.4961923", "0.49591887", "0.4957667", "0.49525782", "0.49397308", "0.49397308", "0.49246907", "0.49245983", "0.49176785", "0.49009138", "0.48989937", "0.4891035", "0.48875728", "0.48824137", "0.48784706", "0.48760152", "0.4868064", "0.48643097", "0.4859409", "0.48552802", "0.48534402", "0.4842351", "0.48419252", "0.4838096", "0.48298582", "0.48172694", "0.48068932", "0.48011103", "0.47969797", "0.47839695", "0.47819597", "0.4765343", "0.4765185", "0.476445", "0.4761054", "0.47566518" ]
0.603645
1
16Bit Multiplier Performs shift multiplication on two register values and outputs the values in a 32bit register.
def MULTIPLIER16BIT(multiplicand,multiplier) accumulator = ([0]*16)+multiplier #Initialize Concatenated Register [AC]+[MQ] count = 16 #Initialize n-bit count. printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) while(count>=0) #Start: if shiftRight(accumulator) == 1 #Shiftout rightmost bit of [AC|MQ] and test it. accumulator[0,16] = ALU16BIT(multiplicand,accumulator[0,16],0,0,1,0)[0] #If it's 1 then AC = AC+MD end printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) count -=1 #Decrement n-bit count by 1. end #If count >= 0 then goto Start count = 0 printState(count,multiplicand,accumulator[16,32],accumulator[0,16]) accumulator+multiplier end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def word16(a, b)\n (a << 8) | b\n end", "def word16(bytes_a, bytes_b)\n (bytes_a << 8) | bytes_b\n end", "def ALU16BIT(a,b,cin,binv,op1,op2)\n\tresult = [nil]*16\n\t15.downto(1).each{|i| result[i],cin = ALU1BIT(a[i],b[i],cin,binv,op1,op2)}\n\tresult[0],cout,ovf = ALU1BIT_OF(a[0],b[0],cin,binv,op1,op2)\n\t#Send out our result, carry out, and overflow\n\treturn result,cout,ovf\nend", "def write16(val)\n\tval = (-val) | 0x8000 if val < 0\n\tputc((val >> 8) & 0xff)\n\tputc(val & 0xff)\n end", "def shr16(e)\n eval_ex(e) >> 16\n end", "def read16\n\tval = (getc() << 8) + getc()\n\tval = -(val & 0x7fff) if (val & 0x8000).nonzero?\n\treturn val\n end", "def raise_to_power(x, y)\n #every shift left is like a * 2\n #11000\nend", "def int8_mult(a, b)\n t = a * b + 0x80\n ((t >> 8) + t) >> 8\n end", "def int8_mult(a, b)\n t = a * b + 0x80\n ((t >> 8) + t) >> 8\n end", "def uint16()\n _uint16(\"uint16\")\n end", "def write_word16_native(val)\n pw(val, 'S')\n end", "def mul(val)\n # imul: //OperandSize == 32 EDX:EAX = EAX * Source\n # 0x00000000000fd317 : imul dword ptr [rcx] ; ret\n tmp = reg_addr\n flat(store(val, tmp), pop_rcx, tmp, libc + 0xfd317)\nend", "def convert(value)\n byteshift = (value+3)/8\n bitshift = value-byteshift*8\n# printf(\"%d --> %d,%d\\n\", value,byteshift,bitshift)\n if bitshift<0\n bitshift *= -1\n bitshift += 0x08\n end\n ret = byteshift*16+bitshift\n return ret\nend", "def uint16(*payloads)\n fixnums(2, FormatStrings::UINT16, payloads)\n end", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def write16(data, options = {})\n dw \"w2 0x#{extract_address(data, options).to_s(16).upcase}, 0x#{extract_data(data, options).to_s(16).upcase}\"\n end", "def * other\n %s(__int (mul (sar self) (sar other)))\n end", "def i16s\n little? ? BinUtils.get_sint16_le(read(2)) : BinUtils.get_sint16_be(read(2))\n end", "def shl op1, op2\n @fisk.shl cast_to_fisk(op1), cast_to_fisk(op2)\n end", "def shiftRight(register)\n\tregister.unshift(0).pop\nend", "def js_shr_zf(count)\n self >> count & (2**(32 - count) - 1)\n end", "def hamming_distance(x, y)\n dist = 0\n\n bits = x^y\n\n while bits > 0\n bits = bits >> 1\n if (bits & 1)\n dist += 1\n end\n end\n\n return dist\nend", "def i16s\n r = little? ? BinUtils.get_sint16_le(@data, @pos) : BinUtils.get_sint16_be(@data, @pos)\n @pos += 2\n r\n end", "def u16\n next_bytes(2).unpack(\"S>\").first\n end", "def <<(bits)\n value = @value * (2**bits.to_i)\n if (bounded?)\n self.class.new(value & self.mask, @length)\n else\n self.class.new(value)\n end\n end", "def scale(series, control, multiplier=1)\n map_over series, control, multiplier do |val,previous|\n [val * multiplier, val]\n end\n end", "def shift() end", "def shift() end", "def i16\n i16s\n end", "def shiftLeft(register)\n\tregister.shift\n\tregister.push(0)\nend", "def convert_and_write_float_sample_16bit(float_sample, mode='file')\n\t\t# converts sample to 16-bit integer and calls encode-and-write method\n\t\t# positive values have one conversion equation...\n\t\tif float_sample >= 0\n\t\t\tint_sample = (float_sample * 32767.to_f).round\n\t\t\t# write rounded value to file\n\t\t\tencode_and_write_int16(int_sample, mode)\n\t\t# ...negative values have another\n\t\telsif float_sample < 0\n\t\t\tint_sample = (((float_sample + 1.to_f) * 32767.to_f) +\n\t\t\t\t32768.to_f).round\n\t\t\t# write rounded value to file\n\t\t\tencode_and_write_int16(int_sample, mode)\n\t\tend\n\tend", "def mult(s, t)\n @lo = ((reg_r(s) * reg_r(t)) << 32) >> 32\n @lo = (reg_r(s) * reg_r(t)) >> 32\n\n adv_pc\n end", "def i16u\n little? ? BinUtils.get_int16_le(read(2)) : BinUtils.get_int16_be(read(2))\n end", "def mult15(n)\n\n\tn * 15\n\t\t\t\n\tend", "def rol(num, cnt)\n #return (num << cnt) | (num >>> (32 - cnt))\n return (num.js_shl(cnt)) | (num.js_shr_zf(32 - cnt))\n end", "def generate_short_payload_multisig_address\n warn \"[DEPRECATION] `generate_short_payload_multisig_address` is no longer recommended.\"\n return unless SystemCodeHash::SECP256K1_BLAKE160_MULTISIG_ALL_TYPE_HASH == script.code_hash\n\n ConvertAddress.encode(prefix, short_payload(CODE_HASH_INDEX_MULTISIG_SIG), Bech32::Encoding::BECH32)\n end", "def _reduce_32(val, _values, result); end", "def _reduce_32(val, _values, result); end", "def setShift(sx,sy) \n @device.setShift(sx,sy) \n end", "def shift_short(buffer)\n bytes = buffer.slice!(0..1)\n bytes.unpack('n').first\n end", "def bitshift\n shift = pop\n int1 = pop\n\n push int1 << shift\n end", "def shift_out\n end", "def shift_short(buffer)\n bytes = buffer.slice!(0..1)\n bytes.unpack('n').first\n end", "def single_number_32bit(nums)\n bits = 4\n arr = Array.new(bits, 0) # constant space\n\n for i in 0...bits\n nums.each do |num|\n n = (num >> i) & 1 # moving bit at most significant place, anding with 1 so that last bit will just give 1 or 0, because 1 is 0...00001\n arr[bits-i-1] += n\n end\n arr[bits-i-1] %= 3\n end\n\n result = 0\n puts arr.to_s\n for i in 0...bits\n result += (arr[i] << (bits-i-1))\n end\n result\nend", "def Multiplication(a,b)\n f = a.to_i * b.to_i\n puts \"Multiplication of both number is: #{f}\"\n end", "def main\n\tputs \"begin press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1])\n\tputs \"next case, press enter...\"\n\twait = gets\n\tMULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0])\n\tputs \"press enter to exit the program...\"\n\twait = gets\nend", "def shift_out_right\n # This is functionally equivalent to shift_out, actually sends LSB first\n each { |bit| yield bit }\n end", "def powers_of_2\r\n\t\tunless $powers_of_2\r\n\t\t\t$powers_of_2 = [1]\r\n\t\t\t((BASE_BYTE << 3) - 1).times do |i|\r\n\t\t\t\t$powers_of_2[i + 1] = $powers_of_2[i] << 1\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn $powers_of_2\r\n\tend", "def shift; end", "def shift; end", "def multiply_fifteen num\n num * 15\nend", "def interleave_bits(x, y)\n c = 0\n 31.downto(0) do |i|\n c = (c << 1) | ((x >> i) & 1)\n c = (c << 1) | ((y >> i) & 1)\n end\n c\n end", "def translate_reg(reg, nregs, reg_size)\n if nregs==1 && reg_size==16 # 16bit integer\n return reg.pack(\"S\").unpack(\"s\")[0]\n elsif nregs==2 && reg_size==16 # 32bit float, big-endian\n return reg.pack(\"nn\").unpack(\"g\")[0]\n else \n return reg[0]\n end\n rescue => ex\n $log.error \"modbus failed to check_type\", :error =>ex.message\n $log.warn_backtrace ex.backtrace\n end", "def MUX2X1(x,y) XOR(x,y); end", "def power2(key)\n self.class.power2(key)\n end", "def shifted_shift(first, second)\r\n (0..second.size).each{|n| return n if first==second.chars.rotate(n).join} end", "def rol(num, cnt)\n # return (num << cnt) | (num >>> (32 - cnt))\n (num.js_shl(cnt)) | (num.js_shr_zf(32 - cnt))\n end", "def transmogrifier(num1,num2,square)\n\tresultOf = num1*num2\n\tnumberex = square * square\n\tresultpower = resultOf + numberex\nend", "def multiply(a, b)\n\treturn a.to_i * b.to_i\nend", "def raise_to_power_brute(x, y)\n result = x\n\n while y > 1\n result *= x\n y -= 1\n end\n\n result\nend", "def i16\n next_bytes(2).unpack(\"s>\").first\n end", "def nsw_mul(lhs, rhs, name = \"\")\n Instruction.from_ptr(C.build_nsw_mul(self, lhs, rhs, name))\n end", "def ethiopian_multiplication(a, b)\n if a > b\n # a should be smaller than b\n tmp = a\n a = b\n b = tmp\n end\n sum = 0\n while a >= 1\n sum += b if a.odd?\n a /= 2\n b *= 2\n end\n sum\n end", "def shift_right\n @mid, @value2, @right = @left, @value1, @mid\n end", "def multiply_two_numbers( x, y )\n x * y\nend", "def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend", "def to_signed_short n\n length = 16 # bits\n max = 2**length-1\n mid = 2**(length-1)\n n>=mid ? -((n ^ max) + 1) : n\nend", "def pack_int64le(val)\n [val & 0x00000000ffffffff, val >> 32].pack(\"V2\")\n end", "def shift\n end", "def shift\n end", "def shift\n end", "def #power(a,b)\n\ta ** b\nend", "def shift(ndigits)\n #This is a stub, used for indexing\n end", "def i16u\n r = little? ? BinUtils.get_int16_le(@data, @pos) : BinUtils.get_int16_be(@data, @pos)\n @pos += 2\n r\n end", "def multiplication (a,b)\n f = a.to_i * b.to_i\n puts \"Multiplication is: #{f}\"\n end", "def nearest_power_of_2(num)\n temp = num\n temp -= 1\n temp |= temp >> 1\n temp |= temp >> 2\n temp |= temp >> 4\n temp |= temp >> 8\n temp |= temp >> 16\n temp += 1\n temp\nend", "def call_mul(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n\n adder = @computer.memory.read(mem_addr, m_spec[:l], m_spec[:r])\n sum = @registers['A'].word.to_i * adder.to_i\n @registers['A'].word.from_int(sum)\n end", "def *(value)\n mul(value) ;\n end", "def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend", "def read_short(signed = false, mut = :STD, order = :BIG)\n val = 0\n case order\n when :BIG\n val |= read_byte(signed) << 8\n val |= read_byte(signed, mut)\n when :LITTLE\n val |= read_byte(signed, mut)\n val |= read_byte(signed) << 8\n end\n val\n end", "def power(a,b)\n a.to_i ** b.to_i\nend", "def MOVSXD(a,b) opcode \"MOVSXD\", [a,b] end", "def write32(val)\n\tval = (-val) | 0x80000000 if val < 0\n\tputc((val >> 24) & 0xff)\n\tputc((val >> 16) & 0xff)\n\tputc((val >> 8) & 0xff)\n\tputc(val & 0xff)\n end", "def write_int16(int)\n write([int].pack(\"s>\"))\n end", "def read_u2\n (read_u1 << 8) | read_u1\n end", "def multiply_2_and_return(x, y)\n x * y\nend", "def twist(x)\n hi_x = x >> 8\n lo_x = (x & 0xFF)\n (rlc8(hi_x) << 8) + (rlc8 lo_x)\n end", "def get(index, numBits)\n andMask = 2**numBits - 1 # 000000001111\n andMask = andMask << (index % @@wordBits) # 000011110000\n value = @bits[index/@@wordBits] & andMask # 0000vvvv0000\n value = value >> (index % @@wordBits) # 00000000vvvv\n value\n end", "def safe_add(x, y)\n v = (x+y) % (2**32)\n return v > 2**31 ? v- 2**32 : v\n end", "def shift_swap(lyst, index, sign)\n lyst[index] = (lyst[index].send(sign,1)) % 5\n end", "def power(x,y)\n\treturn x**y\nend", "def power(n1, n2)\n output = n1\n i = 0\n \n while i < n2\n i += 1\n output = output * n1\n \n end\n return output\nend", "def read16(data, options = {})\n read_memory(extract_address(data, options), number: 2)\n end", "def multiply(a, b)\n\t\treturn a*b\n\tend", "def multiply(first, second)\n first.send(:*, second)\nend", "def case_16(value, method)\n count = 0\n\n while value >= BASE[0]\n value -= BASE[0];\n count += 1\n end\n\n count % 2 == 1 && (method = :push)\n\n [value, method]\n end", "def multiply(x, y)\n return x * y * 37\n x * y\nend", "def hi; (self >> 4).lo end", "def setMult(geneID, index, numBits, value)\n a = @genePool[geneID]\n a.set(index, numBits, value)\n end", "def multiply(x,y) \n\tx * y\t\nend" ]
[ "0.62553686", "0.57320726", "0.554205", "0.548405", "0.5399427", "0.5135696", "0.5019342", "0.49688086", "0.49688086", "0.496511", "0.49536118", "0.484081", "0.48359263", "0.47815377", "0.47711468", "0.47600517", "0.47363007", "0.4700563", "0.464522", "0.46444798", "0.46284735", "0.4611219", "0.46095008", "0.46013105", "0.4596269", "0.4585467", "0.45483002", "0.45483002", "0.45254803", "0.4513952", "0.4513222", "0.44963145", "0.44908053", "0.44895086", "0.44627526", "0.44580433", "0.44574672", "0.44574672", "0.44523066", "0.4449853", "0.4448848", "0.44486326", "0.4431628", "0.44290763", "0.44286594", "0.44278443", "0.44150618", "0.44038913", "0.43876952", "0.43876952", "0.43828714", "0.43770653", "0.43757927", "0.4374321", "0.43727154", "0.43717554", "0.43524495", "0.4349566", "0.43482473", "0.43472004", "0.43459678", "0.43453887", "0.43446872", "0.43420625", "0.43389696", "0.4329204", "0.43279698", "0.43262795", "0.4325585", "0.4325585", "0.4325585", "0.4319549", "0.4314458", "0.43082565", "0.42996803", "0.42969114", "0.42869917", "0.42794028", "0.42771366", "0.4273044", "0.42643905", "0.4263454", "0.42496166", "0.42444202", "0.4221117", "0.42204413", "0.42158887", "0.42108563", "0.42071193", "0.42047557", "0.42044622", "0.42011362", "0.4198957", "0.41971192", "0.41876414", "0.41866365", "0.41844854", "0.41749334", "0.41720328", "0.41668192" ]
0.7001033
0
Shifts a Register to the Right
def shiftRight(register) register.unshift(0).pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shiftLeft(register)\n\tregister.shift\n\tregister.push(0)\nend", "def shift_right\n @mid, @value2, @right = @left, @value1, @mid\n end", "def shift_right\n self.unshift(self.pop)\n end", "def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end", "def right=(r); self[0] = r - self[2]; return r; end", "def shift() end", "def shift() end", "def right=(r)\r\n @x = r - @w\r\n end", "def shift_right(data = 0)\n prev_bit = nil\n shift_out do |bit|\n prev_bit.write(bit.data) if prev_bit\n prev_bit = bit\n end\n prev_bit.write(data)\n self\n end", "def shift; end", "def shift; end", "def rotate_right\n dup.rotate_right!\n end", "def shift_out_right\n size.times do |i|\n yield(bit_at_position(i), i)\n end\n end", "def shift\n end", "def shift\n end", "def shift\n end", "def move_right\n right_tile = C[@location.first, @location.second + 1]\n move_to(right_tile)\n end", "def right\n rotate(1)\n end", "def opcode_8XY2(helper)\n\t\thelper.registry_X = helper.registry_X & helper.registry_Y\n\tend", "def shift_right(count=2)\n c = dup\n c.shift_right!(count)\n c\n end", "def shift!(dr)\r\n @pos.x += dr[0]\r\n @pos.y += dr[1]\r\n end", "def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end", "def rotateRight()\n twoTypeRotate()\n end", "def shift_out_right\n # This is functionally equivalent to shift_out, actually sends LSB first\n each { |bit| yield bit }\n end", "def right(value)\n @ole.Right = value\n nil\n end", "def right(value)\n @ole.Right = value\n nil\n end", "def shift_left\n @left, @value1, @mid = @mid, @value2, @right\n end", "def opcode_8XY1(helper)\n\t\thelper.registry_X = helper.registry_X | helper.registry_Y\n\tend", "def rotateRight()\n fourTypeRotate(Tetromino::COUNTERCLOCKWISE)\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def wrap_right\n wrap_operand(operand.right)\n end", "def shift_left\n self.push(self.shift)\n end", "def move_to_right_of(node)\n self.move_to(node, :right)\n end", "def shift(ndigits)\n #This is a stub, used for indexing\n end", "def setRight(nodeCurrent, nodeRight)\n return nodeCurrent.setRight(nodeRight)\n end", "def mid_borrows_from_right\n @mid.type, @mid.value1, @value2, @mid.mid = 2, @value2, @right.value1, @right.left\n @right.shift_left\n @right.type = 2\n end", "def move_right\n tenacious_transaction do\n move_to_right_of right_sibling.try(:lock!)\n end\n end", "def right; return self[0]+self[2]; end", "def right_borrows_from_mid\n @right.type, @right.mid, @right.value1 = 2, @right.left, @value2\n if @mid.type == 3\n @right.left, @value2 = @mid.right, @mid.value2\n else\n @right.left, @value2 = @mid.mid, @mid.value1\n end\n @mid.type -= 1\n end", "def rotate_right(node)\n new_node = node.left\n node.left = new_node.right\n new_node.right = node\n return new_node\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def move_to_right_of(node)\n move_to node, :right\n end", "def execute_ROR(operand)\n\t\t# affects CF and OF flags\n\t\tcount = bit_rotate_count_for(operand, operand.size)\n\t\tmask = (operand.value << (operand.size - count))\n\t\toriginal_value = operand.value\n\t\toperand.value = (operand.value >> count) + mask\n\t\tset_rotate_flags_from(operand, original_value)\n\tend", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def move_to_right_of(node)\n self.move_to node, :right\n end", "def shift_out\n end", "def right\n direction.move_right!\n end", "def move_right\n self.move_to_right_of(self.right_sibling)\n end", "def put_dest(mode, dst_r)\n case mode\n when 1 # Register direct\n temp = @reg[dst_r]\n x = yield temp\n @reg[dst_r] = x\n when 2 # Indirect\n dst_address = @mem.read(@pc)\n @pc += 1\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n when 3 # Register indirect\n dst_address = @reg[dst_r]\n temp = @mem.read(dst_address)\n new_value = yield temp\n @mem.write(dst_address, new_value)\n end\n end", "def rebalance_for_right_insert\n\t\t\tif @right.left.red?\n\t\t\t\twith_right(@right.rotate_right)\n\t\t\telse\n\t\t\t\tself\n\t\t\tend.rotate_left\n\t\tend", "def right=(value)\n @right = value\n end", "def right\n self.y = (y+1)%10\n end", "def shift!(dr)\r\n (0..1).each { |i| @center[i] += dr[i] }\r\n end", "def right\r\n @angle += ROTATION_ANGLE\r\n end", "def shift_in\n end", "def move_right\n move_to_right_of right_sibling\n end", "def move_right\n move_to_right_of right_sibling\n end", "def shift\n if letter = left.shift || right.shift\n @length -= 1\n letter\n else\n nil\n end\n end", "def shift\n raise \"index out of bounds\" if (length == 0)\n\n val = self.store[0]\n self.store = self.store[1..-1]\n self.length -=1\n val\n end", "def build_operand(arg)\n if (arg.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg.value.fits_u8?)\n # no shifting needed\n @operand = arg.value\n @i = 1\n elsif (op_with_rot = calculate_u8_with_rr(arg))\n @operand = op_with_rot\n @i = 1\n else\n raise AS::AssemblyError.new(AS::ERRSTR_NUMERIC_TOO_LARGE, arg)\n end\n elsif (arg.is_a?(AS::Parser::RegisterArgNode))\n @operand = reg_ref(arg)\n @i = 0\n elsif (arg.is_a?(AS::Parser::ShiftNode))\n rm_ref = reg_ref(arg.argument)\n @i = 0\n shift_op = {'lsl' => 0b000, 'lsr' => 0b010, 'asr' => 0b100,\n 'ror' => 0b110, 'rrx' => 0b110}[arg.type]\n if (arg.type == 'ror' and arg.value.nil?)\n # ror #0 == rrx\n raise AS::AssemblyError.new('cannot rotate by zero', arg)\n end\n \n arg1 = arg.value\n if (arg1.is_a?(AS::Parser::NumLiteralArgNode))\n if (arg1.value >= 32)\n raise AS::AssemblyError.new('cannot shift by more than 31', arg1)\n end\n shift_imm = arg1.value\n elsif (arg1.is_a?(AS::Parser::RegisterArgNode))\n shift_op |= 0x1;\n shift_imm = reg_ref(arg1) << 1\n elsif (arg.type == 'rrx')\n shift_imm = 0\n end\n \n @operand = rm_ref | (shift_op << 4) | (shift_imm << 4+3)\n else\n raise AS::AssemblyError.new(AS::ERRSTR_INVALID_ARG, arg)\n end\n end", "def shift_out_left\n size.times do |i|\n yield(bit_at_position(size - i - 1), i)\n end\n end", "def rotate_left(value, shift)\n ((value << shift) | (value >> (20 - shift))) & 0xFFFFF\n end", "def rotateRight(a, l, r)\n arr = a.dup\n temp = arr[r]\n r.downto(l + 1).each do |i|\n arr[i] = arr[i - 1]\n end\n arr[l] = temp\n arr\n end", "def <<( reg )\n reg = reg.to_reg() if reg.is_a?( RegisterSlot )\n raise \"not reg value or slot #{reg}\" unless reg.is_a?(RegisterValue)\n to_mem(\"#{reg.class_name} -> #{register.class_name}[#{index}]\" , reg)\n end", "def move_right(environment)\n @previous_action = 'moved right'\n location[:x] += 1 if can_move_left?(environment)\n environment.state\n end", "def call_src(reg_key, addr, i_reg, m_spec)\n mem_addr = get_mem_addr(addr, i_reg)\n (1..mem_addr).each do |i|\n @registers['A'].word.rotate_right\n end\n end", "def right\n visit(input.right)\n end", "def unshift(val)\n resize! if @length == @capacity\n @length += 1\n #slide everything to the right\n (@length-2).downto(0).each do |i|\n @store[i+1] = @store[i]\n end\n @store[0] = val\n end", "def bitshift\n shift = pop\n int1 = pop\n\n push int1 << shift\n end", "def hshift(amount)\n @left += amount\n self\n end", "def release_register reg\n if reg.end_point\n raise Errors::AlreadyReleasedError, \"register #{reg.name} already released at #{reg.end_point}\"\n end\n\n reg.end_point = (@instructions.length - 1)\n end", "def modrm_r_on instruction, stream\n address, register = instruction.first, instruction.second\n swap = false # TODO: this can be 1 call at the bottom\n\n if instruction.first.register? && instruction.second.register? then\n if parameters.first.memory_register? then\n return instruction.first.push_mod_rm_on(instruction.second, stream)\n else\n return instruction.second.push_mod_rm_on(instruction.first, stream)\n end\n end\n\n if instruction.first.special_register? then\n return instruction.second.push_mod_rm_on(instruction.first, stream)\n end\n\n if instruction.second.special_register? then\n return instruction.first.push_mod_rm_on(instruction.second, stream)\n end\n\n address, register = if instruction.first.register? && instruction.second.respond_to?(:push_mod_rm_on) then\n [instruction.second, instruction.first]\n else\n [instruction.first, instruction.second]\n end\n\n address.push_mod_rm_on register, stream\n end", "def double_right_rotate( node=@tree )\n node.right = node.left.right\n node.left.right = nil\n node.value, node.right.value = node.right.value, node.value\n end", "def turn_right\n if @@compass.index(@direction) == @@compass.length - 1\n @direction = @@compass[0]\n else\n current_index = @@compass.index(@direction)\n @direction = @@compass[current_index + 1]\n end\n end", "def double_rotate_right(node)\n node.left = rotate_left(node.left)\n return rotate_right(node) \n end", "def right=(n)\n @view__.right = n\n end", "def opcode_8XY3(helper)\n\t\thelper.registry_X = helper.registry_X ^ helper.registry_Y\n\tend", "def rotate_right\n placed?\n @direction = case @direction\n when \"NORTH\" then \"EAST\"\n when \"EAST\" then \"SOUTH\"\n when \"SOUTH\" then \"WEST\"\n when \"WEST\" then \"NORTH\"\n end\n end", "def shift_out_right_with_index\n # This is functionally equivalent to shift_out_with_index\n each_with_index { |bit, i| yield bit, i }\n end", "def setShift(sx,sy) \n @device.setShift(sx,sy) \n end", "def rotate_right\n root = @left\n @left = root.right\n root.right = self\n root.right.update_height\n root\n end", "def right; end", "def right; end", "def turn_right\n @orientation == 3 ? @orientation = 0 : @orientation += 1\n end", "def right_rotate( node=@tree )\n node.right = node.left\n node.left = node.left.left\n node.right.left = nil\n node.value, node.right.value = node.right.value, node.value\n end", "def moveRight(distance)\n @x = @x + distance\n @image.x = @x\n end", "def right\n @ole.Right\n end", "def right\n @ole.Right\n end", "def right()\n return @left + @width\n end", "def left_borrows_from_mid\n @left.type, @left.value1, @value1, @left.mid = 2, @value1, @mid.value1, @mid.left\n @mid.shift_left\n @mid.type -= 1\n end", "def shift_right!(count=2)\n self.gsub!(/^./m,' '*count + '\\0')\n end", "def move_right(mat, y, x)\n return if (x + 1) > (mat.size - 1)\n\n zero_el = mat[y][x]\n other_el = mat[y][x + 1]\n mat[y][x + 1] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :right }\nend", "def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end", "def castle_right(a, b, x, y)\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\t@board[x - 1][y].piece = @board[x + 2][y].piece\n\t\t@board[x + 2][y].piece = nil\n\tend", "def shift(count=1)\n\t self.class[to_a.shift(count)]\n\tend", "def rotate\n push shift\n end", "def release_reg reg\n last = @regs.pop\n raise \"released register in wrong order, expect #{last} but was #{reg}\" if reg != last\n end", "def turnRight\n if @placed\n @face = @face.turnRight\n end\n end", "def rotate_right\n\t\t\troot = @left\n\t\t\troot = root.with_right(with_left(root.right))\n\t\t\troot.with_right(root.right.with_color(root.color)).with_color(root.right.color)\n\t\tend" ]
[ "0.71826947", "0.6885217", "0.66808", "0.6603987", "0.6572543", "0.65169823", "0.65169823", "0.63881755", "0.6375488", "0.6358082", "0.6358082", "0.6291538", "0.6236523", "0.6179961", "0.6179961", "0.6179961", "0.60492164", "0.59982747", "0.59806234", "0.5979064", "0.5964224", "0.59572977", "0.5948018", "0.5909492", "0.5862239", "0.5862239", "0.58611965", "0.58606863", "0.5844207", "0.58376604", "0.5783672", "0.5775848", "0.57395715", "0.5737677", "0.5729252", "0.57131666", "0.570753", "0.570497", "0.56892675", "0.56887305", "0.56825185", "0.56825185", "0.56825185", "0.56793875", "0.5671037", "0.56680334", "0.5655514", "0.5653347", "0.56462324", "0.5635653", "0.5609226", "0.5583409", "0.55746925", "0.55680704", "0.5563402", "0.55581164", "0.55485684", "0.55485684", "0.5544362", "0.55382365", "0.5524988", "0.5524068", "0.55153096", "0.55141574", "0.5512964", "0.54914623", "0.5483862", "0.5482262", "0.5475923", "0.54702246", "0.54687136", "0.5440273", "0.54397565", "0.5435636", "0.5432595", "0.54194283", "0.541911", "0.54152244", "0.54134655", "0.54015946", "0.5385751", "0.5348144", "0.5345747", "0.5345747", "0.5341833", "0.53309435", "0.5324339", "0.53226614", "0.53226614", "0.5316562", "0.53093135", "0.53013057", "0.5300097", "0.52978134", "0.52948844", "0.5292981", "0.52919316", "0.5287978", "0.5286047", "0.52849084" ]
0.8117424
0
Shifts a Register to the Left
def shiftLeft(register) register.shift register.push(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shiftRight(register)\n\tregister.unshift(0).pop\nend", "def shift_left\n self.push(self.shift)\n end", "def shift_left\n @left, @value1, @mid = @mid, @value2, @right\n end", "def rotate_left(value, shift)\n ((value << shift) | (value >> (20 - shift))) & 0xFFFFF\n end", "def move_left\n @memory_position -= 1\n @memory_position = 0xfffffe if @memory_position < 0\n end", "def shift() end", "def shift() end", "def shift_right\n self.unshift(self.pop)\n end", "def shift_right\n @mid, @value2, @right = @left, @value1, @mid\n end", "def shift_left(data = 0)\n prev_bit = nil\n reverse_shift_out do |bit|\n prev_bit.write(bit.data) if prev_bit\n prev_bit = bit\n end\n prev_bit.write(data)\n self\n end", "def shift; end", "def shift; end", "def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end", "def shift_out_left\n size.times do |i|\n yield(bit_at_position(size - i - 1), i)\n end\n end", "def hshift(amount)\n @left += amount\n self\n end", "def left_borrows_from_mid\n @left.type, @left.value1, @value1, @left.mid = 2, @value1, @mid.value1, @mid.left\n @mid.shift_left\n @mid.type -= 1\n end", "def shift\n end", "def shift\n end", "def shift\n end", "def left_rotate(x, amount)\n\tx &= 0xFFFFFFFF\n\treturn (( x << amount ) | (x >> (32 - amount ))) & 0xFFFFFFFF\nend", "def shift_out_left\n # This is functionally equivalent to reverse_shift_out\n reverse_each { |bit| yield bit }\n end", "def unshift(val)\n resize! if @length == @capacity\n @length += 1\n #slide everything to the right\n (@length-2).downto(0).each do |i|\n @store[i+1] = @store[i]\n end\n @store[0] = val\n end", "def push_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n @left = @mid\n @type = 1\n end", "def shift\n raise \"index out of bounds\" if (@length == 0)\n\n first = @store[0]\n (1...@length).each do |i|\n #slide everything to the left\n @store[i - 1] = @store[i]\n end\n @length -= 1\n first\n\n end", "def rotate_left\n dup.rotate_left!\n end", "def shift_left(list)\n # rotate moves the value\n print list.rotate\nend", "def shift\n raise \"index out of bounds\" if (length == 0)\n\n val = self.store[0]\n self.store = self.store[1..-1]\n self.length -=1\n val\n end", "def shift!(dr)\r\n @pos.x += dr[0]\r\n @pos.y += dr[1]\r\n end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def shift_left(list) # make the last element the first elem\n return list.unshift(list.pop)\nend", "def shift(ndigits)\n #This is a stub, used for indexing\n end", "def rotateLeft(a, l, r)\n arr = a.dup\n temp = arr[l]\n (l...r).each do |i|\n arr[i] = arr[i + 1]\n end\n arr[r] = temp\n arr\n end", "def shift_left(list)\n overflow = 0\n overflow = list[0]\n point = 0\n list.size.times do\n list[point] = list[point + 1]\n point += 1\n end\n list[list.size - 1] = overflow\n return list\nend", "def shift\n raise \"index out of bounds\" if @length == 0\n shift_val = @store[0]\n @length -= 1\n @store[0] = nil\n i = 1\n until i == @length + 1\n @store[i-1] = @store[i]\n i += 1\n end\n shift_val\n end", "def shift_right(count=2)\n c = dup\n c.shift_right!(count)\n c\n end", "def shift(n=1)\n shift_l = [n, @left.size].min\n shift_r = n - @left.size\n\n ret = @left.shift(shift_l) || \"\"\n ret.concat @right.shift(shift_r) if shift_r >= 0\n update_size\n update_depth\n ret\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def move_to_left_of(node)\n move_to node, :left\n end", "def shift_left(list)\n a = list\n a.push(list[0])\n a.shift\n a\nend", "def shift_in\n end", "def bitshift\n shift = pop\n int1 = pop\n\n push int1 << shift\n end", "def shift_left(list)\n list_new = list\n i = 0\n first = list[0]\n\n list.size.times do \n list_new[i] = list[i +1]\n i += 1\n end \n list_new[list.size - 1] = first\n\n return list_new\n \nend", "def shift!(dr)\r\n (0..1).each { |i| @center[i] += dr[i] }\r\n end", "def fold_left_into_mid\n @mid.shift_right\n @mid.type, @mid.value1, @mid.left = 3, @value1, @left.left\n shift_left\n @type = 2\n end", "def shift_left2(list)\n list_new = list\n i = 0\n first = list[0]\n\n list.size.times do |i|\n list_new[i] = list[i + 1]\n i += 1\n end\n list_new[list.size - 1] = first\n\n return list_new\n\nend", "def move_to_left_of(node)\n self.move_to(node, :left)\n end", "def left(value)\n @ole.Left = value\n nil\n end", "def left(value)\n @ole.Left = value\n nil\n end", "def shift\n if letter = left.shift || right.shift\n @length -= 1\n letter\n else\n nil\n end\n end", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def shift\n\n #clib.tclistshift2(@pointer) rescue nil\n outlen_op(:tclistshift)\n end", "def move_left\n tenacious_transaction do\n move_to_left_of left_sibling.try(:lock!)\n end\n end", "def move_left\n\t\tmove([-1,0])\n\tend", "def move_to_left_of(node)\n self.move_to node, :left\n end", "def unshift(val)\n resize! if @length == @store.length\n i = @length\n until i == 0\n self[i] = self[i-1]\n i -= 1\n end\n self[0] = val\n val\n end", "def unshift(value)\n end", "def shift\n node = first\n first = node.nxt\n first.prv = nil\n node.nxt = nil\n node\n end", "def shift_left(list)\n i = 0\n shifted = []\n save = []\n save[0] = list[0]\n list.each do |num|\n if i == 0\n\n else\n shifted[i - 1] = num\n end\n i += 1\n end\n shifted[list.size - 1] = save[0]\n return shifted\nend", "def shift(count=1)\n\t self.class[to_a.shift(count)]\n\tend", "def rotateLeft()\n twoTypeRotate()\n end", "def move_left\n left_tile = C[@location.first, @location.second - 1]\n move_to(left_tile)\n end", "def rotate_left(node)\n new_node = node.right\n node.right = new_node.left\n new_node.left = node\n return new_node\n end", "def shift\n raise \"index out of bounds\" unless (length > 0)\n\n first_val = self[0]\n (1...length).each{|i| self[i - 1] = self[i] }\n self.length -= 1\n\n first_val\n end", "def shiftl(word)\n word[1..-1] << word[0]\nend", "def right\n rotate(1)\n end", "def move_left\n move_to_left_of left_sibling\n end", "def rotLeft(a, d)\r\n size = a.size\r\n d.times do\r\n first = a.shift\r\n a.insert(size-1, first)\r\n end\r\n a\r\nend", "def rotateLeft()\n fourTypeRotate(Tetromino::CLOCKWISE)\n end", "def unshift(val)\n resize! if @length == @capacity\n\n @length += 1\n (@length - 2).downto(0).each { |i| self[i+1] = self[i] }\n self[0] = val\n\n nil\n end", "def rebalance_for_left_insert\n\t\t\t# move 1 black from the left to the right by single/double rotation\n\t\t\tif @left.right.red?\n\t\t\t\twith_left(@left.rotate_left)\n\t\t\telse\n\t\t\t\tself\n\t\t\tend.rotate_right\n\t\tend", "def shift_right(data = 0)\n prev_bit = nil\n shift_out do |bit|\n prev_bit.write(bit.data) if prev_bit\n prev_bit = bit\n end\n prev_bit.write(data)\n self\n end", "def turn_left\n @orientation == -4 ? @orientation = -1 : @orientation -= 1\n end", "def rotate_left\n placed?\n @direction = case @direction\n when \"NORTH\" then \"WEST\"\n when \"EAST\" then \"NORTH\"\n when \"SOUTH\" then \"EAST\"\n when \"WEST\" then \"SOUTH\"\n end\n end", "def wrap_left\n wrap_operand(operand.left)\n end", "def unshift(val)\n resize! if length == capacity\n\n self.length += 1\n (length - 2).downto(0).each{|i| self[i+1] = self[i]}\n self[0] = val\n\n nil\n end", "def shift_left(line)\n new_line = []\n line.each { |line| new_line << line unless line.zero? }\n new_line << 0 until new_line.size == 4\n new_line\n end", "def rotate\n push shift\n end", "def right=(r); self[0] = r - self[2]; return r; end", "def castle_left(a, b, x, y)\n\t\t@board[x][y].piece = @board[a][b].piece\n\t\t@board[a][b].piece = nil\n\t\t@board[x + 1][y].piece = @board[x - 1][y].piece\n\t\t@board[x - 1][y].piece = nil\n\tend", "def move_left\n self.move_to_left_of(self.left_sibling)\n end", "def shift_range_left(i, el)\n while i <= @capacity\n @cache[i] = @cache[i + 1]\n i += 1\n end\n @cache[@capacity] = el\n end", "def shift\n @data.shift\n end", "def left\r\n @angle -= ROTATION_ANGLE\r\n end", "def turn_left\n turn(:left)\n end", "def shift_out_right\n size.times do |i|\n yield(bit_at_position(i), i)\n end\n end", "def my_rotate(shift = 1)\n shift = shift % count\n drop(shift) + take(shift)\nend", "def unshift(val)\n if @count >= @cap\n resize!()\n end\n @store.store.unshift(val)\n @count += 1\n end", "def left_rotate( node=@tree )\n node.left = node.right\n node.right = node.right.right\n node.left.right = nil\n node.value, node.left.value = node.left.value, node.value\n end", "def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end", "def left\n self.y = ((y-1)+10)%10\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def shift_out\n end", "def left\n direction.move_left!\n end", "def shift_out_left_with_index\n # This is functionally equivalent to reverse_shift_out_with_index\n reverse_each.with_index { |bit, i| yield bit, i }\n end", "def rotLeft(a, d)\n d.times do\n ele = a.shift\n a << ele\n end\n return a\nend", "def rotate_right\n dup.rotate_right!\n end", "def turn_left\n @direction = DIRECTIONS[DIRECTIONS.index(@direction) - 1]\n end", "def double_left_rotate( node=@tree )\n node.left = node.right.left\n node.right.left = nil\n node.value, node.left.value = node.left.value, node.value\n end", "def from_left(cur)\n\t\tmove(cur, 0, -1)\n\tend" ]
[ "0.77925456", "0.73051286", "0.72569007", "0.7148327", "0.69198847", "0.6785762", "0.6785762", "0.6723873", "0.66384447", "0.6615102", "0.66004956", "0.66004956", "0.6593669", "0.6586902", "0.6556738", "0.64791524", "0.6435789", "0.6435789", "0.6435789", "0.62645733", "0.6241383", "0.6183557", "0.6177524", "0.6173054", "0.6161852", "0.6159109", "0.6110625", "0.6079771", "0.60728157", "0.60029745", "0.5985257", "0.59845966", "0.596814", "0.5966469", "0.5955432", "0.595052", "0.5906311", "0.5906311", "0.5906311", "0.5892812", "0.5869036", "0.5865632", "0.58528626", "0.5845157", "0.58429134", "0.5838857", "0.5832191", "0.58292663", "0.58292663", "0.58174795", "0.5804507", "0.5800978", "0.57926387", "0.579243", "0.57822794", "0.57776856", "0.5771482", "0.57672554", "0.57533014", "0.575321", "0.5750775", "0.57471675", "0.5744435", "0.5743729", "0.57391334", "0.57357687", "0.5732184", "0.57292414", "0.5721669", "0.5721537", "0.5720443", "0.5719316", "0.5719144", "0.5716212", "0.5709527", "0.5704197", "0.57013464", "0.56849515", "0.5681698", "0.5680865", "0.5671654", "0.5670448", "0.56551546", "0.56143963", "0.560052", "0.559945", "0.5598436", "0.5594175", "0.5593442", "0.5586438", "0.5583948", "0.55756354", "0.55745804", "0.5573753", "0.556905", "0.556423", "0.55629504", "0.55545574", "0.5550257", "0.55484897" ]
0.84941745
0
Main Runs each of the test cases.
def main puts "begin press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1],[0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,0,0,0,1,1,0,0,1,1,0,0],[0,0,0,0,0,0,1,0,0,1,0,0,1,0,0,1]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0],[0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1]) puts "next case, press enter..." wait = gets MULTIPLIER16BIT([0,0,0,0,0,1,0,1,0,0,0,0,1,0,0,1],[1,0,0,0,0,1,1,0,0,1,1,0,0,1,1,0]) puts "press enter to exit the program..." wait = gets end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_banner\n @test_plan.each do |plan|\n found_nodes = nodes(plan)\n if found_nodes\n found_nodes.each { |node| execute_plan_tests(node, plan) }\n end\n end\n exit @ret_code\n end", "def run\n test_files.each do |file|\n eval File.read(file)\n end\n\n results = []\n @tests.each_pair do |name, test|\n results << test.call(@config)\n end\n results.reject!(&:nil?)\n results.reject!(&:empty?)\n results.flatten!\n results\n end", "def run_tests\n `make > dev/null`\n @test_harness.run_test(\"./triangle 0 0 0 0 0 0\", :nat_simple)\n @test_harness.run_test(\"./triangle 1 1 2 2 3 3\", :nat_hard)\n @test_harness.run_test(\"./triangle 1 1 3 2 1 3\", :iso_acute)\n @test_harness.run_test(\"./triangle 1 1 3 2 5 1\", :iso_obtuse)\n @test_harness.run_test(\"./triangle 1 1 0 2 0 1\", :iso_right)\n @test_harness.run_test(\"./triangle 1 1 5 1 5 4\", :sca_right)\n @test_harness.run_test(\"./triangle 1 1 4 2 6 1\", :sca_obtuse)\n @test_harness.run_test(\"./triangle 1 1 2 2 4 1\", :sca_obtuse)\n @test_harness.run_test(\"./triangle 0 0 1 3 4 0\", :sca_acute)\n `make clean`\n end", "def run(*args)\n files = args.select { |arg| arg !~ /^-/ }\n\n files = parse_files(files)\n examples = parse_examples(files)\n\n add_pwd_to_path\n\n generate_tests(examples)\n run_tests\n end", "def run_all\n UI.info \"Running all tests...\"\n _really_run(Util.xcodebuild_command(options))\n end", "def run_tests\n puts \"Running exactly #{@spec.size} tests.\"\n @spec.each do |test_case|\n sleep test_case.wait_before_request\n response = send_request_for(test_case)\n Checker.available_plugins.each do |plugin|\n result = @expectation.check(plugin, response, test_case)\n if not result.success?\n putc \"F\"\n @results << result\n break\n else\n if plugin == Checker.available_plugins.last\n @results << result\n putc \".\"\n end\n end\n end\n end\n end", "def run_all\n run_suite(@suite)\n end", "def run(test_cases, options = {})\n fire_event :start\n\n if options[:line_numbers]\n test_groups = nearest_test_groups(test_cases, options[:line_numbers])\n else\n test_groups = test_cases.zip(test_cases.map(&:tests))\n end\n\n test_groups.each do |test_case, tests|\n fire_event :enter, test_case\n tests.each { |test| report(test) }\n fire_event :exit, test_case\n end\n rescue Interrupt\n $stderr.puts \"Interrupted!\"\n ensure\n fire_event :end\n end", "def run\n exe_file, result = compile\n\n if result.failed?\n puts result.error\n return\n end\n\n if cases.empty?\n puts 'No test case found!'\n return\n end\n\n cmd = TTY::Command.new(printer: :progress)\n exe_output = File.join(@temp_dir, 'output')\n\n cases.each do |input, output|\n cmd.run!(exe_file, in: input, out: exe_output)\n identical = FileUtils.compare_file(output, exe_output)\n identical ? puts('Passed') : puts('Failed')\n end\n end", "def run\n test_using_random_sample\n test_using_first_of\n end", "def run(*test_cases)\n @report.on_start if @report.respond_to?(:on_start)\n test_cases.each do |test_case|\n @report.on_enter(test_case) if @report.respond_to?(:on_enter)\n test_case.run(self)\n @report.on_exit(test_case) if @report.respond_to?(:on_exit)\n end\n @report.on_end if @report.respond_to?(:on_end)\n end", "def go_run_tests\n @status = :running\n Thread.new do\n begin\n test_cases = @test_suite.sources\n\n @mutex.synchronize do\n @test_cases = test_cases\n @test_results = {}\n end\n\n @test_suite.run_tests do |result|\n @mutex.synchronize do\n @test_results[result[:source]] = result[:result]\n end\n end\n\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n\n end\n end", "def run(files)\n file = files.first\n puts \"** Running #{file}\"\n \n class_filename = file.sub(self.class::CLASS_MAP, '')\n \n # get the class\n test_class = resolve_classname(class_filename)\n \n # create dummy wrapper modules if test is in subfolder\n test_class.split('::').each do |part|\n eval \"module ::#{part}; end\" if !part.match('Test')\n end\n \n begin \n clear_class(test_class.constantize) \n rescue NameError \n \n end\n \n # TODO: make this reload use load_file\n $\".delete(file)\n \n begin\n require file\n rescue LoadError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue ArgumentError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n rescue SyntaxError\n notifier.error(\"Error in #{file}\", $!)\n puts $!\n return\n end\n \n # TODO: change that to run multiple suites\n #klass = Kernel.const_get(test_class) - this threw errors\n klass = eval(test_class)\n \n Test::Unit::UI::Console::TestRunner.run(klass)\n Test::Unit.run = false\n \n # Invoke method to test that writes to stdout.\n result = test_io.string.to_s.dup\n\n # clear the buffer \n test_io.truncate(0)\n \n # sent result to notifier\n notifier.result(file, result.split(\"\\n\").compact.last)\n\n # sent result to stdio\n puts result\n \n end", "def run_tests\n\n ::RSpec::Core::Runner.run([])\n\n print ::IRB.CurrentContext.io.prompt\n\n end", "def run_all\n deploy_code\n run_test\n end", "def run test_identifier=nil\n @dispatcher.run!\n # start\n message(\"start\")\n suite_setup,suite_teardown,setup,teardown,tests=*parse(test_identifier)\n if tests.empty? \n @dispatcher.exit\n raise RutemaError,\"No tests to run!\"\n else\n # running - at this point all checks are done and the tests are active\n message(\"running\")\n run_scenarios(tests,suite_setup,suite_teardown,setup,teardown)\n end\n message(\"end\")\n @dispatcher.exit\n @dispatcher.report(tests)\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def run_all\n passed = Runner.run(['spec'], cli)\n if passed\n Formatter.notify \"How cool, all works!\", :image => :success\n else\n Formatter.notify \"Failing... not there yet.\", :image => :failed\n end\n end", "def run\n errors = []\n\n begin\n Cucumber::Cli::Main.new(@args).execute!\n rescue SystemExit => e\n # Cucumber calls @kernel.exit() whenever a test fails, or when the test\n # suite has finished running. We prefer to run the full test suite every\n # time, and then fail at the end. However if the SystemExit is a\n # successful one, we don't want to log it as an error.\n errors << e unless e.success?\n end\n\n errors\n end", "def run_all_tests\n print `clear`\n puts \"Tests run #{Time.now.strftime('%Y-%m-%d %H:%M:%S')}\"\n puts `node runtests.js`\nend", "def exec_test\n $stderr.puts 'Running tests...' if verbose?\n\n runner = config.testrunner\n\n case runner\n when 'auto'\n unless File.directory?('test')\n $stderr.puts 'no test in this package' if verbose?\n return\n end\n begin\n require 'test/unit'\n rescue LoadError\n setup_rb_error 'test/unit cannot loaded. You need Ruby 1.8 or later to invoke this task.'\n end\n autorunner = Test::Unit::AutoRunner.new(true)\n autorunner.to_run << 'test'\n autorunner.run\n else # use testrb\n opt = []\n opt << \" -v\" if verbose?\n opt << \" --runner #{runner}\"\n if File.file?('test/suite.rb')\n notests = false\n opt << \"test/suite.rb\"\n else\n notests = Dir[\"test/**/*.rb\"].empty?\n lib = [\"lib\"] + config.extensions.collect{ |d| File.dirname(d) }\n opt << \"-I\" + lib.join(':')\n opt << Dir[\"test/**/{test,tc}*.rb\"]\n end\n opt = opt.flatten.join(' ').strip\n # run tests\n if notests\n $stderr.puts 'no test in this package' if verbose?\n else\n cmd = \"testrb #{opt}\"\n $stderr.puts cmd if verbose?\n system cmd #config.ruby \"-S tesrb\", opt\n end\n end\n end", "def start_tests(files)\n end", "def test_cases; end", "def run_tests t, libr = :cascade, test_files=\"test_*.rb\"\n require 'test/unit/testsuite'\n require 'test/unit/ui/console/testrunner'\n require 'tests/testem'\n \n base_dir = File.expand_path(File.dirname(__FILE__) + '/../') + '/'\n \n runner = Test::Unit::UI::Console::TestRunner\n \n $eventmachine_library = libr\n EmTestRunner.run(test_files)\n \n suite = Test::Unit::TestSuite.new($name)\n\n ObjectSpace.each_object(Class) do |testcase|\n suite << testcase.suite if testcase < Test::Unit::TestCase\n end\n\n runner.run(suite)\nend", "def run!\n options = @args.options\n input_files = Dir.glob(options[:input_files_pattern])\n loader = Trapeze::Loader.new(*input_files)\n unless options[:quiet]\n loader.exceptions.each do |filename, exception|\n $stderr.puts \"#{exception.message} in #{filename}\"\n end\n end\n probe = Trapeze::Probe.new(loader)\n generator = Trapeze::SuiteGenerators::TestUnit.new(:input_files_pattern => options[:input_files_pattern],\n :output_dir => options[:output_dir],\n :probe => probe)\n generator.generate!\n end", "def process(files) #called at end of script\n if files.class==Array \n files.each {|f| \n puts \"\\n\\n--------------------\\n#{f}:\\n\\n\"\n result=system(\"#{$PROGRAM_NAME} #{f} #{ARGV}\")\n puts \"\\n\\nERRORS IN TEST #{f}!!!\\n\\n\" unless result\n }\n else\n test_name=File.basename(files).sub(/\\..*?$/,'')\n test_case=Class.new(Test::Unit::TestCase)\n Object.const_set(:\"Test#{test_name.capitalize}\", test_case)\n mk_test_context(files, test_case)\n end\nend", "def run( options = {} )\n top_app = construct_app_stack\n\n env = Testify.env_defaults.merge options\n @test_results = top_app.call(env)\n\n @status = @test_results.collect(&:status).max # XXX: Optimize?\n\n @test_results\n end", "def run_suite(tests)\n @app.run_suite(tests)\n end", "def run(selected_tests)\n unknown_tests_suites = selected_tests.keys - @available_tests_suites\n log \"[ In-game testing #{@game.name} ] - !!! The following in-game tests suites are not supported: #{unknown_tests_suites.join(', ')}\" unless unknown_tests_suites.empty?\n tests_to_run = selected_tests.reject { |tests_suite, _tests| unknown_tests_suites.include?(tests_suite) }\n return if tests_to_run.empty?\n\n FileUtils.mkdir_p \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData\"\n tests_to_run.each do |tests_suite, tests|\n # Write the JSON file that contains the list of tests to run\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Run.json\",\n JSON.pretty_generate(\n 'stringList' => {\n 'tests_to_run' => tests\n }\n )\n )\n # Clear the AutoTest test statuses that we are going to run\n statuses_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{tests_suite}_Statuses.json\"\n next unless File.exist?(statuses_file)\n\n File.write(\n statuses_file,\n JSON.pretty_generate('string' => JSON.parse(File.read(statuses_file))['string'].delete_if { |test_name, _test_status| tests.include?(test_name) })\n )\n end\n auto_test_config_file = \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_Config.json\"\n # Write the JSON file that contains the configuration of the AutoTest tests runner\n File.write(\n auto_test_config_file,\n JSON.pretty_generate(\n 'string' => {\n 'on_start' => 'run',\n 'on_stop' => 'exit'\n }\n )\n )\n out ''\n out '=========================================='\n out '= In-game tests are about to be launched ='\n out '=========================================='\n out ''\n out 'Here is what you need to do once the game will be launched (don\\'t launch it by yourself, the test framework will launch it for you):'\n out '* Load the game save you want to test (or start a new game).'\n out ''\n out 'This will execute all in-game tests automatically.'\n out ''\n out 'It is possible that the game crashes during tests:'\n out '* That\\'s a normal situation, as tests don\\'t mimick a realistic gaming experience, and the Bethesda engine is not meant to be stressed like that.'\n out '* In case of game crash (CTD), the Modsvaskr test framework will relaunch it automatically and resume testing from when it crashed.'\n out '* In case of repeated CTD on the same test, the Modsvaskr test framework will detect it and skip the crashing test automatically.'\n out '* In case of a game freeze without CTD, the Modsvaskr test framework will detect it after a few minutes and automatically kill the game before re-launching it to resume testing.'\n out ''\n out 'If you want to interrupt in-game testing: invoke the console with ~ key and type stop_tests followed by Enter.'\n out ''\n out 'Press enter to start in-game testing (this will lauch your game automatically)...'\n wait_for_user_enter\n last_time_tests_changed = nil\n with_auto_test_monitoring(\n on_auto_test_statuses_diffs: proc do |in_game_tests_suite, in_game_tests_statuses|\n yield in_game_tests_suite, in_game_tests_statuses\n last_time_tests_changed = Time.now\n end\n ) do\n # Loop on (re-)launching the game when we still have tests to perform\n idx_launch = 0\n loop do\n # Check which test is supposed to run first, as it will help in knowing if it fails or not.\n first_tests_suite_to_run = nil\n first_test_to_run = nil\n current_tests_statuses = check_auto_test_statuses\n @available_tests_suites.each do |tests_suite|\n next unless tests_to_run.key?(tests_suite)\n\n found_test_ok =\n if current_tests_statuses.key?(tests_suite)\n # Find the first test that would be run (meaning the first one having no status, or status 'started')\n tests_to_run[tests_suite].find do |test_name|\n found_test_name, found_test_status = current_tests_statuses[tests_suite].find { |(current_test_name, _current_test_status)| current_test_name == test_name }\n found_test_name.nil? || found_test_status == 'started'\n end\n else\n # For sure the first test of this suite will be the first one to run\n tests_to_run[tests_suite].first\n end\n next unless found_test_ok\n\n first_tests_suite_to_run = tests_suite\n first_test_to_run = found_test_ok\n break\n end\n if first_tests_suite_to_run.nil?\n log \"[ In-game testing #{@game.name} ] - No more test to be run.\"\n break\n else\n log \"[ In-game testing #{@game.name} ] - First test to run should be #{first_tests_suite_to_run} / #{first_test_to_run}.\"\n # Launch the game to execute AutoTest\n @game.launch(autoload: idx_launch.zero? ? false : 'auto_test')\n idx_launch += 1\n log \"[ In-game testing #{@game.name} ] - Start monitoring in-game testing...\"\n last_time_tests_changed = Time.now\n while @game.running?\n check_auto_test_statuses\n # If the tests haven't changed for too long, consider the game has frozen, but not crashed. So kill it.\n if Time.now - last_time_tests_changed > @game.timeout_frozen_tests_secs\n log \"[ In-game testing #{@game.name} ] - Last time in-game tests statuses have changed is #{last_time_tests_changed.strftime('%F %T')}. Consider the game is frozen, so kill it.\"\n @game.kill\n else\n sleep @game.tests_poll_secs\n end\n end\n last_test_statuses = check_auto_test_statuses\n # Log latest statuses\n log \"[ In-game testing #{@game.name} ] - End monitoring in-game testing. In-game test statuses after game run:\"\n last_test_statuses.each do |tests_suite, statuses_for_type|\n log \"[ In-game testing #{@game.name} ] - [ #{tests_suite} ] - #{statuses_for_type.select { |(_name, status)| status == 'ok' }.size} / #{statuses_for_type.size}\"\n end\n # Check for which reason the game has stopped, and eventually end the testing session.\n # Careful as this JSON file can be written by Papyrus that treat strings as case insensitive.\n # cf. https://github.com/xanderdunn/skaar/wiki/Common-Tasks\n auto_test_config = JSON.parse(File.read(auto_test_config_file))['string'].map { |key, value| [key.downcase, value.downcase] }.to_h\n if auto_test_config['stopped_by'] == 'user'\n log \"[ In-game testing #{@game.name} ] - Tests have been stopped by user.\"\n break\n end\n if auto_test_config['tests_execution'] == 'end'\n log \"[ In-game testing #{@game.name} ] - Tests have finished running.\"\n break\n end\n # From here we know that the game has either crashed or has been killed.\n # This is an abnormal termination of the game.\n # We have to know if this is due to a specific test that fails deterministically, or if it is the engine being unstable.\n # Check the status of the first test that should have been run to know about it.\n first_test_status = nil\n _found_test_name, first_test_status = last_test_statuses[first_tests_suite_to_run].find { |(current_test_name, _current_test_status)| current_test_name == first_test_to_run } if last_test_statuses.key?(first_tests_suite_to_run)\n if first_test_status == 'ok'\n # It's not necessarily deterministic.\n # We just have to go on executing next tests.\n log \"[ In-game testing #{@game.name} ] - Tests session has finished in error, certainly due to the game's normal instability. Will resume testing.\"\n else\n # The first test doesn't pass.\n # We need to mark it as failed, then remove it from the runs.\n log \"[ In-game testing #{@game.name} ] - First test #{first_tests_suite_to_run} / #{first_test_to_run} is in error status: #{first_test_status}. Consider it failed and skip it for next run.\"\n # If the test was started but failed before setting its status to something else then change the test status in the JSON file directly so that AutoTest does not try to re-run it.\n if first_test_status == 'started' || first_test_status == '' || first_test_status.nil?\n File.write(\n \"#{@game.path}/Data/SKSE/Plugins/StorageUtilData/AutoTest_#{first_tests_suite_to_run}_Statuses.json\",\n JSON.pretty_generate(\n 'string' => ((last_test_statuses[first_tests_suite_to_run] || []) + [[first_test_to_run, '']]).map do |(test_name, test_status)|\n [\n test_name,\n test_name == first_test_to_run ? 'failed_ctd' : test_status\n ]\n end.to_h\n )\n )\n # Notify the callbacks updating test statuses\n check_auto_test_statuses\n end\n end\n # We will start again. Leave some time to interrupt if we want.\n if @config.no_prompt\n out 'Start again automatically as no_prompt has been set.'\n else\n # First, flush stdin of any pending character\n $stdin.getc until select([$stdin], nil, nil, 2).nil?\n out \"We are going to start again in #{@game.timeout_interrupt_tests_secs} seconds. Press Enter now to interrupt it.\"\n key_pressed =\n begin\n Timeout.timeout(@game.timeout_interrupt_tests_secs) { $stdin.gets }\n rescue Timeout::Error\n nil\n end\n if key_pressed\n log \"[ In-game testing #{@game.name} ] - Run interrupted by user.\"\n # TODO: Remove AutoTest start on load: it has been interrupted by the user, so we should not keep it in case the user launches the game by itself.\n break\n end\n end\n end\n end\n end\n end", "def run\n\t\t @stats.tests += 1\n\t\t\tputs \"Testi: #{@name}\"\n\t\t\tctx = Context.new\n\t\t\tbegin\n\t\t\t\tctx.instance_eval(&@block)\n\t\t\trescue TestAbort # we don't really care if it aborts.\n\t\t\trescue Exception => ex\n\t\t\t\tctx.fail\n\t\t\t\t@stats.failed += 1\n\t\t\t\tputs ex.inspect\n\t\t\t\tputs ex.backtrace.join(\"\\n\")\n\t\t\tend\n\t\t\tif ctx.failed?\n\t\t\t\tputs \" # FAIL!!! ############\"\n\t\t\t\t@stats.failed += 1\n\t\t\telsif ctx.skipped?\n\t\t\t\tputs \" = skipped ============\"\n\t\t\t\t@stats.skipped += 1\n\t\t\telse\n\t\t\t\tputs \" - ok.\"\n\t\t\t\t@stats.passed += 1\n\t\t\tend\n\t\t\tputs\n\t\tend", "def run_tests()\n @loaded_modules.each do |module_name|\n module_class = Object.const_get(module_name.to_s).const_get(module_name.to_s).new\n if module_class.respond_to?( 'run' )\n module_class.run()\n else\n puts \"\\e[31mWARNING\\e[0m: Module #{(module_name)} not implemented\"\n end\n end\n end", "def define_test_tasks\n default_tasks = []\n\n if File.directory? \"test\" then\n desc 'Run the test suite. Use FILTER or TESTOPTS to add flags/args.'\n task :test do\n ruby make_test_cmd\n end\n\n desc 'Run the test suite using multiruby.'\n task :multi do\n ruby make_test_cmd(:multi)\n end\n\n desc 'Show which test files fail when run alone.'\n task :test_deps do\n tests = Dir[\"test/**/test_*.rb\"] + Dir[\"test/**/*_test.rb\"]\n\n paths = ['bin', 'lib', 'test'].join(File::PATH_SEPARATOR)\n null_dev = Hoe::WINDOZE ? '> NUL 2>&1' : '&> /dev/null'\n\n tests.each do |test|\n if not system \"ruby -I#{paths} #{test} #{null_dev}\" then\n puts \"Dependency Issues: #{test}\"\n end\n end\n end\n\n default_tasks << :test\n end\n\n if File.directory? \"spec\" then\n begin\n require 'spec/rake/spectask'\n\n desc \"Run all specifications\"\n Spec::Rake::SpecTask.new(:spec) do |t|\n t.libs = self.rspec_dirs\n t.spec_opts = self.rspec_options\n end\n rescue LoadError\n # do nothing\n end\n default_tasks << :spec\n end\n\n desc 'Run the default task(s).'\n task :default => default_tasks\n\n desc 'Run ZenTest against the package.'\n task :audit do\n libs = %w(lib test ext).join(File::PATH_SEPARATOR)\n sh \"zentest -I=#{libs} #{spec.files.grep(/^(lib|test)/).join(' ')}\"\n end\n end", "def run_main\n end", "def run\n runner = self\n @test_cases.each do |path|\n next if ENV['TEST_CASE'] && !File.basename(path).match(ENV['TEST_CASE'])\n\n Aws::ModelValidators.load_json(path).tap do |test_case|\n\n models = test_case.inject({}) { |h,(k,v)| h[k.to_sym] = v; h }\n errors = models.delete(:errors)\n\n @group.it(File.basename(path[0..-6])) do\n pending unless errors\n results = described_class.new.validate(models, apply_schema: false)\n unless runner.results_match?(results, errors)\n expect(results).to eq(errors)\n end\n end\n\n end\n end\n end", "def run_tests(argv, input, output)\n raise NotImplemented\n end", "def perform\n\tcheck_if_user_gave_input\n\tcreate_folder(get_folder_name)\n\t\n\tDir.chdir(\"#{get_folder_name}\")\n\t\n\tgemfile_creation\n\tgit_init\n\tdotenv_gitignore\n\tlib\n\trspec\n\treadme\n\n\tprint 'enter the title of your main ruby file : '\n\tmain_dot_rb = STDIN.gets.chomp\n\tputs ''\n\n\tDir.chdir('lib') do\n\t\tcreate_main_dot_rb(main_dot_rb)\n\t\tcreate_template_dot_rb\n\tend\n\n\tDir.chdir('spec') do\n\t\tcreate_main_spec_dot_rb(main_dot_rb)\n\t\tcreate_template_spec_dot_rb\n\t\tsystem(\"subl #{main_dot_rb}_spec.rb\")\t\n\tend\nend", "def run(reporter=nil)\n run_tests(tests, true, reporter)\n end", "def run_suite(config)\n # Build the sandbox.\n FileUtils.rm_rf config[:output_dir] if File.exist? config[:output_dir]\n FileUtils.mkdir_p config[:output_dir]\n File.chmod 0777, config[:output_dir]\n temp_dir = File.join config[:output_dir], '__temp_' +\n \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}_#{$PID}_#{rand(1 << 20)}\"\n FileUtils.mkdir_p temp_dir\n File.chmod 0777, config[:output_dir]\n \n # Figure out PIN's configuration.\n pin_config = { :temp_dir => temp_dir, :tool_binary => config[:tool_binary],\n :tool_args => config[:tool_args] || [] }\n if /^vlsifarm/ =~ Socket.gethostname # On vlsifarm.\n pin_config[:binary] = '/mit/6.823/Fall09/bin/pin'\n else # On linerva.\n pin_config[:tool_binary] += '.so'\n pin_config[:binary] = '/mit/6.823/Fall09/Pin2009/pin'\n end\n \n \n # Run the tests.\n test_number = 0\n config[:suite].keys.sort.each do |test_name|\n test_data = config[:suite][test_name]\n \n next if config[:skip_tests].include? test_name\n test_number += 1\n puts \"Test #{test_name} -- #{test_number} of #{config[:suite].length}\"\n \n out_file = File.basename(test_data['binary']) + '.out'\n pin_output = File.join config[:output_dir], out_file\n run_test test_data, pin_config, pin_output\n end\n \n # Tear down the sandbox.\n FileUtils.rm_rf temp_dir \nend", "def main ()\n runlist = YAML.load_file(ARGV[0])\n all = runlist.values.flatten.uniq.sort \n stop_agent(all)\n run_puppet(all)\n #backup_classification(all)\n runlist.each do |role, nodes| #arity?\n classify(nodes, role)\n run_puppet(nodes)\n end\n #restore_classification(all)\n run_puppet(all, true)\n start_agent(all)\nend", "def run_tests_under(config, options, root)\n summary = {}\n test_list(File.join($work_dir,root)).each do |path|\n name = path.sub(\"#{$work_dir}/\", '')\n puts \"\", \"\", \"#{name} executing...\"\n result = TestWrapper.new(config,options,path).run_test\n puts \"#{name} returned: #{result.fail_flag}\"\n summary[name] = result.fail_flag\n end\n return summary\nend", "def run\n\n @startDate = Time.now.to_i * 1000\n @status = 'Started'\n start_test_run(create_test_objects(@tests, @runOptions, @id), @cmd)\n @status = 'Completed'\n @endDate = Time.now.to_i * 1000\n set_status\n @event_emitter.emit_event(test_run_completed: self)\n check_status_and_exit\n #add login for sending an exit code based on whether or not there were any failures.\n end", "def run_app_tests\n end", "def main_run\n\n reset = true #flag to now if you want to exit or not\n\n while reset\n\n puts 'Welcome to CS Air.'\n\n @num_to_command.each {|num,cmd| puts \"Type #{num} for #{cmd}\"}\n command = gets.chomp.to_i\n\n while not @num_to_command.has_key?(command)\n puts 'Please try again'\n command = gets.chomp.to_i\n end\n\n case\n when command == 1\n reset = false #user wants to exit\n next\n when command == 2\n @ui_lib.print_city_list #print out list of all the cities\n next\n when command == 3\n city_specific_run #city specific details\n next\n when command == 4\n statistic_run #CS Air statistic details\n next\n when command == 5\n system('open', @ui_lib.query.get_map_url)\n next\n end\n end\n end", "def run_test(tests, ints_to_test, current_test_name)\n require \"./primality_tests/\" + current_test_name + \".rb\"\n tests[current_test_name.to_sym][:result] = []\n ints_to_test.each {|int|\n tests[current_test_name.to_sym][:result] << send(current_test_name, int)\n }\nend", "def tests; end", "def tests; end", "def run_all_tests(match_patterns = nil)\n run_tests(config.file_sets[\"all\"], match_patterns)\n end", "def run_tests()\n Signal.trap(\"CLD\") {@process_counter += 1}\n for setting in @settings\n Process.wait if @process_counter <= 0\n @process_counter -= 1\n fork do\n temp_name, log = copy_and_edit(setting)\n puts \"Running: \" + setting[:material] + \" \" + setting[:length] + \"cm \" + setting[:energy] + \"MeV\"\n system(@output_dir + \"Hadr06 \" + temp_name + \" > \" + log)\n relocate(setting)\n clean()\n end\n end\nend", "def define_tests\n Apt.update if Process.uid.zero? # update if root\n @lister.packages.each do |pkg|\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(pkg).run\n end\n end\n end\n end", "def execute\n setup\n begin\n data = main\n rescue ArgumentError => e\n warn e.message\n exit 1\n end\n puts format_data(data)\n end", "def run_tests_for(test_pattern)\n reload!\n \n test_pattern.chomp!\n case test_pattern\n when 'all'\n title = 'All Tests'\n pattern = '{unit,functional,integration}/**/*'\n when 'units'\n title = 'Unit Tests'\n pattern = 'unit/**/*'\n when 'functionals'\n title = 'Functional Tests'\n pattern = 'functional/**/*'\n when 'integration'\n title = 'Integration Tests'\n pattern = 'integration/**/*'\n else\n # A title of \"nil\" will be filled in after the tests are loaded\n title = nil\n pattern = test_pattern.gsub(':', '/')\n end\n \n files = Dir.glob(\"#{pattern}.rb\")\n files.each do |file|\n load file\n print '.'\n end\n \n # No title yet? Pull the \"best\" title out of the list of contexts\n if !title\n if Test::Spec::CONTEXTS.any?\n title = Test::Spec::CONTEXTS.keys.sort.first\n else\n title = 'unknown'\n end\n end\n \n title += \" (#{files.length} files)\"\n \n suite = Test::Unit::TestSuite.new(title)\n Test::Spec::CONTEXTS.each do |title, container|\n suite << container.testcase.suite\n end\n \n # Run the test suite and return true/false\n Test::Unit::UI::Console::TestRunner.run(suite).passed?\n end", "def run(test_methods)\n test_results = []\n\n test_methods.each do |test_method|\n runmethod(test_method.to_s, test_method, test_results)\n end\n\n dump_results(test_results) if @outputdir\n if (@command_line_output and not @connection_error)\n output_results(test_results)\n end\n test_results\n end", "def run(arguments, options)\n setup_path = nil\n selectors = BareTest.process_selectors(arguments)\n options = selectors.merge(options)\n options[:persistence] ||= Persistence.new\n\n # Load the setup file, all helper files and all test files\n BareTest.load_standard_test_files(\n :verbose => options[:verbose],\n :setup_path => options[:setup_path],\n :files => options[:files],\n :chdir => '.'\n )\n\n # Run the tests\n puts if options[:verbose]\n ARGV.clear # IRB is being stupid\n runner = BareTest::Run.new(BareTest.toplevel_suite, options)\n runner.run_all\n\n # Return whether all tests ran successful\n runner.global_status == :success\n end", "def run_tests(&block)\n\n @sources.each do |source|\n result = test_source(File.absolute_path(source))\n block.call({ :source => source, :result => result })\n end\n\n end", "def run\n run_accuracy_scenario if accuracy_scenario? && validating_accuracy?\n run_connection_scenario if connection_scenario? && validating_connections?\n end", "def run_all\n continuous_test_server.run_strategy\n end", "def run\n BrowserShooter::Logger.verbose = opts[:verbose]\n BrowserShooter::Logger.log( \"Starting script running with version #{BrowserShooter::VERSION}...\" )\n\n config = BrowserShooter::Configurator.new( opts )\n suites = config.suites\n\n suites.each do |suite|\n suite.tests.each do |test|\n suite.browsers.each do |browser|\n BrowserShooter::Base.run_test(\n suite,\n test,\n browser,\n config\n )\n end\n end\n end\n\n BrowserShooter::Logger.log( \"... script running ended.\" )\n BrowserShooter::Logger.log( \"Logs and Shots are in: #{config[\"output_path\"]}\", true )\n BrowserShooter::Logger.log( \"BYE!\" )\n end", "def run_test\n if validate(@test)\n generate(@test)\n else\n $stderr.puts \"There were some errors, fix them and rerun the program.\"\n end\nend", "def define_tests\n @ours.each do |pkg|\n their = @theirs.find { |x| x.name == pkg.name }\n class_eval do\n define_method(\"test_#{pkg.name}_#{pkg.version}\") do\n PackageVersionCheck.new(ours: pkg, theirs: their).run\n end\n end\n end\n end", "def run_tests(test_names, namespace = '')\n test_links = get_all_test_links\n\n tests = test_names.map do |test_name|\n { :id => test_links.detect{ |a| a.text == test_name }['href'][1..-1],\n :name => test_name }\n end\n\n mkdir_p test_results_dir\n tests.each do |test|\n results_page = agent.get(test_run_url(test, namespace))\n results_table = results_page.search('.outer table td').first\n File.open(test_results_file(test[:name]), 'w') do |f|\n f.print results_table.inner_html\n end\n \n puts \"#{test[:name]} complete, results in #{test_results_file(test[:name])}.\"\n end\n end", "def go_run_one(test_case)\n @status = :running\n Thread.new do\n begin\n @test_suite.run_test(test_case) do |result|\n @test_results[result[:source]] = result[:result]\n end\n rescue => e\n puts e\n print e.bracktrace.join(\"\\n\")\n ensure\n @status = :ran\n end\n end\n end", "def testloop\n \n end", "def test_running\n assert_equal(\"Huff puff huff puff\", Human.new(\"Zelda\").run)\n assert_equal(\"Huff puff huff puff\", Human.new(\"Mary\").run)\n end", "def test(argv = ARGV)\n if spec_file?(argv) && defined?(RSpec)\n # disable autorun in case the user left it in spec_helper.rb\n RSpec::Core::Runner.disable_autorun!\n exit RSpec::Core::Runner.run(argv)\n else\n Zeus::M.run(argv)\n end\n end", "def run_tests(test_files, process_number, num_processes, options, address)\n #require_list = test_files.map { |file| file.sub(\" \", \"\\\\ \") }.join(\" \")\n #cmd = \"#{executable} -Itest -e '%w[#{require_list}].each { |f| require %{./\\#{f}}}' #{address}\"\n #execute_command(cmd, process_number, num_processes, options)\n\n cmd = \"\"\n #如果有-n选项,则只运行指定的测试用例\n if options[:testcase]\n raise \"more than one file was choosen\" if test_files.size != 1 \n cmd = \"#{executable} #{test_files[0]} -n #{options[:testcase]} #{address}\"\n else\n test_files.each do |file|\n cmd += \"#{executable} #{file} #{address};\"\n end \n cmd += \"\\n\"\n end\n\n result = execute_command(cmd, process_number, num_processes, options)\n #记录log\n if options[:log]\n log_str = \"[run_tests]: \\n\" + result[:stdout]\n Actir::ParallelTests::Test::Logger.log(log_str, process_number)\n end\n\n #从result中获取执行结果用于生成测试报告\n Actir::ParallelTests::Test::Result.get_testsuite_detail(result)\n\n result\n end", "def run(suite, type, options={})\n @conf = Conf.instance\n reporter = Reporter.new(type)\n\n reporter.header\n\n suite.each do |test|\n case type\n when :test\n run_test(test) if expected_exists?(test)\n\n when :generate\n if expected_exists?(test)\n run_test(test, true) if options[:overwrite]\n else\n run_test(test, true)\n end\n end\n\n reporter.report(test)\n end\n\n reporter.summary\n end", "def run\n require File.expand_path(\"../#{config[:check]}\", $PROGRAM_NAME)\n\n threads.each(&:join)\n\n puts status_information unless status_information.empty?\n summarize!\n end", "def main; end", "def run\n threads = []\n test_start = Time.now\n puts \"Starting #{options.threads} worker threads at #{test_start}\"\n @options.threads.times do |thread_id|\n threads << Thread.new do\n worker_thread(thread_id)\n end\n end\n threads.each { |t| t.join }\n test_end = Time.now\n puts \"Total test time: #{test_end.to_f - test_start.to_f}\"\n end", "def run_test(num = -1)\n\t\tpred_list = []\n\t\tcount = 0\n\t\ttest_file.each_line do |line|\n\t\t\tsplited = line.split(\" \")\n\t\t\tuser_id = splited[0].to_i\n\t\t\tmovie_id = splited[1].to_i\n\t\t\trating = splited[2].to_i\n\t\t\tpredict = predict(user_id,movie_id)\n\t\t\terror = (rating - predict).abs\n\t\t\tpred_list << {user_id: user_id, movie_id: movie_id, rating: rating, predict: predict,error: error}\n\t\t\tcount += 1\n\t\t\t#if num is -1 the default value, then run all of the tests\n\t\t\t#if num is positive then check to stop\n\t\t\tif count >= num and num > 0\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\treturn MovieTest.new(pred_list)\n\tend", "def tests(context = {})\n run_context(context)\n end", "def main\n end", "def run\n setup\n fuzzing_loop\n end", "def run\n testable = Parser.new(@argv).parse\n Executor.new(testable).execute\n end", "def main\n\n end", "def testNominal\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_SingleDummyGem ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end", "def main\n\n # test\n\n # Console.new\n console_start\n end", "def test!\n in_test_dir do\n notify.start(\"Running tests on: #{proj_branch}\")\n test.run!\n notify.done(\"Test finished: #{test.status}\", test.passed?)\n end\n end", "def run_tests()\r\n Signal.trap(\"CLD\") {@process_counter += 1}\r\n for setting in @settings\r\n Process.wait if @process_counter <= 0\r\n @process_counter -= 1\r\n fork do\r\n temp_name, log = copy_and_edit(setting)\r\n puts \"Running: \" + String(setting[0][:materials]) + \" \" + String(setting[0][:lengths]) + \"cm \" + String(setting[0][:energy]) + \"MeV\"\r\n cmd = String(@output_dir) + \"Hadr06 \" + String(temp_name) + \" > \" + String(log)\r\n system(@output_dir + \"Hadr06 \" + temp_name + \" > \" + log)\r\n relocate(setting)\r\n clean()\r\n end\r\n end\r\nend", "def call(tests)\n Result::Test.new(\n output: '',\n passed: true,\n runtime: 0.0,\n tests: tests\n )\n end", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def run_tests()\n check_solution(1,\"aaabbc\", \"3a2bc\")\n check_solution(2, \"xxyyyyzz\", \"2x4y2z\")\n check_solution(3, \"qqqqq\", \"5q\")\n check_solution(4, \"mississippi\", \"mi2si2si2pi\")\nend", "def test_all\n @results['test_start'] = Time.now()\n passed = []\n boot_vm() if @options[:vmm_enabled]\n prep\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING NO-SERVICE TEST\"\n passed << one_test(@config['init_scenario'])\n # Stop testing if our initial test fails.\n unless passed.first == true\n @log.error \"Initial setup failed.. sleeping 60 seconds for debugging.\"\n sleep 60\n stop_vm() if @options[:vmm_enabled]\n return passed\n end\n freeze_vm() if @options[:vmm_enabled]\n @log.info \"RUNNING TESTS\"\n scenarios = get_scenarios\n test_counter = 0\n scenarios.each do |scenario|\n test_counter += 1\n @log.info \"Running test for #{scenario} - #{test_counter} of #{scenarios.size}\"\n passed << one_test(scenario)\n end\n stop_vm() if @config[:vmm_enabled]\n all_passed = passed.select{|p| p == false}.size == 0\n @log.info \"Number of tests run : #{passed.size}\"\n @log.info \"Result of ALL tests: Passed? #{all_passed}\"\n @results['test_stop'] = Time.now()\n @results['elapsed_time'] = @results['test_stop'] - @results['test_start']\n return all_passed\n end", "def run_fe_tests\n end", "def run_tests(opts = {})\n stats = {\n start: Time.now,\n test_count: 0,\n fail_count: 0\n }\n\n yield stats\n\n if stats[:test_count] == 0\n STDERR.puts \"No test files found\" unless opts[:silent]\n else\n puts \"\\nFinished in %.2g seconds\\n%d files, %d failures\" % [\n Time.now - stats[:start], stats[:test_count], stats[:fail_count]\n ] unless opts[:silent]\n exit(stats[:fail_count] > 0 ? 1 : 0) unless opts[:dont_exit]\n end\n\n stats\n end", "def generate_alltest\n\n end", "def setup\n @suite.p \"\\n:: [SETUP]\\n\"\n # -- let's print the description of each test first:\n Dir.glob(\"#{@suite.suite_root}/tests/**/*_test.rb\") {|f|\n file_contents = File.read(f)\n @suite.p \"\\n [description] : \" + /^#.*@description(.*$)/.match(file_contents)[0].gsub(/^#.*@description/, '') + \"\\n\\n\" if /#{self.class.name}/.match(file_contents)\n }\n end", "def run!\n @application.load_configuration_file_or_read_the_options!(@options)\n case\n when options.include?(:show_heuristics?)\n list_heuristics!\n when options.include?(:generate_file)\n Generator.new(options)\n else\n @application.run_global_commands!\n start_continuous_testing!\n end\n end", "def testing_begin(files)\n end", "def testNominalWithSeveralTypes\n setupTest do |iTasksFileName, iTicketsFileName|\n $Context[:OS_ExecAnswers] = [\n # svn co => success\n [ 0, '' ],\n # deliver => success, generating files\n [ 0, '', @@Generator_DummyGemAndOther ]\n ]\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ]\n ) do |iError, iSlaveActions|\n checkCallsMatch(\n [\n [ 'query', 'svn co MySVNRep' ],\n [ 'query', /^deliver .*$/ ]\n ],\n $Variables[:OS_Exec]\n )\n assert_equal( @@CommonSlaveActions.merge(\n {\n Tools::FilesManager => {\n Actions::File_Upload => [\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Gem/DummyGem.gem\"), 'All', 'Gem', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ],\n [ WEACE::Master::TransferFile.new(\"#{$Variables[:DeliverableDir]}/Releases/All/Other/DummyOtherFile\"), 'All', 'Other', 'BranchName', '0.0.1.20100317', 'ReleaseUser', 'ReleaseComment' ]\n ]\n }\n } ),\n iSlaveActions\n )\n end\n end\n end", "def run_tests(sideload_config:)\n telnet_config ={\n 'Host' => @roku_ip_address,\n 'Port' => 8085\n }\n\n @device_config[:init_params] = {\n root_dir: @root_dir\n }\n loader = Loader.new(**@device_config)\n connection = Net::Telnet.new(telnet_config)\n code, _build_version = loader.sideload(**sideload_config)\n if code == SUCCESS\n @device_config[:init_params] = nil\n linker = Linker.new(**@device_config)\n linker.launch(options: \"RunTests:true\")\n\n connection.waitfor(@end_reg) do |txt|\n handle_text(txt: txt)\n end\n print_logs\n connection.puts(\"cont\\n\")\n end\n end", "def run_tests(test_set, run_subcontexts, reporter)\n @ran_tests = []\n reporter.context_started(self) if reporter\n on_start_blocks.each { |b| instance_eval(&b) }\n test_set.each { |t| instance = t.new; instance.run(reporter); ran_tests << instance }\n subcontexts.each { |s| s.run(reporter) } if run_subcontexts\n on_finish_blocks.each { |b| instance_eval(&b) }\n reporter.context_finished(self) if reporter\n passed?\n end", "def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend", "def start!\n Signal.trap(\"INT\") { printer.done; exit }\n\n queue = Test.all_tests\n threads = (thread_count-1).times.map { |i| Thread.new { worker!(queue, i+1) } }\n\n worker!(queue, 0)\n threads.join\n\n printer.done\n end", "def run_all\n end", "def run_all\n end", "def _test_numbers ; process_test_case(\"numbers\") ; end", "def test_cases(*args, **kwargs, &block)\n if block_given?\n process_block(&block)\n elsif kwargs.length.positive?\n process_kwargs(**kwargs)\n elsif args.length.positive?\n add_tests(*args)\n else\n @tests || {}\n end\n end", "def main()\n\n\twhile(line = STDIN.gets())\n\t\tputs \"\\t\\t#{line.chomp} @#{$clock}\"\n\t\tline = line.strip()\n\t\tarr = line.split(' ')\n\t\tcmd = arr[0]\n\t\targs = arr[1..-1]\n\t\tcase cmd\n\t\twhen \"EDGEB\"; edgeb(args)\n\t\twhen \"EDGED\"; edged(args)\n\t\twhen \"EDGEU\"; edgeu(args)\n\t\twhen \"DUMPTABLE\"; dumptable(args)\n\t\twhen \"SHUTDOWN\"; shutdown(args)\n\t\twhen \"STATUS\"; status()\n\t\twhen \"SENDMSG\"; sendmsg(args)\n\t\twhen \"PING\"; ping(args)\n\t\twhen \"TRACEROUTE\"; traceroute(args)\n\t\twhen \"FTP\"; ftp(args);\n\t\twhen \"CIRCUIT\"; circuit(args);\n\t\telse STDERR.puts \"ERROR: INVALID COMMAND \\\"#{cmd}\\\"\"\n\t\tend\n\tend\nend", "def run\n checks.each(&:run)\n end" ]
[ "0.7364309", "0.7280778", "0.7182273", "0.6942154", "0.6910108", "0.69024926", "0.6895161", "0.68412733", "0.6822853", "0.6820608", "0.6791928", "0.6764579", "0.6738027", "0.6685086", "0.66567236", "0.66548216", "0.6651444", "0.6600708", "0.64860225", "0.6483401", "0.6460082", "0.6436058", "0.6421803", "0.64084417", "0.6404025", "0.6387619", "0.6372114", "0.63711905", "0.63663286", "0.63656473", "0.6355233", "0.63513196", "0.63483965", "0.63325065", "0.6302369", "0.62960756", "0.6258196", "0.6240909", "0.62367624", "0.62329704", "0.6229612", "0.6201148", "0.6199568", "0.6183404", "0.6162528", "0.6162528", "0.6153574", "0.61514217", "0.6146851", "0.6130044", "0.6124492", "0.6113362", "0.6113219", "0.61107004", "0.6110687", "0.61021805", "0.6093702", "0.60812825", "0.60794026", "0.6057506", "0.60511935", "0.60434395", "0.6042695", "0.6032273", "0.6030787", "0.6020165", "0.60167897", "0.6015088", "0.6014867", "0.6013892", "0.60116076", "0.60112435", "0.6007882", "0.6002606", "0.6000878", "0.59921336", "0.59864604", "0.5978576", "0.5977685", "0.59707034", "0.5962441", "0.5962441", "0.5962441", "0.59569126", "0.5955899", "0.59528995", "0.59524554", "0.59501517", "0.5949267", "0.5947033", "0.59260386", "0.5922076", "0.5921101", "0.5913933", "0.59119517", "0.59094036", "0.59094036", "0.5907404", "0.5907038", "0.59049654", "0.58921397" ]
0.0
-1
Before filters Confirms a loggedin user.
def logged_in_user unless logged_in? store_location flash[:danger] = "Please log in." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end", "def appctrl_confirm_user\n redirect_to( signin_path() ) unless @current_user\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n redirect_to root_path\n return false # halts the before_action\n else\n return true\n end\n end", "def before_filter\n if current_user\n true\n end\n end", "def cleared_required\n if current_user\n if current_user.cleared\n return\n end\n raise 'Du är ännu inte godkänd för att tippa.'\n end\n redirect_to \"/login\", notice: 'Logga in för att tippa.'\n end", "def confirm_logged_in\n unless session[:user_id]\n flash[:notice] = \"Please log in.\"\n render('show')\n #redirect_to(:action => 'login')\n \n #redirect_to(:action => 'login')\n #redirect_to(:controller => 'contacts', :action => 'list')\n \n \n return false # halts the before_filter\n else\n redirect_to(:controller => 'admin_users')\n return true\n end\n end", "def authorized!\n redirect_to root_url, alert: \"You need to be set up for receiving whispers first\" and return unless current_user\n end", "def check_user_before_membership\n if current_user\n ncm_membership = current_user.get_membership(@mother)\n epicenter = Epicenter.find_by_slug(params['epicenter_id'])\n\n if epicenter != @mother and not ncm_membership\n session[:new_ncm_membership] = { \n :epicenter_id => params['epicenter_id'], \n :membership_id => params['membership_id'],\n :t => Time.now\n }\n #\n redirect_to new_epicenter_subscription_path(@mother)\n end\n else\n # it's possible that we can put the logic from \"authenticate\" method below here\n redirect_to epicenters_path\n end\n end", "def authorized\n redirect_to new_user_session_path unless logged_in?\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def confirm_logged_in\n \tunless session[:user_id]\n \t\tflash[:notice] = \"Please Log in.\"\n \t\tredirect_to(login_path)\n \tend\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def enforce_logged_in\n bounce unless current_user\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def authorize_user\n if @user.id != current_user.id\n redirect_to \"/\", notice: 'You are not allowed the given operation' and return\n end\n end", "def require_no_authentication\n super\n return unless flash[:alert].present?\n\n flash[:alert] = nil\n flash[:notice] = _('You are already signed in as another user. Please log out to activate your invitation.')\n end", "def confirm_logged_in\n unless session[:user_id] != nil\n redirect_to root_path\n end\n end", "def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end", "def confirm_user_logged_in\n unless logged_in?\n store_url # So that user is sent to the same URL after they log in\n flash[:danger] = \"Please log in.\"\n redirect_to root_url\n end\n end", "def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer (cgahan@ideeinc.com)...\"\n\tend", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def prevent_other_user_edits\n @user = User.find(params[:id])\n\n if !(logged_in?)\n redirect_to login_path\n flash[:danger] = \"You must be logged in to visit this page\"\n\n else\n if (current_user.id != @user.id)\n redirect_to home_path\n flash[:danger] = \"You must be logged in as the correct user to visit this page\"\n end\n end\n end", "def force_auth\n\t\tlogger.debug \" Callback: force_auth\"\n\t\tsession[:last_ts] = nil\n\t\tCASClient::Frameworks::Rails::Filter.filter self unless @current_user\n\tend", "def authorize_user\n unless current_user\n flash[:notice] = \"Sorry, you need to be logged in to access that feature\"\n redirect_to new_session_path\n end\n end", "def unconfirmed_user_only!\n unless current_user.email_confirmed?\n redirect_to root_path, alert: t('application.unconfirmed_user_only')\n end\n end", "def valid_user\n unless ( @user && @user.activated? &&\n @user.authenticated?( :reset, params[ :id]))\n redirect_to root_url\n end\n end", "def restrict_users\n \t\tif user_signed_in?\n \t\t\tif current_user.has_role? :client\n \t\t\t\tif current_user.profile.agreed == nil\n \t\t\t\t\tredirect_to edit_profile_path(current_user.profile)\n \t\t\t\tend\n \t\t\tend\n\n \t\tend\n\n \tend", "def valid_user\n # unless (@user && @user.activated? && @user.authenticated?(:reset, params[:id])) \n unless(@user && @user.activated?)\n redirect_to root_url\n end\n end", "def authorize_user\r\n unless session[:user_id]\r\n session[:original_uri] = request.request_uri\r\n flash[:notice] = Resource.get(\"user_not_authorized_wo_login\")\r\n redirect_to(:controller => \"welcome\", :action => \"signin\")\r\n end\r\n end", "def confirm_logged_in\n unless session[:user_id]\n redirect_to login_path, alert: \"Please log in\"\n end\n end", "def valid_user\n unless (@user && @user.approved? &&\n @user.authenticated?(:reset, params[:id]))\n redirect_to root_url\n end\n end", "def valid_user\n return if @user && @user.activated? && @user.authenticated?('reset', params[:id])\n redirect_to root_url\n end", "def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end", "def user_have\n unless current_user\n redirect_to root_path, :alert => \"Зарегистрируйтесь или войдите\"\n end\n end", "def authorize\n if !user_signed_in?\n redirect_to new_user_session_path\n end\n end", "def valid_user\n unless (@user && @user.activated? &&\n @user.authenticated?(:reset, params[:id]))\n redirect_to root_url\n end\n end", "def configure_sign_in_params\n if !!current_end_user && current_end_user&.is_withdrawal != true #ユーザーが存在する場合(true)かつユーザーの退会フラグがfalseの時\n reset_session\n flash[:alert] = \"このアカウントは退会済みです。\"\n redirect_to request.referer\n end\n end", "def handle_unverified_request\n sorcery_config.before_unverified_request.each do |callback|\n send(callback)\n end\n @current_user = nil\n super # call the default behaviour which resets the session\n end", "def login_required\n not_authorized unless current_user\n end", "def authorize_user\n @user = User.find(params[:id])\n\n #User.find_by(id: (session[:update_email]/50000)) works with the code on line 50 of the sessions controller\n #this is done to allow the user to update the email in the case that they do not receive a confirmation email\n unless @user == User.find_by(id: session[:user_id]) || User.find_by(role_id: session[:user_role_id]) || User.find_by(id: (session[:update_email]/50000))\n redirect_to login_url, notice: \"Permission Denied.\\nA different user login is required to access this page.\"\n end\n end", "def require_user\n current_user\n if @current_user\n if @current_user.token_expired?\n #binding.pry\n @current_user = nil\n session.delete(:id)\n set_notification_messages(\"authentication.session_expired\", :error)\n redirect_or_popup_to_default_sign_in_page\n return\n end\n else\n set_notification_messages(\"authentication.permission_denied\", :error)\n redirect_or_popup_to_default_sign_in_page\n return\n end\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "def verify_user\n redirect_to forbidden_path unless user_signed_in? && @review.user_id == current_user.id\n end", "def run_filters\n set_user\n authorize\n end", "def valid_user\n redirect_to root_url unless @user && @user.activated? && @user.authenticated?(:reset, params[:id])\n end", "def user_logout_required\n if logged_in?\n flash[:notice] = 'Please log out of your user account first!'\n redirect_to current_user\n end\n end", "def authorize_user!\n user = Circle.find(params[:id]).user\n if current_user != user\n flash[:notices] = \"Unathorized action\"\n redirect_to user_url(user.id)\n end\n end", "def valid_user\n \tunless(@user && @user.activated? && @user.authenticated?(:reset, params[:id]))\n \t\tredirect_to root_url\n \tend\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n #then redirect them away\n redirect_to login_path\n end\n end", "def valid_user\n\t\t\tunless (@user && @user.activated? && \n\t\t\t\t\t\t\t@user.authenticated?(:reset, params[:id]))\n\t\t\t\tredirect_to root_url\n\t\t\tend\t\n\t\tend", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def require_user\n #if not logged in \n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n \n \n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def authorized\n redirect_to '/signin' unless current_driver\n end", "def require_user\n current_user\n if @current_user\n if @current_user.token_expired?\n @current_user = nil\n session.delete(:id)\n set_notification_messages(I18n.t(\"authentication.session_expired_heading\"), I18n.t(\"authentication.session_expired_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n else\n set_notification_messages(I18n.t(\"authentication.permission_denied_heading\"), I18n.t(\"authentication.permission_denied_message\"), :error)\n redirect_to_sign_in_page\n return\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def user_stray\n if !logged_in? || @user == nil\n flash[:alert] = \"You have been logged out of your session. Please log back in to continue.\"\n redirect \"/\"\n elsif @user.id != current_user.id\n flash[:alert] = \"You do not have permission to view or edit other users' content.\"\n redirect \"/\"\n end\n end", "def authorize\n redirect_to login_path and return unless current_user\n @current_user.touch(:seen_at)\n end", "def authorize\n if current_user.nil?\n redirect_to login_url, alert: \"Please Log in or Sign Up to comment!\"\n \tend\n end", "def ensure_user_logged_in\n bounce_user unless current_user\n end", "def authorize\n \t\t\tunless User.find_by(id: session[:user_id])\n \t\t\t\tredirect_to login_url, notice: \"Please Log-in\"\n \t\t\tend\n \t\tend", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def logged_in_user\n unless current_user\n flash[:danger] = \"Please log in.\"\n redirect_to log_in_path\n end\n end", "def authorize_signed_in!\n redirect_to user_session_path, alert: \"You have to be signed in to do that!\" unless current_user\n end", "def confirm_logged_in\r\n unless session[:username]\r\n redirect_to authenticate_index_path\r\n else\r\n true\r\n end\r\n end", "def authorize\n if current_user.nil?\n redirect_to events_manager_index_path, :notice => \"Login to continue!\"\n return false\n else\n end \n end", "def authorize \n unless logged_in?\n flash[:danger] = \"You must be logged in to view that... Please log in.\"\n redirect_to new_session_path unless logged_in?\n end\n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform this action\"\n redirect_to :back\n end\n end", "def authenticate_current_user_as_invited_user\n\t unless current_user == @invitation.invited_user\n\t redirect_to :back, alert: 'This invitation is not for you!'\n\t end\n\t end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def require_user\n if !is_logged_in\n flash[:danger] = 'You must be logged in to perform this action'\n redirect_to root_path\n end\n end", "def authenticate_current_user\n unless current_user.admin == true\n unless current_user == User.find(params[:id]) \n flash[:danger] = \"Impossible d'aller sur cette page.\"\n redirect_to root_path\n end\n end\n end", "def pre_authorize_cb; end", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end", "def pre_resend\n \t@user = User.find(params[:id])\n \tif @user.user_state == \"confirmed\"\n flash[:notice] = \"\" + @user.first_name + \", your account is already confirmed.\"\n redirect_to(:action => 'already_confirmed', :id => params[:id])\n else\n render :layout => 'clean'\n end\n end", "def logged_in_user\n unless !current_user.nil?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def authorize\n unless User.find_by_id(session[:user_id])\n redirect_to :log_in, :notice => \"Please log in\"\n end\n end", "def correct_user\n return if current_user_is_admin? || current_user.id == @comment.user_id\n flash[:danger] = 'Not authorized.'\n redirect_to users_path\n end", "def user_authenticated\n redirect_to root_url, alert: 'You must be logged in to go here' unless current_user\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def require_equal_user\n if @user.id != current_user.id\n render :file => \"#{Rails.public_path}/401.html\", :layout => true, :status => :unauthorized\n end\n end", "def verify_user\n return if (@user = current_user)\n flash[:notice] = I18n.t('blacklight.saved_searches.need_login')\n raise Blacklight::Exceptions::AccessDenied\n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def check_user\n if user_signed_in?\n else\n redirect_to root_path, :alert => \"Unauthorised Access\"\n end\n \n end", "def require_user\n if !logged_in?\n flash[:danger] = \"You must be logged in to perform that action\"\n redirect_to root_path\n end\n end", "def authorize\n redirect_to new_session_path unless logged_in?\n end", "def authorize_user\n unless current_user.id == @profile.user_id\n flash[:unauthorized] = \"Not authorized\"\n redirect_to listings_path\n end \n end", "def prevent_user\n if session[:is_admin] != true and params[:user_id].to_i != @current_user.id\n redirect_to products_path\n end\n end", "def authorize\n unless User.find_by_id( session[ :user_id ] )\n session[ :original_uri ] = request.request_uri\n flash[ :notice ] = \"Please log in\"\n redirect_to :controller => :login, :action => :login\n end\n end", "def authenticate_correct_user\n redirect_unauthorized unless current_user? @run.user_id\n end", "def correct_user\n if request.subdomain.present? && request.subdomain != \"www\"\n if user_signed_in?\n if params[:controller] == 'static_pages' && params[:action] == 'home'\n elsif params[:controller] == 'pages' && params[:action] == 'show'\n elsif params[:controller] == 'static_pages' && params[:action] == 'leasing'\n elsif params[:controller] == 'availabilities' && params[:action] == 'show'\n else\n @subdomain = request.subdomain\n @site = Site.where(subdomain: request.subdomain).first\n @user = User.where(id: @site.user_id).first\n if @user.id != current_user.id\n redirect_to (root_url(:subdomain => false) + \"dashboard\")\n # sign_out(@user)\n end\n end\n end\n end\n end", "def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def require_login\n redirect_to login_path, notice: 'The requested action requires you to log in' unless session[:user_id]\n end", "def require_user\n if !logged_in?\n flash[:alert] = \"You must be logged in to perform that action\"\n redirect_to login_path\n end\n end", "def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def authorize\n if current_user != @profile.username\n flash[:alert] = \"Cannot access this profile\"\n redirect_to root_path\n end\n end" ]
[ "0.6569166", "0.6430658", "0.6423167", "0.64137745", "0.63995165", "0.62902534", "0.6249426", "0.6248803", "0.6218758", "0.6173909", "0.612472", "0.61157626", "0.60806084", "0.6062998", "0.6040006", "0.60308075", "0.6022445", "0.60193825", "0.6015744", "0.6000973", "0.5993021", "0.5991861", "0.5990247", "0.59732157", "0.59731853", "0.5957767", "0.5956104", "0.5951737", "0.5947172", "0.592623", "0.5921581", "0.59179676", "0.59034806", "0.5887522", "0.5884948", "0.58768743", "0.58765846", "0.58758426", "0.58735776", "0.587279", "0.58721757", "0.5871094", "0.58678186", "0.58597577", "0.585962", "0.5846623", "0.58431613", "0.583902", "0.58359814", "0.5830664", "0.58259964", "0.58206636", "0.5820238", "0.58191544", "0.5812869", "0.58108264", "0.58006203", "0.57966095", "0.5791977", "0.5786464", "0.57773817", "0.57712746", "0.5759577", "0.5757955", "0.5757765", "0.5755161", "0.5748342", "0.5743378", "0.57423174", "0.57420623", "0.57306045", "0.5729118", "0.57244396", "0.57210755", "0.57175434", "0.5717196", "0.57168984", "0.5715941", "0.57074636", "0.5706773", "0.57067716", "0.57058156", "0.5702965", "0.5699887", "0.56984425", "0.5697734", "0.5697734", "0.5697636", "0.56975067", "0.56961983", "0.5695846", "0.5695014", "0.56949896", "0.56883526", "0.5687561", "0.56852823", "0.56833124", "0.5683292", "0.56819636", "0.56762284", "0.56755614" ]
0.0
-1
Confirms the correct user.
def top_layer_administrator redirect_to(root_url) unless (!current_user.role.blank? && (current_user.role.top_layer_administrator? || current_user.role.assurance_provider? || current_user.role.audit_log_reporting? || current_user.role.secondary_time_period? )) || current_user.admin? || current_user.super_admin? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n msg = \"You do not have permission to update another user's information\"\n require_correct_user(@user, msg)\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def correct_user\n unless helpers.current_user?(@user)\n flash[:danger] = \"You don't have permission to do that\"\n redirect_to root_path\n end\n end", "def correct_user\n set_user\n unless current_user?(@user)\n flash[:danger] = 'This action is not permitted for this account since you are not the owner'\n redirect_to overview_user_path(current_user)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless @user == current_user\n flash[:danger] = 'You are not authorized to do that.'\n redirect_to(root_url)\n end\n end", "def correct_user\n user = User.find(params[:id])\n unless current_user?(user) \n flash[:danger] = \"Uncorrect user.\"\n redirect_to(root_url) \n end\n end", "def correct_user\n\t\tunless current_user == @univers.user\n\t\t\tflash[:danger] = \"You have no power there\"\n\t\t\tredirect_to universes_path\n end\n end", "def confirm\n if @user = UserConfirmsAccount.new(:token => params[:token]).call\n self.establish_session @user\n redirect_to profile_url, :notice => \"Thanks for confirming #{@user.email}\"\n else\n redirect_to profile_url, :notice => \"There was a problem confirming - try re-sending the email?\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if current_user != @user\n flash[:danger] = \"You don't have permission for that\"\n redirect_to(root_url) unless current_user?(@user)\n end\n end", "def correct_user\n @question = Question.find(params[:id])\n redirect_to(root_url) unless current_user == @question.user\n end", "def correct_user\n @user = User.find(params[:id])\n if @user != current_user\n flash[:alert] = \"Action not authorized\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:user_id])\n redirect_to('/unauthorized') unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user_help?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n end\n end", "def correct_user\n if !is_correct_user\n redirect_to incorrect_user_path_for\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \n \"You do not have permission to access #{@user.name}'s account.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Please don't mess with others' profiles!\"\n # redirect_to root_url\n redirect_to @user\n end\n end", "def correct_user\n @user = User.find(params[:id])\n unless current_user?(@user)\n flash[:danger] = \"Yikes. Sorry, but it doesn't look you have permission to do that 😬\"\n redirect_back(fallback_location: root_url)\n end\n end", "def correct_user\n\t @user = User.find(params[:id])\n\t unless current_user?(@user)\n\t flash[:danger] = \"You don't have rights\"\n\t\t\tredirect_back_or(root_url)\n\t end\n\tend", "def correct_user\n unless @user == current_user\n redirect_to user_notes_path(current_user)\n end\n end", "def correct_user\n redirect_to(root_url) unless @user == current_user\n end", "def confirm_with_user\n confirmed = Helper::Util.confirm \"Is this OK? \", true\n return if confirmed\n\n loop do\n Helper::Util.clear\n\n print_identification\n\n say \"<%= color('The following options may be adjusted before continuing.', BOLD) %>\"\n choice = choose do |menu|\n self.class.available_options.reject(&:skip_confirmation).each do |option|\n value = send option.confirm_symbol\n menu.choice \"#{option.label}: #{option.display_value(value)}\"\n end\n\n menu.choice \"Accept and continue\"\n menu.choice \"Quit\"\n menu.readline = true\n menu.prompt = \"What would you like to do?\"\n end\n\n Helper::Util.clear\n\n print_identification\n\n if (option = self.class.available_options.find { |o| choice =~ /^#{Regexp.quote(o.label)}/ })\n loop do\n break if prompt_for_option(option)\n say \"Invalid value for option.\\n\\n\"\n end\n elsif choice =~ /^Accept/\n log\n return\n else\n exit(0)\n end\n end\n end", "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n flash[:danger] = \"Sorry, you're aren't allowed to access that.\"\n redirect_to(\"/#flash\") \n end\n end", "def correct_user(user)\n user == current_user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tif current_user != @user\n\t\t\t\tredirect_back(fallback_location: root_path)\n\t\t\tend\n\t\tend", "def correct_user\n @user = HoacUser.find(params[:id])\n redirect_to(edit_hoac_user_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path, alert: \"You do not have access to that page\" unless current_user == @user\n end", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_url) unless @user == current_user\n\t\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to root_path unless @user == current_user\n\tend", "def correct_user\n\t\t\t@user = User.find(params[:id])\n\t\t\tredirect_to(root_path) unless current_user?(@user)\n\t\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user === current_user\n end", "def correct_user\n user_id = params[:user_id] || params[:id] || session[:user_id]\n @user = User.find_by(id: user_id)\n unless @user.nil?\n unless current_user?(@user) || current_user.administrator?\n flash[:danger] = \"Only the account owner or an adminstrator to do that.\"\n redirect_to(root_path)\n end\n else\n nonexistent_user_error\n end\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n flash[:danger] = \"Admin Access Only.\"\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_path) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless @user == current_user # sauf si\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_path unless @user == current_user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:user_id])\n unless current_user?(@user)\n flash[:danger] = \"You don't have permission for that action.\"\n redirect_to(root_url)\n end\n end", "def correct_user\n @course = Course.find(params[:id])\n @user = @course.users\n unless current_user == @user\n redirect_to(root_url) \n flash[:danger] = \"You are not the authorised user\"\n end\n end", "def correct_user\n @user = User.find(params[:id])\n logger.debug \"***correct_user - Detected User - #{@user.name}\"\n redirect_to(root_url) unless current_user?(@user) || admin_user\n end", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n\t\t@user = User.find(params[:id])\n\t\tredirect_to(root_url) unless current_user?(@user)\n\tend", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_url) unless current_user?(@user)\n end", "def confirm_matching\n @user = User.find(params[:id])\n redirect_to root_path unless current_user? @user\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to(user_root_path,:notice => 'You cannot access this page') unless current_user == @user\n end", "def correct_user\n redirect_to(root_url) unless current_user?(@user)\n end", "def correct_user\n @user = User.find(params[:id])\n redirect_to root_url, notice: \"You do not have permission to view or edit this information because it isn't yours.\" unless current_user?(@user)\n end", "def correct_user\n \n redirect_to(login_path) unless current_user?(@user)\n end" ]
[ "0.7474259", "0.73411936", "0.7317917", "0.7183303", "0.7174887", "0.7049758", "0.70130193", "0.7012358", "0.7006517", "0.7006201", "0.7003461", "0.69663024", "0.69136065", "0.6911695", "0.690295", "0.6892608", "0.68439376", "0.6842948", "0.68397075", "0.683463", "0.6826711", "0.6825813", "0.6811448", "0.680094", "0.67988366", "0.6793706", "0.67789406", "0.67666626", "0.67421", "0.6740984", "0.6740906", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6736732", "0.6732851", "0.67279315", "0.6725006", "0.6723821", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.67211986", "0.6720861", "0.6715527", "0.6711952", "0.6684064", "0.66769403", "0.66658443", "0.6663128", "0.6663128", "0.6663128", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.6658565", "0.66540176", "0.6653203", "0.66520107", "0.664873", "0.66435707" ]
0.0
-1
Confirms an admin user.
def admin_user #redirect_to(root_url) unless current_user.admin || current_user.super_admin?# || top_layer_administrator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm_admin\n \tunless session[:admin]\n \t\tflash[:notice] = \"You are not an admin.\"\n \t\tredirect_to(user_path( :id => session[:user_id]))\n \tend\n end", "def admin_user\n\t\t\tflash_text = \"Administrative privilege required to perform this action.\"\n\t\t\tflash[:danger] = flash_text unless current_user.admin?\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n if user_signed_in? && current_user.adminrole?\n flash.now[:success] = \"Admin Access Granted\"\n else\n redirect_to root_path\n end\n end", "def admin_user\n if(!current_user.admin?)\n flash[:danger] = \"Access Denied. Admin required\"\n redirect_to root_url\n end\n end", "def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless current_user.is_admin?\n flash[:danger] = \"Keine Berechtigung.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n redirect_to(root_url) and flash[:danger] = \"Only admins can do that!\" unless current_user.admin?\n\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n unless this_is_admin?(current_user)\n flash[:danger] = \"You don't have the rights for this action.\"\n redirect_to(root_url)\n end\n end", "def admin\n unless current_user.admin?\n flash[:danger] = \"Sorry, you must be an admin to do that.\"\n redirect_to user_path(current_user)\n end\n end", "def confirm_admin\n @confirm_admin = true if session[:role_name] == 'Administrator'\n end", "def confirm_admin\n redirect_to root_path unless current_user.admin?\n end", "def admin_user\n unless current_user.admin?\n flash[:danger] = \"You do not have the permission to do that.\"\n redirect_to home_path\n end\n end", "def admin_user\n\t unless current_user.admin?\n flash[:danger] = \"Log in as Admin.\"\n redirect_to(root_url)\n\t end \n\t end", "def admin_user\n unless current_user && current_user.admin?\n store_location\n flash[:danger] = \"Please log in as admin.\"\n redirect_to users_url\n end\n end", "def be_admin\n if current_user.switch_to(\"admin\")\n flash[:notice] = \"You have now an 'admin' role\"\n else\n flash[:error] = \"You are not authorized to have a 'admin' role\"\n end\n redirect_to( request.env[\"HTTP_REFERER\"])\n end", "def admin_user\n\t\tunless admin? \n\t\t\tflash[:danger] = \"Only administrators have access to this page\"\n\t\t\tredirect_back_or(root_url) \n\t\tend\n\tend", "def admin_user!\n unless signed_in? and current_user.admin?\n\t flash[:notice]=\"Por favor inicie sesión como administrador\".encode('UTF-8')\n\t redirect_back(fallback_location: root_path) \n end\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user \n if (!current_user.lunches_admin?) \n flash[:alert] = 'You not allowed to edit menu.'\n \n redirect_to(root_url)\n end\n end", "def admin_user\n redirect_to(root_path) unless current_user.try(:admin?) || current_user?(@user)\n end", "def verify_admin\n if !current_user.present? || current_user.email != I18n.t('general.admin_email')\n redirect_to concerts_path\n flash[:notice] = I18n.t('general.log_as_admin')\n end\n end", "def admin_user\n redirect_to(root_path) unless (current_user != nil && current_user.admin == true)\n end", "def admin_user\n unless @is_admin\n flash[:danger] = \"Must be admin to modify recipes\"\n redirect_to(recipes_url) \n end\n end", "def admin_user\n redirect_to root_url, notice: \"You do not have permission to view or edit this information.\" unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless !current_user?(@user) && current_user.admin?\n end", "def admin_user\n \n unless current_user.admin?\n \tflash[:danger] = \"Please log in with the correct user name.\"\n \tredirect_to(root_url)\n end\n end", "def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end", "def admin_user\n redirect_to(root_path) unless is_admin?\n end", "def correct_user\n\t\t\tauthenticate_user!\n\t\t\tunless @user == current_user || current_user.admin?\n\t\t\t\tredirect_to (root_path)\n\t\t\t\tflash[:alert]\n\t\t\tend\n\t\tend", "def admin\n unless current_user.admin?\n redirect_to root_url\n flash[:danger] = \"You have no access here\"\n end\n end", "def admin_user\n if logged_in?\n redirect_to(root_url) unless current_user.admin?\n else\n flash[:danger] = \"You reached an invalid url and have been redirected to the home page.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n @user = current_user\n redirect_to @user unless @user.admin?\n end", "def admin_user\n if (!current_user || current_user.username != 'admin')\n redirect_to(root_url)\n end\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def check_admin\n redirect_to root_path, alert: \"You do not have admin privileges.\" unless current_user.admin\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t\tend", "def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\" è stato aggiunto direttamente da Rails quando alla creazione ha visto che admin è un booleano\n\tend", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n #redirect_to(root_url) unless\n current_user.admin?\n end", "def admin_user\n\t\t\tredirect_to(root_url) unless current_user.admin?\n\t end", "def correct_user\n @userAdmin = UserAdmin.find(params[:id])\n unless current_user?(@userAdmin)\n flash[:danger] = \"You don't have the rights for this page/action.\"\n redirect_to(root_url)\n end\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless user_signed_in? && current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "def admin\n\t\tauthenticate_user!\n\t if current_user.admin\n\t\t return\n\t else\n\t\t redirect_to root_url\n\t end\n\tend", "def check_admin_user\n unless current_user && current_user.privilege_admin?\n flash[:danger] = \"You do not have permission to perform this operation\"\n redirect_to root_path\n end\n end", "def verify_admin_of_user\n redirect_to admins_path,\n flash: { alert: I18n.t(\"administrator.flash.unauthorized\") } unless current_user.admin_of?(@user, \"can_manage_users\")\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.is_admin?\n end", "def admin_user\n unless admin_user?\n redirect_to login_url\n end\n end", "def admin_user\n redirect_to(admin_admins_path) unless current_user.admin?\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "def check_admin_status\n if current_user.nil? || !current_user.admin?\n flash[:alert] = \"Access denied. Please login as an admin user\"\n redirect_to root_url\n end\n end", "def admin_user\n redirect_to(current_user) unless current_user.admin?\n end", "def admin!\n redirect_to root_path, alert: \"Not authorized\" and return unless is_admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin? # se current_user.admin for falso redireciona para pagina principal\n end", "def authenticate_admin\n\t\tauthenticate_user!\n\t\tunless current_user.approved == 1\n\t\t\tsign_out\n\t\t\tflash[:error] = \"User is not admin! Try again using another username!\"\n\t\t\tredirect_to new_user_session_path\n\t\t\t# redirect_to new_user_session_path\n\t\tend\n\tend", "def correct_admin\n @admin_admin = Admin::Admin.find(params[:id])\n redirect_to(admin_admins_path) unless current_user?(@admin_admin)\n end", "def admin_user\n unless logged_in? && current_user.admin?\n redirect_to root_url\n end\n end", "def req_admin\n unless curr_user.admin\n flash[:danger] = \"You must be admin to go there!\"\n redirect_to root_url\n end\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end", "def admin_user\n redirect_to(root_url) unless current_user.admin?\n end" ]
[ "0.79040426", "0.76734394", "0.76483005", "0.7621745", "0.760655", "0.760655", "0.7595599", "0.758948", "0.758948", "0.7503988", "0.7466696", "0.7451627", "0.74247295", "0.7411497", "0.741143", "0.7402666", "0.73996776", "0.73597306", "0.7330382", "0.731928", "0.7313488", "0.7279017", "0.7270432", "0.7247708", "0.72397447", "0.723298", "0.72183865", "0.7174806", "0.7172882", "0.7165858", "0.7159388", "0.71543163", "0.71383506", "0.7125728", "0.7121958", "0.7121958", "0.7121591", "0.7121591", "0.7120819", "0.7119203", "0.7119203", "0.7119199", "0.7113157", "0.7110349", "0.7110349", "0.7103248", "0.7103248", "0.7098395", "0.70950264", "0.7092185", "0.7091323", "0.7091323", "0.7091323", "0.7091323", "0.7076726", "0.7067643", "0.7066017", "0.7066017", "0.7054474", "0.7049436", "0.70416933", "0.7034203", "0.701816", "0.7018095", "0.7014572", "0.70112586", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061", "0.7010061" ]
0.0
-1
Gives the list of use cases as JSon
def index @use_case_groups = @project.use_case_groups respond_to do |format| format.html # index.html.erb format.json { render json: @use_cases } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cases\n return suite.cases(data.id)\n end", "def budget_categories_data\n # @budget.budget_items.collect { |budget_item| budget_item.category.name.to_s }.to_json\n categories = Category.for_budget.to_a\n categories << Category.find_by_name(\"Miscellaneous\")\n return categories.collect { |category| category.name.to_s }.to_json\n end", "def run_list\n json[:run_list]\n end", "def index\n render jsonapi: Seances::UseCases::FetchAll.new.call\n end", "def toJson()\n json = to_a().map{|analyzer|\n analyzer.toJson() ;\n }\n return json ;\n end", "def get_all_uses_cases_from_packages(packages)\n package_usecases = Hash.new\n packages.each do |package|\n use_cases = get_use_cases_from_package(package)\n package_usecases[package] = use_cases\n end\n array = []\n package_usecases.each_value{|value| value.each do |v| array << v end} \n return array\n end", "def cases\n return @cases\n end", "def types\n types = Question.distinct.pluck(:type)\n render json: types.to_a\n end", "def json\n @@id += 1\n \"{\" +\n \"\\\"type\\\": \\\"LEX_SELECT\\\", \\\"id\\\": \\\"S#{@@id}\\\", \" +\n \"\\\"offset\\\": #{@offset}, \\\"length\\\": #{@length}, \" +\n \"\\\"value\\\": [\" + @candidates.map{|elem| elem.json}.join(\",\") +\n \"]}\"\n end", "def results\n ab_test_results.map { |result| [ result.ab_test.name, result.ab_test_option.name ] }.to_hash\n end", "def sport_name_options\n authorize :report\n\n sport_names = company.venues.\n flat_map { |venue| venue.supported_sports_options }.\n uniq { |hash| hash[:value] }\n\n render json: sport_names\n end", "def as_json\n dice.map(&:as_json)\n end", "def purposes\n object.relevant_purposes ? object.relevant_purposes.collect{ |tp| {name: tp.name, code: tp.code}} : []\n end", "def moes_json\n result_set = @experiment.result_names\n result_set = if result_set.blank?\n [t('experiments.analysis.no_results'), '', \"moes_parameter\"]\n else\n result_set.map { |x| [Experiment.output_parameter_label_for(x), x, \"moes_parameter\"] }\n end\n moes_and_params = get_moes_and_params(result_set)\n array = []\n moes_and_params.map do |label, id, type|\n parameter_infos= {:label => ERB::Util.h(label), :id => ERB::Util.h(id), :type => ERB::Util.h(type)}\n array.push(parameter_infos)\n end\n render json: array\n end", "def get_fuel_types\n relatable_category_id = params[:car_calculator][:manufacture]\n result = CarApp.calculated_session.related_categories_from_relatable_category(relatable_category_id, \"fuel_type\") \n final_result = []\n result = result.each_pair do |key, value| \n final_result << {:name => value, :value => key}\n end\n render :json => {:options => final_result}.to_json\n end", "def build_json_from_params \n #Construct array for holding categories\n arr = [] \n get_categories.each do |cat| #Meow\n #For each category create a map {}\n new_cat = {}\n new_cat[\"name\"] = cat[0]\n new_cat[\"steps\"] = []\n get_steps(cat).each do |step|\n #For each step create a map {}\n new_cat_step = {}\n new_cat_step[\"name\"] = step[2]\n #get options returns a list of maps of options\n new_cat_step[\"options\"] = get_options(step) \n new_cat[\"steps\"] << new_cat_step\n end \n arr << new_cat\n end\n json = {\"categories\" => arr, \"prompt\" => params[:prompt]}\n return json\n end", "def get_test_map\n @test_map = Array.new\n @data_map[\"cases\"].each do |hash|\n @test_map << hash\n end\n end", "def gather_alphabets\n \talphabets = helpers.gather_alphabets\n\n render json: {\n data: alphabets\n }\n \t\n end", "def index\n @support_cases = SupportCase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_cases }\n end\n end", "def eligible_case_types\n eligible_case_stages.map(&:case_type)\n end", "def list\n specs = Array.new\n @public_holiday_specifications.each { |phs| specs << phs.to_s }\n specs\n end", "def types\n [\n { value: 'bus', name: 'Bus' },\n { value: 'coach', name: 'Coach' },\n { value: 'hgv', name: 'Heavy goods vehicle' },\n { value: 'van', name: 'Van' },\n { value: 'minibus', name: 'Minibus' },\n { value: 'private_car', name: 'Car' },\n { value: 'motorcycle', name: 'Motorcycle' }\n ]\n end", "def to_json\n {:check_method => @check_method, :exception_case => @exception_case, :digit_weights => @digit_weights}.to_json\n end", "def available_filters_as_json\n json = {}\n available_filters.each do |field, options|\n json[field] = options.slice(:type, :name, :values).stringify_keys\n end\n json\n end", "def available_filters_as_json\n json = {}\n available_filters.each do |field, options|\n json[field] = options.slice(:type, :name, :values).stringify_keys\n end\n json\n end", "def autocomplete\n @design_methods = DesignMethod.where(['name LIKE ?', \"#{params[:term]}%\"])\n @design_hash = []\n @design_methods.each do |d|\n @design_hash << { label: d.name }\n end\n respond_to do |format|\n format.json { render json: @design_hash}\n end\n end", "def json\n\n JSON.fast_generate(@gltf)\n\n end", "def json_include()\n return [\n :events,\n :goals,\n :tracker_days,\n # :journal\n ]\n end", "def toJson()\n return @entryList.map{|entry| entry.toJson() ; }\n end", "def to_json(context)\n\t\tif parent_id\n\t\t\tkids = children.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t} + test_cases.sort_by { |x|\n\t\t\t\tx.issue.subject\n\t\t\t}.collect { |tc|\n\t\t\t\ttc.to_json(context)\n\t\t\t}\n\t\telse\n\t\t\tkids = children.select { |x|\n\t\t\t\t(x.name != '.Obsolete') && (x.name != '.Unsorted')\n\t\t\t}.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t} + test_cases.sort_by { |x|\n\t\t\t\tx.issue.subject\n\t\t\t}.collect { |tc|\n\t\t\t\ttc.to_json(context)\n\t\t\t} + children.select { |x|\n\t\t\t\t(x.name == '.Obsolete') || (x.name == '.Unsorted')\n\t\t\t}.collect { |s|\n\t\t\t\ts.to_json(context)\n\t\t\t}\n\t\tend\n\t\t{\n\t\t\t'suite_id' => id,\n\t\t\t'text' => name,\n\t\t\t'id' => ((name != '.Obsolete') && (name != '.Unsorted')) ? \"suite_#{id}\" : name,\n\t\t\t'expandable' => true,\n\t\t\t'expanded' => false,\n\t\t\t'editable' => !(\n\t\t\t\t((name == '.Unsorted') || (name == '.Obsolete')) && parent.parent.nil?\n\t\t\t) && !parent.nil?,\n\t\t\t'children' => kids,\n\t\t\t'draggable' => (\n\t\t\t\t!parent.nil? && !(\n\t\t\t\t\t((name == '.Unsorted') || (name == '.Obsolete')) && parent.parent.nil?\n\t\t\t\t)\n\t\t\t),\n\t\t\t'state' => { 'opened' => parent.nil? },\n\t\t\t'type' => 'suite'\n\t\t}\n\tend", "def tests\n @tests ||= load_json(test_plan_path)&.fetch(:tests) if test_plan_path\n end", "def to_json\n sort_words.to_h.to_json\n end", "def tojson\n\t\tend", "def get_all\n get_docs\n get_text\n return JSON.pretty_generate(@data)\n end", "def as_json(options={})\n\t\tsuper(:methods => [:display_result,:display_normal_biological_interval,:display_count_or_grade,:display_comments_or_inference,:test_is_abnormal,:test_is_ready_for_reporting,:test_is_verified, :successfully_updated_by_lis])\n\tend", "def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end", "def as_json(*)\n serializer = ScenarioSerializer.new(@controller, @updater.scenario)\n { scenario: serializer, gqueries: @results }\n end", "def json\n @obj.get_json_regex\n end", "def to_full_js(services)\n maps = services.map do |service|\n expr = VinesQL.parse(service.code.strip)\n %Q{\n try {\n var match = #{expr.js};\n if (match) {\n emit([0, '#{service.id}'], {name: name, os: os});\n emit([1, name], '#{service.id}');\n }\n } catch(e) {\n log(e.message);\n }\n }\n end\n\n %Q{\n function(doc) {\n if (doc.type != 'System') return;\n var name = doc['_id'].replace('system:', '');\n var os = doc.ohai.kernel.os.toLowerCase().replace('gnu/', '');\n #{maps.join}\n }\n }\n end", "def list\n categories = Meal.distinct.pluck(:category)\n meal_list = []\n categories.each { |category|\n obj = {\n groupName: category.capitalize,\n options: Meal.where(category: category).select(:id, :name)\n }\n meal_list.push(obj)\n }\n\n render json: meal_list\n end", "def generate_country_energy_cost_array\n country_energy_costs = CountryEnergyCost.all()\n country_energy_costs_array = []\n country_energy_costs.each do |country_energy_cost|\n country_energy_costs_array << country_energy_cost.to_json()\n end\n return country_energy_costs, country_energy_costs_array\n end", "def all_plans\n file = File.read('./data/bundle.json')\n plan_hash = JSON.parse(file)\n plans = plan_hash['plans']\n end", "def getJSON\n rulesPayload = Hash.new\n rulesPayload[:rules] = @rules\n rulesPayload.to_json\n end", "def court_types\n render json: GamePass.court_types_options\n end", "def to_json\n\t\tresult = {}\n\t\tself.filters.collect { |c| result[c[0].to_sym] = c[1] }\n\t\treturn result.to_json\n\tend", "def as_json(*)\n values\n end", "def getListeCase()\n return @listeCase\n end", "def get_task_types_eng\n [\"vat_jan\", \"vat_mar\", \"vat_may\", \"vat_jul\", \"vat_sept\", \"vat_nov\", \"voucher\", \"income_tax\"]\n end", "def all_forms\n\t\t\tretval = []\n\t\t\tNUMBERS.each do |number|\n\t\t\t\tCASES.each do |gram_case|\n\t\t\t\t\tretval << {:case => gram_case, :number => number}\n\t\t\t\tend\n\t\t\tend\n\t\t\tretval\n\t\tend", "def available_grade_levels_json\n params.require(:workspace_id)\n\n # schools\n school_ids = queries.supported_schools.map(&:id).select do |school_id|\n queries.is_authorized_for_school_id?(school_id)\n end\n schools_json = School.find(school_ids).as_json(only: [:id, :name])\n\n # grade levels (include if any of their schools would allow it)\n grade_levels_next_year = queries.supported_grade_levels_next_year.select do |grade_level_next_year|\n grade_level_now = GradeLevels.new.previous(grade_level_next_year)\n school_ids.any? {|school_id| queries.is_authorized_for_grade_level_now?(school_id, grade_level_now) }\n end\n\n render json: {\n schools: schools_json,\n grade_levels_next_year: grade_levels_next_year\n }\n end", "def to_indexed_json\n to_json(methods: [:state, :executed, :aircraft_registration, :zone_name, :technician_ids])\n end", "def list_languages\n\t\trender json: Language.all.to_json\n\tend", "def experimentList\n @allExperiments = UteExperiment.where(:is_private => false, :is_active => true).where(\n :$or => [\n {:campaign_end_at.gte => Time.now.getutc.to_f},\n {:campaign_end_at => nil},\n ]\n )#.pluck(:experiment_code, :talias)\n #[ \n # #UteExperiment.where(:owner => session[:user_id], :is_private => true, :is_active => true), #no personalisation yet implemented\n # UteExperiment.where(:is_private => false, :is_active => true).pluck(:experiment_code, :talias)\n #].collect { |aoc| aoc.to_a}.flatten\n #@sessionlist = Session.where(:is_active => true).map{ |x| \n # { \n # :session_number => x.session_number, \n # :id => x.id, \n # :isexposed => true \n # } \n #}\n @experimentlist = []\n @allExperiments.each do |experiment| \n @experimentlist << {\n experiment_id: experiment.experiment_code,\n is_cacheable: experiment.is_cacheable,\n talias: experiment.talias,\n title: experiment.title,\n description: experiment.text\n }\n end\n respond_to do |format|\n format.html { render text: 'Experiment list: <br/>' + { 'experiments' => @experimentlist }.to_json }\n format.json { \n render json: { 'experiments' => @experimentlist }.to_json \n }\n end\n end", "def select_options_for_court_sports\n @court_sports_enums = Court.where(venue_id: authorized_scope(company.venues).select(:id)).active.\n pluck('distinct sport_name')\n @court_sports = @court_sports_enums.map { |n| Court.sport_names.key(n) }\n render json: @court_sports.map { |x| { value: x, label: x.humanize } }\n end", "def list_inventors\n \tjson_out(Inventor.all)\n\tend", "def get_static_assests\n types = LocationType.all\n facilities = Facility.all\n type_array = []\n facility_array = []\n types.each do |type|\n type_array << type.name\n end\n facilities.each do |facility|\n facility_array << facility.name\n end\n render json: { location_types: type_array, location_facilities: facility_array }\n end", "def getTests\n\t\t\ttests = Array.new\n\t\t\t@language.each do |test,data|\n\t\t\t\ttests << test\n\t\t\tend\n\n\t\t\treturn tests\n\t\tend", "def list(options = {})\n url = build_url(options)\n response = rest_get(url)\n JSON.parse(response)['value'].map { |hash| Azure::Armrest::Usage.new(hash) }\n end", "def getlist\r\n result = SUPPORTED_LANG_LIST\r\n end", "def test_case_data(test_case)\n steps_as_string = test_case.test_steps.map{|step| step.source.last}\n .select{|step| step.is_a?(Cucumber::Core::Ast::Step)}\n .reject{|step| step.is_a?(Cucumber::Hooks::BeforeHook)}.map do | g_step |\n str = g_step.send(:keyword)+g_step.send(:name)\n str += g_step.multiline_arg.raw.map{|l|\"\\n| #{l.join(' | ')} |\"}.join if g_step.multiline_arg.data_table?\n str\n end.join(\"\\n\")\n {'title'=>extract_title(test_case),\n 'type_id'=>type_id(test_case),\n 'custom_steps'=>steps_as_string,\n 'refs'=>refs(test_case)\n }\n end", "def distributed_engine_rules_2_json_simple(rules)\n\n end", "def criteria_to_json criteria\n criteria.each.map{ |doc| (response ||= []) << doc }.flatten.to_json\n end", "def case_string_values\n @res = Set.new\n get_col_results(@parse_path.val.case_expr) if @parse_path.val.case_expr\n @res.to_a\n end", "def get_product_count_types\n types = CountType.where(product_id: params[:product_id]).order(\"name ASC\").map { |type| [type.id, type.name] }\n render :json => types.to_json.to_s.to_json\n end", "def to_json(context, version = nil, environment = nil)\n\t\t{\n\t\t\t'suite_id' => id,\n\t\t\t'text' => name,\n\t\t\t'id' => id,\n\t\t\t'expandable' => true,\n\t\t\t'expanded' => (children.count + test_cases.count) == 0,\n\t\t\t'state' => { 'opened' => parent.nil? },\n\t\t\t'editable' => !parent.nil?,\n\t\t\t'children' => (\n\t\t\t\tchildren.collect { |s| s.to_json(context, version, environment) } +\n\t\t\t\ttest_cases\n\t\t\t\t\t.sort_by { |x| x.issue.subject }\n\t\t\t\t\t.collect { |tc| tc.to_json(context, version, environment) }\n\t\t\t),\n\t\t\t'type' => 'suite'\n\t\t}\n\tend", "def available_codes\n case @coding_klass.to_s\n when 'CodingBudget', 'CodingSpend'\n @activity.class.to_s == \"OtherCost\" ? OtherCostCode.roots : Code.for_activities.roots\n when 'CodingBudgetCostCategorization', 'CodingSpendCostCategorization'\n CostCategory.roots\n when 'CodingBudgetDistrict', 'CodingSpendDistrict'\n @activity.locations\n when 'HsspBudget', 'HsspSpend'\n @activity.class.to_s == \"OtherCost\" ? [] : HsspStratObj.all + HsspStratProg.all\n else\n raise \"Invalid coding_klass #{@coding_klass.to_s}\".to_yaml\n end\n end", "def to_json(options={})\n\t\t\tJSON::pretty_generate(@results.map{|entry| { :vtresult => entry } })\n\t\tend", "def areas_json\n @json = {}\n @json[:id] = self.id\n @json[:country] = self.name\n @json[:country_lat] = self.lat\n @json[:country_lon] = self.lon\n\n @json[:iccas] = []\n self.sites.each do |site|\n site_details = {}\n site_details[:name] = site.name\n site_details[:url] = \"/sites/\" + site.id.to_s\n site_details[:lat] = site.lat\n site_details[:lng] = site.lon\n @json[:iccas] << site_details\n end\n return @json\n end", "def results\n [\n { name: 'Building Services Design Technician', level: 3, providers: 12 },\n { name: 'Building Services Design Engineer', level: 6, providers: 8 },\n { name: 'Vehicle Body and Paint: Body Building', level: 3, providers: 16 },\n { name: 'Construction Building: Trowel Occupations', level: 2, providers: 3 },\n { name: 'Construction Building: Trowel Occupations', level: 3, providers: 22 },\n { name: 'Building Services Engineering Technology and Project Management Technician', level: 3, providers: 2 },\n { name: 'Construction Building: Maintenance Operations', level: 2, providers: 18 },\n { name: 'Construction Building: Woodmachining', level: 2, providers: 44 },\n { name: 'Construction Site Engineering Technician', level: 4, providers: 12 },\n { name: 'Marine Engineer', level: 3, providers: 1 }\n ]\n end", "def get_parsed_rules\n items=InfoParserRule.where(:id_info_source=>params[:id_info_source],:operation=>params[:operation],:kind=>params[:kind])\n render :json=>items\n end", "def print_json(formulae)\n services = formulae.map do |formula|\n formula.slice(*JSON_FIELDS)\n end\n\n puts JSON.pretty_generate(services)\n end", "def json()\n tmp = @plan_ir.map {|plan| plan.json()}\n @tiles = @plan_ir.empty? ? {} : @plan_ir[0].tiles.merge(*@plan_ir[1..].map{|ir|ir.tiles})\n tmp\n end", "def create_subjects_json(subject_list)\n subjects_json = []\n subject_list.each do |subj|\n subjects_json << subj.as_json\n end\n { 'subjects' => subjects_json }.to_json\nend", "def as_json(opts={})\n { experiment_name => {\n started_at: started_at,\n paused_at: paused_at,\n stopped_at: stopped_at,\n winner: winner.try(:name),\n variants: variants.map(&:as_json).reduce({}) { |r,v| r.merge!(v) },\n } }\n end", "def algorithms\n get_info :algorithms\n end", "def types\n aux = WorkOrderType.by_name\n render json: serialized_work_order_types(aux)\n end", "def parse_gherkin_to_json\r\n feature_file_name.each do |file_name|\r\n string_file = file_name.to_s\r\n io = StringIO.new\r\n formatter = Gherkin::Formatter::JSONFormatter.new(io)\r\n parser = Gherkin::Parser::Parser.new(formatter)\r\n #path = File.expand_path(string_file)\r\n parser.parse(IO.read(string_file), string_file, 0)\r\n formatter.done\r\n self.feature_json = MultiJson.dump(MultiJson.load(io.string), :pretty => true)\r\n get_scenario_details\r\n end\r\n\r\n end", "def get_mappings\n mappings = <<~JS\n {\n \\\"properties\\\": {\n JS\n last_index = @headers.length - 1\n @headers.each_with_index do |field, index|\n mappings+= <<-JS\n \\\"#{field}\\\": {\n \"type\": \"text\",\n \"fields\": {\n \"keyword\": {\n \"type\": \"keyword\",\n \"ignore_above\": 256\n }\n }\n }#{index == last_index ? \"\" : \",\"}\n JS\n end\n mappings+= <<~JS\n }\n }\n JS\n mappings\n end", "def as_json(options = nil)\n granularity.as_json(options)\n end", "def diagnosis_name_list\n\t\tdiagnose = current_user.diagnose\n\t\tif diagnose.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {diagnose: diagnose.collect(&:name).as_json } },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Diagnosis are not present\" },:status=> 203\n\t end \n\tend", "def describe\n as_json(only:\n %i[\n type uuid slug name_translations\n name_plural_translations comment default_value primary\n required unique options display_in_list display_in_public_list\n ]\n ).merge(allows_multiple? ? as_json(only: [:multiple]) : {})\n end", "def get_library_functions_list\n library_functions = []\n @indexes.each do |index|\n library_functions += JSON.parse(IO.read(@feature_dir + \"/library_calls/#{index.to_s}.json\")).keys\n end\n library_functions.uniq\n end", "def get_list_defender_facilities\n unit_report = []\n unit_report << \"Auflistung der Anlagen: \"\n @defender_facilities.each do |instances|\n unit_report << instances.facility.name\n unit_report << instances.count\n end\n return unit_report\n end", "def rule_js\n @rules.collect { |sel, js| behaviour_rule(sel, js) }.join(\",\\n\")\n end", "def jorc_codes\n return jorc_reserves.merge(jorc_resources)\n end", "def class_json\n clazz = @offering.clazz\n section = clazz.section && clazz.section.length > 0 ? clazz.section : nil\n section = section ? \" (#{section})\" : \"\"\n {\n name: clazz.name + section,\n students: @students\n .sort_by { |s| \"#{s.last_name} #{s.first_name}\".downcase }\n .map { |s| student_json(s) }\n }\n end", "def capabilities\n @capabilities ||= @data[\"data\"].keys.select do |cap|\n cats = @data[\"data\"][cap][\"categories\"]\n cats.any?{|cat| cat =~ /CSS/ }\n end.sort\n end", "def filter_suggestionsInvestingDotCom\r\n @suggestionsFromInvestingDotCom = @@SJA.select(\"stocks.isin, name, last_price, investing_dotcomrating\").where(\"investing_dotcomrating = ?\", true).order(:name)\r\n render json: @suggestionsFromInvestingDotCom\r\n end", "def get_available_types_from_usage(usage) #TODO: Research use\n return @client.raw(\"get\", \"/helpers/available-types/#{usage}\")\n end", "def index\n @specification_types = SpecificationType.all.order(\"display_order\")\n\n render json: @specification_types, each_serializer: Web::V1::SpecificationTypeSerializer\n end", "def to_json\n @declarations\n end", "def to_json\n JSON.generate(__to_json_map__)\n end", "def to_json\n JSON.generate(__to_json_map__)\n end", "def to_json\n JSON.generate(__to_json_map__)\n end", "def to_json\n JSON.generate(__to_json_map__)\n end", "def as_json(options = {})\n arrange_as_json\n end", "def to_json\n options.collect {|k, v| \"\\\"#{k}\\\":#{v.is_a?(Array) ? \"[{#{v.collect(&:to_json).join('},{')}}]\" : \"{#{v.to_json}}\"}\"}.join(',')\n end", "def list_ideas\n json_out(Idea.all)\n end", "def list_ideas\n json_out(Idea.all)\n end", "def list_ideas\n json_out(Idea.all)\n end" ]
[ "0.57587445", "0.5664733", "0.5617856", "0.561148", "0.5589906", "0.55422795", "0.5527791", "0.54873717", "0.54434013", "0.543456", "0.53609455", "0.532469", "0.531598", "0.52815884", "0.526973", "0.5260005", "0.5223884", "0.5221041", "0.52137494", "0.520938", "0.5200898", "0.5183504", "0.5160924", "0.5130198", "0.5130198", "0.51279473", "0.5117916", "0.5117614", "0.5099844", "0.5094622", "0.5091095", "0.50862414", "0.508209", "0.5079857", "0.50708115", "0.5065473", "0.5062087", "0.50607353", "0.50556856", "0.5039369", "0.5038136", "0.5036583", "0.5027868", "0.50173116", "0.50108206", "0.5008487", "0.5008179", "0.5005962", "0.5000871", "0.49989703", "0.49977246", "0.4995936", "0.4993099", "0.49839306", "0.49740523", "0.49736598", "0.4969874", "0.49691308", "0.4968399", "0.49677014", "0.4961584", "0.4960759", "0.49574995", "0.49562636", "0.49506772", "0.49503052", "0.49485624", "0.49481288", "0.49421275", "0.4935879", "0.4933081", "0.49313214", "0.49280524", "0.4920509", "0.49199918", "0.49198616", "0.4911411", "0.49096048", "0.49061084", "0.49034658", "0.49025875", "0.4900842", "0.48978028", "0.48964345", "0.4893211", "0.4884243", "0.48792315", "0.4869531", "0.48674694", "0.4864172", "0.48639983", "0.48610085", "0.48610085", "0.48610085", "0.48610085", "0.48599344", "0.4857988", "0.48560056", "0.48560056", "0.48560056" ]
0.55995506
4
Gives information about a certain use case
def show @use_case = UseCase.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @use_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n \"hello from EolScenarios#info\"\n end", "def usage\n self.class.const_get(:USAGE)\n end", "def test_info(project_name, plan_name, test_case_name)\n test_plan_id = test_plan_id(project_name, plan_name)\n test_cases = test_cases_for_test_plan(test_plan_id)\n\n test_cases.values.find do |test_case|\n test_case[:name] == test_case_name\n end\n end", "def details\r\n\t\treturn @feature + \". \" + @real_need.details\r\n\tend", "def display_usage\n end", "def info; end", "def info; end", "def get_info()\n\t\tputs \"This information report is about #{@name}.\"\n\t\tif (@sex == \"male\") || (@sex == \"Male\") || (@sex == \"M\")\n\t\t\tputs \"He is #{@age} years old.\"\n\t\t\tputs \"He is a #{@occupation}.\"\n\t\telse\n\t\t\tputs \"She is #{@age} years old.\"\n\t\t\tputs \"She is a #{@occupation}.\"\n\t\tend\n\tend", "def purpose\n end", "def usage; end", "def usage; end", "def details; end", "def info\n fill_usage_info\n end", "def purpose\n \"Intern seeking #{category_name.capitalize} position\"\n end", "def describe_type\n puts \"I am a #{type} type of Bees Wax\"\nend", "def description\n \"Whois lookup\"\nend", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def info\n\tend", "def about\n\t\tputs \"Make: \" + @make\n\t\tputs \"Model: \" + @model\n\t\tputs \"Miles: \" + @miles.to_s\n\t\tputs \"Type: \" + @type\n\t\tputs \"Color: \" + @color\n\t\tputs \"Year: \" + @year.to_s\n\t\tif @used\n\t\t\tputs \"The #{@make} #{@model} is used.\"\n\t\telse\n\t\t\tputs \"The #{@make} #{@model} is new\"\n\t\tend\n\tend", "def describe_type\n puts \"I am a #{type} of Bees Wax\"\n end", "def info\n str = <<INFO\nScenario: #{ name }\nSummary: #{ summary }\nDescription: #{ description_without_summary }\nINFO\n variables.each do |key, value|\n str << \"#{ key }: #{ value.inspect }\\n\"\n end\n str\n end", "def print_usage; end", "def info\n raise \"Not yet implemented\"\n end", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def usage\n puts @usage_text\n end", "def get_info\n @output = \"Voter, #{@name}, #{@politics}\"\n end", "def info\n if feature_name = args.shift\n feature_name = feature_name.downcase.strip\n else\n error(\"Usage: heroku labs:info FEATURE\")\n end\n feature = heroku.get_feature(app, feature_name)\n display \"=== #{feature['name']}\"\n display \"Summary: %s\" % feature[\"summary\"]\n display \"Docs: %s\" % feature[\"docs\"]\n end", "def informational?; end", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def so_desc(feature)\n if hash = @data[feature]\n return hash[\"so_desc\"]\n end\n end", "def purpose\n labware.plate_purpose\n end", "def info()\n #This is a stub, used for indexing\n end", "def usage\n return @usage\n end", "def details(*args); end", "def overview\n case id\n when \"CDN-REALESTATE\"\n \"ETFs that provide exposure to the Canadian Real Estate market - broadly distributed across the country.\"\n when \"COMMODITIES\"\n \"ETFs that provide exposure to various commodities - generally considered as input to a growing economy.\"\n when \"US-LGCAP-STOCK\"\n \"ETFs that provide exposure to the equity of large, U.S. based companies.\"\n when \"US-LONG-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with long maturities.\"\n when \"INTL-REALESTATE\"\n \"ETFs that provide exposure to the International Real Estate market - broadly distributed across the globe.\"\n when \"US-REALESTATE\"\n \"ETFs that provide exposure to the U.S. Real Estate market - broadly distributed across the country.\"\n when \"US-SHORT-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with short maturities.\"\n when \"CDN-LONG-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with long maturities.\"\n when \"CDN-SHORT-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with short maturities.\"\n when \"US-SMCAP-STOCK\"\n \"ETFs that provide exposure to the equity of smaller U.S. based companies.\"\n when \"INTL-BOND\"\n \"ETFs that provide exposure to International Government & Corporate debt, with varying maturities.\"\n when \"US-SHORT-GOVT-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with shorter maturities.\"\n when \"US-MED-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with medium maturities.\"\n when \"CDN-STOCK\"\n \"ETFs that provide exposure to the equity of Canadian companies.\"\n when \"US-MED-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with medium maturities.\"\n when \"EMERG-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in countries classified as Emerging Markets.\"\n when \"US-LONG-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with longer maturities.\"\n when \"INTL-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in Europe, Asia and the Far East (EAFE).\"\n else\n raise \"Asset class overview not prepared.\"\n end\n end", "def facility; end", "def get_info\n puts \"#{@title} by #{@author} is #{@status}.\"\n if @description\n puts \"#{@title} description: #{@description}.\"\n end\n end", "def about\r\n\t\tputs \"Gender: #{@gender}\"\r\n\t\tputs \"ethnicity: #{@ethnicity}\"\r\n\t\tputs \"reindeer_ranking: #{@reindeer_ranking}\"\r\n\t\tputs \"age: #{@age}\"\r\n\tend", "def details\n end", "def details\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_shake.details \n\tend", "def details\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_shake.details \n\tend", "def details\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_shake.details \n\tend", "def purpose\n return nil unless metadata.purpose\n\n metadata.purpose.to_s[0].upcase\n end", "def show_use_case\n find_user\n if !@user.nil?\n assign_project\n @req=Requirement.find_by_id(params[:req])\n if !@req.nil?\n @req_use_cases=@req.use_cases.find(:all, :order => \"updated_at desc\")\n session[:req_id]=@req.id\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n format.html { render \"use_cases/index\" }\n end\n else\n redirect_to requirments_path\n end\n\n else\n redirect_to sign_in_url\n end\n\n end", "def maintenance_help\n puts \"Valid maintenance types are:\"\n Spinneret::Maintenance.constants.each { |cls| puts \" #{cls.to_s}\" }\n puts \"Note that capitalization *is* important and that Opportunistic is\"\n puts \"note a valid maintenance mode by itself.\"\nend", "def my_info\r\n end", "def get_info\n \"here is some info on#{self.name}: #{self.about}\"\n end", "def info\n title + \" (\" + genotype_info + ' / ' + phenotype_info + ')'\n end", "def purposes\n Purpose.all.each_with_index do |purpose, i|\n puts \"#{i + 1}. #{purpose.name}\"\n end\n\n puts \"\\nType the number of the purpose to see a list of associated crystals.\"\n puts \"To go back, type 'menu'.\\n\\n\"\n\n input = gets.strip.downcase\n if input == 'menu'\n elsif input.to_i > 0 && (input.to_i - 1) < Purpose.all.length\n index = input.to_i - 1\n p = Purpose.all[index]\n # Show list of crystals for a given purpose\n Purpose.crystals(p).each_with_index do |crystal, i|\n puts \"#{i + 1}. #{crystal.name}\"\n end\n\n puts \"\\nTo learn more about a crystal, type the number.\"\n input = gets.strip.downcase\n if input.to_i > 0 && (input.to_i - 1) < Purpose.crystals(p).length\n index = input.to_i - 1\n crystal = Purpose.crystals(p)[index]\n # Show info for given crystal\n crystal_info(crystal)\n end\n else\n puts 'Try one of these options:'\n purposes\n end\n end", "def nature; end", "def show\n @code_case = @code_solution.code_case\n end", "def info() quiz_question.info end", "def about_us; end", "def show_info()\n\t\tputs \"ID: #{@@id}\"\n\t\tputs \"Name: #{@car_name}\"\n\t\tputs \"Make: #{@@make}\"\n\t\tputs \"Cost: #{calc_total_cost} INR\"\n\t\tputs\n\t\tputs \"Review: #{@review}\"\n\t\tputs \"Rating: #{@rating} stars\"\n\tend", "def details\n\n end", "def info\n return \"My name is #{@name}, I am #{@age} years old, and my callsign is #{@callsign}.\"\n end", "def details(vehicle_type)\n \"Your #{vehicle_type} is #{model} is #{color} colour and it is a #{year} model and is #{how_old} years old.\"\n end", "def strategy_name; end", "def explain_application_info(org_text)\n retval = {} # Default\n return retval unless org_text\n\n if org_text.match('Application = ')\n appl = SyspApplication.get_cached_instance(org_text.split(' ')[2].to_i)\n if appl\n retval[:short_info] = appl.name\n retval[:long_info] = \"#{appl.description} >> Team: #{appl.developmentteam.name}\"\n else\n retval[:short_info] = \"Application not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_WSMethod = ')\n ws = Wsmethod.get_cached_instance(org_text.split(' ')[2].to_i)\n if ws\n retval[:short_info] = ws.name\n retval[:long_info] = \"#{ws.name}\"\n else\n retval[:short_info] = \"WSMethod not found for #{org_text}\"\n end\n end\n\n if org_text.match('ID_OFMsgType = ')\n mt = Ofmessagetype.get_cached_instance(org_text.split(' ')[2].to_i, session[:database].hash)\n if mt\n retval[:short_info] = mt.name\n retval[:long_info] = \"#{mt.description} >> Domain: #{mt.domain.name}\"\n else\n retval[:short_info] = \"OFMessagetype not found for #{org_text}\"\n end\n end\n\n\n\n retval\n end", "def describe\n # TODO\n end", "def get_info_of_funcname(_func_name)\n\t\t@vulnerability.get_info_of_funcname(_func_name)\n\tend", "def get_info_of_funcname(_func_name)\n\t\t@vulnerability.get_info_of_funcname(_func_name)\n\tend", "def inspect_details\n\t\tif self.from_aspect\n\t\t\treturn \"Chione::Archetype from %p\" % [ self.from_aspect ]\n\t\telsif !self.components.empty?\n\t\t\treturn \"Chione::Archetype for creating entities with %p\" % [ self.components.keys ]\n\t\telse\n\t\t\treturn \"blank Chione::Archetype\"\n\t\tend\n\tend", "def which_suite()\n ret_val = case suite\n when \"H\" then \"Heart\"\n when \"C\" then \"Club\"\n when \"D\" then \"Diamond\"\n when \"S\" then \"Spades\"\n end\n ret_val\n end", "def appropriate_tool_name\n case name\n when \"Ore Vein\"\n \"Pickaxe\"\n when \"Seeds\"\n \"Plow\"\n when \"Wild Game\"\n \"Traps\"\n when \"Cattle\"\n \"Lasso\"\n end\n end", "def _test_details(test)\n suite_name = test.category\n test_name = test.name\n test_description = test.description\n test_name_key = \"[#{test_name}] #{test_description}\"\n\n [suite_name, test_name_key]\n end", "def get_info \n \"The #{@model} bike has #{@wheels} wheels and is going #{@current_speed} mph.\"\n end", "def get_info\n @output = \"Politician, #{@name}, #{@party}\"\n end", "def details\n\t\treturn @feature + \". \" + @real_shake.details\n\tend", "def show_info\n run('show info')\n end", "def identify_class(obj)\n puts case obj.class\n when Hacker\n \"It's a Hacker!\"\n when Submission\n \"It's a Submission!\"\n when TestCase\n \"It's a TestCase!\"\n when Contest\n \"It's a Contest!\"\n else\n \"It's an unknown model\"\n end\nend", "def type\n 'Test Case'\n end", "def performance(index)\n puts \"\\n#{@testcase.name}\\n\"\n puts \" %-10s %-20s %-8s %s \" % [\"#{@response.runtime.to_s[0..6]}s\", \"[#{result_case}]\", @testcase.request['method'], @response.fully_qualified_path]\n end", "def veteran_info; end", "def about_us\n # it's deliberate that there's no code in here... but we should have a helpful error when we request the URL again\n end", "def details\n\t\treturn @feature + \". \" + @real_donation.details\n\tend", "def about\n raise NotImplementedError, 'this should be overridden by concrete sub-class'\n end", "def info\n \"Car with make of #{make}, #{model}, was made in #{year} and is #{color}\"\n end", "def cases()\n \n end", "def look_at(thing) # object\n case thing\n when Location\n puts \"You stand in a #{thing.descriptor}, #{thing.description}\"\n when Entity\n puts \"You see #{thing.full_name}. They're a #{thing.type}!\"\n else\n puts \"You can't see that thing.\"\n end\n puts ''\n end", "def what_is\n end", "def test_getMethodUsage\n info_srv = @adwords.get_service(13, 'Info')\n start_day = Date.new(Date.today.year, 1, 1)\n end_day = Date.today\n usage_map = info_srv.getMethodUsage(start_day, end_day)\n\n # Did we get back a hash?\n assert_instance_of(Hash, usage_map,\n \"Unexpected object type returned: #{usage_map.class}\")\n\n # Retrieve list of all operation rates\n op_rates = AdWords::Utils.get_operation_rates\n\n # Check if the operations in the rates match the operations in the usage map\n op_rates.each do |line|\n service, name = line\n operation = \"#{service}.#{name}\"\n assert_not_nil(usage_map[operation],\n \"Operation missing from usage map: #{operation}\")\n end\n end", "def printUsage\n puts \"Usage: cities.rb City1 City2 City3 City4 City5\"\t \nend", "def details\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_donation.details \n\tend", "def details\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_donation.details \n\tend", "def details\n \"sugar: #{@sugar} / butter: #{@butter}\"\n end", "def details\n data()\n end", "def usage\n basename = File.basename($0)\n necessary_inputs = \"<omsadmin_conf> <cert> <key> <pid> <proxy> <os_info> <install_info>\"\n print(\"\\nTelemetry tool for OMS Agent\\n\"\\\n \"ruby #{basename} #{necessary_inputs}\\n\"\\\n \"\\nOptional: Add -v for verbose output\\n\")\nend", "def purposes\n object.relevant_purposes ? object.relevant_purposes.collect{ |tp| {name: tp.name, code: tp.code}} : []\n end", "def call(visit_info)\n cases = []\n visit_info.each do |(url, views)|\n begin\n this_case = Case.friendly.find(url.split('/').last)\n cases << [this_case, views]\n rescue ActiveRecord::RecordNotFound\n end\n end\n cases\n end", "def info(input)\n get_method(:info, input)\n end", "def info(value); end", "def about\n\t\tputs \"Gender: #{@gender}\"\n\t\tputs \"Ethnicity: #{@ethnicity}\"\n\t\tputs \"Age: #{@age}\"\n\t\tp \"Reindeer Ranking: #{@reindeer_ranking}\"\n\tend", "def info(input)\n get_method(:info, input)\n end", "def get_infos\n #detail = Info.find_by_status(true).detail\n #if detail \n # return detail\n #else\n # return \"wating for updatting.....\"\n #end\n info = Info.random_to_show_info\n return info.detail\n\n end" ]
[ "0.6243129", "0.62389857", "0.619952", "0.6179162", "0.6173462", "0.6150124", "0.6150124", "0.6117044", "0.61004406", "0.6063843", "0.6063843", "0.606215", "0.59914446", "0.59792864", "0.5946084", "0.5901922", "0.5897214", "0.5897214", "0.5897214", "0.58617914", "0.5857531", "0.5854844", "0.58303076", "0.5829957", "0.58228666", "0.5782855", "0.5782855", "0.5782855", "0.5781803", "0.576166", "0.5755531", "0.57519263", "0.5743404", "0.57380193", "0.5735499", "0.5727783", "0.57227343", "0.5699436", "0.56956816", "0.567573", "0.56700754", "0.5619258", "0.5604813", "0.5593417", "0.5593417", "0.5593417", "0.5583805", "0.55835944", "0.5569852", "0.5549384", "0.55326724", "0.55249304", "0.5523878", "0.55223984", "0.55128706", "0.5511982", "0.5505034", "0.5488565", "0.54785484", "0.5476276", "0.5475488", "0.5470503", "0.5462981", "0.5460901", "0.5455671", "0.5455671", "0.5451337", "0.54488385", "0.5447563", "0.5438248", "0.5433821", "0.5420575", "0.54106855", "0.54106754", "0.54028744", "0.5394388", "0.53888214", "0.5388423", "0.53866065", "0.53728235", "0.53672874", "0.5364341", "0.53599745", "0.535778", "0.5357047", "0.533609", "0.53336716", "0.5332022", "0.5332022", "0.53257656", "0.53188086", "0.53136426", "0.53125167", "0.5311372", "0.5310655", "0.5309419", "0.5305731", "0.5304354", "0.5297158" ]
0.55803376
49
Gives the template for creating a new use case
def new @use_case = UseCase.new @use_case.project = Project.find(params[:project_id]) @use_case.use_case_group_id = params[:group_id] respond_to do |format| format.html # new.html.erb format.json { render json: @use_case } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_template\n self.template = \"template 14231\"\n end", "def template(name); end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template_name; end", "def template_name; end", "def template(arg=nil)\n set_or_return(:template, arg, :kind_of => String, :required => true)\n end", "def template\n with_template_factory do |template_factory|\n template = template_factory.build('Test', {})\n puts Graphics::Debugger.new(template).debug\n end\n end", "def set_template\n end", "def template\n\t\t\t@signature[:templates][@action_name]\n\t\tend", "def create_default_templates\n UseCaseTemplate.create_default self\n end", "def add_create(kind, template)\n id = \"#{kind}.create\"\n transitions = {\n save: \"#{kind}.view\",\n cancel: \"#{kind}.list\",\n }\n add_display(Create.new(kind, id, template, transitions))\n end", "def UseCase( name )\n return UseCase.new name\nend", "def template\n @template\n end", "def create\n # scrub this template input\n if template = scenario_params[\"template\"]\n @scenario = YmlRecord.load_yml(\"scenarios/local/#{template}/#{template}.yml\")\n else\n @scenario = Scenario.new(scenario_params)\n end\n\n @scenario.user_id = current_user.id\n @scenario.save!\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render :show, status: :created, location: @scenario }\n else\n format.html { render :new }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def resource_template(name)\n \"#{resource}_#{name}\"\n end", "def template_for_options(opts = {})\n type = opts[:template_type] || 'log'\n if opts[:\"template-raw\"]\n Support::RawERbTemplate.new(opts[:\"template-raw\"])\n elsif opts[:template].is_a?(Support::Template)\n opts[:template]\n else\n template = opts[:template]\n template = \"default-#{type}\" if template.nil? || template.to_s == \"default\"\n Support::Template['mercurial', template]\n end\n end", "def template\n Kernel.const_get(template_name.upcase << '_TEMPLATE')\n end", "def determine_template(options); end", "def template_name=(_arg0); end", "def template_name=(_arg0); end", "def default_codaveri_test_case_template\n {\n id: '',\n type: 'expression',\n timeout: '',\n prefix: '',\n expression: '',\n display: 'str(out)'\n }\n end", "def get_template(template); end", "def generate_template()\n\n file_name = @hostname + '.tf'\n check_file_exists(file_name)\n template_path = determine_role()\n\n template = File.read(template_path)\n renderer = ERB.new(template, nil, '-')\n open(file_name, 'w') { |f|\n \tf.puts renderer.result(self.get_binding)\n f.close\n }\n\n end", "def use_template(name)\n call \"_#{name}\"\n end", "def new\n @template = @question.template\n end", "def template_for(action, resource)\n\t\t\t\"#{resource.gsub(\" \",\"_\")}/#{action}\"\n\t\tend", "def template\n @template ||= Template.new name: script_name, out_file: root_ruby_file, type: type\n end", "def create(attrs)\n if attrs.has_key? :description\n warn \"Fogbugz Case does not handle description\"\n end\n\n options = translate attrs,\n :title => :sTitle,\n :priority => :ixPriority,\n :assignee => :ixPersonAssignedTo,\n :project_id => :ixProject\n\n new_case = api.command(:new, options)\n\n options.merge!(:ixBug => new_case[\"case\"][\"ixBug\"])\n\n self.new options\n end", "def template(name)\n File.join TemplatePath, \"#{name}.rb\"\nend", "def t\n @template\n end", "def creation #wizard will be able to create objects, his proficiency is based on the skill level he has in this type of magic\r\n \r\n end", "def generate\n\t\ttemplate('service.tt', \"lib/services/#{name.underscore}_service.rb\")\n\tend", "def template_from_params\n case params[:view]\n when 'scouts'\n 'scouts'\n else\n 'liiikes'\n end\n end", "def new\n @use_case = UseCase.new\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\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 generate(label)\n package = Package.new\n package.load!\n filename = File.join(package.operations_dir, package.operation_name(label))\n template('operation.rb.erb', filename)\n\n rescue Package::MetadataNotFound\n say \"#{package.script_path} not found\", :red\n say \"You may want to create a new sysops project first\"\n exit 1\n end", "def setting_template_key\n if journal_task_type\n \"TaskTemplate:#{journal_task_type.kind}\"\n else\n \"TaskTemplate:#{card.name}\"\n end\n end", "def create\n file = Tempfile.new(\"onetemplate-#{resource[:name]}\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.MEMORY resource[:memory]\n xml.CPU resource[:cpu]\n xml.VCPU resource[:vcpu]\n xml.DESCRIPTION do\n resource[:description]\n end if resource[:description]\n xml.OS do\n resource[:os].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:os]\n resource[:disks].each do |disk|\n xml.DISK do\n disk.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:disks]\n resource[:nics].each do |nic|\n xml.NIC do\n nic.each do |k, v|\n xml.send(k.upcase, v)\n end\n end\n end if resource[:nics]\n xml.GRAPHICS do\n resource[:graphics].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:graphics]\n xml.FEATURES do\n resource[:features].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:features]\n xml.CONTEXT do\n resource[:context].each do |k, v|\n xml.send(k.upcase, v)\n end\n end if resource[:context]\n end\n end\n tempfile = builder.to_xml\n file.write(tempfile)\n file.close\n self.debug \"Creating template using #{tempfile}\"\n onetemplate('create', file.path)\n file.delete\n @property_hash[:ensure] = :present\n end", "def type\n 'Test Case'\n end", "def template\n\t\tSlim::Template.new(File.join(App.root, 'app', 'views', \"#{self.name}\", \"#{self.action}.slim\"))\n\tend", "def new\n @policy_template = PolicyTemplate.new\n end", "def template\n @template ||= Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type, :security_groups => @security_groups})\n end", "def templates; end", "def new\n\t\t\"let's make something new.\"\n\tend", "def create_controller\n template \"controller.rb\", controller\n end", "def create_new\n render \"create_new\"\n end", "def template\n if @client ==\"ORBOGRAPH\" || @client == \"ORB TEST FACILITY\"\n IO.read(File.dirname(__FILE__) + '/templates/' + organization_name.downcase.gsub(' ','_') + '_'+@batch_type+'_template.xml.erb')\n else\n IO.read(File.dirname(__FILE__) + '/templates/' + organization_name.downcase.gsub(' ','_') + '_template.xml.erb')\n end\n end", "def new_for_creating_stack\n infra_id = params.require(:infrastructure_id)\n\n histories = CfTemplate.for_infra(infra_id)\n # TODO: 変数名変えたほうがいいんじゃ\n globals = CfTemplate.global\n\n render json: {\n histories: histories,\n globals: globals,\n } and return\n end", "def _template\n @template\n end", "def template_name\n \"#{self.class.name.split('::').last.underscore}.json.jbuilder\"\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 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\n # USELESS\n end", "def create\n # USELESS\n end", "def initialize (template); @template = template; end", "def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end", "def template\n return @template\n end", "def create_easy_type_source\n create_source(TYPE_TEMPLATE, type_path)\n end", "def new\n render(\n :new,\n layout: false,\n locals: local_vars.merge(\n all_clinics: Renalware::Pathology::Clinic.for_algorithm,\n all_consultants: Renalware::Pathology::Consultant.ordered,\n all_templates: Renalware::Pathology::Requests::Request::TEMPLATES\n )\n )\n end", "def initialize_template(record)\n\n end", "def template\n @__template\n end", "def template\n @template ||= self.class.template\n end", "def initialize(testing_template = TestingTemplate.new)\n @testing_template = testing_template\n end", "def notemplate\n @title = 'Welcome to ViziCRM!'\n \n return 'There is no template associated with this action.'\n end", "def template_path() 'demo/admin/billing.erb' end", "def create_from_funder_requirements\n plan = ::Plan.new\n authorize plan\n\n # If the template_id is blank then we need to look up the available templates and\n # return JSON\n if plan_params[:template_id].blank?\n # Something went wrong there should always be a template id\n respond_to do |format|\n flash[:alert] = _('Unable to identify a suitable template for your plan.')\n format.html { redirect_to new_plan_path }\n end\n else\n @plan = create_plan(plan: plan, params: plan_params)\n\n if @plan.is_a?(Plan)\n default = ::Template.default\n\n msg = \"#{success_message(@plan, _('created'))}<br />\"\n\n if !default.nil? && default == @plan.template\n # We used the generic/default template\n msg += \" #{_('This plan is based on the default template.')}\"\n\n elsif !@plan.template.customization_of.nil?\n # We used a customized version of the the funder template\n # rubocop:disable Layout/LineLength\n msg += \" #{_('This plan is based on the')} #{@plan.funder&.name}: '#{@plan.template.title}' #{_('template with customisations by the')} #{@plan.template.org.name}\"\n # rubocop:enable Layout/LineLength\n else\n # We used the specified org's or funder's template\n msg += \" #{_('This plan is based on the')} #{@plan.template.org.name}: '#{@plan.template.title}' template.\"\n end\n\n respond_to do |format|\n flash[:notice] = msg\n format.html { redirect_to plan_path(@plan) }\n end\n else\n # Something went wrong so report the issue to the user\n respond_to do |format|\n flash[:alert] = failure_message(plan, _('create'))\n format.html { redirect_to new_plan_path }\n end\n end\n end\n end", "def template(template = nil)\n $template ||= template\n $template || '{{id}} {{name}}'\n end", "def cfn_template\n @_cfn_template ||= \\\n begin\n if stack_type\n send(\"cfn_template_#{stack_type}\")\n else\n cfn_template_guess || fail_task('cannot find template')\n end\n end\n end", "def h\n @template\n end", "def template_for(file); end", "def template_name\n command.text_value\n end", "def new\n if params[:type]\n @content_template = params[:type].constantize.create\n else\n @content_template = ContentTemplate.create\n end\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @content_template }\n end\n end", "def manual_review_needed_template\n 'manual_review_needed'\n end", "def createtemplate\r\n\t\t chars_num = @secretword.length\r\n\t\t line = \"\"\r\n\t\t line_char = \"_\"\r\n\t\t while chars_num > 0 do\r\n\t\t \tline += line_char\r\n\t\t \tchars_num -= 1\r\n\t\t end\r\n\t\t templ = \"[#{line}]\"\r\n\t\t return templ\r\n\t\t end", "def generate_request_spec\n template 'request_spec.rb', File.join('spec/requests', \"#{name.underscore.pluralize}_spec.rb\")\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 template(*args)\n Template.new(*args)\n end", "def scaffold_plan\r\n scaffold_template if @template.nil?\r\n\r\n @plan = Plan.new(template: @template, title: 'Test Plan', grant_number: 'Grant-123',\r\n principal_investigator: 'me', principal_investigator_identifier: 'me-1234',\r\n description: \"this is my plan's informative description\",\r\n identifier: '1234567890', data_contact: 'me@example.com', visibility: :privately_visible,\r\n roles: [Role.new(user: User.last, creator: true)])\r\n\r\n assert @plan.valid?, \"unable to create new Plan: #{@plan.errors.map{|f, m| f.to_s + ' ' + m}.join(', ')}\"\r\n @plan.save!\r\n end", "def UseCaseDiagram( options={}, &block )\n # options :name => \"Name of the Diagram\"\n $name = \"#{$name}\\n#{options[:name]}\" if options.has_key? :name\n # first create internal model,\n # i.e. the <code> in the DSL is executed\n # UseCaseDiagram () do ...<code>... end is executed\n # thereby building the internal use case diagram representation\n block.call\n # display the model\n displayOpen options # display preamble, also provide specific options for the display\n displayUseCases $usecases # display all use cases\n displayLinks $usecases # display links between the use cases\n displayActors $actors # display actors and their links to use cases\n displayClose # display epilogue\nend", "def template_guide\n @title = \"Template Guide\"\n end", "def template(_template_name)\n \"This is a dummy template! <%= dummy %> \\n \"\\\n 'Here is a global value <%= dummy_global %>'\n end", "def h\n @template\n end", "def mccreate_campaign_template(type, opts)\n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", template_id: 198041, generate_text: true}, {})\n setup_mcapi.campaigns.create(type, opts, content = nil, segment_opts = nil, type_opts = nil) \n end", "def create_module\n template 'bpmn_module.rb.template', File.join(model_path, \"#{module_name.underscore}.rb\")\n end", "def template \n puts \"What will we return here?\"\nend", "def template\n Pathname.new(@template || OodPortalGenerator.root.join('templates', 'ood-portal.conf.erb'))\n end", "def create_model\n template 'model.rb', \"app/models/#{model_path}.rb\" unless @skip_model\n end", "def target_template()\n @target_template.dup\n end", "def tpl_name\n \"monit_check_#{new_resource.name}\"\n end", "def url_template; end", "def url_template; end", "def template\n Pathname.new(@template || OodPortalGenerator.root.join(\"templates\", \"ood-portal.conf.erb\"))\n end", "def component_template(component)\n component.id_handle(id: component[:ancestor_id]).create_object\n end", "def show_template\n self.template\n end", "def show_template\n self.template\n end" ]
[ "0.6776548", "0.676121", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.66630906", "0.6563741", "0.6563741", "0.63758725", "0.6287934", "0.6234758", "0.6178252", "0.61466783", "0.61085606", "0.60365236", "0.6014146", "0.60133374", "0.6002143", "0.5990587", "0.5983623", "0.59828115", "0.59808636", "0.59808636", "0.5968304", "0.5966919", "0.5964695", "0.5964103", "0.5959073", "0.5938485", "0.5937557", "0.5900248", "0.58976984", "0.5895533", "0.5871574", "0.583156", "0.58249927", "0.58213884", "0.581327", "0.5807572", "0.57962674", "0.57951003", "0.5781346", "0.5779561", "0.57788867", "0.5772663", "0.57671446", "0.5751757", "0.57446307", "0.5730185", "0.5729597", "0.5723405", "0.5722809", "0.5692018", "0.56762433", "0.56628", "0.56574154", "0.56574154", "0.56573397", "0.56559575", "0.56541854", "0.56434304", "0.56392807", "0.5632201", "0.5621126", "0.56194973", "0.5616867", "0.56144583", "0.5611048", "0.56053954", "0.56046665", "0.5601267", "0.5595776", "0.5580379", "0.5578033", "0.5574244", "0.5569382", "0.5569087", "0.556456", "0.55634415", "0.5561054", "0.5553584", "0.5552679", "0.5542545", "0.55416006", "0.55352473", "0.55343527", "0.5533101", "0.5509511", "0.5507825", "0.55000454", "0.5496591", "0.5496476", "0.5494322", "0.5494322", "0.5489877", "0.54897666", "0.54897314", "0.54897314" ]
0.0
-1
Gives the template for edit a use case
def edit @use_case = UseCase.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_form\n 'common_templates/edit_form'\n end", "def edit\n respond_to do |format|\n format.html { render :action => resource_template(\"edit\") }\n end\n end", "def edit_partial \n return 'edit_' + self.class.to_s.underscore\n end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit; end", "def edit\r\n render :edit\r\n end", "def edit\n @site.setup_template_capacities\n order_template_capacities\n respond_to { |format| format.html }\n end", "def edit\n render :edit\n end", "def edit\n render\n end", "def edit\n render\n end", "def edit\n template = Template.includes(:org, :phases).find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases.includes(sections: { questions: :question_options })\n .order('phases.number',\n 'sections.number',\n 'questions.number',\n 'question_options.number')\n .select('phases.title',\n 'phases.description',\n 'phases.modifiable',\n 'sections.title',\n 'questions.text',\n 'question_options.text')\n if template.latest?\n render 'container', locals: {\n partial_path: 'edit',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n else\n redirect_to org_admin_template_path(id: template.id)\n end\n end", "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "def edit_form\n\t\toptions = { :disabled => false, :show_all => true, :edit => true}\n\t\tform_template(options)\n\tend", "def edit\n # Renders the edit form\n end", "def template_path() 'demo/admin/billing.erb' end", "def edit\n\t\traise NotImplementedError, \"FIXME: Implement editing comments.\"\n\t\t#respond_to do |format|\n\t\t#\tformat.html # edit.html.erb\n\t\t#end\n\tend", "def get_field_edit_rtpl\n case @cal_type\n when'basic'\n return self.get_basic_edit_rtpl\n end\n end", "def edit\n #Nothing necessary\n end", "def edit\n raise NotImplementedError\n end", "def edit\r\n end", "def edit\n render partial: \"form\"\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\r\n \r\n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n \n end", "def edit\n # Reflection to get a class for the model name passed in.\n @dynamo_model = Kernel.const_get(params[:model_name])\n respond_to do |format|\n format.html # edit.html.erb\n end \n end", "def edit\n @title = t 'business_unit_type.edit_title'\n end", "def edit\n \n end", "def editing ; view.editing ; end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end", "def edit\n end" ]
[ "0.70181495", "0.67989075", "0.6718922", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65899473", "0.65275705", "0.64986306", "0.64868927", "0.6471125", "0.6471125", "0.64175165", "0.64133936", "0.64133936", "0.63682884", "0.6342201", "0.6341819", "0.6327395", "0.6318131", "0.6296568", "0.6277381", "0.62698036", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6268761", "0.6264509", "0.6246889", "0.6246889", "0.6246889", "0.6246889", "0.6246889", "0.6246889", "0.6246889", "0.6239124", "0.62376577", "0.6225054", "0.6224469", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117", "0.6219117" ]
0.65949523
3
Creates the information for a new use case
def create @use_case = UseCase.new(params[:use_case]) @use_case.project_id = params[:project_id] @project = Project.find(params[:project_id]) if @use_case.use_case_group_id.nil? then @use_case.use_case_group_id = params[:group_id] end @use_case.data = params[:data].to_json respond_to do |format| if @use_case.save format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case,:type => "step"), notice: 'Use case was successfully created.' } format.json { render json: @use_case, status: :created, location: @use_case } else format.html { render action: "new" } format.json { render json: @use_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n @use_case.hard_infos.last.save\n #--\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @use_case }\n format.json { render :show, status: :created, location: @use_case }\n else\n format.html { render :new }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attrs)\n if attrs.has_key? :description\n warn \"Fogbugz Case does not handle description\"\n end\n\n options = translate attrs,\n :title => :sTitle,\n :priority => :ixPriority,\n :assignee => :ixPersonAssignedTo,\n :project_id => :ixProject\n\n new_case = api.command(:new, options)\n\n options.merge!(:ixBug => new_case[\"case\"][\"ixBug\"])\n\n self.new options\n end", "def creation #wizard will be able to create objects, his proficiency is based on the skill level he has in this type of magic\r\n \r\n end", "def create\n\t\t@problem = AssignmentProblem.find_by_id(new_test_case_params[:assignment_problem_id])\n\t\t@test_case = TestCase.new(new_test_case_params)\n\t\t@test_case.input = new_test_case_params[:input]\n\t\t@test_case.output = new_test_case_params[:output]\n\t\t@test_case.assignment_problem_id = new_test_case_params[:assignment_problem_id]\n\t\tif lecturer_signed_in?\n\t\t\t@test_case.owner_id = current_lecturer.id\n\t\t\t@test_case.owner_type = \"lecturer\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@test_case.owner_id = current_teaching_assistant.id\n\t\t\t@test_case.owner_type = \"teaching assistant\"\n\t\t\t@test_case.assignment_problem_id = session[:assignment_problem_id]\n\t\tend\n\t\tif @test_case.save\n\t\t\tflash[:notice] = \"Your test case is now added\"\n\t\t\tredirect_to :controller => 'assignment_problems', :action => 'new',\n\t\t\t:id => session[:problem_assignment_id]\n\t\telse\n\t\t\trender :action=>'new', :assignment_id => @test_case.assignment_problem_id\n\t\tend\n\tend", "def UseCase( name )\n return UseCase.new name\nend", "def create\n @quote = Quote.find(params[:quote_id])\n @use_case = @quote.use_cases.build(params[:use_case])\n\n\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @quote, notice: 'Use case was successfully created.' }\n format.json { render json: @use_case, status: :created, location: @use_case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n realizarCostos\n end\n end", "def new\n @possible_Jobs = GeneralInfo.see_Jobs\n @templates = Template.uniq.pluck(:prof_name).sort\n @templates.unshift('Designer')\n @templates.unshift('Model')\n @templates.unshift('Photographer')\n @general_info = GeneralInfo.new\n end", "def create\n \n end", "def create_new_case(project_id,suite_id,sub_section_id,test_case)\n testrail_api_client.send_post(\"add_case/#{sub_section_id || suite_id}\",test_case_data(test_case))\n end", "def construct(provider)\n self.generate_resources_data(provider.id)\n self.generate_ingredients_data(provider.id)\n self.status = DeploymentRecommendation::UNEVALUATED\n self.save!\n end", "def create\r\n\r\n\r\n end", "def create_record attributes\n creator = @creator_class.new attributes, @context\n FactoryGirl.create @clazz.name.underscore.to_sym, creator.factorygirl_attributes\n end", "def create\n @use_case = UseCase.new(params[:use_case])\n\n respond_to do |format|\n if @use_case.save\n\n if params[:use_case].has_key?(:file) && params[:use_case][:file]\n @use_case.upload_main_asset(params[:use_case][:file])\n elsif params.has_key?(:file) && params[:file]\n @use_case.upload_main_asset(params[:file])\n end\n\n format.html { redirect_to @use_case, notice: 'Use case was successfully created.' }\n format.json { render json: @use_case, status: :created, location: @use_case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # I was not able to get this working. I suspected a change may have occurred in the API that hasn't been published to docs.\n # Used https://www.hurl.it/ to test requests to the API. Was getting a success response, but\n # never saw the newly created unit in either my SDK or in the stage environment. Could be in the DB but missing an attribute/flag that allows\n # association to the property and/or allows for display.\n puts 'test1'\n #@unit = Unit.new(params)\n puts 'XYZ'\n puts params[:name]\n puts 'ABC'\n end", "def _new_or_edit\n @connection.build_contact_info unless @connection.contact_info.present?\n @connection.build_financial_info unless @connection.financial_info.present?\n @connection.build_health_info unless @connection.health_info.present?\n @connection.health_info.build_moving_violation_history unless @connection.health_info.moving_violation_history.present?\n @connection.health_info.build_health_history unless @connection.health_info.health_history.present?\n @case = Crm::Case.new params[:crm_case], crm_connection:@connection\n @case.build_quoted_details(face_amount:750000) unless @case.quoted_details.present?\n end", "def new\n\t\tsession[:track_id] = params[:track_id]\n\t\tsession[:problem_id] = params[:problem_id]\n\t\tif params[:flag] == \"1\" \n\t\t\tsession[:flag] = params[:flag]\n\t\telsif params[:flag] == \"0\"\n\t\t\tsession[:flag] = params[:flag]\n\t\tend\n\t\t@problem = Problem.find(session[:problem_id])\n\t\t@test_case = TestCase.new\n\tend", "def create\n # USELESS\n end", "def create\n # USELESS\n end", "def set_current_test_name(name)\n metadata[:case] ||= {}\n metadata[:case][:name] = name\n end", "def create\n identify.tap { type }\n end", "def create\n @usage_record = UsageRecord.new(usage_record_params)\n @form_parm = [@usage_record.project, @usage_record]\n @usage_record.tap{ |u| \n u.principle_fund = nil unless params[:use] && params[:use][:principle]\n u.interest_fund = nil unless params[:use] && params[:use][:interest]\n }\n @usage_record.creator = current_user\n respond_to do |format|\n if @usage_record.save\n format.html { redirect_to @project }\n format.json { render :show, status: :created, location: @usage_record }\n else\n format.html { render :new }\n format.json { render json: @usage_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n @test_suite = TestSuite.find(params[:test_suite_id])\n\n #Make sure the tc is linked to the ts\n @test_case.test_suite_id=@test_suite.id\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to test_suite_test_case_path(@test_suite,@test_case), notice: 'Test case was successfully created.' }\n format.json { render :show, status: :created, location: @test_case }\n else\n format.html { render :new }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item(name, annotation, content, avaliability, units, userId)\r\n @newInstance = Ingredience.new\r\n @newInstance.name = name;\r\n @newInstance.annotation = annotation\r\n @newInstance.content = content\r\n @newInstance.avaliability = avaliability\r\n @newInstance.units = units;\r\n @newInstance.user_id = userId;\r\n @newInstance.activation_state = 1;\r\n\r\n @newInstance.save\r\n end", "def create\n @code_case = CodeCase.new(code_case_params)\n\n respond_to do |format|\n if @code_case.save\n format.html { redirect_to design_cases_path, notice: 'Code case was successfully created.' }\n format.json { render :show, status: :created, location: @code_case }\n else\n format.html { render :new }\n format.json { render json: @code_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_use_case\n @use_case = UseCase.find(params[:id])\n end", "def create\n @help_case = HelpCase.new(help_case_params)\n\n respond_to do |format|\n if @help_case.save\n format.html { redirect_to @help_case, notice: 'Help case was successfully created.' }\n format.json { render :show, status: :created, location: @help_case }\n else\n format.html { render :new }\n format.json { render json: @help_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_case = TestCase.new(params[:test_case])\n\n respond_to do |format|\n if @test_case.save\n format.html { redirect_to(@test_case, :notice => 'TestCase was successfully created.') }\n format.xml { render :xml => @test_case, :status => :created, :location => @test_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def info() @info = Info.new end", "def create!\n raise NotImplementedError\n end", "def create!\n end", "def create\n \n end", "def create\n @design_case = DesignCase.new(design_case_params)\n\n respond_to do |format|\n if @design_case.save\n format.html { redirect_to @design_case, notice: 'Design case was successfully created.' }\n format.json { render :show, status: :created, location: @design_case }\n else\n format.html { render :new }\n format.json { render json: @design_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @use_case = UseCase.new\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\n end\n end", "def create\n # TODO: implement create\n end", "def user_created_case user, the_case\n data = {\n category: 'Cases',\n action: 'Created a Case',\n label: the_case.case_name,\n value: user.cases.count,\n bounce: false,\n }\n\n create_event data\n end", "def create_new_work(params)\n @log.info 'Configuring work attributes'\n\n # set depositor\n depositor = User.find_by_user_key(@config['depositor'])\n raise 'User ' + @config['depositor'] + ' not found.' if depositor.nil?\n\n # set noid\n id = Noid::Rails::Service.new.minter.mint\n\n # set resource type\n resource_type = 'Thesis'\n unless params['resource_type'].first.nil?\n resource_type = params['resource_type'].first\n end\n\n # set visibility\n if params.key?('embargo_release_date')\n params['visibility_after_embargo'] = 'open'\n params['visibility_during_embargo'] = 'authenticated'\n else\n params['visibility'] = 'open'\n end\n\n # set admin set to deposit into\n unless @config['admin_set_id'].nil?\n params['admin_set_id'] = @config['admin_set_id']\n end\n\n # set campus\n params['campus'] = [@config['campus']]\n\n @log.info 'Creating a new ' + resource_type + ' with id:' + id\n\n if @config['type_to_work_map'][resource_type].nil?\n raise 'No mapping for ' + resource_type\n end\n\n model_name = @config['type_to_work_map'][resource_type]\n\n # student research but with a label that is otherwise Publication\n if params['degree_level'] || params['advisor']\n model_name = 'Thesis'\n end\n\n # create the actual work based on the mapped resource type\n model = Kernel.const_get(model_name)\n work = model.new(id: id)\n work.update(params)\n work.apply_depositor_metadata(depositor.user_key)\n work.save\n\n work\nend", "def create; end", "def create; end", "def create; end", "def create; 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_infos(infos)\n # info Create\n infos.each do |record|\n \n # Start\n info = info.new\n \n #Add data\n info.name = record[:info_name]\n info.short_name = record[:short_name]\n info.industry_id = lookup_industry_id(record[:industry]) # format: 4e9fab7aa6c2321681000026 / lookup_industry_id(industry_name)\n info.active = true \n \n # Save it!\n if info.valid?\n info.save!\n puts \"The info #{record[:info_name]} has been added to the database.\" \n else\n puts \"Errors found with info: #{record[:info_name]}\"\n puts \"ERRORS: #{info.errors.full_messages}\"\n end\n \n puts \"---------------------------------------------------------------\"\n end\n puts \"DONE!\"\n end", "def create\n @purpose_def = PurposeDef.new(params[:purpose_def])\n\n respond_to do |format|\n if @purpose_def.save\n format.html { redirect_to(@purpose_def, :notice => 'Purpose def was successfully created.') }\n format.xml { render :xml => @purpose_def, :status => :created, :location => @purpose_def }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @purpose_def.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(param)\n\t\traise NotImplementedError\n\tend", "def create\n end", "def new\n @it_case = ItCase.new\n\n @it_case.name=current_user.name\n @it_case.email=current_user.email\n @it_case.department=current_user.department\n @it_case.location= location_help\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @it_case }\n end\n end", "def create\n # scrub this template input\n if template = scenario_params[\"template\"]\n @scenario = YmlRecord.load_yml(\"scenarios/local/#{template}/#{template}.yml\")\n else\n @scenario = Scenario.new(scenario_params)\n end\n\n @scenario.user_id = current_user.id\n @scenario.save!\n\n respond_to do |format|\n if @scenario.save\n format.html { redirect_to @scenario, notice: 'Scenario was successfully created.' }\n format.json { render :show, status: :created, location: @scenario }\n else\n format.html { render :new }\n format.json { render json: @scenario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_resource(env)\n env[:ui].info(\"Creating machine\")\n\n config = env[:machine].provider_config\n vra = env[:vra]\n\n EntitledItemsCollection.fetch(env[:vra])\n .find_by_id(config.catalog_item_id)\n .request(cpus: config.cpus,\n memory: config.memory,\n requested_for: config.requested_for,\n subtenant_id: config.subtenant_id,\n lease_days: config.lease_days) { |req|\n config.extra_entries.types.each do |type|\n config.extra_entries.of_type(type).each do |k,v|\n req.set_parameter(k, type, v)\n end\n end\n }\n .join\n .machine\n end", "def create\n @test_case_entry = TestCaseEntry.new(params[:test_case_entry])\n\n respond_to do |format|\n if @test_case_entry.save\n format.html { redirect_to(@test_case_entry, :notice => 'Test case entry was successfully created.') }\n format.xml { render :xml => @test_case_entry, :status => :created, :location => @test_case_entry }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_case_entry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n raise NotImplementedError\n end", "def create\n raise NotImplementedError\n end", "def create(_instance)\n raise Errors::Backend::NotImplementedError, 'Requested functionality is not implemented'\n end", "def create\n @usage = Usage.new(usage_params)\n\n respond_to do |format|\n if @usage.save\n format.html { redirect_to @usage, notice: 'Usage was successfully created.' }\n format.json { render action: 'show', status: :created, location: @usage }\n else\n format.html { render action: 'new' }\n format.json { render json: @usage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(params[:case])\n @case.operator_id = current_user.id\n if current_user.district_id and !current_user.admin?\n @districts = District.where(\"id = #{current_user.district_id}\")\n @phis = Phi.where(\"district_id = #{current_user.district_id}\")\n else\n @districts = District.all\n @phis = Phi.all\n @centers = Center.all\n end\n @centers = (@phis.count == 1)? Center.where(\"phi_id = #{@phis.first.id}\") : Center.all\n @hes = He.where(:center_id => @centers.map { |id| id })\n\n @laboratories = Laboratory.all\n @municipalities = Municipality.all\n @agents = Agent.all\n @doctors = User.find_all_by_user_type(1)\n @nurses = User.find_all_by_user_type(2)\n @icds = Icd.all\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: t(\"record_created\") }\n format.json { render json: @case, status: :created, location: @case }\n else\n format.html { render action: \"new\" }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @use_case = UseCase.new\n @use_case.project = Project.find(params[:project_id])\n @use_case.use_case_group_id = params[:group_id]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @use_case }\n end\n end", "def create_run_info(opts)\n BawWorkers::Validation.check_custom_hash(opts, BawWorkers::Jobs::Analysis::Payload::OPTS_FIELDS)\n\n normalise_regex = /[^a-z0-9]/i\n current_time = Time.zone.now.utc.iso8601.to_s.downcase.gsub(normalise_regex, '_')\n\n dir_run = File.join(@dir_worker_top, BawWorkers::Jobs::Analysis::Runner::DIR_RUNS,\n \"#{opts[:job_id]}_#{opts[:id]}_#{current_time}\")\n dir_run_temp = File.join(dir_run, BawWorkers::Jobs::Analysis::Runner::DIR_TEMP)\n file_run_log = File.join(dir_run, BawWorkers::Jobs::Analysis::Runner::FILE_LOG)\n\n FileUtils.mkpath([dir_run, dir_run_temp])\n\n {\n dir_run: dir_run,\n dir_run_temp: dir_run_temp,\n file_run_log: file_run_log\n }\n end", "def create_target_mock\n ref = self.service_name.downcase.gsub(/ /, '-')\n create_row = {\n ref: ref,\n display_name: self.service_name,\n type: 'instance',\n iaas_type: 'ec2',\n iaas_properties: {},\n project_id: self.project.id\n }\n Model.create_from_row(self.project.model_handle(:target), create_row, convert: true, ret_obj: { model_name: :target_instance })\n end", "def create\n\t\t@problem = Problem.find_by_id(session[:problem_id])\n\t\t@test_case = TestCase.new\n\t\tif lecturer_signed_in?\n\t\t\t@test_case = TestCase.new(post_params)\n\t\t\t@test_case.owner_id = current_lecturer.id\n\t\t\t@test_case.owner_type = \"lecturer\"\n\t\t\t@test_case.problem_id = session[:problem_id]\n\t\telsif teaching_assistant_signed_in?\n\t\t\t@test_case = TestCase.new(post_params)\n\t\t\t@test_case.owner_id = current_teaching_assistant.id\n\t\t\t@test_case.owner_type = \"teaching assistant\"\n\t\t\t@test_case.problem_id = session[:problem_id]\n\t\tend\n\t\tif @test_case.save\n\t\t\t@problem.test_cases << @test_case\n\t\t\tif session[:flag] == \"1\"\n\t\t\t\tredirect_to :controller => 'test_cases', :action => 'index',\n\t\t\t\t\t:problem_id => session[:problem_id], :track_id => session[:track_id], :flag => \"1\"\n\t\t\telsif session[:flag] == \"0\"\n\t\t\t\tredirect_to :controller => 'model_answers', :action => 'new',\n\t\t\t\t\t:problem_id => session[:problem_id], :track_id => session[:track_id], :flag => \"0\"\n\t\t\tend\n\t\telse\n\t\t\trender :action=>'new', :problem_id => @test_case.problem_id, :flag => session[:flag]\n\t\tend\n\tend", "def new\n\t\t\t\"Should we make something new?\"\n\t\tend", "def instanciate(plan, variables = {})\n raise NotImplementedError, \"must reimplement #instanciate in the task objects used in coordination primitives\"\n end", "def new\n @test_run = current_user.test_runs.new\n @scenario = Scenario.new\n @registration_scenario = @scenario.registration_scenario || Scenario.new\n @profile = Profile.new\n @target = Target.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_run }\n end\n end", "def new\n @use_case = UseCase.new\n @quote = Quote.find(params[:quote_id])\n #@usert = {'General' => 1, 'Administador'=> 2, 'Visitante'=>3 }\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @use_case }\n end\n end", "def create\n @case_support = CaseSupport.new(case_support_params)\n\n respond_to do |format|\n if @case_support.save\n format.html { redirect_to @case_support, notice: 'Case support was successfully created.' }\n format.json { render :show, status: :created, location: @case_support }\n else\n format.html { render :new }\n format.json { render json: @case_support.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit!\n @security_case = SecurityCase.new(params[:security_case])\n\n respond_to do |format|\n if @security_case.save\n format.html { redirect_to(@security_case, :notice => 'Security case was successfully created.') }\n format.xml { render :xml => @security_case, :status => :created, :location => @security_case }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @security_case.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = current_user.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sample(klass, options={})\n klass.create(@@sample[klass].merge(options))\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to @case, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @case = Case.new(case_params)\n @case.user_id = User.current.id\n respond_to do |format|\n if @case.save\n format.html { redirect_to back_url, notice: 'Case was successfully created.' }\n format.json { render :show, status: :created, location: @case }\n else\n format.html { render :new }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @use = Use.new(params[:use])\n @use.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @use.save\n format.html { redirect_to @use, notice: crud_notice('created', @use) }\n format.json { render json: @use, status: :created, location: @use }\n else\n format.html { render action: \"new\" }\n format.json { render json: @use.errors, status: :unprocessable_entity }\n end\n end\n end", "def info\n fill_usage_info\n end", "def create\n @it_case = ItCase.new(params[:it_case])\n @it_case.user_id=current_user.id\n @it_case.ipaddress=request.remote_ip\n @it_case.status=ItCase::STATUSES['Waiting']\n @it_case.opened_time=Time.now\n @it_case.created_type='web'\n @it_case.creator_id=current_user.id\n respond_to do |format|\n if @it_case.save\n format.html { redirect_to mycases_path, notice: '工单已建立' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def new_for_creating_stack\n infra_id = params.require(:infrastructure_id)\n\n histories = CfTemplate.for_infra(infra_id)\n # TODO: 変数名変えたほうがいいんじゃ\n globals = CfTemplate.global\n\n render json: {\n histories: histories,\n globals: globals,\n } and return\n end", "def create(create_choice)\n if create_choice == \"v\"\n puts \"What is the voter's name?\"\n name = gets.chomp.downcase\n puts \"What is the voter's affiliation?\"\n puts \"\"\n puts \"Democratic, Republican, or Other\"\n affiliation = gets.chomp.downcase\n @voters << Voter.new(name, affiliation).data_hash\n puts \"Saved!\"\n elsif create_choice == \"p\"\n puts \"What is the politician's name?\"\n name = gets.chomp.downcase\n puts \"What is the politician's affiliation?\"\n puts \"\"\n puts \"Democratic, Republican, or Other\"\n affiliation = gets.chomp.downcase\n @politicians << Politician.new(name, affiliation).data_hash\n puts \"Saved!\"\n end\n end", "def new_project_unit\n end", "def carton_new(entry)\n log_msg \"in new\"\n record_map = eval entry.record\n create_carton_util(record_map)\n \n end", "def create\n@inst = Inst.new()\n@inst.firstname = params[:inst][:firstname]\n@inst.lastname = params[:inst][:lastname]\n@inst.color = params[:inst][:color]\n@inst.manufacturer = params[:inst][:manufacturer]\nmyInst = BasicInst.new(10, @inst.manufacturer, @inst.color)\n# add the extra features to the new instrument\nif params[:inst][:windows].to_s.length > 0 then\nmyInst = ElectricWindowsDecorator.new(myInst)\nend\nif params[:inst][:devise2].to_s.length > 0 then\nmyInst = Devise2Decorator.new(myInst)\nend\n\n## populate the cost and the description details\n@inst.cost = myInst.cost\n@inst.description = myInst.details\nrespond_to do |format|\nif @inst.save\nformat.html { redirect_to @inst, notice: 'Inst was successfully created.'}\nformat.json { render :show, status: :created, location: @inst }\nelse\nformat.html { render :new }\nformat.json { render json: @inst.errors, status: :unprocessable_entity }\nend\nend\nend", "def create\n\n @case = Case.new(case_params)\n\n respond_to do |format|\n if @case.save\n format.html { redirect_to cases_path, notice: 'Case was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cases_path }\n else\n format.html { render action: 'new' }\n format.json { render json: @case.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_activity(activity)\n Models::Activity.new(:name => activity.name, :description => activity.description)\n end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token, module_id: @module_id }.merge(attrs)\n @attributes = send_request(\"test_modules/#{attrs[:module_id]}/test_cases\", :post) do |req|\n req.body = {\n test_case: attrs.except(:project_token, :module_id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def create\r\n end", "def new\n \n end", "def create\n @case_req = CaseRequirement.new(case_requirement_params)\n\n respond_to do |format|\n if @case_req.save\n\n @application_case = @case_req.application_case\n @applicants = @application_case.applicants.not_current(current_user)\n\n format.html { redirect_to @case_req.application_case, notice: 'Role was successfully created.' }\n format.json { render :show, status: :created, location: @application_case }\n else\n format.html { render :new }\n format.json { render json: @case_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(id, name: nil, type: :PRODUCTION, labels: nil, clusters: nil)\n end", "def new_profile\n profile = Profile.new\n profile.user_group = UserGroup.first\n profile.library = Library.real.first\n profile.locale = I18n.default_locale.to_s\n profile.full_name = 'System'\n profile\nend", "def create\n @user=find_user\n\n if !@user.nil?\n assign_project_use\n if !params[:use_case_name].empty? and @user.privilige!=\"Read\"\n @project=Project.find(session[:project_id])\n\n if !current_user.nil?\n @project_use=@project.use_cases.create(:name=>params[:use_case_name], :status=>\"Draft\", :user_id=>@user.id, :priority=>\"Medium\", :importance=>\"Interesting\")\n if !@project_use.id.nil?\n first_name=@project_use.find_user_first_name(current_user.id)\n UseCase.notification_create(current_user.id, @project.id, @project_use, first_name)\n end\n elsif !current_member.nil?\n @project_use=@project.use_cases.create(:name=>params[:use_case_name], :status=>\"Draft\", :user_id=>@user.user_id, :member_id=>@user.id, :priority=>\"Medium\", :importance=>\"Interesting\")\n if !@project_use.id.nil?\n first_name=@project_use.find_member_first_name(@user.id)\n UseCase.notification_create(@user.user_id, @project.id, @project_use, first_name)\n end\n end\n\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n format.js\n\n end\n end\n end\n end", "def create_drug_context\n @motrin = FactoryGirl.create(:drug, name: \"Motrin\", active: true, otc: true, description: \"Helps alleviate fever and menstrual cramps\")\n @ibuprofen = FactoryGirl.create(:drug, name: \"Ibuprofen\", active: true, otc: true, description: \"Used for headaches\")\n @advil = FactoryGirl.create(:drug, name: \"Advil\", active: true, otc: true)\n @antihistamine = FactoryGirl.create(:drug, name: \"Antihistamine\", active: false, otc: false, description: \"Used for allergies and sinuses\")\n end", "def main\n\n operations.make\n \n operations.each {|op|\n new_experimental_plt = op.output(OUTPUT).collection\n note = op.input(NOTE).val.to_s\n if note != '' || note != nil || note != ' '\n note_entered = true\n key = 'Note'\n Item.find(new_experimental_plt.id).associate key.to_sym, note\n end\n show {\n title \"New Experimental Plate Created\"\n separator\n note \"Output Item: <b>#{new_experimental_plt}</b>\"\n bullet \"Output Object Type: <b>#{new_experimental_plt.object_type.name}</b>\"\n (note_entered) ? (bullet \"Note: <b>#{note}</b>\") : nil\n }\n }\n \n return {}\n \n end", "def create\n end", "def learning_new\n puts \"I am Learning #{TECH_ONE}\"\n end", "def carton_new(entry)\n #log_msg\"in new\"\n record_map = eval entry.record\n create_carton_util(record_map)\n\n end", "def create\n @seance = Seances::UseCases::Create.new.call(params: seance_params)\n\n if @seance.valid?\n render jsonapi: @seance, status: :created\n else\n render jsonapi_errors: @seance.errors, status: :unprocessable_entity\n end\n end", "def create\n @test_case = TestCase.new(test_case_params)\n\n respond_to do |format|\n if @test_case.save\n TestMailer.admin_new_test_email(@test_case).deliver\n \n format.html { redirect_to @test_case, notice: 'Your test was successfully added.' }\n format.json { render action: 'show', status: :created, location: @test_case }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_sample\n @type.new\n end", "def create\n @support_case = current_user.support_cases.build(support_case_params)\n\n respond_to do |format|\n if @support_case.save\n format.html { redirect_to @support_case, notice: 'Support case was successfully created.' }\n format.json { render :show, status: :created, location: @support_case }\n else\n format.html { render :new }\n format.json { render json: @support_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def UseCaseDiagram( options={}, &block )\n # options :name => \"Name of the Diagram\"\n $name = \"#{$name}\\n#{options[:name]}\" if options.has_key? :name\n # first create internal model,\n # i.e. the <code> in the DSL is executed\n # UseCaseDiagram () do ...<code>... end is executed\n # thereby building the internal use case diagram representation\n block.call\n # display the model\n displayOpen options # display preamble, also provide specific options for the display\n displayUseCases $usecases # display all use cases\n displayLinks $usecases # display links between the use cases\n displayActors $actors # display actors and their links to use cases\n displayClose # display epilogue\nend", "def create\n Puppet.debug( \"#{self.resource.type}: CREATE #{resource[:name]}\" ) \n end", "def create_object\n sut.send(:new)\n end" ]
[ "0.6796535", "0.6695031", "0.5962186", "0.59504133", "0.5933434", "0.590102", "0.5809556", "0.5787832", "0.57644856", "0.5650518", "0.5650304", "0.5643049", "0.5624123", "0.5607837", "0.5598078", "0.55879486", "0.5572236", "0.5572236", "0.556721", "0.5563951", "0.5542535", "0.5536316", "0.5525709", "0.5506989", "0.5491021", "0.54902136", "0.5484016", "0.54833704", "0.54833704", "0.5470963", "0.54709506", "0.5470218", "0.5469372", "0.5467259", "0.54636973", "0.54624903", "0.5462395", "0.5454836", "0.5450006", "0.5450006", "0.5450006", "0.5450006", "0.54495704", "0.54484564", "0.5442315", "0.5437931", "0.5426781", "0.5422127", "0.54199064", "0.54191804", "0.5417067", "0.5415071", "0.5415071", "0.540384", "0.5403606", "0.5393967", "0.53886235", "0.5383934", "0.536964", "0.5363973", "0.5352795", "0.53458875", "0.5343922", "0.5334471", "0.5333989", "0.5332411", "0.53222066", "0.5314734", "0.5313921", "0.5313921", "0.53115636", "0.53061354", "0.5301205", "0.5291234", "0.5287701", "0.5286806", "0.5283637", "0.5283102", "0.52806807", "0.52804494", "0.52760553", "0.5275791", "0.52752805", "0.5273195", "0.5271911", "0.52685446", "0.52664876", "0.526317", "0.52609646", "0.5255469", "0.52542144", "0.5243987", "0.5242055", "0.523858", "0.52334815", "0.5233452", "0.5227712", "0.5227429", "0.5224759", "0.5221613" ]
0.578253
8
Changes the information of a use case
def update @use_case = UseCase.find(params[:id]) @use_case.data = params[:data].to_json respond_to do |format| if @use_case.update_attributes(params[:use_case]) if params[:subaction]=="step" format.html { redirect_to requirements_project_use_case_path(@use_case.project, @use_case, :type=>"step"), notice: 'Use case was successfully updated.' } else format.html { redirect_to project_use_case_path(@project, @use_case), notice: 'Use case was successfully updated.' } end format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @use_case.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_use_case\n @use_case = UseCase.find(params[:id])\n end", "def switch(name,aliases,desc,long_desc,negatable)\n abstract!\n end", "def update_case\n api.command :edit, to_case_hash\n end", "def usecase=(usecase)\n if usecase.nil?\n fail ArgumentError, 'usecase cannot be nil'\n end\n\n if usecase.to_s.length > 20\n fail ArgumentError, 'invalid value for \"usecase\", the character length must be smaller than or equal to 20.'\n end\n\n @usecase = usecase\n end", "def update\n @quote = Quote.find(params[:quote_id])\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n format.html { redirect_to @quote , notice: 'Use case was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n realizarCostos\n end\n end", "def change_something(lineup)\n\n puts \"Who do you want to change? Enter Spice name: \"\n lineup.list_names\n member = gets.strip\n lineup.name_check=(member)\n puts \"What would you like to change? enter a --> e \"\n list_changeables\n attribute = gets.strip\n lineup.name_check=(attribute)\n att_name = describe_attribute(attribute)\n current_att = lineup.get_attribute(member, attribute)\n puts \"#{member}'s #{att_name} is #{current_att}...what do you want to change it to?:\"\n new_value = gets.strip\n lineup.name_check=(new_value)\n byebug\n lineup.change_attribute(member, attribute, new_value)\n puts \"#{member}'s #{att_name} has been changed.\"\nend", "def edit\n @use_case = UseCase.find(params[:id])\n end", "def set_current_test_name(name)\n metadata[:case] ||= {}\n metadata[:case][:name] = name\n end", "def set_usage\n # byebug\n @usage = Usage.find(params[:id])\n end", "def update\n # updating hard info\n hard_info = HardInfo.where(use_case_no: @use_case.use_case_no, client_name: @use_case.client_name, product_name: @use_case.product_name)\n hard_info.first.update(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n #--\n respond_to do |format|\n if @use_case.update(use_case_params)\n format.html { redirect_to @use_case }\n format.json { render :show, status: :ok, location: @use_case }\n else\n format.html { render :edit }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_case\n if params[:action] == \"update\" \n @case = Case.find(params[:format])\n else\n @case = Case.find(params[:id])\n end\n end", "def change_info(n, h, w) #these three arguments correspond to the new name height and weight respectively\n @name = n\n @height = h\n @weight = w\nend", "def change_profile(new_name = @name, new_hitpoint = @hitpoint, new_attack_damage = @attack_damage)\r\n @name = new_name\r\n @hitpoint = new_hitpoint\r\n @attack_damage = new_attack_damage\r\n end", "def UseCase( name )\n return UseCase.new name\nend", "def change(params); end", "def purpose(desc)\n args_def.purpose = desc\n end", "def set_usage\n @usage = Usage.find(params[:id])\n end", "def purpose\n end", "def usage; end", "def usage; end", "def change_details\n @engine = Engine.new\n @milage = input_milage\n @top_speed = input_max_speed\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 change_info(n, h, w)\n #using self. tells ruby we are calling the set method we created earlier, not a local variable\n self.name = n\n self.height = h\n self.weight = w\n end", "def set_case\n @case = Announcement.find(params[:id])\n end", "def change_info(n, h, w)\n name = n\n height = h\n weight = w\nend", "def change_info(n, h, w)\n name = n\n height = h\n weight = w\nend", "def annotate_case!(kase, changes)\n return unless @user\n\n RetentionScheduleCaseNote.log!(\n kase:, user: @user, changes:, is_system: true,\n )\n end", "def details=(_); end", "def manage_trains\n @ui.manage_trains_selected_msg\n @ui.input_1_change\n @ui.user_input1.downcase\n\n case @ui.user_input1\n when \"add\" \n manage_trains_add_train\n when \"add route\"\n manage_trains_add_route\n when \"move\"\n manage_trains_move\n when \"cars\"\n manage_trains_cars\n when \"observe\" \n manage_trains_choose_train\n when \"inst\" #Test method for printing value of instance_counter (task form hw-5)\n puts PassengerTrain.instance_counter\n else\n @ui.wrong_input_msg\n end\n end", "def set_case\n @case = Case.find(params[:case_id])\n end", "def set_test_case\n @test_case = TestCase.find(params[:id])\n end", "def set_test_case\n @test_case = TestCase.find(params[:id])\n end", "def set_test_case\n @test_case = TestCase.find(params[:id])\n end", "def set_case_test\n @case_test = CaseTest.find(params[:id])\n end", "def edit_req_usecase\n @user=find_user\n if !@user.nil?\n\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(@user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n @requirement=Requirement.find(session[:req_id])\n if !@requirement.nil?\n format.html { redirect_to show_usecases_url(@requirement.id) }\n else\n format.html { redirect_to requirements_path }\n end\n end\n\n else\n assign_project_use\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def setup_change_skill\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n skill = $data_skills[@acts[1]]\n return unless skill\n self.item_in_use = copy(skill)\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def set_case\n @case = Case.find(params[:id])\n end", "def edit_usecase_file\n find_user\n if !@user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Approve\" or @user.privilige==\"Read/Write/Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n if @use_case.update_attributes(params[:use_case])\n if (!params[:use_case][:status].nil?)\n\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(current_user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n find_user\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n\n end\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n redirect_to show_file_uses_url(@file.id)\n else\n redirect_to project_files_path\n end\n\n else\n\n\n flash[:notice]= t(:usecase_edit_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def update\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n if @use_case.update_attributes(params[:use_case])\n\n if params[:use_case].has_key?(:file) && params[:use_case][:file]\n @use_case.upload_main_asset(params[:use_case][:file])\n elsif params.has_key?(:file) && params[:file]\n @use_case.upload_main_asset(params[:file])\n end\n \n format.html { redirect_to @use_case, notice: 'Use case was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def change_info(n,h,w)\n @name = n\n @height = h\n @weight = w\nend", "def set_case_value(choix, symbol)\n\n @cases[choix] = symbol\n \n \n end", "def setup_change_target\n return unless PONY::ERRNO::check_sequence(current_act)\n setup_target(@acts[1])\n end", "def set_support_case\n @support_case = SupportCase.find(params[:id])\n end", "def usage=(value)\n @usage = value\n end", "def set_code_case\n @code_case = CodeCase.find(params[:id])\n end", "def edit_tracker_usecase\n @user=find_user\n if @user.nil?\n status=@use_case.status\n if ((status!=\"Approved\" and params[:use_case][:status]==\"Approved\" and (@user.privilige==\"Admin\" or @user.privilige==\"Read/Write/Approve\" or @user.privilige==\"Approve\")) or (status!=\"Approved\" and params[:use_case][:status]!=\"Approved\" and (@user.privilige!=\"Read\")) or (status==\"Approved\" and @user.privilige==\"Admin\")or (status==\"Approved\" and params[:use_case][:status]==\"Approved\" and !params[:use_case][:delivered].empty? and @user.privilige!=\"Read\"))\n @use_case.update_attributes(params[:use_case])\n\n if !params[:use_case][:status].nil?\n if (status!=\"Approved\" and params[:use_case][:status]==\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status!=\"For Review\" and params[:use_case][:status]==\"For Review\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_reviewed(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_reviewed(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n elsif (status==\"Approved\" and params[:use_case][:status]!=\"Approved\")\n\n if !current_user.nil?\n first_name=@use_case.find_user_first_name(current_user.id)\n UseCase.notification_no_approved(current_user.id, @use_case.project_id, @use_case, first_name)\n else\n first_name=@use_case.find_member_first_name(@user.id)\n UseCase.notification_no_approved(@user.user_id, @use_case.project_id, @use_case, first_name)\n end\n end\n end\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !session[:tracker_id].nil?\n @tracker=Tracker.find(session[:tracker_id])\n format.html { redirect_to show_tracker_use_url(@tracker.id) }\n else\n format.html { redirect_to trackers_path }\n end\n end\n\n else\n @attr=Attribute.find_by_project_id(session[:project_id])\n flash[:notice]= t(:use_case_no_approve)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def show_use_case\n find_user\n if !@user.nil?\n assign_project\n @req=Requirement.find_by_id(params[:req])\n if !@req.nil?\n @req_use_cases=@req.use_cases.find(:all, :order => \"updated_at desc\")\n session[:req_id]=@req.id\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n format.html { render \"use_cases/index\" }\n end\n else\n redirect_to requirments_path\n end\n\n else\n redirect_to sign_in_url\n end\n\n end", "def set_usage_record\n @usage_record = UsageRecord.find(params[:id])\n end", "def set_help_case\n @help_case = HelpCase.find(params[:id])\n end", "def set_method_of_use\n @method_of_use = MethodOfUse.find(params[:id])\n end", "def update!(**args)\n @option = args[:option] if args.key?(:option)\n @scenario = args[:scenario] if args.key?(:scenario)\n @status = args[:status] if args.key?(:status)\n end", "def change_info(n, h, w)\n self.name = n\n self.height = h\n self.weight = w\nend", "def update!(**args)\n @name = args[:name] if args.key?(:name)\n @services = args[:services] if args.key?(:services)\n @use_case = args[:use_case] if args.key?(:use_case)\n end", "def update\n @purpose_def = PurposeDef.find(params[:id])\n\n respond_to do |format|\n if @purpose_def.update_attributes(params[:purpose_def])\n format.html { redirect_to(@purpose_def, :notice => 'Purpose def was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purpose_def.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @display_rules = args[:display_rules] if args.key?(:display_rules)\n @feature_info = args[:feature_info] if args.key?(:feature_info)\n @type = args[:type] if args.key?(:type)\n end", "def update!(**args)\n @is_auto = args[:is_auto] if args.key?(:is_auto)\n @source_summary = args[:source_summary] if args.key?(:source_summary)\n end", "def override_pain_from_a_spec_test_only(pain)\n @pain_override = pain\n end", "def update_ial_with_ial(ial, opts); end", "def edit_data\n puts \"1-add student\"\n puts \"2-delete student\"\n puts \"3-edit student data\"\n user_selection = gets.chomp\n case user_selection\n when \"1\"\n add_student\n when \"2\"\n delete_student\n when \"3\"\n edit_student_data\n else\n puts @dash+\"error-invalid-selection\"+@dash\n user_menu\n end\n end", "def update!(**args)\n @overview = args[:overview] if args.key?(:overview)\n end", "def run(model, runner, user_arguments)\n super(model, runner, user_arguments)\n\n # use the built-in error checking\n if !runner.validateUserArguments(arguments(model), user_arguments)\n return false\n end\n\n if model.getRefrigerationCases.empty?\n runner.registerAsNotApplicable('No refrigerated cases are present in the current model, it will not be altered.')\n return false\n end\n\n # make choice argument for efficiency level\n efficiency_level = runner.getStringArgumentValue('efficiency_level', user_arguments)\n reference_cases_data = JSON.parse(File.read(File.dirname(__FILE__) + '/resources/cases.json'))\n\n cases_changed = 0\n total_case_length_m = 0\n model.getRefrigerationCases.each_with_index do |individual_case, def_start_hr_iterator|\n case_category = individual_case.additionalProperties.getFeatureAsString('case_category')\n next unless case_category.is_initialized\n case_category = case_category.get\n reference_cases_data.each do |reference_case|\n reference_case_category = reference_case['case_category']\n next unless reference_case_category == case_category\n next unless reference_case['efficiency_level'] == efficiency_level\n next unless OpenStudio.convert(OpenStudio.convert(reference_case['cooling_capacity_per_length'].to_f, 'Btu/h', 'W').get, '1/ft', '1/m').get <= individual_case.ratedTotalCoolingCapacityperUnitLength\n next unless OpenStudio.convert(reference_case['lighting_per_ft'].to_f, '1/ft', '1/m').get <= individual_case.standardCaseLightingPowerperUnitLength\n individual_case.setCaseOperatingTemperature(OpenStudio.convert(reference_case['operating temperature'], 'F', 'C').get)\n individual_case.setDesignEvaporatorTemperatureorBrineInletTemperature(OpenStudio.convert(reference_case['evaporator temperature'], 'F', 'C').get)\n individual_case.setRatedTotalCoolingCapacityperUnitLength(OpenStudio.convert(OpenStudio.convert(reference_case['cooling_capacity_per_length'], 'Btu/h', 'W').get, '1/ft', '1/m').get)\n individual_case.setOperatingCaseFanPowerperUnitLength(OpenStudio.convert(reference_case['evap_fan_power_per_length'], '1/ft', '1/m').get)\n individual_case.setStandardCaseLightingPowerperUnitLength(OpenStudio.convert(reference_case['lighting_per_ft'], '1/ft', '1/m').get)\n individual_case.setCaseAntiSweatHeaterPowerperUnitLength(OpenStudio.convert(reference_case['anti_sweat_power'], '1/ft', '1/m').get)\n individual_case.setMinimumAntiSweatHeaterPowerperUnitLength(OpenStudio.convert(reference_case['minimum_anti_sweat_heater_power_per_unit_length'], '1/ft', '1/m').get)\n individual_case.setCaseDefrostPowerperUnitLength(OpenStudio.convert(reference_case['defrost_power_per_length'], '1/ft', '1/m').get)\n individual_case.setCaseDefrostType(reference_case['defrost_type'])\n\n # adjust defrost schedule if present\n if individual_case.caseDefrostSchedule.is_initialized && individual_case.caseDefrostDripDownSchedule.is_initialized\n old_schedule_defrost = individual_case.caseDefrostSchedule.get\n old_schedule_dripdown = individual_case.caseDefrostDripDownSchedule.get\n\n # new defrost schedule\n numb_defrosts_per_day = reference_case['defrost_per_day'].to_f\n minutes_defrost = reference_case['defrost_duration'].to_f\n minutes_dripdown = reference_case['defrost_duration'].to_f\n minutes_defrost = 59 if minutes_defrost > 59 # Just to make sure to remain in the same hour\n minutes_dripdown = 59 if minutes_dripdown > 59 # Just to make sure to remain in the same hour\n\n # add defrost and dripdown schedules\n defrost_sch_case = OpenStudio::Model::ScheduleRuleset.new(model)\n defrost_sch_case.setName('Refrigeration Defrost Schedule')\n defrost_sch_case.defaultDaySchedule.setName(\"Refrigeration Defrost Schedule Default - #{individual_case.name}\")\n dripdown_sch_case = OpenStudio::Model::ScheduleRuleset.new(model)\n dripdown_sch_case.setName('Refrigeration Dripdown Schedule')\n dripdown_sch_case.defaultDaySchedule.setName(\"Refrigeration Dripdown Schedule Default - #{individual_case.name}\")\n\n # stagger the defrosts for cases by 1 hr\n interval_defrost = (24 / numb_defrosts_per_day).floor # Hour interval between each defrost period\n if (def_start_hr_iterator + interval_defrost * numb_defrosts_per_day) > 23\n first_def_start_hr = 0 # Start over again at midnight when time reaches 23hrs\n else\n first_def_start_hr = def_start_hr_iterator\n end\n\n # add the specified number of defrost periods to the daily schedule\n (1..numb_defrosts_per_day).each do |defrost_of_day|\n def_start_hr = first_def_start_hr + ((1 - defrost_of_day) * interval_defrost)\n defrost_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, def_start_hr, 0, 0), 0)\n defrost_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, def_start_hr, minutes_defrost.to_int, 0), 0)\n dripdown_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, def_start_hr, 0, 0), 0) # Dripdown is synced with defrost\n dripdown_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, def_start_hr, minutes_dripdown.to_int, 0), 0)\n end\n defrost_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)\n dripdown_sch_case.defaultDaySchedule.addValue(OpenStudio::Time.new(0, 24, 0, 0), 0)\n\n # assign the defrost and dripdown schedules\n individual_case.setCaseDefrostSchedule(defrost_sch_case)\n individual_case.setCaseDefrostDripDownSchedule(dripdown_sch_case)\n unless old_schedule_defrost.directUseCount > 0\n old_schedule_defrost.remove\n end\n unless old_schedule_dripdown.directUseCount > 0\n old_schedule_dripdown.remove\n end\n end\n\n # log case length\n total_case_length_m += individual_case.caseLength.to_f\n cases_changed += 1\n runner.registerInfo(\"Case #{individual_case.name} was swapped with a case with the following level of efficiency: #{efficiency_level}.\")\n end\n end\n\n # check if there are no cases\n if total_case_length_m.zero?\n runner.registerAsNotApplicable(\"The refrigeration cases in the current model don't have proper additional properties\\n or the level of efficiency is equal/grater than the chosen one.\")\n return false\n end\n\n # report final condition of model\n total_case_length_ft = OpenStudio.convert(total_case_length_m, 'm', 'ft').get\n runner.registerFinalCondition(\"#{cases_changed} cases with length #{total_case_length_ft.round} ft were upgraded to #{efficiency_level}.\")\n runner.registerValue('refrig_case_upgrades_ft_of_cases_modified', total_case_length_ft.round, 'ft')\n\n return true\n end", "def update!(**args)\n @instance = args[:instance] if args.key?(:instance)\n @is_added_by_edit = args[:is_added_by_edit] if args.key?(:is_added_by_edit)\n @is_inferred = args[:is_inferred] if args.key?(:is_inferred)\n @provider = args[:provider] if args.key?(:provider)\n @source_dataset = args[:source_dataset] if args.key?(:source_dataset)\n end", "def edit\n\t\tsession[:problem_id] = params[:problem_id]\n\t\tsession[:track_id] = params[:track_id]\n\t\tsession[:test_case_id] = params[:test_case_id]\n\t\t@test_case = TestCase.find_by_id(session[:test_case_id])\n\tend", "def UseCaseDiagram( options={}, &block )\n # options :name => \"Name of the Diagram\"\n $name = \"#{$name}\\n#{options[:name]}\" if options.has_key? :name\n # first create internal model,\n # i.e. the <code> in the DSL is executed\n # UseCaseDiagram () do ...<code>... end is executed\n # thereby building the internal use case diagram representation\n block.call\n # display the model\n displayOpen options # display preamble, also provide specific options for the display\n displayUseCases $usecases # display all use cases\n displayLinks $usecases # display links between the use cases\n displayActors $actors # display actors and their links to use cases\n displayClose # display epilogue\nend", "def set_design_case\n @design_case = DesignCase.find(params[:id])\n end", "def update!(**args)\n @feature = args[:feature] if args.key?(:feature)\n @new_restriction = args[:new_restriction] if args.key?(:new_restriction)\n end", "def set_case_requirement\n @case_req = CaseRequirement.find(params[:id])\n end", "def user_updated_case _user, the_case\n data = {\n category: 'Cases',\n action: 'Updated a Case',\n label: the_case.case_name,\n value: nil,\n bounce: false,\n }\n\n create_event data\n end", "def update!(**args)\n @display_name = args[:display_name] if args.key?(:display_name)\n @language_code = args[:language_code] if args.key?(:language_code)\n @support_source = args[:support_source] if args.key?(:support_source)\n @support_target = args[:support_target] if args.key?(:support_target)\n end", "def set_target_info(name, tpg)\n @lun_table.set_target_info(name, tpg)\n end", "def new_changed_food(name)\n food = Food.new 'apple'\n food.name = 'potato'\n food\nend", "def change_info(n, h, w)\n self.name = n\n self.height = h\n self.weight = w\n end", "def switch(name,aliases,desc,long_desc,negatable)\n if negatable\n name = \"[no-]#{name}\" if name.to_s.length > 1\n aliases = aliases.map { |_| _.to_s.length > 1 ? \"[no-]#{_}\" : _ } \n end\n invocations = ([name] + aliases).map { |_| add_dashes(_) }.join('|')\n @io.puts \"#{@nest}=== #{invocations}\"\n @io.puts String(desc).strip\n @io.puts\n @io.puts String(long_desc).strip\n @io.puts\n end", "def change_info(n, h, w)\n self.name = n\n self.height = h\n self.weight = w\n end", "def change_info(n, h, w)\n self.name = n\n self.height = h\n self.weight = w\n end", "def set_sf_case\n @sf_case = SFCase.find(params[:id])\n end", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def update!(**args)\n @code = args[:code] if args.key?(:code)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @name = args[:name] if args.key?(:name)\n @targeting_info = args[:targeting_info] if args.key?(:targeting_info)\n end", "def edit(mode=@mode) # not sure if you can use an instance variable like this\n\told_mode = @mode\n\t\t@mode = mode\n\t\t\n\t\tself.tap |mode_handle|\n\t\t\tyield mode_handle\n\t\tend", "def update!(**args)\n @start_usage_amount = args[:start_usage_amount] if args.key?(:start_usage_amount)\n @unit_price = args[:unit_price] if args.key?(:unit_price)\n end", "def set_case\n @case = Case.friendly.includes(\n :podcasts, :cards,\n edgenotes: [image_attachment: :blob, audio_attachment: :blob],\n activities: %i[case_element card], pages: %i[case_element cards]\n )\n .find(slug).decorate\n end", "def update!(**args)\n @policy = args[:policy] if args.key?(:policy)\n @test_code = args[:test_code] if args.key?(:test_code)\n @trusted_genome_hierarchy = args[:trusted_genome_hierarchy] if args.key?(:trusted_genome_hierarchy)\n end", "def update_features\n self.feature_descriptions = BasketItem.describe_feature_selections(feature_selections)\n end", "def update!(**args)\n @description = args[:description] if args.key?(:description)\n @source_label = args[:source_label] if args.key?(:source_label)\n end", "def create\n @use_case = UseCase.new(use_case_params)\n # creating hard info\n @use_case.hard_infos.new(use_case_params.except(\n :division,\n :sc_tel,\n :project_no,\n :industry,\n :service_product,\n :customer_count,\n :vendor_count,\n :product_count,\n :vehicle_count,\n :driver_count,\n :sc_name,\n :memo,\n :use_case_code\n )\n )\n @use_case.hard_infos.last.save\n #--\n respond_to do |format|\n if @use_case.save\n format.html { redirect_to @use_case }\n format.json { render :show, status: :created, location: @use_case }\n else\n format.html { render :new }\n format.json { render json: @use_case.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_purposes(activity, visit)\n context_menu_open(activity, visit, 'purpose')\n end", "def update!(**args)\n @experimental_building_id = args[:experimental_building_id] if args.key?(:experimental_building_id)\n @experimental_desk_id = args[:experimental_desk_id] if args.key?(:experimental_desk_id)\n @experimental_floor_id = args[:experimental_floor_id] if args.key?(:experimental_floor_id)\n @label = args[:label] if args.key?(:label)\n end", "def update\n\t\t\n\t\t# check if the current use is this person\n\t\t\t\t\n\t\t\n\tend", "def update!(**args)\n @feature = args[:feature] if args.key?(:feature)\n end", "def update!(**args)\n @resource_family = args[:resource_family] if args.key?(:resource_family)\n @resource_group = args[:resource_group] if args.key?(:resource_group)\n @service_display_name = args[:service_display_name] if args.key?(:service_display_name)\n @usage_type = args[:usage_type] if args.key?(:usage_type)\n end", "def update!(**args)\n @abuse_type = args[:abuse_type] if args.key?(:abuse_type)\n @backend = args[:backend] if args.key?(:backend)\n @cluster_evaluation_context = args[:cluster_evaluation_context] if args.key?(:cluster_evaluation_context)\n @comment = args[:comment] if args.key?(:comment)\n @feature = args[:feature] if args.key?(:feature)\n @manual_review_info = args[:manual_review_info] if args.key?(:manual_review_info)\n @misc_data = args[:misc_data] if args.key?(:misc_data)\n @process_time_millisecs = args[:process_time_millisecs] if args.key?(:process_time_millisecs)\n @processed_micros = args[:processed_micros] if args.key?(:processed_micros)\n @region = args[:region] if args.key?(:region)\n @score = args[:score] if args.key?(:score)\n @status = args[:status] if args.key?(:status)\n @target = args[:target] if args.key?(:target)\n @timestamp_micros = args[:timestamp_micros] if args.key?(:timestamp_micros)\n @user_restriction = args[:user_restriction] if args.key?(:user_restriction)\n @version = args[:version] if args.key?(:version)\n @video_review_data = args[:video_review_data] if args.key?(:video_review_data)\n end", "def update!(**args)\n @exam_type = args[:exam_type] if args.key?(:exam_type)\n @expiration = args[:expiration] if args.key?(:expiration)\n @last_passed = args[:last_passed] if args.key?(:last_passed)\n @passed = args[:passed] if args.key?(:passed)\n @taken = args[:taken] if args.key?(:taken)\n @warning = args[:warning] if args.key?(:warning)\n end", "def reopen_case\n # Update USer kyc detail\n @user_kyc_detail.admin_status = GlobalConstant::UserKycDetail.unprocessed_admin_status\n @user_kyc_detail.aml_status = GlobalConstant::UserKycDetail.pending_aml_status if @user_kyc_detail.aml_status !=\n GlobalConstant::UserKycDetail.unprocessed_aml_status\n\n @user_kyc_detail.aml_user_id = nil\n @user_kyc_detail.whitelist_status = GlobalConstant::UserKycDetail.unprocessed_whitelist_status\n @user_kyc_detail.kyc_confirmed_at = nil\n @user_kyc_detail.last_acted_by = @edit_kyc_request.admin_id\n @user_kyc_detail.last_acted_timestamp = Time.now.to_i\n @user_kyc_detail.last_reopened_at = Time.now.to_i\n @user_kyc_detail.save!\n\n update_edit_kyc_row(GlobalConstant::EditKycRequest.processed_status)\n end", "def edit(*)\n super.tap do\n __debug_sim('USER initiates modification of existing entries.')\n end\n end" ]
[ "0.6632282", "0.61285096", "0.6050993", "0.6009865", "0.5945823", "0.5931325", "0.59235436", "0.58690375", "0.58276093", "0.5729558", "0.56906945", "0.5671893", "0.5607212", "0.5553339", "0.55198294", "0.5519742", "0.5479967", "0.54714584", "0.5465218", "0.5465218", "0.5457902", "0.5441901", "0.53997093", "0.5364759", "0.5358939", "0.5358939", "0.5356952", "0.53564256", "0.5355662", "0.53436065", "0.534247", "0.534247", "0.534247", "0.5340231", "0.5318467", "0.5308352", "0.5293619", "0.52934057", "0.52934057", "0.52934057", "0.52934057", "0.52934057", "0.52934057", "0.5269287", "0.5259271", "0.5254115", "0.5252356", "0.5217521", "0.52153736", "0.5205472", "0.5199835", "0.5199686", "0.5198694", "0.5197543", "0.51897043", "0.5183829", "0.51831716", "0.516384", "0.51516634", "0.5134346", "0.51327103", "0.5130055", "0.5126767", "0.5122561", "0.51184195", "0.51084137", "0.51011306", "0.50925475", "0.5091491", "0.5083595", "0.5081515", "0.50682676", "0.50589275", "0.5058437", "0.50577736", "0.50560445", "0.50534993", "0.5051369", "0.5051079", "0.50500864", "0.50500864", "0.50386137", "0.50363225", "0.5026052", "0.5020734", "0.5018515", "0.5016153", "0.5000422", "0.4998612", "0.49956077", "0.49942887", "0.49859914", "0.4984877", "0.49828556", "0.4982088", "0.49743664", "0.49692595", "0.4965749", "0.49547073", "0.49523622" ]
0.5825556
9
Deletes a use case of the application
def destroy @use_case = UseCase.find(params[:id]) @use_case.destroy respond_to do |format| format.html { redirect_to project_use_cases_path @project } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Seances::UseCases::Delete.new.call(id: params[:id])\n end", "def destroy\n @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def destroy_req_usecase\n find_user\n if !@user.nil?\n req=Requirement.find_by_id(session[:req_id])\n if !session[:req_id].nil? and !req.nil?\n @use_case=UseCase.find(params[:id])\n if !@use_case.nil? and @user.privilige!=\"Read\"\n @use_case.requirements.delete(req)\n end\n respond_to do |format|\n format.html { redirect_to show_usecases_url(req.id) }\n end\n else\n redirect_to requirements_path\n end\n else\n redirect_to sign_in_url\n end\n\n end", "def delete\n @exists = apps.include?(params[:app])\n @app = params[:app] unless @exists == false\n\n if @exists\n `rm #{File.expand_path(\"~/.pow/#{@app}\")}`\n redirect_to root_path, :notice => \"Pow app deleted\"\n else\n render :text => \"Given app is not a Pow app\"\n end\n end", "def delete\n results = submit_cmd('delete app instance',:db, \" -env #{self.belongs_to.env} -app_instance #{self.name}\")\n\n\t if ( results.to_s =~ /failure/i || results.to_s =~ /error/i)\n\t \t raise \"update attribute failed\" \n\t else\n\t \t self.belongs_to.appTemplates.delete(self)\n\t end\n\n end", "def destroy\n HardInfo.where(c_office: @use_case.c_office, use_case_no: @use_case.use_case_no, product_name: @use_case.product_name).destroy_all\n @use_case.destroy\n respond_to do |format|\n format.html { redirect_to use_cases_url }\n format.json { head :no_content }\n end\n end", "def delete_application\n node.rm(new_resource.node_attribute, new_resource.resource_name, new_resource.name)\n end", "def delete!\n execute_as_user(\"rm -rf #{app_dir}\")\n end", "def destroy\n @study_case.destroy\n end", "def delete_application(opts)\n opts = check_params(opts,[:applications])\n super(opts)\n end", "def delete_program_by_name(name)\n item = getProgramByName(name)\n item.destroy\nend", "def destroy\n @application_case.destroy\n respond_to do |format|\n format.html { redirect_to application_cases_url, notice: 'Application case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_requirement_use\n @user=find_user\n if !@user.nil?\n @use_req=Requirement.find_by_id(params[:id])\n if !session[:use_case_id].nil?\n @use_case=UseCase.find(session[:use_case_id])\n if !@use_case.nil? and @user.privilige!=\"Read\" and !@use_req.nil?\n @use_req.use_cases.delete(@use_case)\n end\n respond_to do |format|\n assign_project\n @attr=Attribute.find_by_project_id(session[:project_id])\n if !@use_case.nil?\n format.html { redirect_to show_requirements_url(@use_case.id) }\n else\n format.html { redirect_to use_cases_url }\n end\n end\n else\n redirect_to use_cases_path\n end\n else\n redirect_to sign_in_url\n end\n end", "def destroy\n @test_guide_scenario_sa.destroy\n head :no_content\n end", "def destroy\n @use = Use.find(params[:id])\n\n respond_to do |format|\n if @use.destroy\n format.html { redirect_to uses_url,\n notice: (crud_notice('destroyed', @use) + \"#{undo_link(@use)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to uses_url, alert: \"#{@use.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @use.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @test_case = current_user.test_cases.find(params[:id])\n @test_case.logical_delete\n \n respond_to do |format|\n format.html { redirect_to(test_cases_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_guide_scenario.destroy\n head :no_content\n end", "def destroy\n @quote = Quote.find(params[:quote_id])\n @use_case = UseCase.find(params[:id])\n @use_case.destroy\n\n respond_to do |format|\n format.html { redirect_to @quote }\n format.json { head :no_content }\n end\n realizarCostos\n end", "def destroy\n @usage = Usage.find(params[:id])\n @usage.destroy\n\n respond_to do |format|\n format.html { redirect_to usages_url }\n format.json { head :ok }\n end\n end", "def delete_recommendation\n choose_country\n \n puts \"The recommendation for #{@chosen_country.name.capitalize} has been deleted from Traveler's Insight.\"\n crud_menu\n end", "def destroy\n @usage.destroy\n respond_to do |format|\n format.html { redirect_to usages_url }\n format.json { head :no_content }\n end\n end", "def destroy_tracker_usecase\n find_user\n if !@user.nil?\n if !session[:tracker_id].nil?\n tracker=Tracker.find_by_id(session[:tracker_id])\n @use_case=UseCase.find(params[:id])\n if !@use_case.nil? and @user.privilige!=\"Read\" and !tracker.nil?\n @use_case.trackers.delete(tracker)\n respond_to do |format|\n format.html { redirect_to show_tracker_use_url(tracker.id) }\n end\n else\n redirect_to trackers_path\n end\n else\n redirect_to trackers_path\n end\n else\n redirect_to sign_in_url\n end\n\n end", "def destroy\n @program.destroy\n end", "def destroy\n @usage.destroy\n respond_to do |format|\n format.html { redirect_to usages_url, notice: 'Usage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n Fission::Action::VM::Deleter.new(self).delete\n end", "def destroy\n @test_suite = TestSuite.find(params[:test_suite_id])\n @test_case.destroy\n respond_to do |format|\n format.html { redirect_to test_suite_test_cases_url, notice: 'Test case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy \n\t\traise 'This feature is not supported'\n\tend", "def destroy\n @test_case = TestCase.find(params[:id])\n @test_case.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_cases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app.destroy\n redirect_to apps_url, notice: 'app was successfully deleted.'\n end", "def delete\n appctrl_delete( 'User' )\n end", "def destroy\n @use = Use.find(params[:id])\n @use.destroy\n\n respond_to do |format|\n format.html { redirect_to(uses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @customer_app.destroy\n end", "def perform_!\n message \"Are you sure you wish to delete #{y(c.application)} from the #{y(e.name)} environment (#{y(c.ip)})?\"\n if yes?\n message \"Deleting #{y(c.application)}.\"\n e.delete!\n end\n end", "def destroy\n @app.destroy\n\n head :no_content\n end", "def destroy\n @code_case.destroy\n respond_to do |format|\n format.html { redirect_to code_cases_url, notice: 'Code case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tab(name)\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def destroy\n \t@application_case = @case_req.application_case\n @case_req.destroy\n respond_to do |format|\n format.html { redirect_to @application_case, notice: 'Role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy(name)\n deprecate # 07/26/2012\n delete(\"/apps/#{name}\").to_s\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def destroy(name)\n\t\tdelete(\"/apps/#{name}\")\n\tend", "def delete_instance instance_id\n instances.delete_instance name: instance_path(instance_id)\n end", "def destroy\n @test_run.destroy\n redirect_to test_runs_url\n end", "def destroy\n @website_use = WebsiteUse.find(params[:id])\n @website_use.destroy\n\n respond_to do |format|\n format.html { redirect_to(website_uses_url) }\n format.xml { head :ok }\n end\n end", "def delete_application(application_aid)\n select_application gp_card_manager_aid\n secure_channel\n \n files = gp_get_status :files_modules\n app_file_aid = nil\n files.each do |file|\n next unless modules = file[:modules]\n next unless modules.any? { |m| m[:aid] == application_aid }\n gp_delete_file file[:aid]\n app_file_aid = file[:aid]\n end \n app_file_aid\n end", "def destroy\n @test_case_entry = TestCaseEntry.find(params[:id])\n @test_case_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_case_entries_url) }\n format.xml { head :ok }\n end\n end", "def delete_asg name\n auto_scaling = new_auto_scaling\n groups = auto_scaling.groups\n raise \"unable to delete asg, #{name}. asg not found!\" if groups[name].nil? \n\n asg = groups[name]\n\n puts \"deleting asg, #{asg.name}\"\n asg.delete({:force => true})\n delete_launch_configs\nend", "def destroy\n\n EscenarioIdeal.find(params[:id]).destroy\n flash[:success] = \"Escenario eliminado con éxito\"\n redirect_to escenario_ideals_url\n \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 delete_app_profile instance_id, app_profile_id, ignore_warnings: nil\n instances.delete_app_profile name: app_profile_path(instance_id, app_profile_id),\n ignore_warnings: ignore_warnings\n end", "def destroy\n @terms_of_use = TermsOfUse.find(params[:id])\n @terms_of_use.destroy\n\n respond_to do |format|\n format.html { redirect_to terms_of_uses_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete\n rc = NetUseDel.call(nil, @name, USE_NOFORCE)\n if rc != NERR_Success\n raise ArgumentError, get_last_error(rc)\n end\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 @cell_automaton.destroy\n file_path = Rails.root.join(\"public\", \"cell_automatons\", \"#{current_user.id}\")\n file_name = file_path.to_s + \"/\" + @cell_automaton.id.to_s\n File.delete(\"#{file_name}.rb\")\n \n redirect_to cell_automatons_url, notice: 'Cell automaton was successfully destroyed.'\n end", "def destroy\n @usage_record.destroy\n respond_to do |format|\n format.html { redirect_to @project }\n format.json { head :no_content }\n end\n end", "def destroy_usecase_file\n @user=find_user\n if !@user.nil?\n @file_use=UseCase.find_by_id(params[:id])\n if !session[:file_id].nil?\n @file=ProjectFile.find(session[:file_id])\n if !@file.nil? and @user.privilige!=\"Read\" and !@file_use.nil?\n @file_use.project_files.delete(@file)\n respond_to do |format|\n format.html { redirect_to show_file_uses_url(@file.id) }\n end\n else\n redirect_to project_files_path\n end\n else\n redirect_to project_files_path\n end\n else\n redirect_to sign_in_url\n end\n\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 @inden_usage.destroy\n respond_to do |format|\n format.html { redirect_to inden_usages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargapp_ad.destroy \n end", "def destroy\n @examination.destroy\n\n redirect_to examinations_url, notice: 'Simulate test was successfully destroyed.'\n\n\n end", "def destroy\n @app_instance.destroy\n respond_to do |format|\n format.html { redirect_to app_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user=find_user\n if !@user.nil?\n reqs=@use_case.requirements.find :all\n if @user.privilige==\"Admin\" and @use_case.status==\"Approved\"\n if @use_case.destroy\n delete_req(reqs)\n flash[:notice]=\"Use case#{params[:id]} was successfully deleted\"\n redirect_to use_cases_path\n else\n redirect_to :back\n end\n elsif !current_user.nil? and @user.id==@use_case.user_id and @use_case.status!=\"Approved\" and (@user.privilige!=\"Read\")\n if @use_case.destroy\n delete_req(reqs)\n flash[:notice]=\"Use case#{params[:id]} was successfully deleted\"\n redirect_to use_cases_path\n else\n redirect_to :back\n end\n elsif !current_member.nil? and @user.id==@use_case.member_id and @use_case.status!=\"Approved\" and (@user.privilige!=\"Read\")\n if @use_case.destroy\n delete_req(reqs)\n flash[:notice]=\"Use case#{params[:id]} was successfully deleted\"\n redirect_to use_cases_path\n else\n redirect_to :back\n end\n else\n flash[:notice]=t(:requirement_delete_message_with_out_permisson)\n redirect_to :back\n end\n else\n redirect_to sign_in_url\n end\n end", "def del\n delete\n end", "def destroy(name)\n delete(\"/apps/#{name}\").to_s\n end", "def destroy_experiment(_experiment)\n raise \"Not implemented\"\n end", "def destroy\n\t\t@test_case = TestCase.find_by_id(params[:test_case_id])\n\t\t@current = Problem.find_by_id(@test_case.problem_id)\n\t\tif @current.test_cases.count == 1\n\t\t\tflash[:notice] = \"Cannot delete problem's last test case\"\n\t\t\tredirect_to :back and return\n\t\telsif @test_case.destroy\n\t\t\tflash[:notice] = \"Test case successfully Deleted\"\n\t\t\tredirect_to(:controller => 'test_cases', :action => 'index', :problem_id => @current.id,\n\t\t\t\t:track_id => session[:track_id])\n\t\tend\n\tend", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def delete\n \n end", "def destroy\n\t\tbegin\n\t\t\tif(current_user.admin == \"yes\")\n\t\t\t\tsuite = TestSuites.find(params[:id])\n\t\t\t\tsuite.destroy!\n\t\t\t\tflash[:success] = \"Removed Test Suite Successfully\"\n\t\t\t\tlog_action('Delete', current_user ? current_user.username : 'Anonymous', params[:id], 'TestSuite')\n\t\t\t\tredirect_to action: \"index\", suitetype: params['type']\n\t\t\tend\n\t\trescue => e\n\t\t\tflash[:danger] = \"Failed to delete Suite - #{e.message}\"\n\t\t\tredirect_to action: \"index\", suitetype: params['type']\n\t\tend\n\tend", "def destroy\n @feature = Feature.find(params[:id])\n @feature.create_activity :destroy, owner: current_user\n @feature.destroy\n\n respond_to do |format|\n format.html { redirect_to({:action => :index}) }\n format.json { head :no_content }\n end\n end", "def destroy\n @instructor_app.destroy\n respond_to do |format|\n format.html { redirect_to instructor_apps_url, notice: 'Instructor app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @design_case.destroy\n respond_to do |format|\n format.html { redirect_to design_cases_url, notice: 'Design case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @showcase = Showcase.find(params[:id])\n @showcase.destroy\n\n respond_to do |format|\n format.html { redirect_to(showcases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: 'Test app was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_by_service\n Dcm4chee.application_entity_service.remove_ae(title)\n end", "def destroy\n @run = current_user.runs.find(params[:id])\n @run.destroy\n end", "def destroy\n @use_type.destroy\n respond_to do |format|\n format.html { redirect_to use_types_url, notice: 'Use type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_template.destroy\n\n head :no_content\n end", "def delete_vm_instance(name, namespace)\n @conn.vminstances.destroy(name, namespace)\n end", "def delete\n # TODO: implement delete\n end", "def destroy\n @test_app.destroy\n respond_to do |format|\n format.html { redirect_to test_apps_url, notice: \"Test app was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete_app_group(group,app)\n\t\t\tresults = submit_cmd('delete app group',:db,\" -env #{self.env} -domain #{self.domain} -plant #{self.plant} -group #{group} -app_instance #{app}\")\n\t\t\tputs results\n\tend", "def destroy\n @abuse = Abuse.find(params[:id])\n @abuse.destroy\n\n respond_to do |format|\n format.html { redirect_to(abuses_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @case.destroy\n respond_to do |format|\n format.html { redirect_to admin_cases_url, notice: 'Case was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam = Exam.find(params[:id])\n authorize! :delete, @exam\n @exam.destroy\n redirect_to exams_exam_group_path(@exam.exam_group)\n end", "def destroy\n @engine_run.destroy\n redirect_to admin_engine_runs_path, notice: \"Engine run was successfully deleted.\"\n end", "def destroy\n display\n if confirm [\"Are you totally completely sure you want to delete #{app} forever and ever?\", \"THIS CANNOT BE UNDONE! (y/n)\"]\n display \"+> Destroying #{app}\"\n client.app_destroy(app)\n display \"+> #{app} has been successfully destroyed. RIP #{app}.\"\n remove_app(app)\n end\n display\n end", "def destroy\n unless @edit_or_delete_right\n redirect_to exams_url,notice:\"您无权删除别人编写的考试\"\n end\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: '成功删除考试.' }\n format.json { head :no_content }\n end\n end", "def delete_application(client, options)\n if !options[:application].nil?\n application = client.applications.get options[:application]\n application.delete\n puts \"Application deleted.\"\n return\n else\n puts \"Missing arguments\"\n return\n end \nend", "def delete\n end", "def destroy\n\n @title = \"land use mapping\"\n\n @ss = SamplingSite.find(:first, :conditions => [ \"land_use_mappings_id = ?\", params[:id]])\n if !@ss.nil?\n flash[:error] = \"This entry cannot be deleted until used by another entries in the system...\"\n redirect_to :action => \"index\"\n return\n end\n\n @land_use_mapping = LandUseMapping.find(params[:id])\n @land_use_mapping.destroy\n\n respond_to do |format|\n format.html { redirect_to(land_use_mappings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @app = current_user.apps.find(params[:id])\n @app.destroy\n flash[:notice] = \"The #{@app.name} app was successfully deleted\"\n respond_to do |format|\n format.html { redirect_to apps_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @patentcase = Patentcase.find(params[:id])\n @patentcase.destroy\n\n respond_to do |format|\n format.html { redirect_to patentcases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @applicant_test.destroy\n respond_to do |format|\n format.html { redirect_to applicant_url(@applicant), notice: \"Test Eliminado Correctamente\" }\n format.json { head :no_content }\n end\n end", "def delete_program_by_id(item_id)\n item = get_program_by_id(item_id)\n item.destroy\n end", "def destroy\n @actividad = Actividad.find(params[:id])\n if @actividad.destroy()\n redirect_to actividads_path, :notice => \"El registro ha sido eliminado\";\n else\n redirect_to actividads_path, :notice => \"El registro NO ha podido ser eliminado\";\n end\n end" ]
[ "0.73807347", "0.6945137", "0.6421605", "0.6356166", "0.63010746", "0.6286685", "0.6251679", "0.61958724", "0.615406", "0.6138776", "0.61189294", "0.6116951", "0.61103696", "0.60968655", "0.60899067", "0.60757285", "0.6073721", "0.60648096", "0.6053792", "0.5994568", "0.59488904", "0.59224313", "0.59138817", "0.5903435", "0.58855027", "0.58732474", "0.5870111", "0.5869921", "0.5865551", "0.58649105", "0.5856467", "0.5841868", "0.5837786", "0.5828842", "0.5806478", "0.5805669", "0.58030254", "0.57908326", "0.5789299", "0.57775325", "0.57775325", "0.5764167", "0.5758806", "0.5754751", "0.5751384", "0.57340497", "0.57298654", "0.5727333", "0.5712363", "0.57095176", "0.57034427", "0.56913143", "0.56913143", "0.56913143", "0.56913143", "0.568887", "0.56886125", "0.5688049", "0.56869286", "0.5676572", "0.567389", "0.5673705", "0.5672733", "0.5671785", "0.5668196", "0.56611174", "0.5655232", "0.5654387", "0.56518996", "0.56498337", "0.56486213", "0.564785", "0.564635", "0.56400853", "0.563929", "0.56375045", "0.5634068", "0.5631256", "0.56131864", "0.5610585", "0.5609704", "0.5608176", "0.5605798", "0.5604638", "0.5601552", "0.55992585", "0.5598292", "0.5597431", "0.559619", "0.5595537", "0.55944073", "0.5589249", "0.5586106", "0.5584003", "0.5579611", "0.5576927", "0.55716723", "0.5568408", "0.55659634", "0.5563273" ]
0.67705977
2
Gives the template of an use case as JSON
def template_use_case @use_case_template = UseCaseTemplate.find(params[:use_case_template_id]) @json_obj = JSON.parse(@use_case_template.template_form) respond_to do |format| format.js {render 'template_form'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_name\n \"#{self.class.name.split('::').last.underscore}.json.jbuilder\"\n end", "def template(model_name)\n <<~HEREDOC\n {\n \"$schema\": \"http://json-schema.org/draft-04/schema#\",\n \"type\": \"object\",\n \"properties\": {}\n }\n HEREDOC\n end", "def get_template(template); end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def template; end", "def to_json\n config = to_hash.keep_if do |k, _|\n config_options.include?(k.to_sym)\n end\n config[:source] = template_file\n JSON.pretty_generate({ template: config.sort.to_h }, quirks_mode: true)\n end", "def template\n @template\n end", "def template_name; end", "def template_name; end", "def determine_template(options); end", "def cfn_template_json\n if File.exist?(f = \"#{cfn_template_stub}.json\")\n File.read(f)\n end\n end", "def to_json(pretty_generate=true)\n hash = self.to_hash\n\n body = hash['DOCUMENT']['TEMPLATE'][\"#{template_tag}\"]\n if body\n body_hash = JSON.parse(body)\n hash['DOCUMENT']['TEMPLATE'][\"#{template_tag}\"] = body_hash\n end\n\n if pretty_generate\n JSON.pretty_generate hash\n else\n hash.to_json\n end\n end", "def call(template)\n \"begin;#{template.source};end.to_rjson\"\n end", "def template(name); end", "def template\n return @template\n end", "def render(model, options)\n Template.new(model).to_json(options)\n end", "def template\n\t\t\t@signature[:templates][@action_name]\n\t\tend", "def to_s\n @template\n end", "def default_codaveri_test_case_template\n {\n id: '',\n type: 'expression',\n timeout: '',\n prefix: '',\n expression: '',\n display: 'str(out)'\n }\n end", "def json_reflect\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n h = {}\n params.each do |x,y|\n h[x]=y\n end\n write_json h\n end", "def get_template\n @template\n end", "def template\n @template.join(\"\\n\")\n end", "def template\n @template.join(\"\\n\")\n end", "def get_template(data)\n return data if data.is_a?(String)\n\n data.fetch('conf', nil)\nend", "def _template\n @template\n end", "def h\n @template\n end", "def template_for_options(opts = {})\n type = opts[:template_type] || 'log'\n if opts[:\"template-raw\"]\n Support::RawERbTemplate.new(opts[:\"template-raw\"])\n elsif opts[:template].is_a?(Support::Template)\n opts[:template]\n else\n template = opts[:template]\n template = \"default-#{type}\" if template.nil? || template.to_s == \"default\"\n Support::Template['mercurial', template]\n end\n end", "def get_template_text(template)\n if template.key? '_thunder_url'\n return template['_thunder_url']\n else\n return template.to_json\n end\n end", "def json_get\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n write_json @note if @note\n render :nothing => true\n end", "def template\n with_template_factory do |template_factory|\n template = template_factory.build('Test', {})\n puts Graphics::Debugger.new(template).debug\n end\n end", "def template\n @__template\n end", "def template\n @template.nil? ? format_underscore(shortname) : @template\n end", "def template\n @template.content\n end", "def t\n @template\n end", "def templates; end", "def template(arg=nil)\n set_or_return(:template, arg, :kind_of => String, :required => true)\n end", "def format(key, template)\n template.result(binding)\n end", "def to_json(template)\n document = {}\n skip = ['provider', 'connection', 'registration_time', 'plain']\n\n # Create document JSON\n document['provider'] = template['provider']\n document['connection'] = template['connection']\n document['registration_time'] = Time.now.to_i\n\n if CREDENTIALS_FILE.keys.include?(template['provider'])\n c_key = CREDENTIALS_FILE[template['provider']]\n c_file = template['connection'][c_key]\n\n # Load credentials file if exists\n begin\n if File.exist?(c_file)\n c_file = Base64.strict_encode64(File.read(c_file))\n end\n rescue StandardError => e\n return OpenNebula::Error.new(\"Loading credentials: #{e}\")\n end\n\n document['connection'][c_key] = c_file\n end\n\n template.each do |key, value|\n next if skip.include?(key)\n\n document[key] = value\n end\n\n document.to_json\n end", "def form_json\n render template: 'utils/form_json'\n end", "def name\n \"mustache\"\n end", "def as_json(options={})\n\t\tsuper(only: [:usage,:body])\n\tend", "def template_from_params\n case params[:view]\n when 'scouts'\n 'scouts'\n else\n 'liiikes'\n end\n end", "def h\n @template\n end", "def show\n render json: @exercise_template\n end", "def template_map\n \n end", "def hash_template\n template = {}\n \n info.each do | key, value |\n template[key] = generate_structure( value )\n end\n \n template\n end", "def customizeTemplate( \n _displayFormat = \"points\" # specify the type {values, points}\n )\n\n template = File.read(@filename)\n\n\n template.sub!('*****DETAIL*****', @dailyActivity.to_s)\n template.sub!('*****BADGES*****', [].to_s) # empty for now.\n template.sub!('*****FORMAT*****', \"\\\"#{_displayFormat}\\\"\")\n\n template.sub!('*****TOTAL*****', @dailyTotals.to_s)\n template.sub!('*****TARGET*****', @goalTarget.to_s)\n template.sub!('*****START*****', \"\\\"#{@startDate}\\\"\")\n template.sub!('*****END*****', \"\\\"#{@endDate}\\\"\")\n template.sub!('*****NAME*****', \"\\\"#{@name}\\\"\")\n\n return template\n end", "def default_data_for_template(name)\n {\n :name => name,\n :version => '0.0.1',\n :summary => \"A short description of #{name}.\",\n :homepage => \"http://EXAMPLE/#{name}\",\n :author_name => Executable.capture_command('git', %w(config --get user.name), :capture => :out).first.strip,\n :author_email => Executable.capture_command('git', %w(config --get user.email), :capture => :out).first.strip,\n :source_url => \"http://EXAMPLE/#{name}.git\",\n :ref_type => ':tag',\n :ref => '#{spec.version}',\n }\n end", "def template\n Kernel.const_get(template_name.upcase << '_TEMPLATE')\n end", "def resource_template(name)\n \"#{resource}_#{name}\"\n end", "def typus_template(attribute)\n options = read_model_config['fields']['options']\n if options && options['templates'] && options['templates'][attribute.to_s]\n options['templates'][attribute.to_s]\n end\n end", "def use_template(name)\n call \"_#{name}\"\n end", "def to_json(pretty_generate=true)\n hash = self.to_hash\n\n if hash['DOCUMENT_POOL'] && hash['DOCUMENT_POOL']['DOCUMENT']\n if !hash['DOCUMENT_POOL']['DOCUMENT'].instance_of?(Array)\n array = [hash['DOCUMENT_POOL']['DOCUMENT']]\n hash['DOCUMENT_POOL']['DOCUMENT'] = array.compact\n end\n\n hash['DOCUMENT_POOL']['DOCUMENT'].each { |doc|\n body = doc['TEMPLATE'][\"#{TEMPLATE_TAG}\"]\n if body && !body.empty?\n b_hash = JSON.parse(body)\n doc['TEMPLATE'][\"#{TEMPLATE_TAG}\"] = b_hash\n end\n }\n end\n\n if pretty_generate\n JSON.pretty_generate hash\n else\n hash.to_json\n end\n end", "def url_template; end", "def url_template; end", "def template\n @template ||= Ec2.template({:name =>@name, :key_name => @key_name, :image_id => @image_id, :instance_type => @instance_type, :security_groups => @security_groups})\n end", "def template\n File.read(File.expand_path('../../../../templates/activity.md.mustache', __FILE__))\n end", "def new\n @use_case = UseCase.new\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\n end\n end", "def raw\n @template\n end", "def rendered_templates; end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @use_case }\n end\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template\n @template ||= Template.new name: script_name, out_file: root_ruby_file, type: type\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template_package }\n end\n end", "def template\n if @client ==\"ORBOGRAPH\" || @client == \"ORB TEST FACILITY\"\n IO.read(File.dirname(__FILE__) + '/templates/' + organization_name.downcase.gsub(' ','_') + '_'+@batch_type+'_template.xml.erb')\n else\n IO.read(File.dirname(__FILE__) + '/templates/' + organization_name.downcase.gsub(' ','_') + '_template.xml.erb')\n end\n end", "def show\n render json: @default_email_template\n\n end", "def render( args )\n template_name\n end", "def show_template\n self.template\n end", "def show_template\n self.template\n end", "def _render_template(options); end", "def _render_template(options); end", "def template_name=(_arg0); end", "def template_name=(_arg0); end", "def template\n templater.template\n end", "def template_for(file); end", "def render\n inspect\n end", "def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end", "def generate_report(filename, template)\n file = File.read(filename)\n data_hash = JSON.parse(file)\n rpt_data = transform(data_hash)\n\n # Re http://stackoverflow.com/questions/1887845/add-method-to-an-instanced-object\n d = TemplateSource.new(rpt_data)\n\n template = File.read(template) if File.exist?(template)\n renderer = ERB.new(template, nil, '<>')\n renderer.result(d.get_binding)\nend", "def to_message_with_templates\n {\n attachment:{\n type: self.option_types,\n payload: {\n template_type: \"generic\",\n elements: self.get_templates\n }\n }\n }\n end", "def string_resource(resource)\n mystring=\"\\t\" + resource[:type].downcase + '{\"' + resource[:title] + '\":'+\"\\n\"\n resource[:parameters].each_pair do |k,v|\n if v.is_a?(Array)\n indent = \" \" * k.to_s.size\n\n mystring+=\"\\t #{k} => [\\n\"\n v.each do |val|\n mystring+=\"\\t #{indent} #{val},\\n\"\n end\n mystring+=\"\\t #{indent} ]\\n\"\n else\n mystring+=\"\\t #{k} => #{v}\\n\"\n end\n end\n mystring+=\"\\t}\\n\"\nend", "def build_conversion\n {\n \"tool\": {\n \"driver\": {\n \"name\": \"Salus\",\n \"informationUri\": DEFAULT_URI\n }\n }\n }\n end", "def get_item_template\n get_type_template(@source.types)\n end", "def template_str(indent=true)\n template_like_str('TEMPLATE', indent)\n end", "def template_str(indent=true)\n template_like_str('TEMPLATE', indent)\n end", "def template(data = {})\n str = dup\n\n data.each do |key, value|\n str.gsub!(\":#{key}\", value.to_s)\n end\n\n str\n end", "def node_template_data\n {'node' => @node, @node['classification'] => @node}\n end", "def inject_data(template)\n template['$INJECT_DATA'] = model.to_json\n template\n end", "def output_of(resource_type, resource_name, output_type)\n \"${#{resource_type}.#{resource_name}.#{output_type}}\"\n end", "def template\n @template || nil\n end", "def resource_base_name\n 'JSON'\n end", "def render_json\n hash = { :val1 => :param1, :val2 => :param2,\n :inner_hash => {:inner_val1 => :etc}\n }\n render :string => hash.to_json, :layout => false,\n :content_type => \"application/json\"\n end", "def type_template\n activity_types(false)[self.activity_type].to_s\n end", "def show\n @use_case = UseCase.find(params[:id])\n\n respond_to do |format|\n format.html do \n render layout: 'outside'\n end\n format.json { render json: @use_case }\n end\n end" ]
[ "0.64434576", "0.63143045", "0.6240932", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.6234062", "0.60990405", "0.6078205", "0.6074116", "0.6074116", "0.60605574", "0.6047795", "0.6011998", "0.60115516", "0.5996777", "0.5976033", "0.59388584", "0.58981913", "0.5881364", "0.58725274", "0.58701575", "0.585301", "0.5844823", "0.5844823", "0.58206064", "0.57845885", "0.57794136", "0.5746393", "0.57442576", "0.5734764", "0.57269686", "0.572361", "0.5722742", "0.57167184", "0.57142246", "0.57093114", "0.569931", "0.56978685", "0.5652027", "0.5648771", "0.5645236", "0.563886", "0.5635156", "0.5631864", "0.5627425", "0.561447", "0.5571101", "0.5540927", "0.5528716", "0.5524342", "0.55198455", "0.55189884", "0.5518186", "0.55161893", "0.5516111", "0.5516111", "0.5514829", "0.5510714", "0.5498794", "0.54934", "0.5492507", "0.54870594", "0.54870594", "0.548682", "0.548682", "0.5469465", "0.5467362", "0.54667133", "0.54476523", "0.5441261", "0.542467", "0.542467", "0.54175395", "0.54175395", "0.54088044", "0.54088044", "0.5402253", "0.53950775", "0.53913486", "0.5391139", "0.53845096", "0.53719205", "0.53682315", "0.53633213", "0.5358337", "0.53582263", "0.53582263", "0.5354774", "0.53532606", "0.53505975", "0.53467244", "0.5346043", "0.5338668", "0.53358364", "0.53319883", "0.5324934" ]
0.63804716
1
Gives the list of documents of a project to attach to a use case
def attach_document @use_case = UseCase.find(params[:id]) @document_projects = DocumentProject.where(:project_id => params[:project_id]) respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_doc_info\n if (@document == nil)\n return false\n end\n \n @collection = Collection.find(@document.collection)\n @project_list = []\n @collection.projects.each do |project|\n @project_list << project\n end\n end", "def show\n @project = Project.find(params[:id])\n db = MongoMapper.database\n @documents = db[\"documents\"].find( { \"_id\" => { \"$in\" => @project.document_ids} } )\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @project }\n format.json { render :json => @project }\n end\n end", "def index\n @documents = Document.where(project_id: session[:current_project_id]).order(:identifier)\n @project = current_project\n end", "def documents\n document_entries.map{ |f| FileObject[path, f] }\n end", "def documents_list_for_company(company_account_id)\n\n end", "def add\n\t\tbegin\n\t\t\tproject = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless project.present?\n\n\t\t\t# get the docspecs list\n\t\t\tdocspecs = if params[\"_json\"] && params[\"_json\"].class == Array\n\t\t\t\t\t\t\t\t\t\tparams[\"_json\"].collect{|d| d.symbolize_keys}\n\t\t\t\t\t\t\t\t\telsif params[\"sourcedb\"].present? && params[\"sourceid\"].present?\n\t\t\t\t\t\t\t\t\t\t[{sourcedb:params[\"sourcedb\"], sourceid:params[\"sourceid\"]}]\n\t\t\t\t\t\t\t\t\telsif params[:ids].present? && params[:sourcedb].present?\n\t\t\t\t\t\t\t\t\t\tparams[:ids].strip.split(/[ ,\"':|\\t\\n\\r]+/).collect{|id| id.strip}.collect{|id| {sourcedb:params[:sourcedb], sourceid:id}}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\traise ArgumentError, \"no valid document specification found.\" if docspecs.empty?\n\n\t\t\tdocspecs.each{|d| d[:sourceid].sub!(/^(PMC|pmc)/, '')}\n\t\t\tdocspecs.uniq!\n\n\t\t\tif docspecs.length == 1\n\t\t\t\tdocspec = docspecs.first\n\t\t\t\tbegin\n\t\t\t\t\tresult = project.add_doc(docspec[:sourcedb], docspec[:sourceid])\n\t\t\t\t\traise ArgumentError, \"The document already exists.\" if result == nil\n\t\t\t\t\texpire_fragment(\"sourcedb_counts_#{project.name}\")\n\t\t\t\t\texpire_fragment(\"count_docs_#{project.name}\")\n\t\t\t\t\texpire_fragment(\"count_#{docspec[:sourcedb]}_#{project.name}\")\n\t\t\t\t\tmessage = \"#{docspec[:sourcedb]}:#{docspec[:sourceid]} - added.\"\n\t\t\t\trescue => e\n\t\t\t\t\tmessage = \"#{docspec[:sourcedb]}:#{docspec[:sourceid]} - #{e.message}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# AddDocsToProjectJob.perform_now(project, docspecs)\n\n\t\t\t\tAddDocsToProjectJob.perform_later(project, docspecs)\n\t\t\t\tmessage = \"The task, 'add documents to the project', is created.\"\n\t\t\tend\n\n\t\trescue => e\n\t\t\tmessage = e.message\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_back fallback_location: root_path, flash: { notice: message}}\n\t\t\tformat.json {render json:{message:message}}\n\t\tend\n\tend", "def projects\n records \"project\", \"/project/list\"\n end", "def documents\n @mapped_documents ||= Basecamp3::Document.all(bucket.id, id)\n end", "def index\n \n @docfiles = Docfile.all\n end", "def add_from_upload\n\t\tbegin\n\t\t\tproject = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless project.present?\n\t\t\traise ArgumentError, \"sourcedb is not specified.\" unless params[\"sourcedb\"].present?\n\n\t\t\tsourcedb = params[\"sourcedb\"]\n\t\t\tfilename = params[:upfile].original_filename\n\t\t\text = File.extname(filename)\n\t\t\traise ArgumentError, \"Unknown file type: '#{ext}'.\" unless ['.txt'].include?(ext)\n\n\t\t\traise \"Up to 10 jobs can be registered per a project. Please clean your jobs page.\" unless project.jobs.count < 10\n\n\t\t\tfilepath = File.join('tmp', \"add-docs-to-#{params[:project_id]}-#{Time.now.to_s[0..18].gsub(/[ :]/, '-')}#{ext}\")\n\t\t\tFileUtils.mv params[:upfile].path, filepath\n\n\t\t\t# AddDocsToProjectFromUploadJob.perform_now(project, sourcedb, filepath)\n\n\t\t\tactive_job = AddDocsToProjectFromUploadJob.perform_later(project, sourcedb, filepath)\n\t\t\tjob = Job.find_by(active_job_id: active_job.job_id)\n\t\t\tmessage = \"The task, '#{active_job.job_name}', is created.\"\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_back fallback_location: root_path, notice: message }\n\t\t\t\tformat.json {render json: {message: message, task_location: project_job_url(project.name, job.id, format: :json)}, status: :ok}\n\t\t\tend\n\t\trescue => e\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {redirect_back fallback_location: root_path, notice: e.message }\n\t\t\t\tformat.json {render json: {message: e.message}, status: :unprocessable_entity}\n\t\t\tend\n\t\tend\n\tend", "def getDocuments(projectId, queryMap)\t\t\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"\t\t\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap(queryMap))\t\t\r\n\t\t\t\treturn $documentParser.getDocuments(response)\r\n\t\t\tend", "def documents; end", "def documents; end", "def index\n semantic_breadcrumb @project.name\n if @project.manager?(current_user)\n @documents = @project.documents\n else\n ids = @project.assigns.where('user_id = ?', current_user.id).all.map{|d| d.document_id}\n @documents = Document.where('id in (?)', ids)\n end\n @documents = @documents.where(\"did = ?\", params[:did]) if params[:did].present?\n @documents = @documents.where(\"done = ?\", params[:done] == \"true\") if params[:done].present?\n @documents = @documents.where(\"curatable = ?\", params[:curatable] == \"true\") if params[:curatable].present?\n @documents.includes(:assigns)\n if params[:term].present?\n @documents = @documents.where(\"did like ? or title like ? or xml like ?\", \"%#{params[:term]}%\", \"%#{params[:term]}%\", \"%#{params[:term]}%\")\n end\n\n if sort_column == \"default\"\n @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\")\n else \n @documents = @documents.order(sort_column + \" \" + sort_direction)\n end\n @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\")\n unless request.format.json?\n # @documents = @documents.order(\"batch_id DESC, batch_no ASC, id DESC\").page(params[:page])\n @documents = @documents.page(params[:page])\n end \n end", "def create_doc_records(proposal)\n puts \"create_doc_records Not implemented\"\n end", "def external_documents\n DocumentFilter.new(documents: @external_documents).filter\n end", "def index\n @code_solution_attachments = CodeSolutionAttachment.all\n end", "def docs #returns string array of all documents in collection\n raise \"Must be implemented.\"\n return array_of_documents\n end", "def index\n @case_docs = CaseDoc.all\n end", "def index\n @functional_design_documents = FunctionalDesignDocument.all\n end", "def project_ids\n project_goal_docs = self.project_goals\n project_ids = project_goal_docs.collect {|pg| pg['project_key'] }\n end", "def upload_images_and_documents\n if params[:project][:images]\n params[:project][:images].each do |project_image|\n @project.images.create(image: project_image, document: false)\n end\n end\n\n if params[:project][:legal_documents]\n params[:project][:legal_documents].each do |project_doc|\n @project.images.create(image: project_doc, document: true)\n end\n end\n end", "def index\n # @results = []\n # @document.bioc_doc.all_relations.each do |a|\n # e = EntityUtil.get_relation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager\n @relations = @document.relations.where('`version`=?', @version)\n else\n @relations = @assign.relations\n end\n @relations = @relations.order(\"offset\")\n end", "def documents\n authorizations.map(&:document)\n end", "def files\n @study = Study.find(params[:study_id])\n @documents = @study.documents \n \n end", "def files\n files_equivs = \"\"\n @package.documents.each do |file|\n ActiveRecord::Base.logger.info(\"#{file.attach_file_name} #{file.install_path}\")\n files_equivs += \"#{file.attach_file_name} #{file.install_path}\\n\\t\"\n end\n files_equivs\n end", "def add_project_doc(project, document)\n document.project_id = project.id\n end", "def sample_documents\n HalOpenscience::Document.search(\"authIdFormPerson_s:#{docid}\", fields: ['citationFull_s'], limit: 5)\n .results\n .collect(&:citationFull_s)\n end", "def index\n @externaldocuments = Externaldocument.all\n end", "def index\n @documents_people = DocumentsPerson.all\n end", "def documents(params={})\n server.get(\"#{name}/_all_docs\", params)\n end", "def projects ; end", "def browse(options={})\n response = API.instance.send_request('docs.browse', options.merge(:category_id => self.scribd_id))\n documents = []\n response.elements['/rsp/result_set'].elements.each do |doc|\n documents << Document.new(:xml => doc)\n end\n return documents\n end", "def index\n @client_docs = ClientDoc.all\n end", "def eds_documents(data)\n docs = data&.dig('response', 'docs')\n docs = Array.wrap(docs).compact\n factory = blacklight_config.document_factory\n model_opt = { lens: blacklight_config.lens_key }\n docs.map { |doc| factory.build(doc, data, model_opt) }\n end", "def documents\n @documents ||=\n Array.wrap(options[:documents]).compact.presence ||\n (response['docs'] || []).map do |doc|\n document_factory.build(doc, self, options)\n end\n end", "def documents_for(path, site_path = '')\n ethon = ethon_easy_json_requester\n ethon.url = \"#{computed_web_api_url(site_path)}GetFolderByServerRelativeUrl('#{uri_escape path}')/Files\"\n ethon.perform\n check_and_raise_failure(ethon)\n\n threads = []\n rv = []\n result = JSON.parse( ethon.response_body )\n result['d']['results'].each do |file|\n file_struct = OpenStruct.new(\n title: file['Title'],\n path: file['ServerRelativeUrl'],\n name: file['Name'],\n url: \"#{base_url}#{file['ServerRelativeUrl']}\",\n created_at: Time.parse(file['TimeCreated']),\n updated_at: Time.parse(file['TimeLastModified']),\n record_type: nil,\n date_of_issue: nil,\n )\n\n threads << Thread.new {\n ethon2 = ethon_easy_json_requester\n server_relative_url = \"#{site_path}#{path}/#{file['Name']}\"\n ethon2.url = \"#{computed_web_api_url(site_path)}GetFileByServerRelativeUrl('#{uri_escape server_relative_url}')/ListItemAllFields\"\n ethon2.perform\n rs = JSON.parse(ethon2.response_body)['d']\n file_struct.record_type = rs['Record_Type']\n file_struct.date_of_issue = rs['Date_of_issue']\n\n rv << file_struct\n }\n end\n threads.each { |t| t.join }\n rv\n end", "def upload_multiple_documents(note,params)\n if params[:document_home].present?\n document=params[:document_home][:document_attributes]\n Document.upload_multiple_docs_for_task_or_note(document,note,current_user.id,params)\n end\n end", "def show_asset_files\n display_collection_of_folders_docs_tasks\n end", "def list_of_allowed_documents\n @client.make_request :get, profile_path\n end", "def index\n semantic_breadcrumb @project.name, @project\n semantic_breadcrumb \"Assign\"\n\n @assigns = @project.assigns\n @assigns_map = {}\n @assigns.each do |a|\n @assigns_map[\"#{a.document_id}-#{a.user_id}\"] = a\n end\n @documents = @project.documents\n @users = @project.users.where(\"role=1\").order('email asc')\n end", "def index\n @documents = current_user.documents.all\n end", "def upload_supporting_documents\n validate_documents_content_type\n validate_documents_page_size\n\n claim = ClaimsApi::AutoEstablishedClaim.get_by_id_or_evss_id(params[:id])\n raise ::Common::Exceptions::ResourceNotFound.new(detail: 'Resource not found') unless claim\n\n ClaimsApi::Logger.log(\n '526',\n claim_id: claim.id,\n detail: \"/attachments called with #{documents.length} #{'attachment'.pluralize(documents.length)}\"\n )\n\n documents.each do |document|\n claim_document = claim.supporting_documents.build\n claim_document.set_file_data!(document, EVSS_DOCUMENT_TYPE, params[:description])\n claim_document.save!\n ClaimsApi::ClaimUploader.perform_async(claim_document.id)\n end\n\n render json: claim, serializer: ClaimsApi::ClaimDetailSerializer, uuid: claim.id\n end", "def search(options)\n tm = TicketMaster.new(options[:provider], options[:authentication])\n projects = tm.projects(options[:project_attributes])\n puts \"Found #{projects.length} projects\"\n projects.each_with_index do |project, index|\n puts \"#{index+1}) Project #{project.name} (#{project.id})\"\n #read_project project\n #puts\n end\n exit\nend", "def index\n @text_on_pdfs = TextOnPdf.all\n end", "def index\n # @results = []\n # @document.bioc_doc.all_annotations.each do |a|\n # e = EntityUtil.get_annotation_entity(a)\n # a.locations.each do |l|\n # @results << {did: @document.did, offset: l.offset, text: a.text, length: l.length, infons: a.infons }\n # end\n # end\n @project = @document.project\n @version = params[:version] || @document.version\n @version = @version.to_i if @version.present?\n @is_manager = @project.manager?(current_user)\n\n if @is_manager || @project.collaborate_round\n @annotations = @document.annotations.where('`version`=?', @version)\n else\n @annotations = @assign.annotations\n end\n @annotations = @annotations.order(\"offset\")\n end", "def associates\n self.doc_refs\n end", "def documenturls91\n return unless object.documents.attachments\n document_urls = object.documents.map do |adoc| \n URI.join(\n ActionController::Base.asset_host, \n rails_blob_path(adoc))\n end\n end", "def add(projectId, document)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/documents/\"\r\n\t\t\t\tfileBody = Hash.new\r\n\t\t\t\tfileBody[\"uploaddoc\"] = document.getUploaddoc\r\n\t\t\t\tresponse = ZohoHTTPClient.post(url, getQueryMap, document.toParamMAP, fileBody)\t\t\r\n\t\t\t\treturn $documentParser.getDocument(response)\r\n\t\t\tend", "def index\n\n @documentable = find_resource\n @documents = @documentable.documents\n\n end", "def projects\n return forbidden unless current_account # already returns a 401 if credentials aren't supplied\n opts = { :include_document_ids => params[:include_document_ids] != 'false' }\n @response = {'projects' => Project.accessible(current_account).map {|p| p.canonical(opts) } }\n render_cross_origin_json\n end", "def list\n @documentations = Documentation.not_article.order('created_at DESC')\n end", "def document_entries\n entries.select{ |f| File.file?(File.join(path,f)) }\n end", "def documents\n response = API.instance.send_request('docs.getList', { :session_key => @attributes[:session_key] })\n documents = Array.new\n response.elements['/rsp/resultset'].elements.each do |doc|\n documents << Document.new(:xml => doc, :owner => self)\n end\n return documents\n end", "def docs\n @docs ||= []\n end", "def included_files\n ['Compile', 'Content', 'EmbeddedResource', 'None'].map { |item_name|\n proj_xml_node.xpath(\"/x:Project/x:ItemGroup/x:#{item_name}\",\n 'x' => \"http://schemas.microsoft.com/developer/msbuild/2003\").collect { |f|\n debug \"#{name}: #included_files looking at '#{f}' [albacore: project]\"\n link = f.elements.select { |el| el.name == 'Link' }.map { |el| el.content }.first\n OpenStruct.new(\n :item_name => item_name.downcase,\n :link => link,\n :include => f['Include']\n )\n }\n }.flatten\n end", "def index\n @doc_artefacts = DocArtefact.all\n end", "def index\n @group_docs = GroupDoc.all\n end", "def design_docs\n req = make_http_request(\"/pools/default/buckets/#{bucket}/ddocs\",\n :type => :management, :extended => true)\n docmap = {}\n req.on_body do |body|\n res = MultiJson.load(body.value)\n res[\"rows\"].each do |obj|\n if obj['doc']\n obj['doc']['value'] = obj['doc'].delete('json')\n end\n doc = DesignDoc.wrap(self, obj)\n key = doc.id.sub(/^_design\\//, '')\n next if self.environment == :production && key =~ /dev_/\n docmap[key] = doc\n end\n yield(docmap) if block_given?\n end\n req.continue\n async? ? nil : docmap\n end", "def documents\n collections.each_with_object(Set.new) do |(_, collection), set|\n set.merge(collection.docs).merge(collection.files)\n end.to_a\n end", "def documents\n Hancock::Request.send_get_request(\"/envelopes/#{envelope_id}/documents\")[\"envelopeDocuments\"]\n end", "def contents(project)\n # Se crea un hash de condiciones para hacer la busqueda de contenidos\n cond = Hash[:project_id => project.id]\n # Se obtiene el usuario conectado\n us = User.find(session[:user_id])\n # Si es contacto se setea la condicion de acceso a clientes\n cond[:access_client] = true if us.class == Contact\n # Si es administrador se setea la condicion de acceso a administrador o usuario moove-it\n cond[:access_moove_it] = true if us.class != Contact and !us.is_admin\n # Se buscan los contenidos, asociados al proyecto dado, que cumples las condiciones dadas anteriormente\n Content.find(:all, :conditions => cond, :order => 'created_at desc')\n end", "def index\n @document_items = DocumentItem.all\n end", "def projects\n @projects\n end", "def index\n @docu_signs = DocuSign.where(:user => current_account.user)\n @docu_templates = DocuTemplate.includes(:docu_signs).order(\"created_at DESC\").all\n end", "def index\n @q = current_department.documents.ransack(params[:q])\n @documents = @q.result.distinct(:true).includes(department_documents: :department).joins(:department_documents).order(id: :desc).page(params[:page])\n end", "def project_get(project)\n project_find(project)\n projects = @project.all('a[class=table-link]') if @project\n\n project_names = []\n if projects\n projects.each do |proj|\n project_names << proj.text\n end\n else\n project_names = nil\n end\n project_names\n end", "def documents_batch_details(guids)\n get \"/api/documents/#{guids.join(',')}/batch_details.xml\"\n end", "def index\n @doc_templates = DocTemplate.all\n end", "def index\n @attachfiles = Attachfile.all\n end", "def results\n documents\n end", "def extract\n begin\n return [] unless (@project && @gxdb)\n\n doc = Utility.base_doc(@project, @label)\n\n doc.merge!(interpreters)\n doc.merge!(version_and_coordsys)\n doc.merge!(proj_file_stats)\n doc.merge!(proj_db_stats)\n\n doc[:surface_bounds] = surface_bounds\n doc[:activity_score] = activity_score(doc)\n\n doc = purge_ages(doc)\n\n [doc] # array to be consistent with other extractors\n\n rescue Exception => e\n puts e.message\n puts e.backtrace\n raise e\n ensure\n @gxdb.disconnect if @gxdb\n end\n\n end", "def project\n request :project\n end", "def inputs; [object.document_id]; end", "def index\n @pub_attachments = PubAttachment.all\n end", "def cross_project\n []\n end", "def index\n @trial_documents = TrialDocument.all\n end", "def index\n @document_lists = DocumentList.all\n end", "def show_documents\n @document = Document.where(:extension_id => params[:id])\n @extension = Extension.find(params[:id])\n end", "def index\n\t\t@search = Project.search do\n\t\t\tfulltext params[:search]\n\t\tend \n\t\t@projects = @search.results\n end", "def index\n @design_versions = @project.design_version.all\n end", "def export_project(project)\n return [\n project.id,\n project.name,\n project.description,\n project.homepage,\n project.is_public ? 1 : 0,\n project.parent ? project.parent.identifier : nil,\n project.created_on ? project.created_on.strftime('%Y-%m-%d %H:%M:%S') : nil,\n project.updated_on ? project.updated_on.strftime('%Y-%m-%d %H:%M:%S') : nil,\n project.identifier,\n project.status,\n project.enabled_module_names * ',',\n project.trackers.collect(&:name) * ',',\n project.issue_custom_fields.collect(&:name) * ',',\n ]\n end", "def index\n @gov_docs = current_user.gov_docs\n end", "def file_categories(project_id)\n records \"attachment-category\", \"/projects/#{project_id}/attachment_categories\"\n end", "def index\n if @department.present?\n @documents = @department.documents.all\n else\n @documents = Document.all\n end\n end", "def index\n @descriptive_pages = DescriptivePage.where(Project_id: session[:current_project_id])\n @project = Project.find_by(id: session[:current_project_id])\n end", "def fetch_feature_docs\n docs=[]\n d = Dir[@source + \"/*.xml\"]\n #puts d.inspect\n\n d.entries.each do |file|\n docs << file\n end\n #puts docs.inspect\n docs\n end", "def visible_documents\n permissions = self.permissions.find(:all, \n :conditions => [\"controller = ? AND action = ?\", \"documents\", \"show\"])\n ids = permissions.collect{|p| p.subject_id}\n Document.find(:all, :conditions => {:id => ids||[]})\n end", "def call\n response = client.mget options\n\n pairs = response[\"docs\"].map { |doc| [doc[\"_id\"], doc[\"_source\"]] }\n\n pairs.to_h\n end", "def listprojects()\n #loading array of all projects\n projects = Array.new(GoodData::Project.all)\n\n puts \"\"\n puts \"\"\n puts \"Listing GoodData projects available under provided credentials\"\n puts \"\"\n\n counter = 0\n #loop through projects and print their title and PID\n projects.each do |pr|\n counter += 1\n puts \"#{counter}. \"+pr.title+\" - \"+pr.pid\n end\n puts \"\"\n puts \"\"\n\n #get the number of the project from the user\n print \"Choose project:\"\n\n pnum = gets.chomp.to_i - 1\n\n wrkproj = projects[pnum]\n project_detail(wrkproj)\nend", "def design_docs\n DesignDocAccess.new(self)\n end", "def document_params\n params.require(:document).permit(:title, :download_path, :source_path, :email, {source_files: []})\n end", "def index_documents\n @params = {}\n @action = 'index_documents'\n \n send_auth_request\n end", "def project_params\n params.require(:project).permit(:name, :summary, :start_date, :end_date, :description, :location, :hashtag, documents_attributes: [:id, :name, :category, :media, :description, :_destroy])\n end", "def projects\n DataStore.projects\n end", "def all\n include_docs!\n docs\n end", "def index\r\n @documents = Document.all\r\n @appoint_responsible = AppointResponsible.new\r\n end", "def list\n\t\tdocs = proxy_database.view(\"#{shared_data_context.name}/all\")[\"rows\"]\n\t\treturn docs\n \tend", "def get_all_attachments\n begin\n \n if @filename == ''\n raise 'filename not specified'\n end\n \n \n total_attachments = self.get_attachments_count\n \n all_attachments = Array.new\n \n index = 1\n while index <= total_attachments\n \n all_annotations.push(self.get_attachment(index))\n \n index+=1\n end\n \n return all_attachments\n \n \n rescue Exception=>e\n print e\n end\n end", "def index\n @q = DepartmentDocument.where(department_id: current_department.id).ransack(params[:q])\n @department_documents = @q.result.includes(:department, document: :department).page(params[:page]).order(id: :desc)\n end" ]
[ "0.6299673", "0.62958926", "0.62486595", "0.605626", "0.600205", "0.5984258", "0.5937808", "0.5890469", "0.58486956", "0.5818114", "0.5812338", "0.5805676", "0.5805676", "0.5782263", "0.573144", "0.5657223", "0.56364506", "0.56298465", "0.5612092", "0.55874085", "0.5585975", "0.5579725", "0.5545791", "0.5538754", "0.55214506", "0.5505671", "0.5496779", "0.5489055", "0.54823273", "0.547757", "0.5458773", "0.5457395", "0.5434824", "0.54347205", "0.54296225", "0.5428079", "0.54250836", "0.5409957", "0.5408766", "0.5406453", "0.5388399", "0.5385636", "0.53807104", "0.5377439", "0.5376081", "0.53757536", "0.537007", "0.5368079", "0.5364244", "0.53637844", "0.5363688", "0.5360286", "0.53598547", "0.5359105", "0.53555274", "0.5341837", "0.53402007", "0.5338098", "0.5336565", "0.53236765", "0.53158706", "0.53092766", "0.5306766", "0.5305014", "0.5302831", "0.530195", "0.5289122", "0.5284756", "0.52825546", "0.52747375", "0.52737343", "0.527337", "0.5263889", "0.52629995", "0.5259039", "0.5251319", "0.5248525", "0.52429575", "0.52363074", "0.5236007", "0.52357", "0.523387", "0.5232527", "0.52323896", "0.52303493", "0.5229413", "0.522056", "0.5219602", "0.52192044", "0.52158445", "0.5214201", "0.52121633", "0.5211649", "0.5201219", "0.5195727", "0.51952213", "0.5186766", "0.51867366", "0.51859945", "0.5179209" ]
0.7113177
0
Adds or removes a document of a use of case
def add_document @use_case = UseCase.find(params[:id]) document_project = DocumentProject.find(params[:document_project_id]) text = @use_case.add_remove_document(document_project,params[:add]) flash[:notice] = text respond_to do |format| format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_document(doc)\n @documents[doc.uuid] = doc\n end", "def srch_add(opts={})\n\t\t\t\tsrch_client.add_document(opts)\n\t\t\tend", "def addDoc(doc)\n @docs[doc.target] = doc\n end", "def update\n replace_entry \"word/document.xml\", doc.serialize(:save_with => 0)\n end", "def <<(doc)\n @documents[doc.uuid] = doc\n end", "def add(doc)\n connection.add(doc)\n connection.commit if commit_after_change\n end", "def remove_document(doc)\n @documents.delete_if{|document| document == doc }\n end", "def add(doc, uri=nil, content_type=nil)\n return _put_doc(doc, uri, content_type)\n end", "def add doc\n if doc.respond_to? :attributes\n @documents << doc\n else\n raise ArgumentError, 'missing method attributes'\n end\n end", "def add(document)\n @rest.post(\"/#{@db_name}\", [document])\n end", "def cloud_search_delete_document(doc)\n doc.version += 1\n self.cloud_search_batcher_command(:delete_document, doc)\n end", "def reserve(doc)\n Document.where(\n :typ => doc['type'], :ide => doc['_id'], :rev => 1\n ).delete_all > 0\n end", "def add_or_update_file(complete_path)\n document = Document.default_fields_for(complete_path)\n begin\n document.merge! PlainTextExtractor.extract_content_and_language_from(complete_path)\n raise \"empty document #{complete_path}\" if document[:content].strip.empty?\n logger.add_document document\n rescue => e\n logger.reject_document document, e\n end\n index << document\n end", "def update_document_tags(doc)\n idx = fetch_index(doc.repo)\n return nil if (! idx)\n # no way to check if doc exists in index! just call replace (add/del)\n idx.replace(doc)\n # FIXME: update cached list of known tags, if cached\n end", "def update_with_document(doc_data)\n begin\n self.transaction do \n document = doc_data.slice(\n :name, :phase_id, :bookmark, :privilege,\n :description, :author, :source,:doc_source_id,\n :employee_user_id, :created_by_user_id)\n document.merge!({\n :document_home_id => self.id,\n :doc_type_id => doc_data[:category_id]})\n doc= self.latest_doc\n if doc.update_attributes(document) && self.save\n true\n else\n doc.errors.each do |error|\n self.errors.add(error[0], error[1])\n end\n false\n end\n end\n rescue\n false\n end\n end", "def reserve(doc)\n\n r = collection(doc).remove(\n { '_id' => doc['_id'] },\n :safe => true)\n\n r['n'] == 1\n end", "def add_doc(id)\n doc = JSON.parse(File.read(File.expand_path(\"../fixtures/#{id}.json\", __FILE__)))\n solr.add(doc)\n solr.commit\n end", "def save_or_create(db, doc_id)\n begin\n puts \"Trying to create a new testing design document with a view by_automation...\".cyan\n db.save_doc({\"_id\" => doc_id, :views => { :by_automation => { :map => \"function(doc) { if (doc.content.testing == 'SELCUKE') { emit(doc.content.general.oi, doc._id); } }\" } } })\n rescue CouchRest::Conflict => nfe\n puts \"Design document already exists, updating existing design document with view...\".yellow\n doc = db.get('_design/testing')\n rev = db.get(doc['_id'])['_rev']\n db.save_doc({\"_id\" => doc_id, \"_rev\" => rev, :views => { :by_automation => { :map => \"function(doc) { if (doc.content.testing == 'SELCUKE') { emit(doc.content.general.oi, doc._id); } }\" } } })\n puts \"Updated testing design document with rev# \\\"#{rev}\\\"\".cyan\n end\n end", "def set_case_doc\n @case_doc = CaseDoc.find(params[:id])\n end", "def add_document_by_uuid(uuid)\n @documents[uuid] = Document.new(uuid)\n end", "def create_design_doc(id,doc)\n @conn.query({url_path: \"#{database}/_design/#{id}\", opts: doc, method: :put})\n end", "def receive_document(doc)\n folder.documents << doc\n end", "def add_to_doc_hash(doc_id, word, count)\n if $doc_hash.key?(doc_id)\n $doc_hash[doc_id][:size] += count\n if $doc_hash[doc_id].key?(word)\n $doc_hash[doc_id][word] += count\n else\n $doc_hash[doc_id][word] = count\n end\n else\n $doc_hash[doc_id] = {}\n $doc_hash[doc_id][:size] = count\n $doc_hash[doc_id][word] = count\n end\nend", "def add_document(classification, feature_vector)\n reset_cached_probabilities\n \n @number_of_documents_in_class[classification] += 1\n @number_of_documents += 1\n \n feature_vector.each do |feature|\n @features[feature.name] ||= FeatureCount.new\n @features[feature.name].add_count_for_class(feature.value, classification)\n end\n end", "def orchio_put_if_match(document, ref)\n response = client.send_request :put, inst_args(json: document, ref: ref)\n set_ref_value response\n orchio_status response, 201\n end", "def add_document(opts={})\n raise ArgumentError, \":title is required\" if opts[:title].nil?\n raise ArgumentError, \":body is required\" if opts[:body].nil?\n raise ArgumentError, \":url is required\" if opts[:url].nil?\n \n if opts[:tags].is_a?(Array)\n opts[:tags] = opts[:tags].join(\",\")\n end\n \n doc = opts.to_json\n \n Srchio::Response.new(self.class.post(\"/searchers/#{searcher_id}/documents\", :body => doc))\n end", "def add_doc(sourcedb, sourceid)\n doc = Doc.find_by(sourcedb: sourcedb, sourceid: sourceid)\n unless doc.present?\n new_docs, messages = Doc.sequence_and_store_docs(sourcedb, [sourceid])\n unless new_docs.present?\n message = messages.map do |m|\n if m.class == Hash\n m[:body]\n else\n m\n end\n end.join(\"\\n\")\n raise RuntimeError, \"Failed to get the document: #{message}\"\n end\n doc = new_docs.first\n end\n return nil if self.docs.include?(doc)\n doc.projects << self\n doc\n end", "def save doc\n if doc['_attachments']\n doc['_attachments'] = encode_attachments(doc['_attachments'])\n end\n if doc['_id']\n slug = CGI.escape(doc['_id'])\n CouchRest.put \"#{@root}/#{slug}\", doc\n else\n CouchRest.post \"#{@root}\", doc\n end\n end", "def update\n DOCUMENT_PATHS.each do |attr_name, path|\n if path.match(/\\*/)\n instance_variable_get(\"@#{attr_name}\").each do |simple_file_name, contents|\n replace_entry(\"word/#{simple_file_name}.xml\", contents.serialize(save_with: 0))\n end\n else\n xml_document = instance_variable_get(\"@#{attr_name}\")\n replace_entry path, xml_document.serialize(save_with: 0) if xml_document\n end\n end\n end", "def regenerate?(document); end", "def add_doc(doc_id, fields, opts = {})\n call(ft_add(doc_id, fields, opts))\n end", "def create_doc(doc)\n @conn.query({url_path: \"#{database}\", opts: doc, method: :post})\n end", "def delete_additional_document(doc_refno)\n call_ok?(:delete_document, request_delete_additional_document_elements(doc_refno))\n end", "def add_to_index(url, doc)\n unless is_indexed(url)\n # FIXME: replace with logging\n puts \"Indexing #{url}...\"\n \n # Get the individual words\n text = get_text_only(doc)\n words = separate_words(text)\n \n u = Url.find_by_url(url)\n if u.nil?\n u = Url.create!(:url => url)\n end\n \n # Link each word to this url\n words.each_with_index do |word, i|\n unless IGNORE_WORDS.member?(word)\n w = Word.find_by_word(word)\n if w.nil?\n w = Word.create!(:word => word)\n end\n w.word_locations.create!(:url_id => u.id, :location => i)\n end\n end\n end\n end", "def update\n save_doc\n end", "def solr_add(add_document)\n Solarize::Post.execute(Solr::Request::AddDocument.new(add_document))\n end", "def assign_current_document!; end", "def update_doc(doc)\n id = doc[\"_id\"] if doc[\"_id\"]\n\n @conn.query({url_path: \"#{database}/#{id}\", opts: doc, method: :put})\n end", "def add(word, w)\n if word != \"\" \n cur = self\n word.downcase.each_char do |character|\n modified_char = @@vowels.include?(character) ? '*' : character\n cur.kids[modified_char] = SpellingTrie.new if not cur.kids.has_key? modified_char\n cur = cur.kids[modified_char]\n end\n cur.words_here.add(w)\n end\n end", "def update!(**args)\n @doc_tag = args[:doc_tag] if args.key?(:doc_tag)\n end", "def process_document(line, table, id, ids)\r\n if params[:do_update] == '1' \r\n doc = dc_find_document(table, id, ids)\r\n# document found. Update it and return\r\n if doc\r\n doc.update( update_json(ActiveSupport::JSON.decode(line), true) )\r\n msg = dc_check_model(doc)\r\n return (msg ? \" ERROR! #{msg}\" : \" UPDATE. OK.\")\r\n end\r\n end\r\n# document will be added to collection \r\n if ids.to_s.size > 5\r\n#TODO Add embedded document\r\n \" NOT SUPPORTED YET!\"\r\n else\r\n doc = table.classify.constantize.new( update_json(ActiveSupport::JSON.decode(line)) )\r\n doc.save\r\n end\r\n msg = dc_check_model(doc)\r\n msg ? \" ERROR! #{msg}\" : \" NEW. OK.\" \r\nend", "def add_supporting_document(supporting_document)\n doc_refno = ''\n success = call_ok?(:add_document, request_supporting_document_elements(supporting_document)) do |response|\n break if response.blank?\n\n doc_refno = response[:doc_refno]\n end\n [success, doc_refno]\n end", "def put( doc, opts = {} )\n response = http_action :put, doc, opts.merge( :doc => doc )\n doc['_id'], doc['_rev'] = response['id'], response['rev'] if doc.kind_of? Hash\n response\n end", "def add_to_collection_solr_document_path (arg)\n \"/catalog/\" << arg.id << \"/add_to_collection\"\n end", "def process_document(line, table, id, ids)\r\n if params[:do_update] == '1' \r\n doc = dc_find_document(table, id, ids)\r\n # document found. Update it and return\r\n if doc\r\n doc.update( update_json(ActiveSupport::JSON.decode(line), true) )\r\n msg = dc_check_model(doc)\r\n return (msg ? \" ERROR! #{msg}\" : \" UPDATE. OK.\")\r\n end\r\n end\r\n # document will be added to collection\r\n if ids.to_s.size > 5\r\n #TODO Add embedded document\r\n \" NOT SUPPORTED YET!\"\r\n else\r\n doc = table.classify.constantize.new( update_json(ActiveSupport::JSON.decode(line)) )\r\n doc.save\r\n end\r\n msg = DrgCms.model_check(doc)\r\n msg ? \" ERROR! #{msg}\" : \" NEW. OK.\" \r\nend", "def insert_resource(doc)\n self.collection.insert(doc)\n end", "def orchio_put(jdoc)\n response = client.send_request :put, inst_args(json: jdoc)\n if cache.enabled?\n simple_cache.save(\n Document.new(\n response.body.to_hash,\n Metadata.new(\n :collection => ocollection,\n :key => @id,\n :ref => response.header.etag\n )))\n end\n set_ref_value response\n orchio_status response, 201\n end", "def update_doc(doc)\n assert_type(doc, Wgit::Document)\n selection = { 'url.url' => doc.url }\n doc_hash = Wgit::Model.document(doc).merge(Wgit::Model.common_update_data)\n update = { '$set' => doc_hash }\n mutate(true, :documents, selection, update)\n end", "def create_document\n # rubocop:disable Lint/AmbiguousOperatorPrecedence\n if template.metadata['subject'].presence &&\n template.metadata['subject'].casecmp('ela').zero? || template.prereq?\n @document = Document.actives.find_or_initialize_by(file_id: downloader.file_id)\n else\n @document = foundational? ? find_core_document : find_fs_document\n id_field = foundational? ? :foundational_file_id : :file_id\n\n @expand_document ||= @document.present?\n\n @document[id_field] = downloader.file_id if @document.present?\n @document ||= Document.actives.find_or_initialize_by(id_field => downloader.file_id)\n end\n # rubocop:enable Lint/AmbiguousOperatorPrecedence\n end", "def insert_document_if_not_exists(collection, document)\n apk = document['n']\n version_code = document['verc']\n version_name = document['vern']\n publish_date = document['dtp']\n query = \"{'n' => '#{apk}', 'verc' => '#{version_code}'}\"\n # for paid apps, use the release date as a key instead of version code.\n if version_name.nil? and version_code.nil?\n query = \"{'n' => '#{apk}', 'dtp' => '#{publish_date}'}\"\n end\n cursor = collection.find_one(eval(query))\n if cursor.nil?\n id = collection.insert(document)\n @@log.info(\"Inserted a new document for apk: #{apk}, version code: #{version_code}, version name: #{version_name}, document id = #{id}\")\n else\n @@log.info(\"Document already exists for apk: #{apk}, version code: #{version_code}, version name: #{version_name}, release date: #{publish_date}\")\n end\n end", "def find_or_create_documents!\n @find_or_create_documents ||= save!\n end", "def add(document)\n # TODO: Need to validate that it is not already in there?\n doc_id = Maglev::System.increment_pcounter(MDB::SHARED_COUNTER)\n raise DocumentAlreadyExists if @documents.key? doc_id # Shouldn't happen...\n @documents[doc_id] = document\n\n # set the id field, if it has one\n document.id = doc_id if document.respond_to? :id=\n\n # We do the callback within the txn so that the model can\n # persistently update data structures and commit them.\n @view.document_added(doc_id, document) if @view.respond_to? :document_added\n doc_id\n end", "def update(doc)\n lock.synchronize do\n @uncommited[doc.id] = doc\n end\n end", "def upsert_design_document(document, namespace, options = UpsertDesignDocumentOptions.new)\n # PUT /{bucket_name}/_design/{namespace}_{name}\n end", "def write_doc_to_db(doc)\n if @db.upsert(doc)\n Wgit.logger.info(\"Saved document for url: #{doc.url}\")\n else\n Wgit.logger.info(\"Updated document for url: #{doc.url}\")\n end\n end", "def rebuild_document_collection()\n end", "def create_doc(doc_records)\n puts \"create_doc Not implemented\"\n end", "def add_word(word)\n \n end", "def add_to(parent_document)\n new_index = parent_document.toc.length\n insert(new_index, parent_document)\n end", "def <<(doc)\n doc = convert(doc)\n return self if include? doc['movie_id']\n\n super(doc).tap do |result|\n @parent.to_watch.delete doc['movie_id']\n end\n end", "def update!(**args)\n @document = args[:document] if args.key?(:document)\n end", "def update!(**args)\n @document = args[:document] if args.key?(:document)\n end", "def save\n doc['_id'] ||= BSON::ObjectId.new\n\n self.class.collection.find_one_and_update(doc.slice('_id'), doc, { :upsert => true })\n\n doc\n end", "def append(document)\n with_add_callbacks(document, already_related?(document)) do\n _target.push(document)\n characterize_one(document)\n bind_one(document)\n end\n end", "def add_document(attributes)\n folder.documents.create(attributes)\n end", "def delete(collection, doc)\n db = @mongo[collection]\n\n id = subs[key].id\n db[key].delete\n\n self.send({\n msg: 'removed',\n collection: collection,\n id: id\n })\n\n end", "def update(doc, uri=nil, content_type=nil)\n return _put_doc(doc, uri, content_type)\n end", "def add_word(word)\n word_hash = Digest::SHA1.hexdigest(word)\n word_file_path = ROOT_DATA_FOLDER + word_hash\n word_file = File.open(word_file_path, 'a+')\n words = word_file.readlines\n words.each {|word| word.sub! \"\\n\", ''} # remove trailing \\n\n word_index = words.index(word)\n\n if word_index.nil? # add new word to end of file with count = 1\n add_line_to_file(word_file_path, word)\n add_line_to_file(word_file_path, '1')\n else # add count to existing word by replacing count line in file\n word_count = words[word_index + 1].to_i\n add_line_to_file(word_file_path, (word_count + 1).to_s, word_index + 1)\n end\n word_file.close\n end", "def write_to(doc);end", "def store(version, uuid, doc, repo_uuid = @uuid)\n encoded_doc = encode_doc(doc)\n @tc_storage.put(version, encoded_doc)\n @tc_heads.put(uuid + repo_uuid, version)\n nil\n end", "def add_document(birthdate:, first_name:, last_name:, street:, postal_code:, country_code:, document_type:, document_value:)\n data = {\n doc: {\n birth_day: birthdate.day,\n birth_month: birthdate.month,\n birth_year: birthdate.year,\n name_first: first_name,\n name_last: last_name,\n address_street1: street,\n address_postal_code: postal_code,\n address_country_code: country_code,\n document_type: document_type,\n document_value: document_value\n }\n }\n\n @client.patch(path: \"/users/#{@user_id}\", oauth_key: @oauth_key, fingerprint: @fingerprint, json: data)\n end", "def remove_page\n @page = Page.find(params[:id])\n @document = @page.document\n\n @page.move_to_new_document\n\n end", "def cmd_add reference, description = 'TODO description'\n path = reference2path reference\n unless create_if_not_exist reference, path\n return\n end\n puts \"adding content to \" + reference\n open_vim path, :end_of_file, \n :add_line, \n :add_line, \n :append_desc, description, :add_line,\n :append_date,\n :add_line, \n :add_line \n end", "def add\n\t\tbegin\n\t\t\tproject = Project.editable(current_user).find_by_name(params[:project_id])\n\t\t\traise \"The project does not exist, or you are not authorized to make a change to the project.\\n\" unless project.present?\n\n\t\t\t# get the docspecs list\n\t\t\tdocspecs = if params[\"_json\"] && params[\"_json\"].class == Array\n\t\t\t\t\t\t\t\t\t\tparams[\"_json\"].collect{|d| d.symbolize_keys}\n\t\t\t\t\t\t\t\t\telsif params[\"sourcedb\"].present? && params[\"sourceid\"].present?\n\t\t\t\t\t\t\t\t\t\t[{sourcedb:params[\"sourcedb\"], sourceid:params[\"sourceid\"]}]\n\t\t\t\t\t\t\t\t\telsif params[:ids].present? && params[:sourcedb].present?\n\t\t\t\t\t\t\t\t\t\tparams[:ids].strip.split(/[ ,\"':|\\t\\n\\r]+/).collect{|id| id.strip}.collect{|id| {sourcedb:params[:sourcedb], sourceid:id}}\n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t[]\n\t\t\t\t\t\t\t\t\tend\n\n\t\t\traise ArgumentError, \"no valid document specification found.\" if docspecs.empty?\n\n\t\t\tdocspecs.each{|d| d[:sourceid].sub!(/^(PMC|pmc)/, '')}\n\t\t\tdocspecs.uniq!\n\n\t\t\tif docspecs.length == 1\n\t\t\t\tdocspec = docspecs.first\n\t\t\t\tbegin\n\t\t\t\t\tresult = project.add_doc(docspec[:sourcedb], docspec[:sourceid])\n\t\t\t\t\traise ArgumentError, \"The document already exists.\" if result == nil\n\t\t\t\t\texpire_fragment(\"sourcedb_counts_#{project.name}\")\n\t\t\t\t\texpire_fragment(\"count_docs_#{project.name}\")\n\t\t\t\t\texpire_fragment(\"count_#{docspec[:sourcedb]}_#{project.name}\")\n\t\t\t\t\tmessage = \"#{docspec[:sourcedb]}:#{docspec[:sourceid]} - added.\"\n\t\t\t\trescue => e\n\t\t\t\t\tmessage = \"#{docspec[:sourcedb]}:#{docspec[:sourceid]} - #{e.message}\"\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t# AddDocsToProjectJob.perform_now(project, docspecs)\n\n\t\t\t\tAddDocsToProjectJob.perform_later(project, docspecs)\n\t\t\t\tmessage = \"The task, 'add documents to the project', is created.\"\n\t\t\tend\n\n\t\trescue => e\n\t\t\tmessage = e.message\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\tformat.html {redirect_back fallback_location: root_path, flash: { notice: message}}\n\t\t\tformat.json {render json:{message:message}}\n\t\tend\n\tend", "def update!(**args)\n @documents = args[:documents] if args.key?(:documents)\n end", "def add(record)\n handle_drb_error { @server.add index_name, record.to_doc }\n end", "def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end", "def add_to_doc(str)\n @out_doc << str\n end", "def call\n refs = replace_refs\n replace_references(refs)\n\n doc\n end", "def record(record)\n @db.save_doc(record)\n end", "def remove_page\n\n @page = Page.find(params[:id])\n @document=@page.document\n\n @page.move_to_new_document\n\n end", "def add_project_doc(project, document)\n document.project_id = project.id\n end", "def add(word)\n end", "def save(doc, opts={})\n if doc.has_key?(:_id) || doc.has_key?('_id')\n id = doc[:_id] || doc['_id']\n update({:_id => id}, doc, opts.merge!({:upsert => true}))\n id\n else\n insert(doc, opts)\n end\n end", "def append_document append_docs, import_format_modes, source_folder\n begin\n \n if @filename == \"\"\n raise \"Base file not specified.\"\n end\n \n if append_docs.length != import_format_modes.length\n raise \"Please specify complete documents and import format modes.\"\n end\n \n str_uri = $productURI + \"/words/\" + @filename + \"/appendDocument\"\n signed_str_uri = Common::Utils.sign(str_uri)\n \n post_hash = Hash[\"DocumentEntries\",append_docs]; \n json_data = post_hash.to_json\n \n response_stream = RestClient.post(signed_str_uri,json_data,{:accept=>\"application/json\"})\n \n valid_output = Common::Utils.validate_output(response_stream)\n \n if valid_output == \"\" \n folder = SaasposeStorage::Folder.new\n if source_folder == \"\"\n output_stream = folder.getfile(@filename)\n else\n output_stream = folder.getfile( source_folder + \"/\" + @filename)\n end\n output_path = $OutPutLocation + @filename\n Common::Utils.saveFile(output_stream,output_path)\n return \"\"\n else\n return valid_output\n end\n \n \n rescue Exception=>e\n print e\n end\n end", "def add_word(word)\n @word_counts[word] ||= 0\n current_count = @word_counts[word] += 1\n @total_word_count += 1\n # If this word is new for this Group, it might be new for the entire Groupie\n @groupie.add_word(word) if current_count == 1\n nil\n end", "def write_doc_to_db(doc)\n @db.insert(doc)\n Wgit.logger.info(\"Saved document for url: #{doc.url}\")\n\n true\n rescue Mongo::Error::OperationFailure\n Wgit.logger.info(\"Document already exists: #{doc.url}\")\n\n false\n end", "def destroy_document(opts = {})\n es_client.delete document_path(opts)\n end", "def save_docs(docs, o = {})\n return 0 if !docs || docs.size == 0\n saved_count = 0\n docs = filter_existing_docs(docs) if @src.itype != 'file' && !o[:force]\n return 0 if !docs || docs.size == 0\n docs_db = Item.find_by_dids(docs.map{|d|d[:did]}).map_hash{|d|[d[:did],d]}\n debug \"[save_docs] #{docs_db.size}/#{docs.size} docs found from db\"\n docs.each do |doc|\n #debug \"[save_docs] Processing #{doc[:did]}\"\n next if @src.o[:insert_only] && docs_db[doc[:did]]\n doc_db = docs_db[doc[:did]] || Item.new\n next if doc_db.modified_flag || !doc_db.changed_content?(doc)\n begin\n #type = (doc[:itype] =~ /query/)? 'Query' : 'Document'\n doc_db.update_attributes(doc.merge(:source_id=>@src.id))\n #debug \"[save_docs] filter : #{@src.filter.inspect}\"\n if @src.filter && @src.filter.size > 0 && doc_db.validate_by_condition(@src.filter)\n info \"[collect] Document #{doc_db.did} filtered out!\"\n doc_db.destroy\n else\n doc[:metadata][:tag_list].split(\",\").each{|e|doc_db.create_and_link(e, 'tag','t')} unless doc[:metadata][:tag_list].blank?\n doc_db.create_and_link(doc[:metadata][:query], 'query','q') if doc[:metadata][:query]\n #doc_db.add_tags(doc[:metadata][:tag_list], \"s\") unless doc[:metadata][:tag_list].blank?\n doc_db.process_all\n saved_count += 1\n doc_db.save\n end\n rescue Exception => e\n error \"[save_docs] \"+[e.inspect,e.backtrace].join(\"\\n\")\n end\n end\n #puts \"[save_docs] saved_count = #{saved_count}\"\n saved_count\n end", "def agregar_docente\n\t\t@seccion = \"Docentes\"\n @titulo = \"Agregar docente\"\n\tend", "def set_doc\n @doc = @repository.docs.find_by_slug(params[:id])\n end", "def add_doc(doc)\n\n return if doc.nil?\n\n store_all_class_members(doc)\n\n next_doc = load_parent(doc)\n\n # Start recursing superclasses.\n add_public_and_protected(next_doc)\n\n end", "def doc(doc_or_int = 1)\n case doc_or_int\n when Wgit::Document\n append_doc(doc_or_int)\n when Array\n doc_or_int.each { |doc| append_doc(doc) }\n when Integer\n doc_or_int.times { @@docs << DatabaseTestData.doc }\n else\n raise \"Invalid data type: #{url_or_int.class}\"\n end\n end", "def orchio_put_if_none_match(document)\n orchio_put_if_match(document, '\"*\"')\n end", "def add_note(upload_id)\n upload = Upload.find(upload_id.to_i)\n \n if not @document.uploads.include?(upload)\n @document.uploads << upload\n end\n end", "def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end", "def add_docidentifier\n @bib.docidentifier.each do |i|\n case i.type\n when \"isbn\" then @item.isbn = i.id\n when \"lccn\" then @item.lccn = i.id\n when \"issn\" then @item.issn = i.id\n end\n end\n end", "def add_word(word)\r\n \r\n end", "def add_or_update_file(complete_path, thread_number)\n begin\n Timeout::timeout(60) do\n document=Document.find_by_complete_path(complete_path)\n if document then\n if document.supported? then\n if document.has_been_modified? then\n # If the document exists & has content that might have been modified, update it\n document.extract_doc_info!(:truncate)\n document.save\n logger.add_document(document, :update, thread_number)\n index << document.to_ferret_doc\n else\n # The document hasn't been modified, move along\n logger.ignore \"Identical\", complete_path, thread_number\n end\n else\n # The document isn't supported, move along\n logger.ignore \"Ignoring\", complete_path, thread_number\n end\n else\n # The document has not been indexed so far, create it and extract its content if supported\n document=Document[complete_path]\n if document.supported? then\n logger.add_document document, false, thread_number\n else\n logger.reject_document document, thread_number\n end\n index << document.to_ferret_doc\n end\n end\n rescue Exception => e\n # TODO: If TimeOut exceeded, ensure that at least some information about Document is written in DB\n # TODO: If TimeOut exceeded, ensure that no tmp file resides in /tmp\n logger.exception complete_path, e, thread_number\n end\n end", "def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end" ]
[ "0.64871144", "0.6246286", "0.61519283", "0.6036503", "0.5994312", "0.5976628", "0.582978", "0.56827986", "0.5631102", "0.56194687", "0.55908054", "0.5574139", "0.5523576", "0.54831684", "0.54561055", "0.54465383", "0.54449797", "0.54412913", "0.5429157", "0.5404755", "0.5403677", "0.54022384", "0.53988236", "0.5395319", "0.5373306", "0.53664464", "0.5358904", "0.53460443", "0.53421307", "0.53349125", "0.5319297", "0.53139627", "0.5308103", "0.52988744", "0.52954155", "0.5292145", "0.5277437", "0.52688694", "0.5261729", "0.5255934", "0.52545995", "0.5251508", "0.52421093", "0.52340424", "0.51934767", "0.5192328", "0.5188035", "0.51807666", "0.5170148", "0.51647985", "0.5157976", "0.515488", "0.51520187", "0.5149964", "0.51414806", "0.51360804", "0.5134707", "0.5133726", "0.513179", "0.5130716", "0.51203704", "0.51203704", "0.51188326", "0.51159716", "0.5097177", "0.50961244", "0.50943077", "0.5093257", "0.5091792", "0.5085503", "0.5076924", "0.507562", "0.50727636", "0.5071003", "0.50640345", "0.5050038", "0.50472605", "0.504673", "0.50449884", "0.5042401", "0.5041046", "0.50397855", "0.5039026", "0.50358385", "0.5028695", "0.50221074", "0.5021074", "0.50210696", "0.50209075", "0.5003506", "0.5001811", "0.5000783", "0.5000458", "0.49976146", "0.49947476", "0.4993351", "0.49908948", "0.4989101", "0.4985508", "0.49770057" ]
0.5533367
12
Gives the view of the requirement of a certain use case
def requirements @use_case = UseCase.find(params[:id]) @project = @use_case.project @requirements = @use_case.requirements respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_req\n @user=find_user\n if !@user.nil?\n @use_reqs=@use_case.requirements.find :all\n session[:use_case_id]=@use_case.id\n @attr=Attribute.find_by_project_id(session[:project_id])\n respond_to do |format|\n format.html { render \"requirements/index\" }\n end\n else\n redirect_to sign_in_url\n end\n\n end", "def show_use_case\n find_user\n if !@user.nil?\n assign_project\n @req=Requirement.find_by_id(params[:req])\n if !@req.nil?\n @req_use_cases=@req.use_cases.find(:all, :order => \"updated_at desc\")\n session[:req_id]=@req.id\n respond_to do |format|\n @attr=Attribute.find_by_project_id(session[:project_id])\n format.html { render \"use_cases/index\" }\n end\n else\n redirect_to requirments_path\n end\n\n else\n redirect_to sign_in_url\n end\n\n end", "def specific?\n @requirement.specific?\n end", "def specific?\n @requirement.specific?\n end", "def requirements; end", "def requirements; end", "def requirements; end", "def requirements; end", "def caloric_requirement\n age = current_age\n bmr = basal_metabolic_rate(age)\n if strength == 1\n caloric_requirement_st1(age, bmr).to_i\n elsif strength == 2\n caloric_requirement_st2(age, bmr).to_i\n else\n caloric_requirement_st3(age, bmr).to_i\n end\n end", "def show\n @requirement = @project.requirements\n @developers = Developer.by_availability\n end", "def viewable_dependant(obj)\n end", "def viewable_dependant(obj)\n end", "def viewable_dependant(obj)\n end", "def show\n @competences = Competence.all - @demand.competences\n @criterions = Criterion.all - @demand.criterions\n @explanations_props = { explanations: Explanation.to_react(@demand),\n demand: @demand.as_json(only: [ :id,\n :description,\n :name,\n :organization_profile_id ]),\n current_user: current_user.as_json(only: [ :id,\n :active_profile_id,\n :organization_account_id ]).merge({\"supplier\" => current_user.supplier?,\"customer\" => current_user.customer?}),\n # createExplanationPath: demand_explanations_path(@demand)\n }\n authorize @demand\n end", "def show\n @requirements = Requirement.where(project_id: current_project.id)\n end", "def input_requirement\n metric_card.formula_input_requirement\nend", "def matches_requirement?(query, option, requirement); end", "def view_need(id)\n needs_view_data(request(\"needs/view/#{id}.xml\", :auth => true))\n end", "def solved_view(type='html')\n if type.to_s == 'html'\n exercise_type.solved_partial\n end\n end", "def requirements ; @requirements ||= Requirement.requirements_of self ; end", "def requirement\n @dependency.requirement\n end", "def restriction\n end", "def details\r\n\t\treturn @feature + \". \" + @real_need.details\r\n\tend", "def resourceType\n 'ExplanationOfBenefit'\n end", "def purpose\n labware.plate_purpose\n end", "def modeler_description\n return 'This measure receives the power density level from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current power density of each case and it substitute it with the level chosen by the user.'\n end", "def restriction \n end", "def show\n @requirement = Requirement.find(params[:id])\n# @reqSteps = RequirementStep.order(\"position\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requirement }\n end\n end", "def overview\n case id\n when \"CDN-REALESTATE\"\n \"ETFs that provide exposure to the Canadian Real Estate market - broadly distributed across the country.\"\n when \"COMMODITIES\"\n \"ETFs that provide exposure to various commodities - generally considered as input to a growing economy.\"\n when \"US-LGCAP-STOCK\"\n \"ETFs that provide exposure to the equity of large, U.S. based companies.\"\n when \"US-LONG-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with long maturities.\"\n when \"INTL-REALESTATE\"\n \"ETFs that provide exposure to the International Real Estate market - broadly distributed across the globe.\"\n when \"US-REALESTATE\"\n \"ETFs that provide exposure to the U.S. Real Estate market - broadly distributed across the country.\"\n when \"US-SHORT-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with short maturities.\"\n when \"CDN-LONG-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with long maturities.\"\n when \"CDN-SHORT-BOND\"\n \"ETFs that provide exposure to Canadian Corporate debt, with short maturities.\"\n when \"US-SMCAP-STOCK\"\n \"ETFs that provide exposure to the equity of smaller U.S. based companies.\"\n when \"INTL-BOND\"\n \"ETFs that provide exposure to International Government & Corporate debt, with varying maturities.\"\n when \"US-SHORT-GOVT-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with shorter maturities.\"\n when \"US-MED-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with medium maturities.\"\n when \"CDN-STOCK\"\n \"ETFs that provide exposure to the equity of Canadian companies.\"\n when \"US-MED-GOV-BOND\"\n \"ETFs that provide exposure to U.S. Government debt, with medium maturities.\"\n when \"EMERG-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in countries classified as Emerging Markets.\"\n when \"US-LONG-CORP-BOND\"\n \"ETFs that provide exposure to U.S. Corporate debt, with longer maturities.\"\n when \"INTL-STOCK\"\n \"ETFs that provide exposure to the equity of companies based in Europe, Asia and the Far East (EAFE).\"\n else\n raise \"Asset class overview not prepared.\"\n end\n end", "def whole_views(new_political_view)\n case new_political_view\n when \"l\"\n \"Liberal\"\n when \"c\"\n \"Conservative\"\n when \"t\"\n \"Tea Party\"\n when \"s\"\n \"Socialist\"\n when \"n\"\n \"Neutral\"\n else\n \"Liberal\"\n end\n end", "def show_view_option\n uri = Addressable::URI.parse(request.fullpath.split(\"?\")[0] + \"?\" + generate_next_url)\n newUri = uri.query_values\n if newUri['view'].present?\n view_option = newUri['view'].to_s\n else\n view_option = \"detailed\"\n end\n return view_option\n end", "def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end", "def design\r\n \r\n end", "def requirement\n return @requirement if defined?(@requirement) and @requirement\n end", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def details\r\n\t\treturn @feature + \": #{@extra_cost} + \" + @real_need.details \r\n\tend", "def display_usage\n end", "def show\n @crit_requirement = CritRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @crit_requirement }\n end\n end", "def business_decision_support \n end", "def requirements(requirements); end", "def get_view_definition(design, view)\n design_documents = read_inheritable_attribute(:design_documents) || {}\n design_doc = design_documents[design.to_s]\n return nil unless design_doc\n return design_doc[:views][view]\n end", "def check_for_requirements; end", "def requirements=(_arg0); end", "def requirements=(_arg0); end", "def modeler_description\n return 'This measure receives the AntiSweat heater Control from the user. Then it looks for refrigerated display cases; it loops through them; it checks the current AntiSweat heater Control of each case and it substitute it with the one chosen by the user.'\n end", "def purpose\n end", "def description\n \"match the user's mental model of #{@collection_key}\"\n end", "def view_with_check_option_support\n nil\n end", "def fo_tool\n return actor.equips[0] if actor.primary_use == 1\n return actor.equips[1] if actor.primary_use == 2\n return actor.assigned_item if actor.primary_use == 3\n return actor.assigned_item2 if actor.primary_use == 4\n return actor.assigned_item3 if actor.primary_use == 5\n return actor.assigned_item4 if actor.primary_use == 6\n return actor.assigned_skill if actor.primary_use == 7\n return actor.assigned_skill2 if actor.primary_use == 8\n return actor.assigned_skill3 if actor.primary_use == 9\n return actor.assigned_skill4 if actor.primary_use == 10\n end", "def describe_their_ownership\n\t\tif self.forsale\n\t\t\treturn \"is selling a\" \n\t\telsif self.wanted \n\t\t\treturn \"wants to buy a\" \n else \n\t \t\treturn \"owns \" \n\t end \n\tend", "def facility; end", "def get_view(view_name)\r\n\t\t\tself.get_design_note(view_name, API::DFLAGPAT_VIEWS_AND_FOLDERS, View)\r\n\t\tend", "def show\n @requirement_level = RequirementLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @requirement_level }\n end\n end", "def get_html(req)\n @subsection = 'vehicle-view'\n @title = \"#{@vehicle.name}\"\n log.info('type=measure.render template=admin/vehicle/view.erb')\n render 'admin/vehicle/view.erb'\n end", "def interview_committee_decision\n application_interview_decision_type.title if application_interview_decision_type\n end", "def manual_review_needed_template\n 'manual_review_needed'\n end", "def constraint_description(klass, my_constraint, constraint_action)\n if my_constraint.my_i18n\n I18n.t(\".activerecord.attributes.#{klass.name.to_s.constantize.model_name.singular}.jak.#{constraint_action}\", default: I18n.t(\".jak.constraints.#{constraint_action}\"))\n else\n tenant_name = 'Application'\n case constraint_action.to_sym\n when :add\n \"Permits adding and creating new #{klass.model_name.human.pluralize.downcase}.\"\n when :read\n \"Permits viewing all #{klass.model_name.human.pluralize.downcase} and any specific #{klass.model_name.human.downcase}.\"\n when :modify\n \"Permits editing and updating an existing #{klass.model_name.human.downcase}.\"\n when :remove\n \"Permits removing an existing #{klass.model_name.human.downcase}.\"\n when :manage\n \"Grants all power to create, read, update, and remove #{klass.model_name.human.pluralize.downcase} for the #{tenant_name}.\"\n when :index\n \"Permits viewing the index of all #{klass.model_name.human.pluralize.downcase} for the #{tenant_name}.\"\n when :show\n \"Permits viewing a specific #{klass.model_name.human.downcase} for the #{tenant_name}.\"\n when :new\n \"Permits viewing the new #{klass.model_name.human.downcase} button and page for the #{tenant_name}.\"\n when :create\n \"Permits creating a new #{klass.model_name.human.downcase} for the #{tenant_name}.\"\n when :edit\n \"Permits viewing the edit #{klass.model_name.human.downcase} button and page for the #{tenant_name}.\"\n when :update\n \"Permits updating an existing #{klass.model_name.human.downcase} for the #{tenant_name}.\"\n when :destroy\n \"Permits removing an existing #{klass.model_name.human.downcase} from the #{tenant_name}.\"\n else\n I18n.t(\".activerecord.attributes.#{klass.model_name.singular}.jak.#{constraint_action}\", default: I18n.t(\".#{constraint_action}\"))\n end\n end\n end", "def decision\n return @decision\n end", "def resourceType\n 'Practitioner'\n end", "def modeler_description\n return 'Currently this is just setup for design level calculation method, but it could be extended as needed..'\n end", "def index\n @requirements = Requirement.where(project_id: current_project.id)\n end", "def getReq(req)\n @requirements.each do |r|\n if r.get_name==req\n return r\n end\n end\n\n addRequirement(req).last\n # return nil\n end", "def modeler_description\n return 'This measure has optional arguments to apply recommendations from different sections of the Zero Energy Multifamily Design Guide.'\n end", "def case_viewable?(status)\n retrieve_case(status).viewable? if settings\n end", "def view_flow; end", "def characteristics\n requirements + supplements\n end", "def requirements_for(model, field)\n return '' unless model.respond_to?(:requirements) && model.requirements\n case model.requirements[field]\n when :required\n content_tag :span, 'Required',\n :class => 'validation_for required'\n when :nhin_required\n content_tag :span, 'Required (NHIN)',\n :class => 'validation_for required'\n when :hitsp_required\n content_tag :span, 'Required (HITSP R)',\n :class => 'validation_for required'\n when :hitsp_r2_required\n content_tag :span, 'Required (HITSP R2)',\n :class => 'validation_for required'\n when :hitsp_optional\n content_tag :span, 'Optional (HITSP R)',\n :class => 'validation_for'\n when :hitsp_r2_optional\n content_tag :span, 'Optional (HITSP R2)',\n :class => 'validation_for'\n else\n ''\n end\n end", "def show\n @question_requirement = QuestionRequirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @question_requirement }\n end\n end", "def requirement_satisfied_by?(requirement, activated, spec)\n requirement.constraint.satisfies?(spec.version)\n end", "def evaluation_detail\n name\n end", "def show\n @unit_planner = UnitPlanner.find(params[:id])\n \n @skills = Skill.all(:include=>{:strategies=>:approaches}, :order=>\"skills.label\", :conditions=>[\"approaches.unit_planner_id=?\", @unit_planner.id])\n\n # move to model? Also, this seems a bit complicated. Any way to simplify?\n x = @unit_planner.objectives\n y = @unit_planner.formative_tasks.collect{|ft| ft.objectives}.flatten.uniq\n @objectives_sans_formative_tasks = (x - y).collect{|z| \"#{z.criterion.category}.#{z.subcategory}\"}.sort\n @criterions_sans_summative_tasks = (@unit_planner.criterions - @unit_planner.summative_tasks.collect(&:criterions).flatten.uniq).collect(&:category).join(\", \")\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unit_planner }\n end\n end", "def explanation\n activated = @activated.spec.full_name\n requirement = @failed_dep.dependency.requirement\n\n \" Activated %s instead of (%s) via:\\n %s\\n\" % [\n activated, requirement, request_path.join(', ')\n ]\n end", "def modeler_description\n return 'shift or/and adjust heaing and cooling setpoint'\n end", "def show\n @req = @company.implementer_requests\n end", "def show\n @client = Client.find_by_id(@project.client_id)\n @created_by = User.find_by_id(@project.created_by)\n @project_requirements = ProjectRequirement.includes(:project, :skill_type).where(project_id: @project.id)\n @existing_skill_types = ProjectRequirement.where(project_id: @project.id).pluck(:skill_type_id)\n @project_requirement_states = ProjectRequirementState.joins(:project_requirement).where(\"project_requirements.project_id\" => @project.id)\n @project_requirement_flows = ProjectRequirementFlow.joins(:project_requirement).where(\"project_requirements.project_id\" => @project.id)\n end", "def manufacture; end", "def requestor; organization; end", "def view_with_check_option_support\n true\n end", "def getDecision(output, data_source)\r\n key = data_source.to_sym\r\n\r\n # Last sold check\r\n idx = output[key][:metricsNames].index(\"Last Sold History\")\r\n output[:reason][0] = \"Sold too recently\" if !output[key][:metricsPass][idx]\r\n\r\n # Rurality Checks\r\n rs_idx = output[:Census][:metricsNames].index(\"Rurality Score\")\r\n vol_idx = output[key][:metricsNames].index(\"St. Dev. of Historical Home Price\")\r\n\r\n if output[:region] == \"East\"\r\n output[:reason][1] = \"Too rural\" if (!output[:Census][:metricsPass][rs_idx] || !output[key][:metricsPass][vol_idx]) \r\n end\r\n\r\n if output[:region] == \"West\"\r\n output[:reason][1] = \"Too rural\" if !output[:Census][:metricsPass][rs_idx]\r\n end\r\n\r\n # Typicality\r\n typ_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Typicality\" }\r\n typ_fail_cnt = typ_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n\r\n if data_source == \"Zillow\"\r\n neigh_idx = output[key][:metricsNames].index(\"Neighbors Available\")\r\n sqft_idx = output[key][:metricsNames].index(\"SqFt Typicality - Comps\")\r\n est_idx = output[key][:metricsNames].index(\"Estimate Typicality - Comps\")\r\n\r\n if output[key][:metrics][neigh_idx] >= 4\r\n sqfi_nb_idx = output[key][:metricsNames].index(\"SqFt Typicality - Neighbors\")\r\n est_nb_idx = output[key][:metricsNames].index(\"Estimate Typicality - Neighbors\")\r\n\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 3\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 65.0 || output[key][:metrics][est_idx] > 65.0)\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][sqft_idx] && !output[key][:metricsPass][sqfi_nb_idx]\r\n output[:reason][2] = \"Atypical property\" if !output[key][:metricsPass][est_idx] && !output[key][:metricsPass][est_nb_idx]\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n else\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 2\r\n output[:reason][2] = \"Atypical property\" if typ_fail_cnt >= 1 && (output[key][:metrics][sqft_idx] > 60.0 || output[key][:metrics][est_idx] > 60.0)\r\n end\r\n\r\n # Liquidity (allow one false)\r\n liq_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Liquidity\" }\r\n liq_fail_cnt = liq_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][3] = \"Illiquidity\" if liq_fail_cnt >= 2\r\n\r\n # Investment Guidelines\r\n est_idx = output[key][:metricsNames].index(\"Estimated Value\")\r\n type_idx = output[key][:metricsNames].index(\"Property Use\")\r\n build_idx = output[key][:metricsNames].index(\"Build Date\")\r\n msa_idx = output[key][:metricsNames].index(\"Pre-approval\")\r\n\r\n output[:reason][4] = \"Out of $ Range\" if !output[key][:metricsPass][est_idx]\r\n output[:reason][5] = \"Not Prop Type\" if !output[key][:metricsPass][type_idx]\r\n output[:reason][6] = \"New Construction\" if !output[key][:metricsPass][build_idx]\r\n output[:reason][7] = \"Not in MSAs\" if !output[key][:metricsPass][msa_idx]\r\n\r\n # Volatility (allow one false)\r\n vol_idx = output[key][:metricsUsage].each_index.select { |i| output[key][:metricsUsage][i] == \"Volatility\" }\r\n vol_fail_cnt = vol_idx.inject([]) { |tot, a| tot << output[key][:metricsPass][a] }.count(false)\r\n output[:reason][8] = \"Price Vol\" if vol_fail_cnt >= 2\r\n\r\n # Combo Rural (if applicable)\r\n cr_idx = output[:Census][:metricsNames].index(\"Combo Rural\")\r\n output[:reason][9] = \"Combo Rural\" if !output[:Census][:metricsPass][cr_idx]\r\n\r\n # Distance\r\n output[:reason][10] = \"MSA Distance\" if !output[:Google][:metricsPass].any?\r\n\r\n # Approve if not issues\r\n output[:reason][11] = \"Approved\" if output[:reason].compact.size == 0\r\n end", "def viewDistance \n \"viewDistance\" \n end", "def modeler_description\n return 'This can be used in apply measure now, or can be used in a parametric workflow to load in any custom user profiles or floor/ceiling values.'\n end", "def show\n if @application_case.has_user?(current_user)\n\n @notes = @application_case.notes\n @requirements = @application_case.case_requirements\n @status = @application_case.application_statuses\n @statuses = Status.all.sort_by(&:created_at)\n @m_address = @application_case.mortgage_address\n @applicants = @application_case.applicants.as_applicants\n @agent = @application_case.applicants.as_agents.first\n\n @agents ||= []\n @applicants.each do |applicant|\n if !@agents.include?(applicant.user)\n @agents << ClientAgent.agents(applicant.user).first\n end \n end\n\n else \n flash[:notice] = \"You are not authorized to view this\";\n redirect_to(application_cases_path);\n end\n end", "def explanation\n activated = @activated.spec.full_name\n requirement = @failed_dep.dependency.requirement\n\n \" Activated %s via:\\n %s\\n instead of (%s) via:\\n %s\\n\" % [\n activated, request_path(@activated).join(', '),\n requirement, request_path(requester).join(', '),\n ]\n end", "def display_resource(ability)\n ability.name\n end", "def details; end", "def renewal_eligiblity_determination\n end", "def opportunity_availability_friendly(opportunity)\n if opportunity.availability == 0\n 'Tiempo completo'\n elsif opportunity.availability == 1\n 'Medio tiempo'\n elsif opportunity.availability == 2\n 'Menos de 20 horas por semana'\n end\n end", "def availability_and_consultation_modes\n\t\thuman_attribute_names_if_present *(CONSULTATION_MODES + [:consult_remotely, :accepting_new_clients])\n\tend", "def policy; end", "def plan_description\n end", "def requirement\n \"~> #{major}\"\n end", "def medical_use; end", "def display_requested_type\n\t\t\t@display_requested_type ||=\n\t\t\tcase requested_type\n\t\t\twhen 1\n\t\t\t\t'Liên hệ'\n\t\t\twhen 2\n\t\t\t\t'Đăng ký sản phẩm'\n\t\t\twhen 3\n\t\t\t\tcase object_type\n\t\t\t\twhen 'real_estate'\n\t\t\t\t\t'Tư vấn BĐS'\n\t\t\t\twhen 'finance'\n\t\t\t\t\t'Tư vấn tài chính'\n\t\t\t\twhen 'law'\n\t\t\t\t\t'Tư vấn luật'\n\t\t\t\twhen 'architecture'\n\t\t\t\t\t'Tư vấn kiến trúc'\n\t\t\t\telse\n\t\t\t\t\t'Tư vấn'\n\t\t\t\tend\n\t\t\telse\n\t\t\t\t''\t\t\t\t\n\t\t\tend\n\t\tend", "def strategy_name; end", "def show\n @position = Position.find_by_id(@interview.position_id)\n @created_by = User.find_by_id(@interview.created_by)\n @interview_criteria = InterviewCriterium.includes(:skill,:interview).where( interview_id: @interview.id)\n end", "def manufacturing_requirements\n\tself.item.base_blueprint.manufacturing_requirements\nend", "def requirement_satisfied_by?(requirement, activated, spec)\n true\n end", "def show\n set_client_profile(@case)\n\n set_models_permissions\n end", "def show\n authorize :resquest_type, :show?\n end" ]
[ "0.6544294", "0.63729227", "0.6077152", "0.6077152", "0.6059532", "0.6059532", "0.6059532", "0.6059532", "0.6028314", "0.6027648", "0.60089576", "0.60089576", "0.60089576", "0.5981157", "0.59562796", "0.5914783", "0.58335936", "0.5799914", "0.572479", "0.5708224", "0.5642425", "0.5623867", "0.5620789", "0.5603702", "0.5600183", "0.55934936", "0.55799794", "0.5574664", "0.55705845", "0.55590075", "0.55575407", "0.55259544", "0.5524663", "0.550293", "0.54920363", "0.54920363", "0.54920363", "0.5489906", "0.5474567", "0.5461684", "0.5448698", "0.5447058", "0.53997225", "0.5398666", "0.5398666", "0.5395936", "0.5375482", "0.5355226", "0.53388923", "0.5329497", "0.53043526", "0.530091", "0.52913517", "0.52640975", "0.52615607", "0.52521294", "0.5250354", "0.5246412", "0.524404", "0.5239654", "0.52394694", "0.5223937", "0.52177805", "0.52158856", "0.52137357", "0.5210816", "0.52029145", "0.51992154", "0.51982504", "0.5195552", "0.5190983", "0.51894444", "0.51851994", "0.5184126", "0.5183384", "0.5174037", "0.5173734", "0.5172131", "0.5168623", "0.5163269", "0.5162481", "0.5157576", "0.51543903", "0.5151978", "0.51509494", "0.5150203", "0.5139769", "0.51380265", "0.5136481", "0.5129897", "0.51296407", "0.5127458", "0.51270425", "0.5126727", "0.512055", "0.51205313", "0.5119811", "0.51148957", "0.5108105", "0.5080768" ]
0.6594421
0
Gives the view of the tasks of a certain use case
def tasks @use_case = UseCase.find(params[:id]) @project = @use_case.project respond_to do |format| format.html end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_tasks\n # ASK REPO for the tasks\n tasks = @task_repository.all\n # ASK VIEW to display them\n @tasks_view.display(tasks)\n end", "def show\n find_task\n end", "def interviewer_tasks\n tasks.find(:all, :conditions => { :context => 'interviewers', :show_for_context_object_tasks => true })\n end", "def show # Show tasks method\n all_tasks.map.with_index { |l, i| \"(#{i.next}): #{l}\"} # Show all tasks array in numerical order and whether a task is completed\n end", "def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n end", "def display_tasks\n # get the array from the repo\n tasks = @repo.all\n # display all the tasks\n @view.display_tasks(tasks)\n end", "def reviewer_tasks\n tasks.find(:all, :conditions => { :context => 'reviewers', :show_for_context_object_tasks => true })\n end", "def list_tasks\n tasks = @repository.all\n @view.display_tasks(tasks)\n end", "def show_tasks\n\t\tputs \"here are the tasks on the #{self.name} list...\"\n\t\t@tasks.map.with_index {|task, i| puts \"#{i.next}. \" + task.description + \" | complete: \" + task.status.to_s}\n\t\tputs \"\\n\"\n\tend", "def display_tasks\n puts \"What do you want to do? \\n\"\n puts TASKS.values\n end", "def index\n active_task\n completed_task\n end", "def list_all_tasks\n #instance of View\n tasks = @repository.all # Array of tasks\n @view.display_all_tasks(tasks) #View to display all the tasks\n end", "def show\n set_client_profile(@goal)\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n\n @needs = @goal.needs\n end", "def show\n set_task_for_show\n render 'tasks/index'\n end", "def show\n # Restrict access\n check_if_admin unless @task.user_id == @person.id || @task.state == 'open'\n end", "def tasks\n task_list.tasks\n end", "def show\n @task_search = TaskSearch.viewable_searches(current_user).find(params[:id])\n end", "def show\n @tasks = @assignment.tasks\n @assignment.is_ready\n end", "def show\n @tasks = current_user.assigned_and_written_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n @team = @task.team\n @project = @team.project\n @sub_tasks = @task.sub_tasks\n @comment = @task.comments.new\n end", "def index\n set_tasks\n if @role === 'admin'\n @tasks = Task.all\n end\n if @role === 'merchant'\n @tasks = Task.where(merchant: spree_current_user.merchant_id)\n end\n end", "def task\n @keys[:task]\n end", "def show\n @tasks = Task.from_user(@current_user).by_status(:confirmed).ordered\n @new_tasks = Task.from_user(@current_user).by_status(:pending).ordered\n @completed_tasks = Task.from_user(@current_user).by_status(:complete).ordered\n end", "def show\n #@all_tasks = \n #if @tasks\n # @q = @tasks.ransack(params[:q])\n # @tasks = @q.result.page(params[:page])\n # else\n @tasks = @task.subtasks\n # -----------------------------\n @q = @tasks.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n #end\n end", "def show\n @notes = @task.task_notes\n @tasks = @task.sub_tasks\n if current_user.allowed_to?(:manage_roles) and @task.user\n session[:employee_id] = @task.user.id\n User.current = @task.user\n end\n end", "def show\n\t\t@project = Project.find(params[:id])\n\t\t@tasks = @project.tasks \n\n\tend", "def show\n authorize! :read, @task\n end", "def index\n @tasks = eval(get_query)\n @task = @project.tasks.build\r\n @archieved = @project.is_archieved?\n @learnmore = \"Tasks help you keep track of all the little things that need to get done. You can add them for yourself or assign them to someone else.\"\n render :layout => 'onebox_layout'\n end", "def display_tasks_and_comments\n puts \"Displaying tasks... \\n\"\n puts\n if(options.show_tasks == :tasks)\n # Get the maximum width of all task names\n all_displayable_tasks = tasks.select { |t|\n t.comment && t.name =~ options.show_task_pattern\n }\n \n #puts \"Displayable tasks: #{all_displayable_tasks}\\n\"\n \n width = all_displayable_tasks.collect { |t| t.name_with_args.length }.max || 10\n max_column = truncate_output? ? terminal_width() - name.size - width - 7 : nil\n \n @ProjectFileLoader.LoadedProjectFiles().each do |projectFile|\n if(projectFile.HasTasks())\n headline = \"Tasks in project file: '#{projectFile.Path().RelativePath()}'\\n\"\n puts headline\n puts \"-\" * headline.length\n puts projectFile.GetTaskDescriptions(width, max_column)\n end \n end\n else\n super\n end\n end", "def index\n authorize Task\n # TODO: should be showing students prompts through assessments...\n # TODO: change route, go through assessments?\n # enrollment = Enrollment.where(student_id: current_user.id)[0]\n # if enrollment then section = enrollment.section_id\n # assessments = Assessment.where(section_id: section)\n # end\n\n @tasks = policy_scope Task.all\n @tasks_grid = initialize_grid @tasks\n end", "def named_views_secretarys_task\n @task_assigned = UserTask.all(:conditions => [\"assigned_to_user_id = ? AND (status is null OR status != 'complete')\", @sp_session.assignment.user.id], :order => \"created_at DESC\")\n @task_completed = UserTask.all(:conditions => [\"completed_by_user_id = ? AND status like ? AND completed_at >= ?\", @sp_session.assignment.user.id, \"complete\", 1.week.ago], :order => \"created_at DESC\")\n render :partial => 'named_views_secretarys_task'\n end", "def show\n @task = Task.find(params[:id])\n @exercises = (@task.visible_to_admin_only && !current_user.master?) ? [] : @task.exercises\n\n @exercise = if @task.finished?(current_user)\n Exercise.where(:user_id => current_user.id, :task_id => @task.id).first\n else\n Exercise.new(:date => Date.current, :task_id => @task.id, :user_id => current_user.id)\n end\n end", "def index\n if get_case\n @tasks = @case.tasks.includes(:case, :owner).active_tasks_scope\n @my_tasks = @case.tasks.includes(:case, :owner).where(\"owner_id = ? OR secondary_owner_id = ?\", @user.id, @user.id).active_tasks_scope\n @new_path = new_case_task_path(@case)\n @tasks_a = [@case, Task.new] #for modal partial rendering\n else\n # @my_tasks = @user.owned_tasks.active_tasks_scope\n @my_tasks = @firm.tasks.includes(:case, :owner).where(\"owner_id = ? OR secondary_owner_id = ? AND firm_id = ?\", @user.id, @user.id, @firm.id).active_tasks_scope\n @tasks = @firm.tasks.includes(:case, :owner).active_tasks_scope\n @new_path = new_task_path\n @tasks_a = Task.new #for modal partial rendering\n end\n end", "def show\n @accounts = Account.accessible_by(current_ability)\n @opportunities = Opportunity.accessible_by(current_ability)\n authorize! :show, @task\n end", "def name\n\t\t\t@task\n end", "def show\n authorize @task\n @task_note = TaskNote.new(task: @task)\n set_return_to\n @return_to = get_return_to_or_default tasks_url\n end", "def tasks\n @title = 'Puppet Task Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_task)\n erb(:objects)\nend", "def show\n @tasks.each do |project_name, project_tasks|\n @output.puts project_name\n project_tasks.each do |task|\n @output.printf(\" [%c] %d: %s : %s \\n\", (task.done? ? 'x' : ' '), task.id, task.description, task.deadline)\n end\n @output.puts\n end\n end", "def show\n @tasks = @order.tasks\n end", "def settings_print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # get all collaborators\n @collaborators = @project.collaborators\n end", "def show\n @task_items = @task_list.items.active\n end", "def show\n\n\n\n\n @tasks = Task.new\n\n\n end", "def print_tasks\n # find project\n @project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? @project))\n flash[:warning] = \"You can't see stats for this project\"\n redirect_to lato_core.root_path and return false\n end\n # datas\n @status = (params[:status] ? params[:status] : ['wait', 'develop', 'test', 'completed'])\n @collaborators = (params[:collaborators] ? params[:collaborators] : @project.collaborators.ids)\n @start_date = params[:start_date]\n @end_date = params[:end_date]\n @show_expected_time = (params[:show_expected_time] === '1')\n # find tasks\n @tasks = @project.tasks.where(status: @status, collaborator_id: @collaborators)\n unless @start_date.blank?\n @tasks = @tasks.where('start_date >= ?', @start_date.to_date)\n end\n unless @end_date.blank?\n @tasks = @tasks.where('end_date <= ?', @end_date.to_date)\n end\n # disable layout\n render layout: false\n end", "def tasks\n Task.undone_for_user(goddamn_tfpid)\n end", "def index\n @tasks = policy_scope(Task)\n record.user == current_user\n end", "def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end", "def show\n @project = Project.find(params[:id])\n if @project.leader == (@user = current_user)\n @users, @budget, @real_hours = @project.users_and_budget if params[:tab] == 'workers'\n else\n @tasks = @user.tasks_for(@project)\n end\n\n render_tabs(:workers, :budgets)\n end", "def get_name(task_name)\n @view.get_name(task_name)\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def show\n @task = Task.find(params[:id])\n end", "def display_tasks(tasks) # we need the tasks\n # CONTRACT:\n # [x] buy croissants\n # [ ] buy coffee\n tasks.each_with_index do |task, index|\n # if task.done?\n # puts \"[x] #{task.name}\"\n # else\n # puts \"[ ] #{task.name}\"\n # end\n\n status = task.done? ? 'x' : ' '\n puts \"[#{status}] #{index + 1}. #{task.name}\"\n end\n end", "def display_tasks_and_comments(tasks = nil, pattern = nil, display_hidden = nil)\n tasks ||= self.tasks\n\n if pattern ||= options.show_task_pattern\n tasks = tasks.select { |t| t.name[pattern] || t.comment.to_s[pattern] }\n end\n\n width = tasks.collect { |t| t.name.length }.max\n\n tasks.each do |t|\n comment = \" # #{t.comment}\" if t.comment\n if display_hidden\n printf \"sake %-#{width}s#{comment}\\n\", t.name\n else\n printf \"sake %-#{width}s#{comment}\\n\", t.name if t.name && t.comment\n end\n end\n end", "def display_task(task)\n\t\t\tsplit_task(task.name).each_with_index do |name_line, line_index|\n\t\t\t\tcol_1 = pad((task.start_time if line_index==0), 5)\n\t\t\t\tcol_2 = pad(name_line, @name_width)\n\t\t\t\tcol_3 = pad((task.elapsed_time if line_index==0), @elapsed_time_width)\n\n\t\t\t\tif task.current? and TrackingConfig[:color_current_task]\n\t\t\t\t\tcurrent_task_color = TrackingConfig[:current_task_color]\n\t\t\t\t\tcurrent_task_color = TrackingConfig.defaults[:current_task_color] unless String.colors.include? current_task_color\n\n\t\t\t\t\tcol_1 = col_1.colorize current_task_color\n\t\t\t\t\tcol_2 = col_2.colorize current_task_color\n\t\t\t\t\tcol_3 = col_3.colorize current_task_color\n\t\t\t\tend\n\n\t\t\t\tputs \"| #{col_1} | #{col_2} | #{col_3} |\"\n\t\t\tend\n\t\tend", "def show\n set_client_profile(@plan)\n @goals = @plan.goals\n @tasks = @plan.tasks\n end", "def show\n success_task_show\n end", "def task\n return @task\n end", "def own_tasks\n uri = self.uri\n query = Ruta::Sparql.select.where(\n [:task, RDF.type, Ruta::Class.task],\n [:task, Ruta::Property.has_creator, uri]\n )\n tasks = []\n query.each_solution { |sol| tasks.push(sol.task.as(Task)) }\n tasks\n end", "def show_ot\n screen_name(\"Mostrar-OT\")\n\n @ot = Ot.find(params[:ot_id])\n @ot.mark_read\n\n @am_results = AmResult.where(\"ot_id = #{@ot.id}\").order(\"run_date DESC\")\n @observations = Observation.where(\"ot_id = #{@ot.id}\")\n @log = Audit.where(\"ot_id = #{@ot.id}\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n @versions = TargetDocumentVersion.where(\"ot_id = #{@ot.id}\").order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 10)\n\n if current_user.role.id == 3 || current_user.role.id == 5\n @task = @ot.current_task\n end\n end", "def show_tasks(from_file = false)\n read_tasks(session_file, true) if from_file\n if session_tasks.empty?\n io.log_and_exit \"You haven't set up any #{type.gsub('_',' ').capitalize.color(:yellow)} tasks yet.\"\n end\n io.log \"#{type.gsub('_',' ').capitalize.color(:yellow)} tasks:\"\n session_tasks.each_with_index do |task, index|\n io.log \"[#{index}] #{task.color(:cyan)}\"\n end\n end", "def index\n @user = current_user\n if @user.project_manager\n @tasks = Task.where(pm_id: @user.id)\n else\n @tasks = Task.where(collaborator_id: @user.id)\n end\n\n end", "def index\n @instances = Instance.all.where(task: params[:task_id])\n end", "def task_details_for_log\n \"Node #{@puppet_mclient.node_id}, task #{@task}, manifest \"\\\n \"#{@puppet_mclient.manifest}\"\n end", "def show\n @tasks = @list.tasks\n # Setting a layout different from the default\n render layout: 'application'\n end", "def show\n @tasks = current_user.assigned_and_written_tasks.pending.paginate(page: params[:page], per_page: 10)\n @fin_tasks = current_user.watching_tasks.completed.paginate(page: params[:page], per_page: 10) unless params[:page]\n end", "def show\n @project = Project.find(params[:id])\n @tasks = Task.find_all_by_id(params[:id])\n end", "def tasks_or_templates\n \"task_templates\"\n end", "def read_index\n all_tasks = @model.read\n @view.show_index(all_tasks)\n\tend", "def show\n @default_task = DefaultTask.find(params[:id])\n end", "def show\n respond_with Task.find(params[:id])\n end", "def list_all_tasks\n task = Task.all\nend", "def show\n @task = current_user.tasks.find params[:id] \n\n end", "def task\n Camunda::Task.find_by_business_key_and_task_definition_key! business_key, task_key\n end", "def show\n @task = @list.tasks.build\n end", "def show_tasks(tasks)\n tasks.each_with_index do |task, index|\n status = task.done? ? \"x\" : \" \"\n puts \"#{index + 1}. [#{status}] #{task.name}\"\n end\n end", "def show\n project = Project.where(id: params[:id]).first\n if project.present?\n @tasks = project.tasks\n end\n end", "def show\n @completed_tasks_count = @network_event.network_event_tasks.where.not(completed_at: nil).count\n @network_event_task = NetworkEventTask.new\n end", "def index\n @task = PlanningTask.find(params[\"planning_task_id\"])\n end", "def index\n @task = PlanningTask.find(params[\"planning_task_id\"])\n end", "def currentTasks _args\n \"currentTasks _args;\" \n end", "def action_for_task(task)\n task\n end", "def index\n @tasks = @current_user.tasks\n end", "def index\n authenticate_user!\n @tasks = current_user.tasks\n end", "def index\n @tasks = @project.tasks\n end", "def index\n @tasks = @project.tasks\n end", "def show\n @project = Project.find(params[:project_id])\n @task = Task.find(params[:id])\n\n\t@current_user_id = 1 # TODO: fix me\n\t@can_mark_as_abandoned = @task.requester_user_id == @current_user_id || @task.performer_user_id == @current_user_id\n\t@performer_not_yet_decided = @task.performer_user_id == 0\n\t@ready_to_decide_performer = 0 # TODO: fix me @task.\n\t@shares_available = self.get_shares_available( @project.id, @current_user_id )\n\n\t# always assume a new task_share; updating existing ones will delete previous ones\n\t@task_share = TaskShare.new( :task_id => @task.id )\n\n\t@all_task_shares = TaskShare.find_all_by_task_id( @task.id )\n\n\t@expand_share_pool_decision = ExpandSharePoolDecision.find_by_task_id( @task.id )\n\t@vote = Vote.new\n\tif ! @expand_share_pool_decision.nil?\n\t\t#@expand_share_pool_votes = Vote.find_all_by_decision_id( @expand_share_pool_decision.decision.id )\n\t\t@expand_share_pool_votes = @expand_share_pool_decision.decision.votes\n\tend\n\n\tif ! @task.decisions.nil? and ! @task.decisions.first.nil?\n\t\t@who_should_do_task_decision = @task.decisions.first.decidable # assume there's only one, and it's the first, for now; TODO: don't assume\n\tend\n\n\t@who_vote = Vote.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @task }\n end\n end", "def task_list\n self.tasks.map do |task|\n task.text\n end\n end", "def show\n respond_with(@task)\n end", "def index\n\t if current_user.has_role? :admin\n\t\t @tasks = Task.all\n\t elsif current_user.has_role? :ing\n\t\t @user = User.find(current_user)\n\t\t @tasks = @user.tasks\n\t end\n end", "def tasks?\n tasks.summary.items?\n end", "def show\n @tasks = Task.where(:job => @job)\n @paginated_tasks = @tasks.paginate(:page => params[:page], :per_page => Settings.Pagination.NoOfEntriesPerPage)\n end", "def show_tasks(hostname = nil)\n if hostname\n mirror = Mirror.find_by_hostname hostname\n\n if mirror\n puts \"#{mirror.tasks.size} tasks\"\n\n mirror.tasks.each do |task|\n puts \"#{task.command} #{task.path}\"\n end\n else\n puts \"hostname not found\"\n end\n else\n puts \"#{Task.count} tasks\"\n\n Task.all.each do |task|\n puts \"#{task.command} #{task.path}\"\n end\n end\n\n nil\nend", "def inspect\n context = @solution.map{|k, v| \"#{k}: #{v}\"}.join(',')\n \"#<Twilio.Taskrouter.V1.TaskContext #{context}>\"\n end", "def show\n @task = Task.find params[:id]\n\n end", "def task_steps_simple\n # this is a read-only display of workflow steps needed or completed\n # D - C - P - B - S\n # maybe it'll contain a id of the related item\n steps = Task.find_all_by_job_id(self).sort { |a, b| (a.order || 1) <=> (b.order || 1) } \n \n #puts steps.class\n end", "def show\n @task = Task.find params[:id]\n end", "def show\n @user = User.find(params[:id])\n\n @tasks = Task.where(assignee: current_user).page(params[:page])\n @q = @tasks.ransack(params[:q])\n @tasks = @q.result.page(params[:page])\n\n # @tasks_authored = Task.where(author: current_user).page(params[:page])\n # @q_authored = @tasks_authored.ransack(params[:q])\n # @tasks_authored = @q_authored.result.page(params[:page])\n end", "def description\n \"This task searches for common social media profiles\"\nend", "def description\n \"This task searches for common social media profiles\"\nend", "def task_help(name)\n load_tasks\n\n klass, task = find_by_namespace(name)\n\n # set '$thor_runner' to true to display full namespace\n $thor_runner = true\n\n klass.task_help(shell , task)\n end", "def show\r\n @task = @current_user.tasks.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.xml { render :xml => @task }\r\n end\r\n end" ]
[ "0.7217174", "0.70797", "0.6923401", "0.68659025", "0.68518335", "0.68076086", "0.6698484", "0.665766", "0.664071", "0.66338015", "0.66276044", "0.6577122", "0.6562889", "0.652853", "0.65168786", "0.6447878", "0.6430879", "0.64280754", "0.6421458", "0.6411247", "0.63931054", "0.63883954", "0.6382927", "0.6382699", "0.63711506", "0.6369722", "0.63639754", "0.6328055", "0.63121784", "0.6300543", "0.62638456", "0.6261571", "0.6231818", "0.6206881", "0.6196094", "0.61864567", "0.6179809", "0.6177674", "0.61626345", "0.61561185", "0.61558765", "0.6149282", "0.6145988", "0.61423963", "0.61387384", "0.61205673", "0.61165524", "0.61159015", "0.61159015", "0.61159015", "0.611336", "0.6102086", "0.60959804", "0.6091673", "0.6090914", "0.6090064", "0.6084181", "0.6080683", "0.60718375", "0.6060484", "0.60516983", "0.6049839", "0.6049596", "0.6049041", "0.60446525", "0.60436845", "0.6039772", "0.60377425", "0.6036577", "0.6029498", "0.602348", "0.60178775", "0.60172504", "0.6014542", "0.60085475", "0.6001851", "0.5998592", "0.5998592", "0.599395", "0.59881395", "0.5976929", "0.59768456", "0.5972778", "0.5972778", "0.59649813", "0.5961442", "0.5959462", "0.59552324", "0.5955195", "0.5954503", "0.59528726", "0.5949247", "0.59481746", "0.5947883", "0.5946605", "0.594442", "0.5942431", "0.5942431", "0.5939788", "0.59364086" ]
0.7159997
1
does not add the song to the current artist's collection of songs if it already exists therein
def genres songs.collect{ |s| s.genre }.uniq #returns collection of genres for all of the artist's songs/ does not return duplicate genres/ collects genres end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_song(song)\n # song.artist = self # assigns the current artist to the song's 'artist' property (song belongs to artist)\n #@songs << song #adds the song to the current artist's 'songs' collection \n ##does not assign the artist if the song already has an artist\n if song.artist == self\n song.artist\n else\n song.artist = self\n end \n # does not add the song to the current artist's collection of songs if it already exists therein\n if songs.include?(song)\n song\n else\n songs << song\n end \n songs\n end", "def add_song(song)\n if song.artist == nil #does not assign the song if the song already has an artist\n song.artist = self #assigns current artist to songs artist property\n else\n nil\n end\n if @songs.include?(song)\n nil\n else\n @songs << song #adds song, does not add the song if already exists\n end\n song\n end", "def add_song(song)\n song.artist = self unless song.artist == self\n @songs << song unless @songs.include? song\n end", "def add_song(song)\n song.artist = self unless song.artist == self #the song's artist property here\n @songs << song unless @songs.include?(song)\n end", "def add_song(song)\n if self.songs.include?(song) == false\n @songs << song\n end\n\n if song.artist.nil? || song.artist == false\n song.artist = self\n end\n\n end", "def add_song(song)\n if song.artist!=self\n song.artist = self\n elsif !@songs.include?(song)\n @songs << song\n end\n end", "def add_song(song) #Add the instance of the song to the @songs array (but do NOT add duplicated)\n if @songs.include?(song) == false #So, check first to see if it has been added yet or not.\n @songs << song #Push the song into the array if it has not been added yet\n song.artist = self if song.artist == nil #If no artist (nil) then the Song's artist is self (this instance of the song/artist) Associates the two. else nil #If else (i.e. song is already included in the array, do not add it.)\n end\n end", "def add_song(song)\n # Add song to @songs if it doesn't already exist\n @songs << song if !@songs.include?(song)\n # Add artist if not already assigned\n song.artist = self if song.artist ==nil\n save\n end", "def add_song(song)\n if(!songs.include?song)\n songs.add(song)\n end\n end", "def add_song(song)\n if(!song.artist)\n song.artist = self\n end\n \n if(!self.songs.include?song)\n self.songs << song\n end\n end", "def add_song(song_title)\n #adds the song to the current artist's 'songs' collection = @songs\n #does not add the song to the current artist's collection of songs if it already exists therein\n songs << song_title if !songs.detect{|song| song == song_title}\n\n\n #assigns the current artist to the song's 'artist' property (song belongs to artist)\n #does not assign the artist if the song already has an artist\n\n song_title.artist = self if song_title.artist == nil\n end", "def add_song(song)\n #associates a song to the artist's collection\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\nend", "def add_song(song)\n song.artist= self\n @songs << song\n end", "def add_song(song)\n @songs << song\n song.artist = self\n\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n song.artist = self\n @songs << song\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\n @songs << song\n song.artist = self\n end", "def add_song(song)\r\n @songs << song\r\n song.artist = self\r\n end", "def add_song(song)\n @@songs << song\n song.artist = self\n end", "def add_song(song)\n return if Song.find_by_id(song).nil?\n songs << song\n end", "def add_song(song)\n @songs << song\n song.artist = self\n @@sounds_count += 1\n\n end", "def add_track(new_song)\n if AVAILABLE_SONGS.include?(new_song)\n @playlist << new_song\n else\n return false\n end\n end", "def add_song(song)\n self.songs << song\n new_song = Song.new(song)\n new_song.artist = self\n end", "def add_song(song) ### arg is song instance ###\n\t\tsong.artist = self\n\t\tsong.artist.songs << song\n\tend", "def add_song_to_playlist(song)\n if @playlist.include? song\n return #exit out of function if already exits\n end\n @playlist << song #else add song to playlist array\n end", "def add_song(song)\n song.genre = self unless song.genre\n @songs << song unless @songs.include?(song)\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self \n end", "def artists(artist)\n if song.artist = nil || !Artist.find_by_name(name)\n song.artist = artist \n Artist.all << artist \n end \n end", "def add_song(song)\n @@song_count += 1\n @songs << song\n song.artist = self #self refers to Artist\n\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n song.artist = self #instead of @songs << song\n \n # - TEST -\n # hello = Song.new(\"Hello\")\n # adele.add_song(hello)\n # expect(adele.songs).to include(hello)\n # expect(hello.artist).to eq(adele) \n end", "def add_song(song)\n @song = song\n @songs << song\n\n @@song_count = @@song_count + 1\n song.artist = self\n end", "def add_song(song)\n song.artist = self\n end", "def add_song(song)\n @songs << song #add songs by sheveling song into the @song instance\n song.artist = self #add artists name of the songs\n end", "def add_song(song)\n songs << song\n end", "def add_song(song)\n @songs << song \n end", "def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end", "def add_song(new_song)\n @songs.include?(new_song) ? (puts \"The song has already been added\") : @songs.push(new_song)\n end", "def add_song(song)\n songs << song\n end", "def add title, artist\n $albums.each do |album, status|\n # screen for duplicates\n if album[0].downcase == title.downcase\n puts \"You already have a song by that name.\"\n return nil\n end\n end\n album = [title, artist]\n $albums[album] = \"unplayed\"\n # artist = artist.gsub('\"', '')\n puts \"Added #{title} by #{artist.gsub('\"', '')}\"\n return album\nend", "def add_song(song)\n song.artist = self #associate the song with this artist\n end", "def test_song_already_added_to_playlist()\n @room_1.add_song_to_playlist(@song_1)\n @room_1.add_song_to_playlist(@song_1)\n assert_equal(1, @room_1.playlist_count())\n end", "def add_song(song_to_be_added)\n @songs << song_to_be_added\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\n end", "def add_song(song)\n @songs << song\nend", "def add_song(song)\n\t\t@songs <<(song)\n\t\t\n\tend", "def add_song(song)\n # We want to tell the song_name passed in that it belongs to the instance\n # of Artist for which this method is called on aka self.\n song.artist = self\n end", "def add_song(song)\n # I hava class varaible @@all in Song class\n # the song is adding to self (refering to the \n # Artist)\n # adds that song to the artist's collection\n # HOW??? \n @song << song # without it\n song.artist = self \n #binding.pry\n end", "def add_song(song)\n @songs << song\n #here we use the self keyword to refer to the artist on which we are calling this method. We call the =artist method onto the song that is being passed as an argument and set that to self (the artist)\n song.artist = self\n#once we add a new song we want to increase the class array song count\n @@song_count +=1\n end", "def add_song(song_name)\n songs << song_name\n end", "def add_song(x)\n \t@songs << x\n end", "def import\n self.files.each do |f|\n song = Song.new_by_filename(f)\n Artist.all << song.artist unless Artist.all.include?(song.artist)\n end \n end", "def add_song_by_name(name)\n\t\tSong.new(name).artist = self \n\tend", "def artist_name=(name)\n self.artist = Artist.find_or_create_by_name(name)\n #return the new song instance\n artist.add_song(self)\n end", "def add_song(song) #song = #<Song:0x007fc75eb94420 @genre=#<Genre:0x007fc75eb94498 @name=\"rap\", @songs=[]>, @name=\"99 Problems\">\n\n self.songs << song\n end", "def artist=(artist_obj)\n @artist = artist_obj\n\n #self is a song obj\n artist_obj.songs.push(self)\n end", "def add_song(song) #=> we found out by looking at the test that the argument is a song instance\n # the following code tells the current artist calling the method what new song it has:\n self.songs << song\n # but the test is asking us for the inverse of this - instead of telling artist \n # about its songs, we need to tell song about its artist:\n song.artist = self\n # inside the Artist instance scope, Self refers to the artist object calling the add_song method\n end", "def add_song(song_instance)\n songs << song_instance\n end", "def artist=(the_artist)\n @artist = the_artist\n if @artist \n @artist.add_song(self)\n end\n @artist\n end", "def add_song_by_name(song_name)\n song = Song.new(song_name)\n @@songs << song\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def add_song_by_name(name)\n song = Song.new(name)\n @songs << song\n song.artist = self\n end", "def update\n respond_to do |format|\n if @song.update(song_params)\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n \n format.html { redirect_to @song, notice: 'Song was successfully updated.' }\n format.json { render :show, status: :ok, location: @song }\n else\n format.html { render :edit }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_song(song)\n @songs.push(song)\n end", "def add_song(song) # Third, we create 'add_song' to associate a song name with a particular artist.\n song.artist = self # When we call 'song.artist', we set the result equal to 'self', or the artist on which we are calling the method.\n end", "def has_song?(song)\n songs.include?(song)\n end", "def add_song_by_name(song_name)\n song = Song.new(song_name)\n song.artist = self\n @songs << song\n end", "def create\n @song = Song.new(song_params)\n\n respond_to do |format|\n if @song.save\n album_id = params[\"album\"]\n \n if not album_id.nil?\n album = Album.find_by(id: album_id)\n if not album.nil?\n album.songs << @song\n album.save\n\n artist = album.artist\n\n if not artist.nil?\n artist_id = artist.id\n if not artist_id.nil?\n artist.songs << @song\n artist.save\n end\n end\n end\n end\n\n format.html { redirect_to @song, notice: 'Song was successfully created.' }\n format.json { render :show, status: :created, location: @song }\n else\n format.html { render :new }\n format.json { render json: @song.errors, status: :unprocessable_entity }\n end\n end\n end", "def import\n # this method is creating a song from filename\n # Sends filename to the Song class\n files.uniq do |f| \n Artist.all << f\n end \n# \n# Artist.all << songs = files.find do |filename| \n# Song.new_by_filename(filename)\n# \n end", "def artist= (artist)\n @artist = artist\n artist.add_song(self)\n end", "def songs\n Song.all.select {|song| song.artist = self}\n end", "def add_song(song_id)\n song = Song.find(song_id)\n\n raise ArgumentError.new(\"Song (id: #{song_id}) was not found for the given.\") if song.nil?\n raise ArgumentError.new(\"Song (id: #{song_id}) was already in the playlist.\") if @song_ids.include?(song_id)\n\n @song_ids << song_id\n @songs << song\n end", "def initialize\n # @@artists << self\n super\n @songs = []\n end", "def add_song(song)\n @song_list.push(song)\n end", "def add_a_song(song)\n @list_of_songs.push(song)\n end", "def add_song(song)\n song.artist = self \n #binding.pry\n end", "def artist_name=(name)\n #object attr\n self.artist = Artist.find_or_create_by_name(name)\n\n artist.add_song(self)\n\n end" ]
[ "0.8377536", "0.8330306", "0.8308314", "0.8289124", "0.81976336", "0.8197406", "0.8026725", "0.801024", "0.79705393", "0.7767412", "0.7725955", "0.75961816", "0.7481151", "0.74465245", "0.74440587", "0.7395014", "0.7395014", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7391093", "0.7378471", "0.736999", "0.73472303", "0.73333246", "0.73276246", "0.7262376", "0.7243979", "0.7224055", "0.71952575", "0.7157055", "0.7157055", "0.7157055", "0.7157055", "0.7157055", "0.7157055", "0.71449727", "0.71333665", "0.7089027", "0.70797706", "0.70797706", "0.70797706", "0.70380163", "0.7031061", "0.702839", "0.7023862", "0.70070654", "0.6958087", "0.6947241", "0.6947241", "0.69469136", "0.693615", "0.6906573", "0.6895454", "0.6892211", "0.68678135", "0.68678135", "0.68678135", "0.68678135", "0.68678135", "0.68678135", "0.6846178", "0.67914027", "0.6779869", "0.6779521", "0.6715423", "0.6688095", "0.6666374", "0.6664711", "0.6658605", "0.6638045", "0.66193104", "0.6596799", "0.6591599", "0.65736204", "0.65723103", "0.6571376", "0.6532555", "0.6525598", "0.6512419", "0.65116477", "0.65037405", "0.65027714", "0.650269", "0.6497229", "0.64857316", "0.6483917", "0.6474983", "0.645804", "0.6428812", "0.6414673", "0.6395935", "0.63927525", "0.6377036" ]
0.0
-1
GET /freelancer_knowledges GET /freelancer_knowledges.json
def index @freelancer_knowledges = FreelancerKnowledge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def index\n @carrierknowledghes = Carrierknowledghe.all\n end", "def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end", "def index\n @knowledges = Knowledge.all\n end", "def index\n if(current_user.profile.nil?)\n redirect_to new_profile_path,\n notice: \"You need first to fill your profile ;).\"\n else\n @knowledges = current_user.profile.knowledges.all\n end\n end", "def show\n respond_to do |format|\n format.json { render json: @newsletter}\n end\n end", "def show\n render json: @referral_contact\n end", "def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end", "def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end", "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end", "def show\n @delivery_note = DeliveryNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_note }\n end\n end", "def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @unpaid_debt = UnpaidDebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unpaid_debt }\n end\n end", "def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end", "def show\n advertisement = nil\n consumer_page_view = @consumer.crumbs.map{ |crumb| crumb.beacon_id }.uniq.sample\n if consumer_page_view\n @sem3.products_field( \"upc\", Beacon.find(consumer_page_view).first_party_data.sample )\n advertisement = @sem3.get_products\n end\n\n logger.debug \"Advertisement : #{advertisement}\"\n\n respond_to do |format|\n if advertisement\n format.html # show.html.erb\n format.json { render json: advertisement['results'].first }\n else\n format.html # show.html.erb\n format.json { render json: {\"status\" => \"error\"}, status: :not_found }\n end\n end\n end", "def index\n @desks = Desk.all\n\n render json: @desks\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce_c }\n end\n end", "def show\n @newsletter = Newsletter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletter }\n end\n end", "def index\n @title = \"Delivery Methods\"\n \n @delivery_methods = DeliveryMethod.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @delivery_methods }\n end\n end", "def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end", "def show\n @disbursement = Disbursement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disbursement }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end", "def index\n @attendees = Attendee.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @attendees }\n end\n end", "def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end", "def index\n @benefit_requesteds = BenefitRequested.all\n end", "def index\n @proposals = Proposal.all\n\n render json: @proposals\n end", "def show\n @news_agency = NewsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news_agency }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def index\n if (params[:client_id])\n @engagements = Engagement.find_all_by_client_id(params[:client_id])\n else\n @engagements = Engagement.all\n end\n\n respond_with(@engagements)\n end", "def show\n @venue = Venue.find(params[:id])\n @papers = @venue.papers.order(:listorder)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @venue }\n end\n end", "def index\n @references = Reference.all\n\n render json: @references\n end", "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end", "def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end", "def show\n @fundamental_retention_mail = Fundamental::RetentionMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_retention_mail }\n end\n end", "def show\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end", "def show\n @college_fee = CollegeFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college_fee }\n end\n end", "def show\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pack_group_receipt }\n end\n end", "def show\n @purchase_feedback = PurchaseFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_feedback }\n end\n end", "def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end", "def index\n @agreement = Agreement.find(params[:agreement_id])\n @posting_rules = @agreement.posting_rules\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @posting_rules }\n end\n end", "def index\n # @prenotations = Prenotation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prenotations }\n end\n end", "def index\n\n @bans = @cloud.bans.where(\n params.select { |k,v| [:offender_id,:enforcer_id].include?(k.to_sym) }\n ).order_by(due: :desc)\n\n render status: 200\n end", "def show\n render json: @ticket.to_json(include: :conversations), status: 200\n end", "def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end", "def show\n @newsletter_frequency = NewsletterFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletter_frequency }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_requisition }\n end\n end", "def new\n @newsletter = Newsletter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletter }\n end\n end", "def show\n @badge = Badge.find(params[:id])\n @users = @badge.users\n respond_with @badge\n end", "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @donate }\n end\n end", "def index\n # @donation_purposes = DonationPurpose.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @donation_purposes }\n end\n end", "def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end", "def badges\n get(\"user/#{user_id}/badges.json\")\n end", "def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end", "def show\n @site_newsletter = Site::Newsletter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_newsletter }\n end\n end", "def index\n @investments = Investment.all\n\n respond_to do |format|\n format.html\n format.json\n end\n end", "def show\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referral }\n end\n end", "def ack_receipt\n Net::HTTP.get(URI(params[:response_url]))\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n end\n end", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def referrals(params = {})\n scope 'default'\n post('referrals/', params)\n end", "def index\n @recipients = Recipient.all\n # render json: @recipients\n end", "def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def index\n @funds = Fund.all\n\n render json: @funds\n end", "def show\n @transactions = @envelope.transactions if @envelope.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @envelope }\n end\n end", "def index\n @leases = Lease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @leases }\n end\n end", "def show\n @badge = Badge.find_by_key(params[:id])\n respond_to do |format|\n format.html\n end\n end", "def show\n @financial_aid_package = @participant.financial_aid_packages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_aid_package.to_json(methods: [:breakdown]) }\n end\n end", "def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end", "def show\n @delivery = Delivery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery }\n end\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def surgery_name_list\n\t\tsurgeries = current_user.surgeries\n\t\tif surgeries.present?\n\t\t# response to the JSON\n \t render json: { success: true, response: {surgeries: surgeries.collect(&:name).as_json } },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"Surgeries are not present\" },:status=> 203\n\t end \n\tend", "def index\n @announcements = Announcement.all\n\n respond_to do |format|\n format.html { render html: '200' }\n format.json { render 'announcements/index', announcements: @announcements, status: :ok }\n end\n end", "def show\n @emails = JSON.parse(@notification.fetch_emails)\n end", "def index\n @refund_requests = RefundRequest.order 'created_at DESC'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @refund_requests }\n end\n end", "def notifications\n @campus_id = current_user.campus_users.first.campus_id\n invi_status=CRUD::Utility::Invitations.new(@campus_id)\n data = invi_status.get_request_sent\n render :json=>{:data=>data}\n end", "def show\n @product_delivered = ProductDelivered.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_delivered }\n end\n end", "def fawry_api_response\n { 'type' => 'ChargeResponse',\n 'referenceNumber' => '931215518',\n 'merchantRefNumber' => 'io5jxf3jp27kfh8m719arcqgw7izo7db',\n 'expirationTime' => 1_572_884_477_505,\n 'statusCode' => 200,\n 'statusDescription' => 'Operation done successfully' }.to_json\nend", "def create\n @carrierknowledghe = Carrierknowledghe.new(carrierknowledghe_params)\n\n respond_to do |format|\n if @carrierknowledghe.save\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully created.' }\n format.json { render :show, status: :created, location: @carrierknowledghe }\n else\n format.html { render :new }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @pending_recommended_links = PendingRecommendedLink.all\n\n render json: @pending_recommended_links\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "def show\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry_source }\n end\n end", "def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end", "def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def index\n @supplemental_details = SupplementalDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplemental_details }\n end\n end", "def new\n @announce_c = AnnounceC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce_c }\n end\n end", "def emergencias_en_curso\n @emergencies = Emergency.where(:estado => 'f')\n render json: @emergencies\n end", "def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end", "def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end" ]
[ "0.630326", "0.60116845", "0.595098", "0.5839878", "0.5611794", "0.54542494", "0.54053175", "0.53874165", "0.5354847", "0.5344558", "0.53024244", "0.5292661", "0.5282269", "0.5247072", "0.52158225", "0.52143824", "0.5213206", "0.5210956", "0.520964", "0.5204123", "0.52009755", "0.5195981", "0.5190335", "0.518796", "0.51857823", "0.51696724", "0.5156587", "0.5139183", "0.5136055", "0.5112826", "0.51126796", "0.5110451", "0.51079667", "0.51030475", "0.5096908", "0.5091808", "0.5090663", "0.5090561", "0.5087745", "0.50843406", "0.50811774", "0.50741434", "0.5071441", "0.5070194", "0.50670177", "0.506522", "0.5064739", "0.50618476", "0.5059457", "0.5049959", "0.5039089", "0.50376976", "0.50376976", "0.50353914", "0.5034755", "0.50342125", "0.5033888", "0.5028587", "0.5023401", "0.50223404", "0.50219464", "0.501826", "0.5017756", "0.5013788", "0.50114405", "0.5006819", "0.50058496", "0.5004307", "0.500411", "0.50039464", "0.50030553", "0.5002391", "0.49993446", "0.4992511", "0.49897137", "0.49861804", "0.4982977", "0.49802735", "0.49770647", "0.49769324", "0.49767452", "0.49754882", "0.49710268", "0.49694422", "0.4962637", "0.49590307", "0.49580485", "0.4956788", "0.495667", "0.49557996", "0.49542427", "0.4951122", "0.4951122", "0.49505055", "0.49505055", "0.49498862", "0.49494663", "0.49482772", "0.49471822", "0.49454948" ]
0.66673106
0
GET /freelancer_knowledges/1 GET /freelancer_knowledges/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end", "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end", "def index\n @carrierknowledghes = Carrierknowledghe.all\n end", "def index\n @knowledges = Knowledge.all\n end", "def show\n @delivery_note = DeliveryNote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery_note }\n end\n end", "def show\n respond_to do |format|\n format.json { render json: @newsletter}\n end\n end", "def show\n @product.enquiries.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry }\n end\n end", "def show\n @announce_c = AnnounceC.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce_c }\n end\n end", "def show\n @announcement = Announcement.find(params[:id])\n render json:@announcement\n end", "def show\n @pledge = Pledge.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pledge }\n end\n end", "def show\n render json: @referral_contact\n end", "def index\n if(current_user.profile.nil?)\n redirect_to new_profile_path,\n notice: \"You need first to fill your profile ;).\"\n else\n @knowledges = current_user.profile.knowledges.all\n end\n end", "def show\n @newsletter = Newsletter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletter }\n end\n end", "def show\n @receipt = Receipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @receipt }\n end\n end", "def show\n @unpaid_debt = UnpaidDebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unpaid_debt }\n end\n end", "def new\n @delivery_note = DeliveryNote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @delivery_note }\n end\n end", "def show\n @fundamental_retention_mail = Fundamental::RetentionMail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_retention_mail }\n end\n end", "def show\n @newsletter_frequency = NewsletterFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @newsletter_frequency }\n end\n end", "def show\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referee }\n end\n end", "def show\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pack_group_receipt }\n end\n end", "def show\n client = Client.find(params[:id])\n notifications = Notification.all\n client_notifications = notifications\n .select { |notification| client.companies.include? notification.company }\n render json: client_notifications\n end", "def show\n @purchase_requisition = PurchaseRequisition.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_requisition }\n end\n end", "def new\n @newsletter = Newsletter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletter }\n end\n end", "def show\n @inquirement = Inquirement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inquirement }\n end\n end", "def show\n @purchase_feedback = PurchaseFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_feedback }\n end\n end", "def show\n @badge = Badge.find_by_key(params[:id])\n respond_to do |format|\n format.html\n end\n end", "def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end", "def show\n @announce = Announce.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @announce }\n end\n end", "def new\n @announce_c = AnnounceC.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce_c }\n end\n end", "def show\n @disbursement = Disbursement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @disbursement }\n end\n end", "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def show\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tenancy_agreement }\n end\n end", "def show\n @college_fee = CollegeFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @college_fee }\n end\n end", "def show\n @money_receipt = MoneyReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @money_receipt }\n end\n end", "def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def show\n @site_newsletter = Site::Newsletter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_newsletter }\n end\n end", "def show\n @news_agency = NewsAgency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news_agency }\n end\n end", "def show\n @referral = Referral.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @referral }\n end\n end", "def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end", "def index\n @product_delivereds = ProductDelivered.where(:subscription_id => @subscription.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_delivereds }\n end\n end", "def get_ack_incidents\n # use status of incident as a filter\n res = RestClient.get INCIDENT_QUERY_URL, :params => { :status => \"acknowledged\", :fields => \"incident_number\" }\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def create\n @carrierknowledghe = Carrierknowledghe.new(carrierknowledghe_params)\n\n respond_to do |format|\n if @carrierknowledghe.save\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully created.' }\n format.json { render :show, status: :created, location: @carrierknowledghe }\n else\n format.html { render :new }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @refund_request = RefundRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @refund_request }\n end\n end", "def show\n @payment_notification = PaymentNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_notification }\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def new\n @pledge = Pledge.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pledge }\n end\n end", "def show\n advertisement = nil\n consumer_page_view = @consumer.crumbs.map{ |crumb| crumb.beacon_id }.uniq.sample\n if consumer_page_view\n @sem3.products_field( \"upc\", Beacon.find(consumer_page_view).first_party_data.sample )\n advertisement = @sem3.get_products\n end\n\n logger.debug \"Advertisement : #{advertisement}\"\n\n respond_to do |format|\n if advertisement\n format.html # show.html.erb\n format.json { render json: advertisement['results'].first }\n else\n format.html # show.html.erb\n format.json { render json: {\"status\" => \"error\"}, status: :not_found }\n end\n end\n end", "def show\n @notification = current_user.find_client(params[:client_id]).notifications.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end", "def show\n @delivery = Delivery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @delivery }\n end\n end", "def new\n @newsletter_frequency = NewsletterFrequency.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletter_frequency }\n end\n end", "def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status] || \"open\")\n\n respond_to do |format|\n format.html # index.html.erb\n @recipts = Array.new\n format.json {\n @receipts = @receipts.select{|receipt|\n recipt = Hash.new\n receipt.attributes.each do |key, value|\n recipt[key] = value\n end\n recipt[:receipt_identifier] = CommonActions.linkable(receipt_path(receipt), receipt.receipt_identifier)\n recipt[:customer_name] = receipt.organization.present? ? CommonActions.linkable(organization_path(receipt.organization), receipt.organization.organization_name) : \"-\"\n recipt[:receipt_type_name] = receipt.receipt_type.present? ? receipt.receipt_type.type_name : \"\"\n recipt[:check_code] = ( receipt.receipt_type.present? && receipt.receipt_type.type_value == 'check' && receipt.deposit_check.present? ) ? receipt.deposit_check.check_identifier : \"-\"\n if can? :edit, Receipt\n recipt[:links] = CommonActions.object_crud_paths(nil, edit_receipt_path(receipt), nil)\n else\n recipt[:links] = \"\"\n end\n @recipts.push(recipt)\n }\n render json: {:aaData => @recipts}\n }\n end\n end", "def show\n @purchase_receipt = PurchaseReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_receipt }\n end\n end", "def show\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klass_fee }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def show\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundraiser }\n end\n end", "def new\n @announcement = Announcement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announcement }\n end\n end", "def show\n @enquiry_source = EnquirySource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enquiry_source }\n end\n end", "def ack_receipt\n Net::HTTP.get(URI(params[:response_url]))\n end", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def show\n @financial_aid_package = @participant.financial_aid_packages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_aid_package.to_json(methods: [:breakdown]) }\n end\n end", "def show\n @feeling = Feeling.find(params[:id])\n @sake = Sake.find(params[:sake_id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feeling }\n end\n end", "def show\n @discussion = Discussion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @discussion }\n end\n end", "def show\n @eve_notification = EveNotification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @eve_notification }\n end\n end", "def show\n @product_delivered = ProductDelivered.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_delivered }\n end\n end", "def new\n @newsletter_subscription = NewsletterSubscription.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletter_subscription }\n end\n end", "def new\n @announce = Announce.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @announce }\n end\n end", "def index\n @attendees = Attendees.all\n render json: @attendees\n end", "def show\n @news_letter = NewsLetter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @news_letter }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @donate }\n end\n end", "def show\n @breadcrumb = 'read'\n @supplier_payment = SupplierPayment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplier_payment }\n end\n end", "def show\n @showdown = Showdown.find(params[:id])\n @topics = Topic.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @showdown }\n end\n end", "def fawry_api_response\n { 'type' => 'ChargeResponse',\n 'referenceNumber' => '931215518',\n 'merchantRefNumber' => 'io5jxf3jp27kfh8m719arcqgw7izo7db',\n 'expirationTime' => 1_572_884_477_505,\n 'statusCode' => 200,\n 'statusDescription' => 'Operation done successfully' }.to_json\nend", "def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end", "def show\n @customer_feedback = CustomerFeedback.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customer_feedback }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @community_topics = CommunityTopic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @community_topics }\n end\n end", "def show\n @client_need = ClientNeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_need }\n end\n end", "def show\n #@publication = Publication.find(params[:id])\n #@issues = @publication.issues.where( :issue_states => {:name => 'released'})\n #render json: @issues\n\n publication = Publication.find_by_product_code(params[:id])\n\n state = IssueState.find_by_name('Released')\n\n issues = Issue.where(:publication_id => publication, :issue_state_id => state)\n render json: issues.as_json({:except => :pdf_zip})\n\n end", "def show\n @invoicedetail = Invoicedetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoicedetail }\n end\n end", "def show\n @surgery = Surgery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @surgery }\n end\n end", "def show\n @important_issue = ImportantIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @important_issue }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end", "def index\n @title = \"Delivery Methods\"\n \n @delivery_methods = DeliveryMethod.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @delivery_methods }\n end\n end", "def new\n @invoice = Invoice.new\n $details = Array.new\n @customers = Customer.all\n @retire_notes = Array.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @received_military_award = ReceivedMilitaryAward.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @received_military_award }\n end\n end", "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "def show\n @proposal = Proposal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proposal }\n end\n end", "def new\n @notice = @person.notices.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @notice }\n end\n end", "def index\n @supplemental_details = SupplementalDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplemental_details }\n end\n end", "def show\n @mispronunciation = Mispronunciation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mispronunciation }\n end\n end", "def show\n #find Adhoc Deliverable by deliverable id\n @adhoc_deliverable = Deliverable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @adhoc_deliverable }\n end\n end", "def find(email)\n Mailgun.submit :get, complaint_url(email)\n end", "def show\n @community_topic = CommunityTopic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @community_topic }\n end\n end", "def index\n @consents = Consent.all\n render json: @consents\n end", "def show\n # @invoice = Invoice.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @invoice }\n end\n end", "def show\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer_request }\n end\n end", "def new\n @newsletter = Newsletter.new\n\n respond_with(@newsletter)\n end", "def new\n @site_newsletter = Site::Newsletter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @site_newsletter }\n end\n end", "def show\n @enhancement = Enhancement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enhancement }\n end\n end" ]
[ "0.6524159", "0.6367874", "0.621495", "0.59444463", "0.58440053", "0.5661022", "0.555433", "0.5545312", "0.5532304", "0.5502015", "0.5501858", "0.54799265", "0.54600847", "0.5446178", "0.5395857", "0.53801614", "0.53780144", "0.53762215", "0.53746635", "0.53413177", "0.5340164", "0.5337695", "0.53358734", "0.53307384", "0.53251916", "0.5322705", "0.5317211", "0.5314109", "0.5314109", "0.5311073", "0.5308348", "0.52987516", "0.5285759", "0.5284657", "0.5283897", "0.5282545", "0.52744555", "0.52721447", "0.5268918", "0.52513385", "0.5249973", "0.5249767", "0.5242915", "0.52407664", "0.5240701", "0.52197784", "0.5214296", "0.5214296", "0.5210624", "0.52101576", "0.5203235", "0.51900274", "0.5183569", "0.5180113", "0.51777613", "0.5168682", "0.5168682", "0.51604795", "0.51564765", "0.5156379", "0.5155431", "0.5155095", "0.5150943", "0.51465183", "0.5141451", "0.5137414", "0.5126226", "0.51229423", "0.5119731", "0.5116519", "0.51110405", "0.51091814", "0.50976413", "0.50971293", "0.50955635", "0.50955635", "0.50927484", "0.50906503", "0.5089037", "0.508342", "0.5083288", "0.50826466", "0.5080113", "0.50768334", "0.50759053", "0.5074142", "0.5072619", "0.50708556", "0.50708556", "0.5070448", "0.5070132", "0.5066296", "0.50648004", "0.5062797", "0.5059161", "0.50582045", "0.50536996", "0.50526834", "0.50479853", "0.50479543", "0.5047543" ]
0.0
-1
POST /freelancer_knowledges POST /freelancer_knowledges.json
def create @freelancer_knowledge = FreelancerKnowledge.new(freelancer_knowledge_params) respond_to do |format| if @freelancer_knowledge.save format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully created.' } format.json { render :show, status: :created, location: @freelancer_knowledge } else format.html { render :new } format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @carrierknowledghe = Carrierknowledghe.new(carrierknowledghe_params)\n\n respond_to do |format|\n if @carrierknowledghe.save\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully created.' }\n format.json { render :show, status: :created, location: @carrierknowledghe }\n else\n format.html { render :new }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @knowledge = current_user.knowledges.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @knowledge }\n end\n end", "def create\n @knowledge = current_user.knowledges.new(params[:knowledge])\n\n respond_to do |format|\n if @knowledge.save\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully created.' }\n format.json { render json: @knowledge, status: :created, location: @knowledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def index\n @freelancer_knowledges = FreelancerKnowledge.all\n end", "def create\n topic = Topic.new(topic_params)\n if topic.save\n response_data = {\n status: 'success',\n txt: ['質問を投稿しました!'],\n }\n else\n response_data = {\n status: 'error',\n txt: topic.errors.full_messages,\n }\n end\n render json: response_data\n end", "def create\n params[\"balance_enquiry\"][\"karigar_id\"] = params[\"karigar_id\"]\n @balance_enquiry = BalanceEnquiry.new(balance_enquiry_params)\n respond_to do |format|\n if @balance_enquiry.save\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @balance_enquiry }\n else\n format.html { render :new }\n format.json { render json: @balance_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n extra = ParamsFormatter.new(params[:enquiry]).generate\n @enquiry = Enquiry.new(enquiry_params.merge(extra))\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sigurance = Sigurance.new(sigurance_params)\n @sigurance.save!\n\n SiguranceMailer.new_sigurance(@sigurance).deliver_now\n\n respond_to do |format|\n if @sigurance.save\n format.html { redirect_to @sigurance, notice: 'Sigurance was successfully created.' }\n format.json { render :show, status: :created, location: @sigurance }\n else\n format.html { render :new }\n format.json { render json: @sigurance.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @announcement = Announcement.find(params[:announcement])\n\n @purchase = Purchase.new(announcement: @announcement, buyer_id: current_buyer.id, description: @announcement.title,seller_id: @announcement.seller.id )\n key = @announcement.seller.access_code\n Stripe.api_key = key\n\n token = params[:stripeToken]\n\n customer = if current_buyer.stripe_id?\n Stripe::Customer.retrieve(current_user.stripe_id)\n else\n Stripe::Customer.create(email: current_buyer.email, source: token)\n end\n\n payment_intent = Stripe::PaymentIntent.create({\n customer:customer,\n payment_method_types: ['card'],\n amount: @announcement.price.to_i * 100,\n currency: 'eur',\n confirm: true, \n }, stripe_account: @announcement.seller.uid)\n\n respond_to do |format|\n if @purchase.save\n #create the notifications\n Order.create(description: \"ordine 2\",seller: @announcement.seller,announcement: @announcement)\n Notification.create(recipient: @announcement.seller, actor: current_buyer, action: \"buy\" ,notifiable: @announcement)\n @user = current_buyer\n format.html { redirect_to buyer_my_purchases_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @purchase }\n else\n format.html { render :new }\n format.json { render json: @purchase.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enquiry = Enquiry.find params[:enquiry_id]\n content = params[:email_content].gsub(\"\\n\", '<br>')\n FoodPartnerMailer.new_order_notice(@enquiry, content).deliver_later\n SupplierCommunication.create! comm_params\n @enquiry.wait_on_supplier\n head :ok\n end", "def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_announcement\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/announcements/#{@announcement.id}\")\n mail to: @user.email, subject: \"[bootcamp] #{@announcement.user.login_name}さんからお知らせです。\"\n end", "def create\n @enquiry = Enquiry.new(params[:enquiry])\n\n respond_to do |format|\n if @enquiry.save\n logger.info {\"Starting email first\"}\n EnquiryMailer.enquiry_received(@enquiry).deliver\n logger.info {\"Starting email second\"}\n EnquiryMailer.enquiry_response(@enquiry).deliver\n format.html { redirect_to thanks_path, notice: 'Thank you for your enquiry.' }\n format.json { render action: 'show', status: :created, location: @enquiry }\n else\n format.html { render action: 'new' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @refund_request = RefundRequest.new(params[:refund_request])\n\n respond_to do |format|\n if @refund_request.save\n NoticeMailer.refund_request_email(@refund_request).deliver\n format.html { redirect_to root_path, notice: 'Solicitud de devolución correctamente ingresada.' }\n format.json { render json: @refund_request, status: :created, location: @refund_request }\n else\n format.html { render action: \"new\" }\n format.json { render json: @refund_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @enquiry = Enquiry.new(enquiry_params)\n\n respond_to do |format|\n if @enquiry.save\n format.html { redirect_to root_path, notice: 'Message was successfully sent.' }\n format.json { render :show, status: :created, location: @enquiry }\n else\n format.html { render :new }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n return render nothing: true, status: 200 if Rails.env.test?\n RateServices::UpdateLoanDataFromSelectedRate.call(params[:id], params[:fees], lender_params, params[:thirty_fees], params[:prepaid_fees])\n @loan.reload\n\n envelope = Docusign::CreateEnvelopeService.new.call(current_user, @loan)\n recipient_view = DocusignRest::Client.new.get_recipient_view(\n envelope_id: envelope['envelopeId'],\n name: \"#{current_user.first_name} #{current_user.last_name}\",\n email: current_user.email,\n return_url: embedded_response_electronic_signature_index_url(\n loan_id: params[:id],\n envelope_id: envelope['envelopeId'],\n user_id: current_user.id\n )\n )\n\n if recipient_view\n render json: {message: recipient_view}, status: 200\n else\n render json: {message: t(\"errors.iframe_render_error\")}, status: 500\n end\n end", "def index\n @knowledges = Knowledge.order(\"created_at desc\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @knowledges }\n end\n end", "def create\n @agreement_renewal = AgreementRenewal.new(agreement_renewal_params)\n\n respond_to do |format|\n if @agreement_renewal.save\n Franchisee.find(@agreement_renewal.franchisee_id).update(latest_renewal: @agreement_renewal.renewed_date)\n format.html { redirect_to franchisees_path, notice: 'Agreement renewal was successfully created.' }\n format.json { render :show, status: :created, location: @agreement_renewal }\n else\n format.html { render :new }\n format.json { render json: @agreement_renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @general_enquiry = GeneralEnquiry.new(general_enquiry_params)\n\n respond_to do |format|\n if @general_enquiry.save\n format.json { msg = { :status => \"ok\", :message => \"Success!\", :html => \"<b>...</b>\" }\n format.json { render :json => msg } }\n else\n format.json { render json: @general_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proposal = Proposal.new(proposal_params)\n\n # 提案日セット\n# require \"date\"\n# d = Date.today\n# strdate = d.year.to_s + sprintf(\"%02d\", d.month).to_s + sprintf(\"%02d\", d.day).to_s \n# @proposal.proposal_date = strdate\n\n respond_to do |format|\n if @proposal.save\n# format.html { redirect_to proposals_path, notice: '提案を1件登録しました。' }\n format.html { redirect_to @proposal, notice: '提案を1件登録しました。' }\n format.json { render :show, status: :created, location: @proposal }\n else\n format.html { render :new }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def contact_added(freshdesk_data)\n\t response = HTTParty.post(\n\t \"#{@api_domain}contacts\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def create_intervention_ticket\n #Call zendesk API create new client method\n client = ZendeskAPI::Client.new do |config|\n #Get config parameters from application.yml \n #These parameters are ignored by git \n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n #create the ticket \n ZendeskAPI::Ticket.create!(client,\n #define subject with the current user name \n :subject => \"NEW INTERVENTION created by : \" + @currentusername.to_s ,\n #Requirements : \n # The Requester\n # The Customer (Company Name)\n # Building ID\n # The Battery ID\n # The Column ID if specified\n # Elevator ID if specified\n # The employee to be assigned to the task\n # Description of the request for intervention\n\n :comment => \"The customer ID : #{params[:customer]} \n Building ID : #{params[:building]} \n Battery ID : #{params[:battery]} \n Column ID : #{params[:column]} \n Elevator ID : #{params[:elevator]} \n Affected employee ID : #{params[:employee]} \n Description : #{params[:report]} \",\n #Set the priority \n :priority => \"urgent\",\n #Set the type \n :type => \"question\")\n end", "def create\n @interest = GtInterest.new(:email => params[:email], :priority_code => params[:priority_code])\n if @interest.save\n @status = 200\n\n # Don't want to email when using this model to test \"subscribe via email\" signups\n unless /subscribe_to_roll:.+/.match(params[:priority_code])\n ShelbyGT_EM.next_tick { GtInterestMailer.interest_autoresponse(@interest.email).deliver }\n end\n else\n render_error(400, \"must have a valid email\")\n end\n end", "def create\n @newsletter = Newsletter.new(params[:newsletter])\n\n if @newsletter.save\n params.keys.each do |k|\n \t\t#if k.split(\"_\").length-1 == 3\n\t\t#\tcase k.split(\"_\")[0]\n\t\t#\t\twhen \"registersend\" \n\t\t#\t\t\tSendnewsletters.sendnewsletter(params[:newsletter][:mailstart_id].to_s,@newsletter,request.domain).deliver\n\t\t#\t\t\tflash[:notice] = t \"newsletters.create.notice_success_sendind\" \n\t\t#\t\twhen \"register\"\n\t\t#\t\t\tflash[:notice] = t \"newsletters.create.notice_success\" \n\t\t#\tend\n\n\n\t\t#end\t\n\t\tset_params_newsletter(k)\n\tend\t\n \tredirect_to edit_newsletter_path(@newsletter)\n else\n\tflash[:notice] = t \"newsletters.create.notice_failure\" \n\trespond_with(@newsletter)\n end\n end", "def create\n @datum_receipt = DatumReceipt.new(datum_receipt_params)\n\n respond_to do |format|\n if @datum_receipt.save\n format.html { redirect_to @datum_receipt, notice: 'Datum receipt was successfully created.' }\n format.json { render :show, status: :created, location: @datum_receipt }\n else\n format.html { render :new }\n format.json { render json: @datum_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @installment_detail = InstallmentDetail.new(installment_detail_params)\n\n respond_to do |format|\n if @installment_detail.save\n @franchisee = @installment_detail.franchisee\n #InstallmentDetail.franchisee_royalty(@installment_detail)\n @franchisee.franchisee_agreement.update(no_of_installment: InstallmentDetail.where(franchisee_id: @franchisee.id).count.to_i)\n format.html { redirect_to installment_detail_url(id: @installment_detail.franchisee_id), notice: 'Installment detail was successfully created.' }\n format.json { render :show, status: :created, location: @installment_detail }\n else\n format.html { render :new }\n format.json { render json: @installment_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_to_api(snack_name, snack_location, snack_optional)\n RestClient.post ENV['NERDERY_API'], { name: snack_name,\n location: snack_location,\n optional: snack_optional\n }.to_json, content_type: :json\n end", "def dispute_notification(id, amount, currency)\n @id, @amount, @currency = id, amount, currency\n \n mail to: \"kaysertranslation@gmail.com\",\n subject: \"Hikarigo dispute created. Attention may be needed\"\n end", "def create\n @sponsercf = Sponsercf.new(sponsercf_params)\n\n respond_to do |format|\n if @sponsercf.save\n \n format.html { redirect_to @sponsercf, notice: 'Sponsercf was successfully created.' }\n format.json { render :show, status: :created, location: @sponsercf }\n else\n format.html { render :new }\n format.json { render json: @sponsercf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n student = Student.where(\"full_name ilike ?\", params[:walkathon_pledge][:student_name]).first rescue nil\n @walkathon_pledge =\n Walkathon::Pledge.where(student: student, sponsor_name: params[:walkathon_pledge][:sponsor_name]).first rescue nil if student\n\n # There was an old pledge. Delete it.\n @walkathon_pledge.delete if @walkathon_pledge\n\n @walkathon_pledge = Walkathon::Pledge.new(\n params[:walkathon_pledge][:pledge_type] == 'fixed' ? fixed_params : per_lap_params\n )\n @walkathon_pledge.student = student\n\n lap_record = Walkathon::LapCount.find_by_student_id(student.id) if student\n @walkathon_pledge.lap_count = lap_record.lap_count if lap_record\n\n respond_to do |format|\n if @walkathon_pledge.save\n UserMailer.new_pledge_email(student).deliver\n format.html { redirect_to :thankyou, notice: 'Pledge was successfully created.' }\n format.json { render :show, status: :created, location: @walkathon_pledge }\n else\n format.html { render :new }\n format.json { render json: @walkathon_pledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debate = Debate.new(debate_params)\n\n respond_to do |format|\n if @debate.save\n create_first_round\n if @debate.challenger_id\n UserMailer.challenge_existing_user(@debate).deliver_now\n format.html { redirect_to @debate, notice: 'Your debate challenge has successfully been created and an invitation has been sent to the challenger.' }\n format.json { render :show_debate, status: :created, location: @debate }\n elsif @debate.challenger_email.length > 5\n UserMailer.challenge_new_user(@debate).deliver_now\n format.html { redirect_to @debate, notice: 'Your debate challenge has been created and your challenger has been invited to join Citizen Debate and accept your challenge.' }\n format.json { render :show_debate, status: :created, location: @debate }\n else\n # flash[:show_modal] = true\n # flash[:modal_to_show] = '/debates/share_challenge'\n format.html { redirect_to @debate, notice: 'Your debate challenge has successfully been created. You will be notified when another user accepts your public challenge.' }\n format.json { render :show_debate, status: :created, location: @debate }\n end\n\n else\n format.html { render :new }\n format.json { render json: @debate.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @newsletter = Newsletter.new(newsletter_params)\n respond_to do |format|\n if @newsletter.save\n format.json { render json: @newsletter, status: :created, notice: 'newsletter was successfully created.' }\n else\n format.json { render json: @newsletter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @disclaimer = Disclaimer.new(params[:disclaimer])\n @disclaimers = Disclaimer.all\n\n respond_to do |format|\n if @disclaimer.save\n @disclaimers = Disclaimer.all\n format.html { redirect_to presets_path, notice: 'Disclaimer was successfully created.' }\n format.json { render json: @disclaimer, status: :created, location: @disclaimer }\n format.js\n else\n format.html { redirect_to presets_path, notice: 'Disclaimer was successfully created.' }\n format.json { render json: @disclaimer.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @correspondence = Correspondence.new_from_sendgrid(params)\n @correspondence.save\n render :text => \"Saved\", :status => 200\n end", "def create\n @inquiry_reply = InquiryReply.new(inquiry_reply_params)\n @inquiry_reply.user_id = flash[:user_id]\n @inquiry_reply.house_id = flash[:house_id]\n @inquiry_reply.inquiry_id = flash[:inquiry_id]\n @inquiry_reply.company_id = flash[:company_id]\n respond_to do |format|\n if @inquiry_reply.save\n UserMailer.with(user: User.find(@inquiry_reply.user_id), inquiry_reply: @inquiry_reply,\n inquiry: Inquiry.find(@inquiry_reply.inquiry_id), house: House.find(@inquiry_reply.house_id)).inquiry_reply_email.deliver_now\n format.html {redirect_to @inquiry_reply, notice: 'Inquiry reply was successfully created. We have notified the user via email'}\n format.json {render :show, status: :created, location: @inquiry_reply}\n else\n format.html {render :new}\n format.json {render json: @inquiry_reply.errors, status: :unprocessable_entity}\n end\n end\n end", "def create\n @solicitacao_pontual = SolicitacaoPontual.new(solicitacao_pontual_params)\n UserMailer.reserva_pontual(@solicitacao_pontual).deliver_now\n\n respond_to do |format|\n if @solicitacao_pontual.save\n format.html { redirect_to @solicitacao_pontual, notice: 'Solicitacao pontual was successfully created.' }\n format.json { render :show, status: :created, location: @solicitacao_pontual }\n else\n format.html { render :new }\n format.json { render json: @solicitacao_pontual.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.info params\n render status: :ok\n # @enquiry = Enquiry.new(enquiry_params)\n\n # respond_to do |format|\n # if @enquiry.save\n # format.html { redirect_to @enquiry, notice: 'Enquiry was successfully created.' }\n # format.json { render json: @enquiry, status: :created }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @fundamental_announcement = Fundamental::Announcement.new(params[:fundamental_announcement])\n @fundamental_announcement.author = current_backend_user\n\n respond_to do |format|\n if @fundamental_announcement.save\n format.html { redirect_to @fundamental_announcement, notice: 'Announcement was successfully created.' }\n format.json { render json: @fundamental_announcement, status: :created, location: @fundamental_announcement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundamental_announcement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pay_agreement = @fee.pay_agreements.build(pay_agreement_params)\n\n respond_to do |format|\n if @pay_agreement.save\n format.html { redirect_to @pay_agreement, notice: 'Pay agreement was successfully created.' }\n format.json { render :show, status: :created, location: @pay_agreement }\n format.js { }\n else\n format.html { render :new }\n format.json { render json: @pay_agreement.errors, status: :unprocessable_entity }\n format.js { render layout: false, content_type: 'text/javascript' }\n end\n end\n end", "def paid\n #if @notification.acknowledge # check if it’s genuine Robokassa request\n #@user.approve! # project-specific code\n render :text => @notification.success_response\n @user.approve!\n #else\n #head :bad_request\n #end\n end", "def create\n @invitation_request = InvitationRequest.new(invitation_request_params)\n\n respond_to do |format|\n if @invitation_request.save\n format.html { redirect_to root_path, notice: 'Invitation received. We will notify you soon!' }\n format.json { render :show, status: :created, location: @invitation_request }\n else\n @interests = Interest.all\n format.html { render :new }\n format.json { render json: @invitation_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def create\n @inquiry = Inquiry.new(inquiry_params)\n\n respond_to do |format|\n if @inquiry.save\n format.html { redirect_to root_path, notice: 'Inquiry was successfully created.' }\n format.json { render :show, status: :created, location: root_path }\n else\n format.html { render :new }\n format.json { render json: @inquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_intervention_ticket\n client = ZendeskAPI::Client.new do |config|\n config.url = ENV['ZENDESK_URL']\n config.username = ENV['ZENDESK_USERNAME']\n config.token = ENV['ZENDESK_TOKEN']\n end\n \n ZendeskAPI::Ticket.create!(client, \n :subject => \"Building: #{@intervention.building_id} requires intervention\", \n :comment => { \n :value => \n \"The Requester: #{Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name }\n The Customer (Company Name): #{@intervention.customer.company_name}\\n\n Building ID: #{@intervention.building_id}\\n\n Battery ID: #{params[:battery]}\\n\n Column ID: #{if (params[:column] == \"None\") then \"\" else params[:column] end} \n Elevators ID: #{if (params[:elevator] == \"None\" ) then \"\" else params[:elevator] end}\n #{if (@intervention.employee_id) then \"The employee to be assigned to the task: #{@intervention.employee.first_name} #{@intervention.employee.last_name}\" end}\n \n Description:#{@intervention.report}\"\n }, \n :requester => { \n \"name\": Employee.find(@intervention.author_id).first_name+''+Employee.find(@intervention.author_id).last_name \n },\n \n :type => \"problem\",\n :priority => \"normal\"\n )\n end", "def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n #template = NotificationTemplate.where(category: I18n.t('Notification.feedback')).last\n #Notification.create(recipient: current_user, actor: current_user, action: 'Offer', notifiable: @feedback, notification_template: template)\n UserMailer.delay.feedback(@feedback)\n \n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end", "def create\n @editorial = Editorial.new(editorial_params)\n users = User.where(:newsletter => true)\n respond_to do |format|\n if @editorial.save\n users.each do |user|\n UserMailer.newsletter(@editorial, user.email).deliver\n end\n format.html { redirect_to @editorial, notice: 'Article was successfully created.' }\n format.json { render action: 'show', status: :created, location: @editorial }\n else\n format.html { render action: 'new' }\n format.json { render json: @editorial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @order.save\n session[:order] = nil\n flash[:notice] = \"Thank you for your donation to #{@segment.name}\"\n session[:receipt] = \"Thank you for your donation! View your receipt from the 'My Account Section' \"\n format.html { redirect_to my_badge_create_url }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create(args) \n help_form = {:tNote => args[:note],\n :xCategory => args[:category],\n :sFirstName => args[:first_name],\n :sLastName => args[:last_name],\n :sUserId => args[:user_id],\n :sEmail => args[:email],\n :sPhone => args[:phone],\n :fUrgent => args[:urgent]}.reject!{|k,v| v == nil}\n \n JSON.parse(api_request('request.create', 'POST', help_form))['xRequest'] rescue []\n end", "def acknowledge(enquiry)\n @enquiry = enquiry\n\n mail :to => enquiry.email, :subject => \"B&B availability request for Bull Farm Oast\"\n end", "def create\n @purchase_order_datum = PurchaseOrderDatum.new(purchase_order_datum_params)\n \n #add180919\n #コンスタントへ注文番号を書き込む(先頭記号が変わった時)\n update_constant\n \n #工事データの住所を更新\n update_address_to_construction\n \n #メール送信する(メール送信ボタン押した場合)\n\t if params[:send].present?\n \n #画面のメアドをグローバルへセット\n set_responsible\n \n #画面のメアドをグローバルへセット\n #$email_responsible = params[:purchase_order_datum][:supplier_master_attributes][:email1]\n #CC用に担当者2のアドレスもグローバルへセット\n #$email_responsible2 = nil\n #if params[:purchase_order_datum][:supplier_master_id].present?\n # supplier = SupplierMaster.where(id: params[:purchase_order_datum][:supplier_master_id]).first\n # if supplier.present? && supplier.email_cc.present?\n # $email_responsible2 = supplier.email_cc\n # end\n #end\n \n #binding.pry\n \n #メール送信フラグをセット\n params[:purchase_order_datum][:mail_sent_flag] = 1\n\t @purchase_order_datum = PurchaseOrderDatum.new(purchase_order_datum_params) #add170922\n \n\t PostMailer.send_when_update(@purchase_order_datum).deliver\n end\n\t\n respond_to do |format|\n if @purchase_order_datum.save\n \n #臨時FAX用\n save_only_flag = true\n set_order_data_fax(format)\n \n if save_only_flag\n\t\t format.html {redirect_to purchase_order_datum_path(@purchase_order_datum, :construction_id => params[:construction_id], :move_flag => params[:move_flag])}\n else\n format.json { render :show, status: :ok, location: @purchase_order_datum }\n end\n else\n #add210727\n #バリデーション失敗の場合も、仕入担当者をリビルド\n\t @purchase_order_datum.build_supplier_responsible\n \n format.html { render :new }\n format.json { render json: @purchase_order_datum.errors, status: :unprocessable_entity }\n end\n end\n\t\n\t#メール送信する\n\t#PostMailer.send_when_update(@purchase_order_datum).deliver\n\t\n end", "def create\n @konfirm = Konfirm.new(konfirm_params)\n @konfirm.user_id = current_user.id\n\n\n respond_to do |format|\n if @konfirm.save\n UserMailer.konfirm_mail(@konfirm, @user).deliver_now\n\n format.html { redirect_to root_path, notice: 'Terimakasih Telah Melakukan Pembayaran.' }\n format.json { render :show, status: :created, location: @konfirm }\n else\n format.html { render :new }\n format.json { render json: @konfirm.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if @user.hearts >= @reward.cost\n @redemption = Redemption.new()\n @redemption.user = @user\n @redemption.cost = @reward.cost\n @redemption.reward = @reward\n\n if @reward.ifttt?\n key = ENV[\"IFTTT_KEY\"]\n\turl = \"https://maker.ifttt.com/trigger/#{@user.account}#{@reward.event}/with/key/#{key}\"\n\tresponse = RestClient.get url\n\n\trespond_to do |format|\n\t if response.code == 200 && @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n @user.save!\n\n format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n else\n format.json { render json: nil, status: :not_acceptable }\n end\n end\n elsif @reward.cash?\n \trespond_to do |format|\n if @redemption.save\n @user.hearts = @user.hearts - @reward.cost\n\t @user.save!\n\t SmsMailer.sms_email(Admin.all.first).deliver\n\n\t format.json { render json: @redemption.as_json(include: {reward: {only: :name}}).merge({hearts: @user.hearts}), status: :created }\n\t else\n\t format.json { render json: nil, status: :not_acceptable }\n\t end\n\tend\n end\n else\n respond_to do |format|\n format.json { render json: {message: \"Not enough hearts!\"}, status: :not_acceptable }\n end\n end\n end", "def create_bepaid_bill\n # Don't touch real web services during of test database initialization\n return if Rails.env.test?\n\n user = self\n\n bp = BePaid::BePaid.new Setting['bePaid_baseURL'], Setting['bePaid_ID'], Setting['bePaid_secret']\n\n amount = user.monthly_payment_amount\n\n #amount is (amoint in BYN)*100\n bill = {\n request: {\n amount: (amount * 100).to_i,\n currency: 'BYN',\n description: 'Членский взнос',\n email: 'jekhor@gmail.com',\n notification_url: 'https://hackerspace.by/admin/erip_transactions/bepaid_notify',\n ip: '127.0.0.1',\n order_id: '4444',\n customer: {\n first_name: 'Cool',\n last_name: 'Hacker',\n },\n payment_method: {\n type: 'erip',\n account_number: 444,\n permanent: 'true',\n editable_amount: 'true',\n service_no: Setting['bePaid_serviceNo'],\n }\n }\n }\n req = bill[:request]\n req[:email] = user.email\n req[:order_id] = user.id\n req[:customer][:first_name] = user.first_name\n req[:customer][:last_name] = user.last_name\n req[:payment_method][:account_number] = user.id\n\n begin\n res = bp.post_bill bill\n logger.debug JSON.pretty_generate res\n rescue => e\n logger.error e.message\n logger.error e.http_body if e.respond_to? :http_body\n user.errors.add :base, \"Не удалось создать счёт в bePaid, проверьте лог\"\n end\n end", "def index\n @knowledges = Knowledge.all\n end", "def create\n @post = Post.new(post_params)\n @post.user_id = current_user.id\n\n respond_to do |format|\n if @post.save\n newsletters = Newsletter.all\n\n newsletters.each do |newsletter|\n PostMailer.with(newsletter: newsletter, post: @post).new_post.deliver_later\n end\n\n format.html { redirect_to @post, notice: 'Postagem criada com sucesso!' }\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 @customer_refer_email = CustomerReferEmail.new(customer_refer_email_params)\n\n respond_to do |format|\n if @customer_refer_email.save\n format.html { redirect_to @customer_refer_email, notice: 'Customer refer email was successfully created.' }\n format.json { render :show, status: :created, location: @customer_refer_email }\n else\n format.html { render :new }\n format.json { render json: @customer_refer_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @pledge = Pledge.new\n @pledge.pledge_title = params[:pledge]['pledge_title']\n @pledge.pledge_description = params[:pledge]['pledge_description']\n @pledge.user_id = current_user.id\n @pledge.save()\n\n respond_to do |format|\n if @pledge.save\n format.html { redirect_to @pledge, notice: 'Pledge was successfully created.' }\n format.json { render json: @pledge, status: :created, location: @pledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @announcement_for = AnnouncementFor.new(announcement_for_params)\n\n respond_to do |format|\n if @announcement_for.save\n\n \n format.html { redirect_to @announcement_for, notice: 'Announcement for was successfully created.' }\n format.json { render :show, status: :created, location: @announcement_for }\n else\n format.html { render :new }\n format.json { render json: @announcement_for.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @agreement = Agreement.new(agreement_params)\n\n respond_to do |format|\n if @agreement.save\n format.html { redirect_to @agreement, notice: 'Certificado criado com sucesso.' }\n format.json { render :show, status: :created, location: @agreement }\n else\n format.html { render :new }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @freelance_document = FreelanceDocument.new(freelance_document_params)\n\n respond_to do |format|\n if @freelance_document.save\n format.html { redirect_to @freelance_document, notice: 'Freelance document was successfully created.' }\n format.json { render :show, status: :created, location: @freelance_document }\n else\n format.html { render :new }\n format.json { render json: @freelance_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @campaign_pledge = CampaignPledge.new(campaign_pledge_params)\n\n respond_to do |format|\n if @campaign_pledge.save\n format.html { redirect_to @campaign_pledge, notice: 'Campaign pledge was successfully created.' }\n format.json { render :show, status: :created, location: @campaign_pledge }\n else\n format.html { render :new }\n format.json { render json: @campaign_pledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kentrade = Kentrade.new(kentrade_params)\n\n respond_to do |format|\n if @kentrade.save\n format.html { redirect_to @kentrade, notice: 'Kentrade was successfully created.' }\n format.json { render :show, status: :created, location: @kentrade }\n else\n format.html { render :new }\n format.json { render json: @kentrade.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_post topic_id, payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post POSTS, payload, topic_id, nil, \"create_post\" )\n\t\t\t\tend", "def recruitments_new(recruitment)\n @recruitment = recruitment\n\n mail to: \"nandisuper2@gmail.com\",\n subject: \"New recruitment Requested\"\n end", "def send_post_notification(post)\n @post = post\n @post = post\n @poster = post.poster\n if @post.post_needs.size == 0\n @post_needs = []\n else\n @post_needs = @post.post_needs.alphabetical\n end\n recipients = @post.notify_emails\n\n if recipients != \"\"\n mail(:to => recipients, :subject => 'New Request at ' + post.street_1)\n end\n end", "def create\n @freind = Freind.new(freind_params)\n\n respond_to do |format|\n if @freind.save\n format.html { redirect_to @freind, notice: \"Freind was successfully created.\" }\n format.json { render :show, status: :created, location: @freind }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @freind.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_thanks \n end", "def add_bounce\n begin\n RestClient.post $cnf['mailgun']['apikey'] + $cnf['mailgun']['bounnces'],\n :address => 'bkotu6717@gmail.com'\n rescue Exception => e\n puts \"Exception raised add_bounce:\" + e.class.to_s\n puts e.message\n end\n end", "def create\n if request.env['x-amz-sns-message-type'] == 'SubscriptionConfirmation' || ENV['HTTP_X_AMZ_SNS_MESSAGE_TYPE'] == \"SubscriptionConfirmation\" || @data['Type'] == \"SubscriptionConfirmation\"\n response = HTTParty.get(@data['SubscribeURL'])\n head :ok\n\n else\n mail_data = @data['mail']\n bounce_data = @data['bounce']\n recipients = [bounce_data['bouncedRecipients']].flatten\n envelope = Msg::Envelope.find_by_email_id(mail_data['messageId'])\n recipients.each do |recipient_data|\n Msg::Bounce.create({\n :envelope => envelope,\n :bounce_type => bounce_data['bounceType'],\n :bounce_subtype => bounce_data['bounceSubType'],\n :reporter => bounce_data['reportingMTA'],\n :email => recipient_data['emailAddress'],\n :status => recipient_data['status'],\n :diagnostic => recipient_data['diagnosticCode'],\n :raw_message => JSON.dump(bounce_data)\n })\n end\n head :ok\n end\n end", "def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end", "def create\n @signature = Signature.new(params[:signature])\n\n signatureID = params[:signatureid]\n signature = params[:output]\n canvasHeight = params[:canvasHeight]\n canvasWidth = params[:canvasWidth]\n\n # Update invoice with signature\n @invoice = Invoice.find(signatureID)\n Invoice.find(signatureID).set(:signature, signature)\n Invoice.find(signatureID).set(:signatureStatus, true)\n Invoice.find(signatureID).set(:canvasHeight, canvasHeight)\n Invoice.find(signatureID).set(:canvasWidth, canvasWidth)\n\n creatorName = @invoice.creatorName.gsub(' ','%20')\n signeeName = @invoice.signeeName.gsub(' ','%20') \n\n #Set email content. \n subject = \"Contrato%20Aprobado\"\n footer = \"%0D%0DGracias,%0D%0D%5F%5F%0D%0D#{signeeName}\"\n message = \"El%20siguiente%20documento%20ha%20sido%20aprobado.%0D%0Dhttp://digidocgov.herokuapp.com/invoices/#{@invoice.id}#{footer}\"\n email = \"https://sendgrid.com/api/mail.send.json?api_user=rgonzalez&api_key=123456&to=#{@invoice['creatorEmail']}&toname=#{creatorName}&subject=#{subject}&text=#{message}&from=#{@invoice['signeeEmail']}&fromname=#{signeeName}\"\n\n\n #Send email notifying approval (with Sendgrid)\n ap 'Email Data Confirmation'\n ap email\n HTTParty.get(email)\n \n respond_to do |format|\n if @signature.save\n format.html { redirect_to @signature, notice: 'Signature was successfully created.' }\n format.json { render json: @signature, status: :created, location: @signature, :callback => params[:callback] }\n else\n format.html { render action: \"new\" }\n format.json { render json: @signature.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brochure = Brochure.new(params[:brochure])\n\n respond_to do |format|\n if @brochure.save\n NotificationMailer.brochure_email(@brochure).deliver\n format.html { render \"thanks\" }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n\n @intervention = Intervention.new(intervention_params)\n @intervention.author_id = current_user.employee.id\n\n zendesk_ticket_intervention(@intervention)\n\n respond_to do |format|\n if @intervention.save\n format.html { redirect_to @intervention, notice: 'Intervention was successfully created.' }\n format.json { render :show, status: :created, location: @intervention }\n else\n format.html { render :new }\n format.json { render json: @intervention.errors, status: :unprocessable_entity }\n end\n end\n end", "def carrierknowledghe_params\n params.fetch(:carrierknowledghe, {})\n end", "def create\n @kiban = Kiban.new(kiban_params)\n @Maker= MakerDeadline.find_by(メーカー: @kiban.メーカー)\n @approaching_deadline = (@kiban.最終注文日 + (@Maker.期限*365) - Date.today).to_i\n @kiban.経過日 = @approaching_deadline;\n respond_to do |format|\n if @kiban.save\n format.html { redirect_to @kiban, notice: 'Kiban was successfully created.' }\n format.json { render :show, status: :created, location: @kiban }\n else\n format.html { render :new}\n format.json { render json: @kiban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @remission_guide = RemissionGuide.new(remission_guide_params)\n @remission_guide.date = Time.now\n respond_to do |format|\n if @remission_guide.save\n update_credit_and_pending\n format.html {\n flash[:notice] = 'La Guía de Remisión se creó satisfactoriamente.'\n redirect_to remission_guides_path\n }\n format.json { render :show, status: :created, location: @remission_guide }\n else\n format.html { \n flash[:error] = @remission_guide.errors\n redirect_to new_remission_guide_path\n }\n format.json { render json: @remission_guide.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pledge = Pledge.new(params[:pledge])\n\n respond_to do |format|\n if @pledge.save\n format.html { redirect_to @pledge, notice: 'Pledge was successfully created.' }\n format.json { render json: @pledge, status: :created, location: @pledge }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @no_due = NoDue.new(no_due_params)\n\n respond_to do |format|\n if @no_due.save\n format.html { redirect_to @no_due, notice: 'No due was successfully created.' }\n format.json { render :show, status: :created, location: @no_due }\n else\n format.html { render :new }\n format.json { render json: @no_due.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @freight_bill = FreightBill.new(freight_bill_params)\n\n respond_to do |format|\n if @freight_bill.save\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully created.' }\n format.json { render :show, status: :created, location: @freight_bill }\n else\n format.html { render :new }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n params[:delivery][:attach_ids]=params[:delivery][:attach_ids].join(\",\")\n rescue => err\n p err\n end\n rm_unneed_attach\n \n @delivery=Delivery.new(params[:delivery])\n respond_to do |format|\n if @delivery.save\n format.html { redirect_to deliveries_url, notice: '送货单 成功创建.' }\n format.json { render json: @delivery, status: :created, location: @note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def add_contact(email, kyc_data = {})\n custom_params = {\n \"email\" => email,\n \"first_name\" => kyc_data[:first_name] || 'aman',\n \"last_name\" => kyc_data[:last_name] || 'barbaria',\n \"birthdate\" => kyc_data[:birthdate] || '23/07/1991',\n \"street_address\" => kyc_data[:street_address] || 'magarpatta city',\n \"city\" => kyc_data[:city] || 'pune',\n \"state\" => kyc_data[:state] || 'maharashtra',\n \"country\" => kyc_data[:country] || 'INDIA',\n \"postal_code\" => kyc_data[:postal_code] || '411028',\n \"ethereum_address\" => kyc_data[:ethereum_address] || '0x2755a475Ff253Ae5BBE6C1c140f975e5e85534bD',\n \"document_id_number\" => kyc_data[:document_id_number] || \"#{Time.now.to_i}\",\n \"nationality\" => kyc_data[:nationality] || 'INDIAN',\n \"document_id_file_path\" => kyc_data[:document_id_file_path] || '2/i/687eb50ecbe60c37400746a59200c75b',\n \"selfie_file_path\" => kyc_data[:selfie_file_path] || '2/i/24d828f00557817e846ebed6109c0ac8',\n \"residence_proof_file_path\" => kyc_data[:residence_proof_file_path] || '3/i/d3817395b85581eab3068cb43f9c0f63',\n \"investor_proof_files_path\" => kyc_data[:investor_proof_files_path] ||\n ['3/i/d3817395b85581eab3068cb43f9c0f63', '3/i/d3817395b85581eab3068cb43f9c0f63'],\n \"user_ip_address\" => kyc_data[:user_ip_address]\n }\n endpoint = \"/api/#{@version}/kyc/add-kyc/\"\n params = request_parameters(endpoint, custom_params)\n post(params)\n end", "def provider_intention_note_ajax\n begin\n UserMailer.sendNoteToBecomePartner(params[:email])\n container = { \"status\" => \"success\" }\n rescue\n container = { \"status\" => \"fail\" }\n end\n render :json => container.to_json\n end", "def create\n puts \"*********************CREATE*******************\"\n puts \"*************** intervention_params **************\" + intervention_params.to_s\n @intervention = Intervention.new(intervention_params)\n @intervention.intervention_result = \"incomplete\"\n @intervention.intervention_status = \"pending\"\n @currentusername = current_user.full_name\n @intervention.author = @currentuserid\n \n if @intervention.save\n ZendeskAPI::Ticket.create!($client, \n :subject => \"**NEW INTERVENTION** created by : \" + @currentusername.to_s ,\n :comment => \"The customer ID : #{params['intervention'][:customer_id]} \n building ID : #{params['intervention'][:building_id]} \n battery ID : #{params['intervention'][:battery_id]} \n column ID : #{params['intervention'][:column_id]} \n elevator ID : #{params['intervention'][:elevator_id]} \n affected employee ID : #{params['intervention'][:employee_id]} \n description ID : #{params['intervention'][:intervention_report]} \",\n :priority => \"urgent\",\n :type => \"question\")\n\n render 'static_pages/intervention_received'\n else\n flash.now[:error] = \"fail no intervention has been sent\"\n render :index\n end\n end", "def subscriber_notice_awaiting_payment\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'awaiting_payment'\n )\n end", "def create\n @raffle = Raffle.new(raffle_params)\n @raffle.collected_money = 0\n respond_to do |format|\n if @raffle.save\n for follower in @raffle.user.followers\n notification = Notification.new()\n notification.content = \"#{@raffle.user.name} just released the raffle #{@raffle.name}\"\n notification.user_id = follower.id\n notification.raffle_id = @raffle.id\n notification.save\n end\n format.html { redirect_to @raffle, notice: 'Raffle was successfully created.' }\n format.json { render :show, status: :created, location: @raffle }\n else\n format.html { render :new }\n format.json { render json: @raffle.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @carrierknowledghes = Carrierknowledghe.all\n end", "def create\n @referee = Referee.new(referee_params)\n\n respond_to do |format|\n if @referee.save\n format.html { redirect_to @referee, notice: \"Referee was successfully created.\" }\n format.json { render :show, status: :created, location: @referee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey = Survey.find(params[:survey_id])\n emoji = params[:emoji]\n mood = params[:mood]\n @feeling = Feeling.new(mood: mood, emoji: emoji)\n @survey.feelings << @feeling\n\n if @feeling.save\n render :ok, json: @feeling\n else\n @errors = @feelings.error.full_messages\n render json: {message: @errors}, status: :unprocessable_entity\n end\n\n if !@survey\n render json: {message: [\"Survey is Required!\"] }, status: :unprocessable_entity\n end\n end", "def create\n @delivery_note = DeliveryNote.new(params[:delivery_note])\n\n respond_to do |format|\n if @delivery_note.save\n format.html { redirect_to @delivery_note, notice: 'Delivery note was successfully created.' }\n format.json { render json: @delivery_note, status: :created, location: @delivery_note }\n else\n format.html { render action: \"new\" }\n format.json { render json: @delivery_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @customer = Customer.find(params[:customer_id])\n @reclamation = @customer.reclamation.new(reclamation_params)\n\n respond_to do |format|\n if @reclamation.save\n\n else\n format.html { render :new }\n format.json { render json: @reclamation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newsletter = Newsletter.new(newsletter_params)\n @newsletter.unmanager_id = current_user.id\n respond_to do |format|\n if @newsletter.save\n @newsletter.notify_admin\n format.html { redirect_to @newsletter, notice: 'Newsletter wird nun zur Prüfung freigegeben' }\n format.json { render :show, status: :created, location: @newsletter }\n else\n format.html { render :new }\n format.json { render json: @newsletter.errors, status: :unprocessable_entity }\n end\n end\n end", "def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end", "def api_payment_ack_notification\n\n raise \"No notification ID\" unless @payment_notification_id\n\n url = \"#{@config['api_host']}/1/payments/notifications/#{@payment_notification_id}?access_token=#{@oauth_token}\"\n\n puts \"Finding notification info...\"\n log_error \"Request: #{url}\" if @debug >= AttApiReporter::DEBUG_INFO\n\n begin\n page = @agent.put(url, { :notificationID => @payment_notification_id })\n notificationStatus = JSON.parse(page.body)\n puts JSON.pretty_generate(notificationStatus)\n rescue Exception => e\n puts \"ERROR\"\n puts e.page.body\n end\n end", "def create\n\n if params[:sheduled_message].has_key? '0'\n params[:sheduled_message].each do |sm|\n # raise sm.last.to_hash.to_yaml\n SheduledMessage.create sm.last.to_hash\n end\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Messages was successfully queued.' }\n end\n else\n @sheduled_message = SheduledMessage.new(params[:sheduled_message])\n\n respond_to do |format|\n if @sheduled_message.save\n format.html { redirect_to @sheduled_message, notice: 'Sheduled message was successfully created.' }\n format.json { render json: @sheduled_message, status: :created, location: @sheduled_message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheduled_message.errors, status: :unprocessable_entity }\n end\n end\n end\n\n \n end", "def freelance_proposal_params\n params.require(:freelance_proposal).permit(:customer, :portfolio_url, :tools, :estimated_hours, :hourly_rate, :weeks_to_compelete, :client_email)\n end", "def enquiries_post(enquiry, opts = {})\n data, _status_code, _headers = enquiries_post_with_http_info(enquiry, opts)\n data\n end", "def create\n @fund = Fund.new(fund_params)\n\n respond_to do |format|\n if @fund.save\n MoneyMailer.funding_confirmation(current_user, @fund).deliver_now\n Fund.find(@fund.id).update(:state => true)\n format.html { redirect_to @fund, notice: 'Fund was successfully created.' }\n format.json { render :show, status: :created, location: @fund }\n else\n format.html { render :new }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n\n\n end", "def create\n\n @enrollment = Enrollment.new(properties_data: enrollment_properties_params)\n #debugger\n #@enrollment = Enrollment.new()\n #render json: request.raw_post(), status: :created\n\n if @enrollment.save\n render json: {:reference_number => @enrollment.reference_number}, status: :created\n else\n render json: @enrollment.errors, status: :unprocessable_entity\n end\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end" ]
[ "0.6177058", "0.57967305", "0.5719989", "0.5719659", "0.56235546", "0.5551821", "0.5533549", "0.5421324", "0.5402464", "0.53731877", "0.52746886", "0.5257329", "0.5256773", "0.5241811", "0.52405256", "0.52355033", "0.52342623", "0.52285594", "0.5201299", "0.51998365", "0.51905745", "0.51736945", "0.5170104", "0.5167517", "0.5121385", "0.5113942", "0.5111592", "0.5108699", "0.50983596", "0.5077426", "0.50769734", "0.50676775", "0.5066381", "0.50641155", "0.5057709", "0.50513715", "0.50477356", "0.5045829", "0.5044277", "0.50397843", "0.50360346", "0.50290215", "0.5023199", "0.50217277", "0.5015374", "0.50106645", "0.5008381", "0.5005528", "0.5005451", "0.50048834", "0.49990684", "0.4992626", "0.49853525", "0.49846962", "0.49844965", "0.49802518", "0.49722508", "0.49722373", "0.4969152", "0.49687514", "0.49632606", "0.49571782", "0.4955688", "0.4952006", "0.49519372", "0.49500182", "0.49474233", "0.4947138", "0.49469998", "0.49454126", "0.4942217", "0.4942061", "0.4941706", "0.49416", "0.49410293", "0.49338645", "0.4933084", "0.4932313", "0.49301946", "0.4924889", "0.49238533", "0.49225384", "0.49220386", "0.49217784", "0.49202612", "0.49190018", "0.4918194", "0.4918191", "0.49173746", "0.49168998", "0.4910254", "0.4910028", "0.49085876", "0.48975778", "0.4895832", "0.4894691", "0.489242", "0.48875648", "0.48873806", "0.48852107" ]
0.49492547
66
PATCH/PUT /freelancer_knowledges/1 PATCH/PUT /freelancer_knowledges/1.json
def update respond_to do |format| if @freelancer_knowledge.update(freelancer_knowledge_params) format.html { redirect_to @freelancer_knowledge, notice: 'Freelancer knowledge was successfully updated.' } format.json { render :show, status: :ok, location: @freelancer_knowledge } else format.html { render :edit } format.json { render json: @freelancer_knowledge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @carrierknowledghe.update(carrierknowledghe_params)\n format.html { redirect_to @carrierknowledghe, notice: 'Carrierknowledghe was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrierknowledghe }\n else\n format.html { render :edit }\n format.json { render json: @carrierknowledghe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n @knowledge = current_user.knowledges.find(params[:id])\n\n respond_to do |format|\n if @knowledge.update_attributes(params[:knowledge])\n format.html { redirect_to @knowledge, notice: 'Knowledge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @knowledge.errors, status: :unprocessable_entity }\n end\n end\n end", "def contact_updated(freshdesk_data,contact_id)\n\t\t#Rails.logger.info \"Update method id and data\"\n\t\t#Rails.logger.debug \"#{@api_domain}-#{contact_id}-#{@api_key}\"\n\t\t#Rails.logger.debug \"#{freshdesk_data.to_json}\"\n\t response = HTTParty.put(\n\t \"#{@api_domain}contacts/#{contact_id}\", \n\t\t basic_auth: { username: @api_key, password: \"password\" },\n\t\t headers: { 'Content-Type' => 'application/json' },\n\t\t body: freshdesk_data.to_json\n\t )\n\tend", "def update\n respond_to do |format|\n if @enquiry.update(params[:enquiry])\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n# if @proposal.update(proposal_params)\n if @proposal.update_with_conflict_validation(proposal_params)\n format.html { redirect_to @proposal, notice: '提案を1件更新しました。' }\n format.json { render :show, status: :ok, location: @proposal }\n else\n format.html { render :edit }\n format.json { render json: @proposal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @enquiry.update(enquiry_params)\n format.html { redirect_to @enquiry, notice: 'Enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @enquiry }\n else\n format.html { render :edit }\n format.json { render json: @enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @newsletter.update(newsletter_params)\n format.json { render json: @newsletter, status: :ok }\n else\n format.json { render json: @newsletter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sponsercf.update(sponsercf_params)\n format.html { redirect_to @sponsercf, notice: 'Sponsercf was successfully updated.' }\n format.json { render :show, status: :ok, location: @sponsercf }\n else\n format.html { render :edit }\n format.json { render json: @sponsercf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n # if @delivery.paid_for != (delivery_params[:paid_for] == \"1\")\n if !@delivery.paid_for && delivery_params[:paid_for] == \"1\"\n create_payment(@delivery)\n end\n # end\n if @delivery.update(delivery_params)\n format.html { redirect_to @delivery, notice: 'Delivery was successfully updated.' }\n format.json { render :show, status: :ok, location: @delivery }\n else\n format.html { render :edit }\n format.json { render json: @delivery.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @freelance_document.update(freelance_document_params)\n format.html { redirect_to @freelance_document, notice: 'Freelance document was successfully updated.' }\n format.json { render :show, status: :ok, location: @freelance_document }\n else\n format.html { render :edit }\n format.json { render json: @freelance_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @franchisee.update(franchisee_params)\n @franchisee.parent = params[:parent] if params[:parent] \n @franchisee.update(parent: @franchisee.parent)\n @franchisee.update(no_of_owners: FranchiseeOwner.where(franchisee_id: @franchisee.id).count, latest_renewal: @franchisee.franchisee_agreement.renewal_date)\n @franchisee.franchisee_agreement.update(no_of_installment: InstallmentDetail.where(franchisee_id: @franchisee.id).count.to_i)\n format.html { redirect_to franchisees_url, notice: 'Franchisee was successfully updated.' }\n format.json { render :show, status: :ok, location: @franchisee }\n else\n format.html { render :edit }\n format.json { render json: @franchisee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compromise = Compromise.find(params[:id])\n\n if @compromise.update(compromise_params)\n Notification.delete_all([\"compromise_id = ?\", @compromise.id])\n create_for_each_notification_type(@compromise)\n head :no_content\n else\n render json: @compromise.errors, status: :unprocessable_entity\n end\n end", "def update\n @crate = Crate.find(params[:id])\n\n paid = @crate.paid\n\n respond_to do |format|\n if @crate.update_attributes(params[:crate])\n \n # Only sending the mail, in case the paid date was newly added.\n if (paid.nil? == true) && (@crate.paid.nil? == false)\n CratesNotifier.crate_paid(@crate).deliver\n end\n\n format.html { redirect_to @crate, :notice => 'Crate was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @crate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n\n respond_to do |format|\n if @fundamental_announcement.update_attributes(params[:fundamental_announcement])\n format.html { redirect_to @fundamental_announcement, notice: 'Announcement was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_announcement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #Finding the specific chore where the id matches the one we pass in with the body\n @v1_chore = Chore.where(id: params[:id]).first\n #Here we're checking if we have user_id in our body, and if we do, we'll change the selected chore's properties\n #with the parameters of the body, we go through the specific group to our specific chore with the path\n if v1_chore_params[:user_id]\n @v1_chore.user_id = params[:user_id]\n @v1_chore.assigned = true\n if @v1_chore.save\n render :show, status: :ok\n end\n else\n render json: @v1_chore.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @agreement_renewal.update(agreement_renewal_params)\n format.html { redirect_to @agreement_renewal, notice: 'Agreement renewal was successfully updated.' }\n format.json { render :show, status: :ok, location: @agreement_renewal }\n else\n format.html { render :edit }\n format.json { render json: @agreement_renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n params[:newsletter][:subcontact_ids] ||= []\n params[:newsletter][:email_ids] ||= []\n @newsletter = Newsletter.find(params[:id])\n\n #respond_to do |format|\n # if @newsletter.update_attributes(params[:newsletter])\n # format.html { redirect_to @newsletter, :notice => 'Newsletter was successfully updated.' }\n # format.json { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @newsletter.errors, :status => :unprocessable_entity }\n # end\n #end\n if @newsletter.update_attributes(params[:newsletter]) \n params.keys.each do |k|\n\t\tset_params_newsletter(k)\t\n\tend\t\n else\n\t flash[:notice] = t(\"newsletters.update.notice_failure\")\n\t render :edit \n end\n\n #redirect_to(:back)\n end", "def update\n respond_to do |format|\n if @fuel_issued.update(fuel_issued_params)\n format.html { redirect_to @fuel_issued, notice: (t 'fuel_issueds.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fuel_issued.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @delivery_note = DeliveryNote.find(params[:id])\n\n respond_to do |format|\n if @delivery_note.update_attributes(params[:delivery_note])\n format.html { redirect_to @delivery_note, notice: 'Delivery note was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @delivery_note.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @agreement.update(agreement_params)\n format.html { redirect_to @agreement, notice: 'Agreement was successfully updated.' }\n format.json { render :show, status: :ok, location: @agreement }\n else\n format.html { render :edit }\n format.json { render json: @agreement.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n\n if @service_level_agreement.update_attributes(params[:service_level_agreement])\n render :json => {:success => true}\n else\n render :json => {:success => false, :message => @service_level_agreement.errors.full_messages.join(\". \") }\n end\n end", "def updateNotification\n read = convertToBoolean(read)\n delivered = convertToBoolean(delivered)\n\n parameters={id_user: params[:id_user].to_i, subject: params[:subject].to_s, content: params[:content].to_s, read: params[:read], delivered: params[:delivered] }\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n url = \"http://192.168.99.101:4052/notifications/\"+params[:id].to_s\n results = HTTParty.put(url.to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n @disclaimer = Disclaimer.find(params[:id])\n @disclaimers = Disclaimer.all\n\n respond_to do |format|\n if @disclaimer.update_attributes(params[:disclaimer])\n @disclaimers = Disclaimer.all\n format.html { redirect_to @disclaimer, notice: 'Disclaimer was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @disclaimer.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n respond_to do |format|\n if @balance_enquiry.update(balance_enquiry_params)\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @balance_enquiry }\n else\n format.html { render :edit }\n format.json { render json: @balance_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @email_reminder.update(email_reminder_params)\n respond_with @email_reminder\n end", "def update\n authorize @inquiry\n\n if @inquiry.update(inquiry_params)\n head :no_content\n else\n render json: {errors:@inquiry.errors.messages}, status: :unprocessable_entity\n end\n\n end", "def update\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @my_prayer_request.update_attributes(params[:my_prayer_request])\n format.html { redirect_to @my_prayer_request, notice: 'My prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @customer_refer_email.update(customer_refer_email_params)\n format.html { redirect_to @customer_refer_email, notice: 'Customer refer email was successfully updated.' }\n format.json { render :show, status: :ok, location: @customer_refer_email }\n else\n format.html { render :edit }\n format.json { render json: @customer_refer_email.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ticket.update(ticket_params)\n @ticket.update_responsible(:status, 'Waiting for Staff Response')\n format.html { redirect_to @ticket, notice: 'Ticket was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ticket.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @doc.refused = false\n @doc.logs += \"Документ отредактирован #{DateTime.now}. <br> Документ повторно отправлен на подпись #{@doc.signer.name_with_initial}<br>\"\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n\n respond_to do |format|\n if @pack_group_receipt.update_attributes(params[:pack_group_receipt])\n format.html { redirect_to @pack_group_receipt, notice: 'Pack group receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pack_group_receipt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @inquiry_reply.update(inquiry_reply_params)\n UserMailer.with(user: User.find(@inquiry_reply.user_id), inquiry_reply: @inquiry_reply,\n inquiry: Inquiry.find(@inquiry_reply.inquiry_id), house: House.find(@inquiry_reply.house_id)).inquiry_reply_email.deliver_now\n format.html {redirect_to @inquiry_reply, notice: 'Inquiry reply was successfully updated. We have notified the user via email'}\n format.json {render :show, status: :ok, location: @inquiry_reply}\n else\n format.html {render :edit}\n format.json {render json: @inquiry_reply.errors, status: :unprocessable_entity}\n end\n end\n end", "def update\n respond_to do |format|\n if @claim.update(claim_params)\n format.html { redirect_to @claim, notice: 'Claim was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @claim.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.update_attributes(params[:commission_fixing])\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(@commission_fixing.errors)\n end \n end", "def update\n respond_to do |format|\n if @client_contact.update(client_contact_params)\n client_contact_hash()\n format.html { redirect_to @client_contact, notice: $gcMsgUpdateRecord }\n format.json { render :json => @client_contact_hash }\n format.xml { render :xml => @client_contact_hash }\n else\n lcHashError = { return_status: false, errors: @client_contact.errors }\n format.html { render :edit }\n format.json { render :json => lcHashError }\n format.xml { render :xml => lcHashError }\n end\n end\n end", "def update\n \t\t@interested = Interested.find(params[:id])\n\n \t\trespond_to do |format|\n \t\t\tif @interested.update_attributes(params[:interested])\n \t\t\tformat.html { redirect_to @interested, notice: 'Interested was sucessfully updated.' }\n \t\t\tformat.json {head :no_content }\n \t\t\telse\n \t\t\t\tformat.html { render action: \"edit\" }\n \t\t\t\tformat.json { render json: @interested.error, status: :unprocessable_entity }\n \t\t\tend\n \t\tend\n \tend", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n puts \"pregnancy_params => #{pregnancy_params}\"\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: 'Gravidanza aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @pregnancy }\n else\n format.html { render :edit }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n # Record who updated the record\n @funding_request.updator = current_user\n\n respond_to do |format|\n if @funding_request.update(form_params)\n notify_user(:notice, \"The Funding Request was successfully updated\")\n format.html {\n redirect_back(fallback_location: root_path)\n }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident_proof.update(incident_proof_params)\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully updated.' }\n format.json { render :show, status: :ok, location: @incident_proof }\n else\n format.html { render :edit }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fundamental_retention_mail = Fundamental::RetentionMail.find_by_identifier(params[:id])\n\n respond_to do |format|\n if !@fundamental_retention_mail.nil? && !@fundamental_retention_mail.redeem_credit_reward\n format.html { redirect_to @fundamental_retention_mail, notice: 'Retention mail was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_retention_mail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @notice.update(notice_params)\n respond_to do |format|\n format.json { render action: 'show' }\n end\n end", "def update\n respond_to do |format|\n if @kpi_notification.update(kpi_notification_params)\n format.html { redirect_to @kpi_notification, notice: 'Kpi notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @kpi_notification }\n else\n format.html { render :edit }\n format.json { render json: @kpi_notification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @referee = Referee.find(params[:id])\n\n respond_to do |format|\n if @referee.update_attributes(params[:referee])\n format.html { redirect_to @referee, notice: 'Referee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @referee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prayer_request = PrayerRequest.find(params[:id])\n\n respond_to do |format|\n if @prayer_request.update_attributes(params[:prayer_request])\n format.html { redirect_to @prayer_request, notice: 'Prayer request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @prayer_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @newsletter.update(newsletter_params)\n format.html { redirect_to @newsletter, notice: 'Newsletter was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @newsletter.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @snack.update(snack_params)\n format.html { redirect_to @snack, notice: 'Snack was successfully updated.' }\n format.json { render :show, status: :ok, location: @snack }\n else\n format.html { render :edit }\n format.json { render json: @snack.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @freight_bill.update(freight_bill_params)\n format.html { redirect_to @freight_bill, notice: 'Freight bill was successfully updated.' }\n format.json { render :show, status: :ok, location: @freight_bill }\n else\n format.html { render :edit }\n format.json { render json: @freight_bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kont_klient.update(kont_klient_params)\n format.html { redirect_to @kont_klient, notice: 'Kont klient was successfully updated.' }\n format.json { render :show, status: :ok, location: @kont_klient }\n else\n format.html { render :edit }\n format.json { render json: @kont_klient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end", "def update\n @badge = Badge.find_by_key(params['id'])\n @badge.approved_at = Time.now unless session[:admin]\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, :notice => 'Badge was successfully updated.' }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n notification = Notification.find(params[:id])\n notification.update(\n params.permit(:title, :description)\n )\n notification.active = false\n notification.save\n render json: notification\n end", "def update\n @fee = Fee.find(params[:id])\n\n respond_to do |format|\n if @fee.update_attributes(params[:fee])\n format.html { redirect_to fees_path, notice: 'Fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @aoo_ref.update(aoo_ref_params)\n format.html { redirect_to @aoo_ref, notice: 'Aoo ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @aoo_ref }\n else\n format.html { render :edit }\n format.json { render json: @aoo_ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n webhook.update(webhook_params)\n respond_with(webhook)\n end", "def update\n respond_to do |format|\n if @inquiry.update(inquiry_params)\n format.html { redirect_to @inquiry, notice: 'Inquiry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @keyclientorder.update(keyclientorder_params)\n format.html { redirect_to @keyclientorder, notice: 'Keyclientorder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @keyclientorder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @confection.update(confection_params)\n format.html { redirect_to @confection, notice: 'Confection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @confection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @note = Note.find(params[:id])\n\n respond_to do |format|\n if @note.update_attributes(params[:note])\n format.html { redirect_to @note, :notice => 'Contact was successfully updated.' }\n format.json { render :json => @note }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @note.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @interested = Interested.find(params[:id])\n\n respond_to do |format|\n if @interested.update_attributes(params[:interested])\n format.html { redirect_to @interested, notice: 'Interested was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @interested.errors, status: :unprocessable_entity }\n end\n end\n end", "def on_agree\n @doc.update(agreed: false)\n respond_to do |format|\n if @doc.update(doc_params)\n format.html { redirect_to @doc, notice: 'Doc was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc }\n else\n format.html { render :edit }\n format.json { render json: @doc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fee.update(fee_params)\n format.html { redirect_to @fee, notice: 'Fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @fee }\n else\n format.html { render :edit }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_record(http, ref)\n json = %|{\n \"kind\": \"Article\",\n \"title\": \"Sample\",\n \"text\": \"Updated text.\"\n}|\n resp = http.send_request('POST', \"/v1/Article/#{ref}\", json, { 'Content-Type' => 'application/json' })\n # Response should be an OK with a JSON body.\n assert_equal(Net::HTTPOK, resp.class, 'response not an OK')\n reply = Oj.strict_load(resp.body, symbol_keys: true)\n\n # Make sure the message has the correct fields and values.\n assert_equal(0, reply[:code], 'update reply.code should be 0 meaning no error')\n updated = reply[:updated]\n assert_equal(1, updated.length, 'update reply.updated should contain exactly one member')\n ref = updated[0]\n refute_equal(nil, ref, 'update reply record reference can not be nil')\n refute_equal(0, ref, 'update reply record reference can not be 0')\n ref\n end", "def update\n @tack = Tack.find(params[:id])\n\n if @tack.update(tack_params)\n head :no_content\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @depot_fuel.update(depot_fuel_params)\n @depot_fuel.surplus_notification\n format.html { redirect_to @depot_fuel, notice: (t 'depot_fuels.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @depot_fuel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ref.update(ref_params)\n format.html { redirect_to @ref, notice: 'Ref was successfully updated.' }\n format.json { render :show, status: :ok, location: @ref }\n else\n format.html { render :edit }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # if @attention.update(attention_params)\n # format.html { redirect_to @attention, notice: 'Attention was successfully updated.' }\n # format.json { render :show, status: :ok, location: @attention }\n # else\n # format.html { render :edit }\n # format.json { render json: @attention.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @envelope.update(envelope_params)\n format.html { redirect_to @envelope, notice: 'Envelope was successfully updated.' }\n format.json { render :show, status: :ok, location: @envelope }\n else\n format.html { render :edit }\n format.json { render json: @envelope.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(path, params)\n time(\"PATCH #{path}\") { Cloudflarer.new.patch(path, params) }\n end", "def update\n respond_to do |format|\n if @refugee.update(refugee_params)\n format.html { redirect_to @refugee, notice: 'Refugee was successfully updated.' }\n format.json { render :show, status: :ok, location: @refugee }\n else\n format.html { render :edit }\n format.json { render json: @refugee.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @presponsable.update(presponsable_params)\n format.html { redirect_to @presponsable, notice: 'Presponsable was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @presponsable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @coffer.update(coffer_params)\n format.html { redirect_to @coffer, notice: 'Coffer was successfully updated.' }\n format.json { render :show, status: :ok, location: @coffer }\n else\n format.html { render :edit }\n format.json { render json: @coffer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @general_enquiry.update(general_enquiry_params)\n format.html { redirect_to @general_enquiry, notice: 'General enquiry was successfully updated.' }\n format.json { render :show, status: :ok, location: @general_enquiry }\n else\n format.html { render :edit }\n format.json { render json: @general_enquiry.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'edit' , notice: 'Kontakten uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pregnancy.update(pregnancy_params)\n format.html { redirect_to @pregnancy, notice: 'Pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pre_payment_req.update(pre_payment_req_params)\n format.html { redirect_to @pre_payment_req, notice: 'Pre payment req was successfully updated.' }\n format.json { render :show, status: :ok, location: @pre_payment_req }\n else\n format.html { render :edit }\n format.json { render json: @pre_payment_req.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@feeling.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @feeling.update(updated_params)\n puts \"brucep update success\"\n #format.html { redirect_to @feeling, notice: 'Feeling was successfully updated.' }\n format.html { redirect_to new_feeling_path }\n format.json { render :show, status: :ok, location: @feeling }\n #format.js\n else\n format.html { render :edit }\n format.json { render json: @feeling.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @benefit_requested.update(benefit_requested_params)\n format.html { redirect_to @benefit_requested, notice: 'Benefit requested was successfully updated.' }\n format.json { render :show, status: :ok, location: @benefit_requested }\n else\n format.html { render :edit }\n format.json { render json: @benefit_requested.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @demand = Demand.find(params[:id])\n @demand.user_id = current_user.id\n @user = User.find(@demand.user_id)\n\n respond_to do |format|\n if @demand.update_attributes(params[:demand])\n Notifier.processed_demands(@demand,@user).deliver if Rails.env.production?\n format.html { redirect_to services_path, notice: '申し込みは正常に処理されました' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @demand.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calificationem = Calificationem.find(params[:id])\n @calificationem.delivery.calificationem_id = @calificationem.id\n @calificationem.delivery.save\n respond_to do |format|\n if @calificationem.update_attributes(params[:calificationem])\n format.html { redirect_to :back, notice: 'Calificationem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calificationem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @badge = Badge.find(params[:id])\n\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n format.html { redirect_to @badge, notice: 'Badge was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @badge.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prayer.update(prayer_params)\n format.html { redirect_to @prayer, notice: 'Prayer 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 edit(marketing_email, newname = nil)\n params = marketing_email.as_json\n params.merge!(:newname => newname) if newname\n perform_request(Entities::Response, 'newsletter/edit.json', params)\n end", "def update\n respond_to do |format|\n if @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kickoff = Kickoff.find(params[:id])\n\n respond_to do |format|\n if @kickoff.update_attributes(params[:kickoff])\n format.html { redirect_to @kickoff, notice: 'Kickoff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kickoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @badge = Badge.find(params[:id])\n respond_to do |format|\n if @badge.update_attributes(params[:badge])\n flash[:notice] = 'Badge was successfully updated.'\n format.html { redirect_to organization_segment_badge_url(@organization,@segment, @badge) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @badge.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @receipt_detail.update(receipt_detail_params)\n format.html { redirect_to @receipt_detail, notice: 'Receipt detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @receipt_detail }\n else\n format.html { render :edit }\n format.json { render json: @receipt_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @fund.update(fund_params)\n head :no_content\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @konfirm.update(konfirm_params)\n format.html { redirect_to @konfirm, notice: 'Konfirm was successfully updated.' }\n format.json { render :show, status: :ok, location: @konfirm }\n else\n format.html { render :edit }\n format.json { render json: @konfirm.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @email_notification.update(email_notification_params)\n format.html { redirect_to @email_notification, notice: 'Email notification was successfully updated.' }\n format.json { render :show, status: :ok, location: @email_notification }\n else\n format.html { render :edit }\n format.json { render json: @email_notification.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.61674035", "0.5970784", "0.59621316", "0.59359676", "0.5861881", "0.5827468", "0.5781857", "0.57728577", "0.57728577", "0.57666564", "0.57656974", "0.5750609", "0.57496226", "0.5694131", "0.5683518", "0.5676585", "0.5652145", "0.5650353", "0.56306255", "0.56279796", "0.56279165", "0.56278026", "0.56275415", "0.5627506", "0.56067526", "0.560669", "0.56050235", "0.5603844", "0.5593388", "0.5587692", "0.5586435", "0.5580753", "0.5572252", "0.5564713", "0.5557118", "0.5542868", "0.5537948", "0.55374324", "0.5534777", "0.5531508", "0.55238354", "0.5519649", "0.5516816", "0.5515393", "0.5514072", "0.55091274", "0.55083364", "0.5507168", "0.550623", "0.5489858", "0.54890645", "0.54885286", "0.5485173", "0.5482951", "0.5482481", "0.54757595", "0.5473728", "0.54733586", "0.54669595", "0.54638946", "0.54541874", "0.54525256", "0.544957", "0.5449505", "0.54483336", "0.54447854", "0.544465", "0.5443686", "0.54344285", "0.5434303", "0.5434303", "0.54320735", "0.5431587", "0.54312795", "0.5427073", "0.5425791", "0.5424068", "0.5423725", "0.5422076", "0.5420963", "0.5420042", "0.54193693", "0.5418618", "0.5414799", "0.5413562", "0.5412714", "0.5411076", "0.5409978", "0.54083", "0.5408292", "0.5407578", "0.5406143", "0.5406035", "0.54044074", "0.5403619", "0.54029435", "0.540276", "0.5402694", "0.54001236", "0.5399185" ]
0.54532874
61
DELETE /freelancer_knowledges/1 DELETE /freelancer_knowledges/1.json
def destroy @freelancer_knowledge.destroy respond_to do |format| format.html { redirect_to freelancer_knowledges_url, notice: 'Freelancer knowledge was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @knowledge = current_user.knowledges.find(params[:id])\n @knowledge.destroy\n\n respond_to do |format|\n format.html { redirect_to knowledges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @carrierknowledghe.destroy\n respond_to do |format|\n format.html { redirect_to carrierknowledghes_url, notice: 'Carrierknowledghe was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @newsletter.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @gstr_advance_receipts = GstrAdvanceReceipt.find_by_id_and_company_id(params[:id], @company.id)\n @gstr_advance_receipts.delete_gstr_one_entry \n @gstr_advance_receipts.delete\n respond_to do |format|\n @gstr_advance_receipts.register_delete_action(request.remote_ip, @current_user, 'deleted')\n format.html { redirect_to(gstr_advance_receipts_url, :notice =>\"Gstr Advance Receipt has been succesfully deleted\") }\n format.xml {head :ok}\n \n end\n end", "def destroy\n @agreement_renewal.destroy\n respond_to do |format|\n format.html { redirect_to agreement_renewals_url, notice: 'Agreement renewal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_level_agreement = current_user.company.service_level_agreements.find(params[:id])\n @service_level_agreement.destroy\n\n render :json => {:success => true}\n end", "def destroy\n @envelope.destroy\n\n respond_to do |format|\n format.html { redirect_to :root }\n format.json { head :ok }\n end\n end", "def destroy\n @agreement.destroy\n respond_to do |format|\n format.html { redirect_to agreements_url, notice: 'Agreement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundamental_announcement = Fundamental::Announcement.find(params[:id])\n @fundamental_announcement.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_announcements_url }\n format.json { head :ok }\n end\n end", "def destroy\n @inquiry.destroy\n respond_to do |format|\n format.html { redirect_to inquiries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 @delivery_note = DeliveryNote.find(params[:id])\n @delivery_note.destroy\n\n respond_to do |format|\n format.html { redirect_to delivery_notes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @news_agency = NewsAgency.find(params[:id])\n @news_agency.destroy\n\n respond_to do |format|\n format.html { redirect_to news_agencies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n\n Receipt.destroy_all(invoice_id: @invoice)\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Excluido com sucesso.' }\n sweetalert_success('Dados excluidos com sucesso!', 'Sucesso!', useRejections: false)\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def destroy\n @pack_group_receipt = PackGroupReceipt.find(params[:id])\n @pack_group_receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def incident_delete(statuspage_id, incident_id)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['incident_id'] = incident_id\n\n request :method => :post,\n :url => @url + 'incident/delete',\n :payload => data\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url, notice: 'Uw factuur is verwijderd.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmacy_notices = PharmacyNotices.find(params[:id])\n @pharmacy_notices.destroy\n\n respond_to do |format|\n format.html { redirect_to(pharmacy_notices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hold_request.destroy\n respond_to do |format|\n format.html { redirect_to student_requests_path, notice: 'Hold request was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referee = Referee.find(params[:id])\n @referee.destroy\n\n respond_to do |format|\n format.html { redirect_to referees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recharge.destroy\n respond_to do |format|\n format.html { redirect_to recharges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adhoc_deliverable = Deliverable.find(params[:id])\n #delete adhoc deliverable from database\n @adhoc_deliverable.destroy\n\n respond_to do |format|\n format.html { redirect_to adhoc_deliverables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @customer_refer_email.destroy\n respond_to do |format|\n format.html { redirect_to customer_refer_emails_url, notice: 'Customer refer email 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 @ourmail.destroy\n respond_to do |format|\n format.html { redirect_to ourmails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @delivery.destroy\n respond_to do |format|\n format.html { redirect_to admin_deliveries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to @fee.booth, flash: { warning: 'Fee was deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to badges_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @appreciation.destroy\n respond_to do |format|\n format.html { redirect_to appreciations_url, notice: 'Appreciation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'El anuncio se borro correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n render json:@announcement\n\n end", "def destroy\n @referee.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Referee was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @req_breakdown = ReqBreakdown.find(params[:id])\n @req_breakdown.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_req_breakdowns_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @referral_charge = ReferralCharge.find(params[:id])\n @referral_charge.destroy\n\n respond_to do |format|\n format.html { redirect_to(referral_charges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to referrals_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @inquiry = Inquiry.find(params[:id])\n @inquiry.destroy\n\n respond_to do |format|\n format.html { redirect_to(inquiries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @expense_claim.destroy\n respond_to do |format|\n format.html { redirect_to expense_claims_url, notice: 'Expense claim was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @announce = Announce.find(params[:id])\n @announce.destroy\n #AnnounceMailer.delete_mail(@announce).deliver\n\n respond_to do |format|\n format.html { redirect_to announces_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @invoice = Invoice.find(params[:id])\n @invoice.destroy\n\n respond_to do |format|\n format.html { redirect_to invoices_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 @invoicedetail = Invoicedetail.find(params[:id])\n @invoicedetail.destroy\n\n respond_to do |format|\n format.html { redirect_to invoicedetails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @balance_enquiry.destroy\n respond_to do |format|\n format.html { redirect_to karigar_balance_enquiries_path(@karigar), notice: 'Balance enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @references_snaks2.destroy\n respond_to do |format|\n format.html { redirect_to references_snaks2s_url, notice: 'References snaks2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url, notice: 'Enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @enquiry.destroy\n respond_to do |format|\n format.html { redirect_to enquiries_url, notice: 'Enquiry was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @announce_c = AnnounceC.find(params[:id])\n @announce_c.destroy\n\n respond_to do |format|\n format.html { redirect_to announce_cs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee = Fee.find(params[:id])\n @fee.destroy\n\n respond_to do |format|\n format.html { redirect_to fees_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @add_to_invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to add_to_invoice_clients_url, notice: 'Add to invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to announcements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recall = Recall.find(params[:id])\n @recall.destroy\n\n respond_to do |format|\n format.html { redirect_to [:admin,:recalls], notice: 'Отзыв удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @announcement.destroy\n respond_to do |format|\n format.html { redirect_to :delete, flash: { message: 'Announcement was successfully deleted.' } }\n format.json { head :no_content }\n end\n end", "def destroy\n @freelance_document.destroy\n respond_to do |format|\n format.html { redirect_to freelance_documents_url, notice: 'Freelance document was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fuel_issued.destroy\n respond_to do |format|\n format.html { redirect_to fuel_issueds_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @installment_detail.destroy\n @franchisee = @installment_detail.franchisee\n @franchisee.franchisee_agreement.update(no_of_installment: InstallmentDetail.where(franchisee_id: @franchisee.id).count.to_i)\n respond_to do |format|\n format.html { redirect_to installment_detail_url(id: @installment_detail.franchisee_id), notice: 'Installment detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @claim_datum.destroy\n respond_to do |format|\n format.html { redirect_to claim_data_url, notice: 'Claim datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge.destroy\n respond_to do |format|\n format.html { redirect_to badges_url, notice: 'Badge was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @referral.destroy\n respond_to do |format|\n format.html { redirect_to referrals_url, notice: 'Referral was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @refugee.destroy\n respond_to do |format|\n format.html { redirect_to refugees_url, notice: 'Refugee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @refund_request = RefundRequest.find(params[:id])\n @refund_request.destroy\n\n respond_to do |format|\n format.html { redirect_to refund_requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @confection.destroy\n respond_to do |format|\n format.html { redirect_to confections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice: 'Invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n @tenancy_agreement.destroy\n\n respond_to do |format|\n format.html { redirect_to tenancy_agreements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n client = current_user.find_client(params[:client_id])\n @notification = client.notifications.find(params[:id])\n @notification.destroy\n\n respond_to do |format|\n format.html { redirect_to client_notifications_url(client) }\n end\n end", "def destroy\n @datum_receipt.destroy\n respond_to do |format|\n format.html { redirect_to datum_receipts_url, notice: 'Datum receipt was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @helocagree = Helocagree.find(params[:id])\n @helocagree.destroy\n\n respond_to do |format|\n format.html { redirect_to(helocagrees_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @hospital_referral.destroy\n respond_to do |format|\n format.html { redirect_to hospital_referrals_url, notice: 'Hospital referral was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n newsletter = Newsletter.find_by_id(params[:id])\n newsletter.logo.destroy\n newsletter.headline.destroy\n newsletter.body.destroy\n newsletter.social.destroy\n newsletter.destroy\n\n render json: newsletter\n end", "def destroy\n @pushup_reminder.destroy\n\n respond_to do |format|\n format.html { redirect_to pushup_reminders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reference_analytic.destroy\n respond_to do |format|\n format.html { redirect_to reference_analytics_url, notice: 'Reference analytic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to receipts_url, notice: 'Платеж успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ref_datum.destroy\n respond_to do |format|\n format.html { redirect_to ref_data_url, notice: 'Ref datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fundamental_retention_mail = Fundamental::RetentionMail.find(params[:id])\n @fundamental_retention_mail.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_retention_mails_url }\n format.json { head :ok }\n end\n end", "def destroy\n @announcement = Announcement.find(params[:id])\n @announcement.destroy\n respond_to do |format|\n format.html { render html: '200', status: :ok }\n format.json { head :no_content }\n end\n end", "def destroy\n @referralmedical.destroy\n respond_to do |format|\n format.html { redirect_to referralmedicals_url, notice: 'Referralmedical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @badge = Badge.find(params[:id])\n @badge.destroy\n\n respond_to do |format|\n format.html { redirect_to(organization_segment_badges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @claim.destroy\n respond_to do |format|\n format.html { redirect_to claims_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @campaign_pledge.destroy\n respond_to do |format|\n format.html { redirect_to campaign_pledges_url, notice: 'Campaign pledge was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @newsletter.destroy\n respond_to do |format|\n format.html { redirect_to newsletters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @referral_enrolment.destroy\n respond_to do |format|\n format.html { redirect_to referral_enrolments_url, notice: 'Referral enrolment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @discharge = Discharge.find(params[:id])\n @discharge.destroy\n\n respond_to do |format|\n format.html { redirect_to(discharges_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @incident_proof.destroy\n respond_to do |format|\n format.html { redirect_to incident_proofs_url, notice: 'Incident proof was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @fee.destroy\n respond_to do |format|\n format.html { redirect_to fees_url, notice: 'Fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice=Invoice.find(params[:id])\n @invoice.destroy\n respond_to do |format|\n format.html { redirect_to invoices_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.68897974", "0.6703361", "0.670041", "0.6646703", "0.6586873", "0.6571737", "0.6555517", "0.65274686", "0.6509075", "0.6493473", "0.6488995", "0.64743686", "0.6474076", "0.64381456", "0.64283895", "0.64078814", "0.6400561", "0.63977534", "0.63812995", "0.6376295", "0.6371698", "0.6369606", "0.63675356", "0.6364568", "0.63645315", "0.6361321", "0.63607526", "0.6360144", "0.63587344", "0.63519937", "0.6351753", "0.63507664", "0.6349007", "0.63464737", "0.6345087", "0.6343663", "0.63419867", "0.6340053", "0.63384795", "0.6335341", "0.63338673", "0.63334215", "0.63334215", "0.63331443", "0.6333083", "0.6332326", "0.63246435", "0.63245577", "0.6322221", "0.63213825", "0.63206446", "0.63200265", "0.63200265", "0.631877", "0.6315683", "0.63145745", "0.6314214", "0.63131833", "0.63131833", "0.63131833", "0.6312419", "0.6307741", "0.630598", "0.6305582", "0.63050944", "0.63047135", "0.63042027", "0.6303936", "0.62987465", "0.6296662", "0.6296621", "0.62954366", "0.62951696", "0.6288377", "0.6288366", "0.62875783", "0.6285986", "0.62843645", "0.6282458", "0.6281596", "0.628073", "0.62777215", "0.62776065", "0.62769675", "0.6274696", "0.6274005", "0.6271566", "0.62713563", "0.6271202", "0.6269408", "0.6267627", "0.62675095", "0.626371", "0.6262155", "0.626204", "0.62594825", "0.62592876", "0.6256757", "0.6256757", "0.6254432" ]
0.6756347
1
Use callbacks to share common setup or constraints between actions.
def set_freelancer_knowledge @freelancer_knowledge = FreelancerKnowledge.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 freelancer_knowledge_params params.require(:freelancer_knowledge).permit(:freelancer_login, :knowledge_name, :certificates) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def valid_params_request?; end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def 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 active_code_params\n params[:active_code].permit\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\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 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 filter_parameters; end", "def filter_parameters; end", "def list_params\n params.permit(:name)\n 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 admin_social_network_params\n params.require(:social_network).permit!\n end", "def url_whitelist; end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def permit_request_params\n params.permit(:address)\n end", "def sensitive_params=(params)\n @sensitive_params = params\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 user_params\n params.permit(:name, :age, :username, :display_photo, :password)\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 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.6293856", "0.6290323", "0.62816143", "0.6241851", "0.6241208", "0.622036", "0.62128764", "0.62110275", "0.61966056", "0.61776453", "0.617547", "0.6174961", "0.61654735", "0.6153256", "0.61516005", "0.6149498", "0.6123234", "0.6118653", "0.61077267", "0.61061186", "0.6093616", "0.608318", "0.6074428", "0.60650206", "0.60244286", "0.6020295", "0.60155797", "0.6012826", "0.6010141", "0.6010141", "0.60037106", "0.600298", "0.59979576", "0.5994806", "0.5994283", "0.5993927", "0.5980616", "0.59667075", "0.59614897", "0.59610957", "0.596071", "0.5959614", "0.59554", "0.59542966", "0.5946781", "0.5940262", "0.5940262", "0.59401053", "0.5937168", "0.5932135", "0.59293395", "0.592659", "0.59202623", "0.59112674", "0.59088206", "0.590716", "0.59056735", "0.589997", "0.5899655", "0.5898926", "0.5896042", "0.589589", "0.5895867", "0.58894163", "0.5884936", "0.5879227", "0.58740723", "0.5871364", "0.5870148", "0.5869228", "0.5868196", "0.5867967", "0.5865532", "0.58653617", "0.58644646", "0.58631665", "0.5862611", "0.5857609", "0.58558804", "0.5853729", "0.5853025" ]
0.0
-1
when the number is divisible by 3, say fizz when the number is divisible by 5 say buzz when the number is divisible by 3 and 5 say fizzbuzz =begin 1.upto(100) do |i| if i % 15 == 0 puts "fizzbuzz" elsif i % 3 == 0 puts "fizz" elsif i % 5 == 0 puts "buzz" else puts i end end =end
def fizzbuzz(number) if number % 15 == 0 "fizzbuzz" elsif number % 3 == 0 "fizz" elsif number % 5 == 0 "buzz" else number end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz\n\t 1.upto(100) do |i|\n\tif i % 5 == 0 and i % 3 == 0\n\t puts \"FizzBuzz\"\n\telsif i % 5 == 0\n\t puts \"Buzz\"\n\telsif i % 3 == 0\n\t puts \"Fizz\"\n\telse\n\t puts i\n\tend\n\tend\nend", "def fizz_buzz (i)\n 1.upto 100 do |i|\n if i % 5 == 0 && i % 3 == 0 \n puts \"FizzBuzz\"\n elsif i % 5 == 0\n puts \"Buzz\" \n elsif\n puts i % 3 == 0\n else \"Fizz\"\n puts i\n end\nend\nend", "def fizzbuzz\n\n\tfor i in (1..100) do\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0\n\t\t\tputs 'Fizz'\n\t\telse puts i\n\n\t\tend\n\tend\n\nend", "def fizzBuzz (number)\n for i in 1..number\n if (i % 15 == 0)\n puts \"fizzbuzz\"\n elsif (i % 3 ==0)\n puts \"fizz\"\n elsif (i % 5 ==0)\n puts \"buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz\n\t(1..100).each do |num|\n\t if num % 3 == 0 && num % 5 == 0\n\t\tputs \"Fizzbuzz\"\n\t elsif num % 3 == 0\n\t\tputs \"Fizz\"\n\t elsif num % 5 == 0 \n\t\tputs \"Buzz\"\n\t else\n\t\tputs num\n\t end\n\tend\nend", "def fizz_buzz()\n for i in 1..100\n if i % 3 == 0 && i % 5 == 0\n puts 'FizzBuzz'\n elsif i % 3 == 0\n puts 'Fizz'\n elsif i % 5 == 0\n puts 'Buzz'\n else\n puts i\n end\n end\nend", "def fizzbuzz(num)\n num.times do |i|\n \n if i % 15 == 0\n puts \"fizzbuzz\"\n elsif i % 3 == 0 \n puts \"fizz\"\n elsif i % 5 == 0\n puts \"buzz\"\n else\n puts \"num\"\n end\n end\nend", "def fizz_buzz\n num = 0\n 100.times do\n num +=1\n if num % 5 == 0 && num % 3 == 0\n puts 'FizzBuzz'\n elsif num % 5 == 0\n puts 'Buzz'\n elsif num % 3 == 0\n puts 'Fizz'\n else\n puts num\n end\n end\nend", "def fizz_buzz number \n#prints numbers from 1 to 200\n #Modulo\n if number % 3 == 0 && number % 5 == 0\n 'FizzBuzz'\n elsif number % 3 == 0\n 'Fizz'\n elsif number % 5 == 0\n 'Buzz'\n else\n return number\n end\n\nend", "def fizz_buzz()\n for i in 0..100\n# nested if for multiple of 3 and 5\n if i%3 ==0\n if i%5 ==0\n puts \"FizzBuzz\"\n else \n puts \"Fizz\"\n end\n elsif i%5 ==0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz()\n numbers = Array(1..100)\n numbers.each do |num|\n if num % 15 == 0\n puts \"FizzBuzz\" \n elsif num % 3 == 0\n puts \"Fizz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n else\n puts num\n end\n end\nend", "def fizz_buzz(i)\nif i % 3 == 0 && i % 5 == 0\n\t\"fizzbuzz\"\nelsif i % 3 == 0 \n\t \"fizz\"\nelsif i % 5 == 0\n \"buzz\"\nelse\n\t i \n end\nend", "def FizzBuzz\n\t\n1.upto(100) {|i| \n\tputs \"Fizz\" if i%3 == 0 && i%5 != 0\n\tputs \"Buzz\" if i%3 != 0 && i%5 == 0\n\tputs \"FizzBuzz\" if i%3 == 0 && i%5 == 0\n\tputs i if i%3 != 0 && i%5 != 0\n}\t\n\nend", "def fizzbuzz(number)\n (1..number).each do |num|\n if (num % 15).zero?\n puts 'FizzBuzz'\n elsif (num % 3).zero?\n puts 'Fizz'\n elsif (num % 5).zero?\n puts 'Buzz'\n else\n puts num\n end\n end\nend", "def fizz_buzz number \n # for i in number\n # \tif i%3 == 0 \n # \t\treturn \"fiz\"\n # \telsif i%5 == 0\n # \t\treturn \"buzz\"\n # \tend \n # end\n\n if ((number % 3 == 0) && (number % 5 == 0))\n \treturn \"FizzBuzz\"\n elsif (number % 3 == 0)\n \treturn \"Fizz\"\n elsif (number % 5 == 0)\n \treturn \"Buzz\"\n else \n \treturn number\n end\nend", "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 5 == 0 && num % 3 == 0\n puts \"FizzBuzz\"\n elsif num % 3 == 0 then puts \"Fizz\"\n elsif num % 5 == 0 then puts \"Buzz\"\n else puts num\n end\n end\nend", "def fizz_buzz\n (1..100).each do |n|\n if is_div(n, 15)\n puts \"FIZZBUZZ\"\n elsif is_div(n, 3)\n puts \"FIZZ\"\n elsif is_div(n, 5)\n puts \"BUZZ\"\n else\n puts n\n end\n end\nend", "def fizzbuzz(start, finish)\n start.upto(finish) do |num|\n if div_by_3?(num) && div_by_5?(num)\n puts \"FizzBuzz\"\n elsif div_by_5?(num)\n puts \"Buzz\"\n elsif div_by_3?(num)\n puts \"Fizz\"\n else\n puts num\n end\n end\nend", "def fizzbuzz(start_number, end_number)\n (start_number..end_number).each do |number|\n if number % 15 == 0 \n puts \"FizzBuzz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n else\n puts number\n end \n end\nend", "def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend", "def fizzbuzz(number)\n\t\n\tif number % 3 == 0 && number % 5 == 0\n\t\tputs \"FizzBuzz\"\n\n\telsif number % 3 == 0\n\t\tputs \"Fizz\"\n\t\n\telsif number % 5 == 0\n\t\tputs \"Buzz\"\n\n\telse \n\t\tputs number\n\tend\n\nend", "def fizzbuzz(int)\n if int % 15 == 0\n return \"FizzBuzz\"\nend\n if int % 3 == 0 # if the number int is divisible by 3\n return \"Fizz\" # Go fizz\nend\n if int % 5 == 0\n return \"Buzz\"\n end\nend", "def fizzbuzz(number)\n\n if number % 3 == 0 && number % 5 == 0\n puts \"Fizzbuzz\"\n\n elsif number % 3 == 0 \n puts \"Fizz\"\n \n elsif number % 5 == 0\n puts \"Buzz\"\n \n end\n\nend", "def multiples\n \tfor n in 1..100\n \t\tif n%3==0 && n%5==0\n \t\t\tputs \"FizzBuzz\"\n \t elsif n%3==0\n \t \tputs \"Buzz\"\n \t else\n \t \tputs n\n \t end\n \tend\nend", "def fizzbuzz(int)\n if int % 3 == 0 && int % 5 == 0 \n \"FizzBuzz\"\n \n elsif int % 5 == 0 # if the number int is divisible by 5\n \"Buzz\"\n \n # if number is divisible by 3 and 5 print \"FizzBuzz\"\n \n elsif int % 3 == 0 # if the number int is divisible by 3\n \"Fizz\"\n \n end\n end", "def fizzbuzz\n\ty = (1..100)\n\ty.each { |x|\n\t\tif x % 3 == 0 && x % 5 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif x % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telsif x % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telse\n\t\t\tputs x\n\t\tend\n\t}\nend", "def fizz(number)\t\t\t\t# creates fizz function had number argument\n\tfor\ti in 1..number\t\t\t# for loop i is the current value runs from 1 to 100 the agrument\n if i % 5 == 0 and i % 3 == 0 # if the current number is both divisible by 3\n puts \"FizzBuzz\"\t\t\t# prints FizzBuzz\n elsif i % 5 == 0\t\t\t# else if the current number is divisible by 5\n puts \"Buzz\"\t\t\t\t# prints Buzz\n elsif i % 3 == 0\t\t\t# esle if the current number is divisible by 3\n puts \"Fizz\"\t\t\t\t# prints Fizz\n else\t\t\t\t\t\t# else if none of the above conditions exist\n puts i\t\t\t\t\t# print the current number\n end\t\t\t\t\t\t# ends if\n end\t\t\t\t\t\t# ends \n end", "def fizzbuzz(n)\n 1.upto(n) do |i|\n if i % 15 == 0\n puts \"FizzBuzz\"\n elsif i % 5 == 0\n puts \"Fizz\"\n elsif i % 3 == 0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz(a,b)\n numbers = (a..b).to_a\n\n numbers.each do |number|\n if number % 15 == 0\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "def fizzbuzz(integer)\n if integer %3 ==0 && integer %5==0\n return \"FizzBuzz\"\nelsif integer % 3 == 0\n return \"Fizz\"\n elsif integer % 5 ==0 \n return \"Buzz\"\n \n end\n end", "def fizzbuzz(num)\n i = 0;\n num.times do\n i += 1\n # Check to see if num is a multiple of 3 but not 5\n if (i % 3 == 0 && i % 5 != 0)\n p \"Fizz\"\n # Check to see if num is a multiple of 5 but not 3\n elsif (i % 5 == 0 && i % 3 != 0)\n p \"Buzz\"\n # Check to see if num is a multiple of 3 and 5\n elsif (i % 5 == 0 && i % 3 == 0)\n p \"FizzBuzz\"\n else\n p i\n end\n end\nend", "def fizzBuzz\n array = [*1..100]\n array.each { |num|\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"FizBuzz\"\n elsif num % 5 == 0\n puts \"Buzz\"\n elsif num % 3 == 0\n puts \"Fizz\"\n else \n puts num\n end\n }\nend", "def fizzbuzz\n# Set counter to 0\n count = 0\n# Count from 0-100, increments of one\n 100.times do\n count = count + 1\n# If the count is modulo 15 return Fizzbuzz\n if count % 15 == 0\n puts \"#{count} fizzbuzz\"\n puts count.to_s + \" fizzbuzz\"\n# if the count is moudulo 3 return Fizz\n elsif count % 3 == 0\n puts \"#{count} fizz\"\n#if the count is modulo 5 return buzz\n elsif count % 5 == 0\n puts \"#{count} buzz\"\n#All other numbers show a 0\n else\n puts count\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #loop with .each do instead of for loop\n (1..range).each do |i|\n #Use modulo operator to get the remainder of the division i on num-1\n #if i modulo num_1 triple equals 0 AND i modulo num_2 triple equals 0\n if i % num_1 === 0 && i % num_2 === 0\n #print \"fizzbuzz\"\n puts 'fizzbuzz'\n #else if i modulo num_1 triple equals 0\n elsif i % num_1 === 0\n #print \"fizz\"\n puts 'fizz'\n #else if i modulo num_2 triple equals 0\n elsif i % num_2 === 0\n #print \"buzz\"\n puts 'buzz'\n #otherwise\n else\n #print i\n puts i\n #end\n end\n #end\n end\n #end\nend", "def fizz_buzz(n)\n i = 1\n until i>n\n if i%15==0 \n puts \"fizzbuzz\"\n elsif \n i%5==0\n puts \"buzz\"\n elsif \n i%3==0\n puts \"fizz\"\n else \n puts i\n end\n i +=1\n end\nend", "def fizzbuzz (int)\n if int%3==0 && int%5==0 # if the number int is divisible by 3\n \"FizzBuzz\"\n elsif int%3==0\n \"Fizz\"\n elsif int%5==0\n \"Buzz\"\n else\n end\nend", "def fizzbuzz(num)\n collection = (1..num).to_a\n collection.each do |num|\n if (num % 3 == 0) && (num % 5 != 0)\n puts \"Fizz #{num}\"\n elsif (num % 5 == 0) && (num % 3 != 0)\n puts \"Buzz #{num}\"\n elsif (num % 3 == 0) && (num % 5 == 0)\n puts \"FizzBuzz #{num}\"\n end\n end\nend", "def fizzbuzz(num1,num2)\n for i in num1..num2 do\n if i%15 == 0\n puts \"FizzBuzz\"\n elsif i%3 == 0\n puts \"Fizz\"\n elsif i%5 == 0\n puts \"Buzz\"\n else\n puts i\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # create loop and declare variable \"i\" assigned to integar 1, and repeat loop\n # for \"i\" on every subsequent integar until the 3rd argument \"range\" is reached\n (1..range).each do |i|\n # create if statement for if the modulus of variable i and argument num_1 is\n # equal to 0 and the modulus of variable i and num_2 is equal to zero,\n # print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # create else if statement for if the modulus of variable i and argument\n # num_1 is equal to 0, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # create else if statement for if the modulus of variable i and argument\n # num_2 is equal to 0, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n # create else statement for all other conditions, and print \"i\"\n else\n puts i\n # end if statement\n end\n # end loop\n end\n# end method\nend", "def fizz_buzz \n\ti=1\n\t while i < 100 do\n\t \tif i%3 == 0 && i%5 == 0\n\t \t\tprint \"FizzBuzz\\n\"\n\t \telsif i%3 == 0\n\t \tprint \"fizz\\n\"\n\t \telsif i%5 == 0\n\t \t\tprint \"Buzz\\n\"\n\t \telse\n\t \tprint \"#{i}\\n\"\n\t \tend\n\t\ti += 1\n\t end\nend", "def super_fizz(number)\n(0..1000).each do |number|\ndivisible_by_3 = number % 3\ndivisible_by_5 = number % 5\ndivisible_by_7 = number % 7\nif divisible_by_3 == 0\n if divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperFizzBuzz\"\n else\n puts \"FizzBuzz\"\n end\n elsif divisible_by_7 == 0\n puts \"SuperFizz\"\n else\n puts \"Fizz\"\n end\nelsif divisible_by_5 == 0\n if divisible_by_7 == 0\n puts \"SuperBuzz\"\n else\n puts \"Buzz\"\n end\nelsif divisible_by_7 == 0\n puts \"Super\"\nelse\n puts number\nend\nend\nend", "def fizzbuzz(num_1, num_2, range)\n# looping through the code block using iteration.\n (1..range).each do |i|\n# If left hand operand i devided by right hand operand num_1 is equal to 0 and left hand operand i devided by right hand operand num_2 is equal to 0 then print fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If not the first if check left hand operand i devided by right hand operand num_1 is equal to 0 if so print fizz.\n elsif i % num_1 === 0\n puts 'fizz'\n# If not the first if or first elsif check left hand operand i devided by right hand operand num_2 is equal to 0 if so print buzz. \n elsif i % num_2 === 0\n puts 'buzz'\n# If non of the above print i\n else\n puts i\n# End block of code\n end\n end\nend", "def fizzbang(limit)\r\n\t1.upto(limit) do |number|\r\n\t\tif number % 3 == 0 and number % 5 == 0\r\n\t\t\tputs \"fizzbang\"\r\n\t\telsif number % 3 == 0\r\n\t\t\tputs \"fizz\"\r\n\t\telsif number % 5 == 0\r\n\t\t\tputs \"bang\"\r\n\t\telse\r\n\t\t\tputs number\r\n\t\tend\r\n\tend\r\nend", "def fizzbuzz(num_1, num_2, range)\n#iterate throughout the number set\n (1..range).each do |i|\n #boolean, === is exact equals, % is the remainder from division (modulo), && is AND both conditions are met\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_1 === 0\n puts 'fizz'\n #otherwise, if this exact number is met, put this phrase\n elsif i % num_2 === 0\n puts 'buzz'\n #if all else fails, put i\n else\n puts i\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # starts a counter from 1 to range value\n # for each in that range, print the specified output on\n # these next conditions:\n (1..range).each do |i|\n\n # if the next number in the counter is divisible\n # by both num1 and num2 (with 0 remainder)\n if i % num_1 === 0 && i % num_2 === 0\n # print this specified output\n puts 'fizzbuzz'\n\n # if the next number in the counter is divisible by num1 (with 0 remainder)\n elsif i % num_1 === 0\n # print this specified output\n puts 'fizz'\n\n # if the next number in the counter is divisible by num2 (with 0 remainder)\n elsif i % num_2 === 0\n # print this specified output\n puts 'buzz'\n # if none of these conditions are met,\n else\n # print the next number in the range counter.\n puts i\n # end of conditionals\n end\n # end of each.do loop\n end\n # end of method\nend", "def fizzbuzz(number)\n i = 1\n until i > number\n if i % 15 == 0\n puts \"Fizzbuzz for #{i}\"\n elsif i % 3 == 0\n puts \"Fizz for #{i}\"\n elsif i % 5 == 0\n puts \"Bizz for #{i}\"\n end\n i+=1\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #set range of numbers for fizzbuzz\n (1..range).each do |i|\n #set initial condition\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n #set alternate condition\n elsif i % num_1 === 0\n puts 'fizz'\n #set alternate condition\n elsif i % num_2 === 0\n puts 'buzz'\n #set else condition\n else\n puts i\n #close if-statement\n end\n #close .each method\n end\n#close fizzbuzz\nend", "def fizzbuzz\n\t1.upto(100) do |i|\n\t\tprint \"Fizz \" if a = (i % 3).zero?\n\t\tprint \"Buzz \" if b = (i % 5).zero?\n\t\tprint \"FizzBuzz \" if c = (i % 15).zero?\n\t\tprint i.to_s + \" \" unless (a || b || c)\n\tend\nend", "def FizzBuzz()\n x=0\n while x < 100\n x += 1\n if x % 3 == 0 && x % 5 !=0\n puts \"Fizz\"\n elsif x % 5 == 0 && x% 3 !=0\n puts \"Buzz\"\n elsif x % 15 == 0\n puts \"FizzBuzz\"\n else puts x\n end\n end\nend", "def fizzbuzz (i)\n if i % 3 == 0 && i % 5 == 0\n return \"FizzBuzz\"\nend\n if i % 3 == 0 \n return \"Fizz\"\nend\n if i % 5 == 0 \n return \"Buzz\"\nend \nend", "def fizzbuzz (int)\n\n if int % 3 == 0 && int % 5 == 0\n \"FizzBuzz\"\n \n#returns \"FizzBuzz\" when the number is divisible by 3 and 5\n\n elsif int % 3 == 0\n \"Fizz\"\n \n#returns \"Fizz\" when the number is divisible by 3\n \n elsif int % 5 == 0\n \"Buzz\" \n \n#returns \"Buzz\" when the number is divisible by 5\n\n end\nend", "def fizzbuzz(num_1, num_2, range)\n#Repeats the following code for the duration of the range argument.\n (1..range).each do |i|\n#If i is divisible by both num_1 and num_2, it displays string fizzbuzz\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If i is divisible by num_1, it displays string fizz\n elsif i % num_1 === 0\n puts 'fizz'\n#If i is divisible by num_2, it displays string buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#If i isn't divisible by either num_1 or num_2, it displays integer i\n else\n puts i\n#Ends the if, elsif, elsif, else check\n end\n#ends our loop\n end\n#ends our method\nend", "def fizzbuzz(start_num, end_num)\n start_num.upto(end_num) do |num|\n if num % 15 == 0\n print \"FizzBuzz \"\n elsif num % 5 == 0\n print \"Buzz \"\n elsif num % 3 == 0\n print \"Fizz \"\n else\n print \"#{num.to_i} \"\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #This is a for loop that loops from 1 to the given range argument.\n (1..range).each do |i|\n #This is an if statement which sees if both the remainder of i / num_1 is equal to 0 and if the remainder of 1 / num_2 is equal to 0\n if i % num_1 === 0 && i % num_2 === 0\n #If the above if statement is true then it will print 'fizzbuzz'\n puts 'fizzbuzz'\n #This is a continuation of the if statement where if only the remainder of i / num_1 is equal to 0 it will run\n elsif i % num_1 === 0\n #If the above if elsif statement is true then it will print 'fizz'\n puts 'fizz'\n #This is another continuation of the if statement in which if only the remainder of i / num_2 is equal to 0 it will run\n elsif i % num_2 === 0\n #If the above elsif statement is true it will print 'buzz'\n puts 'buzz'\n #If none of the above statements are true this will run\n else\n #If the else is fulfilled this will print i\n puts i\n end\n end\nend", "def fizzbuzz (int)\n if int % 15 == 0 \n \"FizzBuzz\"\n\n elsif int % 5 == 0 \n \"Buzz\"\n \n \nelsif int % 3 == 0\n \"Fizz\"\n else \n \n end \n end", "def fizzbuzz(num_1, num_2, range)\n# Do i for all the numbers in a range from 1 to the value that will be assigned to the variable \"range\".\n (1..range).each do |i|\n# If i divided by the value assigned to num_1 is equal to 0 and i divided by the value assigned to num_2 is equal to zero then print \"fizzbuzz\".\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# If i divided by the value assigned to num_1 is equal to zero print \"fizz\".\n elsif i % num_1 === 0\n puts 'fizz'\n# If i divided by the value assigned to num_2 is equal to zero print \"buzz\".\n elsif i % num_2 === 0\n puts 'buzz'\n# If none of the previous conditions are true print i.\n else\n puts i\n# Ends the if/else statement.\n end\n# Ends the argument.\n end\n# Ends the method.\nend", "def fizz_buzz num\n puts \"FizzBuzz\" if num % 15 == 0\n puts \"Fizz\" if num % 3 == 0\n puts \"Buzz\" if num % 5 == 0\n puts num\nend", "def fizz_buzz\n x=1\n until x > 100 do\n if x%3 == 0 && x%5 !=0\n puts \"Fizz\"\n elsif x%5==0 && x%3 !=0\n puts \"Buzz\"\n elsif x%3 ==0 && x%5==0\n puts \"FizzBuzz\"\n else\n puts x\n end\n x+=1\n end\nend", "def fizz_buzz(n)\n i = 1\n while i <= n\n if i % 15 == 0 \n puts \"fizz buzz\" \n elsif i % 5 == 0 \n puts \"buzz\"\n elsif i % 3 == 0 \n puts \"fizz\"\n else\n puts i\n end\n i+=1\n end\nend", "def fizzbuzz(number)\n if number % 3 === 0 and number % 5 === 0\n return \"fizzbuzz\"\n elsif number % 3 === 0\n return \"fizz\"\n elsif number % 5 === 0\n return \"buzz\"\n else\n return number\n end\nend", "def reprint(number)\n\t(1..100).each do |i|\n\t\tif i % 3 == 0 and i % 5 == 0\n\t\t\tputs 'FizzBuzz'\n\t\telsif i % 5 == 0\n\t\t\tputs 'Buzz'\n\t\telsif i % 3 == 0 \n\t\t\tputs 'Fizz'\t\t\n\t\telse\n\t\t\tputs i\t\t\n\t\tend\n\tend\nend", "def fizzbuzz(num_1, num_2, range)\n # sets 1 to range (last number) where each number will do the following\n (1..range).each do |i|\n # if the remainder of each number i divided by the first number num_1 should have a zero AND\n # the remainder of each number i divided by the second number num_2 should have a zero\n if i % num_1 === 0 && i % num_2 === 0\n # then print 'fizzbuzz'\n puts 'fizzbuzz'\n # otherwise, if the remainder of number i divdied by num_1 should have a zero\n elsif i % num_1 === 0\n # then print 'fizz'\n puts 'fizz'\n # otherwise, if the remainder of number i divided by num_2 should have a zero\n elsif i % num_2 === 0\n # then print 'buzz'\n puts 'buzz'\n else\n # if all the conditions above are not met, then print the number i\n puts i\n end\n end\nend", "def fizzbuzz(num1,num2)\n num1.upto(num2).each do |n|\n case\n when n % 3 == 0\n 'fizz'\n when n % 5 == 0\n 'buzz'\n when n % 3 == 0 && n % 5 == 0\n 'fizzbuzz'\n else\n p n\n end\n end\nend", "def fizzbuzz(number)\nif (number%3==0) && (number%5==0)\n \"FizzBuzz\"\nelsif (number%3)==0\n \"Fizz\"\nelsif (number%5)==0\n \"Buzz\"\nelse\n nil\nend\nend", "def fizzbuzz(num)\n if num % 3 == 0\n return \"fizz\"\n elsif num % 5 == 0\n return \"buzz\"\n elsif num % 3 ==0 && num % 5 == 0\n return \"fizzbuzz\"\n else\n end\nend", "def fizzbuzz(int)\n if int % 3 == 0 && int % 5 == 0# if the number int is divisible by 3\n \"FizzBuzz\" # Go fizz\nelsif int % 5 == 0\n \"Buzz\"\nelsif int % 3 == 0\n \"Fizz\"\nelse int = nil\n end\nend", "def fizzbuzz(num_1, num_2, range)\n #calls alll numbers in range to each do variable |i|\n (1..range).each do |i|\n # begins if else statement if i can be divided by num_1 and if i divided by num_2\n if i % num_1 === 0 && i % num_2 === 0\n # 'fizzbuzz' is printed to terminal\n puts 'fizzbuzz'\n #if the above is not true i will be checked if divisble by num_1\n elsif i % num_1 === 0\n # if true 'fizz' will be printed to the terminal\n puts 'fizz'\n # checks if i can be divided by num_2\n elsif i % num_2 === 0\n # if true 'buzz' is printed to the terminal\n puts 'buzz'\n #if none of the above is true\n else\n # the variable i is printed to the terminal\n puts i\n #ends if else statement\n end\n #ends range.each do\n end\n #ends method\nend", "def fizzbuzz(num_1, num_2, range)\n#create a loop that iterates from 1 up to the value of the argument range\n# variable i gets assigned another value after each loop\n (1..range).each do |i|\n# in each iteration, if i is divided by num_1 and has 0 remainder (modulo)\n# AND if i is divided by num_2 and has 0 remainders, 'fizzbuzz' will print out\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n# if condition is not met from above, then if only i divided by num_1 has 0\n#remainder, then only print out 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n# Or if only i divided by num_2 has 0 remainder, then only print out 'buzz'\n elsif i % num_2 === 0\n puts 'buzz'\n# if the three conditions above are not true then just print out value of i\n else\n puts i\n end\n #iterate the loop to the next value in the range\n end\n # when all values within the range are finished, end the loop\nend", "def fizzbuzz(number)\n if number % 5 == 0 && number % 3 == 0\n return \"FizzBuzz\"\n end\n if number % 3 == 0\n return \"Fizz\"\n end\n if number % 5 == 0\n return \"Buzz\"\n end\nend", "def fizzbuzz(num_1, num_2, range)\n#from integer 1 to argument range above, execute the code below for each element. variable i stands for the element in the range the program is currently using at the time.\n (1..range).each do |i|\n#conditional, if variable i modulo argument num_1 is equal to 0 AND variable i modulo argument num_2 is also equal to 0, print string \"fizzbuzz\"\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the above conditional is not true, check if variable i modulo argument num_1 is equal to 0 by itself. if true, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n#if neither of the above conditionals are true, check if variable i modulo argument num_2 is equal to 0 by itself. if true, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditionals are found to be true, print the value of variable i (the number in the range the program was checking)\n else\n puts i\n end\n end\nend", "def fizzbuzz(number)\n if (number % 5 == 0 && number % 3 == 0)\n 'fizzbuzz'\n elsif number % 5 == 0\n 'buzz'\n elsif number % 3 == 0\n 'fizz'\n else \n number\n end\nend", "def determine_fizz_buzz (num)\n if num % 3 == 0 and num % 5 == 0 and num != 0\n puts \"#{num} is FIZZ BUZZ\"\n elsif num % 5 == 0 and num != 0\n puts \"#{num} is BUZZ\"\n elsif num % 3 == 0 and num != 0\n puts \"#{num} is FIZZ\"\n else\n puts \"#{num} is boring...\"\n end\nend", "def fizzbuzz(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # for each of \"range\", do the below - i iterates from 1 to range\n (1..range).each do |i|\n # if statement - calculates whether remainder = 0 when i is divided by both num_1 and num_2 \n # this is equivalent to figuring out if num_1 and num_2 both divide evenly in. \n if i % num_1 === 0 && i % num_2 === 0\n # print \"fizzbuzz \" to screen if true \n puts 'fizzbuzz'\n # if quotient is zero for num_1 but not num_2 - print fizz \n elsif i % num_1 === 0\n # print fizz \n puts 'fizz'\n #if quotient = 0 for num_2 but not num_1 - print buzz \n elsif i % num_2 === 0\n # print buzz \n puts 'buzz'\n # if none of these are true - print i \n else\n # print i \n puts i\n \n end\n \n>>>>>>> 7f31df2026bbc770e1d39fa796fd7a1c7b96e2e3\n end\n\nend", "def fizzbuzz(starting, ending)\n (starting..ending).each do |num|\n if (num % 15).zero?\n p \"FizzBuzz\"\n elsif (num % 3).zero?\n p \"Fizz\"\n elsif (num % 5).zero?\n p \"Buzz\"\n else\n p num\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n# Take every integer between 1 and the range argument and do the following:\n (1..range).each do |i|\n # If the integer's modulous with num_1 argument equals zero and the integer's modulous with the num_2 argument equals zero\n if i % num_1 === 0 && i % num_2 === 0\n # print fizzbuzz\n puts 'fizzbuzz'\n # Otherwise if the integer's modulous with num_1 argument equals zero\n elsif i % num_1 === 0\n # print fizz\n puts 'fizz'\n # Otherwise if the integer's modulous with num_2 argument equals zero\n elsif i % num_2 === 0\n # print buzz\n puts 'buzz'\n # None of the above?\n else\n # Then just print the integer\n puts i\n # close if statement\n end\n # close .each method\n end\n# close fizz buzz method\nend", "def fizzbuzz\n\ti = 1\n\twhile i < 101\n\t\tif i % 15 == 0\n\t\t\tputs \"fizzbuzz\"\n\t\telsif i % 5 == 0\n\t\t\tputs \"buzz\"\n\t\telsif i % 3 == 0\n\t\t\tputs \"fizz\"\n\t\telse\n\t\t\tputs \"#{i}\"\n\t\tend\n\t\ti = i + 1\n\tend\nend", "def fizzbuzz(fiz_3)\n if fiz_3 % 3 == 0 && fiz_3 % 5 == 0 \n return \"FizzBuzz\"\n end \n \n if fiz_3 % 3 == 0 \n return \"Fizz\"\n end\n \n if fiz_3 % 5 == 0 \n return \"Buzz\"\n end\nend", "def fizzbuzz_group(number)\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n elsif number % 3 == 0\n \"Fizz\"\n elsif number % 5 == 0\n \"Buzz\"\n end\nend", "def fizzbuzz(num)\n i = 1\n while i < num\n \n if i % 3 == 0 && i % 5 == 0\n p \"Fizzbuzz! nums is #{i}\"\n elsif i % 3 == 0\n p \"Fizz! num is #{i}\"\n elsif i % 5 == 0\n p \"Buzz! num is #{i}\"\n end\n i+= 1\n end\n\nend", "def fizzbuzz(int1, int2)\n int1.upto(int2) do | number |\n if (number % 5 == 0) && (number % 3 == 0)\n puts \"FizzBuzz\"\n elsif number % 3 == 0\n puts \"Fizz\"\n elsif number % 5 == 0\n puts \"Buzz\"\n else\n puts number\n end\n end\nend", "def fizzbuzz(num)\n if num%3 == 0\n print \"Fizz\"\n elsif num%5 == 0\n print \"Buzz\"\n else\n puts num\nend", "def fizzbuzz(num_1, num_2, range)\n # create a for-loop that begins at 1 and runs until the range value is met\n (1..range).each do |i|\n # if the next value in the range is divided by num_1 and is mod 0 (no remainder)\n # and if the next value in the range is divided by num_2 and is mod 0\n if i % num_1 === 0 && i % num_2 === 0\n # display string\n puts 'fizzbuzz'\n # if the next value in the range is divided by num_1 and is mod 0\n elsif i % num_1 === 0\n # display string\n puts 'fizz'\n # if the next value in the range is divided by num_2 and is mod 0\n elsif i % num_2 === 0\n # display string\n puts 'buzz'\n else\n # if none of the previous statements are met, display the next value in the range\n puts i\n # end the if/else statement\n end\n # end the for-loop\n end\n# end the method\nend", "def fizzbuzz(num_1, num_2, range)\n # starts a loop which runs through all integers between 1 and whatever 'range' argument is equal to. i is the variable where each integer is stored during the loop.\n (1..range).each do |i|\n # starts if/else statement by detecting whether integer i is evenly divisible by both num_1 and num_2.\n if i % num_1 === 0 && i % num_2 === 0\n #If so, it prints 'fizzbuzz.'\n puts 'fizzbuzz'\n # detects if integer i is evenly divisible by num_1 (and only num_1, since line 45 would have caught it if it were divisible by both)\n elsif i % num_1 === 0\n # If so, it prints 'fizz'\n puts 'fizz'\n # detects if integer i is evenly divisible by num_2 (and only num_2)\n elsif i % num_2 === 0\n # If so, it prints 'buzz'\n puts 'buzz'\n # If integer i is evenly divisible by neither num_1 nor num_2, the function just prints integer i\n else\n puts i\n end\n end\nend", "def fizzbuzz(num)\n\tif num % 15 == 0\n\t\"FizzBuzz\"\n\telsif num % 3 == 0\n\t\"Fizz\"\n\telsif num % 5 == 0\n\t\"Buzz\"\n\t\n\telse num % 15 != 0\n\tputs\n\nend\nend", "def fizzbuzz(num_1, num_2, range)\n#this loops from the specified argument rage using the i variable.\n (1..range).each do |i|\n#if the value of i mod num_1 is equal to zero AND the value of i mod num_2 equals zero put 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#if the condition above was not met BUT i mod num_1 equals zero print 'fizz'\n elsif i % num_1 === 0\n puts 'fizz'\n#if the above conditions are not met but i mod num_2 equals zero print buzz\n elsif i % num_2 === 0\n puts 'buzz'\n#if none of the above conditions are met AT ALL then send the value for the i variable\n else\n puts i\n end\n end\nend", "def fizz_buzz num \n counter = 1\n until counter > num \n if (counter % 3) == 0 && (counter % 5) == 0 \n puts \"FizzBuzz #{counter}\"\n elsif (counter % 3) == 0 \n puts \"Fizz #{counter}\"\n elsif (counter % 5) == 0\n puts \"Buzz #{counter}\"\n end\n counter += 1\n end\nend", "def fizzbuzz(number)\n if number.modulo(3)==0 && number.modulo(5)==00\n \"FizzBuzz\"\n elsif number.modulo(5)==0\n \"Buzz\"\n elsif number.modulo(3)==0\n \"Fizz\"\n else nil\n end\nend", "def print_it(given_num)\n\n # create initialize a stop variable\n num = 0\n\n # continously loop until num is equal to given_num\n until num == given_num\n\n # if num is a multiple of both 3 and 5 print statement\n if ((num % 3) == 0) && ((num % 5) == 0)\n puts \"#{num} - FizzBuzz\"\n\n # if num is only a multiple of 3 print statement\n elsif (num % 3) == 0\n puts \"#{num} - Fizz\"\n\n # if num is only a multiple of 5 print statement\n elsif (num % 5) == 0\n puts \"#{num} - Buzz\"\n\n # if num is not a mutiple of either 3 or 5 print only the num\n else\n puts num\n end\n\n # increment num for next iteration\n num += 1\n end\n\nend", "def multiples(num)\n# \"each\" loop for each integer\n (1..num).each do |num|\n # numbers that are mulitples of 3 and 5\n if num % 3 == 0 && num % 5 == 0\n puts \"FizzBuzz\"\n # multiples of 5\n elsif num % 5 == 0\n puts \"Buzz\"\n # multiples of 3\n elsif num % 3 == 0\n puts \"Fizz\"\n # if not divisible by 5 or 3, just print number\n else\n puts num\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n#Loop through the method using the integers 1 through the range value presented in the argument.\n (1..range).each do |i|\n#If both the modulo if integer and num_1 and integer and num_2 are equal to 0, the string fizzbuzz is returned.\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n#If only the modolo of integer and num_1 is equal to 0, the string fizz is returned.\n elsif i % num_1 === 0\n puts 'fizz'\n#If only the modulo of i and num_2 is equal to 0, the string buzz is returned.\n elsif i % num_2 === 0\n puts 'buzz'\n#If nothing equals 0, put the integer\n else\n puts i\n end\n end\nend", "def fizzbuzz(n)\n if n % (3 and 5) == 0 \n \"FizzBuzz\"\n elsif n % 3 == 0\n \"Fizz\"\n elsif n % 5 == 0\n \"Buzz\"\n else\n n\n end\nend", "def fizzbuzz(num_1, num_2, range) # Create class method called 'fizzbuzz'\n (1..range).each do |i| # Iterate process for each item in a range\n if i % num_1 === 0 && i % num_2 === 0 # If statement - Modulus: Divides left hand operand by right hand operand and returns remainder. === tests equality\n puts 'fizzbuzz' # Prints fizzbuzz\n elsif i % num_1 === 0 # Elsif statement - Modulus of integer and num_1\n puts 'fizz' # Prints fizzbuzz\n elsif i % num_2 === 0 # Elsif statement - Modulus of integer and num_2\n puts 'buzz' # Prints buzz\n else # For anthing else\n puts i # Print the integer\n end\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # this line defines a for-loop that runs from 1 to the range parameter passed in\n # this will iterate on each number from 1 to the range parameter inclusive\n (1..range).each do |i|\n # this line defines an if statement with 3 conditional statements\n # 1) the remainder of the iterator number (i) / num_1 parameter is 0 (meaning even division)\n # 2) the remainder of the iterator number (i) / num_2 parameter is 0 (meaning even division)\n # 3) that both of the above conditionals are true, meaning i is evenly divided by both nums\n if i % num_1 === 0 && i % num_2 === 0\n # if the above conditionals are true this prints a string\n puts 'fizzbuzz'\n # this line will run if the previous if returns false. this defines a second\n # conditional that returns true if the remainder of i / num_1 parameter\n # is 0 (meaning even division)\n elsif i % num_1 === 0\n # if the above conditional is true this line prints a string\n puts 'fizz'\n # this line will run if the previous elsif returns false. this defines a third\n # conditional that returns true if the remainder of i / num_2 parameter\n # is 0 (meaning even division)\n elsif i % num_2 === 0\n # if the above conditional is true this line prints a string\n puts 'buzz'\n # if none of the above the above conditionals return true run line below\n else\n # this line prints the iterator number i\n puts i\n # this line ends the if-elsif-else block\n end\n # this line ends the for-loop\n end\n# this line ends the fizzbuzz method\nend", "def fizzbuzz(num_1, num_2, range)\n #starts an iteraterion over the integers 1-value of range, defined as i\n (1..range).each do |i|\n # 41&42, if the remainder of i devided by parameter num_1 is equavalent to zero, AND the remainder of i divided by num_2 is zero, print 'fizzbuzz'\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # if the remainder of i divided by num_1 is equavalent to zero, print string \"fizz\"\n elsif i % num_1 === 0\n puts 'fizz'\n # if the remainder of i divided by num_2 is zero, print string \"buzz\"\n elsif i % num_2 === 0\n puts 'buzz'\n #if no other conditional has been satisfied, print i\n else\n puts i\n #closes the conditional.\n end\n #closes the iteraterion\n end\n#closes the method\nend", "def fizzbuzz(number)\n if number.modulo(3).zero? and number.modulo(5).zero?\n \"FizzBuzz\"\n elsif number.modulo(5).zero?\n \"Buzz\"\n elsif number.modulo(3).zero?\n \"Fizz\"\n else\n phrase = nil\n end\nend", "def fizzbuzz(num)\n if num % 3 == 0 && num % 5 == 0 # return 'FizzBuzz' when number is divisible by 3 and 5\n return \"FizzBuzz\"\n elsif num % 5 == 0 # return 'Buzz' when number is divisible by 5\n return \"Buzz\"\n elsif num % 3 == 0 # return 'Fizz' when number is divisible by 3\n return \"Fizz\"\n else # return nil when number is not divisible by 3 or 5\n return nil\n end\nend", "def fizzbuzz(number)\n\n if number % 5 == 0 && number % 3 == 0\n \t\"FizzBuzz\"\n elsif number % 5 == 0\n \t\"Buzz\"\n elsif number % 3 == 0\n \t\"Fizz\"\n else\n \tnumber\n end\nend", "def fizz_buzz number\n if number % 15 == 0\n \"FizzBuzz\"\n elsif number % 5 == 0\n \"Buzz\"\n elsif number%3 == 0\n \"Fizz\"\n else\n number\n end\nend", "def fizzbuzz(num_1, num_2, range)\n # Declare a function that does the following for each argument (i) beginning at 1 and ending at\n # the range:\n (1..range).each do |i|\n # If the value of i divided by num_1 is an integer AND the value of i divided\n # by num_2 is also an integer, print the value 'fizzbizz' on the next line\n if i % num_1 === 0 && i % num_2 === 0\n puts 'fizzbuzz'\n # If the value of i divided by num_1 is an integer, print 'fizz' on the next line\n elsif i % num_1 === 0\n puts 'fizz'\n # If the value of i divided by num_2 is an integer, print 'buzz' on the next line\n elsif i % num_2 === 0\n puts 'buzz'\n # If none of the above conditions are met, print the value of i on the next line.\n else\n puts i\n end\n end\nend", "def fizzbuzz(num)\n test_3 = num % 3\n test_5 = num % 5\n \n if test_3 == 0 && test_5 == 0\n \"FizzBuzz\"\n elsif test_3 == 0 && test_5 != 0\n \"Fizz\"\n elsif test_3 != 0 && test_5 == 0\n \"Buzz\"\n end\nend" ]
[ "0.86731976", "0.85912037", "0.85182214", "0.84840256", "0.84069455", "0.83743644", "0.83327276", "0.8292735", "0.8272101", "0.8271448", "0.826314", "0.82613516", "0.8231601", "0.82226473", "0.82136106", "0.8203045", "0.81914985", "0.8188712", "0.8169217", "0.8150899", "0.81386596", "0.81365407", "0.8132123", "0.81211615", "0.81189615", "0.8118424", "0.81126857", "0.8112555", "0.81037503", "0.8095487", "0.8094633", "0.80920446", "0.808473", "0.8084193", "0.8076293", "0.80762607", "0.80563533", "0.8055558", "0.8045916", "0.8041243", "0.804006", "0.80396014", "0.80335426", "0.803297", "0.80288726", "0.80277914", "0.80203867", "0.80078727", "0.80042416", "0.8001975", "0.79954976", "0.7991984", "0.7984038", "0.7983225", "0.79828346", "0.7981126", "0.7975672", "0.797338", "0.7972695", "0.7970717", "0.79685277", "0.79626954", "0.79599947", "0.7959393", "0.79588586", "0.7958281", "0.79566157", "0.7956206", "0.79531825", "0.7950315", "0.7945192", "0.7940511", "0.79352564", "0.79341495", "0.7932821", "0.7931375", "0.79299074", "0.79284656", "0.7927258", "0.79233265", "0.7918696", "0.79138833", "0.7913201", "0.7912938", "0.79122555", "0.7906716", "0.78979945", "0.78975755", "0.7896501", "0.78964466", "0.78926414", "0.7881687", "0.7880124", "0.78787214", "0.78762734", "0.7875838", "0.7874382", "0.787105", "0.7865587", "0.7864972", "0.7860259" ]
0.0
-1
show form update user
def show @user = User.find(params[:id]) respond_to do |format| format.html { render :action => "show" } format.json { render :json => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_form\n @user = User.find_by_id(session[:user_id])\n end", "def update_user\n end", "def update\n @title = t('admin.users.edit.title')\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n js_notify message: t('admin.users.update.success'), type: 'alert-success', time: 2500\n render partial: 'user', content_type: 'text/html', locals: { user: @user }\n else\n render partial: 'edit', status: :unprocessable_entity\n end\n end", "def update\n # Button press on edit page\n\n # Read the user and update the attributes (don't save at this point)\n @user = User.find(params[:id])\n render_error h \"Der Spezialbenutzer #{@user.username} kann nicht editiert werden.\" and return if @user.special?\n @user.attributes=params[:user] if params[:user]\n\n # Subpages\n select_person and return if params['select_person']\n\n if params['commit']\n # 'Save' button\n render 'edit' and return if !@user.save\n\n flash[:notice] = \"Der Benutzer #{@user.username} wurde gespeichert.\"\n redirect_to_origin(default=@user)\n return\n end\n\n render 'edit'\n end", "def update\n if @user.update(user_params)\n render :show\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def edit\n @update_welcome = 'You have accessed the update page'\n @user = User.find(params[:id])\n\n end", "def update\n if @user.update(user_params)\n redirect_to user_path, notice: \"ユーザ情報を変更しました\"\n else\n render :edit\n end\n end", "def update\n #@user = User.find params[:id]\n if @user.update_attributes(user_params)\n redirect_to show_user_path(id: @user.id)\n else\n render \"edit\"\n end\n end", "def update\n @user = User.find_by(id: params[:id])\n if @user.update_attributes :username => user_params[:username], :email => user_params[:email], :password => user_params[:password]\n render :show\n else\n render :edit\n end\n end", "def update\n if @user.update(user_params)\n flash[:success] = \"Dados do chief atualizados com sucesso!\"\n redirect_to @user\n else\n render :edit\n end\n end", "def update\n # Main content\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile has been updated\"\n redirect_to users_path\n else\n render 'edit'\n end\n end", "def update\n @user = current_user\n @user.update(user_params)\n render_wizard @user\n end", "def update\n if @user.update_attributes(params[:user])\n redirect_to admin_users_path, :notice => t('flash.admin.users.update')\n else\n render :action => \"edit\"\n end\n end", "def admin_update\n @user = User.get(params[:id])\n if @user.update(params[:user])\n flash[:success] = \"User updated\"\n else\n render 'edit'\n end\n end", "def update\n if @user.update(user_params)\n redirect_to @user, notice: 'Usuario actualizado exitosamente.'\n else\n render :edit\n end\n end", "def update\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n puts params\n puts \"!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\"\n @user = current_user\n @user.update_attributes(user_params)\n current_user.save\n render_wizard @user\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(user_params)\n flash[:success] = 'Changes to your account information have been saved.'\n redirect_to @user\n else\n @page_title = \"Edit user #{@user.id}\"\n render 'edit'\n end\n end", "def edit\n # return an HTML form for editing a specific user\n @user = User.find(params[:id])\n end", "def update \n if @user.update(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to :action => 'edit'\n else\n render 'edit'\n end \n \n end", "def update\n #first we find the user edited in the partial form.\n @user = User.find(params[:id])\n #than we update the user based on the params received from the partial form.\n if @user.update_attributes(params[:user])\n #if attributes updated display confirmation.\n flash[:success] = \"User details updated!\"\n #if logged user is admin redirect to the INDEX (users_path).\n if current_user.admin?\n redirect_to users_path\n #if logged user isn't admin redirect to application INDEX (store_path).\n else\n redirect_to user_path\n end\n #if it user is not saved, the reason will be displayed (please see partial form for details)\n # and render the EDIT action, so the partial form can be changed to pass the validations.\n else\n render 'edit'\n end\n end", "def update\n\t\tif current_user.is_admin\n\t\t\t@user = User.find(params[:id])\n\t\telse\n\t\t\t@user = current_user\n\t\tend\n\n\t\trespond_to do |format|\n\t\t\t\n\t\t\tif @user.update_attributes(params[:user])\n\t\t\t\tif(!params[:remote])\n\t\t\t\t\tformat.html { redirect_to(@user, :notice => 'Utente aggiornato con successo') }\n\t\t\t\t\tformat.xml { head :ok }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :text => params[:user].values[0].to_s}\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tif(!params[:remote])\n\t\t\t\t\tformat.html { render :action => \"edit\" }\n\t\t\t\t\tformat.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render :text => \"Il valore inserito non e' valido\"}\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def update_users_view\n @user = User.find(params[:id])\n end", "def update\n if @user.update_attributes(users_params)\n flash[:success] = \"Nailed it! You've successfully updated your account information.\"\n redirect_to user_path(@user)\n else\n render 'edit' # automatically saves valid information on form\n end\n end", "def update\n\t\trespond_to do |format|\n\t\tif @user.update(user_params)\n\t\t\tformat.html { redirect_to root_path, notice: 'Информация о пользователе успешно обновлена.' }\n\t\t\tformat.json { render :show, status: :ok, location: @user }\n\t\telse\n\t\t\tformat.html { render :edit }\n\t\t\tformat.json { render json: @user.errors, status: :unprocessable_entity }\n\t\tend\n\t\tend\n\tend", "def update\n if current__user.isAdmin || current__user == @user\n if @user.update(user_update_params)\n # setToken\n # UserNotifierMailer.send_signup_email(@user).deliver\n render :show, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n render json: 'Sorry you are not allowed to perform this operation.', status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render :show\n else\n raise ActiveRecord::RecordInvalid.new(@user)\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n flash[:success] = \"更新されました。\"\n redirect_to users_path\n else\n render 'edit'\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[:success] = \"Профиль обновлен.\"\n format.html { redirect_to @user, notice: 'Пользователь успешно обновлен.' }\n format.json { head :no_content }\n else\n @title = \"Настройки пользователя\"\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_attributes(params[:user])\n flash[:notice] = \"Le profil a bien été modifié\"\n redirect_to user_path(@user)\n else\n render :action => 'edit'\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, alert: '用户信息更新成功' }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n @user.update! user_params\n logger.info \"Account updation succeed! #{@user.id}.\"\n render :show, status: :ok\n end", "def update\n @user = User.shod(params[:id])\n if @user.update(user_params)\n flash[:notice] = t('user_update')\n redirect_to user_path(@user)\n else\n render 'edit'\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to ({action:'index'}), notice: 'ユーザー情報を編集しました' }\n format.json { render :show, status: :ok, location: @user }\n else\n set_superiors\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n @edit = true # Variable criated to differentiate edit and create when entering user edit _form.html.erb\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(current_user.id)\n\n if @user.valid?\n set_attributes\n @user.save\n\n flash[:'alert-success'] = 'User profile successfully updated'\n end\n\n render :index\n end", "def update\n @shown_user = User.find(params[:id])\n\n respond_to do |format|\n if @shown_user.update_attributes(params[:user])\n format.html { redirect_to @shown_user, notice: 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shown_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:success] = \"successfully updated\"\n redirect_to @user \n else\n @title = \"Edit User\"\n render action: \"edit\" \n end\n end", "def update\n if @user.update_attributes params[:user]\n if @user.id == current_user.id\n flash[:notice] = \"Your account was successfully updated.\"\n else\n flash[:notice] = \"#{@user.full_name} account was successfully updated.\"\n end\n if current_user.administrator?\n redirect_to users_path\n else\n redirect_to dashboard_path\n end\n else\n render :action => :edit\n end\n end", "def update\n if current_user.update(user_params)\n redirect_to user_path(current_user), notice: 'Your profile was successfully updated.'\n else\n render :edit\n end\n end", "def update\n\n if @user.update(user_params)\n redirect_to users_path, notice: \"Usuario fue actualizado existosamente\"\n else\n show_role\n render :edit, notice: t('commons.what_wrong')\n end\n end", "def update\n @title = 'Users Management'\n @breadcrumb = 'Users > Edit'\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n\t@user = User.find(params[:id])\n\t@title = \"Edit user\"\n end", "def update \n \t@user = User.find(params[:id])\n \tif @user.update_attributes(user_params)\n \t\tflash[:success] = 'Updated !!!'\n \t\tredirect_to @user \n \telse\n \t\tflash[:danger] = 'Errors Information. Recheck!!\t'\n \t\trender :edit\n \tend\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender :show, status: :ok, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update\n @users = current_firm.users.all\n @user = User.find(params[:id])\n @model = \"user\"\n @model_instanse = @user\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = flash_helper(\"Successfully updated profile.\")\n format.html { redirect_to(user_path(@user))}\n format.js\n else\n \t\n format.js { render \"shared/validate_update\" }\n flash[:notice] = flash_helper(\"something went wrong #{@user.errors}\")\n format.html { redirect_to(edit_user_path(@user))}\n end\n end\n end", "def update\n \t@user = User.find params[:id]\n\n \tif @user.update_attributes(user_params)\n \t\tredirect_to users_path, status: 303\n \telse\n \t\trender :edit\n \tend\n end", "def update\n # @user = params[:user] # need whitelist to make mass assignment\n @user = User.find(params[:id])\n\n #create new user\n if @user!=nil && @user.update_attributes(user_params)\n flash[:notice] = \"User '#{@user.username}' updated successfully.\"\n redirect_to(:action => 'list')\n else\n render('edit') # sign up will receive @user and auto fill form again\n end\n end", "def update\n puts \"******* update *******\"\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @user = current_user\n @user.attributes = params[:user]\n render_wizard @user\n end", "def update\n respond_to do |format|\n if @user.update(edit_user_params)\n format.html { render :show, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"This user has been updated.\"\n redirect_to admin_accounts_path\n else\n flash[:notice] = \"This user could not be updated.\"\n render :action => \"edit\"\n end\n end", "def update\n\t\t@user = current_user\n\t\t@user.name = params[:name]\n\t\t@user.phone = params[:phone]\n\t\t@user.phone_operator = params[:phone_operator]\n\t\tif @user.save\n\t\t\tsession[:user_id] = @user.id\n\t\t\tflash[:notice] = \"Details Updated.\"\n\t\t\tredirect_to(dashboard_path)\n\t\telse\n\t\t\tflash[:alert] = \"Unable to update profile\"\n\t\t\trender \"edit\", layout: \"application_inside\"\n\t\tend\n\tend", "def update\n # find and update a specific user\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User updated'\n redirect_to users_path\n else\n flash[:error] = 'Update error'\n render :action => \"edit\", :id => @user\n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\tflash[:notice] = \"User account was updated successfully.\"\n\t\t\tredirect_to user_path(@user)\n\t\telse\n\t\t\tflash[:error] = get_all_errors\n\t\t\trender 'edit'\n\t\tend\t\t\n\tend", "def update\n @user = current_user\n if @user.update(user_params)\n # flash success\n redirect_to current_user\n else\n # hanle error\n render 'edit'\n end\n end", "def update\n @user = current_user\n\n if @user.update_attributes(params[:user])\n redirect_to profile_path, :notice => I18n.t('profile.update_successful')\n else\n render \"show\"\n end\n end", "def update\n if @user.update(user_params)\n render :show, status: :ok, location: @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 :show, status: :ok, location: @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 :show, status: :ok, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if current_user.update(user_params)\n redirect_to current_user, notice: t(\"profile.updated\")\n else\n render \"edit\"\n end\n end", "def update\n if not check_logged_in then\n return\n end\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 if @user.update_attributes(params[:user])\n flash[:success] = \"Profil mis à jour\"\n sign_in @user\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n @user= User.find(params[:id])\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Successfully updated abuser.\"\n redirect_to users_path\n else\n render :action => 'edit'\n end\nend", "def update\n @user = current_user \n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to root_url\n else\n render :action => \"edit\"\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n redirect_to(root_path, :notice => t(\"successfully_updated\", :scope => 'users.controller'))\n else\n render :action => \"edit\"\n end\n end", "def update \n # note the use of user_params strong parameters to avoid mass assignment vulnerability\n # see below what attributes are allowed to be passed in the user_params definition\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n # rerender the edit page on unsuccessful update\n else\n render 'edit'\n end\n end", "def update\n self_edit_only\n @user = User.find(params[:id])\n if @user.update(update_params)\n redirect_to user_url, :notice => \"Update successful!\"\n else\n render \"edit\"\n end\n end", "def update\n if current_user\n @user = User.find(params[:id])\n if (current_user.username == 'Administrator')||(current_user.username == @user.username)\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\telse\n \tredirect_to root_url, :notice => 'Uwaga! Nie masz uprawnie&#324;!'\n \tend\n else\n redirect_to :login, :notice => 'Informacja! Zaloguj si&#281; aby obejrze&#263;!'\n end\n end", "def update\n if @user.update_attributes(user_params)\n redirect_to users_url, :notice => 'User was successfully updated.'\n else\n render :action => \"edit\"\n end\n end", "def update\n @user.update_attributes!(user_params)\n \n render nothing: true, status: :no_content\n end", "def update\n debugger\n respond_to do |format|\n if @user.update(user_params)\n @show_modal = 'hide'\n set_users\n format.js\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n @show_modal = 'show'\n format.js\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 respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n @info = {:title => \"Update Profile\", :button_name => \"Save\", :new_user => false}\n format.html { render :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 flash.now[:success] = \"Edit Successed\"\n redirect_to @user\n else\n flash.now[:danger] = \"Edit Failed\"\n render \"edit\"\n end\n end", "def update_user\n user = User.find(params[:id])\n user.update! update_user_params(params)\n @users = User.order(:last_name, :first_name)\n @user = current_user\n render :index\n end", "def edit\n @user = User.find(params[:id])\n # @user は編集対象のユーザー\n # current_user はログインしているユーザー \n\n end", "def update\n # find the user by the user id in the route params\n # (this will likely be moved to its own before method)\n @user = User.find(params[:id])\n \n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n # something went wrong, go back to the edit form with existing user info\n render 'edit'\n end # if\n end", "def update\n respond_to do |format|\n if @show_user.update(show_user_params)\n format.html { redirect_to @show_user, notice: 'Show user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @show_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n if @user.update(user_params)\n redirect_to root_url\n else\n render 'edit'\n end\n end", "def update\n if current_user.update_attributes(user_params)\n redirect_to current_user, notice: 'Profile successfully updated.'\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = \"updated!\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n if @user.update_attributes(user_params)\n flash[:success] = \"Profile updated\"\n redirect_to @user\n else\n render 'edit'\n end\n end", "def update\n\t@user = User.find(params[:id])\n\tif @user.update_attributes(params[:user])\n\t\tflash[:success] = \"Profile updated.\"\n\t\tredirect_to @user\n\telse\n\t\t@title = \"Edit user\"\n\t\trender 'edit'\n\tend\n end", "def edit\n \n @user = User.find(params[:id])\n \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\tsession[:edit] = nil\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 respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to([:admin, @user], notice: 'User was successfully updated.') }\n format.xml { head :ok }\n website.add_log(user: current_user, action: \"Updated user #{@user.name}\")\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 load_user\n build_user\n respond_to do |format|\n if user.save\n format.html { redirect_to user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @ser }\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 #Modificado para que solo pueda cambiar nombre y apellido (y admin cuando el que hace el cambio sea un admin)\n\tif(!session[:user_id])\n\t\tlash[:error] = \"Acceso denegado\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n \n\tif(!params[:user_id] or !params[:hashed_id] or !params[:name] or !params[:lastname])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(params[:admin] and !User.find(session[:user_id]).admin)\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n\tif(Digest::SHA1.hexdigest(params[:user_id].to_s) != params[:hashed_id])\n\t\tflash[:error] = \"Error\"\n\t\tredirect_to home_path\n\t\treturn\n\tend\n\t\n @user = User.find(params[:user_id])\n\t@user.name = params[:name]\n\t@user.lastname = params[:lastname]\n\t\n\tif(User.find(session[:user_id]).admin and session[:user_id] != params[:user_id])\n\t\tif(params[:admin])\n\t\t\t@user.admin = true\n\t\telse\n\t\t\t@user.admin = false\n\t\tend\n\tend\n\t\n\t\n\t@user.save\n\t\n\tflash[:succes] = \"Datos actualizados satisfactoriamente\"\n\t\n\tif(User.find(session[:user_id]).admin)\n\t\tredirect_to users_path\n\t\treturn\n\tend\n\t\n\tredirect_to \"/profile/#{@user.id}\"\n end", "def update\n @user = current_user\n if @user.update_attributes(params[:user])\n flash[:notice] = \"Profile update successful.\"\n redirect_to root_url\n else\n render :action => \"edit\"\n end\n end", "def update\n \t@user = current_user\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to admin_user_path(current_user), notice: '<strong>Success!</strong> Your profile was 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 @user = User.find(params[:id])\n if @user.update(user_params)\n redirect_to @user\n else\n render action: 'edit'\n end\n end", "def update\n if @users.update(user_param)\n flash[:notice] = I18n.t('admin.users.edit.success', :name => @users.email)\n redirect_to :action => :index\n else\n #flash[:error] = I18n.t('admin.rental_units.edit.failure')\n render :action => :edit\n end\n end", "def edit\n @user = User.find(params[:id])\n @user.update(user_params)\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=> 'Los datos del usuario han sido actualizados' }\n\n else\n format.html { render :action=> \"edit\" }\n\n end\n end\n end", "def update\n \t@user = User.find(params[:id])\n \tif @user.update_attributes(user_params)\n \t#handle a succesful update\n \tflash[:success] = \"Profil updated\"\n \tredirect_to @user\n \t\n \telse\n \trender 'edit'\n \tend\n end", "def update\n @user = current_user\n if @user.update_attributes(params[:user])\n flash[:notice] = 'Your profile has been successfully updated.'\n redirect_to user_path(@user)\n else\n render :action => 'edit'\n end\n end", "def update\n @user = User.find(self.current_user.id)\n if @user.update_attributes(params[:user])\n flash[:notice] = 'User was successfully updated.'\n redirect_to :action => 'profile'\n else\n render :action => 'edit'\n end\n end", "def update_admin\n @user = User.find_by_id(params[:id])\n if @user.blank?\n render :file => \"#{Rails.root}/public/404.html\", :status => 404, :layout => false\n else\n @user.update_attributes(params[:user])\n @user.errors.full_messages.blank? ? flash.now[:success] = \"Le profil a été mis à jour.\" : false\n @users = User.all.page(params[:page]).per(10)\n render :edit_admin, id: @user.id\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n flash[:notice] = t('users.update.notice')\n redirect_to(@user)\n else\n render :action => \"edit\"\n end\n end", "def update\n respond_to do |format|\n if current_user.update(user_params)\n format.html { redirect_to dashboard_path, notice: \"User was successfully updated.\" }\n format.json { render :show, status: :ok, location: current_user }\n else\n format.html { render :edit }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7832611", "0.78088707", "0.77648675", "0.76833665", "0.75262815", "0.75237745", "0.75127196", "0.7488812", "0.7460537", "0.745417", "0.7453461", "0.7407733", "0.74016386", "0.74005425", "0.7394082", "0.73731714", "0.7373095", "0.736515", "0.73627764", "0.7353143", "0.7325564", "0.7325134", "0.7321944", "0.7317594", "0.731724", "0.7312475", "0.731121", "0.731062", "0.7309919", "0.7309081", "0.73088807", "0.7308323", "0.73072857", "0.7304459", "0.729972", "0.7285061", "0.72813815", "0.72749656", "0.7271898", "0.7267816", "0.726702", "0.725107", "0.72383416", "0.72340524", "0.72189546", "0.72124654", "0.72097677", "0.7207315", "0.72064304", "0.7205191", "0.72049224", "0.72041816", "0.7200846", "0.71997833", "0.71985567", "0.7195004", "0.7194809", "0.7194809", "0.7194809", "0.7193876", "0.7190834", "0.71908", "0.7189197", "0.7181806", "0.7180909", "0.7178468", "0.7177812", "0.71762425", "0.7176215", "0.71754545", "0.71741414", "0.71715", "0.7169887", "0.71644247", "0.7161024", "0.71575403", "0.71557933", "0.71550405", "0.7150094", "0.7147787", "0.7145018", "0.7145018", "0.7145018", "0.7143355", "0.7141857", "0.71402204", "0.71395653", "0.71376556", "0.71371806", "0.7137141", "0.7132402", "0.7126736", "0.7125744", "0.7125155", "0.71228975", "0.7119186", "0.7118631", "0.7108941", "0.7106658", "0.71040624", "0.71035874" ]
0.0
-1
add_post takes in an argument of a post and associates that post with the author by telling the post that it belongs to that author
def add_post(post) @posts << post post.author = self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self\n end", "def add_post(post)\n post.author = self \n end", "def add_post(post)\n @posts << post #pushes post into post array so that we can compare the author with that author\n post.author = self\nend", "def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def add_post(post)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def add_post_by_title(title)\n post_title = Post.new(title)\n post_title.author = self\n @posts << post_title\nend", "def add_post_by_title(post_title)\n post = Post.new(post_title)\n post.author = self\n end", "def add_post_by_title(title)\n title = Post.new(title) #to create a new song\n title.author = self #associate the objects.\n end", "def add_post_by_title(title)\n post = Post.new(title)\n post.author = self\n end", "def add_post(post)\n if alias_board\n alias_board.add_post post\n else\n post.board = self\n end\n end", "def add_post_by_title(title)\n post = Post.new(title)\n @posts << post\n post.author = self\n end", "def add_post\n if current_user.id.to_s == params[:user_id].to_s\n post = Post.new(:user_id => params[:user_id], :content => params[:content],\\\n :title => params[:title], :upvotes => 0, :downvotes => 0, :rank => 0)\n post.save!\n end\n end", "def add_post_by_title(title)\n post = Post.new(title)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def add_post_by_title(title)\n post = Post.new(title)\n @posts << post\n post.author = self\n @@post_count += 1\n end", "def author=(author)\n\t \t@author = author #tells post its author name\n\t \tif !@author.posts.include?(self)\n\t \t\t@author.posts << self # add post to author collection if not already\n\t \tend\n\t end", "def add_post_by_title(post_title)\n post_title = Post.new(post_title)\n self.add_post(post_title)\n end", "def add_author\n add_author_editor \"author\"\n end", "def create\n @post = Post.new(params[:post])\n authorize! :create, @post\n unless params[:author].blank?\n @post.users << User.find(params[:author])\n end\n logger.debug \"Going to save #{Rails.logger.level} #{@post.title.inspect} #{params[:post]}\"\n respond_to do |format|\n if @post.save_post?\n logger.debug \"Saved successfully #{@post.title.inspect}\"\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n logger.debug \"Could not save #{@post.title.inspect}\"\n flash[:alert] = \"Slug cannot be created\"\n format.html { render 'new' }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_author(user)\n return if authors.member?(user)\n\n authors.push(user)\n SiteData.update_contribution(:add, authors_join_table, user.id)\n return unless editors.member?(user)\n\n editors.delete(user)\n SiteData.update_contribution(:del, editors_join_table, user.id)\n end", "def initialize #initializes post belonging to author \r\n @post = author\r\n end", "def store_blog_post(time, author, title, content)\n\t\tvalue = []\n\t\tvalue[0] = title\n\t\tvalue[1] = author\n\t\tvalue[2] = content\n\t\tget_blog_posts.store(time, value)\t\n\tend", "def validate_the_author_of_the_post(post)\n if !is_the_author_of_the_post(post)\n puts \">>>>>> Validation failed: Un-author action is prohibited!\"\n redirect_to post_path\n end\n end", "def create\n @post = Post.new params[:post].merge(:author => current_user)\n \n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => t('posts.show.post_created')) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_post_by_title(title)\n new_post = Post.new(title)\n self.add_post(new_post)\n end", "def add_author_or_editor\n return unless !@save_without_our_callbacks && (user = User.current)\n\n authors.empty? && author_worthy? ? add_author(user) : add_editor(user)\n end", "def create\n @post = current_author.posts.build(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :flash => {:success => 'Post was successfully created.' } ) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n format.json { render :json => @post, :status => :created, :location => @post }\n else\n @title = \"New Post\"\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n format.json { render :json => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @post.author = current_user\n\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n end\n \n respond_with @post\n end", "def add_post conv\n conv.posts.build \n end", "def is_the_author_of_the_post(post)\n post.author_id == current_author.id\n end", "def create\n @post = Post.new(post_params)\n @post.author = @current_user\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 action: 'show', status: :created, location: @post }\n else\n format.html { render action: 'new' }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def addAuthor(author_id)\n # double = DB.exec(\"SELECT * FROM creators WHERE author_id = '#{author_id.to_i}' AND book_id = '#{@id}';\")\n # if double = nil\n DB.exec(\"INSERT INTO creators (name, bio, id) VALUES (#{name}, #{genre}, #{id}})\")\n\n # DB.exec(\"INSERT INTO creators (author_id, book_id) VALUES (#{author_id.to_i},#{@id}) AND INSERT INTO authors (name, bio, id) VALUES (#{name}, #{genre}, #{id});\")\n end", "def create\n @post = BlogPost.new(blog_post_params)\n @post.author = current_user\n create_resource_response(@post)\n end", "def add_post_by_title(title)\n Post.new(title, self)\n end", "def add_author(name)\n aux = name.split\n autor = Author.new(aux[1..-1].join(\" \"),aux[0][0].capitalize)\n @Author << autor \n end", "def post\n # TODO re-enable blog post creation. Requires a config file.\n #if @args.length > 0\n # new_post = BlogPost.new(@args.first, @config)\n #else\n # @stderr.puts 'create:post requires a filename. Try yuzu create:post \"Post Title Here\"'\n #end\n end", "def save\n @post = Post.find_or_new(params[:id])\n if request.post?\n @post.attributes = params[:post]\n # TODO: one author, serveral eitors\n @post.user = current_user\n @post.title = '(untitled)' if @post.title.strip==''\n @post.category = Category.find_by_name(params[:category])\n if @post.save\n flash[:notice] = 'saved successfully'\n redirect_to :action => :edit,\n :id => @post.id\n else\n flash[:errors] = @post.errors\n render :action => :edit\n end\n end\n end", "def post_params\n params.require(:post).permit(:content, :author_id)\n end", "def create\n authorize\n params[:post][:author_id] = session[:author].id\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n flash[:notice] = 'El post fue creado satisfactoriamente.'\n format.html { redirect_to \"/posts\" }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_post\n puts \"Please enter a title\"\n title_input = gets.chomp\n post_title = title(title_input) #title helper method\n\n puts \"What is your name?\"\n author_input = gets.chomp\n post_author = author_input.capitalize!\n\n puts \"Write your post. When finished, press enter.\"\n body_input = gets.chomp\n post_body = body_input.capitalize!\n\n puts \"List any tags for your post. Separate each with a space.\"\n tags_input = gets.chomp\n post_tags = tags_input.split(\" \")\n\n BLOG << Post.new(post_title, post_author, post_body, post_tags, comments = [])\n puts ''\n puts \"Your post, #{post_title}, has been successfully posted to the Arcadia Blog!\"\n puts '(SEE BELOW)'\n puts ''\n puts display_full_post(BLOG.length - 1)\n end", "def author_name\n self.posts.first.author_name\n end", "def blog_post_permission( args = {} )\n Permission.new( args.reverse_merge( :privilege => :post, \n :class_name => 'Blog',\n :is_grant => false,\n :has_grant_option => false,\n :target_owned_by_self => false\n ))\n end", "def write!(other_user)\n wallposts.create!(posted_id: other_user.id)\n end", "def create\n @post = Post.new(post_params)\n @post.author_id = current_user.id\n if @post.save\n # params[:sub_ids].each do |id|\n # PostSub.create(sub_id: id, post_id: @post.id)\n # end\n redirect_to post_url(@post) \n else\n flash.now[:errors] = @post.errors.full_messages\n render :new \n end\n \n end", "def post_params\n params.require(:post).permit(:title, :description, :author_id)\n end", "def create\n @post = Post.new(post_params)\n @post.users.push(User.find(current_user.id))\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 # with assocations, you can build through the association\n # @post = Post.new(post_params)\n #@post.user_id = current_user.id\n\n #this inherently takes the current_user's PK and store it in the FK of the new post because of the assocation we set. It essentially creates this new posts and associates the post with the user.\n # @post = current_user.posts.new(post_params)\n @post = current_user.posts.build(post_params)\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, status: :unprocessable_entity }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #initialize a new post object with the parameters submitted, validated by post_params\n @post = Post.new(post_params)\n \n isComment = false\n #check whether this is actually a comment, meaning it should have kind=2 and will need an originating post id\n if params[:kind].present?\n @post.kind = params[:kind].to_i\n @post.originatingPost_id = params[:originatingPost_id].to_i\n isComment = true\n \n #otherwise, it is a post, which optionally has tags\n else\n @post.kind = 0\n @tagsToAdd = params[:tagsToAdd].split(\" \")\n @tagsToAdd.each do |t|\n @post.tags << createTag(t)\n end\n end\n \n #either way, the currently logged in user should be logged as the creator of this post/comment\n @post.user = User.find(session[:user_id])\n \n if @post.save!\n if isComment\n redirect_to action: \"show\", :id => params[:originatingPost_id] #stay on the post's show page\n else\n redirect_to action: \"show\", :id => @post.id #go to this new post's show page\n end\n else\n redirect_to action: 'new' #upon failure, try again\n end\n end", "def set_addpost\n @addpost = Addpost.find(params[:id])\n end", "def create\n @post = @current_user.posts.build(params[:post])\n if @post.save then\n Feed.create_post(@post)\n end\n end", "def save_post(title, href, source, likes = nil, reply_number = nil, category = nil)\r\n post = Post.new(title: title, url: href, source: source, likes: likes, reply_number: reply_number, category: category)\r\n if post.save\r\n puts title + 'saved'\r\n end\r\n end", "def add_author(name, email = nil)\n @authors << {:name => name, :email => email}\n end", "def create_post(message, author_name, author_email, author_url = nil, ip_address = nil, created_at = nil)\n new_post_hash = API.create_post(forum_key, id, message, author_name, author_email, author_url, ip_address, created_at)\n new_post = Post.new(new_post_hash.merge(default_hash))\n @posts << new_post if @posts\n new_post\n end", "def create_post\n\t\tassignment_id = params[:assignment_id]\n\n\t\tassignment = Assignment.find(assignment_id)\n\t\tgroup_id = assignment.group_id\n\n\t\t\n\t\tpost = Post.create({\n\t\t\tcontent: params[:content],\n\t\t\tpublished_at: DateTime.now\n\t\t\t})\n\n\t\tassignment.posts << post\n\t\tassignment.save\n\n\t\tpost.author = @authenticated_user\n\t\tpost.save\n\n\t\tredirect_to group_db_show_url(group_id)\n\t\treturn\n\tend", "def post_params\n params.require(:post).permit(:title, :body, :author_id)\n end", "def create\r\n @post = Post.new(post_params)\r\n\r\n #-------add current_user to user_id-----------\r\n @post.user_id = current_user.id\r\n #---------------------------------------------\r\n \r\n respond_to do |format|\r\n if @post.save\r\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\r\n format.json { render :show, status: :created, location: @post }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @post.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n if signed_in? && author_signed_in?\n @post = Post.new(params[:post])\n\n respond_to do |format|\n if @post.save\n format.html { redirect_to(@post, :notice => 'Post was successfully created.') }\n else\n format.html { render :action => \"new\" }\n end\n end\n else\n redirect_to root_path\n end\n end", "def create\n @post.character = current_user.character\n authorize! :create, @post\n create! { posts_url }\n end", "def new_blog_post\n\t\t# Get current time when post was created\n\t\tcurrent_time = Time.now\n\n\t\t# Name of the content creator\n\t\tputs \"Enter your name: \"\n\t\tblog_author = gets.chomp\n\n\t\t# Title of blog post\n\t\tputs \"Post title: \"\n\t\tblog_title=gets.chomp\n\n\t\t# Content of blog post\n\t\tputs \"Create a post: \"\n\t\tblog_content = gets.chomp\n\n\t\t# Create a blog post\n\t\tblogpost=Blog_post.new(current_time.to_s, blog_title, blog_author, blog_content)\n\tend", "def addMagazine _obj, _args\n \"_obj addMagazine _args;\" \n end", "def addMagazine _obj, _args\n \"_obj addMagazine _args;\" \n end", "def newPost(_, _, _, metaweblog_struct, _)\n post = Post.create(@db.content_path, metaweblog_struct)\n @db.refresh_post_paths\n\n run_user_cmd\n post['postid']\n end", "def create_post(user_id, post_hash={})\n if Users.find(:id => user_id).empty?\n return false\n end\n if post_hash[:location_id] == nil\n return false\n end\n if post_hash[:text] == nil\n return false\n end\n username = Users.find_by_sql(\"SELECT u.name FROM users u WHERE u.id = ?\", user_id).username\n ptext = post_hash[:text]\n plocation = post_hash[:location_id]\n @posts = Posts.create(:author_id => user_id, :author_name => username, :text => ptext, :location_id => plocation)\n return true\n end", "def add_book(book)\n binding.pry\n self.books << book\n book.author = self\n end", "def create\n @post = current_user.posts.new(params[:post])\n @post.edited_at = Time.current\n @post.published_at = Time.current if params[:publish]\n if @post.save\n flash[:success] = \"Post criado com sucesso.\"\n redirect_to admin_posts_path\n else\n @page_title = \"Novo Post\"\n render :action => 'new'\n end\n end", "def add(text, meta, journal, link, p1=nil, p2=nil)\n text = inject_metadata(text, meta)\n add_revision(text, journal, link, p1, p2)\n end", "def add_to_post(post, all_comments)\n all_comments.each do |comment|\n post.add_comments(comment)\n end\nend", "def create\n\t\t@post = Post.new(post_params)\n\t\t@post.author = @user.username\n\n\t\trespond_to do |format|\n\t\t\tif @post.save\n\t\t\t\tformat.html { redirect_to root_url + \"#!/\" + @post.slug, notice: 'Post was successfully created.' }\n\t\t\t\tformat.js {}\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @post }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @post.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create_post(user, friend, text)\n\t\tUserPost.create(text: text,user1_id: user, user2_id: friend)\n\tend", "def create\n @post = Post.new(post_params)\n\n @author_id = current_user&.author&.id\n @post.author_id = @author_id\n @post.tag_list = post_params[:tag_list]\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 rescue Exception => e\n flash[:alert] = e.message\n raise\n end", "def add_article(title, magazine)\n #going to create a new article when\n # given title and magazine\n #I have to be sure that when creating\n #an article I give it a title,author,magazine\n Article.new(title, magazine,author)\n end", "def add_author( solr_doc, author_number, authors )\n\n role = solr_doc.at_path( \"mods_0_name_#{author_number}_role_0_text_t[0]\" )\n if role && role.include?( 'author' )\n cid = solr_doc.at_path( \"mods_0_name_#{author_number}_computing_id_t[0]\" )\n fn = solr_doc.at_path( \"mods_0_name_#{author_number}_first_name_t[0]\" )\n ln = solr_doc.at_path( \"mods_0_name_#{author_number}_last_name_t[0]\" )\n dept = solr_doc.at_path( \"mods_0_name_#{author_number}_description_t[0]\" )\n ins = solr_doc.at_path( \"mods_0_name_#{author_number}_institution_t[0]\" )\n\n return add_person( authors, author_number, cid, fn, ln, dept, ins )\n end\n\n # could not find the next author, we are done\n return false, authors\n end", "def add(post)\n @posts << post\n CSV.open(@csv_file, 'wb') do |row|\n @posts.each do |postx|\n row << [postx.path, postx.title, postx.body, postx.author, postx.done]\n end\n end\n end", "def create\n if(params[:message]) then\n @user = User.find(session[:user][:id])\n @user.add_post(params[:message])\n redirect_to posts_path, :method => :get\n end\n end", "def create\n @post = Post.new(post_params)\n @post.author_id = current_user.id\n\n if @post.save\n params[:post][:sub_ids].each do |sub_id|\n next if sub_id == \"\"\n postsub = PostSub.new(post_id: @post.id, sub_id: sub_id.to_i)\n postsub.save!\n end\n redirect_to sub_url(@post.subs.first)\n else\n flash[:errors] = @post.errors.full_messages\n render :new\n end\n end", "def create\n @post.author = current_user\n @post.current_revision.user = current_user\n handle_images\n respond_to do |format|\n if @post.save\n handle_pingbacks\n flash[:notice] = 'Post was successfully created.'\n format.html { redirect_to(@post) }\n format.xml { render :xml => @post, :status => :created, :location => @post }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors, :status => :unprocessable_entity }\n end\n end\n end", "def author_name=(author_name)\n self.author = Author.find_or_create_by(name: author_name)\n end", "def post(body)\n Post.create!(sender_id: actor.id, body: body)\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def set_author_id\n if self.author_id.blank?\n self.author_id = self.user_id\n end\n end", "def add_blog(date, text)\n\t\tBlog.new date, self, text\n\tend", "def create\r\n new_post = current_user.posts.new(post_params)\r\n new_post.save\r\n redirect_to post_path new_post\r\n end", "def like_post!(post)\n likes.create!(epost_id: post.id, like: 1)\n end", "def post_params\n params.require(:post).permit(:id, :title, :body, :author)\n end", "def post_params\n params.require(:post).permit(:title, :content, :author_id, :image)\n end", "def create\n @post = current_user.posts.new(post_params)\n\n if @post.save\n flash[:notice] = \"Post successfully saved!\"\n redirect_to posts_path\n else\n flash[:alert] = \"We could not post your blog\"\n render :new\n end\n end", "def create_post(user_id, post_hash={})\n post_hash[:user_id] = user_id\n p = Post.new(post_hash)\n creationStatus = p.save\n\n u = User.find(user_id)\n l = Location.find(post_hash[:location_id])\n\n if creationStatus\n u.posts << p\n l.posts << p\n end\n\n creationStatus\n end", "def add_book author, title\n books = @books[author]\n if books\n if books.include? title\n puts \"That book is already in the system\"\n else\n books << title\n end\n else\n puts \"No such author\"\n end\n end", "def create\n @room = Room.find(params[:target_room_id])\n @post = @room.posts.create(params[:posts])\n @post.user_id = current_user.id\n\n if @post.save!\n flash[:success] = \"Post created!\"\n \n \n \n else\n flash[:failure] = \"Failed to create post!\"\n end\n redirect_to room_path(@room)\n \n end", "def set_post\n @post = Post.friendly.find(params[:id])\n # authorize @post\n end", "def create\n @post = Post.new(post_params)\n @post.user = current_user\n @post.save\n redirect_to @post\n\n end", "def author\n @author ||= AuthorDrop.new(:page => page, :site => site)\n end", "def post_params\n params.require(:post).permit(:author, :img_url, :title, :content)\n end", "def new_post *args\n groups(:studio1).posts.new *args\n end", "def new\n # ensure that a new post is created for a valid author\n if params[:author_id] && !Author.exists?(params[:author_id])\n redirect_to authors_path, alert: \"Author not found.\"\n else\n @post = Post.new(author_id: params[:author_id])\n end\n end", "def posts_by_author(author_name, posts = nil)\n posts ||= published_weblog\n posts.select { |post| post._unwrap.attributes[:author_name] == author_name }\n end", "def new_post(post)\n @user = post.wall_user\n @post = post\n\n mail to: @user.email, subject: \"Someone just posted on your wall.\", reply_to: post.poster.email\n end", "def test_save_case_3\n set_up_new_records\n @author.blog_posts << @post1\n @author.save\n # Set the blog.owner to owner2 & check that relation is set correctly\n author = TestWriter.get(@author[:id])\n author.blog_posts.each { |rec| p rec}\n author.blog_posts.delete( @post1 )\n assert_equal false, (author.blog_posts.include? @post1)\n author.save\n author = TestWriter.get(author[:id])\n post1 = TestBlogPost.get(@post1[:id])\n assert_equal false, (author.blog_posts.include? @post1)\n assert_equal nil, post1.test_writer\n end" ]
[ "0.869754", "0.869754", "0.869754", "0.8630963", "0.8447251", "0.8189614", "0.8189614", "0.8170128", "0.7595813", "0.7546151", "0.75392205", "0.7348585", "0.69672984", "0.6921335", "0.68606687", "0.672986", "0.672986", "0.6714508", "0.66496783", "0.6528957", "0.65135324", "0.6505414", "0.6474869", "0.62844807", "0.6237232", "0.623023", "0.62049097", "0.62040216", "0.6184119", "0.6165234", "0.6141443", "0.61394316", "0.60678834", "0.60527074", "0.60116464", "0.6008765", "0.59640115", "0.59543383", "0.5927753", "0.5904862", "0.58984095", "0.5874581", "0.58726454", "0.58130836", "0.5796374", "0.5787103", "0.5785742", "0.5774506", "0.5763906", "0.5761912", "0.5758232", "0.5735237", "0.5725492", "0.5723783", "0.5719794", "0.5716941", "0.57103586", "0.5708493", "0.56723917", "0.56721485", "0.5655463", "0.5652714", "0.5652714", "0.5651077", "0.56337756", "0.56314564", "0.56287515", "0.56257117", "0.56249547", "0.5613151", "0.56098557", "0.5609363", "0.56081307", "0.5601044", "0.55952555", "0.55897117", "0.55551225", "0.5537079", "0.5532025", "0.5523178", "0.5521389", "0.5521389", "0.55035007", "0.54951984", "0.54913723", "0.5481118", "0.54790294", "0.5478607", "0.5477527", "0.5470086", "0.54684603", "0.54651296", "0.5462628", "0.54617304", "0.54615605", "0.545584", "0.54293734", "0.5422308", "0.5410316", "0.5404437" ]
0.84641385
4