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 |
|---|---|---|---|---|---|---|
Helper method to simplify checks
|
def check_slide(slide, title, code, skipped, content_types = [ ], contents = [ ], strip = true, &checks)
assert_equal(title, slide.title)
assert_equal(code, slide.contains_code?)
assert_equal(skipped, slide.skip)
content_types.each_with_index { |e, i| assert_kind_of(e, slide.elements[i]) }
contents.each_with_index do |e, i|
if strip
assert_equal(e, slide.elements[i].to_s.strip)
else
assert_equal(e, slide.elements[i].to_s)
end
end
checks.call(slide.elements) unless checks.nil?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def checks; end",
"def check ; true ; end",
"def check\n \n end",
"def check\n \n end",
"def issn; end",
"def valid?(thing); end",
"def valid?(thing); end",
"def valid; end",
"def valid?(_) true end",
"def valid?(_) true end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def err_for_todo(name)\n# def err_for_todo(todos, name) # alt syntax\n # if todos.any? { |todo| todo[:name] == name }\n # 'The todo must be unique'\n # elsif !(1..50).cover?(name.size)\n # 'The todo must have between 1 and 50 characters'\n # end\n unless (1..50).cover?(name.size)\n 'The todo must have between 1 and 50 characters'\n end\nend",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def looks_valid?\n check!(false).empty?\n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def checks=(_arg0); end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def check_params; true; end",
"def check(params)\n false\n end",
"def validData?\n validString?($name) & validString?($organization) & validString?($email) &\n validString?($source) & validString?($use) & validString?($notification) & \n $email.include?(\"@\") & $email.include?(\".\")\nend",
"def check_validity!\n # nothing\n end",
"def verify_iss; end",
"def verify_iss; end",
"def validate_args (args)\n\t# todo\nend",
"def check_values\n check_numericity\n check_zip_code\n end",
"def verify_iss=(_arg0); end",
"def verify_iss=(_arg0); end",
"def sanity_check\n @raw_barcode.include?(0) && @raw_barcode.include?(Barcode_Columns-1)\n end",
"def valid_before=(_arg0); end",
"def literal_validation; end",
"def literal_validation; end",
"def check_sentence(sentence)\n\t# type here\n\t# change return\n\treturn true\nend",
"def is_valid; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def error_for_todo_name(name)\n if !(1..100).cover?(name.size)\n \"Todo name must be between 1 and 100 characters.\"\n elsif @list[:todos].any?{|todo| todo == name}\n \"Todo name must be unique.\"\n end \nend",
"def setup_args_valid?(argsArr)\r\n if nil==argsArr[0] or argsArr[0]==\"\"\r\n return \"Bot token cannot be empty or nil.\"\r\n elsif nil==argsArr[1] or argsArr[1]==\"\"\r\n return \"Bot clientId cannot be empty or nil.\"\r\n elsif nil==argsArr[2]\r\n return \"Bot command prefix cannot be nil.\"\r\n end\r\n\r\n return nil\r\n end",
"def improve\n return false unless valid?\n true\n end",
"def check_errors;\n end",
"def check_taxonomic_length(tax)\n !tax_too_short(tax) && !tax_too_long(tax)\nend",
"def offenses_to_check=(_arg0); end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n end",
"def valid?\n @errors << :title if !@title.is_a?(String) || @title.empty?\n @errors << :author if !@author.is_a?(String) || @author.empty?\n @errors << :release_date unless @release_date.is_a?(Date)\n @errors << :publisher if !@publisher.is_a?(String) || @publisher.empty?\n @errors << :isbn unless @isbn.is_a?(Integer) && @isbn < 10**10 && @isbn >= 10**9\n \n @errors.empty?\n end",
"def result_of_checking; end",
"def despined?(*)\n end",
"def error_for_todo(name)\n if !(1..100).cover?(name.size)\n 'Todo item must be between 1 and 100 characters.'\n elsif @todos.any? { |item| item[:name] == name }\n 'Todo items must be unique.'\n end\nend",
"def missing?; false; end",
"def test_missing_argument_invalid_argument\n\t\tc = Check.new\n\t\trefute c.check_arguments([1,1,'s'])\n\tend",
"def check_owner_and_address\n check_owner\n check_address\n check_access\n end",
"def multi_check\n raise NotImplementedError\n end",
"def ok?\n [ :remote_addr, :price, :subscription_id, :transaction_id, :checksum , :jurnalo_user_id ].inject( true ){ |s,x| s && !(send(x).blank?) }\n end",
"def fixed_field_check(record)\n {\n multiple_no_008: multiple_no_008?(record),\n bad_005: bad_005?(record),\n bad_006: bad_006?(record),\n bad_007: bad_007?(record),\n bad_008: bad_008?(record),\n fixed_field_char_errors: fixed_field_char_errors?(record),\n leader_errors: leader_errors?(record)\n }\nend",
"def user_name (name, password)\n if name == password\n 'name and password cannot be the same.'\n elseif name.length < 6 && password.length < 6\n \"names and passwords must be atleast 6 characters long\"\n elseif password.include? ('!''#''$') == false \n 'password must contain at least one of the following \"!, #, $\"'\n elseif name.include? ('!''#''$'' ') == true\n \"ID's connot contain '!, #, $, '\"\n elseif password == 'password'\n 'your password cannot be password'\n end\nend",
"def valid?\n return false if !@token.nil? && @token.to_s.length > 36\n return false if !@token.nil? && @token.to_s.length < 1\n return false if !@notes.nil? && @notes.to_s.length > 255\n return false if !@notes.nil? && @notes.to_s.length < 0\n return false if !@ip_address.nil? && @ip_address.to_s.length > 39\n return false if !@ip_address.nil? && @ip_address.to_s.length < 0\n return false if !@password.nil? && @password.to_s.length > 255\n return false if !@password.nil? && @password.to_s.length < 0\n return false if !@phone.nil? && @phone.to_s.length > 255\n return false if !@phone.nil? && @phone.to_s.length < 0\n return false if !@account_holder_group_token.nil? && @account_holder_group_token.to_s.length > 36\n return false if !@account_holder_group_token.nil? && @account_holder_group_token.to_s.length < 0\n return false if !@business_name_legal.nil? && @business_name_legal.to_s.length > 255\n return false if !@business_name_legal.nil? && @business_name_legal.to_s.length < 0\n return false if !@business_name_dba.nil? && @business_name_dba.to_s.length > 255\n return false if !@business_name_dba.nil? && @business_name_dba.to_s.length < 0\n return false if !@website.nil? && @website.to_s.length > 255\n return false if !@website.nil? && @website.to_s.length < 0\n return false if !@general_business_description.nil? && @general_business_description.to_s.length > 255\n return false if !@general_business_description.nil? && @general_business_description.to_s.length < 0\n return false if !@history.nil? && @history.to_s.length > 255\n return false if !@history.nil? && @history.to_s.length < 0\n return false if !@business_type.nil? && @business_type.to_s.length > 255\n return false if !@business_type.nil? && @business_type.to_s.length < 0\n return false if !@international_office_locations.nil? && @international_office_locations.to_s.length > 255\n return false if !@international_office_locations.nil? && @international_office_locations.to_s.length < 0\n return false if !@taxpayer_id.nil? && @taxpayer_id.to_s.length > 255\n return false if !@taxpayer_id.nil? && @taxpayer_id.to_s.length < 0\n return false if !@duns_number.nil? && @duns_number.to_s.length > 255\n return false if !@duns_number.nil? && @duns_number.to_s.length < 0\n return false if !@attester_name.nil? && @attester_name.to_s.length > 64\n return false if !@attester_name.nil? && @attester_name.to_s.length < 0\n return false if !@attester_title.nil? && @attester_title.to_s.length > 64\n return false if !@attester_title.nil? && @attester_title.to_s.length < 0\n true\n end",
"def invalid; end",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def check_params *required\n required.each{|p|\n params[p].strip! if params[p] and params[p].is_a? String\n if !params[p] or (p.is_a? String and params[p].length == 0)\n return false\n end\n }\n true\nend",
"def conditionally(*) end",
"def conditionally(*) end",
"def validate_check(check)\n validate_check_name(check)\n validate_check_execution(check)\n validate_check_source(check) if check[:source]\n validate_check_scheduling(check)\n validate_check_proxy_requests(check) if check[:proxy_requests]\n validate_check_handling(check)\n validate_check_ttl(check) if check[:ttl]\n validate_check_aggregate(check)\n validate_check_flap_detection(check)\n validate_check_hooks(check) if check[:hooks]\n validate_check_truncate_output(check)\n validate_check_subdue(check) if check[:subdue]\n end",
"def check_validity(line)\n return check_duplicate(line) && check_anagram(line)\nend",
"def check_entry(entry, expected_name, expected_number, expected_email) #helper method used to consildate redundant code\n expect(entry.name).to eq expected_name\n expect(entry.phone_number).to eq expected_number\n expect(entry.email).to eq expected_email\n end",
"def test_arg_check_2string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy']))\n end",
"def valid?(cc)\n\nend",
"def is_valid\n return true\n end",
"def check!\n self.normalize!\n __check_method\n __check_params\n end",
"def first_validate_arg(arg)\n if(arg.length != length)\n puts \"The length of the string is not correct. Your input length is #{arg.length} but the length needs to be #{length}\"\n self.valid = false\n return false\n else\n arg.split(\"\").each do |i|\n if(i != '0' && i !='1')\n puts \"The input argument contain(s) characters other than 0 and 1. Please correct!\"\n self.valid = false\n return false\n end\n end\n end\n return true\n end",
"def validity_check\n\n if strand == '+'\n\n codon = ref_seq[0..2].map(&:last).join\n return true if codon.include?('N')\n codon == 'ATG'\n\n elsif strand == '-'\n\n codon = ref_seq[-3..-1].map(&:last).join\n return true if codon.include?('N')\n codon == 'CAT'\n\n end\n\n end",
"def is_valid?\n end",
"def valid?\n return false if !@date_from.nil? && @date_from.to_s.length > 10\n return false if !@date_from.nil? && @date_from.to_s.length < 10\n return false if !@date_to.nil? && @date_to.to_s.length > 10\n return false if !@date_to.nil? && @date_to.to_s.length < 10\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length > 24\n return false if !@request_next_item_key.nil? && @request_next_item_key.to_s.length < 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length > 1\n return false if !@request_transfer_class.nil? && @request_transfer_class.to_s.length < 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length > 1\n return false if !@request_transfer_term.nil? && @request_transfer_term.to_s.length < 1\n return false if !@next_item_key.nil? && @next_item_key.to_s.length > 24\n return false if !@next_item_key.nil? && @next_item_key.to_s.length < 1\n true\n end",
"def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end",
"def valid?\n return false if @identifier.nil?\n return false if @identifier.to_s.length > 25\n return false if @name.nil?\n return false if @name.to_s.length > 50\n return false if @status.nil?\n return false if @type.nil?\n return false if @address_line1.nil?\n return false if @address_line1.to_s.length > 50\n return false if !@address_line2.nil? && @address_line2.to_s.length > 50\n return false if !@city.nil? && @city.to_s.length > 50\n return false if !@state.nil? && @state.to_s.length > 50\n return false if !@zip.nil? && @zip.to_s.length > 12\n return false if !@phone_number.nil? && @phone_number.to_s.length > 30\n return false if !@fax_number.nil? && @fax_number.to_s.length > 30\n return false if !@website.nil? && @website.to_s.length > 255\n return false if !@account_number.nil? && @account_number.to_s.length > 100\n return false if !@lead_source.nil? && @lead_source.to_s.length > 50\n return false if !@user_defined_field1.nil? && @user_defined_field1.to_s.length > 50\n return false if !@user_defined_field2.nil? && @user_defined_field2.to_s.length > 50\n return false if !@user_defined_field3.nil? && @user_defined_field3.to_s.length > 50\n return false if !@user_defined_field4.nil? && @user_defined_field4.to_s.length > 50\n return false if !@user_defined_field5.nil? && @user_defined_field5.to_s.length > 50\n return false if !@user_defined_field6.nil? && @user_defined_field6.to_s.length > 50\n return false if !@user_defined_field7.nil? && @user_defined_field7.to_s.length > 50\n return false if !@user_defined_field8.nil? && @user_defined_field8.to_s.length > 50\n return false if !@user_defined_field9.nil? && @user_defined_field9.to_s.length > 50\n return false if !@user_defined_field10.nil? && @user_defined_field10.to_s.length > 50\n return true\n end",
"def precheck\n end",
"def test_validates_fail\n assert_equal validates(['1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['1', '1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['k', '1', '6']), [1, nil, nil, nil] # return 1\n assert_equal validates(['1', '-1', '1']), [1, nil, nil, nil] # return 1\n assert_equal validates(['-19', '4', '-1']), [1, nil, nil, nil] # return 1 \n end",
"def lenient? \n @lenient \n end",
"def lenient? \n @lenient \n end",
"def check!\n super()\n \n if not [Symbol, String, Integer, NilClass].any?{ |cl| @id.kind_of?(cl) }\n raise Exception::new(\"ID must contain Symbol, String, Number or nil if included.\")\n end\n end",
"def check_conventions\n\tcheck_encoding\n\tcheck_yaml\n\tcheck_merge\n\tcheck_cucumber\n\tcheck_ruby\nend",
"def test_check_invalid_prospectors\n assert_equal check_valid([2, 0, 1]), [1, nil, nil, nil]\n end",
"def arguments_valid?\n true \n # to do\n end",
"def check_errors;\n end",
"def name_safe?; end",
"def valid?\n raise NotImplementedError\n end",
"def internal_check?(row, col)\n\n values = [@rows[row], @cols[col], @blks[find_block(row,col)]] #Values related to the section\n \n #Check for a missing value\n #------------------------------- \n values = values.flatten.uniq.join.gsub(\"0\",\"\")\n values = \"123456789\".tr(values,\"\")\n if values.length == 1\n @rows[row][col] = values.to_s\n adjust_values\n return true\n else\n return false\n end\n end",
"def computer_offense_check(spaces, space1, space2, space3)\n\n ((spaces[space1] + spaces[space2]).include?(\"OO\") ||\n (spaces[space2] + spaces[space3]).include?(\"OO\") || \n (spaces[space1] + spaces[space3]).include?(\"OO\")) && \n (spaces[space1] + spaces[space2] + spaces[space3]).include?(\"X\") == false\n\nend",
"def check_against_input_for_specials(data)\r\n @field_names[1..-1].each do |f|\r\n raise(ArgumentError,\r\n 'You cannot input a value for this field: %s' % f) if \\\r\n @field_extras[@field_names.index(f)].has_key?('Calculated') \\\r\n or @field_extras[@field_names.index(f)].has_key?('Link_many') \\\r\n and not data[f].nil? \r\n end\r\n end",
"def check_record; end",
"def check_err_order(order)\r\n case order\r\n when \"latte\"\r\n when \"scone\"\r\n when \"tea\"\r\n else\r\n puts ERROR_MSG\r\n return true\r\n end\r\n return false\r\nend",
"def is_valid\n\tend",
"def is_valid\n\tend"
] |
[
"0.69029903",
"0.66005415",
"0.65114754",
"0.65114754",
"0.6343877",
"0.63203996",
"0.63203996",
"0.6294905",
"0.62190044",
"0.62190044",
"0.6178143",
"0.61746085",
"0.61665463",
"0.6165975",
"0.6165975",
"0.6165975",
"0.6165975",
"0.6165975",
"0.61630183",
"0.6149998",
"0.6136713",
"0.6136713",
"0.61274743",
"0.6121252",
"0.61177546",
"0.6066036",
"0.60555357",
"0.60060763",
"0.5973292",
"0.5961611",
"0.5935744",
"0.5935744",
"0.59316605",
"0.59139997",
"0.5872402",
"0.5872402",
"0.58718103",
"0.5858363",
"0.58557105",
"0.58557105",
"0.58350784",
"0.58337337",
"0.58223456",
"0.58206683",
"0.5820416",
"0.5811281",
"0.5801901",
"0.5788987",
"0.57796085",
"0.5774548",
"0.5774548",
"0.5774548",
"0.5774548",
"0.57619584",
"0.5748864",
"0.57346034",
"0.57301414",
"0.57117647",
"0.56914145",
"0.5689369",
"0.56876534",
"0.5674284",
"0.5667887",
"0.56630546",
"0.5662649",
"0.5657053",
"0.5655597",
"0.5654559",
"0.56519705",
"0.56519705",
"0.5651031",
"0.56486726",
"0.56481546",
"0.5637587",
"0.5630215",
"0.5623016",
"0.56210285",
"0.5617637",
"0.56154794",
"0.5611323",
"0.56101733",
"0.5606901",
"0.5599872",
"0.55915993",
"0.55907786",
"0.5587524",
"0.5587524",
"0.55874467",
"0.5585385",
"0.5581843",
"0.5580448",
"0.5580348",
"0.55717254",
"0.55691785",
"0.5569049",
"0.5564544",
"0.5560916",
"0.55595165",
"0.5558944",
"0.55570745",
"0.55570745"
] |
0.0
|
-1
|
Create array of lines from a string
|
def lines(string)
io = StringIO.new(string)
result = io.readlines
io.close
result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lines\n result = Array.new\n @theLines.each { |l| result << String.new(l) }\n return result\n end",
"def get_lines(string)\n result = Array.new\n lines = string.split('[]')\n unless lines.first == \"LEDES1998B\"\n set_error_message(\"First line of Ledes file is not \\\"LEDES1992B[]\\\" #{lines.first}\")\n else\n # delete the first line since it is correct and we don't need it anymore\n lines.delete_at(0) \n end\n lines.delete(lines.last) if lines.last.blank? # sometimes we get a blank line at the end\n @header = lines.first\n # build ledes_line objects \n build_line_item_array lines\n end",
"def arrayify(str)\n str.split(\"\\n\")\n end",
"def parse_to_array(line_as_string)\n as_array = line_as_string.split(\" \")\nend",
"def lines\n if string.respond_to?(:lines)\n string.lines.to_a\n else\n string.to_a\n end\n end",
"def lines\n if string.respond_to?(:lines)\n string.lines.to_a\n else\n string.to_a\n end\n end",
"def array_from_rows(str)\n str.split(\"\\n\").map { |x| x.split(' ').map { |y| y.to_i } }\n end",
"def lines\n text.split(/(?<=[\\n\\f])/)\n end",
"def readlines( sep_string = $/ )\n lines = Array.new\n while line = gets(sep_string)\n lines << line\n end\n lines\n end",
"def lines\n escaped = content.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? content.split(/\\n/, -1) : [content]\n end",
"def lines\n return [] unless @value && text\n\n text.split(/\\r\\n|\\r|\\n/)\n end",
"def split_lines(output_str)\n output_str.split(\"\\n\").map(&:strip)\n end",
"def get_lines\n lines = []\n line = \"\"\n until line == \".\"\n line = Readline.readline\n lines << line\n end\n lines.join(\"\\n\")\n end",
"def array_of_row_arrays(text)\n c = 0\n arr = []\n arr_of_arrys = []\n # add \"\\n\" to last row of string to make symmetric with previous rows\n # creating an array every 51 chars, and push such array into container array\n text.split('').push('\\n').each_with_index do |value, i| \n c += 1\n arr << value\n if c == 51\n c = 0\n arr_of_arrys << arr\n arr = []\n end\n end\n return arr_of_arrys\nend",
"def split_lines(input)\n return input.split(/[ ]*[\\.\\n]+[ ]*/)\n end",
"def toptag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n([A-Za-z\\/\\*])/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def lines\n @lines ||= text.map do |line|\n line.split /\\s{2}/\n end.flatten.reject!{|l| l == '' }\n #puts \"LINES? #{@lines}\"\n @lines\n end",
"def position_string_to_array(string)\n size = Math.sqrt(string.length).to_i\n array = chunk(string, size).map { |row| chunk(row, 1) }\n array\n end",
"def position_string_to_array(string)\n size = Math.sqrt(string.length).to_i\n array = chunk(string, size).map { |row| chunk(row, 1) }\n array\n end",
"def split_lines\n text.split(/\\n/)\n end",
"def lines\n escaped = value.to_s.scan(/(\\\\n|\\\\t|\\\\r)/)\n escaped.empty? ? value.to_s.split(/\\n/, -1) : [value.to_s]\n end",
"def lines(text)\n # Remove any trailing separators, and then split based on them\n # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]\n x = text.sub(/#{self.line_separator}\\Q/,'').split(self.line_separator)\n end",
"def lines\n # TODO: data should be required to be a String, no nils\n @lines ||= data ? data.split(\"\\n\", -1) : []\n end",
"def subtag2array(str)\n sep = \"\\001\"\n str.gsub(/\\n(\\s{1,#{@tagsize-1}}\\S)/, \"\\n#{sep}\\\\1\").split(sep)\n end",
"def readlines(eol=$/)\n ary = []\n ary << line while line = self.gets(eol)\n ary\n end",
"def file_to_a file_path_str, delimiter=\"\\n\"\n File.read(file_path_str).lines(separator=delimiter)\n end",
"def map_lines(str)\n str = require_string! str\n\n str.each_line.with_index.reduce(+'') do |memo, (line, index)|\n memo << yield(line, index)\n end\n end",
"def splitText text\n res = Array.new(text.count(\"\\n\") + 1) {LockString.new}\n i = 0\n text.each_char do |c|\n if c == \"\\n\"\n i += 1\n else\n res[i] << c\n end\n end\n puts res.inspect\n res\n end",
"def parse_text\n text.split(\"\\n\").map { |r| r.scan(/.../) } \n end",
"def grab_stocks(stock_str)\n stock_str.split(\"\\n\")\n end",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n\t\tcontents.split(\"\\n\")\n\tend",
"def lines\n @data.split(/^:/m)[1..-1].map do |line|\n \":#{line}\"\n end\n end",
"def read_lines\n lines = Array.new\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n while not (x1==0 and x2==0)\n l = Line.new(x1,x2)\n lines.push(l)\n line = @file.gets\n tokens = line.scan(/[-+]?\\d*\\.?\\d+/)\n \n x1 = Integer(tokens[0])\n x2 = Integer(tokens[1])\n \n end\n \n return lines\n \n end",
"def words_from_string( line )\n result = Array.new\n words = line.split\n if words.size > 0\n words.each { | word | result << word }\n else\n result << \"\\n\"\n end\n result\n end",
"def readlines\n return nil unless __advance!\n\n lines = []\n while line = gets()\n lines << line\n end\n\n lines\n end",
"def line_split str\n content = str.split(': ')[1] || ''\n if content.match /\\//\n content.split('/').map(&:strip).reject(&:empty?)\n else\n content\n end\n end",
"def get_commented_lines(str)\n if str.respond_to? \"gsub!\"\n str.gsub(/^(.+)$/) {|s| \"# \" + s}\n elsif str.respond_to? \"map\"\n str.map {|line| \"# \" + line}\n end\n end",
"def string_to_array(string)\n string.split(\" \")\nend",
"def string_to_array(string)\n string.split(\" \")\nend",
"def file_to_array file\n lines = []\n File.open(file, \"r\") do |infile|\n while (line = infile.gets)\n lines.push(line.gsub(\"\\n\", \"\").rstrip)\n end\n end\n lines\n end",
"def parse_line(line)\n return [] if line.nil? or line.empty?\n line.chomp(\"\\n\").split(\"\\t\")\n end",
"def line_maker\n @lines = File.readlines(path, chomp: true)\n end",
"def line_split2 (in_string)\n #split the incoming string on each newline\n my_string_array = in_string.split(\"\\n\")\n\n my_string_array.each_index { |index| puts \"Line #{index + 1}: #{my_string_array[index]}\"}\nend",
"def line_split (in_string)\n #split the incoming string on each newline\n my_string_array = in_string.split(\"\\n\")\n\n # put each element out to the screen\n my_string_array.each_index do |index|\n puts \"Line #{index + 1}: #{my_string_array[index]}\"\n end\nend",
"def lists\n lines.inject([]){ |lists, line| lists << split(line) }\n end",
"def lines(source); end",
"def field_array(lines)\n entries = []\n text = lines.join\n text.scan(/^>.+<(.+)>\\n(.+\\n)+\\n/) do |name, data| \n entries << [name, data.chomp]\n end\n Hash[entries]\n end",
"def read_lines(io)\n buffer = +''\n while line = io.gets\n buffer << line\n yield line\n end\n buffer\n end",
"def parse_entries(text)\n # Have to add final blank line because it gets lost on the #split\n lines = text.split(\"\\n\") << ''\n Array.new.tap do |parsed_entries|\n entry_string = ''\n\n lines.count.times do |line_number|\n if (((line_number + 1) % 4) == 0)\n parsed_entries << entry_string.chomp\n entry_string = ''\n else\n entry_string += lines[line_number] + \"\\n\"\n end\n end\n end\n end",
"def local_lines\n strip.split(/\\n+/)\n end",
"def lines; [to_s]; end",
"def convert_string_to_array(str = \"\", seperator = \" \")\n str.split(seperator).map(&:strip).uniq.compact\n end",
"def readlines(sep=$/)\n return [] unless advance!\n\n lines = []\n while line = gets(sep)\n lines << line\n end\n\n lines\n end",
"def rows_as_char_arrays(text)\n rows = text.split(\"\\n\")\n\n max_length = rows.map(&:length).max\n\n rows.map do |row|\n # add padding to fix row length if necessary\n row += ' ' * (max_length - row.length)\n row.chars\n end\n end",
"def load_lines file\n\n\t\tlines = Array.new\n\t\tlines = @file.split(\"\\n\")\n\n\t\t#fuck that, i dont like the dyanmic feed, just pre-parse it\n\t\tlines.map! do |line| #map overwrites the old array\n\t\t\tif line.include? '#'\n\t\t\t\tsplit = line.split '#'\n\t\t\t\t#puts split.to_s\n\t\t\t\tsplit.shift\n\t\t\telse\n\t\t\t\tline\n\t\t\tend\n\t\tend\n\n\t\t#removing blank lines\n\t\tlines.delete_if do |line|\n\t\t\ttrue if line.empty?\n\t\tend\n\n\t\tlines.each { |line| line.chomp! }\n\n\t\tlines\n\tend",
"def create_arr_strs(csv)\n\tarr_of_strings = csv.read.split(\"\\r\")\n\tarr_of_strings\nend",
"def splitLines(theText)\n\n\ttheLines = [];\n\t\n\ttheText.each_line do |theLine|\n\t\n\t\tif (theLine =~ /^(.*?)(\\/\\/.*)/)\n\t\t\tlineText = $1;\n\t\t\tlineComment = $2;\n\t\telse\n\t\t\tlineText = theLine.chomp;\n\t\t\tlineComment = \"\";\n\t\tend\n\n\t\ttheLines << { :text => lineText, :comment => lineComment };\n\t\n\tend\n\n\treturn theLines;\n\nend",
"def string_to_arr(str)\n arr = str.split(\" \")\n arr_f = []\n \n for a in arr\n if a != \"\"\n arr_f.push(a.strip)\n end\n end\n \n return arr_f\n end",
"def make_pyramid_array(str)\n str.split(\"\\n\").map { |line| line.split(' ').map { |ch| ch.to_i } }.reverse\nend",
"def read_input\n ary = []\n File.open('./input.txt', 'r') do |file|\n file.each do |line|\n ary << line.to_s\n end\n end\n\n ary.freeze\nend",
"def lines\n lines = []\n words = message.split\n start_idx = 0\n\n while start_idx < words.size do\n counter = 1\n loop do\n break if start_idx + counter > words.size || words[start_idx, counter].join(' ').size > row_size \n counter += 1\n end\n lines << words[start_idx, counter - 1].join(' ')\n start_idx += counter - 1\n end\n\n lines\n end",
"def parse_grid(some_string)\n the_grid = []\n\n some_string.split(\"\\n\").each do |line|\n the_row = []\n line.split(\" \").each do |column|\n the_row.push(column.to_i)\n end\n the_grid << the_row\n end\n\n return the_grid\nend",
"def split_args(str)\n # We need to handle empty strings ourselves; CSV.parse_line() will\n # return [nil].\n return [] if not str or str.empty?\n return CSV.parse_line(str, ' ').map {|i| i.to_s }\n end",
"def match_array(string, match_string)\n arr = []\n string.scan(Regexp.new(match_string)) do |element|\n arr << element\n end\n return arr\n end",
"def lines\n (1..buffer.length.to_i - 1).map { |ix| buffer[ix.to_i] }.flatten\n end",
"def array_from_string string\n # takes the string found when params tries to return an array, and reconstruct the array.\n array = string.split(/[^Q1234567890]+/)\n array.delete(\"\")\n array\n end",
"def string_to_matrix(string)\n to_nums(string.split(\"\\n\").map { |row| row.strip.split })\n end",
"def get_lines(filename); end",
"def split_string(string)\n string.each_line.with_index do |line, index|\n end\nend",
"def lines(data_str, &block)\n d = data_str\n while d && d.length > 0\n if matching = d.match(/^(\\d+) /) # if have a counting frame, use it\n num_bytes = matching[1].to_i\n frame_offset = matching[0].length\n line_end = frame_offset + num_bytes\n msg = d[frame_offset..(line_end-1)]\n yield msg\n d = d[line_end..d.length]\n elsif matching = d.match(/\\n/) # Newlines = explicit message delimiter\n d = matching.post_match\n else\n STDERR.puts(\"Unable to parse: #{d}. Full line was: #{data_str.inspect}\")\n return\n end\n end\n end",
"def split_string_to_array(str)\n @string_as_array = str.split('')\n return @string_as_array\nend",
"def lines\n content.lines.map(&:chomp)\n end",
"def lines\n @lines[oy...(oy + height)] || []\n end",
"def initialize(string = \"\")\n raise \"expected a string but found #{string.inspect}, a #{string.class}\" unless string.is_a? String\n @lines = LineFolding::unfold_and_split(string).map do |line|\n ContentLine.parse(line)\n end\n end",
"def string_to_array(str)\n return [] if str.blank?\n return str.split(\",\").each{|t| t.strip!} if str.class == String\n return []\n end",
"def prediction_to_array(string)\n segments = []\n string.scan(/[io](\\d+)-(\\d+)/) do |m1, m2|\n segments << { :start => m1.to_i, :stop => m2.to_i }\n end\n segments\n end",
"def split_string(s)\n strings = s.split(\"\\n\")\n strings.map do |s|\n s.strip!.split[2]\n end.compact.select { |f| File.exist?(f) }\nend",
"def flat_strings\n returning [] do |ary|\n traverse { |str| ary << str }\n end\n end",
"def le_arquivoL (arq)\n l = Array.new\n text = File.open(arq).read\n text.gsub!(/\\r\\n?/, \"\\n\")\n text.each_line do |line|\n l = l << line\n end\n return l\n end",
"def parse_line(delim , line)\n temp_array = Array.new #Array to hold data\n index = 0 #Position of array index\n token = \"\" #To hold the string\n grouping = false #Grouping characters flag\n\n #Parse line with delimeter\n line.each_char do |char|\n #Grouping Block \n if char == \"\\\"\" and !grouping\n token += char\n grouping = true\n elsif char == \"\\\"\" and grouping \n token += char\n grouping = false\n elsif char == delim and !grouping \n temp_array.push(clean(token)) \n token = \"\" \n else\n token += char\n end\n end \n \n #Store last token on line\n temp_array.push(clean(token))\n \n return temp_array\nend",
"def make_array\n @phrase_string.downcase.split(WORD_SPLIT).reject(&:empty?)\n end",
"def make_list(text)\n\traw_text_array = text.split(\" \")\n\treturn raw_text_array\nend",
"def parse_row_data_from_input(input_str)\n rows = input_str.split(\"\\n\")\n rows.map { |row| row.split.map(&:to_i) }\nend",
"def lines_groups\n @lines_groups = []\n #current_split = ''\n split_count = 0\n\n #@lines_groups ||= text.collect.with_index do |line, i|\n text.each do |line|\n split_line = line.split( /\\s{2,}/ ).reject! {|e| e == '' }\n $stderr.puts \"SPLIT LINE: #{split_line}\"\n # If we're looking at at least one blank area, we need to start a new group.\n if split_line.nil? || split_count == 0\n split_count += 1\n @lines_groups << []\n # Guard against possibly first line being nil.\n @lines_groups.last << split_line unless split_line.nil?\n elsif !split_line.nil? && split_count > 0\n @lines_groups.last << split_line.flatten #.map {|e| e.squish }\n #unless split_line.nil?\n #{\n # index: i, \n # line: split_line, \n # line_size: split_line.length\n #}\n else\n end\n end\n @lines_groups.flatten\n end",
"def array_sentences(str)\n sentences = str.split('.')\n sentences.map! do |sent|\n sent.split('?').map! do |sent2|\n sent2.split('!')\n end\n end\n sentences.flatten\nend",
"def segments_from_line(line, row)\n segs = []\n line.gsub(/\\s+$/,'').scan(/[AOXN10]-+[\\|@]/) do |match|\n segs << Segment.new(match, row, $`.length)\n end\n segs\n end",
"def lines\n @lines ||= line_codes.map {|l| Line.get(l)}\n end",
"def read_multiline(prompt = '')\n @stop = false\n lines = []\n loop do\n line = read_line(prompt)\n break if !line || line == ''\n next if line !~ /\\S/ && !@stop\n if block_given?\n yield(line) unless line.to_s.empty?\n else\n lines << line unless line.to_s.empty?\n end\n break if @stop\n end\n lines\n end",
"def get_file_as_string_array\n file = (\"#{File.dirname(__FILE__)}/../data/seed.txt\")\n string_array = []\n \n File.open(file, 'r') do |f|\n f.each_line do |line|\n string_array << line\n end\n end\n \n string_array\n end",
"def input_lines; end",
"def getLines(line_begin, line_end, indent, keepLastLF)\n line = line_begin\n\n return '' if line_begin >= line_end\n\n queue = Array.new(line_end - line_begin)\n\n i = 0\n while line < line_end\n lineIndent = 0\n lineStart = first = @bMarks[line]\n\n if line + 1 < line_end || keepLastLF\n # No need for bounds check because we have fake entry on tail.\n last = @eMarks[line] + 1\n else\n last = @eMarks[line]\n end\n\n while first < last && lineIndent < indent\n ch = charCodeAt(@src, first)\n\n if isSpace(ch)\n if ch === 0x09\n lineIndent += 4 - (lineIndent + @bsCount[line]) % 4\n else\n lineIndent += 1\n end\n elsif first - lineStart < @tShift[line]\n # patched tShift masked characters to look like spaces (blockquotes, list markers)\n lineIndent += 1\n else\n break\n end\n\n first += 1\n end\n\n if lineIndent > indent\n # partially expanding tabs in code blocks, e.g '\\t\\tfoobar'\n # with indent=2 becomes ' \\tfoobar'\n queue[i] = (' ' * (lineIndent - indent)) + @src.slice(first...last)\n else\n queue[i] = @src.slice(first...last)\n end\n line += 1\n i += 1\n end\n\n return queue.join('')\n end",
"def parse( line )\r\n line.split(';')\r\nend",
"def extract_lines\n reg = Regexp.new('^\\[' + @date + ':\\d\\d:\\d\\d:\\d\\d\\].*\\n', Regexp::MULTILINE)\n if File.exists?(@@gzlogfile)\n require 'zlib'\n gzfile = open(@@gzlogfile)\n @gz = Zlib::GzipReader.new(gzfile)\n @gz.read.match(reg).to_s.split(\"\\n\")\n end\n @file.read.match(reg).to_s.split(\"\\n\")\n end",
"def get_arrays(line)\n pairs = line.chomp.split(',')\n arrys = pairs.map do |range|\n indeces = range.split('-').map(&:to_i)\n (indeces.first..indeces.last).to_a\n end\nend",
"def input_to_lines(input,parse_aliases=true)\n # Array<Array<String>>\n lines = []\n # Array<String>\n args = []\n in_string = false\n current_word = \"\"\n skip_next = false\n for i in 0...input.length\n # If this character is set to be skipped, skip it\n if skip_next\n skip_next = false\n next\n end\n # Get previous character\n p = (i > 0) ? input[i-1, 1] : nil\n # Get current character\n c = input[i, 1]\n # Get next character\n n = (i < input.length-1) ? input[i+1, 1] : nil\n if c == '\\\\'\n # Escaped quotes & backwards slash\n if n == '\"' || n == '\\\\'\n current_word += n\n skip_next = true\n else\n current_word += c\n end\n elsif c == '\"'\n # Quotes\n in_string = !in_string\n elsif c == ' '\n # Whitespace\n if in_string\n current_word += c\n elsif !current_word.empty?\n args.push(current_word)\n current_word = \"\"\n end\n elsif c == '='\n # Equals sign\n if in_string\n current_word += c\n else\n args.push(current_word)\n current_word = \"\"\n end\n elsif !in_string && (c == '&' && n == '&' || c == ';')\n # && and ;\n skip_next = true if c != ';'\n args.push(current_word) unless current_word.empty?\n # Parse aliases if necessary\n if parse_aliases\n ali = parse_aliases(args)\n else\n ali = nil\n end\n lines.push(args.clone)\n lines.push(ali) if ali && !ali.empty?\n args.clear\n current_word = \"\"\n else\n current_word += c\n end\n end\n args.push(current_word) unless current_word.empty?\n # Parse aliases if necessary\n if parse_aliases\n ali = parse_aliases(args)\n else\n ali = nil\n end\n lines.push(args)\n lines.push(ali) if ali && !ali.empty?\n raise ConsoleError, _INTL('unterminated string') if in_string\n return lines\n end",
"def load\n arr = []\n begin\n while(!@file.eof?)\n line = @file.readline.chomp\n arr.concat(line.split)\n end\n ensure\n @file.close\n end\n arr\n end",
"def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n return array\n\nend",
"def convert_string_tags_to_array(_tags)\n (_tags).split(tags_separator).map(&:strip).reject(&:blank?)\n end"
] |
[
"0.7634611",
"0.72438705",
"0.7181382",
"0.7147869",
"0.6996766",
"0.6996766",
"0.69694364",
"0.6860133",
"0.6804814",
"0.67996144",
"0.6780979",
"0.6683623",
"0.664279",
"0.6616253",
"0.65624845",
"0.65273696",
"0.6502209",
"0.6498536",
"0.6498536",
"0.6492357",
"0.64799446",
"0.6411722",
"0.63697696",
"0.62911946",
"0.6240545",
"0.6198682",
"0.615807",
"0.615731",
"0.6151384",
"0.6128226",
"0.61216676",
"0.61216676",
"0.6101586",
"0.60965145",
"0.60849315",
"0.606618",
"0.6058588",
"0.603722",
"0.5998183",
"0.5998183",
"0.5983837",
"0.5979631",
"0.59724617",
"0.5955965",
"0.5948292",
"0.59348625",
"0.5932685",
"0.5914195",
"0.59008026",
"0.5884266",
"0.5874631",
"0.5854838",
"0.58421856",
"0.5824114",
"0.5823631",
"0.58109397",
"0.57921225",
"0.5786691",
"0.57817274",
"0.572919",
"0.57268226",
"0.57247704",
"0.5713429",
"0.57041466",
"0.5698692",
"0.56798977",
"0.5679684",
"0.5671825",
"0.56711525",
"0.5668867",
"0.56630105",
"0.56553155",
"0.5646416",
"0.56255734",
"0.5614632",
"0.56047136",
"0.55851924",
"0.5580468",
"0.5579338",
"0.55510634",
"0.5536295",
"0.5533003",
"0.5530938",
"0.5529842",
"0.5526966",
"0.549547",
"0.5491577",
"0.5489891",
"0.5480174",
"0.5470827",
"0.5466368",
"0.54413813",
"0.5432932",
"0.54315174",
"0.54312295",
"0.54309064",
"0.54243886",
"0.5418263",
"0.5393722"
] |
0.71985877
|
3
|
validates :role_id, :presence => true validates :date_in, :presence => true validates :date_out, :presence => true
|
def tags1
return projects_tags.where("tags_id in (select id from tags where type_tag=?)",1)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def validate_end_date_before_start_date\n return if date_out.nil? \n if date_out && date_in\n errors.add(:date_in, \": could not be after than Date out\") if date_out < date_in\n end\n end",
"def role_valid\n if !role_data\n errors.add(:role, :invalid)\n end\n end",
"def validate_start_and_end_date\n self.errors.add(:event_start_date, \"should not be in past\") if self.event_start_date < Date.today\n self.errors.add(:event_end_date, \"should not be in past\") if self.event_end_date < Date.today\n self.errors.add(:event_end_date, \"start date should not be after end date\") if self.event_end_date < self.event_start_date\n self.errors.add(:event_end_time, \"end time should not be before start time\") if (self.event_end_date == self.event_start_date and self.event_end_time < self.event_start_time)\n return self\n end",
"def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end",
"def validates_role\n self.role = Role.find_by_name \"Technician\" if self.role.nil?\n end",
"def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end",
"def validate_start_and_stop_date\n if active_date\n if active_start_date.nil? or active_stop_date.nil?\n errors.add(:active_date, \"start date or end date not set\")\n end\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def check_dates_are_valid\n if @start_date.present? && @end_date.present?\n errors.add(:end_date, \"can't be before the start date\") if @end_date < @start_date\n end\n end",
"def date_verify\n if end_date && start_date.nil?\n errors.add(:end_date, \"cannot only specify end date\")\n elsif all_day && start_date.nil?\n errors.add(:all_day, \"cannot specify without date\")\n elsif (start_date && end_date) && (start_date > end_date)\n errors.add(:start_date, \"cannot larger than end date\")\n end\n end",
"def check_dates\n calendar = Line.find(self.line_id).calendar\n\n # check empty fields\n if self.start_month.nil? \n unless self.start_date.nil?\n errors.add(:start_date, \"can't be filled if month is empty\")\n end \n else\n if self.start_month <= calendar.months.count\n unless self.start_date <= max_days = calendar.months.find_by(number: self.start_month).days_normal\n errors.add(:start_date, \"can't exceed number of days in the month (#{max_days})\")\n end\n else\n errors.add(:start_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n\n end\n\n if self.end_month.nil? \n unless self.end_date.nil?\n errors.add(:end_date, \"can't be filled if month is empty\")\n errors.add(:end_month, \"must not be empty\")\n end \n else\n if self.end_year.nil?\n errors.add(:end_month, \"can't be filled if year is empty\")\n errors.add(:end_year, \"must not be empty\")\n else\n if self.end_year < self.start_year\n errors.add(:end_year, \"can't precede start year\")\n end\n end\n\n if self.end_month <= calendar.months.count\n if self.end_month < self.start_month\n errors.add(:end_month, \"can't precede start month\")\n end\n\n unless self.end_date.nil?\n if self.end_date > max_days = calendar.months.find_by(number: self.end_month).days_normal\n errors.add(:end_date, \"can't exceed number of days in the month (#{max_days})\")\n else\n if self.end_date < self.start_date\n errors.add(:end_date, \"can't precede start date\")\n end\n end\n end\n else\n errors.add(:end_month, \"can't be greater than number of months (#{calendar.months.count})\")\n end\n \n end\n end",
"def insurance_dates_validator\n errors.add(:end_date, 'cannot be before start date.') if start_date > end_date\n end",
"def valid_dates\n if !start_date or start_date.month != 1 or start_date.day != 1\n errors.add(\"start_date\", \"Start date must be January 1st\")\n end\n if !end_date or end_date.month != 12 or end_date.day != 31\n errors.add(\"end_date\", \"End date must be December 31st\")\n end\n end",
"def dates_valid?\n date_check(params[:start_date]) && date_check(params[:end_date]) && dates_sequential?\n end",
"def validate_date?(start_date,end_date)\n\t\tstart_date <= end_date\n\tend",
"def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend",
"def start_on_before_end_on\n errors.add :start_on, 'invalid date format' if start_on.present? && !valid_date?(date: start_on)\n errors.add :end_on, 'invalid date format' if end_on.present? && !valid_date?(date: end_on)\n errors.add :start_on, 'invalid date range (Start must come before end)' if start_on.present? && end_on.present? && start_on > end_on\n end",
"def result_date_in_milestone_range\n if milestone_start != nil\n errors.add(:started_at, \" must be started after #{milestone_start}\")\n end\n\n if milestone_end != nil\n errors.add(:ended_at, \" must be ended before #{milestone_end}\")\n end\n end",
"def validate_presence_of_bonus_end_at\n if time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n errors.add(:bonus_end_at, :required)\n end\n end",
"def validate_presence_of_bonus_end_at\n if time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n errors.add(:bonus_end_at, :required)\n end\n end",
"def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end",
"def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend",
"def validate_presence_of_bonus_end_at\n return unless time_bonus_exp && time_bonus_exp > 0 && bonus_end_at.blank?\n\n errors.add(:bonus_end_at, :required)\n end",
"def valid_dates?\n if enddate && startdate && enddate <= startdate\n errors.add(:enddate, \"is before startdate\")\n end\n end",
"def validate_start_and_end_date\n errors.add(:start_date, I18n.t('spree.active_sale.event.validation.errors.invalid_dates')) if invalid_dates?\n end",
"def validate_date_range(record, start_date_attr, start_date, end_date_attr)\n # retrieve end_date value\n end_date = record.send(end_date_attr)\n\n return if date_start_before_end?(start_date, end_date)\n\n record.errors.add(start_date_attr, :before_date_error)\n record.errors.add(end_date_attr, :after_date_error)\n end",
"def validate(record)\n unless valid_preposition?(record.show_date_preposition)\n record.errors.add(:show_date_preposition, 'Invalid show date preposition')\n end\n\n unless valid_date?(record.show_date_beginning)\n record.errors.add(:show_date_beginning, 'Invalid show date beginning')\n end\n\n unless valid_unit?(record.show_date_last_unit)\n record.errors.add(:show_date_last_unit, 'Invalid show date unit')\n end\n\n unless valid_date?(record.show_date_from)\n record.errors.add(:show_date_from, 'Invalid show date from date')\n end\n\n unless valid_date?(record.show_date_to)\n record.errors.add(:show_date_to, 'Invalid show date to date')\n end\n\n unless valid_preposition?(record.date_played_preposition)\n record.errors.add(:date_played_preposition, 'Invalid date played prepos.')\n end\n\n unless valid_date?(record.date_played_beginning)\n record.errors.add(:date_played_beginning, 'Invalid date played beginning')\n end\n\n unless valid_unit?(record.date_played_last_unit)\n record.errors.add(:date_played_last_unit, 'Invalid date played unit')\n end\n\n unless valid_date?(record.date_played_from)\n record.errors.add(:date_played_from, 'Invalid date played from date')\n end\n\n unless valid_date?(record.date_played_to)\n record.errors.add(:date_played_to, 'Invalid date played to date')\n end\n end",
"def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end",
"def date_consistency\n\t\treturn if [start_date.blank?, end_date.blank?].any?\n\t\terrors.add(:end_date, 'must be after start_date') if start_date > end_date\n\tend",
"def validate_start_date_before_end_date\n\t\tif end_time <= start_time\n\t\t\terrors.add(:end_time, \"must be after start time\")\n\t\tend\n\tend",
"def validate_event; end",
"def check_date_format\n err = \"is not valid date.\"\n errors[\"from_date\"] << err unless is_date(from_date)\n errors[\"to_date\"] << err if(to_date.present? && !is_date(to_date))\n end",
"def validate_field_without_promotion\n return unless @designation_history.prev_designation_id.nil?\n begin\n if (@designation_history.new_designation_id != params[:designation_id].to_i) and (@designation_history.applicable_from == params[:designation_history][:applicable_from].to_date)\n flash.now[:error]= l(:designation_not_update_error)\n elsif (@designation_history.applicable_from != params[:designation_history][:applicable_from].to_date) and (@designation_history.new_designation_id == params[:designation_id].to_i)\n flash.now[:error] = l(:desgination_applicable_from_error)\n end\n rescue\n flash.now[:error] = l(:proper_date_error_message)\n end \n render 'systango_hrm_employees/edit' unless flash.now[:error].blank?\n end",
"def invalid_role?\r\n self.role.blank? || self.role < 0\r\n end",
"def validate\r\n only_provides :json\r\n \r\n @event = Event.new(params[event])\r\n @event.user = current_user\r\n @event.title = nil if @event.title.blank?\r\n @event.finish = nil if @event.finish.blank?\r\n # ignore timeline_event since its fields are optional now\r\n \r\n display @event.valid? || @event.errors_as_params\r\n end",
"def is_valid_role? (role_in)\n # Rails.logger.debug(\"* Models::UserRoles.is_valid_role? *** instance *** - role_in:#{role_in.inspect.to_s}\")\n valid_role? (role_in)\n end",
"def validate\r\n\r\n end",
"def check_invariants\n validEvent = true\n\n # This block checks if the start and end times are empty\n if :start_time_date.empty? or :end_time_date.empty?\n errors.add :start_time, \"should be added.\"\n validEvent = false\n end\n \n # This block checks if the number of categories is > 2\n if !categories.nil? and categories.split(',').size > 2\n errors.add :categories, \"section should only have one or two categories selected.\"\n validEvent = false\n end\n\n # This block checks if the start time is greater than the end time\n# #if (Time.strptime(self.start_time, \"%Y-%d-%m %H:%M\") > Time.strptime(self.end_time, \"%Y-%d-%m %H:%M\")) \n# if (self.start_time > self.end_time)\n# errors.add :start_time, \"should be before the end time.\"\n# validEvent = false\n# end\n\n # This block checks if the name field exists\n if (self.name.nil?)\n errors.add :name, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the description field exists\n if (self.description.nil?)\n errors.add :description, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the location field exists\n if (self.location.nil?)\n errors.add :location, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the approval_rating field exists\n if (self.approval_rating.nil?)\n errors.add :approval_rating, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_start field exists\n if (self.event_start.nil?)\n errors.add :event_start, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if the event_end field exists\n if (self.event_end.nil?)\n errors.add :event_end, \"should not be empty.\"\n validEvent = false\n end\n\n # This block checks if there are any duplicate events when submitting a new event\n if(self.id == nil) \n if (Event.exists?(:location => self.location, :start_time => self.start_time, :end_time => self.end_time))\n errors.add :location, \"invalid: Cannot be a duplicate event.\"\n validEvent = false\n end\n else\n if (Event.where(\"location = ? AND start_time = ? AND end_time = ? AND NOT id = ?\", self.location, self.start_time, self.end_time, self.id).length >= 1)\n errors.add :location, \"invalid: Created a duplicate event via editing\"\n end\n end\n\n # This block checks to make sure that the organization\n # matches the specified user\n if !can_modify?(self.user)\n errors.add :organization, \"should be one that you are a member of\"\n validEvent = false\n end\n\n return validEvent\n end",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend",
"def vdate_pin(attr)\nvalidates_presence_of attr , :message => \"^Please Fill #{attr}\"\nvalidates_format_of attr , :with => /^\\d{6}$/ ,\n :message => \"^invalid #{attr}, #{attr} is 6 digit number\"\nend",
"def validate_inventory_date\n result = true\n errors = Array.new\n current_property.room_types.each do |rt|\n if params[\"#{rt.id}\"]\n params[\"#{rt.id}\"].each do |date_inv|\n total_rooms = date_inv[1]\n # value must be positive number\n if !(total_rooms =~ /\\A[-+]?[0-9]*\\.?[0-9]+\\Z/)\n errors << t('inventories.validate.error_not_a_number', :room_type => rt.name, :date => date_inv[0])\n elsif total_rooms.to_i < 0\n errors << t('inventories.validate.error_negative_number', :room_type => rt.name, :date => date_inv[0])\n end\n end\n end\n end\n\n if !errors.empty?\n flash[:alert] = errors\n result = false\n end\n\n result\n end",
"def validate_sale_at\n return true if self.sale_start_at.nil?\n return true if self.sale_end_at.nil?\n \n if self.sale_start_at >= self.sale_end_at\n errors.add(:sale_start_at, 'must be before sale end')\n end\n \n true\n end",
"def validate_can_assign_auction_date\n if self.ready_for_auction? && \n (self.auction_datum.blank? || (self.auction_datum.present? && self.auction_datum.auction_date.blank? )) &&\n self.service_orders.joins(:service_order_details).where(\"service_order_details.status=? AND service_orders.priority=?\", ServiceOrder::SO_STATUS_APPROVED, ServiceOrder::SO_PRIORITY_HIGH).count > 0\n self.errors.add(:\"auction_datum.auction_date\", I18n.t(\"models.vehicle.errors.service_order_must_be_completed\"))\n end\n end",
"def is_date_nil\n\t\tif @start_date.blank? && @start_time.blank?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\n\t\tif @start_date.blank? && @start_time.present?\n\t\t\terrors.add(:start_date, \"Please enter a date.\")\n\t\tend\n\n\t\tif @start_time.blank? && @start_date.present?\n\t\t\terrors.add(:start_time, \"Please enter a time.\")\n\t\tend\n\tend",
"def validate_end_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{last} before #{start}\"\n errors.add(:end_date, \"can't be before the start date\") if last < start\n end",
"def validate\n\n end",
"def validate\n \n \n end",
"def rule_date_range_validation\n if self and self.from_date > self.to_date\n return [false,\"from_date should be less than to_date\"]\n else\n return true\n end\n end",
"def validations\n valid_page_number? if page_number\n valid_period_name? if period_param\n valid_date? if date_param\n end",
"def validate_checkin(event, participant)\n if participant.nil?\n :checkin_need_join_first\n elsif ! event.start_time.today?\n :checkin_in_need_the_same_day_of_event_starttime\n elsif participant.joined\n :checkin_more_than_1_time\n elsif params[:checkin_code] != event.checkin_code\n :checkin_wrong_checkin_code\n end\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def validate\n end",
"def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend",
"def validate_date_uniqueness()\n self.subject_class.attendances.each do |at|\n if self.date_created == at.date_created\n errors.add(:date, \"already existed\")\n end\n end \n end",
"def validDate\n if (Date.parse(startDate.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:startDate, 'must be a valid date')\n elsif (Date.parse(endDate.to_s) rescue ArgumentError) == ArgumentError\n errors.add(:endDate, 'must be a valid date')\n elsif startDate >= endDate\n errors.add(:endDate, 'must be after start date')\n end\n end",
"def validate_start_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{start} after #{last}\"\n errors.add(:start_date, \"can't be after the end date\") if start > last\n end",
"def validate_start_and_stop_time\n if active_time\n if active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_time, \"start time or end time not set\")\n end\n end\n end",
"def must_have_a_role\n errors.add(:roles, \"Must have a staff or admin role\") unless admin_or_staff?\n end",
"def validate_time_stamps\n\t\tif !activated_at.blank? && activated_at < Time.now then\n\t\t\terrors.add(:invalid_date, \"activated_at can not be a past date\")\n\t\tend\n\t\t#if (!deactivated_at.blank? && deactivated_at < Time.now) then\n\t\t#\t\terrors.add(:invalid_date,\" deactivated_at can not be a past date\")\n\t\t#end\n\t\tif !activated_at.blank? && !deactivated_at.blank? && activated_at > deactivated_at then\n\t\t\terrors.add(:invalid_date,\"activated_at can not be future to deactivated_at\")\n\t\tend\n\tend",
"def validates_datastream_date(*attr_names)\n\t\tdatastream_name, fields = attr_names\n\t\tvalues = self.datastreams[datastream_name].get_values(fields)\n \t\tif !values.empty? && !values.first.empty?\n \tvalues.each_with_index do |val,index|\n\t\t\t\tvalidates_date(val)\n\t\t\tend\n\t\tend\t\n\tend",
"def validate_check_in_time\n validate_time(params[:check_in][:check_in_time])\n end",
"def validation; end",
"def validation; end",
"def validate\n if (start_date > end_date || (start_date == end_date && start_time >= end_time))\n errors.add(\"end_date\", I18n.t(\"tog_conclave.fields.errors.end_date_before_start_date\"))\n end\n loc = gg.locate self.venue_address rescue nil\n #errors.add(\"venue_address\", I18n.t(\"tog_conclave.fields.errors.venue_address_error\")) if loc.nil?\n end",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end",
"def validate; end",
"def validate; end",
"def validate; end",
"def validate; end",
"def create\n @event = Event.new(event_params)\n if !(Date.valid_date?(event_params['date(1i)'].to_i,event_params['date(2i)'].to_i,event_params['date(3i)'].to_i))\n @event.errors.add(:base,\"Invalid date error\")\n @possible_times = Event::POSSIBLE_TIMES_CONST\n render :new\n elsif @event.save\n redirect_to(events_path)\n else\n @possible_times = Event::POSSIBLE_TIMES_CONST\n render :new\n end\n end",
"def custom_validations\n self.validate_baseline && validate_baseline_date && \n self.validate_trial_days && self.validates_goal_name && self.validation_due_date\n end",
"def create\n @event = Event.new(event_params)\n respond_to do |format|\n if @event.save\n @role = Role.create(permission: \"owner\", accepted: true, event_id: @event.id, user_id: @user.id, start_date: params[:event][:start_date], end_date: params[:event][:end_date])\n # format.html { redirect_to user_events_path(user_id: @user.id), notice: 'Event was successfully created.' }\n format.html { redirect_to event_path(id: @event.id), notice: 'Event was successfully created.' }\n\n format.json { render :show, status: :created, location: @event }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def validate\n validate_amount\n validate_game\n validate_period\n end",
"def checkout_before_checkin\n errors.add(:guest_id, \"Check out date must be before Check In date\") if checkin != nil && checkout != nil && checkout < checkin || checkout == checkin\n end",
"def validate_service_range\n errors.add(:service_start_date, \"service_start_date required\") unless service_start_date\n errors.add(:service_end_date, \"service_end_date required\") unless service_end_date\n if service_start_date && service_end_date\n errors.add(:service_start_date, \"service_start_date begins after service_end_date\") if service_start_date > service_end_date\n end\n end",
"def validate\n if self.start_date.present? && self.due_date.present?\n errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :start_date_cant_be_after_due_date if self.start_date > self.due_date\n # errors.add_to_base :end_date_cant_be_after_due_date if self.end_date > self.due_date\n if self.financial_year_id == '0'\n if (FinancialYear.last(:conditions => [\"start_date BETWEEN ? AND ? OR end_date BETWEEN ? AND ?\",\n self.start_date, self.due_date, self.start_date, self.due_date])).present?\n\n end\n self.financial_year_id = nil\n elsif self.financial_year_id.present?\n fy = FinancialYear.find_by_id(self.financial_year_id)\n errors.add_to_base :financial_year_must_be_set unless fy.present?\n errors.add_to_base :date_range_must_be_within_financial_year if fy.present? and\n !(self.start_date >= fy.try(:start_date) && self.due_date <= fy.try(:end_date))\n else\n # errors.add_to_base :financial_year_must_be_set\n end\n else\n\n end\n end",
"def time_valid\n if self.valid_from and self.valid_to then\n errors.add(:valid_from,\n \"must be before the valid to date. #{self.valid_from} >= #{self.valid_to}\") unless self.valid_from < self.valid_to\n else\n if self.valid_from or self.valid_to then\n errors.add(:valid_from,\n \" must be set when valid_to is set.\") unless self.valid_from\n errors.add(:valid_to,\n \" must be set when valid_from is set.\") unless self.valid_to\n end\n end\n end",
"def start_date_cannot_be_in_the_past\n if self.start_date && self.start_date < DateTime.now\n errors.add(:date, \"invalid. Start date can't be in the past\")\n end\nend",
"def validate_dates_cannot_be_in_the_past\n if self.promised_pickup_date.present? && self.promised_pickup_date_changed? && (self.promised_pickup_date.in_time_zone < Date.today.in_time_zone) && self.in_or_before_state?(:wtg_for_trip_confirmation)\n self.errors.add(:promised_pickup_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end\n if self.hold_for_pickup_date.present? && self.hold_for_pickup_date_changed? && self.hold_for_pickup_date < Date.today\n self.errors.add(:hold_for_pickup_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end\n if self.sale_hold_action_date.present? && self.sale_hold_action_date_changed? && self.sale_hold_action_date < Date.today\n self.errors.add(:sale_hold_action_date, I18n.t(\"models.vehicle.errors.date_cannot_be_past\"))\n end \n end",
"def validate_attendances_uniqueness\n attendances.each do |attendance|\n next if attendance.justification_ids.blank?\n errors.add(:attendance_ids, \"a falta de #{attendance.date.month}/#{attendance.date.year} já tem justificativo.\")\n end\n end",
"def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end",
"def validate\n raise ValidationError, \"ID is required\" if id.nil?\n raise ValidationError, \"Version is required\" if version.nil?\n raise ValidationError, \"Issue instant is required\" if issue_instant.nil?\n raise ValidationError, \"Issue instant must be UTC\" unless issue_instant.utc?\n end",
"def validate\n carrier_fk = carrier_id if carrier_fk.nil?\n if id.nil?\n date_array = FeeSchedule.find(:all,:conditions=>[\"carrier_id =? and practice_id = ? \",carrier_fk,practice_id]).collect{|x|[x.start_date,x.end_date]} if carrier_fk != 0\n else\n date_array = FeeSchedule.find(:all,:conditions=>[\"carrier_id =? and practice_id = ? and id != ? \",carrier_fk,practice_id,id]).collect{|x|[x.start_date,x.end_date]} if carrier_fk != 0\n end\n start_error = \"\"\n if !date_array.nil?\n for start_d,end_d in date_array\n unless start_date.nil?\n if start_date.to_date >= start_d.to_date and start_date.to_date <= end_d.to_date\n start_error =\"error\"\n end\n end \n unless end_date.nil?\n if end_date.to_date >= start_d.to_date and end_date.to_date <= end_d.to_date\n start_error =\"error\"\n end\n end \n end\n end\n errors.add(\"Selected Date Range already Exists for the Carrier. selected date range for the carrier\") unless start_error.empty?\n unless start_date.nil?\n unless end_date.nil?\n errors.add(\"End date should be greater than start date, End Date \") unless end_date.to_date > start_date.to_date\n end\n end\n if charge_type == 'Standard'\n if id.nil?\n dat_array_charge_type = FeeSchedule.find(:all,:conditions=>[\"charge_type =? and practice_id = ? \",\"Standard\",practice_id]).collect{|x|[x.start_date,x.end_date]}\n else\n dat_array_charge_type = FeeSchedule.find(:all,:conditions=>[\"charge_type =? and practice_id = ? and id != ?\",\"Standard\",practice_id,id]).collect{|x|[x.start_date,x.end_date]}\n end\n start_error_charge_type = \"\"\n for start_d_charge_type,end_d_charge_type in dat_array_charge_type\n unless start_date.nil?\n if start_date.to_date >= start_d_charge_type.to_date and start_date.to_date <= end_d_charge_type.to_date\n start_error_charge_type =\"error\"\n end\n end\n unless end_date.nil?\n if end_date.to_date >= start_d_charge_type.to_date and end_date.to_date <= end_d_charge_type.to_date\n start_error_charge_type =\"error\"\n end\n end \n end \n errors.add(\"Selected Date Range already Exists for the Practice. selected Date range for the Practice\") unless start_error_charge_type.empty? \n end\n end",
"def validate_event=(_arg0); end",
"def check_end_date\n if end_date < Date.today\n \n errors.add(:end_date, \"End Date can only be later than today\")\n end\n end",
"def validates_dates\n ( Date.parse(self['birth_date']) rescue errors.add(:birth_date, 'invalid.date') ) if !self['birth_date'].blank?\n ( Date.parse(self['ffck_number_date']) rescue errors.add(:ffck_number_date, 'invalid.date') ) if !self['ffck_number_date'].blank?\n ( Date.parse(self['medical_certificate_date']) rescue errors.add(:medical_certificate_date, 'invalid.date') ) if !self['medical_certificate_date'].blank?\n ( Date.parse(self['tetanus_vaccine_date']) rescue errors.add(:tetanus_vaccine_date, 'invalid.date') ) if !self['tetanus_vaccine_date'].blank?\n end",
"def initialize(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n validate!\n end",
"def validacion_fecha\n if !check_in.blank? && check_in < Date.today\n errors.add(:check_in, \"menor a fecha actual\")\n \t elsif !check_out.blank? && check_out < Date.today\n \t errors.add(:check_out, \" menor a fecha actual\")\n \t elsif !check_out.blank? && check_out < check_in\n \t errors.add(:check_out, \"no puede ser menor al check_in\")\t\n end\n end",
"def test_valid_with_attributes\r\n fee_schedule = FeeSchedule.new\r\n fee_schedule.start_date = fee_schedules(:fee_schedule_00001).start_date\r\n fee_schedule.end_date = fee_schedules(:fee_schedule_00001).end_date\r\n assert fee_schedule.valid?, fee_schedule.errors.full_messages \r\n end",
"def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end",
"def valid_before; end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end",
"def validate_date(spreadsheet_id)\n date = get_date_array(spreadsheet_id)\n if date[0].to_i >= 1 and date[0].to_i <= 12 and date[1].to_i == 1 and date[2].to_i >= 2016 and get_start_day(date[3]) != nil\n return true\n else\n return false\n end\nend"
] |
[
"0.65318817",
"0.6463052",
"0.6332521",
"0.631046",
"0.62875867",
"0.6254319",
"0.6239401",
"0.6222454",
"0.6222454",
"0.6180557",
"0.61698115",
"0.6161679",
"0.61495787",
"0.6117884",
"0.60653234",
"0.6008963",
"0.59879816",
"0.5962545",
"0.59483576",
"0.59483576",
"0.59479934",
"0.5943411",
"0.59038436",
"0.5879499",
"0.58744717",
"0.5869831",
"0.579675",
"0.5786975",
"0.57847327",
"0.5779448",
"0.57767725",
"0.57755035",
"0.5775466",
"0.5766269",
"0.5727922",
"0.57059723",
"0.5702085",
"0.56950164",
"0.5688558",
"0.5688558",
"0.56884855",
"0.56788385",
"0.5672202",
"0.56646967",
"0.5658333",
"0.5656192",
"0.56529653",
"0.5652426",
"0.5628427",
"0.56251013",
"0.56217915",
"0.5613706",
"0.5613706",
"0.5613706",
"0.55995977",
"0.55995977",
"0.55995977",
"0.55906415",
"0.55874026",
"0.5582608",
"0.5579503",
"0.5578847",
"0.55752915",
"0.55710036",
"0.5562992",
"0.555028",
"0.5548824",
"0.5548824",
"0.55318177",
"0.5530912",
"0.5530912",
"0.5528332",
"0.5528332",
"0.5528332",
"0.5528332",
"0.55282646",
"0.552232",
"0.5520333",
"0.5515072",
"0.5514649",
"0.5508298",
"0.5501679",
"0.5492073",
"0.5491589",
"0.54902416",
"0.54866844",
"0.5486089",
"0.54833263",
"0.5482934",
"0.54823726",
"0.5478832",
"0.54753125",
"0.5473708",
"0.54694563",
"0.5467675",
"0.5467511",
"0.54591703",
"0.5459118",
"0.54587406",
"0.54524916",
"0.5437765"
] |
0.0
|
-1
|
Attempt to push an item on the queue. If the queue is full, then the behavior is determined by the :drop_oldest setting provided to the constructor. Returns true if the object was pushed on the queue, or false if the queue was full.
|
def enqueue(object_)
result_ = true
if @push_ptr
if @pop_ptr == @push_ptr
if @drop_oldest
@pop_ptr += 1
@pop_ptr = 0 if @pop_ptr == @buffer.size
result_ = false
else
return false
end
elsif @pop_ptr.nil?
@pop_ptr = @push_ptr
end
@buffer[@push_ptr] = object_
@push_ptr += 1
@push_ptr = 0 if @push_ptr == @buffer.size
else
@buffer.push(object_)
end
result_
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_last(value)\n if @queue.size < @size\n @queue.push(value)\n true\n else\n false\n end\n end",
"def pushed?\n !pushed_at.nil?\n end",
"def insert_front(value)\n if @queue.size < @size\n @queue.unshift(value)\n true\n else\n false\n end\n end",
"def push(key)\n synchronize do\n top = @map[key]\n if !top || top.empty?\n return false\n end\n\n @queue.synchronize do\n enqueue(top)\n @queue << top\n @map.delete(key)\n end\n\n return true\n end # synchronize\n end",
"def pushed?\n !!self.pushed_at\n end",
"def push(something)\n\t\t@mutex.synchronize do\n\t\t\tnow = Time.now\n\t\t\tif (something != @store.last) or (now > (@last_time + @interval))\n\t\t\t\t# Either something was not seem by last or it was but interval has passed.\n\t\t\t\t@store.push something\n\t\t\t\t(@store.shift if @store.length > @size) unless @size.nil?\n\t\t\t\t@last_time = now\n\t\t\t\tchanged\n\t\t\t\tnotify_observers(something)\n\t\t\t\treturn true\n\t\t\telse\n\t\t\t\t@last_time = now\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\tend",
"def delete_last()\n if @queue.size > 0\n @queue.pop\n return true\n end\n false\n end",
"def pushed?\n !!self.pushed_att\n end",
"def delete_front()\n if @queue.size > 0\n @queue.shift\n return true\n end\n false\n end",
"def push(value)\n\t\t\tif @storage.insert(0, value)\n\t\t\t\ttrue\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\tend",
"def en_queue(value)\n return false if self.is_full\n\n @queue[@rear] = value\n if @rear == @queue.size - 1\n @rear = 0\n else\n @rear += 1\n end\n true\n end",
"def push(obj)\n if @blocked\n raise \"Nothing can be added to queue. Queue is blocked.\"\n else\n super(obj)\n end\n end",
"def queue_full?\n free_slots == 0\n end",
"def push(item = nil)\n @mutex.synchronize do\n raise ClosedQueueError if closed?\n @items.push(item)\n @waiter.resume_next\n end\n self\n end",
"def push(obj)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end",
"def enqueued?\n !!@handle\n end",
"def full?\n # absolute value of @tail is equal to the number of slots in the queue (@size)\n @tail.abs == (@size)\n end",
"def queued?\n @queued\n end",
"def enqueue(el)\n @queue.push(el)\n true\n end",
"def queued?\n @state == STATE_QUEUED\n end",
"def last_in_queue?\n return false unless in_queue?\n self.send(queue_position_column) == bottom_queue_position_in_queue\n end",
"def empty?\n synchronize do\n return false if @publishing || @canceled || @stopping\n\n @items.empty? && @queue.empty?\n end\n end",
"def en_queue(value)\n if is_full() == true\n return false\n end\n\n @rear = (@rear + 1) % (@q.length)\n @q[@rear] = value\n @length += 1\n return true\n end",
"def should_flush?\n (!queue.blank? && count >= size)\n end",
"def in_queue?\n !send(queue_position_column).nil?\n end",
"def enqueue(metric)\n if @queue.length < @max_queue_size\n @queue << metric\n ensure_worker_running\n\n true\n else\n logger.warn(\n 'Queue is full, dropping events. The :max_queue_size ' \\\n 'configuration parameter can be increased to prevent this from ' \\\n 'happening.'\n )\n false\n end\n end",
"def queued_messages?\n @pointer < @buffer.length\n end",
"def push_only?\n chunks.each { |c| return false if !c.opcode.nil? && c.opcode > OP_16 }\n true\n end",
"def queued_messages?\r\n @pointer < @buffer.length\r\n end",
"def size?\n @queue.length\n end",
"def is_full()\n @queue.size == @size\n end",
"def first_in_queue?\n return false unless in_queue?\n self.send(queue_position_column) == 1\n end",
"def push(input_item)\n raise 'Queue is closed!' if @closed\n\n @logger.debug(\"Pushing into #{@name} values: #{input_item}\")\n @mutex.synchronize do\n until offer(input_item)\n @full.wait(@mutex)\n @logger.debug(\"#{@name} is waiting on full\")\n end\n @empty.broadcast\n end\n @logger.debug(\"Finished pushing int #{@name}: #{input_item}\")\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n # index of the last item in @store is equal to -1 (what it's equal to when Stack is created)\n @top == -1\n end",
"def empty?\n @queued.empty?\n end",
"def empty?\n\t\t@queue.empty?\n\tend",
"def push(obj)\n @mutex.synchronize do\n @queue.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\n end",
"def empty?\n @queue.empty?\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 push(message, timeout = nil)\n pushed_op = @Mutex.synchronize do\n return timeout ? true : self if ns_try_push(message)\n\n pushed = Promises.resolvable_future\n # TODO (pitr-ch 06-Jan-2019): clear timed out pushes in @PendingPush, null messages\n @PendingPush.push message, pushed\n pushed\n end\n\n result = pushed_op.wait!(timeout, [true, self, nil])\n result == pushed_op ? self : result\n end",
"def empty?\n self.queue_size == 0\n end",
"def is_full()\n @queue.count { _1 } == @queue.size\n end",
"def push(obj)\n @mutex.synchronize{\n @que.push obj\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end",
"def should_enque?(time)\n return false if disabled?\n return false if not_pass_next_enqueue_time?(time)\n\n # support old data without next_enqueue_timestamp\n return false if did_pass_prev_enqueue_time?(time)\n\n true\n end",
"def queued?\n Resque.info.fetch(:pending) > 10\n end",
"def is_empty()\n @queue.size == 0\n end",
"def push(element)\n# If the array is too capacity, or if we try to push in nil, return nil.\n if full? or element.nil?\n nil\n# Otherwise, put the element in the array.\n else\n # why do we want @top to be @top + 1?\n @top = @top.succ\n # The element is the next item in the array. I guess if we keep taking the\n # element at index -1, it will be nil. I used pry to investigate:\n # @store=[3, 2, 6, 5, nil, nil]\n # The positions will be occupied by nil if we don't have an element there.\n @store[@top] = element\n # The instance of push will be returned??\n self\n end\n end",
"def queued?\n status.queued?\n end",
"def push(element)\n # if Stack is full or the element you're trying to add = nil, cannot add anything\n if full? or element.nil?\n nil\n else\n # +1 added to @top because there is one more item in the Stack\n @top = @top.succ\n # new item actually added to @store array\n @store[@top] = element\n # returns Stack\n self\n end\n end",
"def queued?\n PlayQueue.songs.include?(self)\n end",
"def enqueue?(data)\n result = false\n\n begin\n # uses unix domain socket\n sock_path = @sock_path\n enq_sock = UNIXSocket.new(sock_path)\n \n packet = add_header(data)\n\n Lgdisit.logger.info(LgdisitUtil.get_bracketed_string(self.object_id.to_s) + \"Send: \" + packet)\n enq_sock.send packet,0\n result = true\n rescue => exception\n result = false\n Lgdisit.logger.error(exception) \n ensure\n if !enq_sock.nil?\n enq_sock.close \n Lgdisit.logger.info(LgdisitUtil.get_bracketed_string(self.object_id.to_s) + \"Socket closed.\")\n end\n end\n\n return result\n end",
"def queued?\n @mutex.synchronize { @task_queued }\n end",
"def push_one(item)\n # we're expecting item to be a single item so simply normalize it\n payload = normalize_item(item)\n\n # if successfully persisted to redis return this item's `jid`\n pushed = false\n pushed = raw_push([payload]) if payload\n pushed ? payload[:jid] : nil\n end",
"def include?(item)\n @queue.include?(item)\n end",
"def kgio_autopush?()\n #This is a stub, used for indexing\n end",
"def inQueue\n return @bodyStart < 0\n end",
"def push(obj)\n @queue.put(obj)\n end",
"def test_isEmptyOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( false , @queue.empty? )\n end",
"def en_queue(value)\n if self.openings > 0\n self.openings -= 1\n @head = @head == nil ? 0 : (@head + 1) % @size\n @q[@head] = value \n true\n else\n false\n end\n end",
"def push(element)\n # beginnig of if statement\n # if the method full? returns true or the value of the local var element is nil\n if full? or element.nil?\n # return nil\n nil\n # if the method full? returns false or the value of the local var element is not nil\n else\n # take the value of the variable @top and add one to it\n # assign this new value back to the var @top\n @top = @top.succ\n # assign the value of the local var element\n # to the position in the array @store at the value of @top\n @store[@top] = element\n # return self\n self\n # end if/else statement\n end\n # end push method\n end",
"def push(obj, prio)\n @mutex.synchronize{\n while true\n break if @que.length < @max\n @queue_wait.push Thread.current\n @mutex.sleep\n end\n\n @que.insert find_first_of(prio), [ obj, prio ]\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end",
"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 push(item)\n\t @items.push(item)\n\t # add to the maximum if the maximum is empty \n\t # or the newest item is greater than the old maximum\n\t @max.push(item) if @max.empty? || item >= @max.last\n\tend",
"def push element\n if full?\n raise ArgumentError, \"buffer is full, and override_when_full is false\" unless @override_when_full\n \n @buffer[@newest] = element;\n @newest += 1\n @oldest += 1\n else\n @buffer[@newest] = element;\n @newest += 1\n @fill_count += 1 \n end\n\n if @oldest >= @buffer.count\n @oldest = 0\n end\n\n if @newest >= @buffer.count\n @newest = 0\n end\n end",
"def is_empty()\n @queue.count { _1 } == 0\n end",
"def empty?\n # @head and @tail are equal to what they were when the Queue was created\n @head == -1 and @tail == 0\n end",
"def queued?\n job_queued?\n end",
"def push_possible?(options = {})\n unless push_type_supported?\n @errors.add(push_target, \"#{push_type_name} not supported for '#{@errata.fulladvisory}'.\")\n return false\n end\n\n unless can_push?(options)\n @errors.add(push_target, \"Can't push advisory to #{push_type_name} now due to: #{push_blockers(options).join(\", \")}\")\n return false\n end\n\n if existing_job = self.job_klass.active_job_for(@errata)\n # Active job exists\n @errors.add(push_target, \"An <a href='/push/push_results/#{existing_job.id}'>existing #{self.job_klass.name.titleize}</a> is already running. You will need to cancel it to schedule a new one.\")\n return false\n end\n\n return true\n end",
"def can_remove_no_wait?\n @queue.size > @num_waiting\n end",
"def can_remove_no_wait?\n @queue.size > @num_waiting\n end",
"def push(item)\n @stack.push(item)\n if !@maxs_stack.peek() || item >= @maxs_stack.peek()\n @maxs_stack.push(item)\n end\n end",
"def requeue?\n !self.success? && (@requeue === true || @requeue === :requeue)\n end",
"def test_peekOnNonEmptyQueue\n @queue.enqueue(100)\n assert_equal( 100 , @queue.peek )\n end",
"def push(x)\n @queue << x\n end",
"def exists?\n queue_exists?(@name)\n end",
"def push(element)\n #if the stack is already full or the element is nil, do nothing\n if full? or element.nil?\n nil\n else\n #Add 1 to the value of @top\n @top = @top.succ\n #sets the value at the top of the stack to element\n @store[@top] = element\n #returns it self\n self\n end\n end",
"def can_remove_no_wait?\n @queue.size > @num_waiting\n end",
"def eof?; queue.closed? && queue.empty? end",
"def push(element)\n #if the stack is full or the element is nil don't add it to the stack\n if full? or element.nil?\n nil\n else\n #increment top by one\n @top = @top.succ\n #store the element in the new top's position\n @store[@top] = element\n #return the instance of the stack\n self\n end\n end",
"def push(element)\n #if the stack is full or the element is nil don't add it to the stack\n if full? or element.nil?\n nil\n else\n #increment top by one\n @top = @top.succ\n #store the element in the new top's position\n @store[@top] = element\n #return the instance of the stack\n self\n end\n end",
"def push(item)\n @items.push(item)\n @max.push(item) if !@max.last || item > @max.last\n end",
"def push(obj, prio)\n @mutex.synchronize{\n @que.insert find_first_of(prio), [ obj, prio ]\n begin\n t = @waiting.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n }\n end",
"def any?\n !@queue.empty?\n end",
"def empty()\n @push_queue.empty? and @pop_queue.empty?\n end",
"def push_dup\n push(@store.last) if size > 0\n end",
"def queueing?\n offline? && @state != :flushing\n end",
"def push_queue_push val\n return nil if self.push_queue_names.length == 0\n key = self.push_queue_names[rand(self.push_queue_names.length - 1)]\n self.debug_out \"pushing data onto push queue #{key}\"\n @redis.lpush key, Marshal.dump(val)\n key\n end",
"def de_queue\n unless is_empty\n @q[@tail] = nil\n @tail = (@tail + 1) % @size\n @openings += 1\n true\n else\n false\n end\n end",
"def push(element)\n # we can't put nil onto the stack, and we can't add to the stack if it is full\n if full? or element.nil?\n nil\n else\n # we need to move our top marker to the new element, which is now the top\n @top = @top.succ\n # and we actually put that element here, in our new top index\n @store[@top] = element\n # explicit return of the stack, i think\n self\n end\n end",
"def push(reference)\n if reference\n @lock.synchronize do\n @queue.push(reference)\n end\n end\n end",
"def held?\n status.queued_held?\n end",
"def ripe?\n !!message_queue.detect {|msg| msg.ripe?}\n end",
"def push(x)\n @queue.push(x)\n nil\n end",
"def pending_data?\n !pending_queues.empty?\n end",
"def pop(*args)\n retval = super\n @mutex.synchronize {\n if @que.length < @max\n begin\n t = @queue_wait.shift\n t.wakeup if t\n rescue ThreadError\n retry\n end\n end\n }\n retval\n end"
] |
[
"0.6784146",
"0.64809525",
"0.6380965",
"0.6276838",
"0.6215338",
"0.6041882",
"0.6004543",
"0.5968675",
"0.5930533",
"0.59057665",
"0.58883005",
"0.5886998",
"0.58579034",
"0.582185",
"0.5792463",
"0.57783526",
"0.5770018",
"0.57606775",
"0.57606065",
"0.5740639",
"0.5736608",
"0.5734023",
"0.5723292",
"0.5704787",
"0.5690862",
"0.56698847",
"0.56623375",
"0.56604254",
"0.56470144",
"0.5640488",
"0.56176347",
"0.5615461",
"0.5602163",
"0.55977416",
"0.5592343",
"0.5584371",
"0.5567678",
"0.5567263",
"0.55645335",
"0.55455637",
"0.55455637",
"0.55455637",
"0.5537092",
"0.5520999",
"0.5508819",
"0.5490626",
"0.5482414",
"0.5478953",
"0.5476731",
"0.5476673",
"0.547633",
"0.5466169",
"0.5458574",
"0.54534966",
"0.54510516",
"0.543877",
"0.5435336",
"0.5411095",
"0.5398547",
"0.536196",
"0.5354646",
"0.53240556",
"0.5324024",
"0.53193146",
"0.5296735",
"0.529476",
"0.5292686",
"0.52859867",
"0.527443",
"0.52742076",
"0.52576804",
"0.5251108",
"0.52238554",
"0.52169377",
"0.52007985",
"0.5194589",
"0.51944405",
"0.5194162",
"0.5187663",
"0.51859844",
"0.5172753",
"0.5172531",
"0.51665324",
"0.5158751",
"0.5158751",
"0.5157068",
"0.51536757",
"0.51508564",
"0.5144776",
"0.51446474",
"0.5133827",
"0.5132675",
"0.51263213",
"0.512441",
"0.51155925",
"0.5109543",
"0.51043975",
"0.5095281",
"0.5091837",
"0.50871474"
] |
0.7238949
|
0
|
Return the oldest item in the queue, or nil if the queue is empty.
|
def dequeue
if @push_ptr
if @pop_ptr
object_ = @buffer[@pop_ptr]
@buffer[@pop_ptr] = nil
@pop_ptr += 1
@pop_ptr = 0 if @pop_ptr == @buffer.size
@pop_ptr = nil if @pop_ptr == @push_ptr
object_
else
nil
end
else
@buffer.shift
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_front()\n if @queue.size > 0\n return @queue[0]\n end\n -1\n end",
"def peek()\n @queue.first\n end",
"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 top()\n return @pop_queue.first\n end",
"def peek\n\t\t@queue.first\n\tend",
"def top()\n @queue[0]\n end",
"def front()\n self.is_empty ? -1 : @queue[@front]\n end",
"def peek; @queue[-1] end",
"def peek\n raise QueueUnderflow if empty?\n @info[0]\n end",
"def get_next\n while next_item = @queue.peek\n if next_item.cancelled?\n @queue.shift\n else\n return next_item\n end\n end\n\n return nil\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def peek \n self.queue_var[-1]\n end",
"def peek\n return nil if empty?\n\n @heap[0]\n end",
"def peek()\n @q.first\n end",
"def peek()\n return nil if @items.empty?\n return @items[-1]\n end",
"def get_min\n minimum = @store.pop\n until @store.empty?\n element = @store.pop\n if minimum > element\n minimum = element\n end\n end\n minimum\n end",
"def get_rear()\n if @queue.size > 0\n return @queue[-1]\n end\n -1\n end",
"def min\n @store.peek[:min] unless empty?\n end",
"def top\n return nil if empty?\n @que.last\n end",
"def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end",
"def higher_item_in_queue\n return nil unless in_queue?\n acts_as_queue_class.find(:first, :conditions =>\n \"#{queue_scope_condition} AND #{queue_position_column} = #{(send(queue_position_column).to_i - 1).to_s}\"\n )\n end",
"def oldest\n @messages.first\n end",
"def dequeue\n @mutex.synchronize do\n # Check if the queue is empty.\n if @head == @tail # not using empty? to avoid extra synchronize block\n return nil\n end\n\n # Remove next object.\n object = @queue[@head]\n @queue[@head] = nil\n\n @head = (@head + 1) & @max_mask\n return object\n end\n end",
"def peek()\n if @queue_out.size == 0\n if @queue_in.size == 0\n return\n end\n\n while @queue_in.size > 0\n @queue_out.push(@queue_in.pop)\n end\n end\n\n return @queue_out.last\n end",
"def poll()\n return nil if self.heap_container.length == 0\n return self.heap_container.pop() if self.heap_container.length == 1\n \n item = self.heap_container.pop()\n self.heap_container[0] = self.heap_container.pop()\n self.heapify_down()\n return item\n end",
"def pop\n if @q.empty?\n raise QueueEmptyError, \"tried to pop empty queue in #{@component.inspect}\"\n end\n obj = @q.shift\n @component.dec_queue_ready_count if @q.empty?\n obj\n end",
"def peekMin()\n @store[1]\n end",
"def lower_item_in_queue\n return nil unless in_queue?\n acts_as_queue_class.find(:first, :conditions =>\n \"#{queue_scope_condition} AND #{queue_position_column} = #{(send(queue_position_column).to_i + 1).to_s}\"\n )\n end",
"def get_min()\n # smallest = Float::INFINITY\n # @stack.each do |item|\n # if item < smallest\n # smallest = item\n # end\n # end\n # return smallest\n @stack.min\n end",
"def peek\n return self.heap[0]\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def min\n empty? ? Float::INFINITY : @list.head.value[1]\n end",
"def shift!\n shifted = @queue.shift\n\n return nil if shifted.nil?\n shifted[0]\n end",
"def peek\n item = pop\n push(item)\n item\n end",
"def peek_first\n raise 'No such element' if @size == 0\n @head.value\n end",
"def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end",
"def pop()\n head_index = get_document(@head_index_key)\n tail_index = get_document(@tail_index_key)\n if tail_index > head_index # if there is an item in the queue\n increase_atomic_count(@head_index_key) #incremented new_head_index is ignored, but we are incrementing and popping value\n return get_document(\"#{@key}::#{head_index + 1}\")\n else # \n nil\n end\n end",
"def dequeue\n raise 'Queue is empty' if self.empty?\n\n el = @queue[@head]\n\n if @head == @length - 1\n @head = 0\n else\n @head += 1\n end\n\n if @head == @tail\n self.reset\n end\n\n return el\n end",
"def pop\n if @queue.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 tempItem\n end\n end",
"def dequeue\n min = @pqueues.each.select{|tuple| !tuple.last.empty? }.min_by do |tuple|\n generation = tuple.first\n tuple.last.min[1] + @costs[generation]\n end\n\n return nil if min.blank?\n\n min.last.delete_min[0]\n end",
"def front()\n return is_empty() ? -1 : @q[@front]\n end",
"def pop\n entry = queue.pop[:payload]\n if (entry != :queue_empty)\n Marshal.load(entry)\n else\n nil\n end\n end",
"def min()\n return \"Stack is empty.\" if is_empty\n\n current = @head\n min = current.value\n\n while current != nil\n if current.value < min\n min = current.value\n end\n\n current = current.next\n end\n\n return min\n end",
"def dequeue\n # if queue is empty, cannot remove anything\n if empty?\n nil\n else\n # +1 added to @tail because the queue is going to be one item shorter now\n @tail = @tail.succ\n # dequeued is set equal to the item at the front of the queue\n dequeued = @store[@head]\n # adds a nil to the \"front\" of @store (but this is actually the back of the queue)\n @store.unshift(nil)\n # removes the last item from @store (first item in the queue)\n @store.pop\n # returns the item removed from the queue\n dequeued\n end\n end",
"def earliest!\n earliest_order!.first\n end",
"def dequeue\n #if the queue is already empty, does nothing\n if empty?\n nil\n\n else\n #adds 1 to @tail\n @tail = @tail.succ\n #sets a local variable to the value at the top of the array\n dequeued = @store[@head]\n #adds nil to the tail of the array\n @store.unshift(nil)\n #takes off the element at the top of the array\n @store.pop\n #returns the value that was at the top of the array that has just been removed\n dequeued\n end\n end",
"def dequeue\n # check if queue is empty \n raise ArgumentError, \"Queue is empty\" if self.empty? \n \n element = @store[@front]\n \n # check last element removed\n if (@front == @back)\n @front = @back = -1 \n elsif @front + 1 == MAX_BUFFER\n @front = 0\n # nominal case\n else\n @front += 1\n end\n\n return element\n end",
"def peek()\n if @queue_out.size == 0 \n if @queue_in.size == 0 \n return \n end\n \n while @queue_in.size > 0 \n @queue_out.push(@queue_in.pop)\n end\n end\n \n return @queue_out.last\n end",
"def next\n @mutex.synchronize do\n until @close_now\n a = @queue.shift\n @logger.debug(\"#{@name}'s queue shifted to: #{a}\")\n if !a.nil?\n @full.broadcast\n @empty.broadcast\n return a\n else\n @logger.debug(\"#{@name}'s queue is currently closed?: #{closed?}\")\n return nil if closed?\n\n @empty.wait(@mutex)\n end\n end\n end\n end",
"def pop()\n @queue.shift\n end",
"def front\n return -1 if self.is_empty\n @q[@tail]\n end",
"def priority\n return nil if @queues.empty?\n get_next_queue.priority\n end",
"def dequeue\n # raise NotImplementedError, \"Not yet implemented\"\n #check if front is empty, if yes, return nil\n if @front == -1\n return nil\n #otherwise if front IS the rear, then the queue is full\n elsif @front == @rear\n raise Error, \"Full up here\"\n #not empty\n else \n #do same thing as the enqueue\n new_front = (@front + 1) % queue_size\n temp = @store[@front]\n @store[@front] = nil\n @front = new_front\n end\n return temp\n end",
"def min_value\n if @head.nil?\n return nil\n else\n if head.left\n min_value = min_search(head.left).data\n else\n min_value = head.data\n end\n end\n return min_value\n end",
"def pop()\n res = @pop_queue.shift()\n return res\n end",
"def peek\n empty? ? nil : @head.value\n end",
"def peek\n if empty?\n nil\n else\n @stack.first\n end\n end",
"def find_min\n if @head == nil # empty list case\n # puts \"Error: The linked list is empty. Cannot compute min.\"\n return nil\n end\n\n current = @head\n min = current.data\n current = current.next\n while current != nil\n if current.data < min\n min = current.data\n end\n current = current.next\n end\n return min\n end",
"def peek\n @head ? @head.value : nil\n end",
"def peek()\n @head.nil? ? nil : @head.val\n end",
"def get_min()\n # O(1) time\n @min.last\n end",
"def pop\n @mutex.synchronize do\n loop do\n if @queue.empty?\n @waiting.push Thread.current\n @mutex.sleep\n else\n return @queue.shift\n end\n end\n end\n end",
"def dequeue\n @q.shift\n end",
"def dequeue\n @queue.shift\n end",
"def earliest\n earliest_order.first\n end",
"def get_min()\n return self.min_stack[-1]\n end",
"def min_item\n list.min do |a, b|\n return -1 if a[0].null_item?\n return 1 if b[0].null_item?\n a[1] <=> b[1]\n end\n end",
"def min()\n return \"Stack is empty.\" if is_empty\n\n min = @stack[-1]\n\n @stack.each do | i |\n min = i if i < min\n end\n\n return min\n end",
"def peek\n raise IndexError.new if @data.size == 0\n return @data[0]\n end",
"def get_min()\n @min_stack[-1]\n end",
"def get_min()\n @min_stack[-1]\n end",
"def pop()\n min_dist = 1.0/0.0\n min_tuple = nil\n @queue.each{ |tuple|\n if(tuple.distance < min_dist)\n min_dist = tuple.distance\n min_tuple = tuple\n end\n }\n return @queue.delete(min_tuple)\n end",
"def depq\n in_queue? ? depq_or_subpriority() : nil\n end",
"def min\n @v.compact.min\n rescue\n nil\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 higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def rear()\n self.is_empty ? -1 : @queue[@rear - 1]\n end",
"def pop\n if empty?\n nil\n else\n @q.remove\n @stack.shift\n end\n end",
"def find_min\r\n \r\n if @head.nil?\r\n return nil \r\n end\r\n \r\n # current = @head\r\n min = @head.data\r\n current = @head\r\n \r\n # was failing tests until I realized stop condition for min/max traverse needs to be AFTER the end of list (current.nil?) not last node in list (current.next.nil?)\r\n until current.nil?\r\n if current.data < min \r\n min = current.data\r\n end\r\n current = current.next\r\n end\r\n \r\n return min\r\n end",
"def peek\n if @count > 0\n @items[@count - 1]\n else\n raise \"There are no items in the stack\"\n end\n end",
"def oldest relative_index = 0\n raise ArgumentError, \"buffer is empty\" if empty?\n raise ArgumentError, \"relative_index is greater or equal to @fill_count\" if relative_index >= @fill_count\n \n absIdx = @oldest + relative_index;\n if(absIdx >= @buffer.count)\n absIdx -= @buffer.count;\n end\n \n return @buffer[absIdx];\n end",
"def min\n @keys[0]\n end",
"def peek_min\n if next_head = self.head.sibling\n current_head = self.head\n while next_head \n next_head < current_head ? @min = next_head : @min = current_head\n current_head = next_head\n next_head = next_head.sibling \n end\n else\n @min = self.head\n end\n @min\n end",
"def get_first\r\n # if the list is empty, head is nil\r\n if @head.nil?\r\n return nil\r\n else \r\n value = @head.data\r\n return value\r\n end\r\n end",
"def first_movie (queue)\n queue.first\n end",
"def dequeue\n @items.shift\n end",
"def top(_tag=nil)\n return @stack.last.obj if _tag.nil?\n @stack.reverse_each do |item|\n return item.obj if item.tag == _tag\n end\n return nil\n end",
"def min\n self.reduce('lambda{|memo, item| memo < item ? memo : item }')\n end",
"def find_min\r\n return nil if !@head\r\n\r\n min = @head.data\r\n curr = @head \r\n \r\n while curr \r\n min = curr.data if curr.data < min \r\n curr = curr.next\r\n end\r\n\r\n return min\r\n end",
"def get_first\r\n return @head ? @head.data : nil\r\n end",
"def earliest(key, min)\n _request_id, time = @store.zrangebyscore(key, \"(#{min}\", '+inf', withscores: true, limit: [0, 1]).first\n time\n end",
"def peek\n return @push if !@push.nil?\n return nil if @input.nil?\n return nil if @input.empty?\n return nil if @index >= @input.size\n @input[@index]\n end",
"def peek( queue_name )\n get( queue_name, :peek => true )\n end",
"def get_first\n return head ? head.data : nil\n end",
"def first\n return @front.head unless @front.empty?\n @rear.last # memoize?\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def top()\n return @head ? @head.val : nil\n end",
"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"
] |
[
"0.74382603",
"0.72326887",
"0.7223011",
"0.7161646",
"0.69525766",
"0.6934586",
"0.67884004",
"0.67561287",
"0.6718263",
"0.6716619",
"0.66483307",
"0.6636421",
"0.6636421",
"0.6598664",
"0.6589884",
"0.65497077",
"0.6543673",
"0.6510332",
"0.6491958",
"0.64709675",
"0.64671695",
"0.64505523",
"0.64332336",
"0.639452",
"0.6392633",
"0.63627803",
"0.6330623",
"0.62898993",
"0.62880665",
"0.62475884",
"0.62449354",
"0.62374127",
"0.6213816",
"0.6213816",
"0.6204618",
"0.61984086",
"0.6197554",
"0.6194607",
"0.6160449",
"0.61451495",
"0.6143651",
"0.6143037",
"0.61307883",
"0.6112317",
"0.6096211",
"0.60923225",
"0.60904294",
"0.6058496",
"0.6050968",
"0.6034869",
"0.6030678",
"0.6017714",
"0.6013846",
"0.6012454",
"0.6001859",
"0.5990432",
"0.59895337",
"0.5971731",
"0.5969201",
"0.59468114",
"0.593261",
"0.5915591",
"0.5891382",
"0.5880733",
"0.5856068",
"0.5854126",
"0.5850812",
"0.5837155",
"0.5824351",
"0.58038706",
"0.57933694",
"0.57910985",
"0.5778852",
"0.5774242",
"0.5771064",
"0.57586485",
"0.5734597",
"0.5734597",
"0.5733339",
"0.57325816",
"0.57320094",
"0.57197267",
"0.5718529",
"0.5716048",
"0.5711503",
"0.57083833",
"0.5707054",
"0.56986576",
"0.56953317",
"0.56929815",
"0.56881404",
"0.5677583",
"0.5669954",
"0.565225",
"0.564734",
"0.5639035",
"0.5638936",
"0.5632574",
"0.5621168",
"0.5617364",
"0.56054676"
] |
0.0
|
-1
|
Return an array of the contents of the queue, in order.
|
def dequeue_all
if @push_ptr
if @pop_ptr
if @pop_ptr < @push_ptr
ret_ = @buffer[@pop_ptr..@push_ptr-1]
else
ret_ = @buffer[@pop_ptr..-1] + @buffer[0..@push_ptr-1]
end
@buffer.fill(nil)
@push_ptr = 0
@pop_ptr = nil
ret_
else
[]
end
else
ret_ = @buffer
@buffer = []
ret_
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def queued_messages\n @buffer.slice(@pointer, @buffer.length - @pointer)\n end",
"def queued_messages\r\n @buffer.slice(@pointer, @buffer.length - @pointer)\r\n end",
"def pop\n val = []\n @queue_mutex.synchronize do\n val = @memory_queue.pop\n end\n val\n end",
"def queue\n @queue ||= []\n end",
"def messages\n @zk.children(full_queue_path)\n end",
"def process_queue(doctype)\n verify_doctype(doctype)\n ret = []\n keys = []\n lock_queue_doc(doctype) do |s|\n ret, keys = Store.get_store(0).get_zdata(s.queue_docname(doctype))\n Store.get_store(0).flush_zdata(s.queue_docname(doctype))\n end\n [ret, keys]\n end",
"def to_a\n @que.dup\n end",
"def question_three\n dequeued = []\n my_queue = MyQueue.new\n my_queue.enqueue(5)\n my_queue.enqueue(3)\n my_queue.enqueue(2)\n my_queue.enqueue(7)\n my_queue.enqueue(1)\n my_queue.enqueue(2)\n my_queue.enqueue(4)\n dequeued << my_queue.dequeue\n my_queue.enqueue(3)\n my_queue.enqueue(7)\n my_queue.enqueue(1)\n dequeued << my_queue.dequeue\n [my_queue.to_s,dequeued]\nend",
"def get_output\n output = []\n tokens = 0\n @queue_mutex.synchronize do\n tokens = @queue.size\n tokens.times { output << @queue.shift }\n end\n @mutex.synchronize do\n @enqueued_tokens -= tokens\n end\n\n # Nil if nothing to process in the pipe.\n # Possible only after flushing the pipe.\n if @enqueued_tokens > 0\n output\n else\n output.any? ? output : nil\n end\n end",
"def _q\n @queue||=[]\n end",
"def inbound\n Array.new(@q_in.size) { @q_in.pop }.tap(&:compact!)\n end",
"def entries\n MicroQ.redis do |r|\n r.lrange(QUEUES[:entries], 0, -1)\n end.collect(&MicroQ::Util.json_parse)\n end",
"def get_array\n\t\tsynchronize do\n\t\t\t@condition.wait_until{@array.size > 0}\n\t\t\ta = @array\n\t\t\t@array = []\n\t\t\treturn a\n\t\tend\n\tend",
"def queued_jids\n queued.entries\n end",
"def read_message\n return @text_queue.shift\n end",
"def flush\n []\n end",
"def items(prefix = '')\n queue = []\n collect(\n _get(@root, prefix, 0),\n prefix,\n queue\n )\n queue\n end",
"def pop(queue)\n job = Resque.reserve(queue)\n [job.payload_class, job.args] if job \n end",
"def pop(queue)\n job = Resque.reserve(queue)\n [job.payload_class, job.args] if job \n end",
"def values\n raise_future_proof_exception unless finished?\n @values ||= FutureProof::FutureArray.new(instance_variable_get(:@que).dup)\n end",
"def dequeue\n\t\t@queue.shift\n\tend",
"def mailq\n mailq = []\n\n req(\"mailq\") do |resp|\n mailq.concat [resp[:body]].flatten\n end\n\n mailq\n end",
"def dequeue\n @data.shift\n end",
"def queue\n @queue ||= produce_queue\n end",
"def dequeue\n @q.shift\n end",
"def read_data(ptr=nil)\n self.mutex.synchronize do\n\n # Verify that there is data in the queue\n return [nil,nil] if not self.queue[self.beg]\n\n # Configure the beginning read pointer (sequence number, not index)\n ptr ||= self.queue[self.beg][0]\n return [nil,nil] if not ptr\n\n # If the pointer is below our baseline, we lost some data, so jump forward\n if ptr < self.queue[self.beg][0]\n ptr = self.queue[self.beg][0]\n end\n\n # Calculate how many blocks exist between the current sequence number\n # and the requested pointer, this becomes the number of blocks we will\n # need to read to satisfy the result. Due to the mutex block, we do\n # not need to scan to find the sequence of the starting block or\n # check the sequence of the ending block.\n dis = self.seq - ptr\n\n # If the requested sequnce number is less than our base pointer, it means\n # that no new data is available and we should return empty.\n return [nil,nil] if dis < 0\n\n # Calculate the beginning block index and number of blocks to read\n off = ptr - self.queue[self.beg][0]\n set = (self.beg + off) % self.size\n\n\n # Build the buffer by reading forward by the number of blocks needed\n # and return the last read sequence number, plus one, as the new read\n # pointer.\n buff = \"\"\n cnt = 0\n lst = ptr\n ptr.upto(self.seq) do |i|\n block = self.queue[ (set + cnt) % self.size ]\n lst,data = block[0],block[1]\n buff += data\n cnt += 1\n end\n\n return [lst + 1, buff]\n\n end\n end",
"def queue; end",
"def queue; end",
"def dequeue\n @queue.shift\n end",
"def array\n\t\treturn @hand_contents\n\tend",
"def peek()\n if @queue_out.size == 0 \n if @queue_in.size == 0 \n return \n end\n \n while @queue_in.size > 0 \n @queue_out.push(@queue_in.pop)\n end\n end\n \n return @queue_out.last\n end",
"def queues\n @channel.queues\n end",
"def in_memory\n []\n end",
"def queued\n @queued\n end",
"def reads\n (1..read_count).to_a\n end",
"def Queue\n def initialize\n @q = []\n end\n\n def enqueue(el)\n @q.push(el)\n end\n\n def dequeue\n @q.shift\n end\n\n def show\n @q.dup\n end\nend",
"def q3_read_to_array(data_file_name)\r\n orders = []\r\n \r\n h = q3_read_to_hash(data_file_name)\r\n h.each_pair { |k,v| orders << v }\r\n \r\n return orders\r\nend",
"def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end",
"def queues\n Thread.current[:queues] == \"*\" ? Resque.queues.sort : Thread.current[:queues].split(',')\n end",
"def peek()\n if @queue_out.size == 0\n if @queue_in.size == 0\n return\n end\n\n while @queue_in.size > 0\n @queue_out.push(@queue_in.pop)\n end\n end\n\n return @queue_out.last\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def cache_nodes_to_array\n arr = []\n node = @rear_node\n begin\n arr << node.value\n node = node.parent\n end while !node.nil?\n return arr\n end",
"def dequeue\n remove_elements_to_stack if @out.empty?\n @out.pop\n end",
"def messages\n @queue.messages.select { |m| m.claim == self }\n end",
"def complete_order\n @queue.dequeue\n end",
"def receive\n @subscriber.recv_strings( parts = [] )\n #log.debug \"a queue item [%s]\\n\", parts.join(' ')\n parts\n end",
"def get_general_queue\n reply = @client.call(:get_general_queue)\n data = reply.body.dig(:get_general_queue_response,\n :get_general_queue_result,\n :array_of_string)\n data = check_if_data_exists(data)\n\n data.map do |attrs|\n {\n service_id: attrs[:string][0],\n service_name: attrs[:string][1],\n channel_id: attrs[:string][2],\n channel_name: attrs[:string][3],\n contact_type: attrs[:string][4],\n directive: attrs[:string][5],\n queue_length: attrs[:string][6],\n time_in_queue: attrs[:string][7]\n }\n end\n rescue Savon::HTTPError => error\n Rails.logger.debug error.http.code\n return []\n end",
"def processed_items\n @processed.to_a\n end",
"def restriction_queue_raw(tracking_key, queue)\n Array(Resque.redis.lrange(restriction_queue_key(tracking_key, queue), 0, -1))\n end",
"def queue\n @queue ||= SizedQueue.new @queue_size\n end",
"def in_memory\n []\n end",
"def in_memory\n []\n end",
"def recv_array(flags = 0)\n [].tap do |ary|\n loop do\n ary << recv_string(flags)\n break unless get_opt(ZMQ::RCVMORE)\n end\n end\n end",
"def message_from_queue\n if msg = @connection.pop\n message = msg.body.delete(\"\\n\")\n msg.finish\n message\n end\n end",
"def to_a\n a = []\n for i in 0..size()-1\n a << self[i]\n end\n a\n end",
"def pop()\n @queue.shift\n end",
"def array\n @@array\n end",
"def list_queues(options ={})\r\n content = execute(:get, nil, { :comp => 'list' }.merge!(options), { :x_ms_version => \"2009-09-19\" })\r\n doc = REXML::Document.new(content)\r\n queues = []\r\n \r\n REXML::XPath.each(doc, '//Queue/') do |item|\r\n metadata = {}\r\n \r\n item.elements['Metadata'].elements.each do |element|\r\n metadata.merge!(element.name.gsub(/-/, '_').downcase.to_sym => element.text)\r\n end unless item.elements['Metadata'].nil?\r\n \r\n queues << { :name => REXML::XPath.first(item, \"Name\").text,\r\n :url => REXML::XPath.first(item, \"Url\").text,\r\n :metadata => metadata}\r\n end\r\n return queues\r\n end",
"def queue\n @queue.pending\n end",
"def to_a\n a = []\n while (item = self.next)\n a << item.item\n end\n a\n end",
"def dequeue\n end",
"def to_a()\n a = []\n for i in 0..size()-1\n a << self[i]\n end\n a\n end",
"def entries\n return Array(@entries)\n end",
"def messages\n Enumerator.new do |y|\n loop do\n y << @redis.blpop(@name).last\n end\n end\n end",
"def sub_queues\n sub_queue_obj.find(:all, :order => \"created_at DESC\")\n end",
"def getSlaveClientQueue\n rQueue = []\n\n # Read the SlaveClient's info from the MasterServer's configuration\n lSlaveClientInfo = nil\n File.open(\"#{@WEACERepositoryDir}/Config/MasterServer.conf.rb\", 'r') do |iFile|\n lSlaveClientInfo = eval(iFile.read)[:WEACESlaveClients][0]\n end\n # Get the corresponding queue\n lHash = sprintf('%X', lSlaveClientInfo.hash.abs)\n lQueueFile = \"#{@WEACERepositoryDir}/Volatile/MasterServer/SlaveClientQueues/#{lHash}.Queue\"\n if (File.exists?(lQueueFile))\n File.open(lQueueFile, 'rb') do |iFile|\n rQueue = Marshal.load(iFile.read)\n end\n end\n\n return rQueue\n end",
"def get\n to_array.join(\"\\r\\n\")\n end",
"def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end",
"def queues\n subject.queues\n end",
"def queue(_); end",
"def queue(_); end",
"def read_all(start = 0, size = -1)\n a = []\n size = count - start if size == -1\n result = rds.exists hpk_tag\n return a unless result and size > 0\n\n # read all nonces as list\n nonces = rds.hkeys hpk_tag\n limit = start+size <= nonces.length ? start + size : nonces.length\n\n # read all messages requested in atomic transaction\n res = runMbxTransaction(@hpk, 'read_all') do\n for i in (start...limit)\n rds.get msg_tag nonces[i]\n end\n end\n\n # decode each item from base64 and check for null values\n # left by expired messages\n res.each do |item|\n next unless item\n msg = parse item\n yield msg if block_given?\n a.push msg\n end\n return a\n end",
"def pop\n job = Resque.reserve :default\n [job.payload_class, job.args] if job \n end",
"def pop()\n res = @pop_queue.shift()\n return res\n end",
"def enqueue *args\n a = args.reverse.take(size)\n self.data = a + data[0, size - a.size]\n self\n end",
"def dequeue\n @items.shift\n end",
"def to_a\n @front.to_a.concat(@rear.to_a.tap(&:reverse!))\n end",
"def pluck_message\n pluck_queue_message(name)\n end",
"def pop()\n new_queue = Queue.new\n until @queue.size == 1\n new_queue << @queue.pop\n end\n last = @queue.pop\n @queue = new_queue\n last\n end",
"def dequeue(iterations=1)\n\t\t\tout = Array.new\n\t\t\t\n\t\t\titerations.times do\n\t\t\t\t# get item from the front\n\t\t\t\tout << @queue[@head_index]\n\t\t\t\t# remove item from the queue\n\t\t\t\t@queue[@head_index] = nil\n\t\t\t\t# move the front\n\t\t\t\tadvance_head\n\t\t\t\t\n\t\t\t\t# reduce size\n\t\t\t\t@size -= 1\n\t\t\tend\n\t\t\t\n\t\t\t\n\t\t\tif out.size == 1\n\t\t\t\treturn out.first\n\t\t\telse\n\t\t\t\treturn out\n\t\t\tend\n\t\tend",
"def dequeue; @queue.pop end",
"def messages\n @monitor.synchronize {\n if @buffer[@next_index] == nil\n @buffer[0...@next_index]\n else\n @buffer[@next_index...@limit] + @buffer[0...@next_index]\n end\n }\n end",
"def backlog\n @queues.map{|k,v| [k,v.size]} \n end",
"def dequeue\n synchronize do\n @cond.wait_until{ @array.size > 0 }\n @array.shift\n end\n end",
"def list\n @queue << \"list\"\n end",
"def fetch_queue(room)\n fail ArgumentError, 'must be a Lita::Room object' unless room.is_a? Lita::Room\n\n serialized = redis.get(room.id)\n\n if serialized\n MultiJson.load(serialized)\n else\n []\n end\n end",
"def queues\n @cache\n end",
"def read_messages\n begin\n uri = MQ_CONFIG[\"mq_uri\"]\n conn = Bunny.new(uri)\n conn.start\n channel = conn.create_channel\n\n if MQ_CONFIG[\"digitisation\"][\"source\"].blank?\n logger.warn \"#{Time.now.to_s} WARN: No digitisation source queue defined -> Not listening\"\n return\n end\n\n source = MQ_CONFIG[\"digitisation\"][\"source\"]\n q = channel.queue(source, :durable => true)\n\n logger.debug \"q.message_count = #{q.message_count}\"\n\n unread_messages = Array.new\n\n while q.message_count > 0 do\n delivery_info, metadata, payload = q.pop\n unread_messages.push(payload)\n end\n conn.close\n logger.debug \"Returning array containing #{unread_messages.length} unread messages\"\n unread_messages\n rescue Exception => e\n logger.error \" #{e.message}\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end",
"def pop\n raise \"Abstract queue cannot return objects\"\n end",
"def to_ary\n if empty?\n return []\n end\n\n # newest index is actually @newest - 1\n newest_idx = @newest - 1;\n if(newest_idx < 0)\n newest_idx += @buffer.count;\n end\n\n if newest_idx >= @oldest\n return @buffer[@oldest..newest_idx]\n else\n return @buffer[@oldest...@buffer.count] + @buffer[0..newest_idx]\n end\n end",
"def view_waitlist\n @queue.to_str\n end",
"def bg_messages\n messages = bg_queue.listMessagesAsJSON('')\n logger.warn(\"messages = #{messages}\")\n messages\n end",
"def items\n result = []\n each_item { |item| result.push(item) }\n result\n end",
"def as_array\n @fm.dup\n end",
"def eContents\r\n if @_contained_elements\r\n @_contained_elements.dup\r\n else\r\n []\r\n end\r\n end",
"def array\n @array\n end",
"def end_push\n ## empty\n return [[], []]\n end",
"def pop\n entry = queue.pop[:payload]\n if (entry != :queue_empty)\n Marshal.load(entry)\n else\n nil\n end\n end",
"def enqueue(el)\n self.queue_var = [el] + self.queue_var \n end",
"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"
] |
[
"0.7189088",
"0.7127472",
"0.6844221",
"0.67782277",
"0.6529813",
"0.63952917",
"0.6281892",
"0.6267112",
"0.6261744",
"0.6202497",
"0.6196211",
"0.6120766",
"0.6114355",
"0.60679007",
"0.6062635",
"0.6017754",
"0.59974",
"0.59681576",
"0.59681576",
"0.5916615",
"0.5829373",
"0.58113295",
"0.58102614",
"0.580888",
"0.5807994",
"0.58050567",
"0.5802267",
"0.5802267",
"0.58013844",
"0.57749873",
"0.5763626",
"0.57630646",
"0.5760807",
"0.5755211",
"0.5754699",
"0.57406604",
"0.57354045",
"0.57338053",
"0.57338053",
"0.5726533",
"0.57114804",
"0.5707567",
"0.5702124",
"0.5685144",
"0.5681284",
"0.5677687",
"0.5677332",
"0.5675881",
"0.5673857",
"0.5671166",
"0.5661934",
"0.5661934",
"0.56509334",
"0.5642381",
"0.5641404",
"0.56328326",
"0.5625592",
"0.56182194",
"0.56180525",
"0.560885",
"0.5593897",
"0.55917645",
"0.5570652",
"0.5566262",
"0.5538412",
"0.55366975",
"0.553618",
"0.55299526",
"0.5528754",
"0.5519514",
"0.5519514",
"0.55127513",
"0.551156",
"0.5511006",
"0.5506019",
"0.5505577",
"0.5502861",
"0.5491476",
"0.54816884",
"0.54734975",
"0.5468612",
"0.54638237",
"0.5463107",
"0.5460611",
"0.54570293",
"0.5455974",
"0.545411",
"0.5445676",
"0.5436344",
"0.5435412",
"0.5434754",
"0.5428624",
"0.54252666",
"0.5423616",
"0.54223186",
"0.5418194",
"0.54145974",
"0.5403318",
"0.5400438",
"0.53976834"
] |
0.6611848
|
4
|
Return the size of the queue, which is 0 if the queue is empty.
|
def size
if @push_ptr
if @pop_ptr
value_ = @push_ptr - @pop_ptr
value_ > 0 ? value_ : value_ + @buffer.size
else
0
end
else
@buffer.size
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def size\n\n @queue.size\n end",
"def size\n @queue.size\n end",
"def size\n @mutex.synchronize { @queue.size }\n end",
"def size\n @queue.size\n end",
"def size\n @queue.size\n end",
"def size\n @queue.size\n end",
"def length\n @queue.length\n end",
"def queue_count()\n @queue.length\n end",
"def length\n @queue.length\n end",
"def queue_length\n mutex.synchronize { running? ? @queue.length : 666 }\n end",
"def queue_size(queue)\n Resque.size(queue)\n end",
"def count\n\t\t@queue.length\n\tend",
"def queue_size\n @redis.llen(\"xque:queue:#{@queue_name}\")\n end",
"def size\n\t\t\t@sequence.size + @queue.size\n\t\tend",
"def queue_length\n @queues.inject(0) do |length, (_, queue)|\n length + queue.length\n end\n end",
"def queue_length\n if system.empty?\n 0\n else\n system.length - 1\n end\n end",
"def queue_length\n @executor.getQueue.size\n end",
"def size?\n @queue.length\n end",
"def queue_count\n @queues.length\n end",
"def queue_length\n @job_queue.length\n end",
"def size\n self.queued.inject(0) { |result, data| result + data.last.size }\n end",
"def queue_size\n _get(\"/system/queue-size\") { |json| json }\n end",
"def queue_length\n request_queue.length\n end",
"def work_queue_size()\n @work_queue.size\n end",
"def z_queue_size(queue)\n handle_pipeline(@redis.zcount(redis_key_for_queue(queue), 0, Float::INFINITY), &:to_i)\n end",
"def size\n # This is a a bit racy - we don't update these two queues atomically\n @queue.size + @active.size\n end",
"def queued_messages\n @queue.length\n end",
"def size\n @que.size\n end",
"def queued_messages\n @queue.length\n end",
"def size\n @q.size\n end",
"def queue_size(paypal_id)\n queue = @queue_map[paypal_id]\n if(queue.nil?)\n 0\n else\n queue.size\n end\n end",
"def waitlist_size\n @queue.size\n end",
"def pending_size\n @redis.zcard(\"xque:pending:#{@queue_name}\")\n end",
"def length\n @que.length\n end",
"def sub_queue_count\n sub_queue_obj.count\n end",
"def gevent_queue_size\r\n return @proc_queue.size\r\n end",
"def queue_count()\n @work_queue.size + super()\n end",
"def queue_size(queue)\n prioritized?(queue) ? z_queue_size(queue) : super\n end",
"def message_count\n get_queue_message_count(address)\n end",
"def length\n @que.length\n end",
"def length\n @que.length\n end",
"def queue_count()\n cnt = 0\n @flows.each_value { |f| cnt += f.queue_count() }\n cnt\n end",
"def get_queue_size\n if @number_of_processes\n @queueSize = @number_of_processes\n else\n @queueSize = DATSauce::PlatformUtils.processor_count * 2\n # get max threads from platform utils\n end\n @queueSize\n end",
"def queue_count()\n cnt = 0\n @tasks.each_value { |task| cnt += task.queue_count() }\n cnt\n end",
"def size(name = '.+')\n queues_matching(name).map(&:size).reduce(0, :+)\n end",
"def backlog\n @queue.size\n end",
"def remaining_capacity\n mutex.synchronize { @max_queue == 0 ? -1 : @max_queue - @queue.length }\n end",
"def size\n raise_if_closed!\n\n @lock.synchronize do\n unsynchronized_size\n end\n end",
"def length\n @q.length\n end",
"def remaining_capacity\n @max_queue == 0 ? -1 : @executor.getQueue.remainingCapacity\n end",
"def is_full()\n @queue.size == @size\n end",
"def sizeof(queue, statistics = nil)\n statistics ||= stats\n\n if queue == :all\n available_queues.inject({}){|h,q| h[q] = sizeof(queue, statistics)}\n else\n IO.popen(\"#{db_stat} -d /tmp/qache/#{queue}\").readlines.\n detect{|line| line =~ /(\\d+)\\tNumber of records in the database\\n/ }\n $1.to_i\n end\n end",
"def max_queue_count()\n @max_queue_count\n end",
"def size\n @mutex.synchronize{_size}\n end",
"def size\n @heap.size\n end",
"def size\n @heap.size\n end",
"def check_queue_size_all\n queue = `#{config[:path]} | /bin/egrep '[0-9]+ Kbytes in [0-9]+ Request\\|Mail queue is empty'`\n queue == 'Mail queue is empty' ? 0 : queue.split(' ')[4].to_i\n end",
"def size\n return @buffer.count\n end",
"def size\n 0\n end",
"def size\n 0\n end",
"def size()\n return nil if is_empty\n\n i = 0\n\n while @stack[i] != nil\n i += 1\n end\n\n return i\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def num_waiting\n @waiting.size + @queue_wait.size\n end",
"def size\n return @items.length\n end",
"def total_count(queue)\n collection.find(conditions(queue)).count\n end",
"def size\n @semaphore.synchronize do\n return @hashed_storage.size\n end\n end",
"def queue\n @queue ||= SizedQueue.new @queue_size\n end",
"def size\n return @size\n end",
"def size\n return @size\n end",
"def size\n 0\n end",
"def _size\n @allocated.length + @available_connections.length\n end",
"def empty?\n self.queue_size == 0\n end",
"def num_waiting\n @queue.num_waiting\n end",
"def size\n return @items.size\n end",
"def check_queue_size_deferred\n `#{config[:path]} | /bin/grep -c '^ *(.*)$'`.to_i\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def size\n return @items.length\n end",
"def is_empty()\n @queue.size == 0\n end",
"def size\n return 0 if @head.nil?\n\n n = 0\n self.each { n += 1}\n return n\n end",
"def size\n return @items.size\n end",
"def sizeof(queue, statistics = nil)\n statistics ||= stats\n\n if queue == :all\n queue_sizes = {}\n available_queues(statistics).each do |queue|\n queue_sizes[queue] = sizeof(queue, statistics)\n end\n return queue_sizes\n end\n\n statistics.inject(0) { |m,(k,v)| m + v[\"queue_#{queue}_items\"].to_i }\n end",
"def size()\n return nil if is_empty\n\n current = @head\n size = 0\n\n while current != nil\n size += 1\n current = current.next\n end\n\n return size\n end",
"def size\n @items.length\n end",
"def size\n 0\n end",
"def size\n 0\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def size\n @size.size\n end",
"def size\n @redis.llen @key\n end",
"def size\n return @messages.size\n end",
"def size()\n\t\tif !@head\n\t\t\treturn 0\n\t\telse\n\t\t\tcount = 1;\n\t\t\tcurrentNode = @head\n\n\t\t\twhile currentNode.getNextNode() do\n\t\t\t\tcurrentNode = currentNode.getNextNode()\n\t\t\t\tcount = count + 1\n\t\t\tend\n\n\t\t\treturn count\n\t\tend\n\tend",
"def message_count(queue)\n connect do |bunny|\n return bunny.queue(queue, :durable => true, :auto_delete => false).message_count\n end\n end",
"def size_without_recursion\n count = 0\n return 0 unless @root\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n while !q.isEmpty?\n node = q.dequeue\n count += 1\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n count\n end",
"def size\n return @size\n end",
"def size\n return @size\n end"
] |
[
"0.88670236",
"0.88502824",
"0.88458216",
"0.884093",
"0.8811372",
"0.8742439",
"0.8613658",
"0.8587226",
"0.8478401",
"0.8167921",
"0.81189924",
"0.8092466",
"0.8063037",
"0.80547166",
"0.80545497",
"0.80353695",
"0.8034661",
"0.7942715",
"0.79209864",
"0.79019225",
"0.7882973",
"0.7794173",
"0.7763698",
"0.7710246",
"0.7688273",
"0.7662032",
"0.76609737",
"0.75868386",
"0.75523764",
"0.7534113",
"0.75126415",
"0.7309668",
"0.725588",
"0.72288704",
"0.722603",
"0.72155267",
"0.7212363",
"0.7207561",
"0.7186013",
"0.7074184",
"0.7074184",
"0.70314455",
"0.70192194",
"0.69670045",
"0.69473296",
"0.6915444",
"0.6909186",
"0.68778366",
"0.6862088",
"0.6838572",
"0.6834121",
"0.68251044",
"0.6811304",
"0.6797425",
"0.6787271",
"0.6787271",
"0.67831445",
"0.6726664",
"0.672611",
"0.672611",
"0.67144513",
"0.6708758",
"0.6708758",
"0.66861653",
"0.6662198",
"0.6653649",
"0.6653187",
"0.66492724",
"0.66492724",
"0.66426104",
"0.6639464",
"0.6629887",
"0.6614617",
"0.66097164",
"0.6599752",
"0.6592612",
"0.6592612",
"0.6592612",
"0.6592612",
"0.6592612",
"0.6592612",
"0.6592612",
"0.6590985",
"0.6575455",
"0.6573918",
"0.6573235",
"0.6570903",
"0.6559639",
"0.65486485",
"0.65486485",
"0.6546031",
"0.6546031",
"0.6539885",
"0.65390587",
"0.65302974",
"0.6525888",
"0.65212464",
"0.6512333",
"0.65108013",
"0.65108013"
] |
0.6987391
|
43
|
1 Split document into words 2 Compute word frequency 3 Compute dot product
|
def documentDistance doc1,doc2
puts "Implmementing doc"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def document_frequency\n @corpus.each_with_object({}) do |doc, df|\n doc.bag_of_words.keys.each do |word|\n df[word] = (df.fetch(word) { 0.0 }) + 1.0\n end\n end\n end",
"def calculate_term_frequencies\n results = []\n\n @tokenized_documents.each do |tokens|\n document_result = {}\n tokens[:words].each do |term, count|\n document_result[term] = (count/tokens[:total_count].to_f).round(6)\n end\n\n results << document_result\n end\n\n results\n end",
"def word_freq(text)\n frequency = {}\n unique_words(text).each do |word|\n frequency[word] = 0\n end\n split_normalise(text).each do |word|\n frequency[word] += 1\n end\n frequency\nend",
"def calculate\n document_frequency.each_with_object({}) do |(word, freq), idf|\n idf[word] = Math.log(@corpus.size/freq)\n end\n end",
"def word_frequency(text)\n norm_array = normalize(text).to_a\n freq = { }\n norm_array.each_with_object(Hash.new(0)){|key,hash| hash[key] += 1}\nend",
"def calculate_inverse_document_frequency\n results = {}\n\n tokenized_documents.each do |document|\n terms = document[:words]\n terms.each_key do |term|\n results[term] ||= 0\n results[term] += 1\n end\n end\n\n results.each_pair do |term, count|\n results[term] = 1 + Math.log(total_documents.to_f / (count + 1.0))\n end\n\n results\n end",
"def calculate_term_frequencies\n results = []\n \n @data.each do |document|\n document_result = {}\n \n document.each do |term|\n if document_result.key?(term)\n document_result[term] += 1.0\n else\n document_result[term] = 1.0\n end\n end\n \n # Normalize the count\n document_result.each_key do |term|\n document_result[term] /= document.size\n end\n \n results << document_result\n end\n \n results\n end",
"def word_frequency\n @word_use = Hash.new(0)\n words.each { |w| @word_use[w] += 1 }\n @word_use\n end",
"def checkSearchTerms(wordHash, searchTermsArray, documentCounter, resultsHash, wordArray)\n documentCounter;\n documentNumber = \"Document \" + documentCounter.to_s\n searchTermsArray.each do |word|\n resultsHash.merge!(word => { documentNumber => wordHash[word]})\n # need to figure out the frequency based on the wordHash[word] and the wordArray.length\n end\n # puts wordArray.length\n # puts resultsHash\nend",
"def word_count_engine(document)\n document = document.gsub(/[^ 0-9A-Za-z]/, '').downcase.split(' ')\n\n store = {}\n max = 0\n\n document.each do |element|\n if store[element]\n store[element] += 1\n max = [store[element], max].max\n else\n store[element] = 1\n max = 1 if max == 0\n end\n end\n\n buckets = Array.new(max) { [] }\n\n store.each do |key, value|\n buckets[max - value].push([key, value.to_s])\n end\n\n buckets.flatten(1)\nend",
"def process\n tokenize(text).each do |word|\n token = TfIdfSimilarity::Token.new word\n if token.valid?\n @term_counts[token.lowercase_filter.classic_filter.to_s] += 1\n end\n end\n @size = term_counts.values.reduce(:+)\n end",
"def process_words(freqs, n, word_counts)\n\t# per word calculations\n\tstats = Hash.new\n\tfreqs.each do |key,value|\t\t\t\t\t\t\t\t\t\t# <= for each word...\n\t\t(n - value.size).times { value << 0 } \t\t\t\t# <= \"fills up\" word frequency array with 0s\n\t\tfreqs[key] = value.each_with_index.map { |freq,index| freq.to_f/(word_counts[index]==0 ? 1 : word_counts[index])}\t\t# <= converts each absolute frequency to a relative frequency\n\t\tstats[key] = crunch_stats(freqs[key], n)\n\tend\n\tputs freqs\n\tputs stats\nend",
"def word_freq(categories, word)\n [*categories].inject(0){|sum, category|\n sum += self.counter.freq(category, word)\n }\n end",
"def frequencies\n analyzer = Frequency.call(\n dataset: dataset,\n stemming: stemming,\n block_size: window,\n last_block: :small_last,\n split_across: false,\n progress: ->(p) { progress&.call((p.to_f / 100.0 * 33.0).to_i) }\n )\n\n # Combine all the block hashes, summing the values\n total = analyzer.blocks.size.to_f\n\n base_frequencies = {}\n analyzer.blocks.each_with_index do |b, i|\n progress&.call((i.to_f / total * 16.0).to_i + 33)\n\n b.each_key do |k|\n base_frequencies[k] ||= 0\n base_frequencies[k] += 1\n end\n end\n\n # Get the frequencies of cooccurrence with the word in question\n joint_frequencies = {}\n pairs.each_with_index do |(word, word2_array), i|\n joint_frequencies[word] = {}\n\n analyzer.blocks.each_with_index do |b, j|\n if progress\n p = (i.to_f / pairs.size.to_f) +\n (1 / pairs.size.to_f) * (j.to_f / total.to_f)\n progress.call((p * 17.0).to_i + 49)\n end\n\n next unless b[word]&.>(0)\n\n if word2_array.empty?\n b.each_key do |k|\n joint_frequencies[word][k] ||= 0\n joint_frequencies[word][k] += 1\n end\n else\n word2_array.each do |w|\n if b.key?(w)\n joint_frequencies[word][w] ||= 0\n joint_frequencies[word][w] += 1\n end\n end\n end\n end\n end\n\n [base_frequencies, joint_frequencies, analyzer.blocks.size]\n end",
"def tfreq word, labellist\n @tfreq=0\n labellist.each do |doc|\n @tfreq+=doc[word] if doc.has_key?(word)\n end\n @tfreq\nend",
"def compute_word_frequencies(dataset, progress = nil, args = {})\n convert_args!(args)\n\n # Quick-out for the FromTF analyzer if we can: only one block,\n # one-grams, no stemming\n if ((args[:num_blocks] && args[:num_blocks] == 1) ||\n (args[:num_blocks].nil? && args[:block_size].nil?)) &&\n (args[:ngrams].nil? || args[:ngrams] == 1) &&\n (args[:stemming].nil?)\n return RLetters::Analysis::Frequency::FromTF.new(\n dataset,\n progress,\n split_across: args.delete(:split_across),\n num_words: args.delete(:num_words),\n inclusion_list: args.delete(:inclusion_list),\n exclusion_list: args.delete(:exclusion_list),\n stop_list: args.delete(:stop_list)\n )\n end\n\n # Produce a word list generator\n word_lister_options = {\n ngrams: args.delete(:ngrams),\n stemming: args.delete(:stemming)\n }\n @word_lister = RLetters::Documents::WordList.new(word_lister_options)\n\n # Segment the dataset into text blocks\n doc_segmenter_options = {\n num_blocks: args.delete(:num_blocks),\n block_size: args.delete(:block_size),\n last_block: args.delete(:last_block)\n }\n @doc_segmenter = RLetters::Documents::Segments.new(@word_lister,\n doc_segmenter_options)\n\n set_segmenter_options = {\n split_across: args.delete(:split_across)\n }\n @set_segmenter = RLetters::Datasets::Segments.new(dataset,\n @doc_segmenter,\n set_segmenter_options)\n\n # Perform the position-based analysis (with the remaining args)\n RLetters::Analysis::Frequency::FromPosition.new(@set_segmenter, progress, args)\n end",
"def process_words\n reset_counts\n # iterate through radlib_array and add counts\n self.each do |w|\n Rails.logger.debug(w.inspect)\n case w[\"type\"]\n when \"word\"\n @num_words += 1\n if w[\"selectable\"] && w[\"selected\"]\n @num_blanks += 1\n # fix for old radlibs\n unless w[\"user_pos\"]\n w[\"user_pos\"] = w[\"predicted_pos\"]\n end\n type = w[\"user_pos\"].gsub(\"-\", \"_\").to_sym\n Rails.logger.debug(type)\n @num_blanks_by_type[type] += 1\n end\n when \"whitespace\"\n # don't need to do anything here\n when \"punc\"\n @num_sentences += 1 if w[\"text\"] == \".\" || w[\"text\"] == \"!\" || w[\"text\"] == \"?\"\n end\n end\n end",
"def calculate_inverse_document_frequency\n results = {}\n \n terms.each do |term|\n count = 0.0\n \n @data.each do |document|\n count += 1 if document.include?(term)\n end\n \n results[term] = Math.log10(total_documents / count)\n end\n \n results\n end",
"def frequency\n counts = Hash.new(0)\n self.words.each { |word| counts[word] += 1 }\n counts\n end",
"def weightsCalc\n begin\n terms = $index.keys\n # Calculate inverted-idf for each term\n terms.each do |term|\n df = 0\n $index[term].each do |tf|\n df += tf[1]\n end\n # Get number of docs\n docs = $index[term].keys\n docs = docs.max\n idf = Math.log(df/docs.to_f, 10)\n $index[term][0] = idf\n end\n\n # For each term calculate the term-freq\n # Iterate over terms\n terms.each do |term|\n # Get all doc numbers for term\n docs = $index[term].keys\n # Iterate over doc numbers\n docs.each do |key|\n if key != 0\n val = $index[term][key]\n newVal = 0\n if val != 0\n newVal = 1 + Math.log($index[term][key], 10)\n end\n $index[term][key] = newVal\n end\n end\n end\n\n # Now calculate cosine normalized score for each term\n terms.each do |term|\n idf = $index[term][0]\n sum = 0\n $index[term].each do |weight|\n if weight[0] != 0\n #Gets weight and puts into divisor of cosine normalzing sum\n sum += weight[1]**2\n end\n end\n # Cosine sum is calculated\n consineDiv = Math.sqrt(sum)\n\n # Calculate cosine normalized weight for each doc\n $index[term].each do |weight|\n if weight[0] != 0\n #puts weight\n $index[term][weight[0]] = weight[1] / consineDiv.to_f\n end\n end\n\n # Calculate final score for each doc\n $index[term].each do |weight|\n if weight[0] != 0\n $index[term][weight[0]] = idf * weight[1]\n end\n end\n\n # Average score for each doc\n avgScore = 0\n $index[term].each do |weight|\n if weight[0] != 0\n avgScore += weight[1]\n end\n end\n\n # Put weight in index\n $index[term] = avgScore / $index[term].length.to_f\n end\n puts \"Weights calculated\"\n rescue\n puts \"Error calculating weights\"\n end\nend",
"def term_frequency(document, term)\n tf = document.term_count(term)\n if @function == :bm25\n (tf * 2.2) / (tf + 0.3 + 0.9 * documents.size / @model.average_document_size)\n else\n sqrt(tf)\n end\n end",
"def calculate_word_frequency\n # not a class method, it is used to poulate what are essentially properties on an instance of the class\n #word_frequency = @content.split(\" \").each_with_object(Hash.new(0)) {|word,count| count[word] +=1}\n word_frequency = Hash.new(0)\n #puts word_frequency\n @content.split.each do |word|\n word_frequency[word] += 1\n end\n\n\n @highest_wf_count = word_frequency.values.max\n @highest_wf_words = word_frequency.select { |word, freq| freq == @highest_wf_count }.keys\n @highest_wf_words\n\n end",
"def dotProduct(doc1, doc2)\n _common_tokens = findCommonTokens(doc1.keys, doc2.keys)\n _dot_product = 0.0\n\n _common_tokens.each do |token|\n _dot_product += doc2[token] * doc1[token]\n end\n return _dot_product\n end",
"def calculate\n @tfidf = Hash.new\n\n @idf ||= InverseDocumentFrequency.new(@corpus)\n @tf ||= NormalizedTermFrequency.new(BasicTokenizer.new)\n @idf_weights = @idf.calculate\n\n @corpus.each do |doc|\n termfreq = @tf.calculate(doc.contents)\n\n @tfidf[doc.id] =\n termfreq.each_with_object({}) do |(term, tf), tfidf_weights|\n weight = tf * @idf_weights[term]\n tfidf_weights[term] = weight\n end\n end\n @tfidf\n end",
"def frequency_of_each_word(text)\n words = text.split(\" \")\n frequency = Hash.new(0)\n words.each { |word| frequency[word] += 1 }\n frequency\nend",
"def word_frequency(words)\n frequencies = Hash.new(0)\n words.each do |word|\n frequencies[word] += 1\n end\n frequencies\nend",
"def file_process(file)\n\n stop_words = File.read('stop_words.txt').split(\"\\n\")\n\n lines = File.readlines(file)\n title = lines[0]\n speech = lines[1..-1]\n line_count = speech.size\n text = speech.join\n char_count = text.length\n char_count_nospaces = text.force_encoding('UTF-8').gsub(/\\s+/, '').length\n word_count = text.scan(/\\w+/).length\n sentence_count = text.split(/\\.|\\?|!/).length\n average_words_sentence = word_count / sentence_count\n paragraph_count = text.split(/\\n\\n/).length\n word_frequency_hash = {}\n word_frequency_top = []\n\n text.split().each do |word|\n unless stop_words.include?(word.downcase)\n if word_frequency_hash.has_key?(word.downcase)\n word_frequency_hash[word.downcase] += 1\n else\n word_frequency_hash[word.downcase] = 1\n end\n end\n end\n\n non_fluff_words = (word_frequency_hash.size.to_f / word_count.to_f * 100).to_i\n\n array_of_sentences = text.scan(/[^\\.!?]+[\\.!?]/).map(&:strip).sort_by { |sentence| sentence.length }\n ideal_sentences = array_of_sentences[array_of_sentences.length/3..array_of_sentences.length - array_of_sentences.length/3]\n\n word_frequency = word_frequency_hash.sort_by { |key, value| value}.reverse\n word_frequency.flatten.each_with_index { |word, index| word_frequency_top << word if index.even? }\n\n puts \"#{title}\"\n puts \"#{line_count} lines\"\n puts \"#{char_count} characters\"\n puts \"#{char_count_nospaces} characters excluding spaces\"\n puts \"#{word_count} words\"\n puts \"#{sentence_count} sentences\"\n puts \"#{paragraph_count} paragraphs\"\n puts \"#{average_words_sentence} words per sentence (average)\"\n puts \"#{word_frequency_hash.size} non-fluff words\"\n puts \"roughly #{non_fluff_words} percent non-fluff words.\"\n puts \"Top 10 non-fluff words: #{word_frequency_top.take(10)} top 10 non-fluff words.\"\n puts \"Ideal sentences array: #{ideal_sentences.take(7) }\"\n puts\n puts\n\nend",
"def calc_document_category(doc, category)\n probability = 0\n\n # log(P(word1|cat)) + log(P(word2|cat)) + ....\n doc.each do |word|\n # log(T(cat, word1)) \n # Additive smoothing\n category_word = Math.log2(@categories_word[category][word] + @additive) \n\n # sum(T(cat, word) + 1))\n all_category_word = Math.log2(@laplace_categories_all_word_count[category])\n\n # log(P(word1|cat)) = log(T(cat, word1) + 1) - log(sum(T(cat, word) + 1))\n prob = category_word - all_category_word\n probability += prob if prob.finite?\n end\n probability\n end",
"def calculate_similarity(other_doc)\n self.terms.inject(0.0) do |dot_product, term|\n dot_product + (self.tfidf(term.word) * other_doc.tfidf(term.word))\n end\n end",
"def get_idfs(words)\n idfs = Hash[words.map { |w|\n [w, DEFAULT_IDF]\n }]\n \n Corpus.for_language(@language).where(category_id: @category, word: words).each { |result|\n idfs[result.word] = Math.log( num_documents_for(@language, @category) / (result.count.to_f + 1) )\n }\n idfs\n end",
"def each_word_count(text)\n word_counts = {}\n normalize(text).each do |word|\n word_counts[word] = 0 if !word_counts[word]\n word_counts[word] += 1\n end\n word_counts\nend",
"def dotProduct(doc1, doc2)\n common_tokens(doc1.keys, doc2.keys).inject(0.0) do |dot_product, token|\n dot_product + doc2[token] * doc1[token]\n end\n end",
"def calculate_wcfts(target_word, tar_char_scrs)\n scores_sum = 0.0\n return scores_sum if target_word.nil?\n char_arr = target_word.entry.scan(/./)\n char_arr.each { |entry| scores_sum += tar_char_scrs[entry] }\n scores_sum / target_word.entry.length\nend",
"def score(word1, word2=nil)\n weight = 1 #file_probability(word1, word2)\n weight * probability(word1, word2)\n end",
"def find_frequency(sentence, word) \nsentence.downcase.split.count(word.downcase)\nend",
"def word_count\n weighted(:count, :word).to_i\n end",
"def frequencies(book)\n book.downcase!\n words = book.split\n word_frequency = {}\n words.each do |word|\n if WORDS.include?(word)\n if word_frequency.key?(word)\n word_frequency[word] += 1\n else\n word_frequency[word] = 1\n end\n end\n end\n word_frequency\nend",
"def compute_termfreq(options={})\n return @termfreq if @computed_termfreq\n\n @enum.each do |blob|\n # Skip binary file extensions\n next if blob.binary_mime_type?\n\n # Linguist::FileBlob#generated? can fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n # Skip vendored or generated blobs\n next if blob.vendored? || blob.generated? || blob.language.nil?\n rescue\n next\n end\n\n # Only include programming languages\n if blob.language.type == :programming\n # Skip if lang option is on and this blob is not in the list of specified languages\n next if options[:lang] and not options[:lang].include? blob.language.name\n\n words = []\n\n # Linguist::FileBlob#safe_to_colorize? can similarly fail\n # with \"invalid byte sequence in UTF-8\"\n begin\n if blob.safe_to_colorize?\n words = @parser.parse(CGI.unescapeHTML(blob.colorize()))\n end\n rescue\n next\n end\n \n words.each do |word|\n tokens = @tokenizer.tokenize(word)\n tokens.each do |token|\n @termfreq[token] += 1\n end\n end\n end\n end\n\n @computed_termfreq = true\n\n @termfreq\n end",
"def frequency(word)\n arr = $words.select do |sample|\n word == sample\n end\n arr.size\nend",
"def term_frequency(document, term)\n tf = document.term_count(term)\n sqrt(tf)\n end",
"def compute_weights\n @weight = Hash.new\n \n @terms.each do |term|\n @doc_list.values.each do |doc|\n value = doc.freq_rel(term) * @idf[term]\n @weight[[term,doc]] = value\n\n assert { value >= 0 }\n end\n end\n end",
"def find_frequency(sentence, word)\n\tsentence.downcase.split.count(word.downcase)\n\nend",
"def tfidf_classify(desc)\n #get the collections\n @coll = get_connection[\"words_index\"]\n @count_coll = get_connection[\"document_count\"]\n @max_count = get_connection[\"max_count\"]\n\n # clean up description\n desc.downcase!\n desc.gsub! /\\//, ' '\n desc.gsub! /-/, ' '\n desc.gsub! /[^a-zA-Z\\s]/, ''\n desc.strip!\n desc.gsub!(/\\s+/, ' ')\n words = desc.split /\\s/\n\n final_words = []\n\n FFI::Hunspell.dict do |dict|\n desc.split(/\\s/).each do |word|\n if PASSABLE_WORDS.include? word\n final_words << word\n next\n end\n\n next unless Stopwords.valid? word\n\n if dict.check? word\n stems = dict.stem word\n final_words << (dict.stem word).last\n end\n end\n end\n\n words = final_words\n\n # store aggregated tf-idf scores for each code here\n master_index = {}\n\n words.each do |word|\n word_entry = @coll.find_one('word' => word)\n next if word_entry.nil?\n word_row = word_entry[\"codes\"]\n next if word_row.empty?\n\n #Calculate Inverse Document frequency\n count_entry = @count_coll.find_one('word' => word)\n count = count_entry[\"count\"]\n\n quotient = TOTAL_COUNT.to_f / count.to_f + 1\n idf = Math.log(quotient)\n\n #Calculate Term frequency and update tf-idf\n word_row.each do |code, num|\n max_count_entry = @max_count.find_one({\"code\" => code})\n max_count = max_count_entry[\"count\"]\n\n next if max_count == 0\n tf = 0.5 + ((0.5 * num) / max_count)\n tfidf = tf * idf\n next if tfidf == Float::INFINITY\n\n master_index[code] ||= 0\n master_index[code] += tfidf\n end\n\n end\n\n # sort to get top codes\n tf_index = master_index.sort_by {|k,v| -v}\n\n #fix code name formatting\n results = tf_index[0..10].map do |x|\n code_name = x[0].dup\n code_name.gsub!(/code_/,'')\n code_name.insert(5, '.') if code_name.length == 7\n x[0] = code_name\n x\n end\n\n # give just the results\n pruned_results(results.map {|r| r[0]})\n end",
"def find_frequency(sentence, word)\n sentence.split.map { |w| w.downcase }.count(word.downcase)\nend",
"def get_word_freq\n speech_links = get_links_to_speeches\n word_freq = Hash.new(0)\n \n speech_links.each do |link|\n speech_page = link.click\n if (speech_obj = speech_page.at SPEECH_DIV_IDENTIFIER)\n speech = speech_obj.text\n words = speech.split(' ')\n words.each{ |word| word_freq[clean_str(word)] += 1 }\n end\n end\n\n word_freq.sort_by{ |x,y| y }.reverse\n end",
"def inverse_document_frequency(term)\n df = @model.document_count(term)\n if @function == :bm25\n log((documents.size - df + 0.5) / (df + 0.5))\n else\n 1 + log(documents.size / (df + 1.0))\n end\n end",
"def word_frequency(params={})\n # Set default options\n options = {\n tweets: [@statuses_count, 1000].min,\n include_rts: true,\n exclude_replies: true\n }\n\n # Combine the options the user has set\n options.merge!(params)\n\n result = {}\n\n # Get the tweets which will be in @timeline\n get_timeline(options[:tweets])\n\n # Go through each tweet in the timeline and match words only\n # [key] word => [value] number of times it is used\n @timeline.each do |tweet|\n tweet.text.split.each do |t|\n\n # Some matches come out as null so skip if they are nil\n word = t.downcase.match(/\\w(?<!\\d)[\\w'-]*/)\n next unless word\n word = word[0]\n\n # Check if word has been added to the result, increment count\n if result.has_key?(word)\n result[word] += 1\n else\n result[word] = 1\n end\n end\n end\n\n result = result.sort_by { |key, value| value }.reverse\n print_word_frequency(result)\n end",
"def accumulate term, docid, frequency, index\n @doc_count += 1\n @tot_freq += frequency.to_i\n end",
"def word_stats(force_recount = false)\n process_words unless @num_words && @num_words > 0 && force_recount\n {\n :num_words => @num_words,\n :num_sentences => @num_sentences,\n :num_blanks => @num_blanks,\n :num_blanks_by_type => @num_blanks_by_type\n }\n end",
"def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend",
"def find_frequency(sentence, word)\n sentence.downcase.split.count(word.downcase)\nend",
"def calculate_word_frequency\n puts \"calculate_word_frequency called\"\n#Ok, tänkte att göra det i en hash table. initiera till 1 om hittar ett ord som inte redan finns annars plussa med ett.\n\n#sedan hitta ordet med högst värde i tabellen. och ta ut \"nyckeln\" för denna.\n\n#fråga hur många olika ord ska man identifiera?\n \n #1. gör hash-lista med antal förekommande som value.\n a=@content.split\n #p a\n nH=Hash.new\n a.each { |word| nH[word]==nil ? nH[word]=1 : nH[word] = nH[word]+1}\n #puts nH.to_s\n #Hur identifierar man åt andra hållet nu då?\n #Gå igenom alla keys och jämför vilket värde som är högst?\n #Ok, men nu om det är flera ord är delad etta...\n highest=0\n nH.each do |key, value|\n if value>highest\n highest=value\n end\n #Ok, för att dela etta, kanske räkna ut highest först och sedan kolla vilka keys som har detta värde.\n end\n #puts \"ok, the highest was: #{highest}\"\n @highest_wf_count= highest #kanske ska sätta in denna i loopen ovan. Obs att det är en setter-metod som anropas här som är förklädd till att ge värde.\n #Nu...\n #Ok, kanske kan använda select mer effektivt.\n #En andra uppgift är att \"effektivisera\" eller snygga till det här programmet så att den drar nytta av rubys \"features\" på ett bättre sätt.\n\n\n\n #puts \"ok, highest was\"\n #p nH.select { |k,v| v==highest}.to_a\n initarray=[]\n nH.each { |k,v| initarray << k if v==@highest_wf_count }\n #highest_wf_words= [1,2,3] #initarray #ok, nu förstår jag, det var det där professorn varnade oss om att den inte anropar en funktion utan skapar och sätter en lokal variabel istället.\n #Dessutom är bara attr_reader definierad, inte setter.\n #Ok, getter och setter methods är till för saker utanför klassen att komma åt variablerna.\n @highest_wf_words= initarray\n\n end",
"def pML(ngram, discount=0)\n # if the numerator count is zero, return zero\n if not @counts.include?(ngram) then return 0 end\n\n # extract a denominator ngram based on the size of the numerator ngram\n dgram = nil\n case ngram.size\n when 3\n dgram = ngram[0..1]\n when 2\n dgram= ngram[0..0]\n end\n\n result = 0\n if dgram\n # if the denominator count would be zero, return 0\n if not @counts.include?(dgram) then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @counts.fetch(dgram, 0).to_f\n else\n if @word_count == 0 then return 0 end\n # discount the numerator if needed\n result = (@counts.fetch(ngram, 0).to_f - discount) / @word_count.to_f\n end\n\n# puts \"#{ngram.inspect} #{result}\"\n return result\n\n rescue ZeroDivisionError\n 0\n end",
"def find_frequency(sentence, word)\n ci_sentence = sentence.downcase\n words = ci_sentence.split(\" \")\n words.count(word)\nend",
"def doc_probability(category)\n doc_prob = 1.0\n self.words.each do |word|\n doc_prob *= BayesCategory.where(:category=>category).first.word_probability(word[0])\n end\n doc_prob\n end",
"def calc_similarity(query, doc)\n tokens = Set.new(query.keys + doc.keys)\n\n a = Vector.elements(tokens.map { |n| query[n] || 0 }, false)\n b = Vector.elements(tokens.map { |n| doc[n] || 0 }, false)\n\n return a.inner_product(b) / (a.magnitude * b.magnitude)\n end",
"def word_instances(text)\n instances = Hash.new(0)\n normalize(text).each do |word|\n instances[word] += 1\n end\n instances\nend",
"def run\n load_the_file\n word_frequency\n match_the_word\n end",
"def find_frequency(sentence, word)\n array = sentence.downcase.split(\" \")\n array.count(word)\nend",
"def analyze_words(words)\n pos_count = 0\n neg_count = 0\n neu_count = 0\n search_dictionary(words).each do |w|\n case w\n when 1\n pos_count +=1\n when -1\n neg_count +=1\n when 0\n neu_count +=1\n end\n end\n {positive: pos_count, negative: neg_count, neutral: neu_count}\n end",
"def compute_weights\n\t\t@weight = Hash.new\n\t\t\n\t\t@terms.each do |term|\n\t\t\t@doc_list.values.each do |doc|\n\t\t\t\tvalue = doc.freq_rel(term) * @idf[term]\n\t\t\t\t@weight[[term,doc]] = value\n\n\t\t\t\tassert { value >= 0 }\n\t\t\tend\n\t\tend\n\tend",
"def prob_word_dist(arr)\n\tcounts = {}\n\t(0..arr[0].size-1).each do |i|\n\t\tcounts[i] = {}\n\tend\n\tarr.each do |word|\n\t\t(0..word.size-1).each do |i|\n\t\t\tif counts[i].has_key?(word[i]) then\n\t\t\t\tcounts[i][word[i]] += 1\n\t\t\telse\n\t\t\t\tcounts[i][word[i]] = 1\n\t\t\tend\n\t\tend\n\tend\n\tresult = []\n\t(0..arr.size-1).each do |i|\n\t\tcurr_word = \"\"\n\t\t(0..arr[0].size-1).each do |j|\n\t\t\ttemp_arr = []\n\t\t\tcounts[j].keys.each do |char|\n\t\t\t\t(1..counts[i][char]) do\n\t\t\t\t\ttemp_arr.push(char)\n\t\t\t\tend\n\t\t\tend\n\t\t\tcurr_word += temp_arr[random * temp_arr.size]\n\t\tend\n\t\tresult.add[curr_word]\n\tend",
"def find_frequency(sentence, word)\n word = word.downcase\n sentence.downcase.split.count(word)\nend",
"def extract\n # create hash of words with number of their instances in tokens excluding stopwords\n words_hash = Hash.new(0)\n @tokens.each { |w| \n unless w.empty? or stop_words_for(@language)[w]\n words_hash[w] += 1 \n end\n }\n\n idfs_hash = get_idfs(words_hash.keys)\n\n # calculate tf-idf for each word into keywords array\n keywords = []\n max_num = words_hash.values.max.to_f\n words_hash.each do |word, num|\n tf = num / max_num\n idf = idfs_hash[word]\n keywords << [word, (tf * idf).round(5), idf.round(5)]\n end\n\n # return keywords sorted by rank descending\n keywords.sort_by {|word, rank, idf| -rank}\n end",
"def d(doc)\n _d = 0.0\n doc.keys.each do |term|\n _d += doc[term]**2.0\n end\n return _d\n end",
"def compute_df_tf\n @df_in_dataset = {}\n @tf_in_dataset = {}\n @df_in_corpus = {}\n \n @dataset.entries.each do |e|\n doc = Document.find_with_fulltext e.shasum\n tv = doc.term_vectors\n \n tv.each do |word, hash|\n # Oddly enough, you'll get weird bogus values for words that don't\n # appear in your document back from Solr. Not sure what's up with\n # that.\n @df_in_corpus[word] = hash[:df] unless hash[:df] == 0\n next if hash[:tf] == 0\n \n @tf_in_dataset[word] ||= 0\n @tf_in_dataset[word] += hash[:tf]\n\n @df_in_dataset[word] ||= 0\n @df_in_dataset[word] += 1\n end\n end\n\n @num_dataset_types ||= @tf_in_dataset.count\n @num_dataset_tokens ||= @tf_in_dataset.values.reduce(:+)\n end",
"def count_frequency(word_list, counts)\r\n ignore_list = %w[it its she her he him his they them their i me my you your we us our any]\r\n ignore_list += %w[is be been are was were has have had will would can could do did]\r\n ignore_list += %w[what when where which who whom there here that this these]\r\n ignore_list += %w[for by from at with on to of in into out up down upon back all also about]\r\n ignore_list += %w[ms mrs mr miss no not most more than one an the before after yet so if and as but or then]\r\n ignore_list += ('a'..'z').to_a\r\n word_list = word_list - ignore_list\r\n for word in word_list\r\n counts[word] += 1\r\n end\r\n counts\r\n\r\nend",
"def doc_probability(event, category)\n @tokenizer.tokenize(event, @features).map { |w|\n word_weighted_average(w, category)\n }.inject(1) { |p, c| p * c }\n end",
"def contar(texto)\n palavras = texto.split\n\n frequencies = Hash.new(0)\n\n palavras.each do |word|\n frequencies [word] += 1\n end\n\n frequencies = frequencies.sort_by do |wor, count|\n end\n frequencies.reverse!\n\n frequencies.each do |wor, count|\n puts wor + \" \" + count.to_s\n end\nend",
"def file_probability(word1, word2=nil)\n bigram = (Bigram === word1 ? word1 : get(word1, word2))\n BigDecimal.new(bigram.files.size) / analysis.files.size\n end",
"def get_word_freq(token)\n lemma = token.is_a?(Token)? token.lemma : token\n word_counts[lemma] || 0\n end",
"def wordprob(word, category)\n numerator = self.word_count_in_category(word, category) + 1\n denominator = self.all_word_count_in_category(category) + self.vocabularies.size\n return numerator / denominator\n end",
"def word_count(text)\n\tnew_text = text.split(\" \") #-->Use text.split to turn text into an array that breaks(splits) at each space.\n\t\n \tcounter = Hash.new(0) #-->Next create an empty hash for your results with count = Hash.new (0)\n\n \tnew_text.each {|word| counter[word] += 1} #-->Use a method that will take each word in the array\n\n \tputs counter #-->This will give us our results printed on the screen\nend",
"def word_sizes(sentence)\n sentence.split.each_with_object(Hash.new(0)) { |word, obj| obj[word.size] += 1 } \nend",
"def word_count_mr\n self.words = Hash[self.class.where(:_id=>self.id).map_reduce(MapReduce::word_count(\"title\"),MapReduce::word_count_reduce).out(inline:1).collect { |x,y| [ x[\"_id\"],x[\"value\"][\"count\"].to_i ] }]\n end",
"def d(doc)\n doc.keys.inject(0.0) do |d, term|\n d + doc[term]**2.0\n end\n end",
"def word_tag_probability(word, tag)\n denom = @tag_frequencies[tag]\n\n if denom.zero?\n 0\n else\n @word_tag_combos[\"#{word}/#{tag}\"] / denom.to_f\n end\n end",
"def score(word)\n LETTERS.zip(VALUES_OF_LETTERS).map{|x| word.count(x[0])*x[1] }.reduce(:+)\nend",
"def word_sizes2(string)\n frequency = Hash.new(0) #set the default value to 0\n string.split.each do |word| \n frequency[word.length] += 1\n end\n frequency\nend",
"def words_count\n get_at_words_count + \n get_ata_words_count + \n get_noun_words_count + \n get_adjective_words_count\n end",
"def call\n total = dataset.document_count\n ret = {}\n\n enum = RLetters::Datasets::DocumentEnumerator.new(dataset: dataset)\n enum.each_with_index do |doc, i|\n progress&.call((i.to_f / total.to_f * 100).to_i)\n\n lister = Documents::WordList.new\n words = lister.words_for(doc.uid)\n\n tagged = Tagger.add_tags(words.join(' '))\n next if tagged.nil?\n\n nouns = Tagger.get_nouns(tagged)\n next if nouns.nil?\n\n ret.merge!(nouns) { |_, v1, v2| v1 + v2 }\n end\n\n progress&.call(100)\n ret.sort_by { |(_, v)| -v }\n end",
"def train texts\n model = Hash.new(0)\n texts.each do |text|\n File.new(text).read.downcase.scan(/[a-z]+/).each do |word|\n model[word] += 1\n end\n end\n return model\nend",
"def find_frequency(sentence, word)\n calc_count = 0\n sentence.split(' ').each_with_object([]) do |i, j|\n calc_count += 1 if i.downcase == word\n end\n return calc_count\nend",
"def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end",
"def percent_fog_complex_words\n ( @complex_words.to_f / @words.length.to_f ) * 100\n end",
"def sorted_word_count\n\n\t counts = text_nodes.inject(Hash.new(0)) do |word_counts, node|\n\t\tnode.text().scan(WORD_REGEX).each {|match| word_counts[match.first.upcase] += 1}\n\t\tword_counts\n\t end\n\t counts.sort{|a,b| b[1] <=> a[1]}\n\n end",
"def train(text, label)\n @tokenizer.tokenize(text).each { |token| @data[label][token] += 1 }\n @doc_counts[label] += 1\n end",
"def find_words(words)\n search_results = SearchResults.new\n \n general = Vector.new\n must_match = Vector.new\n must_not_match = Vector.new\n not_found = false\n \n extract_words_for_searcher(words.join(' ')) do |word|\n case word[0]\n when ?+\n word = word[1,99]\n vector = must_match\n when ?-\n \t word = word[1,99]\n vector = must_not_match\n else\n \t vector = general\n end\n \n index = @dict.find(word.downcase)\n if index\n vector.add_word_index(index)\n else\n not_found = true\n \t search_results.add_warning \"'#{word}' does not occur in the documents\"\n end\n end\n \n if (general.num_bits + must_match.num_bits).zero? \n search_results.add_warning \"No valid search terms given\"\n elsif not not_found\n res = []\n @document_vectors.each do |entry, (dvec, mtime)|\n score = dvec.score_against(must_match, must_not_match, general)\n res << [ entry, score ] if score > 0\n end\n \n res.sort {|a,b| b[1] <=> a[1] }.each {|name, score|\n search_results.add_result(name, score)\n }\n \n search_results.add_warning \"No matches\" unless search_results.contains_matches\n end\n search_results\n end",
"def run_corpus # :nodoc:\n tokens = @processor.process\n tokens.each do |token|\n category = @db[token]\n @matches[category] << token if category # word's in corpus.\n end\n end",
"def count_words words\n\t\t\t\twords.empty? ? 0 : App.rdf_collection.find({\n\t\t\t\t\t:\"$or\" => words.map {|i| {:o => i}},\n\t\t\t\t\t:p => RDF::RDFS.label.to_s}).count\n\t\t\tend",
"def texts_score(text1, text2)\n words1 = text1.downcase.scan(/[a-zA-Z]+/) - noise_words\n words2 = text2.downcase.scan(/[a-zA-Z]+/) - noise_words\n common_words = words1 & words2\n p common_words\n common_words.length.to_f / (words1.length + words2.length)\n end",
"def train(words)\n increases = @categories.filter(@name).inject(words)\n @size += increases[@name]\n end",
"def word_prob(category, word)\n cat_freq = word_freq(category, word)\n non_cat_freq = word_freq(counter.keys, word) - cat_freq\n cat_docs = doc_size(category)\n non_cat_docs = doc_size(doc_counter.keys) - cat_docs\n\n cat_prob = [1.0 * cat_freq / cat_docs, 1.0].min\n non_cat_prob = [1.0 * non_cat_freq / non_cat_docs, 1.0].min\n\n if cat_prob == 0.0\n cond_prob = 0.4\n else\n cond_prob = 1.0 * cat_prob / (cat_prob + non_cat_prob)\n end\n\n # STDOUT.puts \"#{category}-#{word}, cat #{cat_prob}, non_cat #{non_cat_prob}, cond_p #{cond_prob}\"\n\n cond_prob = [[cond_prob, 0.99].min, 0.01].max\n end",
"def words_per_sentence\n @words.length.to_f / @sentences.length.to_f\n end",
"def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend",
"def average_word_count\n return 0 if self.collection_yaml.nil?\n return self[:average_word_count] unless self[:average_word_count].nil?\n \n self[:average_word_count] = (self.treat_collection.documents.inject(0) do |t, doc|\n t + doc.words.size\n end) / self.treat_collection.documents.size\n self.save!\n \n self[:average_word_count]\n end",
"def word_count\n\t\tputs \"There are #{@dictionary_analyzer.word_count(@dictionary)} words in this dictionary.\"\n\tend",
"def calculate_tfidf_weights_of_new_document(new_doc)\n termfreq = @tf.calculate(new_doc.contents)\n\n @tfidf[new_doc.id] = termfreq.each_with_object({}) do |(term, tf), tfidf_weights|\n weight = tf * (@idf_weights[term] || @idf.maxIDF)\n tfidf_weights[term] = weight\n end\n @tfidf\n end",
"def farm_words(index, entry_content, freqs, word_counts)\n\twords = Sanitize.clean(entry_content.downcase).split(/[^a-zA-Z](?<!['\\-])/) \t# <= clean up & split the words\n\twords.each do |word|\n\t\tnext if !Blacklist.find_by_word(word).nil?\t\t\t\t\t\t\t\t\t\t\t\t\t# <= check against blacklist\n\t\tif freqs[word][index].nil?\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# <= if word doesn't exist yet\n\t\t\t(index - freqs[word].size).times { freqs[word] << 0\t}\t\t\t\t\t\t\t\t\t# <= add a zero for each entry until this one\n\t\t\tfreqs[word] << 1\n\t\telse\n\t\t\tfreqs[word][index] += 1\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t# <= otherwise, just increment the count\n\t\tend\n\tend\n\tword_counts[index] += words.size\nend",
"def count\n self.wordcounts.map(&:count).inject(0, :+)\n end",
"def page_sentiment (positive, negative)\n totalwords = 0\n count = 0.0\n sentimentwords = 0.0\n if(@thewords)\n #This is the main loop, if each word is positive or negative in the document adjust variables accordingly.\n @thewords.each do |word|\n totalwords+= 1\n if positive.map(&:downcase).include? word[0].downcase\n # puts word[0]\n count +=word[1]\n sentimentwords +=word[1]\n elsif negative.map(&:downcase).include? word[0].downcase\n # puts word[0]\n count -=word[1]\n sentimentwords +=word[1]\n end\n end\n end\n ratio = count/sentimentwords\n if (ratio > 0.10)\n count = 1\n elsif (ratio < -0.10)\n count = -1\n else\n count = 0\n end\n return count\n end"
] |
[
"0.7699382",
"0.73476",
"0.72993225",
"0.7179902",
"0.7063857",
"0.7047761",
"0.6792026",
"0.67630196",
"0.67150044",
"0.6678528",
"0.6675041",
"0.6614578",
"0.6613643",
"0.65825874",
"0.6520865",
"0.65160424",
"0.65044916",
"0.64923483",
"0.6442208",
"0.6389798",
"0.6380805",
"0.6354959",
"0.6328089",
"0.63120186",
"0.6302497",
"0.6257986",
"0.6226057",
"0.6220657",
"0.6209319",
"0.6195799",
"0.6182942",
"0.61807686",
"0.6151735",
"0.6134946",
"0.6101499",
"0.60970485",
"0.60906285",
"0.60745853",
"0.60652477",
"0.6051217",
"0.60289824",
"0.60219544",
"0.6017194",
"0.60051346",
"0.6000199",
"0.5983252",
"0.5978984",
"0.5978379",
"0.59772134",
"0.59761083",
"0.59761083",
"0.59735566",
"0.5958046",
"0.59433216",
"0.5933924",
"0.59324104",
"0.5923594",
"0.5908927",
"0.5905983",
"0.59036994",
"0.5903527",
"0.58903235",
"0.5889629",
"0.58885175",
"0.5861461",
"0.58573246",
"0.5849913",
"0.5841612",
"0.5836951",
"0.58292264",
"0.5815562",
"0.57949746",
"0.577463",
"0.5773873",
"0.5772812",
"0.5756849",
"0.57558334",
"0.5752196",
"0.5751914",
"0.5740175",
"0.5734136",
"0.5732201",
"0.57292134",
"0.5704738",
"0.56991607",
"0.56980455",
"0.56947225",
"0.5693711",
"0.56923276",
"0.568354",
"0.56785727",
"0.5676675",
"0.567413",
"0.5670195",
"0.56669724",
"0.56613547",
"0.5653299",
"0.5647032",
"0.56463856",
"0.5638947",
"0.5638144"
] |
0.0
|
-1
|
try to ennsure that if I "archive" 3 app results today, they don't get thrown in with these ...while at the same time, I don't necessarily want to have them hang around until they would be autoarchived either...
|
def call
return if @customer.nil? || @results.blank?
raise S3SaveError unless upload_records
@results.update_all(archive_state: :archived)
# ServiceRunnerJob.perform_later("Pipeline::Archive::Destroyer", "app_results", @customer.id)
return unless @remaining_results_count > 2500
ServiceRunnerJob.perform_later("Pipeline::Archive::Archiver", @customer.id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fixArchiveMeta\n nDone = 0\n allIDs = Item.where(Sequel.lit(\"updated >= '2020-05-18'\")).select_map(:id)\n allIDs.sort.each_slice(100) { |ids|\n DB.transaction {\n ids.each { |itemID| collectArchiveMeta(itemID, nil).save }\n }\n nDone += ids.length\n puts \"#{nDone}/#{allIDs.length} done.\"\n }\nend",
"def cleanup_abandoned\n Reservation.all(:conditions => [ \"CONFIRM = ? and updated_at < ? and archived = ?\", false, 30.minutes.ago, false]).each do |r|\n debug \"cleanup_abandoned: deleting #{r.id}\"\n Reason.close_reason_is \"abandoned\"\n begin\n\tr.archive\n rescue RuntimeError => err\n\terror 'Cleanup: ' + err.to_s\n rescue ActiveRecord::StaleObjectError => err\n\terror 'Cleanup: ' + err.to_s\n\tlocking_error(r)\n end\n end\n end",
"def archive_ok?\n #todo, we lack any real heuristic for this.\n true\n end",
"def archival?\n false\n end",
"def archival?\n false\n end",
"def confirm_archive\n end",
"def no_archive?\n false\n end",
"def archive\n # Only show reservations that were ever actually checked out\n @reservations = Reservation.where('checked_out_time is not null')\n end",
"def not_scheduled_applications\n accepted_applications.select do |a|\n been_in_stage_for(a, 7.days.ago)\n end\n end",
"def fix_dates( data )\n\n ## check for missing / no dates \n ## examples\n ## - rubytogether feed @ https://rubytogether.org/news.xml\n data.items.each do |item|\n if item.updated.nil? &&\n item.published.nil?\n ## try to get date from slug in url\n ## e.g. /news/2019-10-17-growing-ruby-together\n if (m=FIX_DATE_SLUG_RE.match( item.url ))\n ## todo/fix: make sure DateTime gets utc (no timezone/offset +000)\n published = DateTime.new( m[:year].to_i(10),\n m[:month].to_i(10),\n m[:day].to_i(10) )\n item.published_local = published\n item.published = published\n end\n end\n end\n\n \n ## check if all updated dates are the same (uniq count is 1)\n ## AND if all published dates are present\n ## than assume \"fake\" updated dates and nullify updated dates\n ## example real-world \"messed-up\" feeds include:\n ## - https://bundler.io/blog/feed.xml\n ## - https://dry-rb.org/feed.xml\n ##\n ## todo/check - limit to atom feed format only - why? why not?\n\n count = data.items.size\n count_published = data.items.reduce( 0 ) {|count,item| count += 1 if item.published; count }\n\n if count == count_published\n uniq_count_updated = 0\n last_updated = nil\n\n data.items.each do |item|\n uniq_count_updated += 1 if item.updated != last_updated\n last_updated = item.updated\n end\n\n if uniq_count_updated == 1\n puts \"bingo!! nullify all updated dates\"\n ## todo/fix: log report updated date fix!!!!\n data.items.each do |item|\n item.updated = nil\n item.updated_local = nil\n end\n end\n end\n end",
"def remove_depricated\n self.articles.each do |a|\n unless ((a.created_at + 3.days) > Date.today) \n self.articles.delete(a)\n end\n end\n\tend",
"def wrap_it_up\n publish(@timestamped,'maps') if @vault.size > 0\n end",
"def archive!\n if lock_file_present?(lock_file_name)\n logger.warn \"Lock file \\\"#{lock_file_name}\\\" still there, skipping.\"\n return\n end\n\n begin\n FileUtils.touch lock_file_name\n\n if seq_complete? && dir_forbidden?\n sync!\n\n year = \"20#{run_name[0..1]}\"\n local_archive_dir = File.join(Conf.global_conf[:basecall_dir], year)\n\n # final rsync done\n FileUtils.mkdir local_archive_dir unless File.directory?(local_archive_dir)\n\n new_run_dir = File.join(local_archive_dir, run_name) \n\n raise Errors::DuplicateRunError.new(\"Duplicate run name detected (#{run_name})\") if File.directory?(new_run_dir)\n\n install_run(new_run_dir)\n @run_dir = new_run_dir\n Mailer.notify_run_finished(self)\n\n # guess what\n duplicity!\n\n else\n logger.warn \"Sequencing still running, just sync'ing.\"\n sync!\n end\n rescue => e\n logger.error \"while performing the archiviation step:\"\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\")\n Mailer.notify_admins(self, 'archive', e)\n ensure\n FileUtils.rm lock_file_name if lock_file_present?(lock_file_name)\n end\n end",
"def can_be_archived?\n false\n end",
"def check_if_asqs_up_to_date\n asq = Asq.all.order(last_run: :desc).limit(1)[0]\n return true if !asq.nil? && asq.last_run > Time.now - 20.minutes\n false\n end",
"def skip_week\n for item in action_items\n item.skip! unless item.complete?\n end\n\n end",
"def unpublishable?\n [ UP_TO_DATE, OUT_OF_DATE ].include? flickr_status\n end",
"def discard_results; end",
"def archive_run_result\n @results_archive.save_run_result(@config_manager['run.name'])\n end",
"def not_delivered\n PeriodDocument.scanned.where(\"scanned_at >= ?\", 30.days.ago).select do |scan|\n result = false\n\n temp_pack = TempPack.where(name: scan.name).first\n\n if temp_pack\n # NOTE minus 10 days because PPP delivers a few days before entering the information inside iDocus\n result = temp_pack.temp_documents.scan.where(\"created_at >= ?\", scan.scanned_at-10.days).empty?\n else\n result = true\n end\n\n print (result ? '!' : '.')\n\n result\n end.map(&:name)\n end",
"def allow_vendor_archive?\n [EXPIRED, ACCEPTED, DECLINED, SHIPPED, FINALIZED, AUTO_FINALIZED, REFUND_REQUESTED, REFUND_FINALIZED, ADMIN_FINALIZED].include?(status) &&\n !archived_by_vendor\n end",
"def process_stale_issues\n handle_newly_stale_issues\n handle_stale_and_unmergable_prs\n end",
"def cleanup\n close_file_appender\n archive_run_result if (defined? @results_archive) && @archive_results\n end",
"def set_day_if_discarded; end",
"def process_paused_offers\n asana = AsanaCommunicator.new\n Offer.where(aasm_state: 'paused').find_each do |paused_offer|\n if (Time.zone.now + 30.days).to_date == paused_offer.starts_at.to_date\n asana.create_seasonal_offer_ready_for_checkup_task paused_offer\n end\n end\n end",
"def mark_for_cleanup\n add_accounts_from_activities\n end",
"def archive\n current_user.issues.closed.where(:archived_at => nil).update_all :archived_at => Time.now\n\n head :ok\n end",
"def test_archive_multiple_invocations\n setup_clean_accounts\n add_movs\n Accounts.archive(6, 2012)\n incomes = get_sorted_accounts('Income')\n cash = get_sorted_accounts('cash')\n\n assert_equal 3, incomes.length\n assert_equal 1, incomes[0].movements.length\n assert_equal 1, incomes[1].movements.length\n assert_equal 1, incomes[2].movements.length\n cash.each { |a|\n dputs(1) { \"#{a.path} - #{a.movements.length}\" }\n }\n assert_equal 3, cash.length\n assert_equal 1, cash[0].movements.length\n assert_equal 2, cash[1].movements.length\n assert_equal 2, cash[2].movements.length\n\n Accounts.archive(6, 2012)\n incomes = get_sorted_accounts('Income')\n cash = get_sorted_accounts('cash')\n\n assert_equal 3, incomes.length\n assert_equal 1, incomes[0].movements.length\n assert_equal 1, incomes[1].movements.length\n assert_equal 1, incomes[2].movements.length\n cash.each { |a|\n dputs(1) { \"#{a.path} - #{a.movements.length}\" }\n }\n assert_equal 3, cash.length\n assert_equal 1, cash[0].movements.length\n assert_equal 2, cash[1].movements.length\n assert_equal 2, cash[2].movements.length\n end",
"def abandon_results!()\n #This is a stub, used for indexing\n end",
"def already_reported; end",
"def already_reported; end",
"def no_recent_plagiarism\n if @submission.user == current_user.sk\n s = current_user.sk.submissions.where(:problem => @problem, :status => :plagiarized).order(:last_comment_time).last\n if !s.nil? && s.last_comment_time.to_date + 6.months > Date.today\n redirect_to problem_path(@problem, :sub => @submission) and return\n end\n end\n end",
"def no_other_reservations_on_this_time_period\n item_reservations.each do |ir|\n item = ir.item\n amount_available = item.get_availability(pick_up_time.to_datetime, return_time.to_datetime, id)\n if ir.amount > amount_available\n if amount_available > 0\n errors.add(:items, errors.generate_message(:items, :too_few_available, { :item_title => item.title, :count => amount_available.to_s }))\n else\n errors.add(:items, errors.generate_message(:items, :none_available, { :item_title => item.title }))\n end \n end\n end \n end",
"def must_pay_to_avoid_cancellation\n\t\tif @event.start_date < (Time.now + 1.week) && @event.paid == false \n\t\t\t#cannot book event\n\t\tend\n\tend",
"def no_recent_plagiarism\n s = current_user.sk.submissions.where(:problem => @problem, :status => :plagiarized).order(:last_comment_time).last\n if !s.nil? && s.last_comment_time.to_date + 6.months > Date.today\n redirect_to problem_path(@problem) and return\n end\n end",
"def archive\n self.paper_trail_event = \"archive\"\n self.discard\n end",
"def archive!\n return false if published_at.nil?\n\n update_column :published_at, nil\n end",
"def publishResourcesExit(app_id, run_id, resources, baseStationRid)\n # Cache\n cache = RoomPlacesCachePublish.get_cache(app_id, run_id)\n\n cache.resources_exit(resources, baseStationRid)\nend",
"def publish(ex)\n flag = false\n unless ex.exams.nil?\n ex.exams.each do |exam|\n next if exam.end_time.nil?\n flag = true if exam.end_time >= Date.today\n end\n end\n flag\n end",
"def archive_notice\n if d(@issue.date) < d(PubDate.latest.date) #MHO sb < & use real dates\n content_tag('p', 'You are in the archives.', :class => 'red cntr')\n end\n end",
"def find_all_pending_publication\n find(:all, :conditions => [\"responses.status = ? AND responses.published_at < ?\", \n 'created', Time.now.utc - 30.days])\n end",
"def find_all_pending_publication\n find(:all, :conditions => [\"kases.status = ? AND kases.published_at < ?\", \n 'created', Time.now.utc - 30.days])\n end",
"def set_unarchive_flag\n self.just_unarchived = true\n end",
"def perform\n archived_count = 0\n expired_users_with_email.find_each do |user|\n archived_count += 1 if archive_user(user)\n end\n expired_users_with_accounts.find_each do |user|\n archived_count += 1 if archive_user(user)\n end\n archived_count\n end",
"def cleanup_dead_deployment\n @@recover_count = @@recover_count + 1\n puts \"Recover count: \" + @@recover_count.to_s\n if @@recover_count >= 2\n puts \"To many recover process running, skip it\"\n @@recover_count = @@recover_count - 1\n return\n end\n ScheduleTask.cleanup_dead_deployment(9, 2, \"id desc\") \n @@recover_count = @@recover_count - 1\nend",
"def print_old_list(app_file_list,rm_file)\n if !File.directory?($itunes_dir) and !File.symlink?($itunes_dir)\n puts \"Could not find iTunes directory \"+$itunes_dir\n exit\n end\n app_dir = $itunes_dir+\"/iTunes Media/Mobile Applications\"\n if !File.directory?(app_dir) and !File.symlink?(app_dir)\n puts \"Could not find Mobile Applications directory \"+app_dir\n exit\n end\n app_list = {}\n app_file_list.each do |file_name|\n if file_name.match(/ipa$/)\n file_info = file_name.split(/(\\s+)/)\n if file_info[-3].match(/[0-9]\\./) and file_info[-1].match(/\\.ipa/)\n app_name = file_info[0..-5].join\n app_ver = file_info[-3]\n else\n app_name = file_info[0..-3].join\n app_ver = file_info[-1].split(/\\./)[0..-2].join(\".\")\n end\n if !app_list[app_name]\n app_list[app_name] = app_ver\n lat_ver = app_ver\n else\n cur_ver = app_list[app_name]\n versions = [ cur_ver, app_ver ]\n lat_ver = versions.map{ |v| (v.split '.').collect(&:to_i) }.max.join '.'\n end\n app_list[app_name] = lat_ver\n end\n end\n app_file_list.each do |file_name|\n if file_name.match(/ipa$/)\n file_info = file_name.split(/(\\s+)/)\n if file_info[-3].match(/[0-9]\\./) and file_info[-1].match(/\\.ipa/)\n app_name = file_info[0..-5].join\n app_ver = file_info[-3]\n else\n app_name = file_info[0..-3].join\n app_ver = file_info[-1].split(/\\./)[0..-2].join(\".\")\n end\n lat_ver = app_list[app_name]\n if lat_ver != app_ver\n app_file = app_dir+\"/\"+file_name\n if rm_file == \"y\"\n puts \"Deleting: \"+app_file\n File.delete(app_file)\n else\n puts \"Application: \"+app_name\n puts \"Newest: \"+lat_ver\n puts \"Older: \"+app_ver\n end\n end\n end\n end\n return\nend",
"def fix_scheduled_actions\n @db.transaction do\n # Removing hanging Scheduled Actions\n @to_delete.each do |o|\n @db[:schedaction_pool].where(:oid => o.id, :type => o.type).delete\n end\n end\n end",
"def archive_constraints\n if is_archived_changed? && self.running?\n errors.add(:archive, 'a running sprint is not allowed.')\n end\n end",
"def enumerate_snapshots_to_be_pruned\n backed_up_snapshots = self.snapshots\n backed_up_snapshot_descriptions = backed_up_snapshots.collect { |bus| bus.description }\n prunees = []\n before = Date.today - ( Config.accounts[account.name][:backup][:days] || VfSnapshots::DEFAULT_BACKUP_DAYS )\n backed_up_snapshots.each do |snapshot|\n old_desc = snapshot.description.sub(\"#{account.name} \",'')\n account_name = snapshot.description.split(VfSnapshots::DESC_REGEX).first.chop\n if account_name == account.name\n if /^(\\d{14})/.match(old_desc)\n ts = Time.parse($1).to_date\n prunees << snapshot if (VfSnapshots::DESC_REGEX =~ old_desc) && ts < before\n end\n end\n end\n prunees\n end",
"def reject_notes_and_add_intervened\n self.intervened = false\n \n 1.upto(4).each do |n|\n note_content = self.send(\"note_#{n}\")\n if note_content == school.default_note_content\n self.send(\"note_#{n}=\", nil)\n elsif note_content.present?\n self.intervened = true\n end\n end\n \n count = 0\n interventions.each do |intervention|\n if intervention.content_blank?\n if count > 10\n intervention.destroy\n else\n count += 1\n end\n elsif !intervention.completed\n self.intervened = true\n end\n end\n \n true # Return true otherwise the before_save filter will abort the save.\n end",
"def ungraded_submission_results\n current_submissions_used.joins(:current_result)\n .where('results.marking_state': Result::MARKING_STATES[:incomplete])\n end",
"def store_results(subreddit, which_q, results)\n if results.empty?\n subreddit[\"#{which_q}_recent\"] = []\n @l.info \"nothing to report, #{subreddit.name}::#{which_q} is empty\" \n else\n subreddit[\"#{which_q}_recent\"] = results\n @l.info \"#{results.count} new items from #{subreddit.name}::#{which_q} to check\"\n end\n end",
"def perform\n puts \"Performing cleanup of playlist belonging to inactive users...\"\n Playlist.clear_stale\n puts \"Cleanup complete.\"\n self.class.set(wait: 24.hours).perform_later\n end",
"def no_spamming\n created_urls = submitter.submitted_urls\n num_of_recent_urls = created_urls\n .where('created_at > ?', 1.minute.ago)\n .count\n\n raise \"Cannot create more than 5 shortened links in a minute!\" if num_of_recent_urls >= 5 \n end",
"def get_results\n \titems = self.possessions.find(:all, :limit => 20, :order => 'wants_count DESC')\n #reset data just for testing\n Possession.all.each do |item|\n item.new_owner = nil\n item.save\n end\n \t# items = prune(items)\n \tif items.count > 1\n \t\tfind_some_trades(items)\n \tend\n end",
"def archive\n self.snapshot_action = \"archive\"\n self.discard\n end",
"def bump_old_submissions\n while grouping.reload.has_submission?\n old_submission = grouping.current_submission_used\n if self.submission_version.nil? || (self.submission_version <= old_submission.submission_version)\n self.submission_version = old_submission.submission_version + 1\n end\n old_submission.submission_version_used = false\n old_submission.save\n old_result = old_submission.get_original_result\n old_result.released_to_students = false\n old_result.save\n end\n end",
"def refresh_if_near_expiration; end",
"def filter_old_retweets\n\t@tweet_db.each do |tweet_id, tweet_data|\n\t\ttweet_data[:retweets].delete_if do |id, retweet| \n\t\t\t#if the time now in minutes is greater than or equal to the user defined\n\t\t\t#window, then remove that retweet.\n\t\t\t(Time.now - retweet.created_at).to_i / 60 >= @user_defined_window\n\t\tend\n\tend\nend",
"def cleanup_unposted_works\n works.find(:all, :conditions => ['works.posted = ? AND works.created_at < ?', false, 1.week.ago]).each do |w|\n w.destroy\n end\n end",
"def next_alert_time\n false\n end",
"def handleAssocChanges(postNum, pub, ids, oapID, assocChanges)\n\n # Collate the records by old OAP ID\n fromOAPs = Hash.new { |h,k| h[k] = Set.new }\n assocChanges.each { |campusID, fromOAP, toOAP| fromOAPs[fromOAP] << campusID }\n\n # Figure out which old OAP IDs will end up abandoned, and which are being disassociated\n abandoned = []\n fromOAPs.each { |fromOAP, campusIDs|\n existing = Set.new(db_execute(\"SELECT campus_id FROM ids WHERE oap_id = ?\", fromOAP).map { |row| row[0] })\n if (existing - campusIDs).empty?\n abandoned << fromOAP\n end\n }\n\n disassoc = assocChanges.map{ |campusID, fromOAP, toOAP| toOAP ? nil : fromOAP }.compact\n\n # Ensure that all IDs being abandoned or disassociated haven't been worked on by the users\n errs = []\n (abandoned+disassoc).each { |fromOAP|\n pubs = db_execute(\"SELECT pub_id FROM pubs WHERE oap_id = ?\", fromOAP).map { |row| row[0] }\n pubs.each { |pubID|\n n = db_get_first_value(\"SELECT count(*) FROM eschol_equiv WHERE pub_id = ?\", pubID)\n if n > 0\n errs << \"An eschol_equiv record is associated with publication #{pubID.inspect}, OAP #{fromOAP.inspect}.\"\n end\n n = $arkDb.get_first_value(\"SELECT count(*) FROM arks WHERE source = ? AND external_id = ?\", \"elements\", pubID)\n if n > 0\n errs << \"A file was deposited to eschol for publication #{pubID.inspect}, OAP #{fromOAP.inspect}.\"\n end\n }\n }\n\n if !errs.empty?\n puts \"Warning: The following association change will *not* be performed because of potential problems.\"\n assocChanges.each { |campusID, fromOAP, toOAP|\n if toOAP\n puts \" Change: Campus item #{campusID} switching from oapID #{fromOAP.inspect} to #{toOAP.inspect}.\"\n else\n puts \" Change: Campus item #{campusID} leaving oapID #{fromOAP.inspect}.\"\n end\n }\n errs.each { |err|\n puts \" Potential problem: #{err}\"\n }\n return false\n end\n\n puts \"Note: The following association change appears to be OK, going ahead.\"\n if !abandoned.empty?\n puts \" Abandoned IDs: #{abandoned.inspect}\"\n end\n assocChanges.each { |campusID, fromOAP, toOAP|\n if toOAP\n puts \" Change: Campus item #{campusID} switching from oapID #{fromOAP.inspect} to #{toOAP.inspect}.\"\n else\n puts \" Change: Campus item #{campusID} leaving oapID #{fromOAP.inspect}.\"\n end\n }\n\n # Drop the old OAP record in Elements\n abandoned.each { |fromOAP|\n puts \" Deleting abandoned record #{fromOAP.inspect}.\"\n if $testMode\n puts \" (test mode: not deleting old OAP item)\"\n next\n end\n uri = URI(\"#{$elementsAPI}/publication/records/c-inst-1/#{CGI.escape(fromOAP)}\")\n req = Net::HTTP::Delete.new(uri)\n req.basic_auth $apiCred[0], $apiCred[1]\n (1..10).each { |tryNumber|\n\n $transLog.write(\"\\n---------------------------------------------------------------\\n\")\n $transLog.write(\"\\nDELETE #{uri}\\n\")\n $transLog.flush\n\n res = $elementsAPIConn.request(req)\n\n # Log the response\n $transLog.write(\"Response:\\n\")\n $transLog.write(\"#{res} code=#{res.code} message=#{res.message.inspect}\\n\")\n $transLog.write(\"#{res.body}\\n\")\n\n # HTTPConflict and HTTPGatewayTimeOut happen occasionally, and are likely transitory\n if res.is_a?(Net::HTTPConflict) || res.is_a?(Net::HTTPGatewayTimeOut)\n puts \" Note: failed due to #{res} (likely a transitory concurrency issue).\"\n if tryNumber < 20\n puts \" Will retry after a 30-second pause.\"\n sleep 30\n next\n else\n puts \" Out of retries. Aborting.\"\n end \n end\n\n # Fail if the DELETE failed\n res.is_a?(Net::HTTPSuccess) or raise(\"Error: delete failed: #{res}\")\n }\n }\n\n # Make the changes in our database\n assocChanges.each { |campusID, fromOAP, toOAP|\n if toOAP\n db_execute(\"INSERT OR REPLACE INTO ids (campus_id, oap_id) VALUES (?, ?)\", [campusID, toOAP])\n else\n db_execute(\"DELETE FROM ids WHERE campus_id = ? AND oap_id = ?\", [campusID, fromOAP])\n end\n }\n abandoned.each { |fromOAP|\n db_execute(\"DELETE FROM ids WHERE oap_id = ?\", fromOAP)\n db_execute(\"DELETE FROM pubs WHERE oap_id = ?\", fromOAP)\n db_execute(\"DELETE FROM oap_hashes WHERE oap_id = ?\", fromOAP)\n db_execute(\"DELETE FROM oap_flags WHERE oap_id = ?\", fromOAP)\n }\n\n # All done, and ready to proceed with import.\n return true\n\nend",
"def sync(playcounts)\n iTunes = Appscript.app('iTunes')\n iTunes.tracks.get.each do |track|\n begin\n artist = playcounts[Util.filter_name(track.artist.get)]\n if artist.nil?\n if extra_verbose\n puts \"Couldn't match up #{track.artist.get}\" \n end\n next\n end\n\n playcount = artist[Util.filter_name(track.name.get)]\n if playcount.nil?\n if extra_verbose\n puts \"Couldn't match up #{track.artist.get} - #{track.name.get}\"\n end\n next\n end\n\n itunes_playcount = track.played_count.get || 0\n\n if addpc\n new_itunes_playcount = playcount + itunes_playcount\n elsif playcount > itunes_playcount\n new_itunes_playcount = playcount\n end\n\n if new_itunes_playcount.nil?\n if verbose\n puts \"Skipping #{track.artist.get} - \\\"#{track.name.get}\\\", new playcount smaller than existing\"\n end\n elsif (max_play_count > 0 && new_itunes_playcount > max_play_count)\n if verbose\n puts \"Skipping #{track.artist.get} - \\\"#{track.name.get}\\\", new playcount #{new_itunes_playcount} > max #{max_play_count}\"\n end\n else\n if verbose\n puts \"Setting #{track.artist.get} - \\\"#{track.name.get}\\\" playcount from #{itunes_playcount} -> #{new_itunes_playcount}\"\n end\n track.played_count.set(new_itunes_playcount) unless dry_run\n end\n rescue SystemExit, Interrupt\n raise\n rescue Exception => e\n puts \"Encountered some kind of error on this track: #{e}: #{e.message}\"\n end\n end\n end",
"def future_single_events_cleanup\n self.single_events.rule_based_in_future.each do |single_event|\n single_event.delete unless schedule.occurs_at? single_event.occurrence\n end\n end",
"def check_multiple_activities\n if @activities.size > 1\n sorted = @activities.sort_by{|a| a[:number_of_hours].to_f}.reverse\n # puts sorted.collect{|a| a[:number_of_hours]}.join(\" > \")\n max_hours = sorted.first[:number_of_hours]\n for activity in sorted[1..sorted.size]\n remove_activity(activity, false)\n report = \"[MultipleActivities]: DUP #{activity[:source]} \"\n report << \"(#{activity[:number_of_hours]} hours <= #{max_hours} hours)\"\n @reports << report\n end\n end\n end",
"def under_quarantine\n @quarantine_lock.synchronize{@under_quarantine.keys}\n end",
"def possibly_set_as_completed\n # this is a guard against setting something completed that isn't and that will make this method fail\n return false unless available_in_merritt? # this also sets @mrt_results member variable so we don't have to redo the query again\n\n merritt_id = \"#{APP_CONFIG[:repository][:domain]}/d/#{@mrt_results['ark']}\"\n StashEngine.repository.harvested(identifier: resource.identifier, record_identifier: merritt_id)\n\n if StashEngine::RepoQueueState.where(resource_id: resource_id, state: 'completed').count < 1\n StashEngine.repository.class.update_repo_queue_state(resource_id: resource_id, state: 'completed')\n end\n\n update_size!\n ::StashEngine.repository.cleanup_files(resource)\n true\n end",
"def backup?\n @apps.length > 100 || seconds_since_last_backup > 30*60\n end",
"def info_cleaner\n Thread.new {\n while true\n cleaned = 0\n @store_info.return_all.each do |k,v|\n x = JSON.parse(v)\n alert_time = x['Timestamp'].to_i\n unless alert_time > Time.now.to_i-86400 # Is alert older than 24 hours?\n @store_info.delete(k)\n cleaned = cleaned + 1\n end\n end\n @log.info(\"Removed #{cleaned} old info alerts\")\n sleep 3600 # Sleep for an hour until we loop\n end\n }\n end",
"def convertAllItems(arks)\n # Let the user know what we're doing\n puts \"Converting #{arks==\"ALL\" ? \"all\" : \"selected\"} items.\"\n\n # Build a list of all valid units\n $allUnits = Unit.map { |unit| [unit.id, unit] }.to_h\n $allUnits['lbnl'].type = 'campus'\n\n # Build a cache of unit ancestors\n $unitAncestors = Hash.new { |h,k| h[k] = [] }\n UnitHier.each { |hier| $unitAncestors[hier.unit_id] << hier.ancestor_unit }\n\n # Fire up threads for doing the work in parallel\n Thread.abort_on_exception = true\n prefilterThread = Thread.new { prefilterAllItems }\n indexThread = Thread.new { indexAllItems }\n batchThread = Thread.new { processAllBatches }\n\n # Count how many total there are, for status updates\n $nTotal = QUEUE_DB.fetch(\"SELECT count(*) as total FROM indexStates WHERE indexName='erep'\").first[:total]\n\n # Convert all the items that are indexable\n query = QUEUE_DB[:indexStates].where(indexName: 'erep').select(:itemId, :time).order(:itemId)\n $nTotal = query.count\n if $skipTo\n puts \"Skipping all up to #{$skipTo}...\"\n query = query.where{ itemId >= \"ark:13030/#{$skipTo}\" }\n $nSkipped = $nTotal - query.count\n end\n query.all.each do |row| # all so we don't keep db locked\n shortArk = row[:itemId].sub(%r{^ark:/?13030/}, '')\n next if arks != 'ALL' && !arks.include?(shortArk)\n erepTime = Time.at(row[:time].to_i).to_time\n item = Item[shortArk]\n if !item || item.last_indexed.nil? || item.last_indexed < erepTime || $rescanMode\n $prefilterQueue << [shortArk, erepTime]\n else\n #puts \"#{shortArk} is up to date, skipping.\"\n $nSkipped += 1\n end\n end\n\n $prefilterQueue << nil # end-of-queue\n prefilterThread.join\n indexThread.join\n batchThread.join\nend",
"def fix_ude_approval_order_gaps?\n return false if self.reviewers.size == 0\n fixes_made = false\n\n last_o = 0\n self.reviewers.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order - last_o > 1\n ude.approval_order = last_o + 1\n ude.save\n fixes_made = true\n end\n last_o = ude.approval_order\n end\n max_o = last_o\n last_o = 0\n self.others_notified.sort_by{|ude|ude.approval_order}.each do |ude|\n if ude.approval_order > max_o\n ude.approval_order = max_o\n ude.save\n fixes_made = true\n end\n end\n return fixes_made\n end",
"def archers_ready(archers)\n archers.empty? ? false : archers.all?{ |x| x >= 5 }\nend",
"def check_internet_archive\n task = Task.create!(name: 'Preparing to check Internet Archive',\n service: Service::INTERNET_ARCHIVE,\n status: Task::Status::SUBMITTED)\n InternetArchive.new.check_async(task)\n rescue => e\n handle_error(e)\n else\n flash['success'] = 'Internet Archive check will begin momentarily.'\n ensure\n redirect_back fallback_location: tasks_path\n end",
"def archived\n now = Time.now\n @title = 'Menneet tapahtumat'\n @events = Event.find_recent(100).select { |e| e.date < now }\n\n respond_to do |format|\n format.html { render :action => :index }\n format.xml { render :xml => events }\n end\n end",
"def release_stale_reservations\n unreserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>0}).count\n reserved_count = @mongo.db('weather').collection('queue').find({:reserved_at=>{:$gt=>0}}).count\n log_yellow \"Unreserved: #{unreserved_count}, Reserved: #{reserved_count}\"\n\n res = @mongo.db('weather').collection('queue').update(\n {:reserved_at=>{:$lt=>Time.now.to_i-30, :$gt=>0}},\n {:$set=>{:reserved_at=>0}},\n {:multi=>true, :safe=>true});\n log_yellow \"Released #{res['n']} stale reservations.\"\n end",
"def archive_not_received_service_instances\n not_received = @source_refs_requested - @source_refs_received\n if not_received.present?\n archived_at = Time.now.utc.iso8601\n collection = TopologicalInventoryIngressApiClient::InventoryCollectionServiceInstance.new(:name => :service_instances, :data => [])\n\n not_received.each do |source_ref|\n svc_instance = TopologicalInventoryIngressApiClient::ServiceInstance.new(:archived_at => archived_at,\n :extra => {:status => 'deleted', :task_status => 'error'},\n :source_ref => source_ref)\n collection.data << svc_instance\n end\n logger.info_ext(operation, \"Archiving (source_refs: #{not_received.join(',')}). Jobs were deleted...\")\n save_inventory([collection], inventory_name, schema_name, @refresh_state_uuid, SecureRandom.uuid)\n logger.info_ext(operation, \"Archiving (source_refs: #{not_received.join(',')}). Complete\")\n end\n end",
"def cleanup_dead_deployment\n @@recover_count = @@recover_count + 1\n puts \"Recover count: \" + @@recover_count.to_s\n if @@recover_count >= 2\n puts \"To many recover process running, skip it\"\n @@recover_count = @@recover_count - 1\n return\n end\n ScheduleTask.cleanup_dead_deployment \n @@recover_count = @@recover_count - 1\nend",
"def update_top_jira_crashes(response)\n sort_criteria = \"crash_reasons?sort=number_of_crashes&page=1&order=desc\"\n platform_urls = Array.new\n ticket_keys_list = Array.new\n all_master_ids = get_all_master_ids()\n all_master_ids.each do |app, versions|\n versions.each do |version|\n platform_urls.push(\"#{config.jira.hockeyapp_url}/#{app}/app_versions/#{version}\")\n end\n end\n log.info \"hockeyapp_urls: #{platform_urls}\"\n\n platform_urls.each do |platform_url|\n crash_ids_counts = Hash.new\n count = 0\n http = Curl.get(\"#{platform_url}/#{sort_criteria}\") do|http|\n http.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n data = JSON.parse(http.body_str)\n data['crash_reasons'].each do |id|\n crash_ids_counts[id['id'].to_s] = id['number_of_crashes'].to_s\n count += 1\n if count == config.jira.hockeyapp_topN_crashes.to_i\n break;\n end\n end\n log.info \"crash_ids_counts: #{crash_ids_counts}\"\n\n crash_ids_counts.each do |crash_id, crash_count|\n url = \"#{platform_url}/crash_reasons/#{crash_id}\"\n http = Curl.get(url) do|http|\n http.headers['X-HockeyAppToken'] = \"#{config.jira.hockeyapp_token}\"\n end\n data = JSON.parse(http.body_str)\n # prevent the error when crash_reason does not have ticket_urls key\n if data['crash_reason'].key?('ticket_urls')\n ticket_key = data['crash_reason']['ticket_urls'][0].split('/').last\n if ticket_keys_list.include?(ticket_key)\n crash_count_old = current_crash_count(ticket_key)\n crash_count = crash_count_old.to_i + crash_count.to_i\n else\n ticket_keys_list.push(ticket_key)\n end\n log.info \"ticket-count: #{ticket_key}:#{crash_count}\"\n\n issue = fetch_issue(ticket_key)\n issue.save!(fields: { customfield_11602: crash_count.to_f })\n response.reply(\"Updated #{data['crash_reason']['ticket_urls'][0]} to #{crash_count} crashes.\")\n end\n end\n end\n end",
"def load_appointments\n # Appointment\n return unless current_user\n @appointments = current_user.appointments\n\n clean_open_appointments = sanatize_open_appointments(current_user.open_appointments)\n @pending_requests = clean_open_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @in_progress_appointments = current_user\n .in_progress_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n @scheduled_appointments = current_user.scheduled_appointments\n .group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @past_appointments = past_appointments.group_by do |d|\n start_date = set_in_timezone(d.start_date, current_user.id)\n start_date.strftime('%A %B %d')\n end\n\n @appointments = current_user.appointments\n\n # Appointment Packs\n @appointment_packs = active_appointment_packs\n @past_appointment_packs = past_appointment_packs\n end",
"def maybe_build_reinstalled_time_period\n return if uninstalled?\n return unless current_time_period&.uninstalled?\n\n reconcile_time_period(:reinstalled)\n true\n end",
"def fauxify!\n # cleanup the old ones\n self.delete_all\n # instantiate beginning date\n date = 13.months.ago.to_date\n # loop through the days till today\n cutoff_date = Date.parse(\"23/11/2012\")\n until date == cutoff_date\n # skip weekends\n unless (date.saturday? || date.sunday?)\n # choose a random number of entries between 3 and 25\n number_of_entries = (3..25).to_a.sample\n # create the given number of entries\n number_of_entries.times do\n hour = (9..17).to_a.sample\n minute = (0..59).to_a.sample\n # choose a random time in the day between 09:00 and 17:30 and a random happiness value\n entered_at = DateTime.parse(\"#{date} #{hour}:#{minute}\")\n # happiness_value = HappinessValue[]\n entry_date = entered_at.to_date\n entry_time = entered_at.to_time\n uid = entered_at.to_i\n happiness_entry = self.create(:uid => uid, :entry_date => entry_date, :entry_time => entry_time, :happiness_value => [1,1,1,2,3].sample) unless happiness_entry\n end\n end\n date = date + 1.day\n end\n end",
"def update_delivered(new_results)\n Authorization::Maintenance::without_access_control do\n new_results_ids = new_results.map{|x| x[:id]}\n results_ids = (self.results + new_results_ids).uniq\n ActiveRecord::Base.record_timestamps = false\n self.update_attributes({:delivered_at => Date.today, :results => results_ids})\n ActiveRecord::Base.record_timestamps = true\n end\n end",
"def archive\n if !params[:archive] || params[:archive] == \"true\"\n @archive = \"true\" \n @urlMasters = Urlmaster.where(:archive => \"archive\").order(:archiveTime => :desc)\n else\n @archive = \"false\"\n @urlMasters = Urlmaster.where(:archive => nil)\n end\n flash[:archive] = @archive \n end",
"def reject_automount!\n @reject_automount = true\n end",
"def checked_out?\n unfinished_day.nil?\n end",
"def c2m_check!(last_checked_b4_date = Time.current)\n moab_records.version_audit_expired(last_checked_b4_date).find_each do |moab_rec|\n Audit::CatalogToMoabJob.perform_later(moab_rec)\n end\n end",
"def engage_afterburner\n return unless continue? && prompt_user('Engage afterburner?')\n if one_in_n(3)\n puts 'Mission aborted!'\n @aborts += 1\n play_again?\n else\n puts 'Afterburner engaged!'\n end\n end",
"def collect_garbage!\n find_including_new_records(:all, :conditions => ['as_new = ? AND created_at < ?', true, Time.now - 1.week]).each(&:destroy)\n end",
"def check_for_really_old_internal_date\n if internal_date < 4.days.ago\n Log.librato(:count, \"system.process_uid.really_old_internal_date\", 1)\n user_thread.update_user(:last_uid => nil, :last_uid_validity => nil)\n user_thread.stop!\n return false\n else\n return true\n end\n end",
"def archive\n @meetups = Meetup.active.joins(:events).where('events.date < ?', Date.today)\n .order('events.date DESC').page params[:page]\n end",
"def missed_appointments\n appointments = Observation.joins(:encounter)\n .merge(appointment_encounters)\n .where.not(person_id: referral_patients.select(:person_id))\n .where(concept: ConceptName.where(name: 'Appointment date').select(:concept_id))\n .where('value_datetime BETWEEN ? AND ? AND encounter.program_id = ?',\n @start_date.strftime('%Y-%m-%d 00:00:00'),\n @end_date.strftime('%Y-%m-%d 23:59:59'), 1)\n .group(:person_id)\n\n appointments.each_with_object([]) do |appointment, patients|\n patient = missed_appointment?(appointment)\n\n patients << patient unless patient.blank?\n end\n end",
"def all_day ; true ; end",
"def waits_too_long?(account)\n is?(:asked) and self.asked <= 4.days.ago.to_date\n end",
"def archive_internship_job\n @allopps = GivingBack.with_deleted\n @approved_jobs_internships = @allopps.approved\n current_jobs_internships = Array.new\n @approved_jobs_internships.each do |o|\n if o.archive_on.nil? || (o.archive_on > DateTime.now)\n current_jobs_internships.push (o)\n else\n o.update_attribute(:hidden, true)\n end\n end\n return current_jobs_internships\n end",
"def got_second_dose?\n appointments.active.checked_out.count >= 2\n end",
"def no_appts_avail?\n appointments.empty?\n end",
"def doctor_double_booked #We check this against all of the doctors appointments \n this_start = self.start_time #Instance methods that are called on a particular doctor's appointment \n this_end = self.end_time \n conflict = doctor.appointments.any? do |appointment| \n #Look through all of the doctors appointments and checks if there are any overlapping appointments (start_time, end_time). \n #any? returns true or false. \n \n other_start = appointment.start_time \n other_end = appointment.end_time\n other_start < this_end && this_end < other_end || other_start < this_start && this_start < other_end\n # other_start < this_end && this_end < other_end \n #This means that this appointment ends in the middle of an existing appointment.\n \n # other_start < this_start && this_start < other_end \n #This means that this appointment starts in the middle of an existing appointment. \n end\n if conflict #true or false \n errors.add(:doctor, 'has a conflicting appointment') \n # Adds an error message to the appointment with an error message about the doctor. The doctor is the key, the message is the value. \n end\n end",
"def findings_expiration_warning\n user = User.joins(:findings).take\n\n NotifierMailer.findings_expiration_warning user, user.findings.limit(3)\n end",
"def dead_account?\n recipes.count == 0 && (Time.now - created_at) > 3.months\n end",
"def allow_in_post_mortem; end",
"def index\n @archives = Archive.published\n @future_meetups = Archive.unpublished\n end"
] |
[
"0.57010555",
"0.5669975",
"0.5578132",
"0.55163324",
"0.55163324",
"0.5506198",
"0.544077",
"0.53104424",
"0.5295086",
"0.5252758",
"0.5170933",
"0.5169608",
"0.5154852",
"0.51522034",
"0.51275694",
"0.5115928",
"0.51040655",
"0.51019514",
"0.5092366",
"0.5079567",
"0.50792223",
"0.50784737",
"0.50292176",
"0.5002908",
"0.50004274",
"0.49482864",
"0.49462748",
"0.49396068",
"0.49382812",
"0.4929852",
"0.4929852",
"0.4925425",
"0.4922922",
"0.49091715",
"0.49072623",
"0.4906359",
"0.49030125",
"0.4891625",
"0.48870897",
"0.4883879",
"0.48816025",
"0.4875719",
"0.48433244",
"0.4829203",
"0.48229995",
"0.48157793",
"0.48138088",
"0.48068073",
"0.48043862",
"0.48022425",
"0.48006555",
"0.47954324",
"0.4792629",
"0.4790443",
"0.47811875",
"0.47803003",
"0.47773218",
"0.4775743",
"0.4775069",
"0.4772653",
"0.47720885",
"0.47713304",
"0.47703072",
"0.4768012",
"0.4767721",
"0.47540572",
"0.47509757",
"0.47418806",
"0.47398517",
"0.47380197",
"0.47341874",
"0.4733992",
"0.47299573",
"0.4728676",
"0.47268605",
"0.4724739",
"0.47245625",
"0.47203985",
"0.4712287",
"0.4712139",
"0.47057512",
"0.47046283",
"0.47013298",
"0.46999615",
"0.46989232",
"0.46952412",
"0.46936423",
"0.46927288",
"0.4687512",
"0.46839547",
"0.46832198",
"0.46814752",
"0.4677226",
"0.46770462",
"0.46747297",
"0.4668156",
"0.4662298",
"0.46609628",
"0.46572694",
"0.4648938",
"0.46471918"
] |
0.0
|
-1
|
Generate standard YAML output, but never include the auto warning message. FIXME: Override to solve a convoluted, `simp config` code problem. Because `simp config` needs to know the scenario to use to build the Item decision tree, it needs to determine this Item's value ahead of time. Then, to make sure this Item is actually persisted in the YAML,
|
def to_yaml_s(include_auto_warning = false)
super(false)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def auto_warning\n \">> VALUE SET BY `simp config` AUTOMATICALLY. <<\\n\"\n end",
"def to_yaml_s(include_auto_warning = false)\n raise InternalError.new( \"@key is empty for #{self.class}\" ) if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n if include_auto_warning && @skip_query && @silent\n x += auto_warning\n end\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| y.strip.empty? ? \"#\\n\" : \"# #{y}\" }.join\n\n # add yaml tag directive for just the <key,value> pair\n x += pair_to_yaml_tag(@key, @value)\n x += \"\\n\"\n\n if @skip_yaml\n nil\n else\n x\n end\n end",
"def to_yaml_s\n fail '@key is empty' if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| \"# #{y}\" }.join\n\n # add yaml (but stripped of frontmatter and first indent)\n # TODO: should we be using SafeYAML? http://danieltao.com/safe_yaml/\n x += { @key => @value }.to_yaml.gsub(/^---\\s*\\n/m, '').gsub(/^ /, '' )\n x += \"\\n\"\n\n if @skip_yaml\n x.gsub( /^/, '### ' )\n else\n x\n end\n end",
"def to_yaml_s(include_auto_warning = false)\n @value = highline_question_type.call @value\n super(include_auto_warning)\n end",
"def minimal_yaml(prop, spaces)\n [\n \"#{Google::StringUtils.underscore(prop.name)}:\",\n indent(\n [\n 'description:',\n # + 8 to compensate for name + description.\n indent(bullet_lines(prop.description, spaces + 8), 4)\n ], 4\n )\n ]\n end",
"def to_config\n require_relative '../../puppet/util/docs'\n # Scrub any funky indentation; comment out description.\n str = Puppet::Util::Docs.scrub(@desc).gsub(/^/, \"# \") + \"\\n\"\n\n # Add in a statement about the default.\n str << \"# The default value is '#{default(true)}'.\\n\" if default(true)\n\n # If the value has not been overridden, then print it out commented\n # and unconverted, so it's clear that that's the default and how it\n # works.\n value = @settings.value(self.name)\n\n if value != @default\n line = \"#{@name} = #{value}\"\n else\n line = \"# #{@name} = #{@default}\"\n end\n\n str << (line + \"\\n\")\n\n # Indent\n str.gsub(/^/, \" \")\n end",
"def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end",
"def paml(x)\n\n puts(YAML.dump(x))\nend",
"def ansible_setup_yaml(built_setup)\n YAML.dump(built_setup)\nend",
"def generate_configuration\n template \"mebla.yml\", \"config/mebla.yml\"\n end",
"def generate_save\n YAML.dump(self)\n end",
"def yaml\n @config.to_yaml\n end",
"def to_yaml\n kitchen_config.to_yaml.gsub(/---[ \\n]/, '')\n end",
"def config_template\n config = Mihari.config.values.keys.map do |key|\n [key.to_s, nil]\n end.to_h\n\n YAML.dump(config)\n end",
"def dump\n return unless @config_file\n File.open(@config_file,'w') do |fl|\n @todo_container.each do |category,todo_array|\n fl << \"* #{category}\\n\"\n todo_array.each do |todo_item|\n fl << \"#{priority_star(todo_item.priority)} #{todo_item.flag ? 'TODO' : 'DONE'} #{todo_item.text}\\n\"\n end\n end\n end\n end",
"def to_yaml_s\n _value = @value\n @value = highline_question_type.call @value\n x = super\n @value = _value\n x\n end",
"def configure(allow_suffix=true)\n [:'config-dir', :'spool-dir'].each {|dir| mkdir($config[dir]) }\n %w(CONFIG RECIPIENTS MESSAGES).each {|file| mkyml(file, allow_suffix) }\n 0\n end",
"def to_yaml() end",
"def yaml_dump(val)\n yml = \"\\n\" + YAML.dump(val)\n yml.gsub(/ +\\n/, \"\\n\")\n end",
"def to_yaml(opts = {})\n YAML.quick_emit(self.id, opts) {|out| out.scalar(\"tag:hapgoods.com,2010-08-11:#{self.class.name}\", id)}\n end",
"def to_yaml(opts = {})\n return super if defined?(YAML::ENGINE) && !YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def minimal_doc_block(prop, config, spaces)\n [\n minimal_yaml(prop, spaces),\n indent([\n \"required: #{prop.required ? 'true' : 'false'}\",\n (\"type: bool\" if prop.is_a? Api::Type::Boolean),\n (\"aliases: [#{config['aliases'][prop.name].join(', ')}]\" \\\n if config['aliases']&.keys&.include?(prop.name)),\n (if prop.is_a? Api::Type::Enum\n [\n 'choices:',\n \"[#{prop.values.map { |x| quote_string(x.to_s) }.join(', ')}]\"\n ].join(' ')\n end)\n ].compact, 4)\n ]\n end",
"def to_yaml(opts = {})\n return super unless defined?(YAML::ENGINE) && YAML::ENGINE.syck?\n\n YAML.quick_emit(nil, opts) do |out|\n string = to_s\n out.scalar(YAML_TAG, YAML_MAPPING[string] || string, :plain)\n end\n end",
"def to_yml\n \"generate_to: '#{generate_to}'\\n\" <<\n \"builders_matcher: '#{builders_matcher}'\\n\" <<\n \"factories_matcher: '#{factories_matcher}'\"\n end",
"def yaml(object) \n title = split(object)\n category = split(object, 1)\n ret = ''\n \n ret += '---' + \"\\n\"\n ret += \"layout: styleguide\" + \"\\n\"\n ret += \"title: #{title.capitalize}\" + \"\\n\"\n ret += \"category: #{category}\" + \"\\n\"\n ret += \"scss: _#{title}.scss\" + \"\\n\"\n ret += '---' + \"\\n\"\n \n ret\n end",
"def to_s\n return @to_s if instance_variable_defined? :@to_s\n @to_s = \"<#{configuration_name}\".tap do |string|\n definitions.each do |name, definition|\n string << \" #{name}=#{definition.get(self).inspect}\"\n end\n string << '>'\n end\n end",
"def apply_summary\n file = @file ? File.basename(@file) : 'SIMP server <host>.yaml'\n \"Disabling of duplicate OS & SIMP YUM repos in #{file} #{@applied_status}\"\n end",
"def copy_yml\n template \"config/regulate.yml\", \"config/regulate.yml\"\n end",
"def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end",
"def doc_property_yaml(prop, config, spaces)\n block = minimal_doc_block(prop, config, spaces)\n # Ansible linter does not support nesting options this deep.\n if prop.is_a?(Api::Type::NestedObject)\n block.concat(nested_doc(prop.properties, config, spaces))\n elsif prop.is_a?(Api::Type::Array) &&\n prop.item_type.is_a?(Api::Type::NestedObject)\n block.concat(nested_doc(prop.item_type.properties, config, spaces))\n else\n block\n end\n end",
"def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end",
"def write_success_marker(config)\n success_file = File.join config[:output_dir], 'success.yml'\n File.open(success_file, 'w') { |f| YAML.dump config, f } \nend",
"def configure_bliss\n puts 'Configuring collector...'\n sync_arg('What\\'s your Bliss API Key?', 'API_KEY')\n sync_arg('What is the name of your organization in git?', 'ORG_NAME')\n FileUtils.mkdir_p @conf_dir\n File.open(@conf_path, 'w') { |f| f.write @config.to_yaml } # Store\n puts 'Collector configured.'.green\n end",
"def dump_summary(*args)\n output.puts super(*args).to_yaml\n output.puts \"...\"\n end",
"def change_to_s(is, want)\n return \"defined configuration as '#{want}'\" if is == :absent\n return \"undefined configuration from '#{is}'\" if want == :absent\n \"configuration changed '#{is}' to '#{want}'\"\n end",
"def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end",
"def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end",
"def generate_config\n @config = Innsights::Client.create(processed_app_name)\n if @config.nil?\n abort\n else\n template 'innsights.yml', 'config/innsights.yml'\n end\n end",
"def nice_yaml(string)\n YAML.dump(string).gsub(/\\A---\\n/, '')\n end",
"def random_venue_yml\n puts \"venue#{@ctr}:\"\n @ctr = @ctr+1\n \n puts \" venue_id: #{@ctr}\"\n puts \" venue_name: #{@venues.random_item.to_s}\"\n puts \" venue_description: Description for #{@venues.random_item.to_s}\"\n puts \" contactinfo_id: 1\"\n puts\n \n \n \n end",
"def generate\n FileUtils.cp DEFAULT_CONFIG, File.join(@path, 'config/rails_best_practices.yml')\n end",
"def yaml_file?; end",
"def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end",
"def yaml_emitter\n # Until all platforms have psych available,\n # we must continue to emit using syck.\n universal_psych_support? ? PSYCH : SYCK\n end",
"def from_yaml\n results = YAML.load(self)\n \n # Replace bad values\n if results == false or results == nil\n \"\"\n else\n results\n end\n end",
"def to_yaml\n # write yaml\n end",
"def to_yaml(opts={})\n YAML.quick_emit(nil, opts) do |out|\n out.scalar(taguri, to_h, :plain)\n end\n end",
"def generate_warning_text\n @warnings\n end",
"def encode_workitem (wi)\n YAML.dump(wi)\n end",
"def default_description\n description = \"Run `#{@application_class.name}`\"\n description << ' quietly' if @quiet\n description << \" using config file #{@config}\" if @config\n description\n end",
"def to_yaml(opts = {})\n definition.to_yaml(opts)\n end",
"def to_yaml(opts = {})\n YAML::dump_stream({'logical' => logical}, {'physical' => physical})\n end",
"def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end",
"def to_yaml\n {:drops => drops.collect(&:to_hash)}.to_yaml\n end",
"def inspect\n properties.to_yaml\n end",
"def to_yaml(indent_space_count = 0)\n yaml = \"\"\n longest_label_mapping_length =\n @label_mappings.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n\n if @label_mappings.length > 0\n yaml += \" \" * indent_space_count + \"Kit:\\n\"\n ljust_amount = longest_label_mapping_length + 1 # The +1 is for the trailing \":\"\n @label_mappings.sort.each do |label, path|\n yaml += \" \" * indent_space_count + \" - #{(label + \":\").ljust(ljust_amount)} #{path}\\n\"\n end\n end\n \n return yaml\n end",
"def return_property_yaml(prop, spaces)\n block = minimal_return_block(prop, spaces)\n if prop.is_a? Api::Type::NestedObject\n block.concat(nested_return(prop.properties, spaces))\n elsif prop.is_a?(Api::Type::Array) &&\n prop.item_type.is_a?(Api::Type::NestedObject)\n block.concat(nested_return(prop.item_type.properties, spaces))\n else\n block\n end\n end",
"def inspect\n @inspect ||= begin\n lines = dry_initializer.options.map do |item|\n text = \" #{item.target}\"\n text << \": #{item.desc}\" if item.desc\n text << \" (required)\" unless item.optional\n text\n end\n\n [\"Input options:\", *lines, nil].join(\"\\n\") if lines.any?\n end\n end",
"def generate(ignore_missing: false)\n data = self.data\n if data.blank?\n raise FphsException, 'Data is blank and item_type / item_id does not return an item' unless item\n\n data = Formatter::Substitution.setup_data item, for_item\n data[:_subject] = subject\n data[:extra_substitutions] = extra_substitutions_data\n\n end\n\n raise FphsException, \"Layout template #{layout_template_name} was not found\" unless layout_template\n\n if content_template_name\n raise FphsException, \"Content template #{content_template_name} was not found\" unless content_template\n elsif !content_template_text\n raise FphsException, 'Content template name or text must be set'\n end\n\n self.generated_text = layout_template.generate content_template_name: content_template_name,\n content_template_text: content_template_text,\n data: data,\n ignore_missing: ignore_missing\n\n self.generated_content = generated_text\n save!\n end",
"def chkout_handling_options_label\n $tracer.trace(__method__)\n #unit_test_no_generate: chkout_handling_options_label, section.id(\"handling_options\").find.h3\n return ToolTag.new(section.id(\"handling_options\").find.h3, __method__, self)\n end",
"def to_yaml\n longest_track_name_length =\n @tracks.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n ljust_amount = longest_track_name_length + 7\n \n yaml = \"#{@name.to_s.capitalize}:\\n\"\n @tracks.keys.sort.each do |track_name|\n yaml += \" - #{track_name}:\".ljust(ljust_amount)\n yaml += \"#{@tracks[track_name].rhythm}\\n\"\n end\n \n return yaml\n end",
"def to_yaml_type \n YAML_TYPE\n end",
"def generate_yaml_object?\n generate! unless skip_for_generation?\n end",
"def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end",
"def yaml_custom_config?(msg)\n msg[2] == :unknown_key && msg[1] == :root && YAML_CUSTOM_CONFIG.include?(msg[3][:key])\n end",
"def generate_assets_yml(node, force = true)\n\n\t\t# traverse subfolders, go deep\n\t\tif node_has_children(node)\n\t\t\t node.children.items.each_with_index do |child|\n\t\t\t\t generate_assets_yml(child, force)\n\t\t\t end\n\t\tend \n\t\n\t\tif force or !File.exists?(\"#{node.source_path}/aaaa-assets.yml\")\n\t\t\n\t\t\taaml = Map.new({ asset_items: [] })\n\n\t\t\timage_subfolder = nil\n\t\t\tif node.source_path?\t\t\n\t\t\t\timage_subfolder = Dir.entries(node.source_path).select {|entry| File.directory? File.join(node.source_path, entry) and (entry == 'images') }\n\t\t\telse\n\t\t\t\t ap node\n\t\t\t\t exit\n\t\t\tend\n\t\t \n\t\t\tif image_subfolder\n\t\t\t\n\t\t\t\timages = []\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.png\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.jpg\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.jpeg\")\n\t\t\t\timages.concat Dir.glob(\"#{node.source_path}/images/*.gif\")\n\t\t\t\t\t\n\t\t\t\timages.each do |image_path|\n\t\t\t\n\t\t\t\t\tsource = node.full_link + image_path.gsub(/#{node.source_path}/, \"\")\n\t\t\t\t\tfile = source[source.rindex(\"/\") + 1..-1]\n\t\t\t\t\ttitle = file[0..file.rindex(\".\") - 1].gsub(/_/, \" \")\n\t\t\t\t\n\t\t\t\t\titem = Map.new({\n\t\t\t\t\t\ttype: \"image\",\n\t\t\t\t\t\t#source: source,\n\t\t\t\t\t\t#link: \"/images\" + source,\n\t\t\t\t\t\tfile: file,\n\t\t\t\t\t\timg_alt: process_navigation_name(title),\n\t\t\t\t\t\timg_caption: nil,\n\t\t\t\t\t\timg_tooltip_text: nil \n\t\t\t\t\t})\n\t\t\t\t\taaml.asset_items << item\n\t\t\t\tend\n\t\t\t\n\t\t\t\tif images.size > 0\n\t\t\t\t\t\t\t\n\t\t\t\t\taaml_yaml = aaml.to_yaml.gsub(/^(- )/, \"\\n- \")\n\t\t\n\t\t\t\t\t# write out navigation.yml file...\n\t\t\t\t\tFile.open(\"#{node.source_path}/aaaa-assets.yml\", 'w') { |file| file.write(aaml_yaml) }\n\t\t\t\t\n\t\t\t\t\t#ap aaml \n\t\t\t\tend\n\t\t\n\t\t\tend\n\t\tend\n\tend",
"def print_event_yml()\n # Parse the event container <aside><div><p>...</p></div></aside>\n # to get the orga dates and names\n allevents = fetch_html()\n allevents.xpath('//aside//div//p').each do |events_chunk|\n\n # # Split array in cohensive elements at once\n # elements = events_chunk.content.split(/\\,\\ |\\.\\ |\\n/)\n\n # # Puts warning\n # elements_yml = \"# Do not edit this list manually, it will be overwritten\\n\"\n # elements_yml = elements_yml + \"# in a couple of hours anyway!\\n\\n\"\n\n # elements_yml = elements_yml + \"events:\\n\"\n # i = 0\n\n # until i >= elements.length do\n # if i != nil and elements[i +3] != nil then\n # # Puts all event names out of elements\n # elements_yml = elements_yml + \" - name: \\\"\" + elements[i + 3] + \"\\\"\\n\"\n # end\n # if i != nil then\n # # Puts all event dates out of elements\n # puts elements[i + 2] + \":\" + elements[i + 1]\n # begin\n # elements_yml = elements_yml + Date.new(2018,elements[i + 2].to_i,elements[i + 1].to_i).strftime(\" date: \\\"%b %d, %Y\\\"\\n\")\n # rescue ArgumentError\n # end\n # end\n # if i != nil then\n # # Puts all event background colors\n # elements_yml = elements_yml + \" background: \\\"\" + gen_color() + \"\\\"\\n\"\n # end\n # i += 4;\n # end\n # return elements_yml\n end\nend",
"def setup_autosigning\n <<-EOS\necho \"*\" > /etc/puppet/autosign.conf\n EOS\n end",
"def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end",
"def format_rule(rule)\n return unless rule.attributes['name']\n\n puts ''\n puts '----'\n puts ''\n puts \"== #{rule.attributes['name']} ==\"\n puts ''\n\n is_deprecated = rule.attributes['deprecated'] == 'true'\n if is_deprecated\n puts \"'''Deprecated'''\"\n puts ''\n \n ref = rule.attributes['ref'].sub(/rulesets\\/java\\//, '') \n name = ref[/[^\\/]+$/]\n ruleset = ref[/^[^\\.]+/]\n puts \"This rule has been renamed or moved. Use instead: [[PmdRules#{ruleset.capitalize}##{name.downcase}|#{name}]]\"\n \n return\n end\n \n puts \"<blockquote>#{norm_text(rule.get_text('description'))}</blockquote>\"\n puts ''\n\n isxpath = rule.attributes['class'] == 'net.sourceforge.pmd.lang.rule.XPathRule'\n if isxpath\n puts 'This rule is defined by the following XPath expression:'\n puts '<pre>'\n puts rule.elements['properties/property/value'].texts.join.strip\n puts '</pre>'\n else\n classname = rule.attributes['class']\n href = \"https://github.com/codecop/pmd-rules/tree/master/src/main/java/#{classname.gsub(/\\./,'/')}.java\"\n puts \"This rule is defined by the following Java class: [#{href} #{classname}]\"\n end\n\n rule.elements.each('example') do |example|\n puts ''\n puts '=== Example: ==='\n puts '<pre>'\n puts example.texts.join.strip\n puts '</pre>'\n end\n\n properties = rule.elements['count(properties/property)']\n properties -= 1 if isxpath\n if properties > 0\n puts ''\n puts 'This rule has the following properties:'\n puts ''\n \n puts '{| class=\"wikitable\"'\n puts '! Name'\n puts '! Default value' \n puts '! Description' \n \n rule.elements.each('properties/property') do |prop|\n next if prop.attributes['name']=='xpath'\n puts '|-' \n puts \"| #{prop.attributes['name']}\"\n puts \"| '#{prop.attributes['value']}'\"\n puts \"| #{prop.attributes['description']}\"\n end\n puts '|}' \n end\nend",
"def cmd_notify_pushover_save\n\t\t\t\tprint_status(\"Saving parameters to config file\")\n\t\t\t\tif @app_key and @user_key\n\t\t\t\t\tconfig = {'app_key' => @app_key, 'user_key' => @user_key}\n\t\t\t\t\tFile.open(Notify_pushover_yaml, 'w') do |out|\n\t\t\t\t\t\tYAML.dump(config, out)\n\t\t\t\t\tend\n\t\t\t\t\tprint_good(\"All parameters saved to #{Notify_pushover_yaml}\")\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"You have not provided all the parameters!\")\n\t\t\t\tend\n\t\t\tend",
"def to_yaml\n @main.to_yaml\n end",
"def generate_id_yml(script)\n native_data = script.native\n native_data[:container][:supplemental_groups] = supplemental_groups(native_data[:container][:supplemental_groups])\n container = helper.container_from_native(native_data[:container], default_env)\n id = generate_id(container.name)\n configmap = helper.configmap_from_native(native_data, id, script.content)\n init_containers = helper.init_ctrs_from_native(native_data[:init_containers], container.env)\n spec = OodCore::Job::Adapters::Kubernetes::Resources::PodSpec.new(container, init_containers: init_containers)\n all_mounts = native_data[:mounts].nil? ? mounts : mounts + native_data[:mounts]\n node_selector = native_data[:node_selector].nil? ? {} : native_data[:node_selector]\n gpu_type = native_data[:gpu_type].nil? ? \"nvidia.com/gpu\" : native_data[:gpu_type]\n\n template = ERB.new(File.read(resource_file), nil, '-')\n\n [template.result(binding), id]\n end",
"def to_yaml( opts={} )\n\t\trequire 'yaml'\n\t\tYAML.quick_emit( self.object_id, opts ) {|out|\n\t\t\tout.seq( self.class.to_yaml_type ){|seq|\n\t\t\t\tseq.add( self.dirs )\n\t\t\t}\n\t\t}\n\tend",
"def genPiledConf(conf = {})\n return genPiledDefaultConf().update(conf) ;\n end",
"def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend",
"def queuedump\n queuefile = YAML.load_file(\"/config/queue.yml\")\n puts queuefile['queue']\n queuefile['last_update'] = \"text\"\n File.open('/config/queue.yml','w') do |h| \n h.write queuefile.to_yaml\n end\nend",
"def to_yaml\n self.to_h.to_yaml\n end",
"def to_yaml\n self.to_h.to_yaml\n end",
"def mkyml(yml, allow_suffix=true)\n file = \"#{$config[:'config-dir']}/#{yml.downcase}.yml\"\n file += '.new' if File.exists?(file) && allow_suffix\n if !File.exists?(file)\n File.open(file, 'w') do |f|\n f.puts eval(yml).rekey(&:to_s).to_yaml\n end\n File.chmod(0640, file)\n File.chown($config[:uid], $config[:gid], file)\n end\n end",
"def dump(io)\n @config.keys.select {|s| String === s}.sort.each do |k|\n v = @config[k]\n case v\n when Array\n io.puts \"#{k}=#{v.join ' '}\"\n else\n io.puts \"#{k}=#{v}\"\n end\n end\n end",
"def display_report(report)\n super\n\n File.write(ConfigurationLoader::AUTO_GENERATED_FILE, config_file_contents)\n log.log \"Created #{ConfigurationLoader::AUTO_GENERATED_FILE}.\"\n log.log \"Run `haml-lint --config #{ConfigurationLoader::AUTO_GENERATED_FILE}`\" \\\n \", or add `inherits_from: #{ConfigurationLoader::AUTO_GENERATED_FILE}` in a \" \\\n '.haml-lint.yml file.'\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 cleaning_up item\n show do \n title \"Cleaning Up...\"\n separator\n note \"Before finishing up, rinse out plate <b>#{item}</b> with diluted bleach & H2O.\"\n note \"Then rinse once more with EtOH\"\n end\n end",
"def bare_yaml\n return \"\" unless present?\n yaml = to_yaml\n\n # Detect single-line libyaml 0.2.1 scalar and remove trailing newline\n return yaml.sub(/\\A--- ([^\\n]+)\\n\\Z/m, '\\1') if yaml.single_line_ending_in_newline?\n\n yaml.sub(/\\A---[ \\n]/, \"\") # Handle header for multi-line yaml snippets\n .sub(/(\\n\\.\\.\\.\\n)?\\Z/m, \"\") # Handle libyaml 0.1.7 end of stream marker\n end",
"def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end",
"def config\n \n # TODO: Re-enable:\n # # Display the value for a specific machine.\n # $ rudy -e prod -r db config param-name\n \n if @@config.nil? || @@config.empty?\n return if @@global.quiet\n raise Rudy::NoConfig\n end\n\n outform = @@global.format == :json ? :to_json : :to_yaml\n \n types = @option.marshal_dump.keys & @@config.keys # Intersections only\n types = @@config.keys if @option.all\n types = [:machines] if types.empty?\n \n if @option.project\n rf = File.join(RUDY_HOME, 'Rudyfile')\n raise \"Cannot find: #{rf}\" unless File.exists?(rf)\n li File.read(rf)\n \n elsif @option.script\n conf = fetch_script_config\n li conf.to_hash.send(outform) if conf\n \n else\n #li \"# ACCOUNTS: [not displayed]\" if types.delete(:accounts)\n types.each do |conftype|\n li \"# #{conftype.to_s.upcase}\"\n next unless @@config[conftype] # Nothing to output\n if conftype == :accounts\n skey = @@config[conftype][:aws][:secretkey]\n @@config[conftype][:aws][:secretkey] = hide_secret_key(skey)\n end\n \n li @@config[conftype].to_hash.send(outform)\n end\n end\n \n end",
"def to_yaml\n to_h.to_yaml\n end",
"def item_to_xml(item)\n item_type = @artifact_type.downcase\n xml = \" <#{item_type}>\\n\"\n\n item.each_key do |key|\n if key != \"_type\" && !key.nil? then\n if /\\<#{key}/ =~ \"#{item[key]}\" then\n xml = xml + \"#{item[key]}\"\n else\n xml = xml + \" <#{key}>#{item[key]}</#{key}>\\n\"\n end\n end\n end\n xml = xml + \" </#{item_type}>\\n\"\n return xml\n end",
"def to_config\n \" PROCESSOR #{@name} #{self.class.name.to_s.class_name_to_filename} #{@item_name} #{@value_type}\\n\"\n end",
"def get_item_text(item)\n text = if item.children.empty?\n item.text\n else\n item.children.delete_at(rand(item.children.length))\n end\n item.rule.min -= 1\n item.rule.max -= 1\n text\n end",
"def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end",
"def puts(msg = '', yaml_comment = true)\n msg = \"#{msg}\\n\"\n $stdout.write msg\n if yaml_comment && msg != \"\\n\"\n $outfile.write \"# #{msg}\"\n else\n $outfile.write msg\n end\nend",
"def inspect\n s = self.to_s\n s = s[0,s.length-1]\n display_hooks = hooks.dup\n display_hooks.each do |k,v|\n display_hooks.delete(k) if v.empty?\n end\n unless display_hooks.empty?\n s << \" hooks=#{display_hooks.inspect}\"\n end\n unless requirements.empty?\n s << \" requirements=#{requirements.inspect}\"\n end\n s << \" targets=#{targets.map(&:to_sym).inspect}\" if targets\n s << \" origins=#{origins.map(&:to_sym).inspect}\" if origins\n s << \">\"\n s\n end",
"def write_one_problem(data, num_items, num_metrics)\n max_weight = data[\"max_weight\"]\n weights = data[\"weights\"]\n values = data[\"values\"]\n\n items = []\n num_items.times do |index|\n items << {\n \"weight\" => weights[index],\n \"metrics\" => values[index][0...num_metrics]\n }\n end\n\n metric_ids = (0...num_metrics).to_a.map{|index| \"metric#{index}\" }\n\n # Calculate the bit width required\n metric_sums = Array.new(num_metrics, 0)\n weight_sum = 0\n items.each do |item|\n item[\"metrics\"].each_with_index do |metric_value, index|\n metric_sums[index] += metric_value\n end\n weight_sum += item[\"weight\"]\n end\n\n max_integer = (metric_sums + [max_weight, weight_sum]).max\n bit_width = (Math.log(max_integer, 2)).ceil + 1\n\n template_string = <<-eos\nopen util/integer\npred show {}\n\nabstract sig Item {\n weight : one Int,\n<% metric_ids.each do |metric| %>\n <%= metric %> : one Int<%= \",\" unless metric_ids[-1] == metric %>\n<% end %>\n}\n\none sig Knapsack {\n items : set Item,\n max_weight : one Int,\n current_weight : one Int,\n<% metric_ids.each do |metric| %>\n <%= metric %> : one Int<%= \",\" unless metric_ids[-1] == metric %>\n<% end %>\n}\n{\n max_weight = <%= max_weight %>\n\n // Metric of the knapsack is sum of item metrics\n<% metric_ids.each do |metric| %>\n <%= metric %> = (sum i : items | i.<%= metric %>)\n<% end %>\n\n // Weight of knapsack is sum of item weights\n current_weight = (sum i : items | i.weight)\n\n // Weight of knapsack must be less than the max weight\n current_weight <= max_weight\n}\n\n// Define concrete items\n<% items.each_with_index do |item, index| %>\none sig Item<%= index %> extends Item {} {\n weight = <%= item[\"weight\"] %>\n<% metric_ids.each_with_index do |metric, index2| %>\n <%= metric %> = <%= item[\"metrics\"][index2] %>\n<% end %>\n}\n<% end %>\n\ninst KnapsackProblem {\n <%= bit_width %> Int\n}\n\nobjectives o_global {\n<% metric_ids.each_with_index do |id, index| %>\n maximize Knapsack.<%= id %><%= \",\" unless metric_ids[-1] == id %>\n<% end %>\n}\n\nrun show for KnapsackProblem optimize o_global\neos\n\n template = ERB.new( template_string, 0, \"<>\" )\n\n File.open(\"knapsack_#{num_items}_metrics_#{num_metrics}.als\", \"w\") do |f|\n f.puts template.result(binding)\n end\n\n puts \"Created Alloy file for knapsack_#{num_items}_metrics_#{num_metrics}\"\nend",
"def config_for(key, value)\n \"#{key}=#{value && value}\\n\"\n end",
"def to_yaml\n as_yaml.to_yaml\n end",
"def get_summary\n failures = 0\n while failures < @config.pluginconf.fetch(\"puppetng.max_summary_failures\", MAX_SUMMARY_FAILURES).to_i\n begin\n yaml = YAML.load_file(@lastrunsummary_file)\n if yaml.is_a?(Hash)\n return yaml\n end\n rescue\n end\n failures += 1\n sleep 1\n end\n #TODO: more specific exception\n raise \"failed to load summary YAML\"\n end",
"def check_for_auto_attr\n auto_attr = @presenter.extract_nested_value(node.automatic, @attr_spec)\n if ! auto_attr.nil?\n @collected_warnings << \"Attribute is set at automatic level. This means it is likely set by Ohai.\"\n end\n end",
"def to_yaml\n dump(:x)\n end"
] |
[
"0.6189041",
"0.5990701",
"0.5969959",
"0.5823672",
"0.5632906",
"0.54996115",
"0.5376722",
"0.5265555",
"0.5223406",
"0.51639843",
"0.51193625",
"0.50991535",
"0.50987667",
"0.5095213",
"0.5060933",
"0.50364095",
"0.5028591",
"0.49820378",
"0.49710774",
"0.492528",
"0.49224886",
"0.49092713",
"0.4908686",
"0.4873364",
"0.48607352",
"0.48585883",
"0.48573688",
"0.48185474",
"0.48017976",
"0.47842655",
"0.47687232",
"0.47623935",
"0.4759544",
"0.47547907",
"0.47097751",
"0.4708402",
"0.4708402",
"0.4707108",
"0.46924332",
"0.46390745",
"0.4632282",
"0.46308744",
"0.46235955",
"0.46190527",
"0.46060884",
"0.45940015",
"0.45895067",
"0.45750785",
"0.45749548",
"0.4570211",
"0.45600745",
"0.4552486",
"0.45395404",
"0.45305946",
"0.4514023",
"0.45017156",
"0.4490668",
"0.44889015",
"0.448577",
"0.44814977",
"0.44780254",
"0.44593486",
"0.44471097",
"0.44404766",
"0.44320154",
"0.44299367",
"0.4427608",
"0.44251007",
"0.44234818",
"0.44218263",
"0.440809",
"0.44057912",
"0.43938705",
"0.43936917",
"0.43926555",
"0.4387745",
"0.4387069",
"0.43860295",
"0.43860295",
"0.4372048",
"0.43718225",
"0.4366641",
"0.4366494",
"0.43644214",
"0.4362564",
"0.4362249",
"0.435593",
"0.43557918",
"0.43533415",
"0.43509054",
"0.43508697",
"0.43400425",
"0.4332458",
"0.4324848",
"0.43240315",
"0.43232647",
"0.43150938",
"0.43127224",
"0.43091664",
"0.4308522"
] |
0.6360387
|
0
|
Responds to request with index_ok status and resources
|
def index_ok(resources:)
render json: resources, status: :ok, include: index_includes
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n render_result('ok')\n end",
"def index\n build_resource({})\n respond_with self.resource\n end",
"def request_res_index(*args)\n @res_index\n end",
"def index\n render status: :ok, json: { status: 'done' }.to_json\n\tend",
"def index\n status = get_health_status( )\n response = make_response( status )\n render json: response, :status => response.is_healthy? ? 200 : 500\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 end",
"def index\n head params[:response_status]\n end",
"def index_status()\n\n read_index_alias = to_read_index_alias_name()\n write_index_alias = to_write_index_alias_name()\n parsed = @http.get(\"http://#{@host}:#{@port}/#{write_index_alias}/_status\")\n @logger.error(\"+++++ write index_status\", :write_index_alias => write_index_alias, :parsed => parsed)\n\n if parsed.key?(\"ok\")\n\n @logger.error(\"***** index_status ok\")\n\n indices = parsed[\"indices\"]\n index_name = indices.keys.first\n index = indices[index_name]\n docs = index[\"docs\"]\n num_docs = docs[\"num_docs\"]\n\n return index_name, num_docs, write_index_alias, read_index_alias\n\n else\n\n error = parsed[\"error\"]\n @logger.error(\"***** index_status error\", :error => error)\n\n index_name = to_index_name(0, @application, @domain)\n return index_name, 0, write_index_alias, read_index_alias\n\n end\n\n end",
"def index\n msg = MSG[:index][:success]\n common_response(msg, events: Event.all)\n end",
"def index\n authorize! :index, current_model_class\n yield if block_given? # after_index\n respond_with collection\n end",
"def index\n render json: {success: true}\n end",
"def index\n respond_with(pages)\n end",
"def index\n @articles = Article.all\n respond_with @articles, status: get_status\n end",
"def index\n respond_with(@scans)\n end",
"def response(env)\n case env['PATH_INFO']\n when '/' \n [200, {}, haml(:index)]\n else\n API.call(env)\n end\n end",
"def index\n\t\trespond_to do |format|\n\t\t\tformat.html {html_index}\n\t\t\tformat.json {json_index}\n\t\tend\n\tend",
"def index\r\n render json: { status: \"Test API\"}\r\n end",
"def index\n render :text=>\"update not supported\", :status=>500\n end",
"def index\n respond_with(sources)\n end",
"def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n respond_with(accounts)\n end",
"def index\n @orders = index_resources\n respond_with(@orders)\n end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end",
"def index\n puts \"test/index\"\n ap params\n done 404\n end",
"def index\n# @indices = Index.all\n#\n# respond_to do |format|\n# format.html # index.html.erb\n# format.xml { render :xml => @indices }\n# end\n end",
"def index?; end",
"def index \n @server_racks = ServerRack.all\n\n respond_with @server_racks\n end",
"def index\n authorize :resquest_type, :index?\n @resquest_types = ResquestType.all\n end",
"def index\n @todos = Todo.all\n respond_with @todos\n end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index; end",
"def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end",
"def index\n get\n end",
"def index\n requests = Request.where(status: 0)\n if requests\n render json: requests, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n }\n },\n status: :ok\n else\n render status: :unprocessable_entity\n end\n end",
"def index\n Page.first\n Rails.cache.write('status', true)\n head :ok\n end",
"def index\n \t @responses = Response.all\n end",
"def ok; @status = 200 end",
"def ok; @status = 200 end",
"def index\n get('')\n end",
"def restful_response\n\n begin\n res = yield\n if performed? then\n return res\n end\n\n if request.path_parameters[:action] == \"index\" && res.kind_of?(ActiveRecord::Relation) && res.respond_to?(:page)\n # automatically apply paging to lists, when possible\n res = res.page(params[:page]).per(params[:per_page])\n end\n\n return restful(res)\n\n rescue Exception => ex\n if ex.kind_of? MissingParam then\n return render(:text => ex.message, :status => 400)\n end\n raise\n end\n\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n @pages = Page.all\n respond_with(@pages)\n end",
"def index\n respond_with releases\n end",
"def index\n @items = @list.items.all.order(id: :desc)\n return success_item_index\n end",
"def index\n \t#render json: Api::Alert.all, status: :ok\n \tend",
"def index\n respond_with Post.all\n end",
"def index\n respond_with Post.all\n end",
"def index\n respond_with Post.all\n end",
"def index\n # If subscribe job states have not changed, return a 304\n if stale? etag: EtagCalculator.etag(current_user.subscribe_jobs_updated_at),\n last_modified: current_user.subscribe_jobs_updated_at\n if SubscribeJobState.exists? user_id: current_user.id\n @job_states = SubscribeJobState.where user_id: current_user.id\n Rails.logger.debug \"User #{current_user.id} - #{current_user.email} has #{@job_states.count} SubscribeJobState instances\"\n respond_with @job_states\n else\n head 404\n end\n end\n rescue => e\n handle_error e\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end",
"def index\n respond_with Biblebook.all\n end",
"def index\n index! do |format|\n format.html\n format.json do\n object = if params[:id]\n resource.increment_hits!\n resource\n else\n collection\n end\n\n render :json => object \n end\n end\n end",
"def index\n @entries = @resource_finder.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @entries }\n end\n end",
"def index\n @pages = Page.all\n\n respond_with @pages\n end",
"def index\n conditions = {}\n conditions[:status] = params[:status] if params[:status]\n @projects = Project.find(:all, :conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @projects }\n format.json { render :json => @projects }\n end\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @responses = Response.all\n end",
"def index\n @api_docs_services = api_docs_services.all\n respond_with(@api_docs_services)\n end",
"def index\n \n end",
"def index\n \n end",
"def index\n \n end",
"def index_exists?\n begin\n result = Slingshot::Configuration.client.get \"#{Mebla::Configuration.instance.url}/#{@slingshot_index_name}/_status\"\n return (result =~ /error/) ? false : true\n rescue RestClient::ResourceNotFound\n return false\n end\n end",
"def index\n respond_with(Response.collection_as_unity_JSON(:all))\n end",
"def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end",
"def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @requests }\n end\n end"
] |
[
"0.70537627",
"0.6929136",
"0.6889598",
"0.68736124",
"0.6838742",
"0.6838742",
"0.6796769",
"0.6636623",
"0.66111386",
"0.65857875",
"0.6577394",
"0.655659",
"0.6519567",
"0.64604425",
"0.6448699",
"0.6399619",
"0.6386759",
"0.6367987",
"0.6365259",
"0.63649845",
"0.6354009",
"0.6295441",
"0.62620056",
"0.6258544",
"0.6256528",
"0.6254315",
"0.6248635",
"0.6238197",
"0.6235626",
"0.62261647",
"0.62179196",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6217203",
"0.6206804",
"0.61971354",
"0.6171782",
"0.6171089",
"0.6141646",
"0.6123566",
"0.6123566",
"0.61000526",
"0.609687",
"0.6090243",
"0.6090243",
"0.6086003",
"0.60840034",
"0.6075716",
"0.6054301",
"0.6054301",
"0.6054301",
"0.6053164",
"0.60503155",
"0.60462207",
"0.6045548",
"0.6040692",
"0.60370207",
"0.60305154",
"0.60301095",
"0.60301095",
"0.60301095",
"0.60301095",
"0.60301095",
"0.60281175",
"0.6011893",
"0.6011893",
"0.6011893",
"0.60068005",
"0.6006411",
"0.60055053",
"0.5999013"
] |
0.77497816
|
0
|
GET /kitchen_items GET /kitchen_items.json
|
def index
@kitchen_items = KitchenItem.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def show\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_kit }\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 item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend",
"def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end",
"def list_items( args={} )\n @session.base_url = \"http://my.cl.ly\"\n \n url = \"/items\"\n args.each do |k, v|\n # probably a nicer way to do this\n if url == \"/items\"\n url << \"?#{k.to_s}=#{v.to_s}\"\n else\n url << \"&#{k.to_s}=#{v.to_s}\"\n end\n end\n resp = @session.get( url )\n \n raise AuthorizationError if resp.status == 401\n Crack::JSON.parse(resp.body)\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def show\n render json: @rentable_item\n end",
"def index\n recipe_items = current_user.recipes.includes(recipe_items: :ingredient).find(params[:recipe_id]).recipe_items\n render json: { recipe_items: recipe_items}.to_json(include: :ingredient), status: :ok\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def show\n item = Item.find(params[:id])\n render json: item\n end",
"def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end",
"def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end",
"def show\n render json: Item.find(params[:id])\n end",
"def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end",
"def get_books(response)\n response[\"items\"]\nend",
"def show\n render json: Item.find(params[\"id\"])\n end",
"def items\n response[\"items\"]\n end",
"def index\n render json: RequestItem.all\n end",
"def index\n @lunch_items = LunchItem.all\n end",
"def get_items\n @items\n end",
"def item\n @items = Item.select {|k,v| k.product_type_id != 4 }\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @items, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end",
"def show\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitchen }\n end\n end",
"def show\n json_response(@food_item)\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def items\n @items ||= items_from_response\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def index\n @item_inventories = ItemInventory.all\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def index\n @order_items = OrderItem.all\n # render json: @order_item, status: :created\n # render json: @order_item.as_json(include: :item)\n\n end",
"def index\n @inboxes = Inbox.all\n @inboxes = @inboxes.select { |x| x.umkm_id == params[:umkm_id].to_i }\n render json: {items: @inboxes}\n end",
"def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end",
"def index\n @potluck_items = @event.potluck_items\n\n respond_to do |format|\n format.html { render :layout => false }# index.html.erb\n format.json { render json: @event.get_potluck_items_for_guests.to_json }\n end\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def show\n render json: @item\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end",
"def fetch\n result = WebApi.json!(\"IEconItems_#{app_id}\", 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n item_class = self.class.send :class_variable_get, :@@item_class\n\n @items = []\n result[:items].each do |item_data|\n unless item_data.nil?\n item = item_class.new(self, item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def index\n @products = Product.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventories }\n end\n end",
"def get_items\n response_xml = http_get(@client, \"#{xero_url}/Items\")\n parse_response(response_xml, {}, {:request_signature => 'GET/items'})\n end",
"def my\n items = current_user.items\n render json: items\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end",
"def index\n @received_item_and_qties = ReceivedItemAndQty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @received_item_and_qties }\n end\n end",
"def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end",
"def index\n @used_bikes = UsedBike.all\n\n render json: @used_bikes, each_serializer: Web::V1::UsedBikeSerializer\n end",
"def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = Item.includes(:user).order(created_at: :desc).all\n render json: @items\n end",
"def show\n\t\trender json: @auction_item.as_json\n\tend",
"def index\n @items = Item.all\n\n render :json => @items, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n end",
"def getitem\n\n int_parent = params[:parent]\n @items = Item.where(\"manifestation_id = ?\", int_parent).order(\"item_siglum ASC\")\n @items_master = Array.new\n @items.each do |it|\n @holding_institution = HoldingInstitution.find(it.holding_institution_id)\n str_it_string = \"(\" + it.item_siglum + \") \" + @holding_institution.holding_institution_name + \" [\" + it.item_shelfmark + \"]\"\n @it_item = [str_it_string, it.id]\n @items_master.push(@it_item)\n end\n\n\n respond_to do |format|\n format.html { render json: @items_master }\n format.json { render json: @items_master }\n end\n end",
"def show\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventoryitem }\n end\n end",
"def show\n @fridge = Fridge.find(params[:id])\n @items = @fridge.fridge_items # for _item_list.html.erb\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fridge }\n end\n end",
"def items(); @items || CrateAPI::Items.new(); end",
"def index\n render json: Item.paginate(page: params[:page], per_page: 25)\n end",
"def show\n respond_with @celeb.to_json(:include => :items)\n end",
"def index\n @items_locations = ItemsLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items_locations }\n end\n end",
"def index\n @livingitems = Livingitem.all\n end",
"def index\n if params[:cart_id]\n get_cart\n @items = Item.where(cart: @cart)\n elsif params[:order_id]\n get_order\n @items = Item.where(order: @order)\n end\n render json: @items, status: 200\n end",
"def index\n @recipe_items = RecipeItem.all\n end",
"def show\n \n render status: 200, :json => @item\n\n end",
"def show\n if @hall.items_url != ''\n xml = open(@hall.items_url)\n @items = Nokogiri::XML(xml).xpath('/items/item').map do |item|\n p item\n {\n name: item.xpath('name/text()').to_s,\n description: item.xpath('description/text()').to_s,\n x: item.xpath('x/text()').to_s.to_i,\n y: item.xpath('y/text()').to_s.to_i,\n image: item.xpath('image/text()').to_s\n }\n end\n else\n @items = Item.where(hall_id: @hall.id)\n unless @items\n @items = @items.map do |item|\n {\n name: item.name,\n description: item.description,\n x: item.x,\n y: item.y,\n image: item.image.url\n }\n end\n end\n end\n end",
"def index\n @items = Item.all\n @items_response = Hash.new \n @items_response[:items] = Array.new \n @items.each do |item|\n temp_item = Hash.new\n temp_item[:title] = item.title\n temp_item[:description] = item.description\n temp_item[:price] = item.price\n temp_item[:status] = item.status\n unless item.status.eql?('banned')\n temp_item[:published_date] = item.published_date\n temp_item[:Seller_Name] = Seller.find(item.seller_id).name\n temp_item[:Seller_Latitude] = Seller.find(item.seller_id).latitude\n temp_item[:Seller_Longitude] = Seller.find(item.seller_id).longitude\n end\n temp_item[:Category] = Category.find(item.category_id).name\n @items_response[:items] << temp_item\n end\n render json: {response: @items_response, count: @items_response[:items].count }, status: :ok\n end",
"def show\n render json: @purchase, methods: [:inventories]\n end",
"def items_all\n @work_order_items = WorkOrderItem.by_id\n render json: serialized_work_order_items(@work_order_items)\n end",
"def index\n @weapons = Weapon.all\n\n render json: @weapons\n end",
"def index\n @auth_shopping_cart_items = @auth_shopping_cart_item_class.find_cart_items({:resource => lookup_resource}).page 1\n respond_with @auth_shopping_cart_items\n end",
"def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end"
] |
[
"0.7134772",
"0.69249094",
"0.687674",
"0.6861754",
"0.678004",
"0.6698239",
"0.66140956",
"0.6599162",
"0.6570955",
"0.6568973",
"0.65619594",
"0.6485358",
"0.6472469",
"0.6456834",
"0.64541215",
"0.6437892",
"0.6433963",
"0.6433963",
"0.6433963",
"0.6433963",
"0.64330137",
"0.6430696",
"0.6425356",
"0.64178175",
"0.64069116",
"0.6404728",
"0.6402715",
"0.6399985",
"0.6397567",
"0.63763493",
"0.63719165",
"0.63560075",
"0.63408244",
"0.631389",
"0.6311421",
"0.63058203",
"0.62976474",
"0.62875617",
"0.6285169",
"0.62812227",
"0.6269673",
"0.62280816",
"0.62193644",
"0.62004167",
"0.61980635",
"0.6187085",
"0.618337",
"0.6180181",
"0.6171949",
"0.6169375",
"0.61503756",
"0.61427927",
"0.61408657",
"0.6138551",
"0.61367077",
"0.61306643",
"0.6125936",
"0.6121151",
"0.61193055",
"0.6112325",
"0.6111593",
"0.6110162",
"0.6093475",
"0.6090454",
"0.6087892",
"0.6083543",
"0.60758764",
"0.6064393",
"0.6061999",
"0.60571575",
"0.60544646",
"0.60504127",
"0.60457873",
"0.60430366",
"0.60407174",
"0.603428",
"0.60263",
"0.6026044",
"0.60220397",
"0.6020923",
"0.60193866",
"0.6014866",
"0.60135204",
"0.6010557",
"0.60103446",
"0.6007028",
"0.6005439",
"0.600021",
"0.5996923",
"0.59930253",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485",
"0.59899485"
] |
0.7376812
|
0
|
GET /kitchen_items/1 GET /kitchen_items/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @kitchen_items = KitchenItem.all\n end",
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def show\n item = Item.find(params[:id])\n render json: item\n end",
"def index\n @api_v1_items = Item.all\n render json: @api_v1_items\n end",
"def show\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_kit }\n end\n end",
"def show\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @potluck_item }\n end\n end",
"def show\n render json: Item.find(params[:id])\n end",
"def item(uuid)\n http.get \"/items/#{uuid}\"\n end",
"def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end",
"def show\n render json: Item.find(params[\"id\"])\n end",
"def items\n \tbegin\n \t@categories = Category.all.includes(items: [:dimensions])\n \t@ingredients = Ingredient.actives\n \trender 'api/v1/home/items', status: :ok\n \trescue Exception => e\n \t\terror_handling_bad_request(e)\n \tend\n\n\tend",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def get_item\n @item = Item.find_by_id(params[:id])\n if @item\n return @item\n else \n render json: {\"message\": {\"type\": \"error\", \"content\": \"The item could not be found!\"}}\n end\n end",
"def items\n @beverages = Beverage.available\n respond_to do |format|\n format.json { render :json => @beverages.to_json(methods: :image_url)}\n end\n end",
"def index\n #@items = Item.find_by_user_id(Session[user_id])\n @items = Item.all\n render json: @items\n end",
"def show\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kitchen }\n end\n end",
"def show\n @item = Item.all.where(collection_id: params[:id])\n render :json => @item\n end",
"def show\n render json: @rentable_item\n end",
"def show\n @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closet_item }\n end\n end",
"def item_from_fridge_id\n @items = Item.where(:fridge_id => params[:fridge_id])\n render :json => @items.to_json(:include => :product)\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item.to_json() }\n end\n end",
"def index\n json_response(current_restaurant.restaurant_food_items)\n end",
"def get_items(product_id, params={})\n self.client.get(\"products/#{product_id}/items\", params)\n end",
"def list_ingredients\n rid = params[:id]\n items = Aws.get_ingredients_from_db(rid)\n render :json => items\n end",
"def index\n @items = Item.find(:all, :order => 'id ASC')\n # @items = Item.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def 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 show\n @weather_item = WeatherItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @weather_item }\n end\n end",
"def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fooditem }\n end\n end",
"def show\n @inventoryitem = Inventoryitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventoryitem }\n end\n end",
"def show\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def show\n json_response(@food_item)\n end",
"def index\n @items = Admin::Item.by_agency(@current_agency.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_items }\n end\n end",
"def show\n @item = @deal.items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @items }\n end\n end",
"def show\n \n render status: 200, :json => @item\n\n end",
"def show\n authenticate\n list = List.find(params[:id])\n items = list.items\n render json: {\n items: items,\n id: list.id\n }\n end",
"def show\n render json: @item\n end",
"def show\n @recipe = Recipe.find(params[:id])\n @nutrition_info = NutritionInfo.where( \"recipe_id = ?\", @recipe.id ).first\n @inventory_items = []\n @recipe.inventory_items.each do |inventory_item|\n @inventory_items << inventory_item\n end\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe }\n end\n end",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def show\n @itemstable = Itemstable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemstable }\n end\n end",
"def index\n render json: RequestItem.all\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def item\n @item = Item.find(params[:id])\n end",
"def index\n recipe_items = current_user.recipes.includes(recipe_items: :ingredient).find(params[:recipe_id]).recipe_items\n render json: { recipe_items: recipe_items}.to_json(include: :ingredient), status: :ok\n end",
"def fetch\n result = WebApi.json!('ITFItems_440', 'GetPlayerItems', 1, { :SteamID => @steam_id64 })\n\n @items = []\n result[:items][:item].each do |item_data|\n unless item_data.nil?\n item = TF2Item.new(item_data)\n @items[item.backpack_position - 1] = item\n end\n end\n end",
"def show\n @admin_item = Admin::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_item }\n end\n end",
"def show\n @admin_item = Admin::Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_item }\n end\n end",
"def item\n @items = Item.select {|k,v| k.product_type_id != 4 }\n\n respond_to do |format|\n #format.html # index.html.erb\n format.json { render json: @items, :only => [:id, :name, :description, :price, :time], :include => {:product_type => { :only => [:id, :name]}}}\n end\n end",
"def findItem\n item = Item.find(params[:id])\n if item\n return item\n else\n return render json: {data: \"Failure, could not find this item.\"}, status: :not_found\n end\n end",
"def show \n #get the item id from the url params\n item_id = params[:id]\n #use `item_id` to find the item in the database\n #and save it to an instance variable\n @item = Item.find_by_id(item_id)\n render json: @item\n # @item = City.find(params[:id])\n # @item = Item.joins(:posts).includes(:posts).find(params[:id])\n # puts @item\n # render json: {\n # item: @item\n # }\n end",
"def show\n @purchase = Purchase.find(params[:purchase_id])\n @purchase_item = @purchase.purchase_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_item }\n end\n end",
"def path\n \"/{databaseId}/items/list/\"\n end",
"def index\n @lunch_items = LunchItem.all\n end",
"def show\n @rackitem = Rackitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rackitem }\n end\n end",
"def index\n @items = current_user.items\n respond_to do |format|\n format.html\n format.json { render json: @items }\n end\n end",
"def show\n @wishlistitem = Wishlistitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wishlistitem }\n end\n end",
"def show\n @itemname = Itemname.find(params[:id])\n @locations = Location.all\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @itemname }\n end\n end",
"def details\n @vouch_list = VouchList.find(params[:id])\n render json: {\n title: @vouch_list.title,\n items: @vouch_list.items_formatted\n }\n end",
"def show\n render json: @item, status: :ok\n end",
"def show\n @item_datum = ItemData.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_datum }\n end\n end",
"def index\n @section = Section.find(params[:section_id])\n @items = @section.items\n render json: ItemSerializer.new(@items)\n end",
"def index\n\t\t@auction_items = @auction.auction_items\n\t\trender json: @auction_items.as_json\n\tend",
"def show\n @list = List.find(params[:list_id])\n @list_items = @list.list_items.find(params[:list_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @list_item }\n end\n end",
"def show\n @product_item = ProductItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_item }\n end\n end",
"def show\n @mostsmallitemequipinventory = Mostsmallitemequipinventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemequipinventory }\n end\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render :json => Item.all}\n end\n\n end",
"def show\n render json: @request_item\n end",
"def index\n @items = Item.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boards }\n end\n end",
"def show\n\t\trender json: @auction_item.as_json\n\tend",
"def index\n @item_type = params[:type] = \"C\"\n \n params[:id] = nil\n \n # 찜한 상품, 콜렉션\n @collections = Collection.itemList(params)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @collections }\n end\n \n end",
"def get_books(response)\n response[\"items\"]\nend",
"def show\n @shop_item = @flat.shop_items.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_item }\n end\n end",
"def show\n @item_info = ItemInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item_info }\n end\n end",
"def show\n @mostsmalliteminfo = Mostsmalliteminfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmalliteminfo }\n end\n end",
"def set_kitchen_item\n @kitchen_item = KitchenItem.find(params[:id])\n end"
] |
[
"0.7043698",
"0.6975022",
"0.6800097",
"0.6777088",
"0.6717245",
"0.67129",
"0.67125845",
"0.6705742",
"0.66885334",
"0.66855645",
"0.66746444",
"0.66569424",
"0.6622738",
"0.6615867",
"0.6579635",
"0.6558462",
"0.65432334",
"0.65254223",
"0.65217423",
"0.6487448",
"0.64746934",
"0.64735895",
"0.64641947",
"0.6463383",
"0.64610523",
"0.6419581",
"0.64120716",
"0.6396817",
"0.63906837",
"0.63848287",
"0.6383055",
"0.6377164",
"0.6377164",
"0.6377164",
"0.6377164",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.63740516",
"0.6373968",
"0.6367988",
"0.6356754",
"0.63457155",
"0.63437456",
"0.63432753",
"0.6340423",
"0.6309994",
"0.6305804",
"0.6300723",
"0.6295607",
"0.62781906",
"0.6278098",
"0.6258636",
"0.62585175",
"0.62572664",
"0.6255248",
"0.6250953",
"0.6250953",
"0.6241302",
"0.62194663",
"0.6211637",
"0.6171806",
"0.6168176",
"0.6163467",
"0.6161765",
"0.6156315",
"0.61547124",
"0.6153448",
"0.6148129",
"0.61467505",
"0.6141044",
"0.6136118",
"0.6133232",
"0.61309904",
"0.61270934",
"0.61206806",
"0.61183417",
"0.6106524",
"0.6100542",
"0.60983044",
"0.6086831",
"0.60835516",
"0.60827374",
"0.60825133",
"0.60821927",
"0.6070697"
] |
0.0
|
-1
|
POST /kitchen_items POST /kitchen_items.json
|
def create
@kitchen_item = KitchenItem.new(kitchen_item_params)
respond_to do |format|
if @kitchen_item.save
format.html { redirect_to @kitchen_item, notice: 'Kitchen item was successfully created.' }
format.json { render :show, status: :created, location: @kitchen_item }
else
format.html { render :new }
format.json { render json: @kitchen_item.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create_item()\n\n request_body = {\n 'name' => 'Milkshake',\n 'variations' => [\n {\n 'name' => 'Small',\n 'pricing_type' => 'FIXED_PRICING',\n 'price_money' => {\n 'currency_code' => 'USD',\n 'amount' => 400\n }\n }\n ]\n }\n\n response = Unirest.post CONNECT_HOST + '/v1/' + LOCATION_ID + '/items',\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully created item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item creation failed'\n puts response.body\n return nil\n end\nend",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully added.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n item = Item.new(item_params)\n item.done = \"0\"\n item.trash = \"0\"\n\n if item.save\n render json: {data:item}, status: :created\n else\n render json: {data:item}, status: :unprocessable_entity\n end\n end",
"def create\n @item = Item.new(item_params)\n\n if @item.save\n render json: @item\n else\n render json: { error: t('story_create_error') }, status: :unprocessable_entity\n end\n end",
"def create\n @request_item = RequestItem.new(request_item_params)\n @request_item.item = Item.new(name: params[:request_item][:item][:name])\n\n if @request_item.save\n render json: @request_item \n else\n render json: @request_item.errors, status: :bad_request\n end\n end",
"def create\n create_params = item_params\n item = Item.new(\n name: create_params[:name], \n is_complete: false, #create_params[:is_complete], \n list_id: create_params[:list_id])\n\n item.save!\n render json: item\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end",
"def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end",
"def create\n @item = Item.new(item_params)\n if @item.save\n @items = Item.all\n render status: 201, :json => @item\n \n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n \n \n end",
"def create\n @item = build_item\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'アップロードしたでー' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n 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(item_params)\n if @item.save\n render json: ItemSerializer.new(@item)\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item = current_owner.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to items_path, notice: 'Item was created successfully' }\n format.json { render :show, status: :created, location: items_path }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @kioskitem = Kioskitem.new(kioskitem_params)\n\n respond_to do |format|\n if @kioskitem.save\n format.html { redirect_to dashboard_path + \"#kiosk\", notice: 'Kiosk Item was successfully created.' }\n format.json { render :show, status: :created, location: @kioskitem }\n else\n format.html { render :new }\n format.json { render json: @kioskitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def kitchen_item_params\n params.require(:kitchen_item).permit(:name, :purchased_quantity, :used_quantity, :unit, :receipt_item_id)\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_url, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, item: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create \n #whitelist params and save them to a variable \n item_params = params.require(:item).permit(:name, :category, :image, :price)\n #create a new item from 'item_params'\n @item = Item.new(item_params)\n #if item saves, render the new item in JSON\n if @item.save \n render json: @item\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to :items, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @slot }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @item = Item.new(item_params)\n #まだView設定がまだのため仮の登録データ、あとでViewからのデータをitem_paramsで定義します。\n atai = 1\n watasi = \"hoge\"\n\n @item.status = atai\n @item.upper_category = watasi\n @item.middle_category = watasi\n @item.lower_category = watasi\n @item.seller = watasi\n @item.size_type = watasi\n \n \n @item.save\n redirect_to root_path\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(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n @item.save\n respond_with @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 create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to '/items', notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wanted_item = WantedItem.new(wanted_item_params)\n\n respond_to do |format|\n if @wanted_item.save\n format.html { redirect_to @wanted_item, notice: 'Wanted item was successfully created.' }\n format.json { render :show, status: :created, location: @wanted_item }\n else\n format.html { render :new }\n format.json { render json: @wanted_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: \"Item was successfully created.\" }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v1_item = Item.new(api_v1_item_params)\n\n if @api_v1_item.save\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def create\n @lunch_item = LunchItem.new(lunch_item_params)\n\n respond_to do |format|\n if @lunch_item.save\n format.html { redirect_to @lunch_item, notice: 'Lunch item was successfully created.' }\n format.json { render :show, status: :created, location: @lunch_item }\n else\n format.html { render :new }\n format.json { render json: @lunch_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @weather_item = WeatherItem.new(params[:weather_item])\n\n respond_to do |format|\n if @weather_item.save\n format.html { redirect_to @weather_item, notice: 'Weather item was successfully created.' }\n format.json { render json: @weather_item, status: :created, location: @weather_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @weather_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n \n respond_to do |format|\n if @item.save \n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_item = OrderItem.new(order_items_params)\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 json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entry }\n end\n end\n end",
"def create\n @toodoo_item = ToodooItem.new(toodoo_item_params)\n\n respond_to do |format|\n if @toodoo_item.save\n format.html { redirect_to @toodoo_item, notice: 'Toodoo item was successfully created.' }\n format.json { render :show, status: :created, location: @toodoo_item }\n else\n format.html { render :new }\n format.json { render json: @toodoo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @admin_item = Admin::Item.new(params[:admin_item])\n\n respond_to do |format|\n if @admin_item.save\n format.html { redirect_to @admin_item, notice: 'Item was successfully created.' }\n format.json { render json: @admin_item, status: :created, location: @admin_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item }\n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def 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\n ListItem.transaction do\n item = Item.new(item_params)\n item.save\n\n @list_item = ListItem.new(list_item_params)\n @list_item.item_id = item.id\n @list_item.list_id = params[:list_id]\n\n\n if @list_item.save\n render json: @list_item, status: :created\n else\n render json: @list_item.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @fooditem = Fooditem.new(params[:fooditem])\n\n respond_to do |format|\n if @fooditem.save\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully created.' }\n format.json { render :json => @fooditem, :status => :created, :location => @fooditem }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_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.build_note\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n respond_with(@items)\n end\n end\n end",
"def create\n @rentable_item = RentableItem.new(rentable_item_params)\n @rentable_item.save\n end",
"def create\n cart_uuid = params[:cart_id]\n @item = Item.new(item_params.merge(cart_uuid: cart_uuid))\n if @item.save\n render json: @item, status: 201\n else\n render_errors 400, @item.errors.full_messages\n end\n end",
"def create\n @item = Item.new(item_save_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @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 @potluck_item = PotluckItem.new(params[:potluck_item])\n\n respond_to do |format|\n if @potluck_item.save\n format.html { redirect_to [@event, @potluck_item], notice: 'Potluck item was successfully created.' }\n format.json { render json: @potluck_item, status: :created, location: @potluck_item }\n else\n format.html { render action: \"new\", status: :unprocessable_entity }\n format.json { render json: @potluck_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventoryitem = Inventoryitem.new(params[:inventoryitem])\n\n respond_to do |format|\n if @inventoryitem.save\n format.html { redirect_to @inventoryitem, notice: 'Item was successfully created.' }\n format.json { render json: @inventoryitem, status: :created, location: @inventoryitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventoryitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @room_item = RoomItem.create(params.require(:room_item).permit(:Room_id, :Item_id))\n respond_to do |format|\n if @room_item.save\n format.html { redirect_to @room_item, notice: \"Room item was successfully created.\" }\n format.json { render :show, status: :created, location: @room_item }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @room_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item_datum = ItemData.new(params[:item_datum])\n\n respond_to do |format|\n if @item_datum.save\n format.html { redirect_to @item_datum, notice: 'Item datum was successfully created.' }\n format.json { render json: @item_datum, status: :created, location: @item_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to lists_path, :notice => 'Item was successfully created.' }\n format.json { render :json => lists_path, :status => :created, :location => lists_path }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @rackitem = Rackitem.new(params[:rackitem])\n\n respond_to do |format|\n if @rackitem.save\n format.html { redirect_to :back, notice: 'Rackitem was successfully created.' }\n format.json { render json: @rackitem, status: :created, location: @rackitem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @orden_item = OrdenItem.new(orden_item_params)\n @orden_item.orden_id = @orden_item.id_orden\n @orden_item.item_id = @orden_item.id_item\n @orden_item.item_name = @orden_item.item.item_name\n @orden_item.item_image = @orden_item.item.item_image\n @orden_item.item_type = @orden_item.item.item_type\n\n respond_to do |format|\n if @orden_item.save\n format.html { redirect_to @orden_item, notice: 'Orden item was successfully created.' }\n format.json { render :show, status: :created, location: @orden_item }\n else\n format.html { render :new }\n format.json { render json: @orden_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #api_key = \"cb8d3966-e1c6-4429-a8cf-b615523481c4\"\n\n @item = Item.new(item_params)\n\n @swift_api_key = SwiftApiKey.first\n\n api_key = @swift_api_key.key\n\n HTTParty.post(\"https://app.getswift.co/api/v2/deliveries\",\n {\n :body => {\n \"apiKey\": api_key,\n \"booking\":{\n \"items\": [{\n \"quantity\": @item.quantity,\n \"sku\": @item.sku,\n \"description\": @item.description,\n \"price\": @item.price\n }],\n \"pickupDetail\": {\n \"name\": \"Marko\",\n \"phone\": \"604 356 8259\",\n \"address\": \"301 Maude Road, Port Moody, V3H5B1\"\n },\n \"dropoffDetail\": {\n \"name\": @item.name,\n \"phone\": @item.phone,\n \"address\": @item.address\n }\n }\n }.to_json,\n :headers => { 'Content-Type' => 'application/json' }\n }\n )\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def item_create\n @item = Item.new(item_params)\n respond_to do |format|\n if @item.save\n format.html { redirect_to item_index_path, notice: 'O item foi criado com sucesso.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :item_new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @itemtipo = Itemtipo.new(itemtipo_params)\n\n if @itemtipo.save\n render json: @itemtipo, status: :created, location: @itemtipo\n else\n render json: @itemtipo.errors, status: :unprocessable_entity\n end\n end",
"def create\n @curriculumID = Curriculum.find(params[:curriculum_id])\n @item = @curriculumID.items.build(params[:item])\n respond_to do |format|\n if @item.save\n format.html { redirect_to @curriculumID, notice: \"Lehrplaninhalt #{@item.title} wurde erfolgreich angelegt.\" }\n format.json { render action: 'show', status: :created, location: @item } \n else\n format.html { render action: 'new' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n city_id = params[:city_id] || params[:wish_item][:city_id]\n params[:wish_item].delete(:city_id) if params[:wish_item][:city_id].present?\n\n # Used by html call\n if params[:original_wish_item_id].present?\n original_wish_item = WishItem.find(params[:original_wish_item_id])\n end\n\n # Used by javascript call\n if params[:vouch_item_id].present?\n tags = []\n vouch_item = VouchItem.find(params[:vouch_item_id])\n vouch_item.tags.each do |tag|\n tags.push(tag.name)\n end\n end\n\n wish_list = WishList.find_or_create_by_user_id_and_city_id(current_user.id, city_id)\n wish_item = wish_list.wish_items.build(params[:wish_item])\n puts \"add item for business #{wish_item.business_id}\"\n\n if wish_item.save\n respond_to do |format|\n # Add taggings from original wish item to new wish item\n if original_wish_item.present?\n original_wish_item.wish_taggings.each do |tagging|\n add_tagging_with_params(id: wish_item.id, name: tagging.tag.name)\n end\n end\n\n format.html {\n flash[:notice] = \"The item has been successfully added to your wish list!\"\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n success: true,\n wish_item_id: wish_item.id,\n tags: tags\n }\n }\n end\n else\n respond_to do |format|\n format.html {\n flash[:alert] = wish_item.errors.full_messages\n redirect_to wish_lists_path\n }\n format.json {\n render json:\n {\n status: 422,\n errors: wish_item.errors.full_messages.join(\",\")\n }\n }\n end\n end\n end",
"def create\n @lostitem = Lostitem.new(lostitem_params)\n\n respond_to do |format|\n if @lostitem.save\n format.html { redirect_to edit_lostitem_path(@lostitem), notice: 'Lostitem was successfully created.' }\n format.json { render :show, status: :created, location: @lostitem }\n else\n format.html { render :new }\n format.json { render json: @lostitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_item_to_the_room\n @item = Item.find(params[:id])\n @room = Room.find(params[:room_id])\n \n @item.rooms << @room\n \n render json: @item, include: :rooms\n\n end",
"def godown_item_params\n params.require(:godown_item).permit(:godown_entry_id, :product_id, :terminal_code, :model, :sn_code, :price, :items, :amount, :status)\n end",
"def item_params\n params.require(:item).permit(:name, :phone, :address, :quantity, :description, :price, :sku)\n end",
"def item_params\n params.require(:item).permit(:item, :body)\n end",
"def create\n @go_down_item = GoDownItem.new(go_down_item_params)\n\n respond_to do |format|\n if @go_down_item.save\n format.html { redirect_to @go_down_item, notice: 'Go down item was successfully created.' }\n format.json { render :show, status: :created, location: @go_down_item }\n else\n format.html { render :new }\n format.json { render json: @go_down_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @deal.items.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to deal_items_url(@deal), notice: 'Item was successfully created.' }\n format.json { render json: @item, status: :created, location: @item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apiv1_item = Item.new(apiv1_item_params)\n\n respond_to do |format|\n if @apiv1_item.save\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @apiv1_item }\n else\n format.html { render :new }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_item = RecipeItem.new(recipe_item_params)\n\n respond_to do |format|\n if @recipe_item.save\n format.html { redirect_to @recipe_item.recipe, notice: 'Recipe item was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_item }\n else\n format.html { render :new }\n format.json { render json: @recipe_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bought_item = BoughtItem.new(bought_item_params)\n\n respond_to do |format|\n if @bought_item.save\n format.html { redirect_to @bought_item.apartment, notice: 'Bought item was successfully created.' }\n format.json { render :show, status: :created, location: @bought_item }\n else\n format.html { render :new }\n format.json { render json: @bought_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 @needed_item = NeededItem.new(needed_item_params)\n\n respond_to do |format|\n if @needed_item.save\n format.html { redirect_to @needed_item.apartment, notice: 'Needed item was successfully created.' }\n format.json { render :show, status: :created, location: @needed_item }\n else\n format.html { render :new }\n format.json { render json: @needed_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @item = @list.items.create(item_params)\n redirect_to @list\n end",
"def item_params\n params[:item][:ingredient_list] ||= [] \n params.require(:item).permit(:name, ingredient_list: [])\n end",
"def createItemOfList\n results1 = checkUser(params[:target_account]) #userid user to give the money\n if results1.code == 200\n parameters={user_id: (@current_user[\"id\"]).to_i, description: (params[:description]), date_pay: params[:date_pay], cost: params[:cost], target_account: params[:target_account], state_pay:params[:state_pay]}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4055/lists\", options)\n if results.code == 201\n head 201\n else\n render json: results.parsed_response, status: results.code\n end\n elsif results1.code == 404\n renderError(\"Not Found\", 404, \"The resource does not exist\")\n end\n end",
"def create\n @item = current_user.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to root_path, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.72451705",
"0.6928463",
"0.6806272",
"0.6793319",
"0.6772816",
"0.676852",
"0.6707462",
"0.66971517",
"0.66828066",
"0.6654724",
"0.6581394",
"0.65711427",
"0.6538814",
"0.651494",
"0.65121204",
"0.6478343",
"0.6473956",
"0.6432934",
"0.64138335",
"0.63993627",
"0.63717395",
"0.6367949",
"0.6367949",
"0.6367949",
"0.6367949",
"0.6367949",
"0.6367949",
"0.6367949",
"0.63679254",
"0.6367644",
"0.63525236",
"0.6343406",
"0.63315696",
"0.63096154",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.63091975",
"0.6308389",
"0.62981236",
"0.62890357",
"0.6272983",
"0.6269741",
"0.62609506",
"0.62480164",
"0.6247193",
"0.6241521",
"0.6241521",
"0.6241521",
"0.6241521",
"0.6241521",
"0.6240222",
"0.62400734",
"0.62385267",
"0.6236463",
"0.6231217",
"0.6228723",
"0.622544",
"0.6222593",
"0.6221146",
"0.6220087",
"0.6215372",
"0.62142926",
"0.62141865",
"0.620867",
"0.6191945",
"0.61904466",
"0.6189946",
"0.6189222",
"0.6188647",
"0.6180053",
"0.61743236",
"0.6158938",
"0.61514676",
"0.6141353",
"0.6137603",
"0.61337584",
"0.6121113",
"0.6119399",
"0.61186737",
"0.6114171",
"0.6109668",
"0.61092407",
"0.61035705",
"0.6098058",
"0.60929835",
"0.60919553",
"0.6082763"
] |
0.72483754
|
0
|
PATCH/PUT /kitchen_items/1 PATCH/PUT /kitchen_items/1.json
|
def update
respond_to do |format|
if @kitchen_item.update(kitchen_item_params)
format.html { redirect_to @kitchen_item, notice: 'Kitchen item was successfully updated.' }
format.json { render :show, status: :ok, location: @kitchen_item }
else
format.html { render :edit }
format.json { render json: @kitchen_item.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n @item_kit = ItemKit.find(params[:id])\n\n respond_to do |format|\n if @item_kit.update_attributes(params[:item_kit])\n format.html { redirect_to @item_kit, notice: 'Item kit was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_kit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lunch_item.update(lunch_item_params)\n format.html { redirect_to @lunch_item, notice: 'Lunch item was successfully updated.' }\n format.json { render :show, status: :ok, location: @lunch_item }\n else\n format.html { render :edit }\n format.json { render json: @lunch_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = @client.items.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update_attributes(item_params)\n render json: @item, status: :ok\n else\n render_error(@item, :unprocessable_entity)\n end\n end",
"def update_item(item_id)\n request_body = {\n 'name' => 'Malted Milkshake'\n }\n\n response = Unirest.put CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS,\n parameters: request_body.to_json\n\n if response.code == 200\n puts 'Successfully updated item:'\n puts JSON.pretty_generate(response.body)\n return response.body\n else\n puts 'Item update failed'\n puts response.body\n return nil\n end\nend",
"def update\n if @item.update(item_params)\n render json: @item, status: :ok\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @kioskitem.update(kioskitem_params)\n format.html { redirect_to dashboard_path + \"#kiosk\", notice: 'Kiosk Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @kioskitem }\n else\n format.html { render :edit }\n format.json { render json: @kioskitem.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 @closet_item = ClosetItem.find(params[:id])\n\n respond_to do |format|\n if @closet_item.update_attributes(params[:closet_item])\n format.html { redirect_to @closet_item, notice: 'Closet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @closet_item.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 update\n @potluck_item = PotluckItem.find(params[:id])\n\n respond_to do |format|\n if @potluck_item.update_attributes(params[:potluck_item])\n format.html { render :action => :show }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", status: :unprocessable_entity }\n format.json { render json: @potluck_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n Rails.logger.debug params.inspect\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n respond_with(@items)\n end\n end\n end",
"def update\n \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 respond_to do |format|\n if @needed_item.update(needed_item_params)\n format.html { redirect_to @needed_item, notice: 'Needed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @needed_item }\n else\n format.html { render :edit }\n format.json { render json: @needed_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @item.update(item_params)\n render status: 201, :json => @item, :include =>[{:location =>{:except=>[:id, :created_at, :updated_at]}}, {:food =>{:except =>[:id, :created_at, :updated_at]}}], :except => [:created_at, :updated_at, :food_id, :location_id]\n else\n render status: 404, json: { message: @item.errors}.to_json\n end\n\n \n end",
"def update\n ingredient.update(ingredient_params)\n render json: ingredient\n end",
"def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to items_path, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @rackitem = Rackitem.find(params[:id])\n\n respond_to do |format|\n if @rackitem.update_attributes(params[:rackitem])\n format.html { redirect_to @rackitem, notice: 'Rackitem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rackitem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n# @item = Item.get(params[:id])\n\n respond_to do |format|\n if @item.update(params[:item])\n format.html { redirect_to({action: :show, id: @item}, notice: 'Item was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fooditem = Fooditem.find(params[:id])\n\n respond_to do |format|\n if @fooditem.update_attributes(params[:fooditem])\n format.html { redirect_to @fooditem, :notice => 'Fooditem was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @fooditem.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @convenience_item.update(convenience_item_params)\n format.html { redirect_to @convenience_item, notice: 'Convenience item was successfully updated.' }\n format.json { render :show, status: :ok, location: @convenience_item }\n else\n format.html { render :edit }\n format.json { render json: @convenience_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { respond_with_bip(@item) }\n else\n format.html { render action: 'edit' }\n format.json { respond_with_bip(@item) }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @kitchen = Kitchen.find(params[:id])\n\n respond_to do |format|\n if @kitchen.update_attributes(params[:kitchen])\n format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kitchen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @item = Item.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @item.update_attributes(params[:item])\r\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @item.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to lists_path, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n item = @list.list_items.find(params[:id])\n\n if item.update_attributes(params[:list_item])\n render json: item\n else\n error(t('messages.list_item.errors.update'))\n end\n end",
"def change_multiple_items\n @items = params[:items]\n\n @items.each do |item|\n @current_item = Item.find(item[:id])\n @current_item.update(quantity: item[:quantity])\n end\n\n render :json => @items.to_json\n end",
"def 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 @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end",
"def update\n @item.update!(item_params)\n end",
"def update\n # respond_to do |format|\n # if @kitchen.update_attributes(post_params)\n # format.html { redirect_to @kitchen, notice: 'Kitchen was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @kitchen.errors, status :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @recipe_item.update(recipe_item_params)\n format.html { redirect_to @recipe_item, notice: 'Recipe item was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_item }\n else\n format.html { render :edit }\n format.json { render json: @recipe_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n #@food_item automatically set to FoodItem.find(params[:id])\n\n respond_to do |format|\n if @food_item.update_attributes(params[:food_item])\n if request.xhr?\n format.html { render partial: 'row', locals: {food_item: @food_item, index: 0}}\n else\n format.html { redirect_to @food_item, notice: 'Food item was successfully updated.' }\n end\n format.json { head :no_content }\n else\n if request.xhr?\n format.html { render partial: 'row_form', locals: {food_item: @food_item}, status: :unprocessable_entity }\n else\n format.html { render action: \"edit\" }\n end\n format.json { render json: @food_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update #saves and redirects, saves changes\n @line_item = LineItem.find(params[:id])\n @line_item.quantity = params[:quantity]\n @line_item.size_id = params[:size_id]\n @line_item.save\n render json: @line_item\n end",
"def update\n @item = TodoItem.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:todo_item])\n format.html { redirect_to @item, notice: 'TodoItem was successfully updated.' }\n format.json {render json: {\n success: true,\n data: [],\n message: \"TodoItem was successfully updated.\"\n }}\n else\n format.html { render action: \"edit\" }\n format.json { render json: {\n success: false,\n data: [],\n message: @item.errors\n }}\n end\n end\n end",
"def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end",
"def update\n respond_to do |format|\n if @toodoo_item.update(toodoo_item_params)\n format.html { redirect_to @toodoo_item, notice: 'Toodoo item was successfully updated.' }\n format.json { render :show, status: :ok, location: @toodoo_item }\n else\n format.html { render :edit }\n format.json { render json: @toodoo_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet_item.update(pet_item_params)\n format.html { redirect_to @pet_item, notice: 'Pet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_item.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 @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = \"Item has been updated\"\n format.json { render :json => @item.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { render :action => :edit }\n else\n format.json { render :text => \"Could not update item\", :status => :unprocessable_entity } #placeholder\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n format.html { render :action => :edit, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @item = \"Vger::Resources::#{params[:item][:item_type]}\".constantize.find(params[:id])\n respond_to do |format|\n if @item.class.save_existing(params[:id], params[:item])\n format.html { redirect_to suitability_item_path(params[:id]), notice: 'Suitability Item was successfully updated.' }\n format.json { render json: @item, status: :created, location: @item }\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_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to root_path, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @how_to.update(how_to_params)\n format.html { redirect_to item_path }\n format.json { render :show, status: :ok, location: @items }\n else\n format.html { render :edit }\n format.json { render json: @how_to.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item ' + @item.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:id])\n @todo.update_attributes(params[:todo])\n render :json => @todo\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(item_params)\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.name, status: :unprocessable_entity }\n # format.html { render json: @item, notice: 'Item was not successfully updated.' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n\n\n end",
"def update\n @admin_item = Admin::Item.find(params[:id])\n\n respond_to do |format|\n if @admin_item.update_attributes(params[:admin_item])\n format.html { redirect_to @admin_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: @admin_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n recipe.update(recipe_params)\n render json: recipe\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 respond_to do |format|\n if @requirement_item.update(requirement_item_params)\n format.html { redirect_to @requirement_item, notice: 'Requirement item was successfully updated.' }\n format.json { render :show, status: :ok, location: @requirement_item }\n else\n format.html { render :edit }\n format.json { render json: @requirement_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def update!(**args)\n @items = args[:items] if args.key?(:items)\n @request_id = args[:request_id] if args.key?(:request_id)\n end",
"def item_update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to item_show_path(@item), notice: 'O item foi atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @listitem.update(listitem_params)\n render :show, status: :ok, location: todolist_listitem_path(@todolist, @listitem)\n else\n render json: @listitem.errors, status: :unprocessable_entity\n end\nend",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to items_path, notice: 'Item was updated successfully' }\n format.json { render :show, status: :ok, location: items_path }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n product = Product.find(params[:id])\n product_details = params.permit(:title, :inventory_count, :price)\n\n product.update(product_details)\n\n render json: product\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n else\n format.html { render :edit }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7048443",
"0.6896587",
"0.68237144",
"0.67524743",
"0.6710602",
"0.6661912",
"0.6659253",
"0.65691996",
"0.6545763",
"0.6538919",
"0.6530061",
"0.6522068",
"0.64431727",
"0.64341956",
"0.6414629",
"0.64085096",
"0.6402146",
"0.6399562",
"0.63763523",
"0.6375756",
"0.63712716",
"0.6366385",
"0.63530713",
"0.6343274",
"0.63401955",
"0.63389355",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6337157",
"0.6332553",
"0.63262856",
"0.63262856",
"0.63133824",
"0.6311337",
"0.6290745",
"0.62871337",
"0.6283098",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.62820226",
"0.627727",
"0.6272871",
"0.6268663",
"0.62670857",
"0.6252608",
"0.624908",
"0.62490267",
"0.62459964",
"0.6236229",
"0.62348115",
"0.62346315",
"0.6233749",
"0.62301755",
"0.6219857",
"0.62169623",
"0.6213973",
"0.62102383",
"0.6209968",
"0.6206696",
"0.6190974",
"0.6190344",
"0.6187624",
"0.61824244",
"0.6182106",
"0.6180027",
"0.61797893",
"0.61767304",
"0.61743766",
"0.61719966",
"0.61712307",
"0.61692977",
"0.61692774",
"0.61625355",
"0.6162522",
"0.6162522",
"0.6162051",
"0.61600286",
"0.61598927",
"0.6159272",
"0.6158981",
"0.61547834",
"0.6154481",
"0.6154481",
"0.6154481",
"0.6154481",
"0.6154481"
] |
0.69881314
|
1
|
DELETE /kitchen_items/1 DELETE /kitchen_items/1.json
|
def destroy
@kitchen_item.destroy
respond_to do |format|
format.html { redirect_to kitchen_items_url, notice: 'Kitchen item was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete_item(item_id)\n response = Unirest.delete CONNECT_HOST + '/v1/' + LOCATION_ID + '/items/' + item_id,\n headers: REQUEST_HEADERS\n\n if response.code == 200\n puts 'Successfully deleted item'\n return response.body\n else\n puts 'Item deletion failed'\n puts response.body\n return nil\n end\nend",
"def destroy\n @item = @client.items.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully removed from Inventory.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_item(id)\n record \"/todos/delete_item/#{id}\"\n end",
"def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n render status: 200, json: @request_item.destroy\n end",
"def destroy\n @item_kit = ItemKit.find(params[:id])\n @item_kit.destroy\n\n respond_to do |format|\n format.html { redirect_to item_kits_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @kioskitem.destroy\n respond_to do |format|\n format.html { redirect_to kioskitems_url, notice: 'Kiosk Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n# @item = Item.get(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to({action: :index}, notice: 'Item was successfully deleted.') }\n format.json { head :ok }\n end\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fooditem = Fooditem.find(params[:id])\n @fooditem.destroy\n\n respond_to do |format|\n format.html { redirect_to fooditems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lunch_item.destroy\n respond_to do |format|\n format.html { redirect_to lunch_items_url, notice: 'Lunch item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_item = Admin::Item.find(params[:id])\n @admin_item.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n self.auth_admin\n @hall = Hall.where(name: @item.location)\n @item.destroy\n respond_to do |format|\n format.html { redirect_to halls_path(@hall), notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item1 = LineItem1.find(params[:id])\n @line_item1.destroy\n\n respond_to do |format|\n format.html { redirect_to line_item1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem.destroy\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @closet_item = ClosetItem.find(params[:id])\n @closet_item.destroy\n\n respond_to do |format|\n format.html { redirect_to closet_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n item = @item.name\n @item.deleted = true\n @item.deleted_at = Time.now\n @item.save\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: \"#{item} was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item.destroy\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @weather_item = WeatherItem.find(params[:id])\n @weather_item.destroy\n\n respond_to do |format|\n format.html { redirect_to weather_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :ok }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_datum = ItemData.find(params[:id])\n @item_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to item_datum_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to '/items', notice: 'Item was successfully updated.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lineitem = Lineitem.find(params[:id])\n @lineitem.destroy\n\n respond_to do |format|\n format.html { redirect_to lineitems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @itemstable = Itemstable.find(params[:id])\n @itemstable.destroy\n\n respond_to do |format|\n format.html { redirect_to itemstables_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sub1_line_item.destroy\n respond_to do |format|\n format.html { redirect_to sub1_line_items_url, notice: 'Sub1 line item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end",
"def destroy\n @test_item.destroy\n respond_to do |format|\n format.html { redirect_to test_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rackitem = Rackitem.find(params[:id])\n @rackitem.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Rackitem removed' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @resource_item.destroy\n respond_to do |format|\n format.html { redirect_to resource_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n render json: ItemSerializer.new(@item)\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to lists_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to tasks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @order_item.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end",
"def destroy\n Todo.find(params[:id]).destroy\n render :json => {:message => \"Record deleted\", :item_id => params[:id]}\n end",
"def destroy\n @item = @user.items.find(params[:id])\n @item.destroy\n\n\n respond_to do |format|\n format.html { redirect_to user_items_path(@user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line_item = LineItem.find(params[:id])\n @line_item.destroy\n\n respond_to do |format|\n format.html { redirect_to line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy#\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @equipment_line_item.destroy\n respond_to do |format|\n format.html { redirect_to equipment_line_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_line = ItemLine.find(params[:id])\n @item_line.destroy\n\n respond_to do |format|\n format.html { redirect_to item_lines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @item.destroy\n # respond_to do |format|\n # format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @hamper_item.destroy\n respond_to do |format|\n format.html { redirect_to hamper_items_url, notice: 'Hamper item was successfully destroyed.' }\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 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_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end",
"def item_destroy\n @item = Item.find(params[:id])\n @item.destroy\n respond_to do |format|\n format.html { redirect_to item_index_path, notice: 'O item foi removido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @food_item.destroy\n respond_to do |format|\n format.html { redirect_to food_items_url, notice: \"Food item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventoryitem = Inventoryitem.find(params[:id])\n @inventoryitem.destroy\n\n respond_to do |format|\n format.html { redirect_to inventoryitems_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @wanted_item = WantedItem.find(params[:id]).destroy\n respond_to do |format|\n format.json { head :no_content }\n # format.json { redirect_to wanted_items_url, notice: 'Item was successfully destroyed.' }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n # format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n\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.destroy\n respond_to do |format|\n format.html { redirect_to items_path, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ordereditem.destroy\n respond_to do |format|\n format.html { redirect_to ordereditems_url }\n format.json { head :no_content }\n end\n end",
"def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item.destroy\n respond_to do |format|\n format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7543226",
"0.7345672",
"0.73273945",
"0.7256286",
"0.72124076",
"0.7212166",
"0.7191534",
"0.7148264",
"0.7145646",
"0.71179235",
"0.7109465",
"0.7107864",
"0.7074573",
"0.70669353",
"0.7063961",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70634866",
"0.70534635",
"0.7047095",
"0.7043052",
"0.7043052",
"0.70430267",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.70375514",
"0.7027373",
"0.7014158",
"0.7007356",
"0.6975608",
"0.6974787",
"0.696286",
"0.69510275",
"0.69510275",
"0.69494003",
"0.694924",
"0.693504",
"0.6929077",
"0.69234467",
"0.6918052",
"0.6909846",
"0.6903656",
"0.6901323",
"0.6899921",
"0.68956",
"0.6879657",
"0.6879141",
"0.68783873",
"0.6877083",
"0.6872268",
"0.6870749",
"0.68689233",
"0.68666124",
"0.6865945",
"0.68605417",
"0.68605417",
"0.68605417",
"0.68605417",
"0.6848443",
"0.6842361",
"0.6842111",
"0.6837245",
"0.6836581",
"0.6831599",
"0.68243736",
"0.68224037",
"0.68203586",
"0.681615",
"0.68153447",
"0.68138057",
"0.6813477",
"0.6811551",
"0.68110055",
"0.6804358",
"0.6797111",
"0.67953163",
"0.6794408",
"0.6794408",
"0.6794408",
"0.6794408",
"0.6794408"
] |
0.7216307
|
4
|
Use callbacks to share common setup or constraints between actions.
|
def set_kitchen_item
@kitchen_item = KitchenItem.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 kitchen_item_params
params.require(:kitchen_item).permit(:name, :purchased_quantity, :used_quantity, :unit, :receipt_item_id)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
GET /imagedemos GET /imagedemos.json
|
def index
@imagedemos = Imagedemo.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @images = Image.all\n\n render json: @images\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def list\n @api.get(\"#{@api.path}/Images\")\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end",
"def images\n IbmCloudRest.get \"#{@uri}/images\"\n end",
"def index\n @img_lists = ImgList.all\n render json: @img_lists\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image_url = ImageUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_url }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end",
"def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def show\n render json: @family_image\n end",
"def show\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def images\n images = []\n JSON.parse(resource['/offerings/image'].get)[\"images\"].each do |img|\n images << Image.new(img)\n end\n return images\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end",
"def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend",
"def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend",
"def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end",
"def show\n @image_datum = ImageDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_datum }\n end\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def index\n @images = Image.all\n respond_with @images\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n render json: Picture.all\n end",
"def get_images\n {}\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def show\n render json:@web_display_car_image\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n render json: @picture\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def show\n user_id, id, ref = params[:user_id], params[:id], params[:ref]\n img = nil\n if id == '0' && ref\n # do lookup by reference\n img = Image.find_user_image_by_ref(user_id, params[:ref])\n elsif id != '0'\n # do lookup by guid\n img = Image.find_user_image_by_guid(user_id, id)\n end\n return not_found if !img\n\n respond_to do |format|\n format.json { render :json => img.js_serialize, :callback => params[:callback] }\n end\n end",
"def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end",
"def images\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end",
"def urls( options =nil )\n json = request 'images.getURLs', options, :ImageID => image_id, :ImageKey => key\n \n image = upper_hash_to_lower_hash( json['Image'] )\n image.merge!( :image_id => image[\"id\"] )\n \n OpenStruct.new( image ) \n end",
"def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end",
"def show\n render json: @sample_photo\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def show\n render json: @picture, status: :ok\n end",
"def show\n\n # Get random gif from Giphy (http://giphy.com)\n response = HTTParty.get('http://api.giphy.com/v1/gifs/search?' +\n 'q=' + @boolio.val.to_s +\n '&api_key=dc6zaTOxFJmzC' + # provided for public beta testing via (https://github.com/Giphy/GiphyAPI#public-beta-key)\n '&limit=1' + # only want 1\n '&offset=' + rand(30).to_s + # pull from the top 10 most relevant images\n '&rating=pg' + # afraid if this is any higher\n '&fmt=json' # seems to return JSON anyway, but just in case\n )\n\n if response.code == 200\n\n # conver to JSON\n json = JSON.parse response.body, object_class: OpenStruct\n\n # set image from returned results\n @image = json.data[0].images if json.data.count > 0\n end\n\n end",
"def images; end",
"def images(artist, options={})\n get(:standard, {:method => \"artist.getImages\", :artist => artist}.merge(options))\n end",
"def image\n response[\"image\"]\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end",
"def index\n @images = Image.all\n @categories = Category.all.sort_by(&:name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n end\n end",
"def retrieveImages\n posting = Posting.find(params[:id])\n post_attachments = posting.post_attachments.all\n respond_to do |format|\n format.json { render json: {\n status: 'ok',\n rowcount: post_attachments.length,\n results: post_attachments.map { |b| {\n id: b.id,\n imageData: b.image,\n description: b.description\n }}\n }}\n end\n end",
"def show\n @hotel_pic = HotelPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel_pic }\n end\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @imgcomments = Imgcomment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imgcomments }\n end\n end",
"def show\n render json: @web_car_gallery\n end",
"def index\n @advertisements = Advertisement.where(user: current_user).order(updated_at: :desc).with_attached_images\n\n respond_to do |format|\n format.html\n format.json { render json: { advertisements: @advertisements } }\n end\n end",
"def api_url\n \"https://connect.gettyimages.com/v1\"\n end",
"def index\n @web_display_car_images = WebDisplayCarImage.all\n\n render json:@web_display_car_images\n end",
"def product_images\n user_id, product = params[:user_id], params[:id]\n return bad_request if !user_id || !product\n # returns all images for a given user and product\n images = UserProduct.find_images(user_id, product)\n # create json array\n img = images ? images.collect { |i| i.js_serialize } : []\n render :json => img\n end",
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def images\n []\n end",
"def show\n # proxy to GET /roi/id\n @result = ImageServer.get('/roi/'+params[:id]);\n render :json => @result\n end",
"def show\n @web_image = WebImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_image }\n end\n end",
"def show\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_image }\n end\n end",
"def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end",
"def show\n @image_section = ImageSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_section }\n end\n end",
"def wiki_image_data(image)\n RestClient.get(image['image_url'], :accept => image['image_content_type'])\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options passed in\n uri = URI.parse(@uri_string + '/' + image_uuid)\n # and get the results of the appropriate RESTful request using that URI\n result = hnl_http_get(uri)\n # finally, based on the options selected, print the results\n print_object_array(hash_array_to_obj_array([result]), \"Image:\")\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def show\n render json: @thumb\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def getImage\n image=AWS::S3::S3Object.url_for('testing.png','tradeDev')\n render :json => {:image=>image}\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @review_image = ReviewImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review_image }\n end\n end",
"def find( options={} )\n set_session if( session_id.nil? )\n image = request( 'images.getInfo', options )['Image']\n from_json_one( image, session_id )\n end",
"def images()\n @photos = all_photos() \n @headers['Content-Type'] = CONTENT_TYPE\n end",
"def info( options =nil )\n json = request 'images.getInfo', options, :ImageID => image_id, :ImageKey => key\n \n image = upper_hash_to_lower_hash( json['Image'] )\n image.merge!( :image_id => image[\"id\"] )\n \n OpenStruct.new( image ) \n end",
"def images(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Images\", params: params)\n end",
"def images\n if @group.is_member?(@user)\n @images = @group.uploads.images.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n else\n @images = @group.uploads.images.public.paginate(:page => @page, :per_page => @per_page, :order => 'created_at desc')\n end\n respond_to do |format|\n format.js { render :json => basic_uploads_json(@images) }\n end\n end",
"def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end"
] |
[
"0.71706057",
"0.71033627",
"0.7084107",
"0.7084107",
"0.70489085",
"0.6948099",
"0.6942099",
"0.6930324",
"0.6929514",
"0.6918766",
"0.68134093",
"0.68132335",
"0.6805545",
"0.680441",
"0.6791519",
"0.6788768",
"0.6775336",
"0.6772888",
"0.67508864",
"0.6743682",
"0.6743682",
"0.6743682",
"0.6743682",
"0.67067224",
"0.6701777",
"0.6695909",
"0.66952175",
"0.66907483",
"0.66802436",
"0.66800165",
"0.66620237",
"0.6655696",
"0.6653039",
"0.6652163",
"0.66487765",
"0.6646644",
"0.6643642",
"0.663386",
"0.66297036",
"0.66276085",
"0.66125655",
"0.6599811",
"0.658958",
"0.6587292",
"0.6575852",
"0.6554104",
"0.6550751",
"0.64869475",
"0.6486144",
"0.6484217",
"0.6475233",
"0.6475134",
"0.6472556",
"0.6450633",
"0.64499104",
"0.6443003",
"0.644266",
"0.6421708",
"0.64158636",
"0.6409471",
"0.6398993",
"0.6386176",
"0.63825905",
"0.6358981",
"0.6352053",
"0.6337364",
"0.63363093",
"0.63355494",
"0.6331956",
"0.63059783",
"0.62992835",
"0.6288618",
"0.62800485",
"0.6279516",
"0.6272732",
"0.6266965",
"0.62651396",
"0.6261008",
"0.626043",
"0.62603146",
"0.62500155",
"0.6249492",
"0.62491155",
"0.6248654",
"0.6248329",
"0.6247553",
"0.62417924",
"0.62407273",
"0.62359613",
"0.6231893",
"0.6229344",
"0.6229075",
"0.6229075",
"0.6227699",
"0.622757",
"0.62221307",
"0.6221017",
"0.62204593",
"0.621959",
"0.621846"
] |
0.6965595
|
5
|
GET /imagedemos/1 GET /imagedemos/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def show\n @image = Image.find(params[:id])\n\n render json: @image\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def index\n @images = getmydata(\"Image\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @photos = JSON.parse(response.body)\t\t \n\tend\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\t\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def show\n @image_url = ImageUrl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_url }\n end\n end",
"def show\n @image = Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def show\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagem }\n end\n end",
"def show\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n @image_set = ImageSet.find(params[:id])\n\n render json: @image_set\n end",
"def show\n @image_datum = ImageDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_datum }\n end\n end",
"def index\n @cap_image = fetch_cap_image(params['q'])\n\n if @cap_image.nil?\n @cap_image = CapImage.all.first\n flash.now[:alert] = 'Couldn\\'t fetch random image. Here\\'s one from the archives.'\n end\n\n respond_to do |format|\n format.html\n format.json { render json: @cap_image }\n end\n end",
"def index\n @img_lists = ImgList.all\n render json: @img_lists\n end",
"def show\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @imagedemos = Imagedemo.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @image }\n end\n end",
"def show\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_gallery }\n end\n end",
"def index\n render json: Picture.all\n end",
"def index\n @illustrations = Illustration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @illustrations }\n end\n end",
"def get_images\n @command = :get_images\n # set a flag indicating whether or not the user wants to see all images,\n # including the hidden ones\n show_hidden = (@prev_args.peek(0) == \"-i\" || @prev_args.peek(0) == \"--hidden\")\n # get the images from the RESTful API (as an array of objects)\n uri_str = ( show_hidden ? \"#{@uri_string}?hidden=true\" : @uri_string )\n uri = URI.parse uri_str\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'filename'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Images:\", :style => :table)\n end",
"def images\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/images\") )\n end",
"def show\n respond_to do |format|\n format.html\n format.json { render json: @article, methods: [:image_url] }\n end\n end",
"def show\n # proxy to GET /roi/id\n @result = ImageServer.get('/roi/'+params[:id]);\n render :json => @result\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def index\n @variant_images = VariantImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variant_images }\n end\n end",
"def image_list\n @images = Picture.where(album_id: params[:album_id])\n respond_to do |format|\n format.json { render json: @images.to_json(methods: [:path])}\n end\n end",
"def show\n coach = Coach.find(params[:id])\n json = coach.to_json({:image_url => ActionController::Base.helpers.asset_path(coach.image_url)})\n\n respond_to do |format|\n format.json {render :json => json}\n end\n end",
"def list\n @api.get(\"#{@api.path}/Images\")\n end",
"def serv_json\n \"http://api.dribbble.com/shots/popular?page=1\"\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n wishes = Wish.all.with_attached_image.where(is_secret: false)\n render json: { wishes: generate_image_url(wishes) }\n end",
"def show\n render json: @family_image\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\n end",
"def images\n bugImages = BugImage.all\n render :json => bugImages.to_json\n end",
"def show\n render json:@web_display_car_image\n end",
"def show\n user_id, id, ref = params[:user_id], params[:id], params[:ref]\n img = nil\n if id == '0' && ref\n # do lookup by reference\n img = Image.find_user_image_by_ref(user_id, params[:ref])\n elsif id != '0'\n # do lookup by guid\n img = Image.find_user_image_by_guid(user_id, id)\n end\n return not_found if !img\n\n respond_to do |format|\n format.json { render :json => img.js_serialize, :callback => params[:callback] }\n end\n end",
"def show\n render json: @sample_photo\n end",
"def show\n @motivational_image = MotivationalImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motivational_image }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def show\n render json: @picture\n end",
"def index\n @images = Image.all\n respond_with @images\n end",
"def images() \n uri = URI.parse(\"http://\" + @location.host + \":9292/v2/images\")\n return get_request(uri, @token)\n end",
"def show\n render json: @picture, status: :ok\n end",
"def show\n @entry = Entry.find(params[:id])\n hash = {:folder_index => 7, :entry_path => 1}\n @index_count = @entry.getImgCount(hash)\n\n hash.delete(\"entry_path\")\n hash[:count] = 5;\n @image_array = @entry.getRndImgFromDir(hash)\n @image_name = @entry.image.split(\"/\").last().split(\"_\").last().split(\".\").first()\n img = @entry.image\n #@image_name = img[img.rindex('/')+1, img.length][img.rindex('_'), img.length]\n #.split(\".\")[0]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entry }\n end\n end",
"def show\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estate_agent_image }\n end\n end",
"def show\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @bgimage }\n end\n end",
"def show\n\n @observation = Observation.find(params[:id])\n @coral = Coral.find(params[:coral_id])\n\n @files = Dir.glob(\"app/assets/images/tagged_outlines_thumbs/*\")\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @observation }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @slider_image = SliderImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slider_image }\n end\n end",
"def show\n @combined_image = CombinedImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @combined_image }\n end\n end",
"def index\n @pictures = @album.pictures #JRD111115\n\n respond_to do |format|\n format.html #index.html.erb\n format.json { render json: @pictures}\n end\n end",
"def show\n @hotel_pic = HotelPic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hotel_pic }\n end\n end",
"def get_image_by_uuid\n @command = :get_image_by_uuid\n # the UUID was the last \"previous argument\"\n image_uuid = @prev_args.peek(0)\n # setup the proper URI depending on the options passed in\n uri = URI.parse(@uri_string + '/' + image_uuid)\n # and get the results of the appropriate RESTful request using that URI\n result = hnl_http_get(uri)\n # finally, based on the options selected, print the results\n print_object_array(hash_array_to_obj_array([result]), \"Image:\")\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def getimagesinfo\n trek = Trek.find_by_id(params[:id])\n send_data(trek.get_images_info.to_json,\n {:type => \"application/json\", :disposition => \"inline\"})\n end",
"def index\n @pictures = Picture.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def show\n @pic = Pic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pic }\n end\n end",
"def show\n @web_image = WebImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @web_image }\n end\n end",
"def show\n @user = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @photos.map{|photo| photo.to_jq_image } }\n end\n end",
"def show\n\n # Get random gif from Giphy (http://giphy.com)\n response = HTTParty.get('http://api.giphy.com/v1/gifs/search?' +\n 'q=' + @boolio.val.to_s +\n '&api_key=dc6zaTOxFJmzC' + # provided for public beta testing via (https://github.com/Giphy/GiphyAPI#public-beta-key)\n '&limit=1' + # only want 1\n '&offset=' + rand(30).to_s + # pull from the top 10 most relevant images\n '&rating=pg' + # afraid if this is any higher\n '&fmt=json' # seems to return JSON anyway, but just in case\n )\n\n if response.code == 200\n\n # conver to JSON\n json = JSON.parse response.body, object_class: OpenStruct\n\n # set image from returned results\n @image = json.data[0].images if json.data.count > 0\n end\n\n end",
"def index\n @slider_images = SliderImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @slider_images }\n end\n end",
"def index\n @images = Image.all\n @categories = Category.all.sort_by(&:name)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @images }\n end\n end",
"def show\n @slide_image = SlideImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slide_image }\n end\n end",
"def show\n @text2_image = Text2Image.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @text2_image }\n end\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @illustration }\n end\n end",
"def show\n @image_section = ImageSection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_section }\n end\n end",
"def show\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_upload }\n end\n end",
"def show\n @category_image = CategoryImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category_image }\n end\n end",
"def index\n @imgcomments = Imgcomment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imgcomments }\n end\n end",
"def show\n @review_image = ReviewImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @review_image }\n end\n end",
"def show\n render json: @thumb\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos\n @photos_j = @album.photos.map { |p| p.json }\n @photo = Photo.new\n @album.add_one_view\n\n # @images = Dir.glob(\"app/assets/images/*.jpg\")\n # pic_hash = @images.first(10).map { |i| {:pic_url => i}}\n # @photos = pic_hash.each_with_index.map {|i,v| {:photo_id => v.to_s + \"1\" }.merge(i) }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos_j }\n end\n end",
"def show\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n if(params[:study])\n @photos = Photo.order(\"rank DESC\").where(\"tag = ?\", params[:study].gsub(\"\\u00A0\", \" \").gsub(\"\\u00C2\", \" \").strip)\n elsif(params[:frontpage])\n @photos = Photo.order(\"rank DESC\").where(\"front_page = ?\", true)\n else\n @photos = Photo.order(\"tag ASC, rank DESC\").all\n end \n\n @photos.each { |photo| photo.medium_url = photo.photo_file.url(:medium) } \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos.to_json({:only => [:name, :image_width], :methods => :medium_url}) }\n end\n end",
"def show\n @exercise_image = case @exercise.blank?\n when true\n ExerciseMediumImage.where(token: params[:exercise_medium_id], id: params[:id])\n when false\n @exercise.exercise_images.find(params[:id])\n end\n \n\n render json: @exercise_image\n end",
"def show\n @illustration = Illustration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @illustration }\n end\n end",
"def index\n @fotos = Foto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fotos }\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def show\n @match_image = MatchImage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @match_image }\n end\n end",
"def index\n\n per_page = 10\n \n # Total number of images\n @total_num_of_images = Image.all.length\n \n @server_info = request.host_with_port\n \n # Params => Search\n @images = _index_1_search_text(per_page)\n \n @contentArray = _index_get_log()\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def image(id, nsfw = false)\n img = get url: \"images/#{id}\", nsfw: nsfw\n img['image'] if img\n end",
"def show\n @image = Image.find(params[:id])\n\n @previous = @image.previous_image\n @next = @image.next_image\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image }\n end\n end",
"def index\n @combined_images = CombinedImage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @combined_images }\n end\n end",
"def show\n @image_group = ImageGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @image_group }\n end\n end",
"def show\n @image = Gui::Image.find(params[:id])\n @panel = @image.panel\n @dialog = @image.dialog\n @images = @panel.images unless @panel.nil?\n @images = @dialog.images unless @dialog.nil?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gui_image }\n end\n end",
"def images\n IbmCloudRest.get \"#{@uri}/images\"\n end",
"def show\n @bwimage = Bwimage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bwimage }\n end\n end",
"def show\n render json: @web_car_gallery\n end",
"def images artist\n url = \"http://developer.echonest.com/api/v4/artist/images?api_key=#{ECHONEST_API_KEY}&name=#{artist}&format=json&results=#{RESULTS}&start=0&license=unknown\"\n result = parseURL url\n result[\"response\"][\"images\"]\nend",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end",
"def index\n @galleries = Gallery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @galleries }\n end\n end"
] |
[
"0.73817205",
"0.73817205",
"0.7233121",
"0.7165596",
"0.70986265",
"0.7077283",
"0.7067926",
"0.70449656",
"0.70106393",
"0.70106393",
"0.70106393",
"0.70106393",
"0.6989664",
"0.6958747",
"0.69349676",
"0.6933679",
"0.69262606",
"0.68988883",
"0.6895199",
"0.689226",
"0.68621343",
"0.6854793",
"0.68502396",
"0.6828542",
"0.6821036",
"0.6816922",
"0.6802305",
"0.67990756",
"0.6779674",
"0.6778757",
"0.6773761",
"0.67500466",
"0.6728782",
"0.67177945",
"0.67070425",
"0.66999966",
"0.66996247",
"0.66900986",
"0.6685775",
"0.66735435",
"0.6653333",
"0.66362375",
"0.6627899",
"0.6624932",
"0.6622756",
"0.66125125",
"0.66122067",
"0.6605999",
"0.6601913",
"0.65954596",
"0.6592543",
"0.65781987",
"0.6564765",
"0.65564674",
"0.654081",
"0.6531676",
"0.65281695",
"0.65281695",
"0.65227485",
"0.6521283",
"0.6512408",
"0.6511",
"0.65040845",
"0.6502622",
"0.6497811",
"0.6487887",
"0.6486377",
"0.64713275",
"0.6467592",
"0.6463887",
"0.6458517",
"0.6457747",
"0.6456307",
"0.6454146",
"0.6450706",
"0.6446774",
"0.6444108",
"0.6442992",
"0.6441548",
"0.64413273",
"0.6439249",
"0.64303845",
"0.64248854",
"0.64240754",
"0.64198494",
"0.641091",
"0.6398824",
"0.6397726",
"0.6392543",
"0.63849884",
"0.6370917",
"0.6370641",
"0.6369995",
"0.6369436",
"0.63620776",
"0.63596666",
"0.63557035",
"0.63335556",
"0.63304883",
"0.63304883",
"0.63304883"
] |
0.0
|
-1
|
POST /imagedemos POST /imagedemos.json
|
def create
@imagedemo = Imagedemo.new(imagedemo_params)
respond_to do |format|
if @imagedemo.save
format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully created.' }
format.json { render action: 'show', status: :created, location: @imagedemo }
else
format.html { render action: 'new' }
format.json { render json: @imagedemo.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end",
"def create \n @image ||= Image.new(image_params)\n if @image.save\n render json: {\"url\" => @image.image_url(:resized), \"success\" => true}\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.json { render :json => { url: @image.image.url} }\n else\n \n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.json { render json: @image, status: :created, location: [:admin, @image] }\n else\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n request_image = params[:image]\n url_hash = SecureRandom.urlsafe_base64(6)\n name = url_hash + \"-\" + request_image.original_filename.downcase\n\n File.open(\"#{Rails.root}/public/theta/#{name}\", 'wb') do |f|\n f.write(request_image.read)\n end\n\n theta = Theta.create!(url_hash: url_hash, image_url: name)\n render json: {url: \"http://www.rakugaki.tk/h/#{theta.url_hash}\"}, status: 201\n end",
"def get_images_data\t\t\t\t\t\t\n\t\t{ payload: { 'makes' => makes_dropdown, 'images' => images_array('none').compact}, success: true}\n\tend",
"def create\n @post = Post.new(post_params)\n if @post.save\n # write out the address in the console\n puts @post.image\n render json: { image_url: @post.image }, status: 200\n else\n logger.info @post.errors.full_messages\n render json: { error: @post.errors.full_messages }, status: :not_acceptable\n end\n end",
"def create\n @post_img = PostImg.new(post_img_params)\n\n respond_to do |format|\n if @post_img.save\n format.html { redirect_to @post_img, notice: 'Post img was successfully created.' }\n format.json { render :show, status: :created, location: @post_img }\n else\n format.html { render :new }\n format.json { render json: @post_img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n post = Post.new(post_params)\n post.location = Location.create(name: params[:post][:location][:name], lat: params[:post][:location][:lat], long: params[:post][:location][:long])\n if post.save\n params[:post][:images].each do |i|\n img = Image.find(i[:id])\n img.update(active: 1, post_id: post.id)\n end\n\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n\n else\n render json: post.errors, status: 404\n end\n end",
"def create_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, nil)\n nil\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to aquarium_images_url, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n type = @image.url_type\n #response.headers[\"Content-type\"] = \"text/plain\"\n if @image.save\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else \n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n end\n end",
"def create\n image = Image.create(image_params)\n\n if image.new_record?\n render json: { errors: image.errors.messages }, status: 422\n else\n render json: image, status: 201\n end\n end",
"def create\n #debugger\n blog = blog_params[:name]\n @user = User.find(session[:user_id])\n\n params[:image][:attached_assets_attrs].each do |item|\n ImgGroup.post item[:asset], @user, blog\n end\n\n respond_to do |format|\n format.html { render action: 'done' }\n format.json { render text: 'All posted.', status: :created, location: @image }\n end\n end",
"def create\n @image = Spree::Image.new(params[:image])\n\n respond_to do |format|\n if @upload.save\n format.html {\n render :json => [@image.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@image.to_jq_upload]}, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The params coming in are:#{params.inspect}\"\n @experience_image = ExperienceImage.new(experience_image_params)\n logger.debug \"The file created is: #{@experience_image.inspect}\"\n\n\n respond_to do |format|\n if @experience_image.save\n format.json{ render :json => @experience_image }\n else\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def imagedemo_params\n params.require(:imagedemo).permit(:fname, :lname, :image)\n end",
"def create\n @illustration = Illustration.new(params[:illustration])\n\n respond_to do |format|\n if @illustration.save\n format.html { redirect_to @illustration, :notice => 'Illustration was successfully created.' }\n format.json { render :json => { :normal_url => @illustration.attachment.url(:normal) }.merge(@illustration.attributes), :status => :created, :location => @illustration }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @illustration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @image_datum = ImageDatum.new(params[:image_datum])\n\n respond_to do |format|\n if @image_datum.save\n format.html { redirect_to @image_datum, notice: 'Image datum was successfully created.' }\n format.json { render json: @image_datum, status: :created, location: @image_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n flash[:success] = 'Image was successfully created.'\n format.html { redirect_to new_admin_image_preview_url(image_id: @image.id) }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @results = []\n\n unless params[:files].nil?\n params[:files].each do |data|\n img = Image.new\n img.filename = data.original_filename\n img.data = data.read\n img.upload_id = params[:uuid]\n img.visitation_form_id = params[:formId]\n img.image_type = params[:imageType]\n img.content_type = data.content_type\n #img.temp_index = params[:birdIndex]\n img.bird_id = params[:birdId]\n\n if !img.save\n render :json => { :errors => img.errors.full_messages }, :status => 400 and return\n else\n @results << { name: img.filename, imageType: img.image_type, id: img.id }\n end\n end\n end\n\n render json: { files: @results }\n end",
"def create_deskewed_image(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :POST, 'File')\n end",
"def create\n @gallery = find_gallery\n @gallery.save! unless @gallery.persisted?\n @image = Image.new params[:image]\n @image.image_gallery_id = @gallery.id\n @images = @gallery.images\n \n respond_to do |format|\n if @image.save \n format.js\n format.json { render json: @image, status: :created, location: @image }\n else\n format.js\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n # fetch tags from google vision API\n helpers.fetch_tags(image_params)\n\n @image.image_file.attach(image_params[:image_file])\n\n respond_to do |format|\n if @image.save()\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def postToolsImage( filedata, type)\n params = Hash.new\n params['filedata'] = filedata\n params['type'] = type\n return doCurl(\"post\",\"/tools/image\",params)\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render json: @image, status: :created, location: @image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_to_sample = ImageToSample.new(image_to_sample_params)\n\n respond_to do |format|\n if @image_to_sample.save\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image_to_sample }\n else\n format.html { render action: 'new' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @gallery = find_gallery\n @gallery.save! unless @gallery.persisted?\n @image = Image.new image_params\n @image.image_gallery_id = @gallery.id\n\n respond_to do |format|\n if @image.save\n format.js\n format.json { render json: @image, status: :created, location: @image }\n else\n format.js\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def create\n @post = Post.new(params[:post])\n @post.user_id = session[:user_id]\n \n respond_to do |format|\n if @post.save\n flash[:notice] = 'Post was successfully created.'\n \n if params[:images]\n counter = 0\n for image in params[:images][\"file_data\"]\n if image != \"\"\n @image = Image.create(:file_data => image, :owner_id => @post.id, :owner_type => 'Post', :filename => image.original_filename, \n :body => params[:images][\"body\"][counter] )\n counter = counter + 1\n end\n end\n end\n \n format.html { redirect_to :controller => \"posts\" }\n format.xml { head :created, :location => post_url(:id => @post) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @post.errors.to_xml }\n end\n end\n end",
"def image_callback\n @image = Image.create(image_params)\n @lecture.update(image: @image)\n end",
"def create\n data = image_params[:data]\n\n if data\n @image = Image.new.tap do |t|\n t.data = data.read\n t.description = data.original_filename\n end\n end\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postimage = Postimage.new(postimage_params)\n\n respond_to do |format|\n if @postimage.save\n format.html { redirect_to @postimage, notice: 'Postimage was successfully created.' }\n format.json { render :show, status: :created, location: @postimage }\n \n else\n format.html { render :new }\n format.json { render json: @postimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image_datum = ImageDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_datum }\n end\n end",
"def new\n @image = Image.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end",
"def create\n @picture = Picture.create!(picture_params)\n render json: @picture, status: :created\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n flash[:notice] = 'Image was successfully created.'\n format.html { redirect_to(@image) }\n format.json { render :json => @image, :status => :created, :location => @image }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: \"Image was successfully created.\" }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@img = ReportImage.new(img_params)\n\n\t\tif @img.save\n\t\t\trender :json => @img\n\t\telse\n\t\t\trender :json => @img.errors\n\t\tend\n\tend",
"def new\n @image = Image.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @image }\n end\n end",
"def new\n @post = Post.new\n 2.times { @post.post_images.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\n end",
"def create\n @image = Image.new(image_params)\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_attrib = ImageAttrib.new(image_attrib_params)\n\n if @image_attrib.save\n render :show, status: :created, location: @image_attrib\n else\n render json: @image_attrib.errors, status: :unprocessable_entity\n end\n end",
"def create_remote\n img = {}\n data = {}\n if params[:data].present?\n data = JSON.parse(params[:data]).symbolize_keys\n img = data[:image].symbolize_keys\n else\n img = params[:image]\n end\n model = @imageable.class\n former_image = @imageable.respond_to?(:images) ? nil : @imageable.image\n kind = img[:kind]\n kind = model::IMAGE_KINDS.keys.first if kind.blank? && model.const_defined?(:IMAGE_KINDS)\n image = Image.new(imageable: @imageable, kind: kind, legend: img[:legend].to_s, zoomable: (img[:zoomable].present? ? img[:zoomable] : true))\n if Figaro.env.s3_enabled.to_bool\n # Special field for carrierwave_direct's business\n image.img.key = data[:key]\n end\n if request.xhr?\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n return render(json: image, status: :ok)\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n errors = image.errors[:img]\n render json: [{ error: errors }], status: :error\n else\n if image.save_and_process!\n former_image.try :destroy if former_image\n #image[:url] = image.img.url\n if Figaro.env.s3_enabled.to_bool && Figaro.env.js_upload_enabled.to_bool && Figaro.env.js_s3_iframe_enabled.to_bool\n return render(nothing: true)\n end\n return redirect_to({ action: :assist, id: image })\n end\n Rails.logger.error \"[Image Creation Error #{Time.zone.now.xmlschema}] #{image.errors.full_messages}\"\n redirect_to parent_url, alert: \"L’image n’a pas pu être créée\"\n end\n end",
"def create\n params[:exercise_medium_image][:token] = params[:exercise_medium_id]\n @exercise_image = case @exercise.blank?\n when true\n ExerciseMediumImage.new(params[:exercise_medium_image])\n when false\n @exercise.exercise_images.new(params[:exercise_medium_image])\n end\n \n # Won't validate so we avoid carrierwave error checking\n if @exercise_image.save(:validate=>false)\n file_name = ActiveRecord::Base.sanitize(params[:exercise_medium_image][:image])\n\n # Manually update exercise so we avoid carrierwave\n ActiveRecord::Base.connection.execute(\"update exercise_images set image=\" + file_name+ \" where id=\" + @exercise_image.id.to_s)\n @exercise_image.reload\n # Maybe reprocess the image to get thumbnails?? Naaah\n\n render json: @exercise_image, status: :created\n else\n render json: @exercise_image.errors.full_messages, status: :unprocessable_entity\n end\n \n end",
"def create\n @upload_preview = UploadPreview.new(params[:upload_preview])\n \n if @upload_preview.save\n render :json => {:img_path => @upload_preview.img.url.to_s,:id=>@upload_preview.id, \n :name => @upload_preview.img.instance.attributes[\"img_file_name\"]}, :content_type => 'text/html' \n else\n render :json => {:result => 'error'}, :content_type => 'text/html'\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @image }\n else\n format.html { render action: 'new' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image = ImagePost.new\n @image.build_content\n @image.content.mediable = @image\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image }\n end\n end",
"def create\n @sample_photo = SamplePhoto.new(sample_photo_params)\n\n\n if @sample_photo.save\n render json: @sample_photo, status: :created\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def element\n image_name_list = get_image_name_list ORIGINALS_PATH\n image_name_list.each { |image_name| post(image_name) }\n end",
"def create\n @animal_image = AnimalImage.new(animal_image_params)\n\n respond_to do |format|\n if @animal_image.save\n format.html { redirect_to @animal_image, notice: \"Animal image was successfully created.\" }\n format.json { render :show, status: :created, location: @animal_image }\n else\n format.html { render :new }\n format.json { render json: @animal_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n @pix.images.attach(params[:images]) if params[:images]\n if @pix.save\n format.html do\n redirect_to go_to_pix(@pix),\n flash: { success: 'Pix was successfully saved.' }\n end\n format.json { render :show, status: :created, location: @pix }\n else\n format.html { render :new }\n format.json { render json: @pix.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @img = current_user.imgs.build(img_params)\n # @img = Img.new(img_params)\n\n respond_to do |format|\n if @img.save\n format.html { redirect_to @img, notice: \"Img was successfully created.\" }\n format.json { render :show, status: :created, location: @img }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_image\n obtain_product_image_params\n pi = ProductImage.new(picture: @image_params)\n @product.product_images << pi\n render json: @product.simple_info, status: :ok\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def uploader\n @doctor = Doctor.find(params[:id])\n image = @doctor.create_image(file: params[:image])\n if image.present?\n render json: {doctor: image.file},status: 200\n else\n render json: {errors: @doctor}, status: 422\n end\n\n end",
"def create\n @image = Image.new(image_params) do |t|\n t.data = Base64.encode64(params[:image][:data].read)\n t.filename = params[:image][:data].original_filename\n t.mime_type = params[:image][:data].content_type\n end\n # @image.name = image_params['name']\n # @image.price = image_params['price']\n # @image.city = image_params['city']\n # @image.description1 = image_params['description1']\n # @image.description2 = image_params['description2'] \n @image.active = true\n @image.admin_ok = false\n @image.user_id = current_user.id\n @image.e_mail = current_user.email\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n @image.user_token = @user_token\n\n respond_to do |format|\n params_hash = image_params\n if not params_hash[:aspect_ratio]\n @image.errors.add(:url, \"Must be a valid URL to an image\")\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n elsif @image.save\n format.html { redirect_to @image, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @apartment = current_user.apartments.new(apartment_params)\n\n respond_to do |format|\n if @apartment.save\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @apartment.pictures.create(image: image)\n }\n end\n format.html { redirect_to @apartment, notice: 'Propiedad creada correctamente.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @memberimage = Memberimage.new(params[:memberimage])\n\n respond_to do |format|\n if @memberimage.save\n format.html { redirect_to ideas_path, notice: 'Memberimage was successfully created.' }\n format.json { render json: @memberimage, status: :created, location: @memberimage }\n else\n format.html { render action: \"new\" }\n format.json { render json: @memberimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_json\n respond_to do | wants |\n wants.json do\n _create do | image, image_placement |\n if image.save && image_placement.save\n render :layout => false, :json => { :status => 'UPLOADED', :image_url => url_for(:action=>'show', :id=>image_placement.id, :only_path => true)} \n # returning application/json, text/x-json, text/json cause Firefox 3 to try to open an app\n # returning text/html or application/xhtml+xml causes ampersands (&) in json \n # strings to get html_escape (&)\n response.content_type = Mime::HTML\n else\n render :layout => false, :json => { :status => 'FAILED'}\n # otherwise Rails returns application/json and Firefox 3 tries to open an app\n response.content_type = Mime::HTML\n end\n end\n end\n end\n end",
"def create\n @image = Image.new(image_params)\n @image.ip = ip2long request.remote_ip\n @image.delete_code = (0...50).map { ('a'..'z').to_a[rand(26)] }.join\n @image.homepage = false\n @image.save\n end",
"def create\n @family_image = FamilyImage.new(family_image_params)\n\n if @family_image.save\n render json: @family_image, status: :created, location: @family_image\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def create\n @admin_image = Image.new(admin_image_params)\n \n respond_to do |format|\n if @admin_image.save\n format.html { redirect_to admin_images_url, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @admin_image }\n else\n format.html { render :new }\n format.json { render json: @admin_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def new\n @imovel = Imovel.new\n @imovel.images.build\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imovel }\n end\n end",
"def create\n @image = Image.new(params[:image])\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to([:admin,@image], :notice => 'Image was successfully created.') }\n format.xml { render :xml => [:admin,@image], :status => :created, :location => @image }\n format.json do \n render :json=> @image,\n :content_type => 'text/json',\n :status => :created \n end\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n format.json { render :status=>:unprocessable_entity ,:json => @image.errors, :content_type => 'text/json' }\n\n end\n end\n end",
"def create\n @image_4ye = Image4ye.upload(image_params[:file].tempfile)\n @mini_image = MiniMagick::Image.read(image_params[:file].tempfile)\n @image = Image.new(image_params)\n @image.url = @image_4ye.url\n @image.width = @mini_image[:width]\n @image.height = @mini_image[:height]\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to images_path, notice: 'Image was successfully created.' }\n format.json { render :show, status: :created, location: @image }\n else\n format.html { render :new }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n if negocio_params[:imagen] == nil\n base64 = \"\"\n elsif negocio_params[:imagen] == \"\"\n base64 = \"\"\n else\n base64 = negocio_params[:imagen]\n base64.slice!('data:image/png;base64,')\n end\n\n @negocio = Negocio.new(negocio_params)\n\n respond_to do |format|\n if @negocio.save\n\n format.html { redirect_to @negocio, notice: 'Negocio was successfully created.' }\n format.json { render :show, status: :created, location: @negocio }\n else\n format.html { render :new }\n format.json { render json: @negocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imagepost = Imagepost.new(imagepost_params)\n @imagepost.user = current_user\n\n respond_to do |format|\n if @imagepost.save\n format.html { redirect_to @imagepost, notice: 'Imagepost was successfully created.' }\n format.json { render :show, status: :created, location: @imagepost }\n else\n format.html { render :new }\n format.json { render json: @imagepost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @review_image = ReviewImage.new(params[:review_image])\n\n respond_to do |format|\n if @review_image.save\n format.html { redirect_to @review_image, notice: 'Review image was successfully created.' }\n format.json { render json: @review_image, status: :created, location: @review_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @review_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @image_section = ImageSection.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_section }\n end\n end",
"def new\n @image_url = ImageUrl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_url }\n end\n end",
"def upload_new_image_file(detection_flags, image = {})\n @client.post \"/service_json_ssl.svc/UploadNewImage_File\", {detection_flags:detection_flags,imagefile_data:image[:data],original_filename:image[:original_filename]}\n end",
"def create\n\n params[:exercise_illustration][:token] = params[:exercise_id]\n @exercise_illustration = case @exercise.blank?\n when true\n ExerciseIllustration.new(params[:exercise_illustration])\n when false\n @exercise.exercise_illustrations.new(params[:exercise_illustration])\n end\n \n # Won't validate so we avoid carrierwave error checking\n if @exercise_illustration.save(:validate=>false)\n file_name = ActiveRecord::Base.sanitize(params[:exercise_illustration][:illustration])\n\n # Manually update exercise so we avoid carrierwave\n ActiveRecord::Base.connection.execute(\"update exercise_illustrations set illustration=\" + file_name+ \" where id=\" + @exercise_illustration.id.to_s)\n @exercise_illustration.reload\n # Maybe reprocess the illustration to get thumbnails?? Naaah\n\n render json: @exercise_illustration, status: :created\n else\n render json: @exercise_illustration.errors.full_messages, status: :unprocessable_entity\n end\n \n end",
"def create\n @post = Post.new(post_params)\n @post.score = 0\n\n\n\n if(post_params[:image] == nil)\n path = \"#{Rails.root}/public/uploads/post/image/#{@post.id}/image.jpg\"\n File.open(path, \"wb\") do |f|\n f.write(Base64.decode64(@post.imagedata))\n end\n @post.image = File.open(path)\n else\n @post.imagedata = Base64.encode64(File.open(@post.image.path).read)\n end\n\n respond_to do |format|\n if @post.save\n format.html {\n redirect_to @post, notice: 'Post was successfully created.' \n }\n format.json {\n render json: @post \n }\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 @post = Post.new(post_params)\n\n\n if @post.save && params[:images]\n params[:images].each { |image|\n @post.images.create(image: image)\n }\n end\n\n redirect_to @post\n end",
"def new\n @review_image = ReviewImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @review_image }\n end\n end",
"def new\n @motivational_image = MotivationalImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motivational_image }\n end\n end",
"def create\n @markdown_image = MarkdownImage.new(markdown_image_params)\n\n respond_to do |format|\n if @markdown_image.save\n format.js\n format.html { redirect_to [:admin, @markdown_image], notice: 'Markdown image was successfully created.' }\n format.json { render action: 'show', status: :created, location: @markdown_image }\n else\n format.html { render action: 'new' }\n format.json { render json: @markdown_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @image_collection = ImageCollection.new(image_collection_params)\n\n respond_to do |format|\n if @image_collection.save\n image_collection_params[:attached_images].reject(&:empty?).each do |id|\n @image_collection.images << Image.find(id)\n end\n\n @image_collection.save\n\n format.html { redirect_to @image_collection, notice: 'Image collection was successfully created.' }\n format.json { render :show, status: :created, location: @image_collection }\n else\n format.html { render :new }\n format.json { render json: @image_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @picture = Picture.new(picture_params)\n\n if @picture.save\n @picture.update(foodscape_id: params[:foodscape_id])\n render json: @picture, status: :created\n else\n render json: @picture.errors, status: :unprocessable_entity\n end\n end",
"def create\n @imageable = find_imageable\n @image = @imageable.images.build(image_params)\n\n respond_to do |format|\n if @image.save\n format.html { redirect_to @image, notice: t('.notice', image: @image) }\n format.json\n else\n format.html { render :new }\n format.json {\n render json: @image.errors[:attachment], status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @motivational_image = MotivationalImage.new(params[:motivational_image])\n\n respond_to do |format|\n if @motivational_image.save\n format.html { redirect_to @motivational_image, notice: 'Motivational image was successfully created.' }\n format.json { render json: @motivational_image, status: :created, location: @motivational_image }\n else\n format.html { render action: \"new\" }\n format.json { render json: @motivational_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n image = PropertyImage.new()\n image.photo = params[:file]\n image.property_form = @property_form\n if image.save\n respond_to do |format|\n format.json do\n json = {id: image.id}\n render json: json\n end\n end\n end\n end",
"def create\n\n # original code\n\n # @image_set = ImageSet.create(image_set_params)\n\n # render json: @image_set\n\n# code for imageMagick\n @image_set = current_user.image_sets.guild(image_set_params)\n authorize @image_set\n if @image_set.save\n # to handle multiple image upload on create\n if params[:images]\n params[:images].each {|image|\n @image_set.images.create(image: image)\n }\n end\n flash[:notice] = \"Your image set has been created.\"\n redirect_to @image_set\n else\n flash[:alert] = \"Something went wrong.\"\n render 'new'\n end\n\n end",
"def new\n @estate_agent_image = EstateAgentsImage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @estate_agent_image }\n end\n end"
] |
[
"0.66844064",
"0.63975775",
"0.63907677",
"0.6249914",
"0.619083",
"0.6177423",
"0.6177007",
"0.6172407",
"0.61656713",
"0.61557436",
"0.60964936",
"0.6092667",
"0.60897505",
"0.6087746",
"0.60378796",
"0.60340583",
"0.6030172",
"0.60289156",
"0.5999898",
"0.5991341",
"0.5983765",
"0.5979979",
"0.5962217",
"0.5955043",
"0.59528524",
"0.59404314",
"0.59404314",
"0.59404314",
"0.59404314",
"0.5935971",
"0.59211016",
"0.5914222",
"0.5914222",
"0.5914222",
"0.5914222",
"0.5914222",
"0.5914222",
"0.5912341",
"0.5910736",
"0.5892609",
"0.5883354",
"0.5882535",
"0.5875767",
"0.58711064",
"0.58672744",
"0.5866135",
"0.58624834",
"0.58624834",
"0.58624834",
"0.58624834",
"0.58624834",
"0.58579946",
"0.58573663",
"0.58466566",
"0.58359325",
"0.5832681",
"0.5832492",
"0.58301014",
"0.5827668",
"0.5822928",
"0.5822928",
"0.58184195",
"0.58174354",
"0.5810996",
"0.57870996",
"0.5783693",
"0.5775729",
"0.5770502",
"0.57532537",
"0.5746177",
"0.5737742",
"0.5736101",
"0.57182574",
"0.5717057",
"0.5715461",
"0.5715111",
"0.57027656",
"0.56997085",
"0.5686396",
"0.56854475",
"0.56842166",
"0.56842077",
"0.56834334",
"0.56802756",
"0.56777966",
"0.567756",
"0.56770605",
"0.56756675",
"0.5675437",
"0.567456",
"0.5666866",
"0.5666598",
"0.5662405",
"0.5658568",
"0.5657258",
"0.5656673",
"0.5649871",
"0.5645822",
"0.5630476",
"0.5626318"
] |
0.6904636
|
0
|
PATCH/PUT /imagedemos/1 PATCH/PUT /imagedemos/1.json
|
def update
respond_to do |format|
if @imagedemo.update(imagedemo_params)
format.html { redirect_to @imagedemo, notice: 'Imagedemo was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @imagedemo.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n params[:image].delete :created_at\n params[:image].delete :updated_at\n params[:image].delete :id\n @image = Image.find(params[:id])\n if @image.update_attributes(params[:image])\n render json: @image\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n #we can allow updating an image name and description and unit, but not the image data. for that we need to create a new image\n update_params = image_params\n update_params.delete(\"image\")\n\n if @image.update(update_params)\n head :no_content\n else\n render json: @image.errors, status: :unprocessable_entity\n end\n end",
"def update\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food.build_image(params['image']) do |t|\n if params['food']['image']['data']\n t.data = Base64.encode64(params['food']['image']['data'].read)\n t.filename = params['food']['image']['data'].original_filename\n t.mime_type = params['food']['image']['data'].content_type\n end\n end \n @food.name = @food.name.capitalize\n respond_to do |format|\n if @food.update(food_params)\n format.html { redirect_to @food, notice: 'Food was successfully updated.' }\n format.json { render :show, status: :ok, location: @food }\n else\n format.html { render :edit }\n format.json { render json: @food.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, :notice => 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update(url, data)\n RestClient.put url, data, :content_type => :json\nend",
"def update\n respond_to do |format|\n if @image_to_sample.update(image_to_sample_params)\n format.html { redirect_to @image_to_sample, notice: 'Image to sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image_to_sample.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n type = @image.url_type\n if @image.update_attributes!(params[:image])\n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\") ].to_json.to_s\n else\n redirect_to console_images_path\n end\n else \n if request.xhr?\n render :text => [ @image.to_jq_upload(type, \"image\").merge({ :error => \"custom_failure\" }) ].to_json.to_s\n else\n redirect_to edit_console_image_path(@image)\n end\n end\n end",
"def update\n respond_to do |format|\n if @icesled.update(icesled_params)\n if params[:images]\n @icesled.gallery ||= Gallery.new\n params[:images].each do |image|\n @icesled.gallery.images.create(image: image)\n end\n unless @icesled.image_file_size\n @icesled.update(image: @icesled.gallery.images.first.image)\n end\n end\n format.html { redirect_to @icesled, notice: 'Icesled was successfully updated.' }\n format.json { render :show, status: :ok, location: @icesled }\n else\n format.html { render :edit }\n format.json { render json: @icesled.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n parms = ski_params\n parms[:color] = parms[:color].split(', ') if parms[:color]\n respond_to do |format|\n if @ski.update(parms)\n if params[:images]\n @ski.gallery ||= Gallery.new\n params[:images].each do |image|\n @ski.gallery.images.create(image: image)\n end\n unless @ski.image_file_size\n @ski.update(image: @ski.gallery.images.first.image)\n end\n end\n format.html { redirect_to @ski, notice: 'Ski was successfully updated.' }\n format.json { render :show, status: :ok, location: @ski }\n else\n format.html { render :edit }\n format.json { render json: @ski.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n if @image.update(image_params)\n render json: {status: \"success\", data: {image:@image}}, status: :ok\n else\n render json: @comment.errors, status: 404\n end\n end",
"def update options={}\n client.put(\"/#{id}\", options)\n end",
"def update\n respond_to do |format|\n if image.update(image_params)\n format.html { redirect_to image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: image }\n else\n format.html { render :edit }\n format.json { render json: image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @experience_image.update(experience_image_params)\n format.html { redirect_to @experience_image, notice: 'Experience image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @experience_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @img.update(img_params)\n format.html { redirect_to @img, notice: \"Img was successfully updated.\" }\n format.json { render :show, status: :ok, location: @img }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n post = Post.find(params[:post][:id])\n post.body = params[:post][:body]\n\n # //location\n post.location.name = params[:post][:location][:name]\n post.location.lat = params[:post][:location][:lat]\n post.location.long = params[:post][:location][:long]\n # images\n for new_img in params[:post][:images]\n flag = 0\n for old_img in post.images\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n img = Image.find new_img[:id]\n img.update_attributes(post_id: post.id, active: 1)\n end\n end\n\n for old_img in post.images\n flag = 0\n for new_img in params[:post][:images]\n if old_img.id == new_img[:id]\n flag = 1\n break\n end\n end\n if flag == 0\n old_img.destroy\n end\n end\n\n if post.save\n render json: {\n status: \"success\",\n data: post.as_json(\n include: [\n {\n user:\n {\n only: [:id, :name, :avatar]\n }\n },\n :location,\n {\n images: {\n only: [:id, :src]\n }\n },\n :rates\n ])}, status: :ok\n else\n render json: post.errors, status: 404\n end\n\n end",
"def update\n respond_to do |format|\n if @image.update_attributes(image_params)\n flash[:notice] = 'Image was successfully updated.'\n format.html { redirect_to(@image) }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n params = image_params\n params[\"tags\"] = params[\"tags\"].delete_suffix(',')\n\n respond_to do |format|\n if @image.update(params)\n format.html { redirect_to @image, notice: \"Image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @family_image = FamilyImage.find(params[:id])\n\n if @family_image.update(family_image_params)\n head :no_content\n else\n render json: @family_image.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @recipe_image.update(recipe_image_params)\n format.html { redirect_to @recipe_image, notice: 'Recipe image was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_image }\n else\n format.html { render :edit }\n format.json { render json: @recipe_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to mypictures_path}\n format.json { head :no_content }\n flash[:success] = \"Image updated\"\n\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @featureimg.update(featureimg_params)\n format.html { redirect_to current_user, notice: 'Feature Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @featureimg.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @sample_photo.update(sample_photo_params)\n render json: @sample_photo, status: :ok\n else\n render json: @sample_photo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html {redirect_to @image, notice: 'Image was successfully updated.'}\n format.json {render :show, status: :ok, location: @image}\n else\n format.html {render :edit}\n format.json {render json: @image.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @idea = Idea.find(params[:id])\n @idea.name = params[:name]\n @idea.description = params[:description]\n repo_path = \"#{Rails.root}/public/data/repository/#{current_user.id}/#{@idea.name}\"\n cover_img_path = \"/data/repository/#{current_user.id}/#{@idea.name}\"\n\n if params[:cover_img]\n @idea.cover_img = params[:cover_img]\n DataFile.save(params[:cover_img], cover_img_path)\n\t\t\t@git = GitHelper.init(repo_path, current_user.email, current_user.name)\n\t\t\tGitHelper.commitAll(@git, \"Changed cover image.\")\n end\n\n if @idea.save\n\t\t\trender json: @idea\n\t\telse\n\t\t\trender json: {error: \"Failed to update idea\"}, status: :unauthorized\n end\n end",
"def update\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n if @photo1.update_attributes(params[:photo1])\n format.html { redirect_to @photo1, notice: 'Photo1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_radios_for_array(args = {}) \n id = args['id']\n temp_path = \"/radios.json/{arrayId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"radioId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end",
"def update!(**args)\n @update_photo_requests = args[:update_photo_requests] if args.key?(:update_photo_requests)\n end",
"def update\n if @product_image.update_attributes(product_image_params)\n render json: @product_image, status: 200\n else\n render_error 400, @product_image.errors.full_messages\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n old_image_id=@food_group.image_id\n #if params[:food_group][:image_attributes][:image_path] == nil\n if @food_group.update(food_group_params)\n #byebug\n if params[:food_group][:image_attributes][:image_path] == nil\n @food_group.update(:image_id=>old_image_id)\n end\n @food_group.update(:updated_by=>session[:kitchen_user_id])\n format.html { redirect_to action: \"index\", notice: 'Food group was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_group }\n else\n format.html { render :edit }\n format.json { render json: @food_group.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @animal_image.update(animal_image_params)\n format.html { redirect_to @animal_image, notice: \"Animal image was successfully updated.\" }\n format.json { render :show, status: :ok, location: @animal_image }\n else\n format.html { render :edit }\n format.json { render json: @animal_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image_gallery = ImageGallery.find(params[:id])\n\n respond_to do |format|\n if @image_gallery.update_attributes(params[:image_gallery])\n format.html { redirect_to @image_gallery, notice: 'Image gallery was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_gallery.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @img = Img.find(params[:id])\n\n respond_to do |format|\n if @img.update_attributes(params[:img])\n format.html { redirect_to(@img, :notice => 'Img was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @img.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @image.update(image_params)\r\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @image }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @image.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n #Finds selected data file\n @image = Image.find(params[:id])\n\n #Components\n #Checks if the data file is attached to any components - if so clears them\n if(!@image.components.nil?)\n @image.components.clear\n end\n #Sets Data Files Components\n if(!params[:component_parent_ids].nil?)\n for id in params[:component_parent_ids]\n @image.components.push(Component.find(id))\n end\n end\n\n #Products\n #Checks if the data file is attached to any products - if so clears them\n if(!@image.products.nil?)\n @image.products.clear\n end\n #Sets Data Files Products\n if(!params[:product_ids].nil?)\n for id in params[:product_ids]\n @image.products.push(Product.find(id))\n end\n end\n\n #Valuefields\n #Checks if the data file is attached to any valuefields - if so clears them\n if(!@image.valuefields.nil?)\n @image.valuefields.clear\n end\n #Sets Data Files Valuefields\n if(!params[:valuefield_ids].nil?)\n for id in params[:valuefield_ids]\n @image.valuefields.push(Valuefield.find(id))\n end\n end\n #creates an array of products\n @all_products = Product.all\n #creates an array of components\n @all_components = Component.all\n #creates an array of valuefields\n @all_valuefields = Valuefield.all\n respond_to do |format|\n if @image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_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!(**args)\n @image = args[:image] if args.key?(:image)\n @question = args[:question] if args.key?(:question)\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 @image_section = ImageSection.find(params[:id])\n ci = @image_section.combined_image\n\n respond_to do |format|\n if @image_section.update_attribute(:sketchpad_json, params[:drawn_json])\n format.html { redirect_to edit_image_section_path(ci.image_sections.sample), \n notice: 'Image section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to :back, notice: 'Imagen actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n puts y params['photo'].keys\n params['photo'].keys.each do |photo_id|\n photo = Photo.find(photo_id)\n photo.update_attributes(params['photo'][photo_id])\n end\n respond_to do |format|\n if true \n format.html { redirect_to photos_path, notice: 'Photos were successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"index\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to [@gallery,@image], notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @image }\n else\n format.html { render :edit }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @favorite_image.update(favorite_image_params)\n format.html { redirect_to @favorite_image, notice: 'Favorite image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @favorite_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # PATCH\n raise NotImplementedError\n end",
"def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n save_to_json\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @imagem = Imagem.find(params[:id])\n\n respond_to do |format|\n if @imagem.update_attributes(params[:imagem])\n format.html { redirect_to @imagem, notice: 'Imagem was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n respond_to do |format|\n if @image.update(image_params)\n format.html { redirect_to images_url, notice: 'Image was successfully updated.' }\n format.js {} \n else\n format.html { render action: 'edit' }\n format.js {} \n end\n end\n end",
"def update\n # If class to use json\n # if params[:image]\n # params[:image] = decode_base64\n # end\n respond_to do |format|\n if @post_img.update(post_img_params)\n format.html { redirect_to @post_img, notice: 'Post img was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_img }\n else\n format.html { render :edit }\n format.json { render json: @post_img.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_image.update(admin_image_params)\n format.html { redirect_to @admin_image, notice: 'Image was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_image }\n else\n format.html { render :edit }\n format.json { render json: @admin_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_image_features(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :PUT, nil)\n nil\n end",
"def update\n respond_to do |format|\n if @image_reference.update_attributes image_reference_params\n format.html { redirect_to @image_reference, notice: 'Image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image_upload = ImageUpload.find(params[:id])\n\n respond_to do |format|\n if @image_upload.update_attributes(params[:image_upload])\n format.html { redirect_to @image_upload, notice: 'Image upload was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image_upload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = Image.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:image])\n b = Bubo.from_heroku\n b.remove_image(@image.id.to_s)\n b.add_image(@image.id.to_s, @image.url)\n \n format.html { redirect_to(@image, :notice => 'Image was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @image.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_image\n # wish image can be updated only when then wish belongs to current user\n if @wish.user_id == current_user.id\n @wish.image.purge\n @wish.image.attach(wish_params[:image])\n render json: url_for(@wish.image)\n end\n end",
"def update\n @variant_image = VariantImage.find(params[:id])\n\n respond_to do |format|\n if @variant_image.update_attributes(params[:variant_image])\n format.html { redirect_to @variant_image, notice: 'Variant image was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @variant_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @client_image.update(client_image_params)\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n # format.json { render :show, status: :ok, location: @client_image }\n else\n format.html { redirect_to client_client_images_path(params[:client_id]), notice: 'Client image was successfully updated.' }\n format.json { render json: @client_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image_collection.update(image_collection_params)\n format.html { redirect_to @image_collection, notice: 'Image collection was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_collection }\n else\n format.html { render :edit }\n format.json { render json: @image_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @memberimage = Memberimage.find(params[:id])\n\n respond_to do |format|\n if @memberimage.update_attributes(params[:memberimage])\n format.html { redirect_to ideas_path, notice: 'Memberimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @memberimage.errors, status: :unprocessable_entity }\n end\n end\n end",
"def modify(name: nil, avatar: nil, channel_id: nil)\n RestClient.patch(@url, { name: name, avatar: avatarise(avatar), channel_id: channel_id }.compact.to_json, content_type: :json)\n end",
"def update\n respond_to do |format|\n if @markdown_image.update(markdown_image_params)\n format.html { redirect_to @markdown_image, notice: 'Markdown image was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @markdown_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @image = ImagePost.find(params[:id])\n\n respond_to do |format|\n if @image.update_attributes(params[:imagest_po])\n track_activity @image\n format.html { redirect_to @image, notice: 'Image post was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @objective_image.update(objective_image_params)\n format.html { redirect_to @objective_image, notice: 'Objective image was successfully updated.' }\n format.json { render :show, status: :ok, location: @objective_image }\n else\n format.html { render :edit }\n format.json { render json: @objective_image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @showcase = Showcase.find(params[:id])\n if params[:delete_image]\n \t@showcase.photo=nil\n end\n\n respond_to do |format|\n if @showcase.update_attributes(params[:showcase])\n flash[:notice] = 'Showcase was successfully updated.'\n format.html { redirect_to(@showcase) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @showcase.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @image =Image.find(params[:id])\n \t\t\n \t\t#si viene imagen en los parametros la subo\n\t\tif (params[:image][:filename])\n\t\t#traigo el nombre de la iamgen anterior al cambio\n\t\timageold = @image.filename\n\t\tprocess_image(tmp = params[:image][:filename].tempfile)\n\t\t\n\t\t#remuevo la anterior\n\t\tremove_image_file(imageold)\n\t\tend\n\t\t\n\t\t#si viene titulo nuevo lo actualizo\n\t\tif(params[:image][:title])\n\t\t@image.title = params[:image][:title]\n\t\tend\n respond_to do |format|\n if @image.save #@image.update_attributes(params[:image])\n format.html { redirect_to @image, notice: 'Image was successfully updated.'}\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @image.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put!\n request! :put\n end",
"def update\n @image.update(image_params)\n redirect_to '/images'\n end",
"def update\n @foto = Foto.find(params[:id])\n\n respond_to do |format|\n if @foto.update_attributes(params[:foto])\n format.html { redirect_to @foto, notice: 'Foto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @image_file.update(image_file_params)\n format.html { redirect_to @image_file, notice: 'Image file was successfully updated.' }\n format.json { render :show, status: :ok, location: @image_file }\n else\n format.html { render :edit }\n format.json { render json: @image_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @gallery = Gallery.find(params[:id])\n @gallery.update_attributes(params[:gallery])\n respond_with(@gallery, :status => :updated)\n end",
"def update\n @bgimage = Bgimage.find(params[:id])\n\n respond_to do |format|\n if @bgimage.update_attributes(params[:bgimage])\n format.html { redirect_to @bgimage, :notice => 'Bgimage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bgimage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n new_images = params[:images]||[]\n\n @intention = Intention.find_by_uuid(params[:id])\n @intention.image_urls = IntentionsHelper.strip_duplicate_images(new_images)\n @intention.save\n\n points = VISBD_INTENTION_IMAGE_POINTS*new_images.count\n track_event(current_action_item(Intention::COMPONENT_TYPE)||current_enrollment, Intention::VISUALIZED_EVENT, target:@intention, points:points)\n\n render nothing: true\n end",
"def 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 @pic.update(pic_params)\n format.html { redirect_to @pic, notice: 'Pic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @image.update_attributes(params[:image]) && @resource.update_attributes(params[:resource])\n format.html { redirect_to edit_course_path(@course), notice: 'image 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: @image.errors, status: :unprocessable_entity }\n format.js \n end\n end\n end"
] |
[
"0.6884882",
"0.68321043",
"0.6433385",
"0.6431917",
"0.6390499",
"0.6390499",
"0.6390499",
"0.6390499",
"0.63829255",
"0.638108",
"0.6376428",
"0.6303793",
"0.6292783",
"0.6292783",
"0.6292783",
"0.6292783",
"0.6292783",
"0.6292783",
"0.6292783",
"0.62687355",
"0.6242547",
"0.62266517",
"0.6213343",
"0.6182395",
"0.61806536",
"0.6173604",
"0.6168398",
"0.61632675",
"0.6129409",
"0.61272156",
"0.6121259",
"0.6116457",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61146414",
"0.61117464",
"0.6104039",
"0.6103084",
"0.60938364",
"0.6091091",
"0.6086452",
"0.6081858",
"0.6081836",
"0.60721326",
"0.60626733",
"0.60573417",
"0.60472596",
"0.6045125",
"0.6044565",
"0.60407585",
"0.60383093",
"0.60338485",
"0.6032783",
"0.60139066",
"0.60111004",
"0.60088426",
"0.59971184",
"0.5975481",
"0.59690535",
"0.5966836",
"0.5966374",
"0.5964943",
"0.5962407",
"0.5958399",
"0.5955149",
"0.5954962",
"0.595248",
"0.5950135",
"0.5949052",
"0.5948879",
"0.5945959",
"0.5943405",
"0.5935155",
"0.593467",
"0.5933355",
"0.5929408",
"0.5928133",
"0.5911916",
"0.5904578",
"0.5904372",
"0.59036094",
"0.58992887",
"0.58949894",
"0.58934355",
"0.58787674",
"0.5869015",
"0.5866789",
"0.5864113",
"0.58610207",
"0.58609384",
"0.5855686",
"0.5853593"
] |
0.67917943
|
2
|
DELETE /imagedemos/1 DELETE /imagedemos/1.json
|
def destroy
@imagedemo.destroy
respond_to do |format|
format.html { redirect_to imagedemos_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n render json: {status: \"success\"}, status: :ok\n end",
"def destroy\n #Finds selected image\n @image = Image.find(params[:id])\n #destroy image\n @image.destroy\n respond_to do |format|\n format.html { redirect_to '/admin' }\n format.json { head :ok }\n end\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @image_to_sample.destroy\n respond_to do |format|\n format.html { redirect_to image_to_samples_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n output = \"oneimage delete #{resource[:name]} \", self.class.login\n `#{output}`\n end",
"def destroy\n @img.destroy\n respond_to do |format|\n format.html { redirect_to imgs_url, notice: \"Img was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was deleted successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n ImagesIndex.delete params[:id]\n respond_to do |format|\n format.html { redirect_to(\"/images_indices\") }\n format.xml { head :ok }\n end\n end",
"def destroy\n Image.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n request(:delete, \"/computing/image/#{uuid}\")\n true\n end",
"def destroy\n @image_upload = ImageUpload.find(params[:id])\n @image_upload.destroy\n\n respond_to do |format|\n format.html { redirect_to image_uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @img = Img.find(params[:id])\n @img.destroy\n\n respond_to do |format|\n format.html { redirect_to(imgs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @featureimg.destroy\n respond_to do |format|\n format.html { redirect_to featureimgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n head :no_content\n end",
"def destroy\n @image_url = ImageUrl.find(params[:id])\n @image_url.destroy\n\n respond_to do |format|\n format.html { redirect_to image_urls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n file_url = @image.url\n @image.destroy\n\n File.delete(\"public/uploads/#{file_url}\")\n\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @setup_image.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n image = Image.find(params[:id])\n if image.user_id == current_user.id\n image.destroy\n render json:{}, status:201\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Imagen eliminada correctamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n File.delete(Rails.root.join(\"app\",'assets','images',@photo.path))\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = ImagePost.find(params[:id])\n @image.destroy\n track_activity @image\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy()\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to images_url, notice: \"Image was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post_img.destroy\n respond_to do |format|\n format.html { redirect_to post_imgs_url, notice: 'Post img was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estate_agent_image = EstateAgentsImage.find(params[:id])\n @estate_agent_image.destroy\n\n respond_to do |format|\n format.html { redirect_to estate_agent_image_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def delete_image(id)\n uri = URI.parse(\"http://\" + @location.host + \":\" + @location.port.to_s + \"/v2/images/\" + id)\n return delete_request(uri, @token)\n end",
"def destroy\n @story_image.destroy\n respond_to do |format|\n format.html { redirect_to story_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html do\n flash[:notice] = \"Image Successfully deleted\"\n redirect_to :back\n end\n format.json do\n render json: 'success'\n end\n end\n\n end",
"def destroy\n @image_path = ImagePath.find(params[:id])\n @image_path.destroy\n\n respond_to do |format|\n format.html { redirect_to(image_paths_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html {redirect_to admin_path, notice: 'Image was successfully destroyed.'}\n format.json {head :no_content}\n end\n end",
"def destroy\n @image = Gui::Image.find(params[:id])\n @image.destroy\n redirect_to gui_panels_path\n\n # respond_to do |format|\n # format.html { redirect_to gui_images_url }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @image_section = ImageSection.find(params[:id])\n @image_section.destroy\n\n respond_to do |format|\n format.html { redirect_to image_sections_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @banner_img = BannerImg.find(params[:id])\n @banner_img.destroy\n\n respond_to do |format|\n format.html { redirect_to banner_imgs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imagem = Imagem.find(params[:id])\n @imagem.destroy\n\n respond_to do |format|\n format.html { redirect_to imagems_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @dimage.destroy\n respond_to do |format|\n flash[:success] = t(:dimage_suc_de)\n format.html { redirect_to dimages_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @animal_image.destroy\n respond_to do |format|\n format.html\n format.js {}\n format.json { render json: { ok: true } }\n end\n end",
"def destroy\n @image_reference.destroy\n respond_to do |format|\n format.html { redirect_to image_references_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recipe_image.destroy\n respond_to do |format|\n format.html { redirect_to recipe_images_url, notice: 'Recipe image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experience_image.destroy\n respond_to do |format|\n format.html { redirect_to experience_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @objective_image.destroy\n respond_to do |format|\n format.html { redirect_to objective_images_url, notice: 'Objective image 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 @photo.destroy\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_file.destroy\n respond_to do |format|\n format.html { redirect_to image_files_url, notice: 'Image file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to photo.delete\"\n if !self.file.blank?\n Util.delete_image(self.file) #Delete the image file from the image server\n end\n reqUrl = \"/api/photo/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password'])#Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code}\", \"#{rest_response.message}\" #Return error\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n redirect_to console_images_path\n end",
"def destroy\n @image.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @column_image.destroy\n respond_to do |format|\n format.html { redirect_to column_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image_gallery = ImageGallery.find(params[:id])\n @image_gallery.destroy\n\n respond_to do |format|\n format.html { redirect_to image_galleries_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @markdown_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_markdown_images_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @avatar.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_image.destroy\n respond_to do |format|\n format.html { redirect_to admin_images_url, notice: 'Image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end",
"def destroy\n @postimage.destroy\n respond_to do |format|\n format.html { redirect_to postimages_url, notice: 'Postimage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_images_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n checkaccountobject(\"images\",@image)\n cloud = Oecloud.new(:zone => @image.zone, :image => @image)\n if cloud.deregisterimage\n @image.destroy\n end\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end",
"def destroy\n ApiAction.new.destroy_image(@logo.uuid_image)\n @logo.destroy\n respond_to do |format|\n format.html { redirect_to campaign_path(@logo.campaign), notice: 'Logo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imagepost.destroy\n respond_to do |format|\n format.html { redirect_to imageposts_url, notice: 'Imagepost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n @post_pic.destroy\n respond_to do |format|\n format.html { redirect_to post_pics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def image_destroy\n result = RestaurantManage.image_destroy(@restaurant, params[:pic_id])\n get_restaurant()\n render json: result\n end"
] |
[
"0.7461737",
"0.74285847",
"0.7316272",
"0.7244463",
"0.72352445",
"0.7227089",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72268707",
"0.72259176",
"0.72172105",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7168657",
"0.7134994",
"0.7126288",
"0.71253115",
"0.7089287",
"0.708513",
"0.70816743",
"0.7077605",
"0.7072388",
"0.7064598",
"0.70609385",
"0.7058167",
"0.7050819",
"0.7045443",
"0.70448685",
"0.70336914",
"0.7012482",
"0.70096326",
"0.70078146",
"0.70077276",
"0.7001082",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.69990116",
"0.6998604",
"0.6998423",
"0.6996877",
"0.6991361",
"0.6989465",
"0.6979555",
"0.6978683",
"0.6974477",
"0.69681716",
"0.69657576",
"0.69646776",
"0.69241",
"0.6918391",
"0.6915157",
"0.69126314",
"0.69125926",
"0.6908298",
"0.6907644",
"0.6901421",
"0.68964994",
"0.68944854",
"0.6892971",
"0.68915266",
"0.6877879",
"0.68777364",
"0.68756366",
"0.6874907",
"0.6874256",
"0.6857962",
"0.6857751",
"0.6850781",
"0.68499786",
"0.68499786",
"0.68499786",
"0.6843006",
"0.6840073",
"0.68329436",
"0.68311703",
"0.683115",
"0.6824019",
"0.6822004",
"0.68178064",
"0.6813531",
"0.68128294",
"0.680955",
"0.68069434",
"0.68069184"
] |
0.77337545
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_imagedemo
@imagedemo = Imagedemo.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 imagedemo_params
params.require(:imagedemo).permit(:fname, :lname, :image)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Finds worksheet by its name or numerical index
|
def [](ind)
case ind
when Integer then worksheets[ind]
when String then worksheets.find { |ws| ws.sheet_name == ind }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def worksheet idx\n case idx\n when Integer\n @worksheets[idx]\n when String\n @worksheets.find do |sheet| sheet.name == idx end\n end\n end",
"def worksheet_by_name(sheetname = nil)\n sheets.select { |s| s.name == sheetname }.first\n end",
"def worksheet( index )\n if @workbook\n x = index.is_a?(String) ? @workbook.getSheetIndex(index.to_java(java.lang.String)) : index\n return @workbook.getSheetAt(x)\n end\n nil\n end",
"def sheet_by_name(name)\n encoded_name = Axlsx.coder.encode(name)\n @worksheets.find { |sheet| sheet.name == encoded_name }\n end",
"def sheet_no(name)\n return name - 1 if name.is_a?(Fixnum)\n worksheets.each_with_index do |worksheet, index|\n return index if name == normalize_string(worksheet.name)\n end\n raise StandardError, \"sheet '#{name}' not found\"\n end",
"def find_row_of_title(xls, name)\n xls.each do |xls|\n xls.each_with_index do |x, index|\n if x.include?(name)\n return index\n end\n end\n end\nend",
"def sheets_by_name(name)\n @sheets.select { |s| s.name == name }\n end",
"def getSheet\n case ftype\n when FTYPE_SHEET\n return Sheet.find_by_id(type_index)\n else # \n return nil\n end\n end",
"def worksheet(name)\n Worksheet.new(@wb.getWorksheet(name))\n end",
"def worksheet_id(sheet_name)\n @spreadsheet.worksheets.tap { |sheets|\n @logger.debug(\"==== Worksheets ====\")\n @logger.debug([' [Sheet Name]', '[Sheet ID]'].join(\" \"))\n sheets.each { |x| @logger.debug(x.join(\" \")) }\n }.each { |sheet|\n return sheet[1] if sheet[0] == sheet_name\n }\n end",
"def spreadsheet_by_title(title)\n return spreadsheets(\"q\" => [\"title = ?\", title], \"maxResults\" => 1)[0]\n end",
"def find_collection_by_title(val)\n val_pattern = /#{val.to_s.downcase.gsub(/\\s/, '')}/\n worksheet = self.spreadsheet.worksheets.find { |w| w.title.downcase.gsub(/\\s/, '') =~ val_pattern }\n raise CollectionNotFound, \"No worksheet found '#{val}'! Please try again.\" unless worksheet\n Collection.new(self, worksheet)\n end",
"def index\n @worksheet.index\n end",
"def sheet?(wb,wsname)\n\n result=false\n return result if (!wb.is_a?(WIN32OLE))\n\n if (wsname.is_a?(String))\n result=false\n wb.worksheets().each { |ws| break if (result=(ws.name==wsname)) }\n elsif (wsname.is_a?(Integer))\n nosh = wb.worksheets().count\n result = ((wsname>=1) and (wsname<=nosh) )\n end\n return result\nend",
"def sheet(i = nil)\n @current_sheet = i if i\n @sheet = @book.getSheetAt(@current_sheet)\n end",
"def index\n worksheet.rows.index(self)\n end",
"def [](cell_def)\n sheet_name = cell_def.split('!')[0] if cell_def.include?('!')\n worksheet = worksheets.find { |s| s.name == sheet_name }\n raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)\n\n worksheet[cell_def.gsub(/.+!/, \"\")]\n end",
"def openSheet(sheet_key, page=0) \n\t\tws = @session.spreadsheet_by_key(sheet_key).worksheets[page]\n\tend",
"def index\n @worksheets = Worksheet.all\n end",
"def find_resource_identifier(sheet, name)\n\t\t\ti = 0\n\t\t\theader = XlsReader.header(sheet)\n\t\t\theader.each do |p|\n\t\t\t\tif p.to_s.upcase.eql? name\n\t\t\t\t\treturn i\n\t\t\t\telse\n\t\t\t\t\ti = i + 1\n\t\t\t\tend\n\t\t\tend\n\t\t\t-1\n\t\tend",
"def set_worksheet\n @worksheet = Worksheet.find(params[:id])\n end",
"def delete_worksheet worksheet_index\n @worksheets.delete_at worksheet_index\n end",
"def worksheet_name\n 'default'\n end",
"def index_by_header( header )\n sheet.header_rows > 0 or fail NoMethodError, 'No header rows present'\n col_index( colref_by_header( header ) )\n end",
"def search(exercise_name)\n for i in 0..@exercises.size-1 do\n if @exercises[i].name == exercise_name\n return i\n end\n end\n\n #Fail to find, returns -1\n return -1\n end",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def add_worksheet(name = nil)\n if name.nil? then\n n = 0\n\n begin\n name = SHEET_NAME_TEMPLATE % (n += 1)\n end until self[name].nil?\n end\n\n new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)\n worksheets << new_worksheet\n new_worksheet\n end",
"def worksheets\n @worksheets ||= (1..number_of_worksheets).collect { |n| Nokogiri::XML(zipfile.read(\"xl/worksheets/sheet#{n}.xml\")) }\n end",
"def sheets( ref=nil )\n if ref.nil?\n return to_enum (:each) unless block_given?\n each { |s| yield s }\n else\n case ref\n when Fixnum ; @sheets[ ref - 1 ]\n when String ; @sheets.find { |s| s.name =~ /^#{ ref }$/i }\n when Regexp ; @sheets.find { |s| s.name =~ ref }\n end\n end\n end",
"def row_index\n worksheet.rows.index(self)\n end",
"def wsref(fnarg_h)\n\n wb=fnarg_h[\"wb\"]\n cflag=fnarg_h[\"cflag\"] || false\n wsname=fnarg_h[\"wsname\"] || 1\n\n ws=nil\n if (!wb.is_a?(WIN32OLE))\n Logger.msg(\"Err\", \"wsref: Workbook reference is nil ....\")\n return ws\n end\n\n if ( (!wsname.is_a?(String)) and (!wsname.is_a?(Integer)))\n Logger.msg(\"Err\", \"wsref: Worksheet name neither string nor integer: \", [wb.name, wsname])\n return ws\n end\n\n if (sheet?(wb,wsname))\n ws = wb.worksheets(wsname)\n elsif(cflag)\n wb.worksheets.add\n (wsname.is_a?(String)) ? wb.worksheets(1).name = wsname : wsname=1\n wb.save()\n ws=wb.worksheets(wsname)\n else\n Logger.msg(\"Err\",\"get_wsref: Worksheet is not exist \", [wb, wsname])\n end\n return ws\nend",
"def worksheet\n @session ||= GoogleDrive::Session.from_service_account_key(\"client_secret.json\")\n @spreadsheet ||= @session.spreadsheet_by_title(\"Mentormonth\")\n @worksheet ||= @spreadsheet.worksheets.first\nend",
"def set_first_sheet\n hidden = 0 # Active worksheet can't be hidden.\n firstsheet = index\n end",
"def worksheet\n return @worksheet\n end",
"def worksheet\n return @worksheet\n end",
"def find_column_number_by_name_in_sheet(ws,col_name)\n across = 1\n down = 1\n until ws[down,across] == col_name || down == ws.num_rows\n if(across == 10 ) # ws.num_cols) # max columns in sheet\n across = 1 # reset column index to 1\n down = down + 1 # increment row count\n else\n across = across + 1 # check next column\n end\n end\n if down == ws.num_rows\n raise \"Cannot Find Column #{column_name} in #{ws}\"\n end\n across # i.e. return the column index / failure not an option!\n end",
"def worksheet=(value)\n @worksheet = value\n end",
"def worksheet=(value)\n @worksheet = value\n end",
"def show\n @worksheet = Worksheet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @worksheet }\n end\n end",
"def [] index_or_string\n if index_or_string.is_a? String\n match = index_or_string.match(/([A-Z]+)([0-9]*)/i)\n col_index = Workbook::Column.alpha_index_to_number_index(match[1])\n row_index = match[2].to_i - 1\n self[row_index][col_index]\n elsif index_or_string.is_a? Range\n collection = to_a[index_or_string].collect { |a| a.clone }\n Workbook::Table.new collection\n elsif index_or_string.is_a? Integer\n to_a[index_or_string]\n end\n end",
"def find_playlist_by_name name\n @playlists.each do |playlist|\n return playlist.index if name == playlist.name\n end\n end",
"def sheets(*args)\n if args.empty?\n @worksheets\n else\n args.collect { |i| @worksheets[i] }\n end\n end",
"def readsheet(i,j,k)\n sheetloc='C:\\Ruby23\\bin\\rubyselenium_poc\\Amazon_TestData\\TestData.xls'\ndoc = Spreadsheet.open(sheetloc)\nsheet = doc.worksheet(i) # list number, first list is 0 and so on...\nval = sheet[j,k] # read particular cell from list 0, r for row, c for column \nreturn val\nend",
"def find(k)\n @cells[k]\n end",
"def add_worksheet(name = '')\n name = check_sheetname(name)\n worksheet = Worksheet.new(self, @worksheets.size, name)\n @worksheets << worksheet\n worksheet\n end",
"def sheets\n return_sheets = []\n #TODO: @workbook_doc.find(\"//*[local-name()='sheet']\").each do |sheet|\n @workbook_doc.xpath(\"//*[local-name()='sheet']\").each do |sheet|\n #TODO: return_sheets << sheet.attributes.to_h['name']\n return_sheets << sheet['name']\n end\n return_sheets\n end",
"def get_menu_index(menu, name)\n menu.find_index{|item| item[:title] == name }\n end",
"def insert_worksheet(index = 0, options = {})\n worksheet = Worksheet.new(self, options)\n @worksheets.delete_at(@worksheets.size - 1)\n @worksheets.insert(index, worksheet)\n yield worksheet if block_given?\n worksheet\n end",
"def find_index(params = {})\n name = if params.one?\n params.keys.first.to_s\n else\n params.keys.join('_and_')\n end\n index = model[association.name]['index'][name]\n\n return if index.blank? && Embedded.config.scan_tables\n raise NoSolutionsError, name if index.blank?\n\n index\n end",
"def set_first_sheet\n @hidden = 0 # Active worksheet can't be hidden.\n set_firstsheet(@index)\n end",
"def index\n @sheet.workbook.pivot_tables.index(self)\n end",
"def shard( name )\n definitions_by_name[ name.to_sym ]\n end",
"def add_worksheet(name)\n Worksheet.new(@wb.addWorksheet(name))\n end",
"def find(str)\n index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}\n move_cursor index if index\n end",
"def find_index_by_path(*path)\n if item = find_item_by_path(*path)\n item.index\n end\n end",
"def find(name); end",
"def sheets\n worksheets.collect {|worksheet| normalize_string(worksheet.name)}\n end",
"def index( index_name, ensure_exists = false )\n \n index_instance = nil\n \n if index_name.nil?\n raise ::ArgumentError, 'Index name required but received nil.'\n end\n \n unless index_instance = indexes[ index_name ]\n if ensure_exists\n raise ::ArgumentError, 'No index found by name ' << index_name.to_s + ' for ' << to_s + '.'\n end\n end\n \n return indexes[ index_name ]\n\n end",
"def find_index_by_path(*path)\n current = id_to_module.last\n if path.first == current.name\n path.shift\n end\n\n path.each do |name|\n current = id_to_module.find do |info|\n info.name == name && info.parent == current\n end\n return if !current\n end\n create_index(current.row, 0, current.id)\n end",
"def index\n @model_workout_sheets = ModelWorkoutSheet.all\n end",
"def find_first_row_with_content(cells_content)\n validate_workbook\n index = nil\n\n @sheet_data.each_with_index do |row, index|\n cells_content = cells_content.map { |header| header.to_s.downcase.strip }\n original_cells_content = row.map { |cell| cell.nil? ? '' : cell.value.to_s.downcase.strip }\n if (cells_content & original_cells_content).size == cells_content.size\n return index\n end\n end\n return nil\n end",
"def index\n @spreadsheets = Spreadsheet.all\n end",
"def sheets\r\n ['default']\r\n end",
"def get_spreadsheet(session, excel)\n\t\t#on recupere le fichier de notre drive\n\t\tfile = session.spreadsheet_by_title(excel)\n\n\t\t#je me positionne dans le 1er onglet de mon fichier spreadsheet drive (excel drive)\n\t\treturn onglet1 = file.worksheets[0]\n\tend",
"def open_spreadsheet sheet_name = ''\n extension = File.extname(@filepath.split(\"/\").last)\n @spreadsheet = Roo::Spreadsheet.open(@filepath, extension: extension)\n @spreadsheet.default_sheet = @spreadsheet.sheets.include?(sheet_name) ? sheet_name : @spreadsheet.sheets.first\n rescue => e\n add_error message: e.message, backtrace: e.backtrace, row_index: nil, data: {}\n end",
"def data_at(sheet_index, record_index, cell_index)\n @sheets[sheet_index].records[record_index].cells[cell_index]\n end",
"def shard_index(n)\n orig_n = n\n n = n.to_i if n.is_a?(GenericNumeric)\n if n.is_a?(Numeric) || n.to_s =~ /^[+-]\\d+$/\n n = n.to_i if n.is_a?(String)\n n += shard_count if n<0\n stop \"Frozen file does not contain shard number #{orig_n}\" if n<0 || n>shard_count\n else\n name = n.to_s.sub(/^\\\\/,'') # Remove leading '\\\\', if any\n raise \"!Missing shard index or name\" if n.to_s == ''\n n = _shard_index(name)\n stop \"!Frozen file does not contain a shard named #{name.inspect}\" unless n\n end\n n\n end",
"def activate_sheet(term)\n\n if @workbook\n x = term.is_a?(String) ? @workbook.getSheetIndex(term.to_java(java.lang.String)) : term\n @sheet = worksheet(x)\n\n if @sheet\n @current_sheet_index = x\n @workbook.setActiveSheet(@current_sheet_index)\n @sheet = @workbook.getSheetAt(@current_sheet_index)\n @sheet.setActive(true)\n end\n end\n @sheet\n end",
"def find(index_key)\n index[index_key]\n end",
"def get_spreadsheet_key_by_title(spreadsheet_name)\n spreadsheets_uri = \"http://spreadsheets.google.com/feeds/spreadsheets/private/full?title=#{spreadsheet_name}&title-exact=true\"\n my_spreadsheets = get_feed(spreadsheets_uri)\n \n doc = create_datastructure_from_xml(my_spreadsheets.body)\n \n return doc[\"entry\"][0][\"id\"][0][/full\\/(.*)/, 1]\n end",
"def snames(wb)\n return nil if (!wb.is_a?(WIN32OLE))\n result_a = Array.new\n wb.worksheets().each { |ws| result_a << ws.name }\n return result_a\nend",
"def sheets\n [\"default\"]\n end",
"def create_worksheet( options = {} )\n sheet_name = options[:name]\n\n @workbook = HSSFWorkbook.new if @workbook.nil?\n\n if sheet_name\n\n name = sanitize_sheet_name( sheet_name )\n\n return create_sheet_and_set_styles( name ) if @workbook.getSheetIndex(name) < 0 # Check sheet doesn't already exist\n\n activate_sheet(name)\n\n else\n i = 0\n # there is no hard limit to no of sheets in Excel but at some point you will run out of memory!\n begin\n sheet_name = \"Worksheet#{i += 1}\"\n end while(@workbook.getSheetIndex(sheet_name) >= 0)\n\n return create_sheet_and_set_styles( sheet_name )\n end\n end",
"def find_bucket(name)\n buckets.find(\"#{name}\")\n end",
"def find_first_row_with_content(cells_content)\n validate_workbook\n\n sheet_data.rows.each_with_index { |row, index|\n next if row.nil?\n cells_content = cells_content.map { |header| header.to_s.strip.downcase }\n original_cells_content = row.cells.map { |cell| (cell && cell.value).to_s.strip.downcase }\n\n if (cells_content & original_cells_content).size == cells_content.size\n return index\n end\n }\n return nil\n end",
"def spreadsheet_by_key(key)\n file = file_by_id(key)\n if !file.is_a?(Spreadsheet)\n raise(GoogleDrive::Error, \"The file with the ID is not a spreadsheet: %s\" % key)\n end\n return file\n end",
"def search_index(games, search_term)\n search_index = games.find_index(search_term)\n search_index || \"Not Found\"\nend",
"def set_sheet\n @sheet = @campaign.sheets.find(params[:id])\n end",
"def getColumnIndex map,ws\r\n\t#range gives a two dimensional array\r\n\theadLines = ws.range(\"a1:o1\").value[0]\r\n\tmap.each do |key,val|\r\n\t\t#Check if the given column itself exists in the workbook (Ex : CSCRM)\r\n\t\tindex = headLines.index key\r\n\t\tif index\r\n\t\t\tmap[key] = index + 1\r\n\t\telse\r\n\t\t\tkey_alias = $columnNameMap[key]\r\n\t\t\tif key_alias\r\n\t\t\t\t#if the column name alias exists, check for the alias name exists in the worksheet\r\n\t\t\t\tindex = headLines.index key_alias\r\n\t\t\t\tmap[key] = index + 1 if index\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend",
"def find(year, julian_month, week_number=nil)\n if week_number.nil?\n MerchCalendar.weeks_for_month(year, julian_month)\n else\n MerchCalendar.weeks_for_month(year, julian_month)[week_number-1]\n end\n end",
"def set_sheet\n @sheet = Sheet.find(params[:id])\n end",
"def set_sheet\n @sheet = Sheet.find(params[:id])\n end",
"def set_sheet\n @sheet = Sheet.find(params[:id])\n end",
"def set_sheet\n @sheet = Sheet.find(params[:id])\n end",
"def select_test_suite(path)\n # search the directory and create the hash with index and spreadsheet names.\n fl_list = Dir.entries(path).delete_if{ |e| e=~ /^\\..*/|| e=~/^.*\\.rb/}\n while 1\n index = 0\n puts \"The following test suites are available for execution:\"\n fl_list.each do |i|\n print index+1,' - ',i.chomp(\".xls\"),\"\\n\"\n index = index+1\n end\n puts \"Please type the number of the desired suite followed by <Enter>\"\n input_str = gets.chomp.to_i\n if fl_list.include?(fl_list[input_str-1])\n break\n end\n end\n return fl_list[input_str-1] # return the spreadsheet name\nend",
"def sheet\n return @sheet if defined?(@sheet) && !@sheet.nil?\n self.sheet = Workbook::Sheet.new(self)\n end",
"def get_search(index, expression)\n chef_server.search.query(index, expression, rows: 1).rows.first\n end",
"def find_by(params = {})\n find_by_index(params) || where(params).first\n end",
"def find_index_by_model(model)\n if info = id_to_module.find { |info| info.this == model }\n return create_index(info.row, 0, info.id)\n end\n end",
"def require_index(name); end",
"def require_index(name); end",
"def worksheets(temporal)\n @worksheet_feed = temporal\n gdocs = Gdocs::WorkSheets.new({:token => @access_token.token, :refresh_token => @access_token.refresh_token, :token_expires_at => @access_token.expires_at})\n @worksheets ||= gdocs.list(@worksheet_feed)\n end",
"def worksheet_by_url(url)\n if !(url =~\n %r{^https?://spreadsheets.google.com/feeds/cells/(.*)/(.*)/private/full((\\?.*)?)$})\n raise(GoogleDrive::Error, \"URL is not a cell-based feed URL: #{url}\")\n end\n worksheet_feed_url = \"https://spreadsheets.google.com/feeds/worksheets/#{$1}/private/full/#{$2}#{$3}\"\n worksheet_feed_entry = request(:get, worksheet_feed_url)\n return Worksheet.new(self, nil, worksheet_feed_entry)\n end",
"def section_index(name)\n 0.upto(length - 1) do |index|\n return index if section_name(index) == name\n end\n nil\n end",
"def report_exist? name\n not @session.spreadsheets('title' => name).empty?\n end",
"def extract_worksheet_names\n extract ExtractWorksheetNames, 'workbook.xml', 'Worksheet names'\n extract ExtractRelationships, File.join('_rels','workbook.xml.rels'), 'Workbook relationships'\n rewrite RewriteWorksheetNames, 'Worksheet names', 'Workbook relationships', 'Worksheet names'\n rewrite MapSheetNamesToCNames, 'Worksheet names', 'Worksheet C names'\n end",
"def index\n @input_file = RubyXL::Parser.parse(open(params[:path_to_file])) \n @rankmi_sheet=@input_file[1]\n @input_sheet=@input_file[0]\n end"
] |
[
"0.8306105",
"0.7891127",
"0.75315154",
"0.7046851",
"0.69909555",
"0.6475498",
"0.6434711",
"0.6310057",
"0.63025266",
"0.6286639",
"0.6130749",
"0.61009437",
"0.6037043",
"0.58916146",
"0.5853227",
"0.5770568",
"0.5757218",
"0.5749886",
"0.5741633",
"0.5737839",
"0.57045406",
"0.55554074",
"0.54638225",
"0.54594463",
"0.545244",
"0.5438867",
"0.5438867",
"0.5438867",
"0.5419473",
"0.53811795",
"0.5378444",
"0.5344488",
"0.5328184",
"0.5275688",
"0.52692395",
"0.52692395",
"0.52545244",
"0.52337545",
"0.52337545",
"0.51798433",
"0.5175806",
"0.51706266",
"0.5152442",
"0.51497",
"0.5134648",
"0.50843877",
"0.5076132",
"0.50598395",
"0.5059403",
"0.50390506",
"0.50272363",
"0.5025033",
"0.49987793",
"0.49895927",
"0.4988876",
"0.4985685",
"0.49829817",
"0.49791762",
"0.49738312",
"0.49731925",
"0.49637294",
"0.49481586",
"0.49453345",
"0.49387342",
"0.49254858",
"0.49167663",
"0.49164653",
"0.49134046",
"0.4907953",
"0.49000502",
"0.48984054",
"0.4894453",
"0.48900455",
"0.48898682",
"0.48857522",
"0.48715153",
"0.485358",
"0.4847307",
"0.4844941",
"0.48436162",
"0.4814804",
"0.4789835",
"0.4789835",
"0.4789835",
"0.4789835",
"0.4783964",
"0.4775258",
"0.47748145",
"0.4767716",
"0.47628868",
"0.47520235",
"0.47520235",
"0.47501296",
"0.47417676",
"0.4734621",
"0.47222757",
"0.47193843",
"0.47166345"
] |
0.77482533
|
4
|
Create new simple worksheet and add it to the workbook worksheets
|
def add_worksheet(name = nil)
if name.nil? then
n = 0
begin
name = SHEET_NAME_TEMPLATE % (n += 1)
end until self[name].nil?
end
new_worksheet = Worksheet.new(:workbook => self, :sheet_name => name)
worksheets << new_worksheet
new_worksheet
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_worksheet opts = {}\n opts[:name] ||= client(\"Worksheet#{@worksheets.size.next}\", 'UTF-8')\n add_worksheet Worksheet.new(opts)\n end",
"def add_worksheet worksheet\n worksheet.workbook = self\n @worksheets.push worksheet\n worksheet\n end",
"def add_worksheet(name = '')\n name = check_sheetname(name)\n worksheet = Worksheet.new(self, @worksheets.size, name)\n @worksheets << worksheet\n worksheet\n end",
"def add_worksheet(name)\n Worksheet.new(@wb.addWorksheet(name))\n end",
"def create_worksheet( options = {} )\n sheet_name = options[:name]\n\n @workbook = HSSFWorkbook.new if @workbook.nil?\n\n if sheet_name\n\n name = sanitize_sheet_name( sheet_name )\n\n return create_sheet_and_set_styles( name ) if @workbook.getSheetIndex(name) < 0 # Check sheet doesn't already exist\n\n activate_sheet(name)\n\n else\n i = 0\n # there is no hard limit to no of sheets in Excel but at some point you will run out of memory!\n begin\n sheet_name = \"Worksheet#{i += 1}\"\n end while(@workbook.getSheetIndex(sheet_name) >= 0)\n\n return create_sheet_and_set_styles( sheet_name )\n end\n end",
"def worksheet\n @worksheet ||= workbook.add_worksheet(:name => name) do |sheet|\n sheet.add_row header.map(&:value)\n\n rows.each do |row|\n values = row.map(&:value)\n types = row.map(&:type)\n\n sheet.add_row values, :types => types\n end\n end\n end",
"def add_worksheet(options = {})\n worksheet = Worksheet.new(self, options)\n yield worksheet if block_given?\n worksheet\n end",
"def creat_xls(num)\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.add\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend",
"def create\n @worksheet = Worksheet.new(params[:worksheet])\n\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: 'Worksheet was successfully created.' }\n format.json { render json: @worksheet, status: :created, location: @worksheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_or_recreate_ws title\n\t\t\tif ws = worksheet_by_title(title) \n\t\t\t\tws.delete\n\t\t\tend\n\t\t\tadd_worksheet title\n\t\tend",
"def create_workbook\n @p.use_autowidth = true\n w = @p.workbook\n w.use_autowidth\n ws = ''\n w.styles do |s|\n blue_cell = s.add_style(\n :bg_color => \"B0C4DE\", \n :fg_color => \"00\", :sz => 11, \n :alignment =>{:horixontal => :center}, \n :font_name => 'Calibri', \n :border => Axlsx::STYLE_THIN_BORDER\n )\n #I want to modify the header so it prints better, but I don't want to modify the original array\n wh = @excel_row.map do |e| e.dup end\n w.add_worksheet(:name => \"Pacbio Read Stats\") do |sheet|\n sheet.add_row wh, :style => blue_cell\n ws = sheet\n end\n \n end\n ws\nend",
"def store_workbook # :nodoc:\n # Add a default worksheet if non have been added.\n add_worksheet if @worksheets.empty?\n\n # Ensure that at least one worksheet has been selected.\n @worksheets.visible_first.select if @activesheet == 0\n\n # Set the active sheet.\n @activesheet = @worksheets.visible_first.index if @activesheet == 0\n @worksheets[@activesheet].activate\n\n # Convert the SST strings data structure.\n prepare_sst_string_data\n\n # Prepare the worksheet VML elements such as comments and buttons.\n prepare_vml_objects\n # Set the defined names for the worksheets such as Print Titles.\n prepare_defined_names\n # Prepare the drawings, charts and images.\n prepare_drawings\n # Add cached data to charts.\n add_chart_data\n\n # Prepare the worksheet tables.\n prepare_tables\n\n # Prepare the metadata file links.\n prepare_metadata\n\n # Package the workbook.\n packager = Package::Packager.new(self)\n packager.set_package_dir(tempdir)\n packager.create_package\n\n # Free up the Packager object.\n packager = nil\n\n # Store the xlsx component files with the temp dir name removed.\n ZipFileUtils.zip(\"#{tempdir}\", filename)\n\n IO.copy_stream(filename, fileobj) if fileobj\n Writexlsx::Utility.delete_files(tempdir)\n end",
"def worksheet(name)\n Worksheet.new(@wb.getWorksheet(name))\n end",
"def insert_worksheet(index = 0, options = {})\n worksheet = Worksheet.new(self, options)\n @worksheets.delete_at(@worksheets.size - 1)\n @worksheets.insert(index, worksheet)\n yield worksheet if block_given?\n worksheet\n end",
"def <<(worksheet)\n if not worksheet.is_a? Worksheet\n raise ArgumentError, \"Need to have a Excel::Worksheet\"\n end\n root << worksheet\n end",
"def new_xls(s_s) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(1)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\n\nend",
"def setup_workbook(workbook)\n \n sheet = workbook.add_worksheet :name => 'lists', :state => :very_hidden\n alphabet = ('A'..'ZZZ').to_a\n\n # Modes \n modes = FtaModeType.active\n @modes_end_column = alphabet[modes.count]\n sheet.add_row make_row(modes)\n\n # Service Types \n service_types = FtaServiceType.active\n @service_types_end_column = alphabet[service_types.count]\n sheet.add_row make_row(service_types)\n\n # Guideway Elements\n fta_types = FtaTrackType.active.sorted + FtaGuidewayType.active + FtaPowerSignalType.active + [\"Total Track Miles Under Performance Restriction\"]\n @fta_types_end_column = alphabet[fta_types.count]\n sheet.add_row make_row(fta_types)\n\n # Allocation Unit(Row 4)\n allocation_units = ['TM', '%', 'Quantity']\n @allocation_units_end_column = alphabet[allocation_units.count]\n sheet.add_row make_row(allocation_units)\n end",
"def add( ref = false )\n case ref\n when false ; s = Sheet.new( 'Sheet' + ( @sheets.count + 1 ).to_s, self )\n when Sheet ; ( s = ref ).workbook = self\n when String ; s = Sheet.new( ref, self )\n else ; fail TypeError, \"Unsupported Type: #{ ref.class }\"\n end\n @sheets << s\n s\n end",
"def add_as_sheet(book:)\n\n sheet = book.create_worksheet\n\n sheet.name = \"#{name} #{date.strftime('%F')}\"\n row = sheet.row(1)\n row.push \"Event: \"\n row.push name + \" \" + date.strftime('%F')\n row = sheet.row(2)\n row.push \"Uttag datum:\"\n row.push DateTime.now.strftime('%FT%R')\n row = sheet.row(3)\n row.push \"Bokningar:\"\n row = sheet.row(4)\n row.push \"Id\", \"Biljetter\", \"Namn\", \"Bokades\", \"Epost\", \"Telefon\", \"Kontaktperson\", \"Betalat\", \"Meddelande\", \"Notering\", \"Rabatt\", \"Rabattmeddelande\", \"Paket\"\n bookings.each_with_index do |booking, index|\n row = sheet.row(5+index)\n row.push booking.id, booking.tickets, booking.name, booking.created_at.strftime('%FT%R'), booking.email, booking.phone_nr, booking.contact_person, booking.paid, booking.message, booking.memo, booking.discount, booking.discount_message, booking.order_rows_string\n end\n\n return book\n end",
"def create_coaches_worksheets(coaches, workbook)\n coaches.each do |coach_name|\n coach_worksheet = workbook.add_worksheet(\"#{Y_M_DATE}_#{coach_name}_relevé\")\n end\nend",
"def xl_new\n @xl_styles = {}\n xl = Axlsx::Package.new\n xl.use_shared_strings = true\n xl.workbook.styles do |s|\n s.fonts[0].sz = 9\n @xl_styles['Title'] = s.add_style(:b => true)\n @xl_styles['Comma'] = s.add_style(:format_code => '#,##0')\n @xl_styles['Right'] = s.add_style(:alignment => {:horizontal => :right})\n @xl_styles['Add'] = s.add_style :fg_color => '00A000'\n @xl_styles['Update'] = s.add_style :fg_color => '0000A0', :bg_color => 'F0F0FF'\n @xl_styles['Move'] = s.add_style :fg_color => '4040FF'\n @xl_styles['Delete'] = s.add_style :fg_color => 'FF0000', :strike => true\n @xl_styles['Matched'] = s.add_style :fg_coler => 'A0A0A0'\n end\n xl\n end",
"def create!(name:)\n @sheet = Sheet.new(name)\n\n @sheet.save\n end",
"def generate_excel_multi_worksheet(collections, options={})\n message = \"\"\n xls_file = Spreadsheet::Workbook.new\n begin\n collections.each do |key, values|\n sheet = xls_file.create_worksheet :name => key\n red = Spreadsheet::Format.new :color => 'black', :size => 10, :align => 'center', :pattern_fg_color => :red, :pattern => 1\n values.each_with_index do |err, index|\n err.each do |r|\n #next unless r.present?\n sheet.row(index).push r\n end\n end\n end\n rescue Exception => e\n message = e.message\n end\n blob = StringIO.new(\"\")\n #blob = message if !message.present?\n xls_file.write blob\n blob.string\n end",
"def create_new_sheet(date, new_spreadsheet_id)\n #make copy of template sheet to new spreadsheet\n new_sheet_id = copy_sheet(new_spreadsheet_id)\n \n #set the name of that sheet\n set_name_of_sheet(date.day.to_s, new_sheet_id, new_spreadsheet_id)\n \n #set the date on the sheet\n set_date_of_sheet(date, new_spreadsheet_id)\nend",
"def create\n @worksheet = Worksheet.new(worksheet_params)\n @worksheet.client.client_last_visit = Time.now\n @worksheet.client.client_rating = (Client.last.client_rating.to_i + 1)\n @worksheet.client.user_id = User.find_by_email(\"#{@current_user.email}\").id\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: 'Worksheet was successfully created.' }\n format.json { render :show, status: :created, location: @worksheet }\n else\n format.html { render :new }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def sheet\n return @sheet if defined?(@sheet) && !@sheet.nil?\n self.sheet = Workbook::Sheet.new(self)\n end",
"def add_buildings_worksheet(package, first_column_style)\n package.workbook.add_worksheet(name: 'Buildings information') do |sheet|\n add_header_row(sheet, ['Buildings information'])\n add_building_name_row(sheet, ['Building name'], :left)\n add_buildings_information(sheet)\n style_buildings_information_sheet(sheet, first_column_style)\n end\n end",
"def add_service_periods_worksheet(package, standard_column_style, units)\n package.workbook.add_worksheet(name: 'Service Periods') do |sheet|\n hint_style = sheet.styles.add_style sz: 12, border: { style: :thin, color: '00000000' }, alignment: { wrap_text: true, vertical: :center, horizontal: :left }, fg_color: '6E6E6E'\n hint_center_style = sheet.styles.add_style sz: 12, border: { style: :thin, color: '00000000' }, alignment: { vertical: :center, horizontal: :center }, fg_color: '6E6E6E'\n\n add_header_row(sheet, ['Service Reference', 'Service Name', 'Metric per Annum'])\n add_building_name_row(sheet, ['', '', ''], :center)\n add_service_periods(sheet, units)\n style_service_periods_matrix_sheet(sheet, standard_column_style, hint_style, hint_center_style) if sheet.rows.size > 1\n end\n end",
"def spreadsheet\n if contains_extractable_spreadsheet?\n workbook = parse_spreadsheet\n if content_blob.worksheets.empty?\n workbook.sheets.each_with_index do |sheet, sheet_number|\n content_blob.worksheets << Worksheet.create(sheet_number: sheet_number, last_row: sheet.last_row,\n last_column: sheet.last_col)\n end\n content_blob.save\n end\n workbook\n end\n end",
"def dup\n s = Sheet.new( name, workbook )\n d = data\n unless d.nil?\n d = d.dup\n s.load( d.all, header_rows )\n d.sheet = s\n end\n s\n end",
"def generate_excel(collections, heading, options={})\n message = \"\"\n xls_file = Spreadsheet::Workbook.new\n sheet = xls_file.create_worksheet :name => \"Sheet 1\"\n red = Spreadsheet::Format.new :color => 'black', :size => 10, :align => 'center', :pattern_fg_color => :red, :pattern => 1\n begin\n collections.each_with_index do |err, index|\n err.each do |r|\n #next unless r.present?\n sheet.row(index).push r\n end\n end\n rescue Exception => e\n message = e.message\n end\n blob = StringIO.new(\"\")\n #blob = message if !message.present?\n xls_file.write blob\n blob.string\n end",
"def set_worksheet\n @worksheet = Worksheet.find(params[:id])\n end",
"def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, :notice => 'Sheet was successfully created.' }\n format.json { render :json => @sheet, :status => :created, :location => @sheet }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sheet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def worksheet_name\n 'default'\n end",
"def create_excel(records, klass)\n records = records.as_json\n headers = records.first.keys\n size_arr = []\n headers.size.times { size_arr << 22 }\n xl = Axlsx::Package.new\n xl.workbook.add_worksheet do |sheet|\n sheet.add_row headers, b: true\n records.each do |record|\n sheet.add_row record.values\n end\n sheet.column_widths *size_arr\n end\n file_location = \"#{Rails.root}/public/export_#{klass}_#{Time.now.to_s}\"\n xl.serialize(file_location)\n file_location\n end",
"def create\n @sheet = Sheet.new(params[:sheet])\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully created.' }\n format.json { render json: @sheet, status: :created, location: @sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dossier = Dossier.new(dossier_params)\n @dossier.sheets.new(template: 'summary')\n respond_to do |format|\n if @dossier.save\n format.html { redirect_to @dossier, notice: 'Report was successfully created.' }\n format.json { render :show, status: :created, location: @dossier }\n else\n format.html { render :new }\n format.json { render json: @dossier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def excel_create\n raise ExcelError.new('Cannot create excel! An instance is already open') unless @excel.nil?\n\n @excel = WIN32OLE.new('Excel.Application', 'localhost')\n @excel.DisplayAlerts = false\n update_pid(excel_pid)\n end",
"def worksheet=(value)\n @worksheet = value\n end",
"def worksheet=(value)\n @worksheet = value\n end",
"def write_from_scratch workbook, io\n sanitize_worksheets workbook.worksheets\n collect_formats workbook\n sheets = worksheets workbook\n buffer1 = StringIO.new ''.dup\n # ● BOF Type = workbook globals (➜ 6.8)\n write_bof workbook, buffer1, :globals\n # ○ File Protection Block ➜ 4.19\n # ○ WRITEACCESS User name (BIFF3-BIFF8, ➜ 5.112)\n # ○ FILESHARING File sharing options (BIFF3-BIFF8, ➜ 5.44)\n # ○ CODEPAGE ➜ 6.17\n write_encoding workbook, buffer1\n # ○ DSF ➜ 6.32\n write_dsf workbook, buffer1\n # ○ TABID\n write_tabid workbook, buffer1\n # ○ FNGROUPCOUNT\n # ○ Workbook Protection Block ➜ 4.18\n # ○ WINDOWPROTECT Window settings: 1 = protected (➜ 5.111)\n # ○ PROTECT Cell contents: 1 = protected (➜ 5.82)\n write_protect workbook, buffer1\n # ○ OBJECTPROTECT Embedded objects: 1 = protected (➜ 5.72)\n # ○ PASSWORD Hash value of the password; 0 = No password (➜ 5.76)\n write_password workbook, buffer1\n # ○ BACKUP ➜ 5.5\n # ○ HIDEOBJ ➜ 5.56\n # ● WINDOW1 ➜ 5.109\n write_window1 workbook, buffer1\n # ○ DATEMODE ➜ 5.28\n write_datemode workbook, buffer1\n # ○ PRECISION ➜ 5.79\n write_precision workbook, buffer1\n # ○ REFRESHALL\n write_refreshall workbook, buffer1\n # ○ BOOKBOOL ➜ 5.9\n write_bookbool workbook, buffer1\n # ●● FONT ➜ 5.45\n write_fonts workbook, buffer1\n # ○○ FORMAT ➜ 5.49\n write_formats workbook, buffer1\n # ●● XF ➜ 5.115\n write_xfs workbook, buffer1\n # ●● STYLE ➜ 5.103\n write_styles workbook, buffer1\n # ○ PALETTE ➜ 5.74\n write_palette workbook, buffer1\n # ○ USESELFS ➜ 5.106\n buffer1.rewind\n # ●● BOUNDSHEET ➜ 5.95\n buffer2 = StringIO.new ''.dup\n # ○ COUNTRY ➜ 5.22\n # ○ Link Table ➜ 4.10.3\n # ○○ NAME ➜ 6.66\n # ○ Shared String Table ➜ 4.11\n # ● SST ➜ 5.100\n # ● EXTSST ➜ 5.42\n write_sst workbook, buffer2, buffer1.size\n # ● EOF ➜ 5.37\n write_eof workbook, buffer2\n buffer2.rewind\n # worksheet data can only be assembled after write_sst\n sheets.each do |worksheet| worksheet.write_from_scratch end\n Ole::Storage.open io do |ole|\n ole.file.open 'Workbook', 'w' do |writer|\n writer.write buffer1.read\n write_boundsheets workbook, writer, buffer1.size + buffer2.size\n writer.write buffer2.read\n sheets.each do |worksheet|\n writer.write worksheet.data\n end\n end\n end\n end",
"def create_spreadsheet\n @package = Axlsx::Package.new\n @workbook = @package.workbook\n\n selected_buildings = @report.user_buildings\n\n services_selected = selected_buildings.collect { |b| b.building_json['services'] }.flatten # s.collect { |s| s['code'].gsub('-', '.') }\n services_selected.uniq!\n\n @workbook.add_worksheet(name: 'Building Information') do |sheet|\n # sheet.add_row ['Buildings information']\n i = 0\n [['Buildings information', nil],\n ['Building Type', 'eg. General office - customer facing, non customer facing, call centre operations.'],\n ['Address', ''],\n [nil, nil], [nil, nil], [nil, nil],\n ['GIA', 'Gross Internal Area: Square Metre (GIA) per annum']].each do |label|\n vals = []\n vals << label[0] << label[1] << row(selected_buildings, i)\n vals.flatten!\n sheet.add_row vals\n i += 1\n end\n end\n\n # selected_services = services_selected.map { |s| s['code'].gsub('-', '.') }\n services = @report.list_of_services # @report.selected_services(selected_services)\n uom_values_for_selected_buildings = @report.uom_values(selected_buildings)\n\n uoms = CCS::FM::UnitsOfMeasurement.all.group_by(&:service_usage)\n uom2 = {}\n uoms.map { |u| u[0].each { |k| uom2[k] = u[1] } }\n\n @workbook.add_worksheet(name: 'Service Matrix') do |sheet|\n i = 1\n vals = ['Work Package', 'Service Reference', 'Service Name', 'Unit of Measure']\n selected_buildings.each do |building|\n vals << 'Building ' + i.to_s + ' - ' + building.building_json['name']\n i += 1\n end\n sheet.add_row vals\n\n work_package = ''\n services.sort_by { |s| [s.work_package_code, s.code[s.code.index('.') + 1..-1].to_i] }.each do |s|\n if work_package == s.work_package_code\n label = nil\n else\n label = 'Work Package ' + s.work_package_code + ' - ' + s.work_package.name\n end\n\n work_package = s.work_package_code\n\n vals = [label, s.code, s.name]\n\n vals_v = []\n vals_h = nil\n uom_labels_2d = []\n selected_buildings.each do |building|\n id = building.building_json['id']\n suv = uom_values_for_selected_buildings.select { |v| v['building_id'] == id && v['service_code'] == s.code }\n\n any_suv = uom_values_for_selected_buildings.select { |v| v['service_code'] == s.code }\n\n vals_h = []\n uom_labels = []\n if suv.empty?\n if uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n elsif s.work_package_code == 'A' || s.work_package_code == 'B'\n uom_labels << nil\n elsif s.work_package_code == 'M' || s.work_package_code == 'N'\n uom_labels << 'Percentage of Year 1 Deliverables Value (excluding Management and Corporate Overhead, and Profit) at call-off'\n elsif any_suv.empty?\n uom_labels << 'service (per annum)'\n end\n\n vals_h << nil\n else\n suv.each do |v|\n if v['spreadsheet_label']\n uom_labels << v['spreadsheet_label']\n elsif uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n end\n\n vals_h << v['uom_value']\n end\n end\n vals_v << vals_h\n uom_labels_2d << uom_labels\n rescue StandardError\n vals << '=NA()'\n end\n\n uom_labels_max = uom_labels_2d.max\n\n max_j = vals_v.map(&:length).max\n if max_j\n (0..max_j - 1).each do |j|\n vals << uom_labels_max[j]\n\n (0..vals_v.count - 1).each do |k|\n vals << vals_v[k][j]\n end\n sheet.add_row vals\n\n vals = [nil, s.code, s.name]\n end\n end\n # end\n work_package = s.work_package_code\n end\n end\n\n @workbook.add_worksheet(name: 'Procurement summary') do |sheet|\n date = sheet.styles.add_style(format_code: 'dd mmm yyyy', border: Axlsx::STYLE_THIN_BORDER)\n left_align = sheet.styles.add_style(alignment: { horizontal: :left })\n ccy = sheet.styles.add_style(format_code: '£#,##0')\n\n sheet.add_row ['CCS reference number & date/time of production of this document']\n sheet.add_row\n sheet.add_row ['1. Customer details']\n sheet.add_row ['Name']\n sheet.add_row ['Organisation']\n sheet.add_row ['Position']\n sheet.add_row ['Contact details']\n sheet.add_row\n sheet.add_row ['2. Contract requirements']\n sheet.add_row ['Initial Contract length', @report.contract_length_years, 'years'], style: [nil, nil, left_align]\n sheet.add_row ['Extensions']\n sheet.add_row\n sheet.add_row ['Tupe involvement', @report.tupe_flag]\n sheet.add_row\n sheet.add_row ['Contract start date', @report.start_date&.to_date], style: [nil, date]\n sheet.add_row\n sheet.add_row ['3. Price and sub-lot recommendation']\n sheet.add_row ['Assessed Value', @report.assessed_value], style: [nil, ccy]\n sheet.add_row ['Assessed value estimated accuracy'], style: [nil, ccy]\n sheet.add_row\n sheet.add_row ['Lot recommendation', @report.current_lot]\n sheet.add_row ['Direct award option']\n sheet.add_row\n # sheet.add_row ['4. Supplier Shortlist']\n label = '4. Supplier Shortlist'\n @report.selected_suppliers(@current_lot).each do |supplier|\n sheet.add_row [label, supplier.data['supplier_name']]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['5. Regions summary']\n label = '5. Regions summary'\n FacilitiesManagement::Region.all.select { |region| @data[:posted_locations].include? region.code }.each do |region|\n sheet.add_row [label, region.name]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['6 Services summary']\n # services = FacilitiesManagement::Service.where(code: @data['posted_services'])\n services = @report.list_of_services\n services.sort_by!(&:name)\n label = '6 Services summary'\n services.each do |s|\n sheet.add_row [label, s.name]\n label = nil\n end\n sheet.add_row\n end\n end",
"def setup_workbook(workbook)\n # nothing to do by default\n end",
"def create_xlsx(external_verify, verify, verified, not_complete, pre_title, extra_columns = [], value_lambdas = [])\n p = Axlsx::Package.new(author: 'Admin')\n wb = p.workbook\n add_wb(wb, external_verify, \"#{pre_title} Externally Verify\", extra_columns, value_lambdas)\n add_wb(wb, verify, \"#{pre_title} Verify\", extra_columns, value_lambdas)\n add_wb(wb, verified, \"#{pre_title} Verified\", extra_columns, value_lambdas)\n add_wb(wb, not_complete, \"#{pre_title} Not Complete\", extra_columns, value_lambdas)\n p\n end",
"def to_sample_sheet lanes = [1,2,3,4,5,6,7,8]\n view = SampleSheetView.new(self, lanes)\n view.write\n end",
"def new\n @worksheet = Worksheet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @worksheet }\n end\n end",
"def create_spreadsheet(title = \"Untitled\")\n file = self.drive.files.insert.request_schema.new({\n \"title\" => title,\n \"mimeType\" => \"application/vnd.google-apps.spreadsheet\",\n })\n api_result = execute!(\n :api_method => self.drive.files.insert,\n :body_object => file)\n return wrap_api_file(api_result.data)\n end",
"def addWorksheetFromActiveRecord(sheetname, objectType, objects)\r\n\t \r\n\t objects = [objects] unless objects.class == Array\r\n\t \r\n\t item = [sheetname.to_s, objectType.to_s, objects]\r\n\t @worksheets += [item]\r\n\t end",
"def test_cloning_roundtrip\n b = Workbook::Book.open File.join(File.dirname(__FILE__), \"artifacts/book_with_tabs_and_colours.xlsx\")\n b.sheet.table << b.sheet.table[2]\n assert_equal(90588, b.sheet.table[5][:b].value)\n # assert_equal(\"#FFFF00\",b.sheet.table[2][:c].format[:background_color])\n # assert_equal(\"#FFFF00\",b.sheet.table[5][:c].format[:background_color])\n filename = b.write_to_xls\n b = Workbook::Book.open filename\n assert_equal(90588, b.sheet.table[5][:b].value)\n # assert_equal(\"#FF00FF\",b.sheet.table[5][:c].format[:background_color])\n end",
"def spreadsheet\n if is_extractable_spreadsheet?\n workbook = parse_spreadsheet_xml(spreadsheet_xml)\n if content_blob.worksheets.empty?\n workbook.sheets.each_with_index do |sheet, sheet_number|\n content_blob.worksheets << Worksheet.create(:sheet_number => sheet_number, :last_row => sheet.last_row, :last_column => sheet.last_col)\n end\n content_blob.save\n end\n return workbook\n else\n return nil\n end\n end",
"def add_new_record(h, ws)\n row_array = []\n @excel_row.each do |a|\n row_array.push(h[a])\n end\n ws.add_row row_array\nend",
"def create\n respond_to do |format|\n if @label_sheet.save\n format.html { redirect_to([:admin, @label_sheet], notice: 'Label Sheet was successfully created.') }\n format.xml { render xml: @label_sheet, status: :created, location: @label_sheet }\n website.add_log(user: current_user, action: \"Created Label Sheet: #{@label_sheet.name}\")\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @label_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_workspace_and_options_tabs()\n new_notebook = Wx::Notebook.new(self)\n\n @ws_tab = Wx::Panel.new(new_notebook) # Add workspace tab\n @ws_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @ws_tab.set_sizer(@ws_mvsizer)\n\n @options_tab = Wx::Panel.new(new_notebook) # Add options tab\n @options_mvsizer = Wx::BoxSizer.new(Wx::VERTICAL)\n @options_tab.set_sizer(@options_mvsizer)\n\n\n new_notebook.add_page(@ws_tab , \"Workspace\")\n new_notebook.add_page(@options_tab , \"Options\")\n evt_notebook_page_changing(new_notebook.get_id()) {|event| on_changing_page(event) }\n end",
"def create\n @spreadsheet = Spreadsheet.new(spreadsheet_params)\n respond_to do |format|\n if @spreadsheet.save\n format.html { redirect_to @spreadsheet, notice: 'Spreadsheet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @spreadsheet }\n else\n format.html { render action: 'new' }\n format.json { render json: @spreadsheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_volume_worksheet(package, standard_column_style)\n package.workbook.add_worksheet(name: 'Volume') do |sheet|\n add_header_row(sheet, ['Service Reference', 'Service Name', 'Metric per annum'])\n add_building_name_row(sheet, ['', '', ''], :center)\n number_volume_services = add_volumes_information_da(sheet)\n style_volume_sheet(sheet, standard_column_style, number_volume_services)\n end\n end",
"def generate_excel(technical=false)\n @package = Axlsx::Package.new\n wb = @package.workbook\n @blue_cell = wb.styles.add_style :fg_color => \"0000FF\", :sz => 12, :alignment => { :horizontal=> :center }\n @wrap_text= wb.styles.add_style({:alignment => {:horizontal => :left, :vertical => :top, :wrap_text => true}} )\n add_canonical_documents(wb, technical)\n\n end",
"def create\n @sheet0 = Sheet0.new(params[:sheet0])\n\n respond_to do |format|\n if @sheet0.save\n format.html { redirect_to @sheet0, notice: 'Sheet0 was successfully created.' }\n format.json { render json: @sheet0, status: :created, location: @sheet0 }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sheet0.errors, status: :unprocessable_entity }\n end\n end\n end",
"def write_worksheet_data(worksheet, header)\n worksheet.write('A1', 'Region', header)\n worksheet.write('B1', 'Sales Rep', header)\n worksheet.write('C1', 'Product', header)\n worksheet.write('D1', 'Units', header)\n\n data = [\n ['East', 'Tom', 'Apple', 6380],\n ['West', 'Fred', 'Grape', 5619],\n ['North', 'Amy', 'Pear', 4565],\n ['South', 'Sal', 'Banana', 5323],\n ['East', 'Fritz', 'Apple', 4394],\n ['West', 'Sravan', 'Grape', 7195],\n ['North', 'Xi', 'Pear', 5231],\n ['South', 'Hector', 'Banana', 2427],\n ['East', 'Tom', 'Banana', 4213],\n ['West', 'Fred', 'Pear', 3239],\n ['North', 'Amy', 'Grape', 6520],\n ['South', 'Sal', 'Apple', 1310],\n ['East', 'Fritz', 'Banana', 6274],\n ['West', 'Sravan', 'Pear', 4894],\n ['North', 'Xi', 'Grape', 7580],\n ['South', 'Hector', 'Apple', 9814]\n ]\n\n row_num = 1\n data.each do |row_data|\n worksheet.write_row(row_num, 0, row_data)\n row_num += 1\n end\n end",
"def create\n @model_workout_sheet = ModelWorkoutSheet.new(model_workout_sheet_params)\n\n respond_to do |format|\n if @model_workout_sheet.save\n format.html { redirect_to @model_workout_sheet, notice: 'Model workout sheet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @model_workout_sheet }\n else\n format.html { render action: 'new' }\n format.json { render json: @model_workout_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def worksheets\n @worksheets ||= (1..number_of_worksheets).collect { |n| Nokogiri::XML(zipfile.read(\"xl/worksheets/sheet#{n}.xml\")) }\n end",
"def create_new_sheet(title,description, keys, level)\n\tacai = Keyword.find_by_name(\"ACAI\") #default skill keywords required\n\tsheet = Sheet.new\n\tsheet.title = title.split(\":\").last.humanize \n\tsheet.id_dokuwiki = title\n\tif(level.to_s.match(/[0-3]/))\n\t\tsheet.level = level\n\telse \n\t\tsheet.level = 1\t#default level\n\tend\t \n\tsheet.keywords << keys\n\tsheet.description = description \n\tif !sheet.valid?\n\t\tsheet.keywords << acai\n\tend\t\n\tsheet.save\nend",
"def export_my_absence\n workbook = Spreadsheet::Workbook.new\n data_sheet = workbook.create_worksheet :name => \"absensi harian #{@current_person.full_name}\"\n format = Spreadsheet::Format.new :weight => :bold\n data_sheet.row(0).default_format = format\n data_sheet.row(0).replace ['Jam Masuk','Jam Keluar','Lama Kerja']\n data_sheet = set_data_export_my_absence(data_sheet)\n spreadsheet = StringIO.new\n workbook.write spreadsheet\n send_data spreadsheet.string, :filename => \"absent_harian_#{@current_person.full_name}.xls\", :type => \"application/vnd.ms-excel\"\n end",
"def create_cells\n sheet.row_ids.each {|i| cell_for_row(i) }\n end",
"def create\n @worksheet = Worksheet.find(params[:worksheet_id]) # Loads the worksheet the comment belongs to\n @worksheet.comments.create(comment_params.merge(user: current_user)) # add comment to the Db\n redirect_to worksheet_path(@worksheet) # send the user back to the worksheet details page\n end",
"def build\r\n\t \tbuffer = \"\"\r\n\t\t xml = Builder::XmlMarkup.new(buffer)\r\n\t\t xml.instruct! :xml, :version=>\"1.0\", :encoding=>\"UTF-8\" \r\n\t\t xml.Workbook({\r\n\t\t 'xmlns' => \"urn:schemas-microsoft-com:office:spreadsheet\", \r\n\t\t 'xmlns:o' => \"urn:schemas-microsoft-com:office:office\",\r\n\t\t 'xmlns:x' => \"urn:schemas-microsoft-com:office:excel\", \r\n\t\t 'xmlns:html' => \"http://www.w3.org/TR/REC-html40\",\r\n\t\t 'xmlns:ss' => \"urn:schemas-microsoft-com:office:spreadsheet\" \r\n\t\t }) do\r\n\t \r\n\t\t\t xml.Styles do\r\n\t\t\t xml.Style 'ss:ID' => 'Default', 'ss:Name' => 'Normal' do\r\n\t\t\t xml.Alignment 'ss:Vertical' => 'Bottom'\r\n\t\t\t xml.Borders\r\n\t\t\t xml.Font 'ss:FontName' => 'Arial'\r\n\t\t\t xml.Interior\r\n\t\t\t xml.NumberFormat\r\n\t\t\t xml.Protection\r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'DefaultBold' do\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'Date' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => 'mm/dd/yy'\r\n\t\t\t end\r\n\r\n\t\t\t xml.Style 'ss:ID' => 'DateBold' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => 'mm/dd/yy'\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'Currency' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => '\"$\"#,##0.00'\r\n\t\t\t end\t\t\t \r\n\r\n\t\t\t xml.Style 'ss:ID' => 'CurrencyBold' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => '\"$\"#,##0.00'\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t\t end\t\t\t \r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t for object in @worksheets\r\n\t\t \t\t# use the << operator to prevent the < > and & characters from being converted.\r\n\t\t \t\t# this will concat them together.\r\n\t\t \t\tif object[1] =='array'\r\n\t\t \t\t xml << worksheetFromArray(object[0], object[2])\r\n\t elsif object[1]=='table'\r\n\t xml << worksheetFromTable(object[0], object[2])\r\n\t else\r\n\t xml << worksheet(object[0], object[1], object[2])\r\n\t end\r\n\t\t\t end # for records\r\n\t\t\t end\r\n\t\t\t \r\n\t return xml.target! \r\n\t end",
"def generate_sample_sheet\n sample_sheet = PacbioSampleSheet.new(run: self, configuration: pacbio_run_sample_sheet_config)\n sample_sheet.generate\n end",
"def worksheet (sheetname, objectType,objects)\r\n\t\r\n\t buffer =\"\"\r\n\t xm = Builder::XmlMarkup.new(buffer) # stream to the text buffer\r\n\t type = ActiveRecord::Base.const_get(objectType.classify)\r\n\t \r\n\t xm.Worksheet 'ss:Name' => sheetname do\r\n \t xm.Table do\r\n \t \r\n \t # Header\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data column.human_name, 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t \r\n \t # Rows\r\n \t for record in objects\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data record.send(column.name), 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t end # for\r\n \t \r\n \t end # table\r\n\t end #worksheet\r\n\t \r\n\t return xm.target! # retrieves the buffer\r\n\t\r\n\t end",
"def run\n connect if cn.state.zero?\n sql || get_sql\n replace_placeholders\n \n # If we already hold a Sheet\n if result \n \n # Take the Workbook which holds the current Sheet\n rwb = result.parent\n \n # Run the Report and bring back a new Sheet\n self.result = query( sql )\n \n # Add the new Sheet onto the existing Workbook\n rwb << result\n \n else\n \n # Create a new Sheet\n self.result = query( sql )\n \n end\n \n # Use the SQL report naming convention to guess at a sheet name.\n # Max Sheet name length in Excel is 31 characters.\n result.name = clean_name if name\n \n # Set the result to be invisible by default\n result.parent.standalone = true\n \n # Return the Sheet\n result\n \n end",
"def add_service_matrix_worksheet(package, standard_column_style)\n package.workbook.add_worksheet(name: 'Service Matrix') do |sheet|\n add_header_row(sheet, ['Service Reference', 'Service Name'])\n add_building_name_row(sheet, ['', ''], :center)\n add_service_matrix(sheet)\n style_service_matrix_sheet(sheet, standard_column_style)\n end\n end",
"def to_xls\n\n doc = Spreadsheet::Workbook.new # start the excel document\n\n # create the project information worksheet\n tab1 = doc.create_worksheet :name => \"Project Information\"\n\n # write a few lines to the sheet\n tab1.row(1).concat ['This','is','file','1','row','1']\n tab1.row(2).concat ['This','is','file','1','row','2']\n tab1.row(3).concat ['This','is','file','1','row','3']\n\n doc2 = Spreadsheet::Workbook.new\n d2t1 = doc2.create_worksheet :name=>'P1'\n d2t1.row(0).concat [\"a little somethin somethin for doc 2\"]\n files = [\"#{user}_ef_1.xls\",\"#{user}_ef_2.xls\" ]\n doc.write \"exports/#{files[0]}\"\n doc2.write \"exports/#{files[1]}\"\n return files\n end",
"def write_columns_to_sheet\n # Opens working copy spreadsheet, updates column names, and writes changes\n require 'rubyXL'\n workbook = RubyXL::Parser.parse(self.working_file)\n worksheet = workbook[0]\n self.columns.each_with_index do |val, col|\n worksheet.add_cell(0, col, val)\n end\n workbook.write(self.working_file)\n end",
"def create\n @excel = Excel.new(excel_params)\n\n respond_to do |format|\n if @excel.save\n format.html {redirect_to @excel, notice: 'Excel was successfully created.'}\n format.json {render :show, status: :created, location: @excel}\n else\n format.html {render :new}\n format.json {render json: @excel.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @question_sheet = Fe::QuestionSheet.new_with_page\n\n respond_to do |format|\n if @question_sheet.save\n format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) }\n format.xml { head :created, :location => admin_question_sheet_path(@question_sheet) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_sheet.errors.to_xml }\n end\n end\n end",
"def set_first_sheet\n @hidden = 0 # Active worksheet can't be hidden.\n set_firstsheet(@index)\n end",
"def generate_workbook file_name\n raise FileNameNotGiven, 'filename is nil' if file_name.nil?\n self.Workbooks.Add\n empty_ole_workbook = self.Workbooks.Item(self.Workbooks.Count)\n filename = General.absolute_path(file_name).tr('/','\\\\')\n unless File.exist?(filename)\n begin\n empty_ole_workbook.SaveAs(filename)\n rescue WIN32OLERuntimeError => msg\n # if msg.message =~ /SaveAs/ and msg.message =~ /Workbook/ then\n raise FileNotFound, \"could not save workbook with filename #{file_name.inspect}\"\n # else\n # # todo some time: find out when this occurs :\n # raise UnexpectedREOError, \"unknown WIN32OLERuntimeError with filename #{file_name.inspect}: \\n#{msg.message}\"\n # end\n end\n end\n empty_ole_workbook\n end",
"def write_tasks_to_spreadsheet(tasks, output_filename)\n # Initialize\n book = Spreadsheet::Workbook.new\n sheet = book.create_worksheet\n sheet.row(0).concat %w{Title Category Minimum Maximum Average}\n\n puts tasks\n\n tasks.each_with_index do |task, i|\n sheet.row(i + 1).push(task.title)\n sheet.row(i + 1).push(task.category)\n sheet.row(i + 1).push(task.min_price)\n sheet.row(i + 1).push(task.max_price)\n sheet.row(i + 1).push(task.avg_price)\n end\n\n # Format\n sheet.row(0).height = 14\n\n format = Spreadsheet::Format.new :color => :blue,\n :weight => :bold,\n :size => 14\n sheet.row(0).default_format = format\n\n # Write to file\n book.write output_filename\nend",
"def build_document\n self.root = XML::Node.new('Workbook')\n root['xmlns'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:o'] = 'urn:schemas-microsoft-com:office:office'\n root['xmlns:x'] = 'urn:schemas-microsoft-com:office:excel'\n root['xmlns:ss'] = 'urn:schemas-microsoft-com:office:spreadsheet'\n root['xmlns:html'] = 'http://www.w3.org/TR/REC-html40'\n end",
"def create\n @style_sheet = @site.style_sheets.new(params[:style_sheet])\n @style_sheet.created_by = @style_sheet.updated_by = current_user\n\n respond_to do |format|\n if @style_sheet.save\n flash[:notice] = \"StyleSheet was successfully created.\"\n format.html { redirect_to([:admin, @site, @style_sheet]) }\n format.xml { render :xml => @style_sheet, :status => :created, :location => @style_sheet }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @style_sheet.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @worksheets = Worksheet.all\n end",
"def create\n @score_sheet = ScoreSheet.new(params[:score_sheet])\n\n respond_to do |format|\n if @score_sheet.save\n format.html { redirect_to @score_sheet, notice: 'Score sheet was successfully created.' }\n format.json { render json: @score_sheet, status: :created, location: @score_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @score_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_spreadsheet_xml(spreadsheet_xml)\n workbook = Workbook.new\n \n doc = LibXML::XML::Parser.string(spreadsheet_xml).parse\n doc.root.namespaces.default_prefix=\"ss\"\n \n doc.find(\"//ss:style\").each do |s|\n style = Style.new(s[\"id\"])\n s.children.each do |a|\n style.attributes[a.name] = a.content unless (a.name == \"text\")\n end\n workbook.styles[style.name] = style\n end\n\n\n doc.find(\"//ss:sheet\").each do |s|\n unless s[\"hidden\"] == \"true\" || s[\"very_hidden\"] == \"true\"\n sheet = Sheet.new(s[\"name\"])\n workbook.sheets << sheet\n #Load into memory\n min_rows = 10\n min_cols = 10\n #Grab columns\n columns = s.find(\"./ss:columns/ss:column\")\n col_index = 0\n #Add columns\n columns.each do |c|\n col_index = c[\"index\"].to_i\n col = Column.new(col_index, c[\"width\"])\n sheet.columns << col\n end\n #Pad columns (so it's at least 10 cols wide)\n if col_index < min_cols\n for i in ((col_index+1)..min_cols)\n col = Column.new(i, 2964.to_s)\n sheet.columns << col\n end\n else\n min_cols = col_index\n end\n #Grab rows\n rows = s.find(\"./ss:rows/ss:row\")\n row_index = 0\n #Add rows\n rows.each do |r|\n row_index = r[\"index\"].to_i\n row = Row.new(row_index, r[\"height\"])\n sheet.rows[row_index] = row\n #Add cells\n r.find(\"./ss:cell\").each do |c|\n col_index = c[\"column\"].to_i\n content = c.content\n content = content.to_f if c[\"type\"] == \"numeric\"\n cell = Cell.new(content, row_index, col_index, c[\"formula\"], c[\"style\"])\n row.cells[col_index] = cell\n end\n end\n #Pad rows\n if row_index < min_rows\n for i in (row_index..min_rows)\n row = Row.new(i, 1000.to_s)\n sheet.rows << row\n end\n min_rows = 10\n else\n min_rows = row_index\n end\n sheet.last_row = min_rows\n sheet.last_col = min_cols\n end\n end\n\n workbook\n end",
"def create\n @job_sheet = JobSheet.new(params[:job_sheet])\n\n respond_to do |format|\n if @job_sheet.save\n format.html { redirect_to @job_sheet, notice: 'Job sheet was successfully created.' }\n format.json { render json: @job_sheet, status: :created, location: @job_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @job_sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_cells\n definition['cells'].each do |cellname|\n cells.create!(name: cellname)\n end\n end",
"def add_style_sheets(*sheets)\n for sheet in sheets do\n @style_sheets << \" -s #{sheet} \"\n end\n end",
"def add_style_sheets(*sheets)\n for sheet in sheets do\n @style_sheets << \" -s #{sheet} \"\n end\n end",
"def create\n @sheet = Sheet.new(sheet_params)\n @sheet.user = current_user || @user\n\n respond_to do |format|\n if @sheet.save\n format.html { redirect_to @sheet, notice: 'Sheet was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sheet }\n else\n format.html { render action: 'new' }\n format.json { render json: @sheet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def parse_worksheet(wb, i, worksheet_xml, worksheet_name, sheet_id)\n worksheet = Worksheet.new(wb, worksheet_name)\n wb.worksheets[i] = worksheet # Due to \"validate_workbook\" issues. Should remove that validation eventually.\n worksheet.sheet_id = sheet_id\n dimensions = RubyXL::Reference.new(worksheet_xml.css('dimension').attribute('ref').value)\n cols = dimensions.last_col\n\n # Create empty arrays for workcells. Using +downto()+ here so memory for +sheet_data[]+ is\n # allocated on the first iteration (in case of +upto()+, +sheet_data[]+ would end up being\n # reallocated on every iteration).\n dimensions.last_row.downto(0) { |i| worksheet.sheet_data[i] = Array.new(cols + 1) }\n\n namespaces = worksheet_xml.root.namespaces\n\n if @data_only\n row_xpath = '/xmlns:worksheet/xmlns:sheetData/xmlns:row[xmlns:c[xmlns:v]]'\n cell_xpath = './xmlns:c[xmlns:v[text()]]'\n else\n row_xpath = '/xmlns:worksheet/xmlns:sheetData/xmlns:row'\n cell_xpath = './xmlns:c'\n\n sheet_views_nodes = worksheet_xml.xpath('/xmlns:worksheet/xmlns:sheetViews/xmlns:sheetView', namespaces)\n worksheet.sheet_views = sheet_views_nodes.collect { |node| RubyXL::SheetView.parse(node) }\n\n col_node_set = worksheet_xml.xpath('/xmlns:worksheet/xmlns:cols/xmlns:col',namespaces)\n worksheet.column_ranges = col_node_set.collect { |col_node| RubyXL::ColumnRange.parse(col_node) }\n\n merged_cells_nodeset = worksheet_xml.xpath('/xmlns:worksheet/xmlns:mergeCells/xmlns:mergeCell', namespaces)\n worksheet.merged_cells = merged_cells_nodeset.collect { |child| RubyXL::Reference.new(child.attributes['ref'].text) }\n\n# worksheet.pane = worksheet.sheet_view[:pane]\n\n data_validations = worksheet_xml.xpath('/xmlns:worksheet/xmlns:dataValidations/xmlns:dataValidation', namespaces)\n worksheet.validations = data_validations.collect { |node| RubyXL::DataValidation.parse(node) }\n\n #extLst\n ext_list_node = worksheet_xml.xpath('/xmlns:worksheet/xmlns:extLst', namespaces)\n unless ext_list_node.empty?\n worksheet.extLst = Hash.xml_node_to_hash(ext_list_node.first)\n else\n worksheet.extLst = nil\n end\n #extLst\n\n ##legacy drawing##\n legacy_drawing_node = worksheet_xml.xpath('/xmlns:worksheet/xmlns:legacyDrawing', namespaces)\n unless legacy_drawing_node.empty?\n worksheet.legacy_drawing = Hash.xml_node_to_hash(legacy_drawing_node.first)\n else\n worksheet.legacy_drawing = nil\n end\n ##end legacy drawing\n\n drawing_nodes = worksheet_xml.xpath('/xmlns:worksheet/xmlns:drawing', namespaces)\n worksheet.drawings = drawing_nodes.collect { |n| n.attributes['id'] }\n end\n\n worksheet_xml.xpath(row_xpath, namespaces).each { |row|\n unless @data_only\n ##row styles##\n row_attributes = row.attributes\n row_style = row_attributes['s'] && row_attributes['s'].value || '0'\n\n worksheet.row_styles[row_attributes['r'].content] = { :style => row_style }\n\n if !row_attributes['ht'].nil? && (!row_attributes['ht'].content.nil? || row_attributes['ht'].content.strip != \"\" )\n worksheet.change_row_height(Integer(row_attributes['r'].value) - 1, Float(row_attributes['ht'].value))\n end\n ##end row styles##\n end\n\n row.search(cell_xpath).each { |value|\n #attributes is from the excel cell(c) and is basically location information and style and type\n value_attributes = value.attributes\n # r attribute contains the location like A1\n cell_index = RubyXL::Reference.ref2ind(value_attributes['r'].content)\n style_index = 0\n # t is optional and contains the type of the cell\n data_type = value_attributes['t'].content if value_attributes['t']\n element_hash ={}\n\n value.children.each { |node| element_hash[\"#{node.name()}_element\"] = node }\n\n # v is the value element that is part of the cell\n if element_hash[\"v_element\"]\n v_element_content = element_hash[\"v_element\"].content\n else\n v_element_content=\"\"\n end\n\n if v_element_content == \"\" # no data\n cell_data = nil\n elsif data_type == RubyXL::Cell::SHARED_STRING\n str_index = Integer(v_element_content)\n cell_data = wb.shared_strings[str_index].to_s\n elsif data_type == RubyXL::Cell::RAW_STRING\n cell_data = v_element_content\n elsif data_type == RubyXL::Cell::ERROR\n cell_data = v_element_content\n else# (value.css('v').to_s != \"\") && (value.css('v').children.to_s != \"\") #is number\n data_type = ''\n if(v_element_content =~ /\\./ or v_element_content =~ /\\d+e\\-?\\d+/i) #is float\n cell_data = Float(v_element_content)\n else\n cell_data = Integer(v_element_content)\n end\n end\n\n # f is the formula element\n cell_formula = nil\n fmla_css = element_hash[\"f_element\"]\n if fmla_css && fmla_css.content\n fmla_css_content= fmla_css.content\n if(fmla_css_content != \"\")\n cell_formula = fmla_css_content\n cell_formula_attr = {}\n fmla_css_attributes = fmla_css.attributes\n cell_formula_attr['t'] = fmla_css_attributes['t'].content if fmla_css_attributes['t']\n cell_formula_attr['ref'] = fmla_css_attributes['ref'].content if fmla_css_attributes['ref']\n cell_formula_attr['si'] = fmla_css_attributes['si'].content if fmla_css_attributes['si']\n end\n end\n\n style_index = value['s'].to_i #nil goes to 0 (default)\n\n worksheet.sheet_data[cell_index[0]][cell_index[1]] =\n Cell.new(worksheet,cell_index[0],cell_index[1],cell_data,cell_formula,\n data_type,style_index,cell_formula_attr)\n cell = worksheet.sheet_data[cell_index[0]][cell_index[1]]\n }\n }\n\n worksheet\n end",
"def wsref(fnarg_h)\n\n wb=fnarg_h[\"wb\"]\n cflag=fnarg_h[\"cflag\"] || false\n wsname=fnarg_h[\"wsname\"] || 1\n\n ws=nil\n if (!wb.is_a?(WIN32OLE))\n Logger.msg(\"Err\", \"wsref: Workbook reference is nil ....\")\n return ws\n end\n\n if ( (!wsname.is_a?(String)) and (!wsname.is_a?(Integer)))\n Logger.msg(\"Err\", \"wsref: Worksheet name neither string nor integer: \", [wb.name, wsname])\n return ws\n end\n\n if (sheet?(wb,wsname))\n ws = wb.worksheets(wsname)\n elsif(cflag)\n wb.worksheets.add\n (wsname.is_a?(String)) ? wb.worksheets(1).name = wsname : wsname=1\n wb.save()\n ws=wb.worksheets(wsname)\n else\n Logger.msg(\"Err\",\"get_wsref: Worksheet is not exist \", [wb, wsname])\n end\n return ws\nend",
"def generateExcelFromArray(questions_array, category, tags,file_num)\n book = Spreadsheet::Workbook.new\n sheet1 = book.create_worksheet\n sheet1.row(0).concat %w{QuestionNo TestName Category Tags Directions QuestionText QuestionImage AnswerText AnswerImage Correct Option Option Option Option}\n row_num = 1\n\n questions_array.each do |question|\n row = sheet1.row(row_num)\n row[0] = row_num\n row[1] = question.test_name\n row[2] = question.category\n row[3] = question.tags.join(\",\")\n row[4] = question.directions\n row[5] = question.question_text\n row[6] = question.question_image\n row[7] = question.answer_text\n row[8] = question.answer_image\n row[9] = question.correct_answer\n row[10] = question.options[0]\n row[11] = question.options[1]\n row[12] = question.options[2]\n row[13] = question.options[3]\n\n\n row_num = row_num + 1\n end\n #Formatting row\n sheet1.row(0).height = 18\n format = Spreadsheet::Format.new :color => :blue,:weight => :bold,:size => 12\n sheet1.row(0).default_format = format\n book.write \"/home/malav/rails_projects/generated_excels/#{category}-#{tags}-#{file_num}.xls\"\nend",
"def get_my_spreadsheets()\n spreadsheet_feed_response = get_feed(SPREADSHEET_FEED)\n create_datastructure_from_xml(spreadsheet_feed_response.body)\n end",
"def worksheet=(v) DataTypeValidator.validate :row_worksheet, Worksheet, v; @worksheet = v; end",
"def create\n file = params['file']\n random_name = random_string(20)\n File.open( \"public/excel/\" + random_name + file.original_filename, \"wb\" ) { |f| f.write( file.read ) }\n name = \"public/excel/\" + random_name + file.original_filename\n ext_name = File.extname( name )\n\n #parsujemy plik excela\n if ext_name == '.csv' #parsowanie w przypadku plików .csv\n workbook = CSV.read(name, { :col_sep => ';', :encoding => 'iso-8859-2:utf-8'})\n workbook = workbook\n else\n workbook = Spreadsheet.open name #parsowanie w przypadku standardowych plików excela .xls .xlsx\n workbook = workbook.worksheets[0]\n end\n\n #wyswietlamy komunikat zwrotny\n if Excel.create(:excel_json => workbook.to_json, :name => file.original_filename, :user_id => session[:user]['id'])\n render json: {save: true, message: 'zapisano poprawnie plik', callback: 'excel'}\n else\n render json: {save: false, message: 'błąd w zapisie', callback: 'excel'}\n end\n end",
"def worksheets(temporal)\n @worksheet_feed = temporal\n gdocs = Gdocs::WorkSheets.new({:token => @access_token.token, :refresh_token => @access_token.refresh_token, :token_expires_at => @access_token.expires_at})\n @worksheets ||= gdocs.list(@worksheet_feed)\n end",
"def activate_sheet(term)\n\n if @workbook\n x = term.is_a?(String) ? @workbook.getSheetIndex(term.to_java(java.lang.String)) : term\n @sheet = worksheet(x)\n\n if @sheet\n @current_sheet_index = x\n @workbook.setActiveSheet(@current_sheet_index)\n @sheet = @workbook.getSheetAt(@current_sheet_index)\n @sheet.setActive(true)\n end\n end\n @sheet\n end",
"def to_excel\n workbook.dup.clear_all.add( self.dup ).workbook.to_excel\n end",
"def out2sheet(fnarg_h={})\n\n if ( (!fnarg_h['dataset'].is_a?(Array)) and (!fnarg_h['dataset'].is_a?(Hash)) )\n Logger.msg(\"Err\",\"out2sheet: Given dataset is neither Array nor hash\",fnarg_h['dataset'].class)\n return false\n end\n\n if (!fnarg_h['ws'].is_a?(WIN32OLE))\n Logger.msg(\"Err\",\"out2sheet: worksheet reference is not WIN32OLE\",fnarg_h['ws'])\n return false\n end\n\n ws=fnarg_h['ws']\n dataset=fnarg_h['dataset']\n r1 = ( (fnarg_h['r1'].is_a?(Integer)) and (fnarg_h['r1']>0) ) ? fnarg_h['r1'] : 1\n c1= ( (fnarg_h['c1'].is_a?(Integer)) and (fnarg_h['c1']>0) ) ? fnarg_h['c1'] : 1\n hdlist=fnarg_h['hdlist']\n hdfmt=fnarg_h['hdfmt']\n append=(fnarg_h['append']==nil) ? true : fnarg_h['append']\n\n begin\n if (append==true)\n urange = ws.UsedRange\n nor = urange.rows.count\n noc = urange.columns.count\n rindex = ( ( nor ==1 ) and (noc==1) ) ? 1 : nor+1\n rindex = r1 if ( rindex<r1 ) ## In append if starting row is given and is higher than current last row, then use that.\n else\n ws.UsedRange.delete\n rindex = r1\n end # if append\n if ( dataset.is_a?(Array) ) ## Assume dataset is array of array.\n nor= dataset.length\n noc=(dataset[0].length <1 ) ? 1 : dataset[0].length\n begin\n ws.Range(ws.cells(rindex,c1),ws.cells(rindex+nor-1,c1+noc-1)).value=dataset\n rescue\n #There are some issue in writting very big chunk of data, in that case , I write row by row.\n dataset.each { |arr|\n arr.each_with_index { |v, ind| ws.Cells(rindex,c1+ind).value = v }\n } #each arr\n rindex += 1\n end #rescue\n elsif ( dataset.is_a?(Hash) )\n nor = dataset.keys.length\n noc = 2\n d_aofa = dataset.select { |key,val| true }\n d_aofa.collect! { |arr| [arr[0],sprintf(\"#{hdfmt['value']}\",arr[1])] } if (hdfmt['value'].is_a?(String))\n d_aofa=d_aofa.unshift(['Description','Value'])\n ws.Range(ws.cells(rindex,c1),ws.cells(rindex+nor-1,c1+noc-1)).value=d_aofa\n end # dataset is Hash\n rescue\n Logger.msg(\"Err\", \"out2sheet: #{ws} writing to excel sheet error #{$!}\")\n return false\n end\n return true\nend",
"def data_categories_sheet\r\n @book.worksheet(WBF[:category_sheet])\r\n end",
"def create_games_excel\r\n\r\n if (params[:msg].nil?)\r\n\r\n @student_group = StudentGroup.find(params[:id])\r\n #@book = Spreadsheet.open 'C:/Users/Rushabh Hathi/Desktop/Dialogue1.0/public/Files/abc.txt'\r\n @book = Spreadsheet::Workbook.new\r\n sheet1 = @book.create_worksheet\r\n @rolelist=Role.all(:conditions=>['case_study_id=?', @student_group.case_study_id])\r\n i=1\r\n\r\n# #here role name is added for the list to be populated\r\n# @rolelist.each do |r|\r\n# sheet1[0, i]=r.name\r\n# i=i+1\r\n# end\r\n\r\n @studentgroupuserlist=StudentGroupUser.all(:conditions=>['student_group_id=?', params[:id]])\r\n @studentlist= Array.new\r\n @unallocated_student= Array.new\r\n @studentgroupuserlist.each do |s|\r\n @studentlist << User.find(s.user_id)\r\n end\r\n\r\n #here the dynamic data from student group gets populated\r\n i=1\r\n sheet1[0, 0]=\"Student ID\"\r\n sheet1[0, 1]=\"Student Name\"\r\n sheet1[0, 2]=\"Role Name\"\r\n\r\n\r\n @studentlist.each do |s|\r\n\r\n sheet1[i, 0]=s.id\r\n sheet1[i, 1]=s.first_name+s.last_name\r\n sheet1[i, 2]= \" \"\r\n i=i+1\r\n @book.write \"#{Rails.root}/public/Files/Game_Creation.xls\"\r\n\r\n\r\n end\r\n\r\n end\r\n end"
] |
[
"0.8110177",
"0.77272063",
"0.77159745",
"0.76507896",
"0.74569863",
"0.72874314",
"0.70154905",
"0.6885352",
"0.67705363",
"0.6718044",
"0.6703531",
"0.6619508",
"0.65931875",
"0.6549719",
"0.65302944",
"0.6451329",
"0.6392518",
"0.6388227",
"0.63838637",
"0.61581063",
"0.6131614",
"0.6073452",
"0.5978125",
"0.59327066",
"0.592718",
"0.5883424",
"0.58807313",
"0.58675724",
"0.5863568",
"0.5722361",
"0.5658568",
"0.56524557",
"0.56230134",
"0.5581027",
"0.5580907",
"0.55782926",
"0.55711985",
"0.5558365",
"0.5535818",
"0.5535818",
"0.5506835",
"0.5500985",
"0.5495686",
"0.54785806",
"0.54741347",
"0.54688746",
"0.5461255",
"0.54598576",
"0.5452842",
"0.54468155",
"0.5422545",
"0.5405767",
"0.54053783",
"0.54043835",
"0.53877425",
"0.53852826",
"0.5382502",
"0.53632724",
"0.53278923",
"0.53141993",
"0.52649224",
"0.52570444",
"0.52550215",
"0.5247494",
"0.5242551",
"0.523989",
"0.52323645",
"0.5231137",
"0.52229",
"0.5212463",
"0.52085173",
"0.52006483",
"0.5157616",
"0.5150922",
"0.51506233",
"0.5140649",
"0.51274",
"0.51158524",
"0.5115072",
"0.5106178",
"0.510199",
"0.50982004",
"0.5088115",
"0.508449",
"0.508449",
"0.5075443",
"0.50702053",
"0.5069657",
"0.50651145",
"0.50380087",
"0.50371546",
"0.50147325",
"0.5012162",
"0.5000743",
"0.4997626",
"0.49968386",
"0.49949497",
"0.49935853"
] |
0.77608424
|
3
|
Calculate password hash from string for use in 'password' fields.
|
def password_hash(pwd)
hsh = 0
pwd.reverse.each_char { |c|
hsh = hsh ^ c.ord
hsh = hsh << 1
hsh -= 0x7fff if hsh > 0x7fff
}
(hsh ^ pwd.length ^ 0xCE4B).to_s(16)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def password_digest(password); end",
"def digest(string)\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :\n BCrypt::Engine.cost\n BCrypt::Password.create(string, cost: cost)\n end",
"def digest(string)\n\t\tcost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost\n\t\tBCrypt::Password.create(string, cost: cost)\n\tend",
"def digest(string)\n\t\tcost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost\n\t\tBCrypt::Password.create(string, cost: cost)\n\tend",
"def digest(string)\n User.digest(string, self.password_salt)\n end",
"def calc_digest(password)\n return nil unless password\n algorithm.encode(password)\n end",
"def password_hash(str)\n fifty_fifty(Digest::MD5.hexdigest(str)) { str }\nend",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def secure_hash(string)\n Digest::SHA2.hexdigest(string)\n end",
"def hash_password(password)\r\n\t\tUser.hash_password(password, self.hash_algorithm)\r\n\tend",
"def secure_hash(string)\n\t\t\tDigest::SHA2.hexdigest(string)\n\t\tend",
"def secure_hash(string)\n\t Digest::SHA2.hexdigest(string)\n\tend",
"def password_hash(pass)\n self.class.password_hash(pass)\n end",
"def password_hash(p = nil)\n pass = p ? p : self.passphrase\n raise 'Passphrase is nil' if pass.blank?\n Encryption::MD5Digest.new.digest_base64(pass)\n end",
"def hash_string(value)\n return case password_hash_type\n when 'md5' then Digest::MD5.hexdigest(value + self.password_salt)\n end\n end",
"def calc_hash(pass)\n salt_cost = SCrypt::Engine.autodetect_cost(self[:salt])\n SCrypt::Engine.scrypt(pass, self[:salt], salt_cost, 32).unpack('H*').first\n end",
"def password_digest(password)\n ::BCrypt::Password.create(password).to_s\n end",
"def hash(password, salt)\n Digest::SHA512.hexdigest(\"#{ password }:#{ salt }\")\n end",
"def standard_password_digest\n password_digest( standard_password )\n end",
"def password_digest(password)\n Authentication::Encryptor.digest(password)\n end",
"def hash_password(username, plaintext)\n OpenSSL::Digest::MD5.hexdigest(\"#{username}:mongo:#{plaintext}\")\n end",
"def hexdigest(string)\n @digest_class.new(string).hexdigest\n end",
"def hashed_password(username, password)\n @hashers.fetch(username).call(password)\n end",
"def pwdhash(salt=nil)\n salt = String.random_password.md5 if salt.nil?\n salt = salt[0..8]\n salt+(salt+self).sha1\n end",
"def hash_password(password)\n digest = OpenSSL::Digest::SHA256.new\n OpenSSL::PKCS5.pbkdf2_hmac(password, @verify_salt, 300_000, digest.digest_length, digest)\n end",
"def hash_password\n self.password_salt = SecureRandom.base64(8) if self.password_salt == nil\n self.hashed_password = Digest::SHA1.hexdigest(self.password_salt + self.password)\n end",
"def digest_str(password)\n raise ArgumentError, \"password must be a String\" unless password.is_a?(String)\n\n result = Util.zeros(STRBYTES)\n\n ok = self.class.pwhash_str(\n result,\n password, password.bytesize,\n @opslimit, @memlimit\n )\n raise CryptoError, \"unknown error in Argon2#digest_str\" unless ok\n\n result.delete(\"\\x00\")\n end",
"def hash_password\n return if password.blank?\n self.password_hash = Password.create(password)\n end",
"def hash_password\n self.password = Digest::MD5.hexdigest(self.password)\n end",
"def password_hash(salt, password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n RbNaCl::PasswordHash.scrypt(password, salt, opslimit, memlimit, digest_size)\n end",
"def create_hash(user_pw)\n return Digest::SHA1.hexdigest(user_pw)\nend",
"def password_digest(password)\n ::BCrypt::Password.create(\"#{password}#{self.pepper}\", :cost => self.class.stretches).to_s\n end",
"def lm_hash(password)\n NTLM::Util.lm_v1_hash(password).unpack(\"H*\")[0].upcase\n end",
"def hash_pass()\n self.pass=(BCrypt::Password.create(pass).to_s)\n end",
"def hard_hash(password)\n opslimit = 2**20\n memlimit = 2**24\n digest_size = 64\n\n salt = RbNaCl::Random.random_bytes(RbNaCl::PasswordHash::SCrypt::SALTBYTES)\n digest = RbNaCl::PasswordHash.scrypt(password, salt,\n opslimit, memlimit, digest_size)\n [Base64.strict_encode64(digest), Base64.strict_encode64(salt)].join(\"\\n\")\nend",
"def hash_password\n\t\t# Is there a password set in the model? If not then do nothing\n\t\tif password.present?\n\t\t\treturn self.password_digest = BCrypt::Password.create(password)\n\t\tend\n\tend",
"def generate_verify_hash(password)\n @password_hash = hash_password(password)\n end",
"def get_password\n\tpwd1 = Password.get(\"New Password: \")\n\tpwd2 = Password.get(\"Retype New Password: \")\n\n\tbegin\n\t\traise if pwd1 != pwd2\n\t\trescue\n\t\t\tprint \"ERROR: Password mismatch!\\n\"\n\t\t\texit\n\tend\n\n\tbegin\n\t\tpwd1.check # check password strength\n\t\trescue\n\t\t\tprint \"ERROR: Password strength check failed: \" + $! + \"\\n\"\n\t\t\texit\n\tend\n\n\tsalt = rand.to_s.gsub(/0\\./, '')\n\tpass = pwd1.to_s\n\thash = \"{SSHA}\"+Base64.encode64(Digest::SHA1.digest(\"#{pass}#{salt}\")+salt).chomp!\n\treturn hash\nend",
"def hash_password # We'll call this method in the seed file; from https://gist.github.com/mdang/7b6097cc13b07db82c78\n if password.present?\n self.password_digest = BCrypt::Password.create(password)\n end\n end",
"def hashed_password\n @hashed_password ||= Digest::SHA1.hexdigest(password).upcase\n end",
"def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end",
"def get_hash(input)\n return $hasher.reset.update(input).to_s\nend",
"def lm_hash(password)\n keys = gen_keys password.upcase.ljust(14, \"\\0\")\n apply_des(LM_MAGIC, keys).join\n end",
"def digest(string)\n @digest_class.new(string).digest\n end",
"def create_hash_password(password)\n BCrypt::Password.create(password)\n end",
"def password_digest(password)\n self.class.encryptor_class.digest(password, self.class.stretches, self.password_salt, self.class.pepper)\n end",
"def password=(str)\n @password = str\n self.password_digest = User.digest(str)\n end",
"def digest_password\n token = nonce + timestamp + password\n Base64.encode64(Digest::SHA1.hexdigest(token)).chomp!\n end",
"def ntlm_hash(password, opt = {})\n pwd = password.dup\n unless opt[:unicode]\n pwd = EncodeUtil.encode_utf16le(pwd)\n end\n OpenSSL::Digest::MD4.digest pwd\n end",
"def create_hash(password)\n BCrypt::Password.create(password)\n end",
"def hash_password\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.password_digest = BCrypt::Engine.hash_secret(self.password, self.salt)\n \t\tself.password = nil\n \tend",
"def create_hash(password)\n BCrypt::Password.create(password)\n end",
"def calculate_auth_string( salt, user )\n return hash( salt, @creds[user] )\n end",
"def update_hash!(password)\n self.password = password\n hash_password\n save\n end",
"def digest\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST : BCrypt::Engine.cost\n BCrypt::Password.create(SecureRandom.urlsafe_base64, cost: cost)\n end",
"def encrypt_password(password, salt, hash)\n case hash.to_s\n when 'sha256'\n Digest::SHA256.hexdigest(\"#{password}-#{salt}\")\n else\n raise 'Unsupported hash algorithm'\n end\n end",
"def digest\n cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :\n BCrypt::Engine.cost\n BCrypt::Password.create(self, cost: cost)\n end",
"def create_hash_digest(password)\n BCrypt::Password.create(password)\nend",
"def digest(string, options = {})\n salt = options[:salt] || SecureRandom.base64\n Digest::SHA1.hexdigest(\"#{salt}--#{string}\")\n end",
"def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end",
"def is_digest_for?(string)\n return false unless BCrypt::Password.valid_hash? self\n BCrypt::Password.new(self).is_password?(string)\n end",
"def computed_sha(string)\n provider.computed_sha(string)\n end",
"def create_digest(string, bit_size)\n Digest::SHA1.hexdigest(string).hex.to_s(2).rjust(40*4, '0')[0..bit_size-1].to_i(2)\nend",
"def digest( str )\n Digest::SHA1.hexdigest( str )\n end",
"def cypher_hash(cypher_string)\n cypher_string.hash.abs\n end",
"def hash_decoder\n hash_params = current_resource.info['rep:password'].match(\n /^\\{(?<algo>.+)\\}(?<salt>\\w+)-(?<iter>(\\d+)-)?(?<hash>\\w+)$/\n )\n\n raise('Unsupported hash format!') unless hash_params\n\n hash_params\n end",
"def hash_password!\n\t\t@password = BCrypt::Password.create(@password) \t\n\tend",
"def check_password(pass, hash)\n DjangoHash.parse(hash).check_password(pass)\n end",
"def nt_hash(password)\n NTLM::Util.nt_v1_hash(password).unpack(\"H*\")[0].upcase\n end",
"def digest_legacy_password(password)\n raise NotImplementedError, \"You must implement #{self.class.name}#digest_legacy_password(password)\"\n end",
"def validate_password(password)\n return false unless @digest_parts.any? # RUBY\n\n @a1 = ::Digest::MD5.hexdigest(@digest_parts['username'] + ':' + @realm + ':' + password)\n validate\n end",
"def create_new_hash(password)\n BCrypt::Password.create(password)\n end",
"def validate_password(input_string)\n password, rule = parse_input(input_string)\n\n # vjkjjcjjrjjmtnbjjjnj\n password_size =\n password.chars.filter { |char| char == rule.letter }.size\n\n rule.min <= password_size && password_size <= rule.max\nend",
"def hash_user_password(user)\n # Only hash password if it is present\n # Don't error out here so that internal methods can catch all missing\n # fields later on and return a more meaningful error if necessary.\n if user.key?('password')\n password = user['password']\n\n # Hash the password\n hashed = BCrypt::Password.create('password')\n\n user['password'] = hashed\n end\n end",
"def get_pre_keyed_hash(password)\n md = OpenSSL::Digest::SHA1.new\n passwd_bytes = []\n password.unpack('c*').each do |byte|\n passwd_bytes << (byte >> 8)\n passwd_bytes << byte\n end\n md << passwd_bytes.pack('c*')\n md << 'Mighty Aphrodite'.force_encoding('UTF-8')\n md\n end",
"def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end",
"def password\n @hash.to_s\n end",
"def build_meteor_password_hash(encrypted_password)\n {bcrypt: encrypted_password}\n end",
"def calc_digest input\n Digest::SHA1.hexdigest(input.to_s).\n\n # XXX: surround all digits with alphabets so\n # Maruku doesn't change them into HTML\n gsub(/\\d/, 'z\\&z')\n end",
"def hash\n Digest::SHA2.hexdigest(self.id.to_s + self.password_hash.to_s + self.email.to_s).slice(0,10)\n end",
"def make_pw_hash(pw, salt = nil)\n salt = make_salt unless salt\n BCrypt::Password.create(pw + salt) + ',' + salt\n end",
"def hash_new_password\n self.password = BCrypt::Password.create(@new_password)\n end",
"def identify_hash(hash)\n hash = hash.to_s.strip\n case\n # operating systems\n when hash.start_with?('$1$') && hash.length == 34\n return 'md5'\n when hash.start_with?('$2$') && hash.length == 59,\n hash.start_with?('$2a$') && hash.length == 60,\n hash.start_with?('$2b$') && hash.length == 60,\n hash.start_with?('$2x$') && hash.length == 60,\n hash.start_with?('$2y$') && hash.length == 60\n return 'bf' #bcrypt\n when hash.start_with?('$5$') && hash.split('$').last.length == 43\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha256,crypt'\n when hash.start_with?('$6$') && hash.split('$').last.length == 86\n # we dont check full length since it may have 'rounds=' in the [1] area or not with an arbitrary length number\n return 'sha512,crypt'\n when hash.start_with?('@S@') && hash.length == 148\n return 'qnx,sha512'\n when hash.start_with?('@s@') && hash.length == 84\n return 'qnx,sha256'\n when hash.start_with?('@m@') && hash.length == 52\n return 'qnx,md5'\n when hash.start_with?('_') && hash.length == 20\n return 'des,bsdi,crypt'\n when hash =~ /^[\\.\\/\\dA-Za-z]{13}$/ # hash.length == 13\n return 'des,crypt'\n when hash =~ /^\\$dynamic_82\\$[\\da-f]{128}\\$HEX\\$[\\da-f]{32}$/ # jtr vmware ldap https://github.com/rapid7/metasploit-framework/pull/13865#issuecomment-660718108\n return 'dynamic_82'\n when hash.start_with?(/{SSHA}/i)\n return 'ssha'\n when hash.start_with?(/{SHA512}/i)\n return 'raw-sha512'\n when hash.start_with?(/{SHA}/i)\n return 'raw-sha1'\n when hash.start_with?(/{MD5}/i)\n return 'raw-md5'\n when hash.start_with?(/{SMD5}/i)\n return 'smd5'\n when hash.start_with?(/{SSHA256}/i)\n return 'ssha256'\n when hash.start_with?(/{SSHA512}/i)\n return 'ssha512'\n # windows\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/ && hash.split(':').first.upcase == 'AAD3B435B51404EEAAD3B435B51404EE'\n return 'nt'\n when hash.length == 65 && hash =~ /^[\\da-fA-F]{32}:[\\da-fA-F]{32}$/\n return 'lm'\n # OSX\n when hash.start_with?('$ml$') && hash.split('$').last.length == 256\n return 'pbkdf2-hmac-sha512,osx' # 10.8+\n when hash =~ /^[\\da-fA-F]{48}$/ # hash.length == 48\n return 'xsha,osx' # 10.4-10.6\n # databases\n when hash.start_with?('0x0100') && hash.length == 54\n return 'mssql05'\n when hash.start_with?('0x0100') && hash.length == 94\n return 'mssql'\n when hash.start_with?('0x0200') && hash.length == 142\n return 'mssql12'\n when hash =~ /^[\\da-f]{16}$/ # hash.length == 16\n return 'mysql' # mysql323 (pre 4.1)\n when hash.start_with?('*') && hash.length == 41\n return 'mysql-sha1' # mysql 4.1+\n when hash.start_with?('md5') && hash.length == 35\n return 'postgres'\n when hash =~ /^[\\da-fA-F]{16}$/\n return 'des,oracle' # pre 11g\n when hash =~ /^S:[\\dA-F]{60}$/\n return 'raw-sha1,oracle11'\n when hash =~ /^S:[\\dA-F]{60};H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'raw-sha1,oracle'\n when hash =~ /^H:[\\dA-F]{32};T:[\\dA-F]{160}$/\n return 'pbkdf2,oracle12c'\n # webapps\n when hash.start_with?('$P$') && hash.length == 34,\n hash.start_with?('$H$') && hash.length == 34\n return 'phpass' # wordpress, drupal, phpbb3 (H not P)\n when hash.start_with?('$ml$') && hash.length == 203\n return 'PBKDF2-HMAC-SHA512'\n when hash.start_with?('{PKCS5S2}') && hash.length == 73\n return 'PBKDF2-HMAC-SHA1'\n when hash.start_with?('$B$') && hash.split('$').last.length == 32\n return 'mediawiki'\n # mobile\n when hash =~/^[A-F0-9]{40}:[a-f0-9]{16}$/\n return 'android-sha1'\n when hash =~/^[A-F0-9]{32}:[a-f0-9]{16}$/\n return 'android-md5'\n # other\n when hash =~ /^<\\d+@.+?>#[\\w]{32}$/\n return 'hmac-md5'\n when hash.length == 114 && hash.start_with?('$M$')\n return 'F5-Secure-Vault'\n when hash =~ /^M\\$[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash'\n when hash =~ /^\\$DCC2\\$\\d+#[[:print:]]+#[\\da-fA-F]{32}(?:(?::[[:print:]]*$)|$)/\n return 'mscash2'\n end\n ''\nend",
"def sha(str)\n Digest::SHA1.hexdigest(str)[0, 40]\n end",
"def password_digest\n BCrypt::Password.new(super)\n end",
"def hash_password\n self.hashed_password = BCrypt::Password.create(self.hashed_password)\n end",
"def password_digest(password)\n Devise.bcrypt(self.class, password)\n end",
"def process_line(password)\n md5 = Digest::MD5.hexdigest(password.chop!)\n if $encoded.include? md5 then $digest[md5] = password end\nend",
"def password=(new_password)\r\n\t\t@password_hash = User.calculate_hash(new_password)\r\n\tend",
"def mutate_bcrypt_password(_)\n '400$8$2d$f6ed5a490c441958$67f59aa61bc617849a3280b5e80f78607e53b5aa5807a44ddbc53e804e2e2a99'\n end",
"def password_object\n Password.new(password_hash)\n end",
"def salt_password( authkey, password )\n combined = authkey.to_s + password.to_s\n return Digest::MD5.hexdigest(combined)\n end",
"def hashed_password\n @hashed_password ||= Digest::MD5.hexdigest(\"#{name}:mongo:#{password}\")\n end",
"def get_hashed_password(token, password, check)\r\n if check\r\n return Rex::Text.sha1(password + token)\r\n else\r\n return Rex::Text.sha1(Rex::Text.sha1(password) + token)\r\n end\r\n end",
"def create_hashed_password\n self.password = password.crypt(\"ChaveDoProvas\")\n end",
"def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end",
"def hash_passphrase_text passphrase\n passphrase_text_hash = Digest::SHA256.base64digest passphrase\n end"
] |
[
"0.7502564",
"0.72289884",
"0.72189313",
"0.72189313",
"0.7100617",
"0.6975053",
"0.6973624",
"0.6935003",
"0.6935003",
"0.6935003",
"0.69026077",
"0.68875515",
"0.67386955",
"0.6716514",
"0.66810834",
"0.65440243",
"0.6542212",
"0.65396833",
"0.6539318",
"0.65320736",
"0.6443127",
"0.6441797",
"0.64298534",
"0.6409958",
"0.6409657",
"0.64009",
"0.63949996",
"0.6372491",
"0.63702947",
"0.636963",
"0.6369437",
"0.63605535",
"0.6345275",
"0.6342278",
"0.63032484",
"0.62668604",
"0.6265036",
"0.62647885",
"0.6245088",
"0.62429905",
"0.6241861",
"0.62326705",
"0.62323105",
"0.6231893",
"0.62237436",
"0.6219265",
"0.62179095",
"0.6182857",
"0.6181094",
"0.6174489",
"0.61687726",
"0.6159571",
"0.6158301",
"0.6156066",
"0.61391926",
"0.613358",
"0.61188823",
"0.61117464",
"0.61111784",
"0.6096364",
"0.6092696",
"0.6068641",
"0.6060511",
"0.6050791",
"0.6050525",
"0.60459256",
"0.6042644",
"0.60333306",
"0.5994766",
"0.59924805",
"0.59864706",
"0.5976193",
"0.5964151",
"0.59608465",
"0.59605366",
"0.5942151",
"0.5940635",
"0.5926078",
"0.59074026",
"0.5904134",
"0.59015095",
"0.5898582",
"0.58841825",
"0.58813447",
"0.58512324",
"0.58510125",
"0.58374685",
"0.583594",
"0.58318496",
"0.5830195",
"0.5828501",
"0.5826429",
"0.58166105",
"0.58142185",
"0.5813369",
"0.57872283",
"0.57862306",
"0.5783727",
"0.5771325",
"0.5759448"
] |
0.7296077
|
1
|
by default, only sets cell to nil if :left is specified, method will shift row contents to the right of the deleted cell to the left if :up is specified, method will shift column contents below the deleted cell upward
|
def delete_cell(row_index = 0, column_index=0, shift=nil)
validate_workbook
validate_nonnegative(row_index)
validate_nonnegative(column_index)
row = sheet_data[row_index]
old_cell = row && row[column_index]
case shift
when nil then
row.cells[column_index] = nil if row
when :left then
row.delete_cell_shift_left(column_index) if row
when :up then
(row_index...(sheet_data.size - 1)).each { |index|
c = sheet_data.rows[index].cells[column_index] = sheet_data.rows[index + 1].cells[column_index]
c.row -= 1 if c.is_a?(Cell)
}
else
raise 'invalid shift option'
end
return old_cell
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_cell(row=0,col=0,shift=nil)\n validate_workbook\n validate_nonnegative(row)\n validate_nonnegative(col)\n if @sheet_data.size <= row || @sheet_data[row].size <= col\n return nil\n end\n\n cell = @sheet_data[row][col]\n @sheet_data[row][col]=nil\n\n if shift && shift != :left && shift != :up\n raise 'invalid shift option'\n end\n\n if shift == :left\n @sheet_data[row].delete_at(col)\n @sheet_data[row] << nil\n (col...(@sheet_data[row].size)).each do |index|\n if @sheet_data[row][index].is_a?(Cell)\n @sheet_data[row][index].column -= 1\n end\n end\n elsif shift == :up\n (row...(@sheet_data.size-1)).each do |index|\n @sheet_data[index][col] = @sheet_data[index+1][col]\n if @sheet_data[index][col].is_a?(Cell)\n @sheet_data[index][col].row -= 1\n end\n end\n if @sheet_data.last[col].is_a?(Cell)\n @sheet_data.last[col].row -= 1\n end\n end\n\n return cell\n end",
"def undo_move(move)\n self.cells[move.to_i - 1] = \" \"\n end",
"def drop_left\n tbl = self.class.new(\n 'Columns' => Array.new(self.rows.count+1,' '),\n 'Header' => self.header,\n 'Indent' => self.indent)\n (self.columns.count+1).times do |ti|\n row = self.rows.map {|r| r[ti]}.unshift(self.columns[ti]).flatten\n # insert our col|row break. kind of hackish\n row[1] = \"| #{row[1]}\" unless row.all? {|e| e.nil? || e.empty?}\n tbl << row\n end\n return tbl\n end",
"def left!(position_of_empty_tile)\n @state_array[position_of_empty_tile]=@state_array[position_of_empty_tile - 1]\n @state_array[position_of_empty_tile - 1] = @@empty\n @path += \"R\"\n self\n end",
"def turn_left\n # a kind of matrix multiplication\n new_row_diff = 0 - @col_diff\n new_col_diff = @row_diff + 0\n @row_diff = new_row_diff\n @col_diff = new_col_diff\n end",
"def left_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col-1, cell.row)}\n end",
"def move_left(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == 0) ? array.first.length - 1 : @current_col - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def turn_right\n new_row_diff = @col_diff + 0\n new_col_diff = 0 - @row_diff\n @row_diff = new_row_diff\n @col_diff = new_col_diff\n end",
"def moveToCell(newrow, newcol)\n row_shift = newrow - @row\n col_shift = newcol - @col\n\n # Make sure we aren't asking to move out of the matrix.\n if newrow > @rows || newcol > @cols || newrow <= 0 || newcol <= 0\n return 0\n end\n\n # Did we move up/down?\n if row_shift > 0\n # We are moving down\n if @vrows == @cols\n @trow = 1\n @crow = newrow\n @row = newrow\n else\n if row_shift + @vrows < @rows\n # Just shift down by row_shift\n @trow += row_shift\n @crow = 1\n @row += row_shift\n else\n # We need to munge the values\n @trow = @rows - @vrows + 1\n @crow = row_shift + @vrows - @rows + 1\n @row = newrow\n end\n end\n elsif row_shift < 0\n # We are moving up.\n if @vrows == @rows\n @trow = 1\n @row = newrow\n @crow = newrow\n else\n if row_shift + @vrows > 1\n # Just shift up by row_shift...\n @trow += row_shift\n @row += row_shift\n @crow = 1\n else\n # We need to munge the values\n @trow = 1\n @crow = 1\n @row = 1\n end\n end\n end\n\n # Did we move left/right?\n if col_shift > 0\n # We are moving right.\n if @vcols == @cols\n @lcol = 1\n @ccol = newcol\n @col = newcol\n else\n if col_shift + @vcols < @cols\n @lcol += col_shift\n @ccol = 1\n @col += col_shift\n else\n # We need to munge with the values\n @lcol = @cols - @vcols + 1\n @ccol = col_shift + @vcols - @cols + 1\n @col = newcol\n end\n end\n elsif col_shift < 0\n # We are moving left.\n if @vcols == @cols\n @lcol = 1\n @col = newcol\n @ccol = newcol\n else\n if col_shift + @vcols > 1\n # Just shift left by col_shift\n @lcol += col_shift\n @col += col_shift\n @ccol = 1\n else\n @lcol = 1\n @col = 1\n @ccol = 1\n end\n end\n end\n\n # Keep the 'old' values around for redrawing sake.\n @oldcrow = @crow\n @oldccol = @ccol\n @oldvrow = @row\n @oldvcol = @col\n\n return 1\n end",
"def down!(position_of_empty_tile)\n @state_array[position_of_empty_tile] = @state_array[position_of_empty_tile + @@columns]\n @state_array[position_of_empty_tile + @@columns] = @@empty\n @path += \"U\"\n self\n end",
"def insert_left(obj)\n self.left, self.right = obj.left, obj\n reinsert_horizontal\n end",
"def before_destroy # already protected by a transaction\n return if self[right_col_name].nil? || self[left_col_name].nil?\n self.reload # in case a concurrent move has altered the indexes\n dif = self[right_col_name] - self[left_col_name] + 1\n base_set_class.delete_all( \"#{scope_condition} AND (#{left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\" )\n base_set_class.update_all(\"#{left_col_name} = CASE \\\n WHEN #{left_col_name} > #{self[right_col_name]} THEN (#{left_col_name} - #{dif}) \\\n ELSE #{left_col_name} END, \\\n #{right_col_name} = CASE \\\n WHEN #{right_col_name} > #{self[right_col_name]} THEN (#{right_col_name} - #{dif} ) \\\n ELSE #{right_col_name} END\",\n scope_condition)\n end",
"def move row, col\n @row = row\n @col = col\n end",
"def delete_prev_char\n return -1 if !@editable \n return if @curpos <= 0\n # if we've panned, then unpan, and don't move cursor back\n # Otherwise, adjust cursor (move cursor back as we delete)\n adjust = true\n if @pcol > 0\n @pcol -= 1\n adjust = false\n end\n @curpos -= 1 if @curpos > 0\n delete_at\n addcol -1 if adjust # move visual cursor back\n @modified = true\n end",
"def move_left\n # @dx = -8\n @x -= 8\n end",
"def rebalance_for_left_delete\n\t\t\trebalance = false\n\t\t\t[if black?\n\t\t\t\tif @right.black?\n\t\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t\t# make whole sub-tree 1 level lower and ask rebalance\n\t\t\t\t\t\trebalance = true\n\t\t\t\t\t\twith_right(@right.with_color(:red))\n\t\t\t\t\telse\n\t\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\t\tbalanced_rotate_left\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\t# flip this sub-tree into another type of 3-children node\n\t\t\t\t\tret = rotate_left\n\t\t\t\t\t# try to rebalance in sub-tree\n\t\t\t\t\tleft, rebalance = ret.left.rebalance_for_left_delete\n\t\t\t\t\traise 'should not happen' if rebalance\n\t\t\t\t\tret.with_left(left)\n\t\t\t\tend\n\t\t\telse # red\n\t\t\t\tif @right.children_color?(:black)\n\t\t\t\t\t# make right sub-tree 1 level lower\n\t\t\t\t\twith_right(@right.with_color(color)).with_color(@right.color)\n\t\t\t\telse\n\t\t\t\t\t# move 1 black from the right to the left by single/double rotation\n\t\t\t\t\tbalanced_rotate_left\n\t\t\t\tend\n\t\t\tend, rebalance]\n\t\tend",
"def move_down(array)\r\n set_current_row_col(array)\r\n new_row = @current_row == array.length - 1 ? 0 : @current_row + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[new_row][@current_col]\r\n array[new_row][@current_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def shift\n kvpair = self.to_h.shift\n @table.delete kvpair.first\n kvpair\n end",
"def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : 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 up!(position_of_empty_tile)\n @state_array[position_of_empty_tile] = @state_array[position_of_empty_tile - @@columns]\n @state_array[position_of_empty_tile - @@columns] = @@empty\n @path += \"D\"\n self\n end",
"def make_move!\n return false if get_cell_value(row, column).present?\n\n self.send cell_column(row, column, false), icon\n win? || drawn?\n\n self.save\n end",
"def move(cell, direction)\n return unless cell.contents\n target = look(cell, direction)\n if target.open?\n target.contents = cell.contents\n cell.contents = nil\n end\n end",
"def left_cell_x(x = @x); self.class.left_cell_x_at(x); end",
"def before_destroy\n return if self[acts_as_nested_set_options[:right_column]].nil? || self[acts_as_nested_set_options[:left_column]].nil?\n dif = self[acts_as_nested_set_options[:right_column]] - self[acts_as_nested_set_options[:left_column]] + 1\n\n self.class.transaction {\n self.class.delete_all( \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:left_column]} > #{self[acts_as_nested_set_options[:left_column]]} and #{acts_as_nested_set_options[:right_column]} < #{self[acts_as_nested_set_options[:right_column]]}\" )\n self.class.update_all( \"#{acts_as_nested_set_options[:left_column]} = (#{acts_as_nested_set_options[:left_column]} - #{dif})\", \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:left_column]} >= #{self[acts_as_nested_set_options[:right_column]]}\" )\n self.class.update_all( \"#{acts_as_nested_set_options[:right_column]} = (#{acts_as_nested_set_options[:right_column]} - #{dif} )\", \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:right_column]} >= #{self[acts_as_nested_set_options[:right_column]]}\" )\n }\n end",
"def right!(position_of_empty_tile)\n @state_array[position_of_empty_tile] = @state_array[position_of_empty_tile + 1]\n @state_array[position_of_empty_tile + 1] = @@empty\n @path += \"L\"\n self\n end",
"def move_right(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == array.first.length - 1) ? 0 : @current_col + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def move_piece_back\n @chess_board.board[@row][@col] = @chess_board.board[@row_new][@col_new]\n end",
"def backspace\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tif @colmode\n\t\t\t\tcolumn_backspace(mark_row,row,@col)\n\t\t\telse\n\t\t\t\tcolumn_backspace(mark_row,row,1)\n\t\t\tend\n\t\telse\n\t\t\tif (@col+@row)==0\n\t\t\t\treturn\n\t\t\tend\n\t\t\tif @col == 0\n\t\t\t\tcursor_left\n\t\t\t\tmergerows(@row,@row+1)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tcursor_left\n\t\t\tdelchar(@row,@col)\n\t\tend\n\tend",
"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 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 decrement_position\n # return unless in_list?\n update_attribute position_column, self.send(position_column).to_i - 1\n end",
"def left\n check_placement\n\n super\n end",
"def move_left\n left_tile = Couple.new(@location.first, @location.second - 1)\n move_to(left_tile)\n end",
"def clear\n prev_block = prev\n case alignment\n when 'left'\n (prev_block && prev_block.alignment == 'right') ? :after : :before\n when 'right'\n (prev_block && prev_block.alignment == 'left') ? :after : :before\n else\n nil\n end \n end",
"def move_left\n tenacious_transaction do\n move_to_left_of left_sibling.try(:lock!)\n end\n end",
"def delete_current\n left_node = @current.left\n right_node = @current.right\n removed_value = @current.value\n if !left_node.nil?\n left_node.set_right right_node\n end\n if !right_node.nil?\n right_node.set_left left_node\n @current = right_node\n else\n # wrap\n @current = get_leftmost\n end\n return removed_value\n end",
"def move_left\n @memory_position -= 1\n @memory_position = 0xfffffe if @memory_position < 0\n end",
"def move_left(mat, y, x)\n return if (x - 1) < 0\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: :left }\nend",
"def move_to(row, col)\n @row, @col = wrap(row, col)\n end",
"def insert_split left_repeated, data\n if left = try_create_empty_x(left_repeated)\n @x_cell.prev = left\n end\n\n if right = try_create_empty_x(repeated? - left_repeated - 1)\n @x_cell.next = right\n end\n\n set_data data # mutator\n\n {\n :left => self.class.new(@row, left),\n :mid => self,\n :right => self.class.new(@row, right)\n }\n end",
"def remove\n left\n @text.slice!(@cursor, 1)\n end",
"def shift_right\n self.unshift(self.pop)\n end",
"def move(line, column = T.unsafe(nil)); end",
"def move(line, column = T.unsafe(nil)); end",
"def shift\n return default if (node = @tree.minimum).nil? \n @tree.delete node\n node.to_a\n end",
"def move_left\n\t\tmove([-1,0])\n\tend",
"def left!(origin, stop)\n y = origin.column\n\n while y >= stop.column\n add_result extract!(IndexPath[origin.row, y])\n\n y -= 1\n end\n\n # Begin moving up from the start of this row\n starts_at = IndexPath[stop.row - 1, stop.column]\n ends_at = IndexPath[max_rows - origin.row + 1, stop.column]\n\n up!(starts_at, ends_at)\n end",
"def moveto_newcell(direction)\n meadow = Meadow.instance\n meadow.remove_AntFromCell(self,@x,@y)\n\n if direction == 0 #up\n @y -= 1\n elsif direction == 1 #down\n @y += 1\n elsif direction == 2 #left\n @x -= 1\n else #right\n @x += 1\n end\n meadow.add_AntToCell(self,@x,@y)\n end",
"def set_default_left_and_right\n maxright = dataset.nested.max(self.class.qualified_right_column).to_i || 0\n # adds the new node to the right of all existing nodes\n self.left = maxright + 1\n self.right = maxright + 2\n end",
"def relative_left_cell\n return left_cell if @facing == 'up'\n return up_cell if @facing == 'right'\n return right_cell if @facing == 'down'\n return down_cell if @facing == 'left'\n end",
"def delete_with_one_child(parent, target, direction)\n # if child's left exists, assign it to parent's left/right, else assign child's right\n parent.send \"#{direction}=\".to_sym, (target.left || target.right)\n end",
"def todo_item_deleted(todo_item) \n index = todo_list_manager.todo_items.indexOfObject(todo_item)\n \n todo_list_manager.todo_items.delete_at(index)\n todo_list_manager.save\n \n visible_cells = table_view.visibleCells\n #cell_being_deleted = visible_cells[index]\n last_view = visible_cells[visible_cells.count - 1]\n start_animating = false\n\n # slides the deleted cell to the left first and then shifts up the table\n # stock animation for deleteRowsAtIndexPaths merges the two animations and doesn't look as good\n visible_cells.each_with_index do |cell, cell_index|\n if cell_index == index\n #toggle_cross_symobol_cell(cell_being_deleted)\n\n UIView.animateWithDuration(0.2, \n delay: 0.0, \n options: UIViewAnimationOptionCurveEaseOut,\n animations: proc { cell.frame = CGRectOffset(cell.frame, -cell.frame.size.width, 0) },\n completion: proc { |cell| break if cell_index == index }\n )\n elsif start_animating\n UIView.animateWithDuration(0.2, \n delay: 0.2, \n options: UIViewAnimationOptionCurveEaseIn,\n animations: proc { cell.frame = CGRectOffset(cell.frame, 0, -cell.frame.size.height) },\n completion: Proc.new do |cell| \n if cell_index == visible_cells.count - 1\n table_view.reloadData\n #toggle_cross_symobol_cell(cell_being_deleted)\n end\n end\n )\n end\n \n start_animating = true if cell.todo_item == todo_item \n\n end\n \n # although I use my own animation to handle the cell being deleted to the left I had to include this to properly manage deleting info from the table and preventing flicker\n table_view.beginUpdates\n indexPathForRow = NSIndexPath.indexPathForRow(index, inSection: 0)\n table_view.deleteRowsAtIndexPaths([indexPathForRow], withRowAnimation: UITableViewRowAnimationLeft)\n table_view.endUpdates\n \n \n # reload the cells after the delete animation has finished to keep the proper color gradient\n #self.performSelector(\"reload_table_view_after_delete\", withObject: nil, afterDelay: 0.55) \n end",
"def reset_table_cell\n mixin({\n text_align: 'left',\n font_weight: 'normal',\n vertical_align: 'middle'\n })\n end",
"def right_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col+1, cell.row)}\n end",
"def move!(row, column, icon)\n @row, @column, @icon = row, column, icon\n\n make_move!\n end",
"def cursor_up(wrap = false)\n if row == 0\n process_up\n else\n super\n end\n end",
"def shift!(dr)\r\n @pos.x += dr[0]\r\n @pos.y += dr[1]\r\n end",
"def trash\n self.attributes = {\n :page_id => nil,\n :container_id => nil,\n :cell_id => nil,\n :folded => true,\n :public => false\n }\n self.remove_from_list\n end",
"def clear(row, col)\n if !@field[row][col].contains_mine?\n @field[row][col].reveal!\n if row == 0 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine?\n @field[row][col + 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif row == 0 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == 0\n if !@field[row][col + 1].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col + 1].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == @row_count - 1 && col == @column_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n end\n elsif row == 0\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row + 1][col - 1].contains_mine? && !@field[row + 1][col].contains_mine? && !@field[row + 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row + 1][col - 1].reveal!\n @field[row + 1][col].reveal!\n @field[row + 1][col + 1].reveal!\n end\n elsif col == 0\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif row == @row_count - 1\n if !@field[row][col - 1].contains_mine? && !@field[row][col + 1].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col + 1].contains_mine? &&\n @field[row][col - 1].reveal!\n @field[row][col + 1].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col + 1].reveal!\n end\n elsif col == @column_count - 1\n if !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? && !@field[row][col - 1].contains_mine? && !@field[row - 1][col].contains_mine? && !@field[row - 1][col - 1].contains_mine? &&\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n @field[row][col - 1].reveal!\n @field[row - 1][col].reveal!\n @field[row - 1][col - 1].reveal!\n end\n elsif row > 0 && row < @row_count && col > 0 && col < @column_count\n adjacent_cells(row, col).each do |cell|\n if !cell.contains_mine?\n cell.reveal!\n end\n end\n end\n else @field[row][col].reveal!\n end\n end",
"def undoMove(index)\n @board[index] = \" \"\n end",
"def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end",
"def clear(row, col)\n if within_field?(row, col) && !cell_cleared?(row, col)\n @field[row][col].clear\n if contains_mine?(row, col)\n @field[row][col].detonate\n else\n if adjacent_mines(row, col) == 0\n clear(row - 1, col - 1)\n clear(row - 1, col)\n clear(row - 1, col + 1)\n clear(row, col - 1)\n clear(row, col + 1)\n clear(row + 1, col - 1)\n clear(row + 1, col)\n clear(row + 1, col + 1)\n end\n end\n end\n end",
"def move_left\n left_tile = C[@location.first, @location.second - 1]\n move_to(left_tile)\n end",
"def move_left\n move_to_left_of left_sibling\n end",
"def column_delete(row1,row2,col)\n\t\tsc = bc2sc(@row,col)\n\t\tfor r in row1..row2\n\t\t\tc = sc2bc(r,sc)\n\t\t\tif c<0 then next end\n\t\t\tif c==@text[r].length then next end\n\t\t\t@text[r] = @text[r].dup\n\t\t\t@text[r][c] = \"\"\n\t\tend\n\tend",
"def left(j)\n\t\tnew_loc = @location.dup\n\t\tnew_loc[:x] -= j\n\t\tGridPoint3D.new(x: new_loc[:x], y: new_loc[:y], z: new_loc[:z])\n\tend",
"def move_cell(row,col,direction)\n\t\tnew_row=row\n\t\tnew_col=col\n\t\tcurrent_value=@board[[row,col]].value\n\t\t#return if it's an empty cell\n\t\tif current_value==0\n\t\t\treturn 0\n\t\tend\n\n\t\t#==== Find new Cell\n\n\t\tif direction==1 #========= Move left\n\t\t\tcounter=col-1\n\t\t\twhile true\n\t\t\t\ttemp_value=@board[[row,counter]].value\n\t\t\t\t\n\t\t\t\tbreak if ( counter==0 || (temp_value!=0 && temp_value!=current_value))\n\t\t\t\tnew_col=counter\n\t\t\t\tif temp_value==current_value\n\t\t\t\t\tcurrent_value=current_value*2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tcounter=counter-1\n\t\t\t\tend\n\t\t\t\t\n\t\t\tend\n\t\telsif direction==2 #========= Move right\n\t\t counter=col+1\n\t\t\twhile true\n\t\t\t\ttemp_value=@board[[row,counter]].value\n\t\t\t\tbreak if ( counter==5 || (temp_value!=0 && temp_value!=current_value))\n\t\t\t\tnew_col=counter\n\n\t\t\t\tif temp_value==current_value\t\n\t\t\t\t\tcurrent_value=current_value*2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tcounter=counter+1\n\t\t\t\tend\n\t\t\tend\n\t\telsif direction==3 #========= Move up\n\t\t\tcounter=row-1\n\t\t\twhile true\n\t\t\t\ttemp_value=@board[[counter,col]].value\n\t\t\t\tbreak if ( counter==0 || (temp_value!=0 && temp_value!=current_value))\n\t\t\t\tnew_row=counter\n\n\t\t\t\tif temp_value==current_value\t\n\t\t\t\t\tcurrent_value=current_value*2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tcounter=counter-1\n\t\t\t\tend\n\t\t\tend\n\t\telse #========= Move down\n\t\t\tcounter=row+1\n\t\t\twhile true\n\t\t\t\ttemp_value=@board[[counter,col]].value\n\t\t\t\tbreak if ( counter==5 || (temp_value!=0 && temp_value!=current_value))\n\t\t\t\tnew_row=counter\n\n\t\t\t\tif temp_value==current_value\t\n\t\t\t\t\tcurrent_value=current_value*2\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tcounter=counter+1\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\t#===== Chnage The Values\n\t\tif (new_row==row && new_col==col)\n\t\t\treturn 0\n\t\tend\n\n\t\t@cell_moved=true\n\n\t\t@board[[new_row,new_col]].old_value=@board[[new_row,new_col]].value\n\t\t@board[[new_row,new_col]].value=current_value\n\n\t\t@board[[row,col]].old_value=@board[[row,col]].value\n\t\t@board[[row,col]].value=0\n\n\t\tif current_value == 2048\n\t\t\t@move_result=1\n\t\tend\n\n\tend",
"def left\n cursor.left\n\n refresh\n end",
"def move_and_scale_up(cell)\n cell_clone = cell.clone\n cell_clone.x += grid.width + 1\n scale_up(cell_clone)\n end",
"def shiftrow\n #mover la fila 1\n #puts \"\\n ANTES DE SHIFTROW: #{@m_addround}\"\n @m_addround[1][0],@m_addround[1][1],@m_addround[1][2],@m_addround[1][3]=@m_addround[1][1],@m_addround[1][2],@m_addround[1][3],@m_addround[1][0]\n @m_addround[2][0],@m_addround[2][1],@m_addround[2][2],@m_addround[2][3]=@m_addround[2][2],@m_addround[2][3],@m_addround[2][0],@m_addround[2][1]\n @m_addround[3][0],@m_addround[3][1],@m_addround[3][2],@m_addround[3][3]=@m_addround[3][3],@m_addround[3][0],@m_addround[3][1],@m_addround[3][2]\n #puts \"\\n DESPUES DE SHIFTROW: #{@m_addround}\"\n @m_addround\n end",
"def move_down(mat, y, x)\n return if (y + 1) > (mat.size - 1)\n\n zero_el = mat[y][x]\n other_el = mat[y + 1][x]\n mat[y + 1][x] = zero_el\n mat[y][x] = other_el\n\n { m: mat, zero: update_coordinates(zero_el, other_el), move: :down }\nend",
"def delchar(row,col)\n\t\tif col == @text[row].length\n\t\t\tmergerows(row,row+1)\n\t\telse\n\t\t\t@text[row] = @text[row].dup\n\t\t\t@text[row][col] = \"\"\n\t\tend\n\tend",
"def clear(row, col)\n cell = @field[row][col]\n cell.uncover\n @mines_detonated = true if cell.mined\n\n left = @field[row][col - 1] unless col - 1 < 0\n top_left = @field[row -1][col -1] unless row -1 < 0 || col -1 < 0\n bot_left = @field[row +1][col -1] unless row + 1 > @row_count - 1 || col -1 < 0\n right = @field[row][col + 1] unless col + 1 > @column_count - 1\n top_right = @field[row -1][col +1] unless row -1 < 0 || col + 1 > @column_count - 1\n bot_right = @field[row +1][col +1] unless row + 1 > @row_count - 1 || col + 1 > @column_count - 1\n top = @field[row -1][col] unless row - 1 < 0\n bottom = @field[row +1][col] unless row + 1 > @row_count - 1\n\n if adjacent_mines(row, col) == 0\n left.uncover if !left.nil?\n top_left.uncover if !top_left.nil?\n bot_left.uncover if !bot_left.nil?\n right.uncover if !right.nil?\n top_right.uncover if !top_right.nil?\n bot_right.uncover if !bot_right.nil?\n top.uncover if !top.nil?\n bottom.uncover if !bottom.nil?\n end\n end",
"def lower_position!(amount = 2)\n if position > 0\n update!(position: position - amount)\n end\n dashboard.reposition_cells\n position\n end",
"def left\n self[self.nested_set_options[:left_column]] || 0\n end",
"def remove_piece(pos)\n i, j = pos\n @rows[i][j] = nil\n @pieces.delete(@rows[i][j])\n end",
"def move_by(row_delta, col_delta)\n @row, @col = wrap(@row + row_delta, @col + col_delta)\n end",
"def reformat_for_next_generation!\n # create an array of dead cells and insert it as the first and last row of cells\n dead_cells = (1..@cells.first.size).map { Cell.new }\n # don't forget to deep copy the dead_cells\n @cells.unshift Marshal.load(Marshal.dump(dead_cells))\n @cells.push Marshal.load(Marshal.dump(dead_cells))\n\n # also insert a dead cell at the left and right of each row\n @cells.each do |row|\n row.unshift Cell.new\n row.push Cell.new\n end\n\n # validate to see if we broke the board\n validate\n end",
"def left\n send left_column_name\n end",
"def move_down_cell(path_helper, object)\n if object.last?\n content_tag(:td, ' '.html_safe)\n else\n content_tag(:td, link_to('Move Down', send(path_helper, object), class: 'btn btn-default'))\n end\n end",
"def set_default_left_and_right\n unless @skip_nested_set_callbacks\n maxright = base_class.first(scoped(:order => \"#{right_column_name} DESC\")).try(right_column_name) || 0\n # adds the new node to the right of all existing nodes\n self[left_column_name] = maxright + 1\n self[right_column_name] = maxright + 2\n end\n end",
"def trash\n self.update_column(:public, false)\n self.update_column(:folded, true)\n self.remove_from_list\n end",
"def clear(row, col)\n\n end",
"def delete_left(other)\n left.delete(other.project(left.header))\n end",
"def slide(direction)\n x, y = @block_to_loc[Block.new(0)]\n # Marshal is needed to perform a deep copy of the object\n new_rows = Marshal::load(Marshal.dump(@rows))\n return_nil = true\n unless is_invalid_move?(x, y, direction, new_rows)\n return_nil = false\n swap_blocks(x, y, direction, new_rows)\n end\n if return_nil == false\n return new_rows.flatten \n else\n return nil\n end\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 swap_left\n # Creates new state matrix\n new_state = current_state_dup\n\n # Swap values\n new_state[blank_y][blank_x] = new_state[blank_y][blank_x + 1]\n new_state[blank_y][blank_x + 1] = 0\n\n # Returns new matrix\n new_state\n end",
"def rebalance_for_right_delete\n\t\t\trebalance = false\n\t\t\t[if black?\n\t\t\t\tif @left.black?\n\t\t\t\t\tif @left.children_color?(:black)\n\t\t\t\t\t\trebalance = true\n\t\t\t\t\t\twith_left(@left.with_color(:red))\n\t\t\t\t\telse\n\t\t\t\t\t\tbalanced_rotate_right\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tret = rotate_right\n\t\t\t\t\tright, rebalance = ret.right.rebalance_for_right_delete\n\t\t\t\t\traise 'should not happen' if rebalance\n\t\t\t\t\tret.with_right(right)\n\t\t\t\tend\n\t\t\telse # red\n\t\t\t\tif @left.children_color?(:black)\n\t\t\t\t\twith_left(@left.with_color(color)).with_color(@left.color)\n\t\t\t\telse\n\t\t\t\t\tbalanced_rotate_right\n\t\t\t\tend\n\t\t\tend, rebalance]\n\t\tend",
"def revert_pos(data); end",
"def move_to_left_of(node)\n self.move_to node, :left\n end",
"def clear(row, col)\n end",
"def move_up(array)\r\n set_current_row_col(array)\r\n new_row = (@current_row == 0) ? array.length - 1 : @current_row - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[new_row][@current_col]\r\n prepare_new_array(new_row, @current_col, array, current_ele, @current_row)\r\n end",
"def move_up_left\n i = 1\n until false\n x, y = @pos\n x -= i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def move_down_left\n i = 1\n until false\n x, y = @pos\n x += i\n y -= i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def shift(del=1)\n del = @length if del > @length\n rem = del\n ret = \"\"\n if isleaf(self)\n ret += @str.slice(0,rem)\n @str.slice!(0,rem)\n end\n if @left != nil\n if rem > @left.length\n rem -= @left.length\n ret += @left.shift(@left.length)\n else\n ret = @left.shift(rem)\n rem = 0\n end\n if @left.length <= 0\n @left = nil\n end\n end\n if @right != nil and rem > 0\n ret += @right.shift(rem)\n rem = 0\n if @right.length <= 0\n @right= nil\n end\n end\n @length -= del\n return ret\n end",
"def remove!(jumped_pos)\n board[jumped_pos] = nil\n end",
"def undo\n\t\t@moves.undo\n\tend"
] |
[
"0.66775256",
"0.63605005",
"0.6154143",
"0.59607273",
"0.5921581",
"0.5834795",
"0.58257157",
"0.5819249",
"0.57766175",
"0.57533693",
"0.5748814",
"0.5740785",
"0.5733002",
"0.5596116",
"0.5578374",
"0.55728936",
"0.5568853",
"0.55657446",
"0.55616975",
"0.55542773",
"0.55539864",
"0.55276793",
"0.5510361",
"0.5479784",
"0.5469432",
"0.54301",
"0.5427834",
"0.5405854",
"0.53714544",
"0.53689873",
"0.5364141",
"0.5361733",
"0.53307235",
"0.53231597",
"0.5317821",
"0.5314726",
"0.53077203",
"0.5304892",
"0.5303051",
"0.53000396",
"0.529789",
"0.52951944",
"0.529361",
"0.5290168",
"0.5290168",
"0.5284271",
"0.52817154",
"0.5264316",
"0.52545995",
"0.52449626",
"0.5243761",
"0.5238645",
"0.5237231",
"0.5228353",
"0.52180797",
"0.5217946",
"0.5211342",
"0.5203836",
"0.5203115",
"0.52024776",
"0.52019244",
"0.5196171",
"0.51928467",
"0.5192327",
"0.51891696",
"0.51885533",
"0.51867753",
"0.5171842",
"0.5161347",
"0.51523644",
"0.5152112",
"0.5142044",
"0.51407516",
"0.5140578",
"0.513839",
"0.51295465",
"0.5129042",
"0.5124426",
"0.51222605",
"0.5121776",
"0.5118733",
"0.51185685",
"0.511243",
"0.51035786",
"0.50920445",
"0.50883913",
"0.508813",
"0.508813",
"0.508813",
"0.50871533",
"0.5085438",
"0.5079509",
"0.5071989",
"0.5066775",
"0.5061705",
"0.5058805",
"0.5053489",
"0.5051545",
"0.5049442",
"0.5045216"
] |
0.6488819
|
1
|
Inserts row at row_index, pushes down, copies style from the row above (that's what Excel 2013 does!) NOTE: use of this method will break formulas which reference cells which are being "pushed down"
|
def insert_row(row_index = 0)
validate_workbook
ensure_cell_exists(row_index)
old_row = new_cells = nil
if row_index > 0 then
old_row = sheet_data.rows[row_index - 1]
if old_row then
new_cells = old_row.cells.collect { |c|
if c.nil? then nil
else nc = RubyXL::Cell.new(:style_index => c.style_index)
nc.worksheet = self
nc
end
}
end
end
row0 = sheet_data.rows[0]
new_cells ||= Array.new((row0 && row0.cells.size) || 0)
sheet_data.rows.insert(row_index, nil)
new_row = add_row(row_index, :cells => new_cells, :style_index => old_row && old_row.style_index)
# Update row values for all rows below
row_index.upto(sheet_data.rows.size - 1) { |r|
row = sheet_data.rows[r]
next if row.nil?
row.cells.each_with_index { |cell, c|
next if cell.nil?
cell.r = RubyXL::Reference.new(r, c)
}
}
return new_row
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_row(row_index=0)\n validate_workbook\n validate_nonnegative(row_index)\n\n increase_rows(row_index)\n\n @sheet_data.insert(row_index,Array.new(@sheet_data[row_index].size))\n\n row_num = row_index+1\n\n #copy cell styles from row above, (or below if first row)\n @sheet_data[row_index].each_index do |i|\n if row_index > 0\n old_cell = @sheet_data[row_index-1][i]\n else\n old_cell = @sheet_data[row_index+1][i]\n end\n\n unless old_cell.nil?\n #only add cell if style exists, not copying content\n\n if @row_styles[(row_num+1).to_s].nil?\n @row_styles[(row_num+1).to_s] = {:style=>0}\n end\n if old_cell.style_index != 0 && old_cell.style_index.to_s != @row_styles[(row_num+1).to_s][:style].to_s\n c = Cell.new(self,row_index,i)\n c.style_index = old_cell.style_index\n @sheet_data[row_index][i] = c\n end\n end\n end\n\n #copy row styles from row above, (or below if first row)\n (@row_styles.size+1).downto(row_num+1) do |i|\n @row_styles[i.to_s] = @row_styles[(i-1).to_s]\n end\n if row_index > 0\n @row_styles[row_num.to_s] = @row_styles[(row_num-1).to_s]\n else\n @row_styles[row_num.to_s] = nil#@row_styles[(row_num+1).to_s]\n end\n\n #update row value for all rows below\n (row_index+1).upto(@sheet_data.size-1) do |i|\n row = @sheet_data[i]\n row.each do |c|\n unless c.nil?\n c.row += 1\n end\n end\n end\n\n return @sheet_data[row_index]\n end",
"def insert_row(row_index = 0)\n validate_workbook\n ensure_cell_exists(row_index)\n\n old_row = new_cells = nil\n\n if row_index > 0 then\n old_row = sheet_data.rows[row_index - 1]\n if old_row then\n new_cells = old_row.cells.collect { |c|\n if c.nil? then nil\n else nc = RubyXL::Cell.new(:style_index => c.style_index)\n nc.worksheet = self\n nc\n end\n }\n end\n end\n\n row0 = sheet_data.rows[0]\n new_cells ||= Array.new((row0 && row0.cells.size) || 0)\n\n sheet_data.rows.insert(row_index, nil)\n new_row = add_row(row_index, :cells => new_cells, :style_index => old_row && old_row.style_index)\n\n # Update row values for all rows below\n row_index.upto(sheet_data.rows.size - 1) { |i|\n row = sheet_data.rows[i]\n next if row.nil?\n row.cells.each { |c| c.row = i unless c.nil? }\n }\n\n return new_row\n end",
"def create_row(index)\n @row = @sheet.createRow(index - 1)\n @row\n end",
"def insert row_ind\n row = @row_refs[row_ind]\n return if row.nil? || row.repeated?\n @row_refs.insert_after(row_ind, row.send(:insert_after))[1]\n end",
"def customize_row_index(row_index)\n row_index += 1\n end",
"def create_row(index)\n return nil if @sheet.nil?\n raise 'BAD INDEX: Row indexing starts at 0' if index < 0\n @row = @sheet.createRow(index)\n @row\n end",
"def insert_row(row, index=@rows.length)\n @rows.insert(index, row)\n end",
"def new_row_at(index)\n raise ArgumentError, \"no row factory set\" if @factory.nil?\n\n insert_row(index, @factory.create_row(self))\n end",
"def move_up(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't be 0: can't move the primary style \n\t\t# can't be 1: can't move the style at index 1 up, because it would displace the primary\n\t\tif index > 1\n\t\t\tsrc = index\n\t\t\tdst = index - 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def align_row sself, sother, row_index\n asd = 0\n if sself[row_index] && sother[row_index]\n asd = sself[row_index].key <=> sother[row_index].key\n elsif sself[row_index]\n asd = -1\n elsif sother[row_index]\n asd = 1\n end\n if (asd == -1) && insert_placeholder?(sother, sself, row_index)\n sother.insert row_index, placeholder_row\n row_index -= 1\n elsif (asd == 1) && insert_placeholder?(sother, sself, row_index)\n sself.insert row_index, placeholder_row\n row_index -= 1\n end\n\n row_index + 1\n end",
"def insert row_ind, count=1\n @row_refs.insert(row_ind,count)\n end",
"def base_insert_row(index, row, editable)\n check_editable(index)\n\n editable = editable? if editable.nil?\n @rows.insert(index, RowHolder.new(row, editable))\n fire_row_inserted(index, row)\n end",
"def insert(idx, row)\n order_check(row)\n super\n end",
"def jump_rows(row)\n @rows+=row\n set RGhost::Cursor.jump_rows(row)\n end",
"def add_back_row(color, row)\n backrow = [Rook, Knight, Bishop, Queen, King, Bishop, Knight, Rook]\n backrow.map.with_index { |piece, column| piece.new(color, [row, column]) }\n end",
"def insert_column(col_index=0)\n validate_workbook\n validate_nonnegative(col_index)\n increase_columns(col_index)\n\n old_index = col_index > 0 ? col_index-1 : col_index+1\n old_col = @cols[get_cols_index(old_index)]\n if old_index == 1\n old_col = nil\n end\n\n #go through each cell in column\n @sheet_data.each_with_index do |r,i|\n #insert \"column\" in each row\n r.insert(col_index, nil)\n\n #copy styles over to each cell\n old_cell = r[old_index]\n unless old_cell.nil?\n #only add cell if style exists, not copying content\n if old_cell.style_index != 0\n if !old_col.nil? && old_cell.style_index.to_s != old_col[:attributes][:style].to_s\n c = Cell.new(self,i,col_index)\n c.style_index = old_cell.style_index\n @sheet_data[i][col_index] = c\n end\n end\n end\n end\n\n #copy over column-level styles\n new_col = change_cols(get_cols_index(old_index),old_index)\n @cols[-1] = deep_copy(old_col)#-1 = last\n\n new_col = @cols.last\n if @cols.last.nil?\n @cols.pop\n end\n\n #shift col styles 'right'\n @cols.each do |col|\n if Integer(col[:attributes][:min]) > col_index\n col[:attributes][:min] = (1 + Integer(col[:attributes][:min])).to_s\n end\n if Integer(col[:attributes][:max]) > col_index\n col[:attributes][:max] = (1 + Integer(col[:attributes][:max])).to_s\n end\n end\n unless new_col.nil?\n new_col[:attributes][:min] = (1 + Integer(new_col[:attributes][:min])).to_s\n new_col[:attributes][:max] = (1 + Integer(new_col[:attributes][:max])).to_s\n end\n\n #update column numbers\n @sheet_data.each do |row|\n (col_index+1).upto(row.size) do |j|\n unless row[j].nil?\n row[j].column += 1\n end\n end\n end\n end",
"def move_down(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't move the final element in the list down any further\n\t\tif src == @styles.size-1\n\t\t\tsrc = index\n\t\t\tdst = index + 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def insert_worksheet(index = 0, options = {})\n worksheet = Worksheet.new(self, options)\n @worksheets.delete_at(@worksheets.size - 1)\n @worksheets.insert(index, worksheet)\n yield worksheet if block_given?\n worksheet\n end",
"def set_form_row\n r,c = rowcol\n @rows_panned ||= 0\n \n #win_row=@form.window.top\n win_row=@win_top # 2010-02-11 15:12 RFED16\n win_row = 0 # 2010-02-07 21:44 now ext offset added by widget\n #win_row = 0 # new approach, we have it \n #win_col=@form.window.left\n # added 1 ?? in copywin too 2010-02-11 18:51 RFED16 this results in extra in normal situations.\n row = win_row + r + (@current_index-@toprow) + @rows_panned \n $log.debug \" #{@name} LIST set_form_row #{row} = ci #{@current_index} + r #{r} + winrow: #{win_row} - tr:#{@toprow} #{@toprow} + rowsp #{@rows_panned} \"\n $log.debug \" - LIST set_form_row row_offset: #{@row_offset} + r #{r} + ci - topr + rowsp: #{@rows_panned}. c= #{c} \"\n\n ## 2009-12-28 23:05 TRYING OUT but i really can't do this everywhere. BUFFERED\n ## this needs to percolate up a heirarchy.\n ## 2010-01-05 21:09 changed c to nil, since c is not cursor col pos but where printing starts, i think\n #@form.setrowcol row, nil\n #setformrowcol row, nil\n setrowcol row, nil\n show_caret_func\n end",
"def before_table_row(table_row)\n return if skip_current_step?\n @current_row = []\n @failure_printed = false\n @current_table << @current_row\n end",
"def build_row(letter, index)\n row_template.dup.tap do |row|\n row[index] = letter\n row.concat(row.reverse[1..-1])\n end\n end",
"def scroll_forward\n #@oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def row(options = {}, &block)\n raise StandardError.new('row called within row block') if @in_row\n\n @in_row = true\n @col_offset = @col_start\n options = change_row(options || {})\n\n @row_cell_options = @base_cell_options.merge(options)\n\n fill_cells(@row_offset, @col_offset)\n\n # skip placeholders when starting a new row.\n if @data[@row_offset]\n while @data[@row_offset][@col_offset] == :span_placeholder\n @col_offset += 1\n end\n end\n\n yield if block_given?\n\n @in_row = false\n @row_offset += 1\n @row_cell_options = nil\n end",
"def scroll_forward\n @oldindex = @current_index\n @current_index += @scrollatrows\n @prow = @current_index - @scrollatrows\n end",
"def move_to_position(index, scope = {})\n insert_at(self.parent, index, scope)\n end",
"def ensure_visible row = @current_index\n unless is_visible? row\n @prow = row\n end\n end",
"def add_row\n @rows += 1\n @current_cards.push [@deck.removeAny, @deck.removeAny, @deck.removeAny]\n end",
"def place_row(color, i)\n @grid[i].each_with_index do |el, j|\n case j\n when 0\n el << Rook.new(color, [i, j], self)\n when 1\n el << Knight.new(color, [i, j], self)\n when 2\n el << Bishop.new(color, [i, j], self)\n when 3\n el << Queen.new(color, [i, j], self)\n when 4\n el << King.new(color, [i, j], self)\n when 5\n el << Bishop.new(color, [i, j], self)\n when 6\n el << Knight.new(color, [i, j], self)\n when 7\n el << Rook.new(color, [i, j], self)\n end\n end\n end",
"def add_row( new_row, pos=@table.size)\n @table.insert(pos, new_row)\n end",
"def insert_row!(*args)\r\n after, before = nil, nil\r\n opts = (Hash === args.last || Numeric === args.last) ? args.pop : {}\r\n case opts\r\n when Numeric\r\n before = opts\r\n when Hash\r\n after = opts[:after]\r\n before = opts[:before]\r\n end\r\n input = args.flatten\r\n \r\n # get input column count and assign default headers\r\n init_blank_headers!(input.size) if headers.empty?\r\n \r\n # pad or truncate row based on headers\r\n input = normalized_columns(input)\r\n unless after or before\r\n @data += input\r\n else\r\n if after\r\n after = [after, row_count].min\r\n @data.insert( [index_of_next_row_start(after), @data.size].min, *input)\r\n end\r\n if before\r\n before = [before, row_count].min\r\n @data.insert(index_of_row_start(before), *input)\r\n end\r\n end\r\n \r\n init_caches!\r\n self\r\n end",
"def add_row(pos)\n start = pos[:at].to_i\n count = pos[:count].to_i\n rows.each do |row|\n row.position += count if row.position >= start\n end\n count.times { rows.new(position: pos[:at]) }\n saved = rows.collect {|row| row.save }\n saved.all?\n end",
"def ensure_visible row = @current_index\n unless is_visible? row\n @prow = @current_index\n end\n end",
"def pick_row(index)\n raise ArgumentError, 'Argument (: index) is out of range' unless index < @rows\n @grid[index]\n end",
"def change_row_fill(row=0,rgb='ffffff')\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n Color.validate_color(rgb)\n if @row_styles[(Integer(row)+1).to_s].nil?\n @row_styles[(Integer(row)+1).to_s] = {}\n @row_styles[(Integer(row)+1).to_s][:style] = '0'\n end\n\n @row_styles[(Integer(row)+1).to_s][:style] = modify_fill(@workbook,Integer(@row_styles[(Integer(row)+1).to_s][:style]),rgb)\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n c.change_fill(rgb)\n end\n end\n end",
"def add_style(style)\n self.raw_style ||= {}\n\n new_style = Axlsx.hash_deep_merge(raw_style, style)\n\n all_edges = [:top, :right, :bottom, :left]\n\n if !raw_style[:border].nil? && !style[:border].nil?\n border_at = (raw_style[:border][:edges] || all_edges) + (style[:border][:edges] || all_edges)\n new_style[:border][:edges] = border_at.uniq.sort\n elsif !style[:border].nil?\n new_style[:border] = style[:border]\n end\n\n self.raw_style = new_style\n\n wb = row.worksheet.workbook\n\n wb.styled_cells << self\n end",
"def row(row, by)\n by.times { @display[row].unshift @display[row].pop }\n self\n end",
"def goto_prev_selection\n return if selected_rows().length == 0 \n row = selected_rows().sort{|a,b| b <=> a}.find { |i| i < @obj.current_index }\n row ||= @obj.current_index\n #@obj.current_index = row\n @obj.goto_line row\n end",
"def insert_at(data, index)\n\t\t@current_node = at(index)\n\t\t@insert_node = Node.new(data, @current_node)\n\n\t\t#Handeling the case that user inserts a node at head position (even though prepend exists for that)\n\t\tif @current_node != @head\n\t\t\t@old_link_node = at(index - 1)\n\t\t\t@old_link_node.next_node = @insert_node\n\t\telse\n\t\t\t@head = @insert_node\n\t\tend\n\tend",
"def get_model_row(row)\n new_row = [].concat(row)\n size = row.size\n (0..size - 1).each do |i|\n cell = row[i]\n\n next unless cell.has_attribute?('colspan')\n\n colspan = cell.get_attribute('colspan').to_i\n\n next unless colspan > 1\n\n (1..colspan - 1).each do |j|\n new_row.insert(i + j, cell)\n end\n end\n new_row\n end",
"def add_row(row, mark: false)\n row.transform_keys!(&:as_sym)\n # Make sure there is a column for each known header and each new key\n # present in row.\n new_heads = row.keys - headers\n new_heads.each do |h|\n # This column is new, so it needs nil items for all prior rows lest\n # the value be added to a prior row.\n items = Array.new(size, nil)\n columns << Column.new(header: h, items: items, tolerant: tolerant_col?(h))\n end\n headers.each do |h|\n # NB: This adds a nil if h is not in row.\n column(h) << row[h]\n end\n self\n end",
"def cursor_up(wrap = false)\n if row == 0\n process_up\n else\n super\n end\n end",
"def row(index)\n end",
"def ensure_cell_exists(row_index, column_index = 0)\n validate_nonnegative(row_index)\n validate_nonnegative(column_index)\n\n sheet_data.rows[row_index] || add_row(row_index)\n end",
"def insert_at(position = 1)\n move_to_child_with_index(parent, position - 1)\n end",
"def endRow; @row + @height - 1; end",
"def insert_before(index, *items)\n items.reverse.each do |item|\n self.insert(index, item)\n end\n self\n end",
"def insert_at(node, index)\n target = self.at(index)\n target_prev = target.prev\n set_next_and_prev(target_prev, node)\n set_next_and_prev(node, target)\n self.size += 1\n end",
"def add_row\n unless @current_row.nil?\n # Add the row to the puzzle.\n @puzzle << @current_row\n # And clear the row.\n @current_row = nil\n end\n end",
"def increase_rows(row)\n @sheet_data.size.upto(row) do\n @sheet_data << Array.new(@sheet_data[0].size)\n end\n end",
"def move_bucket(position)\n log(:move_bucket) do\n bucket.update(:row_order_position => position)\n end\n\n bucket\n end",
"def on_enter_row arow\n super\n # TODO check if user wants focus to be showed\n ## this results in the row being entered and left being evaluated and repainted\n # which means that the focussed row can be bolded. The renderer's +render+ method will be triggered\n if @should_show_focus\n fire_row_changed @oldindex\n fire_row_changed arow\n end\n end",
"def row_position=(position)\n @row_position = position \n end",
"def insert_at(index)\n if index < 0 || index >= @size\n return nil\n end\n\n next_to_last = nil\n new_node = nil\n if index == 0\n return prepend\n elsif index == @size-1\n return append\n else\n search_index = @head\n index.times {|i|\n if i == index - 1\n next_to_last = search_index\n end\n search_index = search_index.next_node\n }\n new_node = Node.new\n next_to_last.next_node = new_node\n new_node.next_node = search_index\n end\n @size += 1\n new_node\n end",
"def insert_at(value, index)\n prev = self.at(index - 1)\n next_node = prev.next_node\n prev.next_node = Node.new(value, next_node)\n end",
"def row( index )\n Row.new( self, index )\n end",
"def move_row(pos)\n from = pos[:from].to_i\n dest = pos[:dest].to_i\n moving = nil\n\n # Moving down\n if dest > from\n rws = rows.where(position: from..dest)\n rws.each do |row|\n if row.position == from\n moving = row\n moving.position = -1\n else\n row.position -= 1\n end\n end\n moving.position = dest\n\n # Moving up\n else\n rws = rows.where(position: dest..from)\n rws.each do |row|\n if row.position == from\n moving = row\n moving.position = -1\n else\n row.position += 1\n end\n end\n moving.position = dest\n end\n\n saved = rws.map(&:save)\n saved.all?\n end",
"def insert_before(idx: nil, callable: nil, &block)\n insert(idx: idx, callable: callable, adjust: 1, &block)\n end",
"def goto_row(row)\n \n set RGhost::Cursor.goto_row(row) \n end",
"def insert_at(index)\n at(index)\n temp = @current_node.next\n blankNode = Node.new('Inserted Node')\n @current_node.next = blankNode\n blankNode.next = temp\n end",
"def reset_to_new_row\n self.row = Row.new\n self.state = NEW_ROW\n self.cur_family = nil\n self.cur_qaul = nil\n self.cur_ts = nil\n self.cur_val = nil\n self.cur_labels = nil\n end",
"def append_row!(*args)\r\n insert_row!(*args)\r\n end",
"def insert_at(inode, index)\n return nil if index < 1 || index > size\n\n prev_node = get_prev_node(index) unless index == 1\n\n if index > 1\n inode.next = prev_node.next\n\n prev_node.next = inode\n\n self.size += 1\n else\n prepend(inode)\n end\n\n inode\n end",
"def goto_last_position\n return unless @oldrow\n @current_index = @oldrow\n bounds_check\n end",
"def ensure_cell_exists(row_index, column_index = 0)\n validate_nonnegative(row_index)\n validate_nonnegative(column_index)\n\n row = sheet_data.rows[row_index] || add_row(row_index)\n end",
"def get_row_from_index(index)\n (index - 1) / 8 + 1\n end",
"def new_row cell_values = []\n r = Workbook::Row.new(cell_values, self)\n r\n end",
"def insert_column(column_index = 0)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n old_range = cols.get_range(column_index)\n\n #go through each cell in column\n sheet_data.rows.each_with_index { |row, row_index|\n old_cell = row[column_index]\n c = nil\n\n if old_cell && old_cell.style_index != 0 &&\n old_range && old_range.style_index != old_cell.style_index then\n\n c = RubyXL::Cell.new(:style_index => old_cell.style_index, :worksheet => self,\n :row => row_index, :column => column_index,\n :datatype => RubyXL::DataType::SHARED_STRING)\n end\n\n row.insert_cell_shift_right(c, column_index)\n }\n\n cols.insert_column(column_index)\n\n # TODO: update column numbers\n end",
"def go_to_next_row()\n turn_left()\n move()\n turn_left()\n end",
"def set_focus_on arow\n @oldrow = @current_index\n @current_index = arow\n bounds_check if @oldrow != @current_index\n end",
"def set_position(index)\n first_item_position = board.tasks.by_status(self.status)[index].position\n insert_at(first_item_position)\n end",
"def bump(index, position = 1)\n @items.insert(position-1, @items.delete_at(index.to_i-1))\n save\n @items[position.to_i-1]\n end",
"def add(piece, index)\n @board.each_with_index do |row, position|\n if (row[index] != \"\\u26b3\") || (position == 5)\n row[index] == \"\\u26b3\" ? row[index] = piece : @board[position-1][index] = piece\n break\n end\n end\n end",
"def insert_at_index(index, value)\n new_node = Node.new(value)\n if index.zero?\n new_node.next_node = first_node\n self.first_node = new_node\n else\n current_node = first_node\n current_index = 0\n while current_index < (index - 1)\n current_node = current_node.next_node\n current_index += 1\n end\n new_node.next_node = current_node.next_node\n current_node.next_node = new_node\n end\n end",
"def select_additionally(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n Native.RunEditor_select_additionally(@handle.ptr, index)\n end",
"def place_pawn_first_rows\n 8.times { |col| self[[1, col]] = Pawn.new(self, :black, [1, col]) }\n 8.times { |col| self[[6, col]] = Pawn.new(self, :white, [6, col]) }\n end",
"def add_pawn_row(color, row)\n pawn_row = []\n 8.times { |column| pawn_row << Pawn.new(color, [row, column]) }\n pawn_row\n end",
"def next_row\n @current_row += 1\n end",
"def previous_row num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier)\n @oldrow = @current_index\n # NOTE that putting a multiplier inside, prevents an event from being triggered for each row's\n # on leave and on enter\n num.times { \n @current_index -= 1 if @current_index > 0\n }\n bounds_check\n $multiplier = 0\n end",
"def insert(result)\n # puts \"insert called with #{result}\"\n tabindex = Marshal.dump(@state)\n if @table[tabindex].has_key?(result)\n @table[tabindex][result] += 1\n else\n @table[tabindex][result] = 1\n end\n # puts \"table #{@table.inspect}\"\n next_state(result)\n end",
"def set_row(row, height = nil, format = nil, hidden = 0, level = 0, collapsed = 0)\n record = 0x0208 # Record identifier\n length = 0x0010 # Number of bytes to follow\n\n colMic = 0x0000 # First defined column\n colMac = 0x0000 # Last defined column\n # miyRw; # Row height\n irwMac = 0x0000 # Used by Excel to optimise loading\n reserved = 0x0000 # Reserved\n grbit = 0x0000 # Option flags\n # ixfe; # XF index\n\n return if row.nil?\n\n # Check that row and col are valid and store max and min values\n return -2 if check_dimensions(row, 0, 0, 1) != 0\n\n # Check for a format object\n if format.kind_of?(Format)\n ixfe = format.get_xf_index\n else\n ixfe = 0x0F\n end\n\n # Set the row height in units of 1/20 of a point. Note, some heights may\n # not be obtained exactly due to rounding in Excel.\n #\n unless height.nil?\n miyRw = height *20\n else\n miyRw = 0xff # The default row height\n height = 0\n end\n\n # Set the limits for the outline levels (0 <= x <= 7).\n level = 0 if level < 0\n level = 7 if level > 7\n\n @outline_row_level = level if level > @outline_row_level\n\n # Set the options flags.\n # 0x10: The fCollapsed flag indicates that the row contains the \"+\"\n # when an outline group is collapsed.\n # 0x20: The fDyZero height flag indicates a collapsed or hidden row.\n # 0x40: The fUnsynced flag is used to show that the font and row heights\n # are not compatible. This is usually the case for WriteExcel.\n # 0x80: The fGhostDirty flag indicates that the row has been formatted.\n #\n grbit |= level\n grbit |= 0x0010 if collapsed != 0\n grbit |= 0x0020 if hidden != 0\n grbit |= 0x0040\n grbit |= 0x0080 unless format.nil?\n grbit |= 0x0100\n\n header = [record, length].pack(\"vv\")\n data = [row, colMic, colMac, miyRw, irwMac, reserved, grbit, ixfe].pack(\"vvvvvvvv\")\n\n # Store the data or write immediately depending on the compatibility mode.\n if @compatibility != 0\n @row_data[row] = header + data\n else\n append(header, data)\n end\n\n # Store the row sizes for use when calculating image vertices.\n # Also store the column formats.\n @row_sizes[row] = height\n @row_formats[row] = format unless format.nil?\n end",
"def skip_rows!\n if skip > 0\n local_copy.in_place :tail, \"+#{skip + 1}\"\n end\n end",
"def on_enter_row arow\n return nil if @list.nil? || @list.size == 0\n\n @repaint_footer_required = true\n\n ## can this be done once and stored, and one instance used since a lot of traversal will be done\n require 'canis/core/include/ractionevent'\n aev = TextActionEvent.new self, :ENTER_ROW, current_value().to_s, @current_index, @curpos\n fire_handler :ENTER_ROW, aev\n end",
"def show_focus_on_row row0, _prow, tf=true\n # color = tf ? $reversecolor : $datacolor\n # if cursor on row, reverse else normal\n attr = tf ? Ncurses::A_REVERSE : Ncurses::A_NORMAL\n color = @color_pair\n r = row0+1 \n #check if row is selected or not\n row_att = @list_attribs[_prow] unless @list_attribs.nil?\n if !row_att.nil?\n status = row_att.fetch(:status, \" \")\n attr1 = row_att[:bgcolor] \n color = attr1 unless attr1.nil?\n end\n @datawidth ||= @width-2\n return if r > get_content().length\n @form.window.mvchgat(y=r+@row, x=1+@col, max=@datawidth, attr, color, nil)\n end",
"def winsertln\n Ncurses.winsertln(pointer)\n end",
"def right_click_table_row(table, row_index)\n append_to_script \"right_click_table_row \\\"#{table}\\\" , \\\"#{row_index}\\\"\"\n end",
"def change_row_underline(row=0, underlined=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified underline settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_row_font(row, Worksheet::UNDERLINE, underlined, font, xf_id)\n end",
"def add_header_row(sheet, initial_values)\n header_row_style = sheet.styles.add_style sz: 12, b: true, alignment: { wrap_text: true, horizontal: :center, vertical: :center }, border: { style: :thin, color: '00000000' }\n header_row = initial_values\n header_row += (1..@active_procurement_buildings.count).map { |x| \"Building #{x}\" }\n\n sheet.add_row header_row, style: header_row_style, height: standard_row_height\n end",
"def update_head_vertical_location(row)\n locate_head[0] = row\n end",
"def drop_left\n tbl = self.class.new(\n 'Columns' => Array.new(self.rows.count+1,' '),\n 'Header' => self.header,\n 'Indent' => self.indent)\n (self.columns.count+1).times do |ti|\n row = self.rows.map {|r| r[ti]}.unshift(self.columns[ti]).flatten\n # insert our col|row break. kind of hackish\n row[1] = \"| #{row[1]}\" unless row.all? {|e| e.nil? || e.empty?}\n tbl << row\n end\n return tbl\n end",
"def insert_before(index, *args, **_arg2, &block); end",
"def insert_at(value, index)\n if index == 0\n prepend(value)\n elsif index >= self.size\n append(value)\n else\n prev = nil\n cur = head\n i = 0\n until i == index\n prev = cur\n cur = cur.next_node\n i += 1\n end\n prev.next_node = Node.new(value, cur)\n end\n end",
"def insert_at(element, index)\n return insert_at_trailer(element) if index == size\n raise(StandardError, 'IndexError') if invalid_index?(index)\n return insert_at_header(element) if normalize_index(index).zero?\n\n node = find_node_by_index(index)\n do_insert_between_nodes(element, node.prev, node)\n end",
"def insert_column(column_index = 0)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n old_range = cols.get_range(column_index)\n\n #go through each cell in column\n sheet_data.rows.each_with_index { |row, row_index|\n old_cell = row[column_index]\n c = nil\n\n if old_cell && old_cell.style_index != 0 &&\n old_range && old_range.style_index != old_cell.style_index then\n\n c = RubyXL::Cell.new(:style_index => old_cell.style_index, :worksheet => self,\n :row => row_index, :column => column_index,\n :datatype => RubyXL::DataType::SHARED_STRING)\n end\n\n row.insert_cell_shift_right(c, column_index)\n }\n\n cols.insert_column(column_index)\n\n # TODO: update column numbers\n end",
"def insert_at(index,data)\n return nil if @head.nil? || index > self.size - 1\n if index == 0\n self.prepend(data)\n elsif index == self.size - 1\n self.append(data)\n else\n new_node = Node.new(data)\n current_node = @head\n prev_node = nil\n index.times do\n prev_node,current_node = current_node,current_node.next\n end\n end\n new_node.next,prev.next = current_node,new_node \n end",
"def insert_at(index, value)\n node = Node.new\n node.value = value\n counter = 0\n current_node = @head\n until counter == index\n previous_node = current_node\n current_node = current_node.next_node\n counter += 1\n end\n previous_node.next_node = node\n node.next_node = current_node\n end",
"def insert_at(value, index)\n current = @head\n (index - 1).times do\n current = current.next_node\n end\n\n current.next_node = Node.new(value, current.next_node)\n \n end",
"def insert_rows( before, number=1 )\n @data = @data.insert( ( col_index( before ) - 1 ), *Array.new( number, [nil] ) )\n calc_dimensions\n end",
"def insert_at(value, index)\n node = Node.new\n node.value = value\n curr = head\n return (@head = node) if index.zero?\n\n index.downto(2) do |_|\n break if curr.next.nil?\n\n curr = curr.next\n end\n node.next = curr.next\n curr.next = node\n head\n end",
"def step\n @seed.text = @row.cells\n \n @canvas.append do\n image width, CELL_HEIGHT do\n @row.draw(self)\n end\n end\n @canvas.scroll_top = @canvas.scroll_max\n \n @row = @row.next\n end",
"def create_workbook\n @p.use_autowidth = true\n w = @p.workbook\n w.use_autowidth\n ws = ''\n w.styles do |s|\n blue_cell = s.add_style(\n :bg_color => \"B0C4DE\", \n :fg_color => \"00\", :sz => 11, \n :alignment =>{:horixontal => :center}, \n :font_name => 'Calibri', \n :border => Axlsx::STYLE_THIN_BORDER\n )\n #I want to modify the header so it prints better, but I don't want to modify the original array\n wh = @excel_row.map do |e| e.dup end\n w.add_worksheet(:name => \"Pacbio Read Stats\") do |sheet|\n sheet.add_row wh, :style => blue_cell\n ws = sheet\n end\n \n end\n ws\nend"
] |
[
"0.77728134",
"0.73713225",
"0.6821091",
"0.6818492",
"0.6501642",
"0.634587",
"0.6271167",
"0.61997044",
"0.60979337",
"0.5912466",
"0.5892402",
"0.5857722",
"0.58378756",
"0.5727148",
"0.56885797",
"0.55677676",
"0.55555385",
"0.5530888",
"0.54023814",
"0.538178",
"0.53795576",
"0.5346343",
"0.5333314",
"0.5300274",
"0.5298088",
"0.52646345",
"0.52592194",
"0.5223774",
"0.5214073",
"0.5199519",
"0.519863",
"0.51697206",
"0.5164928",
"0.51506615",
"0.5130599",
"0.51183325",
"0.507962",
"0.50740445",
"0.5062851",
"0.50533855",
"0.5046394",
"0.5044551",
"0.5039378",
"0.503553",
"0.5033696",
"0.50333714",
"0.5031256",
"0.5012018",
"0.50031716",
"0.49890685",
"0.49869677",
"0.49812922",
"0.4971995",
"0.49662498",
"0.49630237",
"0.4947274",
"0.49312904",
"0.49304956",
"0.49229598",
"0.49223578",
"0.49146315",
"0.49132696",
"0.49107206",
"0.49021342",
"0.48980516",
"0.48976624",
"0.48930958",
"0.48866025",
"0.48859513",
"0.4878495",
"0.48679203",
"0.48645338",
"0.4864007",
"0.48635858",
"0.48591816",
"0.48578712",
"0.4857192",
"0.48502558",
"0.48488146",
"0.48446637",
"0.4835998",
"0.4834591",
"0.48327196",
"0.4816039",
"0.4814737",
"0.4813014",
"0.48091212",
"0.48090932",
"0.48076025",
"0.47974607",
"0.4785094",
"0.4774224",
"0.4774175",
"0.47674587",
"0.4764852",
"0.47472754",
"0.47460476",
"0.47434238",
"0.47431135",
"0.47417542"
] |
0.7339157
|
2
|
Inserts column at +column_index+, pushes everything right, takes styles from column to left NOTE: use of this method will break formulas which reference cells which are being "pushed right"
|
def insert_column(column_index = 0)
validate_workbook
ensure_cell_exists(0, column_index)
old_range = cols.get_range(column_index)
#go through each cell in column
sheet_data.rows.each_with_index { |row, row_index|
old_cell = row[column_index]
c = nil
if old_cell && old_cell.style_index != 0 &&
old_range && old_range.style_index != old_cell.style_index then
c = RubyXL::Cell.new(:style_index => old_cell.style_index, :worksheet => self,
:row => row_index, :column => column_index,
:datatype => RubyXL::DataType::SHARED_STRING)
end
row.insert_cell_shift_right(c, column_index)
}
cols.insert_column(column_index)
# TODO: update column numbers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_column(col_index=0)\n validate_workbook\n validate_nonnegative(col_index)\n increase_columns(col_index)\n\n old_index = col_index > 0 ? col_index-1 : col_index+1\n old_col = @cols[get_cols_index(old_index)]\n if old_index == 1\n old_col = nil\n end\n\n #go through each cell in column\n @sheet_data.each_with_index do |r,i|\n #insert \"column\" in each row\n r.insert(col_index, nil)\n\n #copy styles over to each cell\n old_cell = r[old_index]\n unless old_cell.nil?\n #only add cell if style exists, not copying content\n if old_cell.style_index != 0\n if !old_col.nil? && old_cell.style_index.to_s != old_col[:attributes][:style].to_s\n c = Cell.new(self,i,col_index)\n c.style_index = old_cell.style_index\n @sheet_data[i][col_index] = c\n end\n end\n end\n end\n\n #copy over column-level styles\n new_col = change_cols(get_cols_index(old_index),old_index)\n @cols[-1] = deep_copy(old_col)#-1 = last\n\n new_col = @cols.last\n if @cols.last.nil?\n @cols.pop\n end\n\n #shift col styles 'right'\n @cols.each do |col|\n if Integer(col[:attributes][:min]) > col_index\n col[:attributes][:min] = (1 + Integer(col[:attributes][:min])).to_s\n end\n if Integer(col[:attributes][:max]) > col_index\n col[:attributes][:max] = (1 + Integer(col[:attributes][:max])).to_s\n end\n end\n unless new_col.nil?\n new_col[:attributes][:min] = (1 + Integer(new_col[:attributes][:min])).to_s\n new_col[:attributes][:max] = (1 + Integer(new_col[:attributes][:max])).to_s\n end\n\n #update column numbers\n @sheet_data.each do |row|\n (col_index+1).upto(row.size) do |j|\n unless row[j].nil?\n row[j].column += 1\n end\n end\n end\n end",
"def insert_column(column_index = 0)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n old_range = cols.get_range(column_index)\n\n #go through each cell in column\n sheet_data.rows.each_with_index { |row, row_index|\n old_cell = row[column_index]\n c = nil\n\n if old_cell && old_cell.style_index != 0 &&\n old_range && old_range.style_index != old_cell.style_index then\n\n c = RubyXL::Cell.new(:style_index => old_cell.style_index, :worksheet => self,\n :row => row_index, :column => column_index,\n :datatype => RubyXL::DataType::SHARED_STRING)\n end\n\n row.insert_cell_shift_right(c, column_index)\n }\n\n cols.insert_column(column_index)\n\n # TODO: update column numbers\n end",
"def move_right(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == array.first.length - 1) ? 0 : @current_col + 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def addcol num\n return if @col.nil? || @col == -1\n @col += num\n @window.wmove @row, @col\n ## 2010-01-30 23:45 exchange calling parent with calling this forms setrow\n # since in tabbedpane with table i am not gietting this forms offset. \n setrowcol nil, col\n end",
"def endCol; @col + @width - 1; end",
"def move_column(pos)\n from = pos[:from].to_i\n dest = pos[:dest].to_i\n\n # Moving right\n if dest > from\n rws = columns.where(position: from..dest)\n rws.each do |col|\n if col.position == from\n moving = col\n moving.position = -1\n else\n col.position -= 1\n end\n end\n moving.position = dest\n\n # Moving left\n else\n rws = columns.where(position: dest..from)\n rws.each do |col|\n if col.position == from\n moving = col\n moving.position = -1\n else\n col.position += 1\n end\n end\n moving.position = dest\n end\n\n saved = rws.map(&:save)\n saved.all?\n end",
"def cursor_right(wrap = false)\n if col_max >= 2 && (index % col_max == col_max - 1)\n select(index + 1 - col_max)\n elsif col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?))\n select((index + 1) % item_max)\n end\n end",
"def move_to_column(x); puts \"\\e[#{x}F\" end",
"def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end",
"def addcol num\n if num < 0\n if @form.col <= @col + @col_offset\n # $log.debug \" error trying to cursor back #{@form.col}\"\n return -1\n end\n elsif num > 0\n if @form.col >= @col + @col_offset + @width\n # $log.debug \" error trying to cursor forward #{@form.col}\"\n return -1\n end\n end\n @form.addcol num\n end",
"def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def column_next direction=0\n # right movement or panning cycles back to first column\n # leftward movement stops at first column.\n if direction == 0\n @stact += @grows\n @stact = 0 if @stact >= @vps\n @cursor += @grows\n # 2019-03-18 - zero loses offset. we need to maintain it\n # @cursor = 0 if @cursor >= @vps\n if @cursor - @sta >= @vps\n @cursor -= @grows while @cursor > @sta\n @stact -= @grows while @stact > 0\n @cursor += @grows if @cursor < @sta\n @stact += @grows if @stact < 0\n end\n else\n @stact -= @grows\n @cursor -= @grows\n @stact = 0 if @stact < 0\n # setting cursor as zero loses the position or offset\n # We are trying to maintain offset\n @cursor += @grows if @cursor < 0\n end\nend",
"def draw_right_column(node)\n node = Node.new(EMPTY_CELL, node) unless left_column_drawn?\n end_line_with(node)\n end",
"def rotate_right!\n new_pixels = []\n 0.upto(width - 1) { |i| new_pixels += column(i).reverse }\n replace_canvas!(height, width, new_pixels)\n end",
"def add_column(col, pos=nil)\n i = pos.nil? ? max_y : pos\n if headers \n column_names.insert(i, col.shift)\n end\n @rows.each do |row|\n row.insert(i, col.shift)\n end\n end",
"def col\n horizontals_push; alignments_reset ; widths_reset\n end",
"def turn_right\n new_row_diff = @col_diff + 0\n new_col_diff = 0 - @row_diff\n @row_diff = new_row_diff\n @col_diff = new_col_diff\n end",
"def cursor_right(wrap)\n if @index % 10 < 9\n @index += 1\n elsif wrap\n @index -= 9\n end\n end",
"def increase_columns(column)\n @sheet_data.each do |r|\n r.size.upto(column) do\n r << nil\n end\n end\n end",
"def add_column(pos)\n start = pos[:at].to_i\n count = pos[:count].to_i\n columns.each do |column|\n column.position += count if column.position >= start\n end\n count.times { columns.new(position: pos[:at]) }\n saved = columns.collect {|column| column.save }\n saved.all?\n end",
"def merge_columns(prune_count)\n prune_count = columns.size if prune_count > columns.size\n return unless prune_count > 0\n prune_count.times do\n break unless columns.size > 1\n dying_column = columns.pop\n previous_sibling = columns.last\n dying_column.move_boxes_to(previous_sibling)\n dying_column.destroy\n end\n end",
"def cursor_right(wrap = true)\n if col_max >= 2 && (index < item_max - 1 || (wrap && horizontal?))\n select((index + 1) % item_max)\n @item_window.category = current_symbol if @item_window\n end\n end",
"def move_forward\n Proc.new { | spaces | \"#{ @column }#{ forward( spaces ) }\" }\n end",
"def column(data_index = nil, options = nil, html_options = nil, &block)\n @columns << Column.new(data_index, options, html_options, &block)\n end",
"def shift_right\n self.unshift(self.pop)\n end",
"def rotate_column(x,num)\n col_cells = @cells.select {|c| c.x == x}\n new_cells = col_cells.map {|c| c.rotate(0,num)}\n @cells.subtract(col_cells)\n @cells.merge(new_cells)\n end",
"def to_col(pos)\n\t (1..@cols).include?(pos) ? pos - 1 : nil\n\tend",
"def col_right\n if @col_right.nil?\n @col_right = container.div(:class, 'a-col-right')\n end\n\n @col_right\n end",
"def move_right\n for i in 0...@array.size\n if (i + 1) % XSIZE == 0\n v = @array.delete_at(i)\n yield v if block_given?\n @array.insert(i - XSIZE + 1, v)\n end\n end\n end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def addrowcol row,col\n return if @col.nil? or @col == -1 # contradicts comment on top\n return if @row.nil? or @row == -1\n @col += col\n @row += row\n @window.wmove @row, @col\n \n end",
"def drop_left\n tbl = self.class.new(\n 'Columns' => Array.new(self.rows.count+1,' '),\n 'Header' => self.header,\n 'Indent' => self.indent)\n (self.columns.count+1).times do |ti|\n row = self.rows.map {|r| r[ti]}.unshift(self.columns[ti]).flatten\n # insert our col|row break. kind of hackish\n row[1] = \"| #{row[1]}\" unless row.all? {|e| e.nil? || e.empty?}\n tbl << row\n end\n return tbl\n end",
"def set_column(*args)\n data = args\n cell = data[0]\n\n # Check for a cell reference in A1 notation and substitute row and column\n if cell =~ /^\\D/\n data = substitute_cellref(*args)\n\n # Returned values $row1 and $row2 aren't required here. Remove them.\n data.shift # $row1\n data.delete_at(1) # $row2\n end\n\n return if data.size < 3 # Ensure at least $firstcol, $lastcol and $width\n return if data[0].nil? # Columns must be defined.\n return if data[1].nil?\n\n # Assume second column is the same as first if 0. Avoids KB918419 bug.\n data[1] = data[0] if data[1] == 0\n\n # Ensure 2nd col is larger than first. Also for KB918419 bug.\n data[0], data[1] = data[1], data[0] if data[0] > data[1]\n\n # Limit columns to Excel max of 255.\n data[0] = ColMax - 1 if data[0] > ColMax - 1\n data[1] = ColMax - 1 if data[1] > ColMax - 1\n\n @colinfo.push(data)\n\n # Store the col sizes for use when calculating image vertices taking\n # hidden columns into account. Also store the column formats.\n #\n firstcol, lastcol, width, format, hidden = data\n\n width ||= 0 # Ensure width isn't undef.\n hidden ||= 0\n width = 0 if hidden > 1 # Set width to zero if col is hidden\n\n (firstcol .. lastcol).each do |col|\n @col_sizes[col] = width\n @col_formats[col] = format unless format.nil?\n end\n end",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def column_next dir=0\n if dir == 0\n $stact += $grows\n $stact = 0 if $stact >= $viewport.size\n else\n $stact -= $grows\n $stact = 0 if $stact < 0\n end\nend",
"def move(column, type)\n if column <1 || column > @columns\n return false\n elsif @slots[column - 1].length >= @rows\n return false\n else \n @slots[column-1].push type\n return true\n end\n end",
"def col_down\n slice_by_rows\n transpose\n self\n end",
"def right_col offset, &block\n bounding_box(\n [bounds.right-right_width, bounds.top - offset], :width => right_width\n ) do\n yield\n end\n end",
"def move_right\n @memory_position += 1\n @memory_position = 0 if @memory_position > 0xfffffe\n end",
"def insert_col!(*args)\r\n after, before = nil, nil\r\n opts = (Hash === args.last || Numeric === args.last) ? args.pop : {}\r\n case opts\r\n when Numeric\r\n before = opts\r\n when Hash\r\n name = opts[:name]\r\n after = opts[:after]\r\n before = opts[:before]\r\n else\r\n after = col_count\r\n end\r\n #TODO lookup after, before if not Numeric\r\n input = args.flatten\r\n \r\n if @data.empty? && !input.empty?\r\n col_init!(input, name)\r\n else\r\n \r\n # pad or truncate column based on row count\r\n input = normalized_rows(input) \r\n \r\n if after\r\n col_insert_after!(after, input, name)\r\n end \r\n if before\r\n col_insert_before!(before, input, name)\r\n end\r\n \r\n end\r\n \r\n self\r\n end",
"def move_right\n\t\tmove([1,0])\n\tend",
"def insert_row(row_index=0)\n validate_workbook\n validate_nonnegative(row_index)\n\n increase_rows(row_index)\n\n @sheet_data.insert(row_index,Array.new(@sheet_data[row_index].size))\n\n row_num = row_index+1\n\n #copy cell styles from row above, (or below if first row)\n @sheet_data[row_index].each_index do |i|\n if row_index > 0\n old_cell = @sheet_data[row_index-1][i]\n else\n old_cell = @sheet_data[row_index+1][i]\n end\n\n unless old_cell.nil?\n #only add cell if style exists, not copying content\n\n if @row_styles[(row_num+1).to_s].nil?\n @row_styles[(row_num+1).to_s] = {:style=>0}\n end\n if old_cell.style_index != 0 && old_cell.style_index.to_s != @row_styles[(row_num+1).to_s][:style].to_s\n c = Cell.new(self,row_index,i)\n c.style_index = old_cell.style_index\n @sheet_data[row_index][i] = c\n end\n end\n end\n\n #copy row styles from row above, (or below if first row)\n (@row_styles.size+1).downto(row_num+1) do |i|\n @row_styles[i.to_s] = @row_styles[(i-1).to_s]\n end\n if row_index > 0\n @row_styles[row_num.to_s] = @row_styles[(row_num-1).to_s]\n else\n @row_styles[row_num.to_s] = nil#@row_styles[(row_num+1).to_s]\n end\n\n #update row value for all rows below\n (row_index+1).upto(@sheet_data.size-1) do |i|\n row = @sheet_data[i]\n row.each do |c|\n unless c.nil?\n c.row += 1\n end\n end\n end\n\n return @sheet_data[row_index]\n end",
"def column(index)\n cells.each_with_index.map{|cell,i| cell if i%9==index}.compact\n end",
"def move_right\n right_tile = C[@location.first, @location.second + 1]\n move_to(right_tile)\n end",
"def column_backspace(row1,row2,col)\n\t\tif col == 0 then return end\n\t\tsc = bc2sc(@row,col)\n\t\tfor r in row1..row2\n\t\t\tc = sc2bc(r,sc)\n\t\t\tif @text[r].length == 0 then next end\n\t\t\tif c<=0 then next end\n\t\t\t@text[r] = @text[r].dup\n\t\t\t@text[r][c-1] = \"\"\n\t\tend\n\t\tcursor_left\n\tend",
"def align_column colindex, lrc\n raise ArgumentError, \"wrong alignment value sent\" if ![:right, :left, :center].include? lrc\n @calign[colindex] ||= lrc\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", nil, lrc)\n else\n @chash[colindex].align = lrc\n end\n @chash\n end",
"def add_piece(column, symbol) #todo: extract position finding ?\n position = grid[column].inject { |memo, space| memo > space.to_i ? memo : space }\n available_index = grid[column].index(position)\n grid[column][available_index] = symbol\n end",
"def column(index)\n end",
"def cursor_backward\n if @curpos > 0\n @curpos -= 1\n #if @pcol > 0 #and @form.col == @col + @col_offset\n #@pcol -= 1\n #end\n addcol -1\n elsif @pcol > 0 \n # pan left only when cursor pos is 0\n @pcol -= 1 \n end\n # $log.debug \" crusor back cp:#{@curpos} pcol:#{@pcol} b.l:#{@buffer.length} d_l:#{@display_length} fc:#{@form.col}\"\n=begin\n# this is perfect if not scrolling, but now needs changes\n if @curpos > 0\n @curpos -= 1\n addcol -1\n end\n=end\n end",
"def cover_column(column)\n column.right.left = column.left\n column.left.right = column.right\n\n i = column.down\n loop do\n break if i == column\n\n j = i.right\n loop do\n break if j == i\n\n j.down.up = j.up\n j.up.down = j.down\n j.column.size -= 1\n\n j = j.right\n end\n\n i = i.down\n end\n end",
"def move_down(index)\n\t\traise ArgumentError, \"Can not move the primary Style\" if index == 0\n\t\traise IndexError, \"Indices must be positive natural numbers.\" if index < 0\n\t\t\n\t\t\n\t\t# can't move the final element in the list down any further\n\t\tif src == @styles.size-1\n\t\t\tsrc = index\n\t\t\tdst = index + 1\n\t\t\t\n\t\t\tswap(@styles, src, dst)\n\t\tend\n\tend",
"def move_right\n @board.each(&:reverse!)\n action = move_left\n @board.each(&:reverse!)\n action\n end",
"def insert_columns(add_count)\n add_count.times do\n new_column = self.columns.create(:jivepage => jivepage)\n new_column.create_box!(\"textblock\", 1, \n :content => \"Click here to change text.\") if new_column.first?\n end\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 calculate_column(index)\n index % 9\n end",
"def move_to(row, col)\n @row, @col = wrap(row, col)\n end",
"def build_column(start_column = nil)\n if block_given?\n raise StandardError.new('build_column block called within row block') if @in_row\n raise StandardError.new('build_column called without valid argument') unless start_column.is_a?(Numeric)\n\n backup_col_start = @col_start\n backup_col_offset = @col_offset\n backup_row_offset = @row_offset\n @col_start = start_column.to_i\n @col_offset = @col_start\n @row_offset = 0\n\n yield\n\n @col_start = backup_col_start\n @col_offset = backup_col_offset\n @row_offset = backup_row_offset\n end\n @col_start\n end",
"def action_column(options={}, &block)\n self.current_column_number += 1\n\n case mode\n when :counter\n self.number_of_columns ||= 0\n self.number_of_columns += 1\n nil\n when :header\n options = { :align => :left }\n if self.current_column_number == 1\n options[:class] = 'first'\n elsif self.current_column_number == self.number_of_columns\n options[:class] = 'last'\n end\n\n @template.haml_tag :th, options do\n @template.haml_concat I18n.t(:'link.actions')\n end\n when :content\n td_options = options[:td_options] || {}\n td_options[:class] = td_options[:class].to_a || []\n td_options[:class] << 'actions'\n @template.haml_tag :td, td_options do\n @template.haml_tag :ul, :class => 'actions' do\n @template.haml_concat @template.capture_haml(&block)\n end\n end\n end\n end",
"def move_right\n right_tile = Couple.new(@location.first, @location.second + 1)\n move_to(right_tile)\n end",
"def column(matrix, col_index)\n (0...matrix.size).inject([]) do |column, row_index|\n column << matrix[row_index][col_index]\n end\nend",
"def reset_column(from=g_from_direction)\n to = opposite_position(from)\n reset_float\n mixin({\n width: 'auto',\n \"margin-#{to}\" => auto\n })\n end",
"def draw_left_column(node)\n right_adjusted_text = node.to_s.rjust(CELL_WIDTH)\n @output.print right_adjusted_text\n @left_column_drawn = true\n end",
"def justify_columns(options={})\n right_justified_columns = options[:right_justify] || []\n widths = self.map do |column|\n column.map{|entry| entry.to_s.size}.max\n end\n justified = []\n self.each_with_index do |column, column_number|\n if right_justified_columns.include?(column_number)\n justified << column.map{|entry| \"%*s\" % [widths[column_number], entry] }\n elsif column_number < self.size-1\n justified << column.map{|entry| \"%-*s\" % [widths[column_number], entry] }\n else\n justified << column\n end\n end\n justified\n end",
"def add_column_key(key)\n\t\tself.google_doc.restart_session_if_necessary #TODO do we actually need to do these?\n\t\treset_worksheet_obj if @worksheet_obj == nil\n\t\t@worksheet_obj[1, num_keys+1] = key\n\t\t@worksheet_obj.save\n\tend",
"def new_rook_column\n king_side = 5\n queen_side = 3\n column == 6 ? king_side : queen_side\n end",
"def setrowcol r, c\n # aha ! here's where i can check whether the cursor is falling off the viewable area\n if c+@cols_panned < @orig_left\n # this essentially means this widget (button) is not in view, its off to the left\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} < #{@orig_left} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n if c+@cols_panned > @orig_left + @display_w\n # this essentially means this button is not in view, its off to the right\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} > #{@orig_left} + #{@display_w} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n super r+@rows_panned, c+@cols_panned\n end",
"def column!( column )\n columns && Mtx.synchronize { @columns << column }\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def column!(j)\n if block_given?\n (0...row_size).collect { |i| @rows[i][j] = yield @rows[i][j] }\n else\n column(j)\n end\n end",
"def move_left(array)\r\n set_current_row_col(array)\r\n new_col = (@current_col == 0) ? array.first.length - 1 : @current_col - 1 # This logic will decide the new co-ordinated of space\r\n current_ele = array[@current_row][new_col]\r\n array[@current_row][new_col] = ' '\r\n replace_existing_element(array,current_ele, @current_row, @current_col)\r\n array\r\n end",
"def move(line, column = T.unsafe(nil)); end",
"def move(line, column = T.unsafe(nil)); end",
"def cell_column(row, column, reader = true)\n return \"r#{row}_c#{column}\" if reader\n\n \"r#{row}_c#{column}=\"\n end",
"def inject_col(n_times, from_col, src_array, direction)\n case direction\n when 0\n add_col(1, from_col, src_array, -1)\n add_col(n_times-1, from_col, src_array, 0) unless n_times-1 > 0\n when -1\n add_col(1, from_col, src_array, 0)\n add_col(n_times-1, from_col, src_array, -1) unless n_times-1 > 0\n else\n raise ArgumentError, 'Argument number (#{args.size}) is wrong'\n end\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 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 get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"def column_of( x )\n @left_column + x\n end",
"def column_of( x )\n @left_column + x\n end",
"def column(position)\n ConsoleGlitter.escape(\"#{position}G\")\n end",
"def OLDsetrowcol r, c\n $log.debug \" SCROLL setrowcol #{r}, #{c} + #{@cols_panned}\"\n # aha ! here's where i can check whether the cursor is falling off the viewable area\n cc = nil\n rr = nil\n if c\n cc = c #+ @cols_panned\n if c+@cols_panned < @orig_left\n # this essentially means this widget (button) is not in view, its off to the left\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} < #{@orig_left} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n if c+@cols_panned > @orig_left + @display_w\n # this essentially means this button is not in view, its off to the right\n $log.debug \" setrowcol OVERRIDE #{c} #{@cols_panned} > #{@orig_left} + #{@display_w} \"\n $log.debug \" aborting settrow col for now\"\n return\n end\n end\n if r\n rr = r+@rows_panned\n end\n super rr, cc\n end",
"def update_head_horizontal_location(column)\n locate_head[1] = column\n end",
"def insert_columns( before, number=1 )\n a = Array.new( number, nil )\n before = col_index( before ) - 1\n @data.map! { |row| row.insert( before, *a ) }\n calc_dimensions\n end",
"def move_down_right\n i = 1\n until false\n x, y = @pos\n x += i\n y += i\n pos = [x, y]\n break if x > 7 || x < 0 || y > 7 || y < 0 || @board[pos].color == @color\n @moves << pos\n break if @board[pos].color != @color\n i += 1\n end\n end",
"def add_column(table_name, column_name, type, options = {})\n add_column_sql = \"ALTER TABLE #{quote_table_name(table_name)} ADD #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n add_column_options!(add_column_sql, options)\n begin\n execute(add_column_sql)\n rescue\n raise unless non_existent_domain_error?\n create_boolean_domain\n execute(add_column_sql)\n end\n if options[:position]\n # position is 1-based but add 1 to skip id column\n alter_position_sql = \"ALTER TABLE #{quote_table_name(table_name)} ALTER COLUMN #{quote_column_name(column_name)} POSITION #{options[:position] + 1}\"\n execute(alter_position_sql)\n end\n end",
"def move_to(row = nil, column = nil)\n return CSI + 'H' if row.nil? && column.nil?\n CSI + \"#{column + 1};#{row + 1}H\"\n end",
"def cursor_left(wrap = false)\n if col_max >= 2 && (index % col_max == 0)\n select(index - 1 + col_max)\n elsif col_max >= 2 && (index > 0 || (wrap && horizontal?))\n select((index - 1 + item_max) % item_max)\n end\n end",
"def get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"def rotate_column(a, b, screen)\n column = []\n screen.each { |row| column << row[a] }\n\n edge = column.pop(b)\n column.unshift(edge)\n column.flatten!\n\n screen.each_with_index do |row, i|\n row[a] = column[i]\n end\n\n screen\nend",
"def column(index)\n columns[index]\n end",
"def ListView_InsertColumn(hwnd, iCol, pcol)\n send_listview_message(hwnd, :INSERTCOLUMN, wparam: iCol, lparam: pcol)\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"
] |
[
"0.7456166",
"0.7036691",
"0.59061456",
"0.59035003",
"0.5833103",
"0.5710718",
"0.5678746",
"0.5587918",
"0.55842537",
"0.55572724",
"0.5536212",
"0.5529086",
"0.5527865",
"0.5526873",
"0.5511202",
"0.54889226",
"0.5446902",
"0.5417679",
"0.5413551",
"0.5408778",
"0.5407602",
"0.5295398",
"0.5276095",
"0.5275975",
"0.5240348",
"0.5224271",
"0.52061486",
"0.51277035",
"0.51071274",
"0.5101913",
"0.5062613",
"0.50475425",
"0.50475425",
"0.50475425",
"0.5045575",
"0.5043072",
"0.5026622",
"0.5022902",
"0.5022902",
"0.5022902",
"0.500493",
"0.49987108",
"0.49895036",
"0.49860385",
"0.49847668",
"0.49811244",
"0.49772006",
"0.49716836",
"0.49635172",
"0.4961824",
"0.49453393",
"0.49255767",
"0.49231735",
"0.49111456",
"0.49010232",
"0.487943",
"0.48686513",
"0.48431274",
"0.48333877",
"0.48333877",
"0.48318118",
"0.48272753",
"0.48098248",
"0.48086378",
"0.48026025",
"0.47930497",
"0.47824645",
"0.4782337",
"0.47819626",
"0.4775828",
"0.4773497",
"0.47577667",
"0.47555482",
"0.47500587",
"0.47449785",
"0.473572",
"0.4716127",
"0.4716127",
"0.47088772",
"0.4708387",
"0.47050363",
"0.47050363",
"0.47050363",
"0.47048068",
"0.47035277",
"0.47035253",
"0.47035253",
"0.469427",
"0.4690284",
"0.4683906",
"0.4681996",
"0.4679813",
"0.46772975",
"0.46668044",
"0.4660041",
"0.4653776",
"0.46431556",
"0.46424508",
"0.4635319",
"0.46306732"
] |
0.6948869
|
2
|
Get raw column width value as stored in the file
|
def get_column_width_raw(column_index = 0)
validate_workbook
validate_nonnegative(column_index)
range = cols.locate_range(column_index)
range && range.width
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def column_width\n return @column_width\n end",
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def width\n @columns * @block_size\n end",
"def width\n metadata[:width] if valid?\n end",
"def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end",
"def value_width\n @width\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def column_width=(value)\n @column_width = value\n end",
"def column_widths\n []\n end",
"def get_width; end",
"def width(path)\n io_for(path).width\n end",
"def width\n source_node[:width].to_i\n end",
"def width\n @source.width\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def getWidth\n @width\n end",
"def getWidth\n @width\n end",
"def getWidth\n @width\n end",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def getWidth\n @width\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def width\r\n has_width? ? parms[0].to_i : 0\r\n end",
"def width\n @width\n end",
"def width\n size.last\n end",
"def width\n size.last\n end",
"def width\n attr('width')\n end",
"def column_size; end",
"def getWidth\n @width\n end",
"def width\n\t\t\t\t\t@image.base_columns\n\t\t\t\tend",
"def column_width colindex, width=:NONE\n if width == :NONE\n #return @cw[colindex]\n return get_column(colindex).width\n end\n @_skip_columns[colindex] = true ## don't calculate col width for this.\n get_column(colindex).width = width\n self\n end",
"def width\n return @width\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end",
"def column\n Vedeu.width / 12\n end",
"def column\n Vedeu.width / 12\n end",
"def width\n rmagick_image.columns\n end",
"def width\n dimensions.first\n end",
"def width\n\t\tnode['width']\n\tend",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def getWidth\n\t\t@width\n\tend",
"def width\n cols\n end",
"def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end",
"def columns\n IO.console.winsize.last\n end",
"def width\n self.size[:x]\n end",
"def get_col_widths()\n w_name = 0\n w_serial = 0\n\n $devices[:connected].each { |dev|\n next if dev[:disabled]\n next if not is_selected(dev)\n\n l_name = dev[:name].length\n w_name = l_name if l_name > w_name\n\n if $verbose\n l_serial = dev[:serial].length\n w_serial = l_serial if l_serial > w_serial\n end\n }\n\n if $verbose\n return [ w_name, w_serial + 1 ]\n end\n return w_name\nend",
"def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end",
"def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end",
"def width\n size_a[0]\n end",
"def column_width\n @level_order.inject(0) do |width_, level_|\n w_ = level_.name.size\n w_ > width_ ? w_ : width_\n end\n end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def column_size\n @delegate.getColSize\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def width\n dimensions()[:x]\n end",
"def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n unless @col_sizes[col].nil?\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n return (width *12).to_i\n else\n return (width *7 +5 ).to_i\n end\n else\n return 64\n end\n end",
"def contents_width\n width - standard_padding * 2\n end",
"def width_str\r\n has_width? ? parms[0] : \"\"\r\n end",
"def width\n end",
"def width\n end",
"def for_file(file)\n io_string_for(file).dimensions\n end",
"def widthcell\n 10\n end",
"def width\n return nil unless @width ## this is required otherwise checking for nil will fail\n if @width < 0\n return ( FFI::NCurses.COLS + @width ) - self.col + 1\n end\n @width\n end",
"def image_width\n\t\t\t@data[\"image\"][\"width\"]\n\t\tend",
"def width=(_); end",
"def width=(_); end",
"def columns; IO.console.winsize[1] rescue 80; end",
"def width\n @x1 - @x0\n end",
"def length\n length = width\n end",
"def width\n begin\n (@num_cols.to_i) * (@col_width.to_i + @gutter.to_i)\n rescue\n 0\n end\n end",
"def width\n chars.inject(0) { |length, char| length + (char.bytesize == 1 ? 1 : 2) }\n end",
"def width\n @dimensions.x\n end",
"def width\n barcode.encoding.length * xdim\n end",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def width=(_arg0); end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def pixelwidth\n end",
"def header_length\n @header_length ||= DBF_HEADER_SIZE + columns.size * 32 + 1\n end",
"def width\n @ole.Width\n end",
"def width\n @ole.Width\n end",
"def width\n self.class.width\n end",
"def width\n @width || Vedeu.width\n end",
"def width\n raise NotImplementedError\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def size\n @record.send( :\"#{@column}_size\" ) rescue -1\n end",
"def get_column_width(column_index = 0)\n width = get_column_width_raw(column_index)\n return RubyXL::ColumnRange::DEFAULT_WIDTH if width.nil?\n (width - (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)).round\n end",
"def max_col\n [(@opts.width - 32) / char_width, @max_char].min\n end",
"def cell_width\n @cell_width ||= @doc.bounds.right / 7\n end",
"def num_cols()\n return self[0].length\n end",
"def base_width; 26 + @width; end",
"def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end",
"def col_max\n [(self.width - padding * 2) / 96, 1].max\n end",
"def width\n bounds.right\n end"
] |
[
"0.71662885",
"0.70062655",
"0.68812126",
"0.6791667",
"0.6709167",
"0.67076576",
"0.66874766",
"0.6671525",
"0.66001284",
"0.65530646",
"0.6510749",
"0.6504935",
"0.64883566",
"0.6456142",
"0.6432641",
"0.6432641",
"0.6424143",
"0.6420093",
"0.64200306",
"0.6419416",
"0.6390006",
"0.6380638",
"0.63699377",
"0.63699377",
"0.636939",
"0.63654584",
"0.63645965",
"0.6360363",
"0.63583493",
"0.6331595",
"0.6273266",
"0.62575966",
"0.62575966",
"0.625521",
"0.6228992",
"0.6216868",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.62072694",
"0.61936677",
"0.61816216",
"0.6176825",
"0.6170558",
"0.61465687",
"0.61440104",
"0.6140892",
"0.61223346",
"0.61122966",
"0.6082883",
"0.60696954",
"0.6054938",
"0.6054106",
"0.6035565",
"0.6028765",
"0.60076165",
"0.6003784",
"0.59992826",
"0.59992826",
"0.5998943",
"0.5997912",
"0.59866977",
"0.5985865",
"0.59841865",
"0.59841865",
"0.59423137",
"0.59319955",
"0.5930775",
"0.59275323",
"0.5926252",
"0.59033805",
"0.5902049",
"0.5900648",
"0.5900648",
"0.5900648",
"0.5897072",
"0.58656764",
"0.5862116",
"0.5860792",
"0.5851082",
"0.5851082",
"0.5848408",
"0.5839683",
"0.5839192",
"0.5835171",
"0.5835171",
"0.5832951",
"0.5827895",
"0.5826341",
"0.58151126",
"0.5769251",
"0.57688934",
"0.5764132",
"0.5745644",
"0.5741384"
] |
0.72390014
|
0
|
Get column width measured in number of digits, as per
|
def get_column_width(column_index = 0)
width = get_column_width_raw(column_index)
return RubyXL::ColumnRange::DEFAULT_WIDTH if width.nil?
(width - (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)).round
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def column_width\n return @column_width\n end",
"def width\n begin\n (@num_cols.to_i) * (@col_width.to_i + @gutter.to_i)\n rescue\n 0\n end\n end",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def width\n @columns * @block_size\n end",
"def column_width(n=0)\n sg = 0\n if n.zero?\n n = g_total_cols\n sg = g_side_gutter_width\n end\n (n*g_col_width) + ((n - 1)*g_gutter_width).ceil + (sg*2)\n end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def column_width\n @level_order.inject(0) do |width_, level_|\n w_ = level_.name.size\n w_ > width_ ? w_ : width_\n end\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def width\n cols\n end",
"def text_column_width\n (width - (columns - 1) * gutter_width) / columns\n end",
"def column_width=(value)\n @column_width = value\n end",
"def column_widths\n []\n end",
"def column_widths\n @column_widths ||= transposed.map do |value_array|\n largest_width_in_column = value_array.flatten.map { |entry| entry.to_s.length }.max\n [[largest_width_in_column, max_width].min, min_width].max\n end\n end",
"def widthcell\n 10\n end",
"def get_col_widths()\n w_name = 0\n w_serial = 0\n\n $devices[:connected].each { |dev|\n next if dev[:disabled]\n next if not is_selected(dev)\n\n l_name = dev[:name].length\n w_name = l_name if l_name > w_name\n\n if $verbose\n l_serial = dev[:serial].length\n w_serial = l_serial if l_serial > w_serial\n end\n }\n\n if $verbose\n return [ w_name, w_serial + 1 ]\n end\n return w_name\nend",
"def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n unless @col_sizes[col].nil?\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n return (width *12).to_i\n else\n return (width *7 +5 ).to_i\n end\n else\n return 64\n end\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def get_column_width_raw(column_index = 0)\n validate_workbook\n validate_nonnegative(column_index)\n\n range = cols.locate_range(column_index)\n range && range.width\n end",
"def get_width; end",
"def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end",
"def width\n chars.inject(0) { |length, char| length + (char.bytesize == 1 ? 1 : 2) }\n end",
"def cell_width\n @cell_width ||= @doc.bounds.right / 7\n end",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def width\n rmagick_image.columns\n end",
"def columns; IO.console.winsize[1] rescue 80; end",
"def width\n dimensions()[:x]\n end",
"def column_count(string)\n Math.sqrt(string.length).ceil\nend",
"def columns\n IO.console.winsize.last\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def value_width\n @width\n end",
"def column_size; end",
"def width(as: :units)\n if as == :mm\n widest_row = rows.max_by{|row| row.keys.last.row_offset + row.keys.last.width}\n\n (widest_row.keys.last.row_offset + widest_row.keys.last.width) * unit_width\n else\n rows.max_by{|row| row.keys.length}.keys.length\n end\n end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end",
"def calc_width(col, colspan, length, width)\n if @scale.empty?\n width = \"#{100*length/width}%\"\n else\n warr = @scale[col,colspan]\n if warr.length == 1\n if warr[0] == 'auto'\n return nil\n else\n return warr[0]\n end\n elsif warr.include?('auto') or warr.include?('')\n return nil # auto is html default \n else\n ws = 0\n apercentage = false\n afixedwidth = false\n warr.each do |w|\n ws += w.to_i\n if w[-1,1] == '%'\n apercentage = true\n else\n afixedwidth = true\n end\n end\n if apercentage and afixedwidth\n return nil # both kinds unreconcilable\n elsif apercentage and not afixedwidth\n return \"#{ws}%\"\n else\n return \"#{ws}\"\n end\n end\n end\n return nil # should never get here, but just in case\n end",
"def column\n Vedeu.width / 12\n end",
"def column\n Vedeu.width / 12\n end",
"def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end",
"def column_size\n @delegate.getColSize\n end",
"def column_width colindex, width=:NONE\n if width == :NONE\n #return @cw[colindex]\n return get_column(colindex).width\n end\n @_skip_columns[colindex] = true ## don't calculate col width for this.\n get_column(colindex).width = width\n self\n end",
"def width\n @dimensions.x\n end",
"def width\n\t\t\t\t\t@image.base_columns\n\t\t\t\tend",
"def width\n self.size[:x]\n end",
"def minimum_width\n table.columns_size * MIN_WIDTH + border_size\n end",
"def calculate_width( features )\n width, gaps = 0, 0\n features.each do |feature|\n if feature.feature_name == \"gap\"\n gaps += @gap_width\n else\n width += feature.width ? feature.width : 0\n end\n end\n width = ( width + gaps ) + 1\n return width.to_i\n end",
"def column_numbers_string\n normalize_widths = (1..@width).to_a.map do |num|\n # If the column number is 1 digit, put a space in front of it\n if num > 9\n num.to_s\n else\n \" \" + num.to_s\n end\n end\n normalize_widths.join('|')\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def width\n theWidth = 0\n @theLines.each { |l| theWidth = l.length if l.length > theWidth }\n theWidth\n end",
"def width\n @width\n end",
"def width\n string = to_s\n max_width = 0\n string.each_line do |line|\n max_width = [max_width, line.uncolored.chomp.size].max\n end\n max_width\n end",
"def width\n return @width\n end",
"def getWidth\n @width\n end",
"def getWidth\n @width\n end",
"def width\n return nil unless @width ## this is required otherwise checking for nil will fail\n if @width < 0\n return ( FFI::NCurses.COLS + @width ) - self.col + 1\n end\n @width\n end",
"def terminal_width\n if ENV['THOR_COLUMNS']\n result = ENV['THOR_COLUMNS'].to_i\n else\n result = unix? ? dynamic_width : 80\n end\n (result < 10) ? 80 : result\n rescue\n 80\n end",
"def width\n size.last\n end",
"def width\n size.last\n end",
"def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end",
"def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end",
"def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end",
"def getWidth\n @width\n end",
"def width\n length * xdim\n end",
"def width\n length * xdim\n end",
"def length_of_column n\n length_of_largest_cell_in_column n \n end",
"def width\n end",
"def width\n end",
"def getWidth\n @width\n end",
"def num_cols()\n return self[0].length\n end",
"def output_cols\n return 80 unless @output.tty?\n terminal.terminal_size.first\n rescue NoMethodError\n return 80\n end",
"def base_width; 26 + @width; end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def getWidth\n @width\n end",
"def width\n dimensions.first\n end",
"def my_width \n 0.75\n end",
"def maximum_width\n @factors.flatten.reject(&:nil?).max.to_s.size\n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def column_space(); @column_space; end",
"def width\n @width ||= [title, formatted_values].flatten.map(&:length).max\n end",
"def width\n metadata[:width] if valid?\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def convert_x_to_column(x)\n\t\treturn (((@width-1)/2) + x).round\n\tend",
"def console_col_size\n IO.console.winsize[1]\n end",
"def width\n @x1 - @x0\n end",
"def width\n source_node[:width].to_i\n end"
] |
[
"0.8538969",
"0.83671516",
"0.8016057",
"0.7992989",
"0.79792637",
"0.7836938",
"0.762777",
"0.7625645",
"0.7590127",
"0.75601715",
"0.75453126",
"0.7534604",
"0.7534162",
"0.7403343",
"0.73857796",
"0.7327247",
"0.7291546",
"0.72057295",
"0.70836806",
"0.70370877",
"0.7032207",
"0.6984845",
"0.69742996",
"0.6968458",
"0.69483465",
"0.69434637",
"0.68709743",
"0.68709743",
"0.68709743",
"0.68653274",
"0.68454456",
"0.6843951",
"0.6841003",
"0.68369454",
"0.6825688",
"0.6825688",
"0.6816646",
"0.67882144",
"0.67782706",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67586535",
"0.67529345",
"0.6747037",
"0.6747037",
"0.6739628",
"0.67179644",
"0.67057085",
"0.6703286",
"0.670288",
"0.6685901",
"0.6680154",
"0.66784155",
"0.6671499",
"0.66641736",
"0.66641736",
"0.66559875",
"0.6649518",
"0.664179",
"0.6640625",
"0.66373265",
"0.66373265",
"0.6635077",
"0.66271067",
"0.6612571",
"0.6612571",
"0.66079265",
"0.6593042",
"0.65891755",
"0.65857786",
"0.65838236",
"0.65838236",
"0.6576461",
"0.65764356",
"0.65764356",
"0.65746105",
"0.65625083",
"0.65604144",
"0.65574896",
"0.6555076",
"0.6519908",
"0.65071446",
"0.6495322",
"0.64947534",
"0.6484775",
"0.6476495",
"0.64741886",
"0.647355",
"0.64734614",
"0.6467454",
"0.64664257",
"0.6459309",
"0.6451671"
] |
0.73232603
|
16
|
Set raw column width value
|
def change_column_width_raw(column_index, width)
validate_workbook
ensure_cell_exists(0, column_index)
range = cols.get_range(column_index)
range.width = width
range.custom_width = true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def column_width=(value)\n @column_width = value\n end",
"def change_column_width_raw(column_index, width)\n validate_workbook\n ensure_cell_exists(0, column_index)\n range = cols.get_range(column_index)\n range.width = width\n range.custom_width = true\n end",
"def width(val); @width = val; self; end",
"def width=(width)\n end",
"def width(value)\n model.width = proc { value }\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def width(value)\n @ole.Width = value\n nil\n end",
"def width(value)\n @ole.Width = value\n nil\n end",
"def width(value)\n attributes[:width] = value\n end",
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def column_width colindex, width=:NONE\n if width == :NONE\n #return @cw[colindex]\n return get_column(colindex).width\n end\n @_skip_columns[colindex] = true ## don't calculate col width for this.\n get_column(colindex).width = width\n self\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def width=(value)\n @width = value\n end",
"def width=(value)\n\t\t\t@width = value\n\t\tend",
"def width=(value)\n\t\t\t@width = value\n\t\tend",
"def setwidth(width)\n @width = width\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def width=(width)\n @width = width || 0\n end",
"def width=(width)\n @width = width || 0\n end",
"def column_width\n return @column_width\n end",
"def width=(w)\n @view__.width = w\n end",
"def width=(_); end",
"def width=(_); end",
"def width\n @columns * @block_size\n end",
"def width= w\n\t\t\t@width = w\n\t\t\t@column_width = nil\n\t\t\t@margin_width = nil\n\t\tend",
"def width=(value)\n @style.width = value\n end",
"def column_widths\n []\n end",
"def set_Width(value)\n set_input(\"Width\", value)\n end",
"def value_width\n @width\n end",
"def border_width=(width)\n self.each {|cell| cell.border_width = width}\n end",
"def width=(val)\n super\n fire_dimension_changed :width\n end",
"def auto_adjust_widths\n column_widths = []\n\n rows.each do |row|\n row.columns.each_with_index do |col, i|\n column_widths[i] = [col.required_width, (column_widths[i] || 0)].max\n end\n end\n\n rows.each do |row|\n row.columns.each_with_index do |col, i|\n col.width = column_widths[i]\n end\n end\n end",
"def width=(width)\n @width = width.to_s\n\n setOption('width', @width)\n end",
"def width=(new_width)\n resize_width(new_width)\n end",
"def adjust_column_width\n grouped_columns = group_by{|column| column.width == \"0%\" ? \"without\" : \"with\"};\n with = grouped_columns[\"with\"] || []\n without = grouped_columns[\"without\"] || []\n # origin 5% keeped for selection column width\n used = with.inject(5){|total, column| column.width =~ /(\\d+)%$/ ? total + $1.to_i : total}\n begin\n avg_width = (100 - used) / without.size\n left_width = (100 - used) % without.size\n without.each{|col| col.width = \"#{avg_width}%\"}\n without.last.width = \"#{avg_width + left_width}%\"\n end if not without.empty?\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def ds_width=(width)\n list = (width.is_a?(String) ? ALLOWED_STRING_WIDTHS : ALLOWED_NUMERIC_WIDTHS)\n width = self.class.fetch_or_fallback(list, width, 'two_thirds') if width\n @ds_width_class = if width.is_a?(String)\n \"ds_input--fluid-#{width}\"\n elsif width\n \"ds_input--fixed-#{width}\"\n end\n end",
"def width=(_arg0); end",
"def fit_width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def set_tyre_width(tyre_width)\n\t\t@tyre_width = tyre_width\n\tend",
"def setWidth(width)\n # This exists to deal with an inconsistency in IE's implementation where\n # it won't accept negative numbers in length measurements\n # FIXME: assert extractLengthValue(width.trim().toLowerCase()) >= 0 : \"CSS widths should not be negative\";\n \n DOM.setStyleAttribute(@element, \"width\", width)\n end",
"def widthcell\n 10\n end",
"def width\n end",
"def width\n end",
"def width\n @width\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def get_column_width_raw(column_index = 0)\n validate_workbook\n validate_nonnegative(column_index)\n\n range = cols.locate_range(column_index)\n range && range.width\n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def columns=(integer); end",
"def width(value)\n fail InvalidWidth if x_out_of_bounds?(value)\n\n attributes[:geometry][:width] = value\n end",
"def width\n cols\n end",
"def shrink\n column_size = table.columns_size\n ratio = ((natural_width - renderer.width) / column_size.to_f).ceil\n\n widths = (0...column_size).reduce([]) do |lengths, col|\n width = (renderer.column_widths[col] - ratio)\n # basically ruby 2.4 Numeric#clamp\n width = width < minimum_width ? minimum_width : width\n width = width > renderer.width ? renderer.width : width\n lengths << width\n end\n distribute_extra_width(widths)\n end",
"def setCellWidth(cellContent, width)\n numCharsTooShort = width - cellContent.length\n if numCharsTooShort < 0\n # cellContent is too long, so truncate\n return cellContent[0, [width - 3, 0].max] + '.' * [3, width].min\n else\n # cellContent is requested width or too short, so right-pad with zero or more spaces\n return cellContent + ' ' * numCharsTooShort\n end\n end",
"def ListView_SetColumnWidth(hwnd, iCol, cx)\n send_listview_message(hwnd, :SETCOLUMNWIDTH, wparam: iCol, lparam: MAKELPARAM(cx, 0))\n end",
"def my_width \n 0.75\n end",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def width\n metadata[:width] if valid?\n end",
"def width\n attr('width')\n end",
"def width=(width)\n if width.nil?\n fail ArgumentError, 'invalid value for \"width\", width cannot be nil.'\n end\n @width = width\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def fw; self.fixed_width = true; self; end",
"def autowidth(widtharray)\n return if value.nil?\n\n if styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text\n first = true\n value.to_s.split(/\\r?\\n/, -1).each do |line|\n if first\n first = false\n else\n widtharray << 0\n end\n widtharray[-1] += string_width(line, font_size)\n end\n else\n widtharray[-1] += string_width(value.to_s, font_size)\n end\n widtharray\n end",
"def column_size; end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def fill_col_widths(picklist_column_widths)\n # populate width of dropdown columns by the length of their contents\n @col_widths.each do |category, widths|\n sum = 0\n widths.each_with_index do |w, i|\n if w.nil?\n @col_widths[category][i] = picklist_column_widths.shift\n end\n sum += @col_widths[category][i]\n end\n if category.to_s.length + 2 > sum\n width_factor = (category.to_s.length + 2).to_f / sum.to_f\n widths.each_index do |i|\n @col_widths[category][i] *= width_factor\n end\n end\n end\n end",
"def set_tyre_width(tyre_width)\n\t\tif tyre_width < 57 || tyre_width > 61\n\t\t\traise Exception.new \"Invalid tyre width for MTB\"\n\t\tend\n\t\t@tyre_width = tyre_width\n\tend",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def use_autowidth() @use_autowidth; end",
"def width\n raise NotImplementedError\n end",
"def fix_row_widths\n\n fill_cells(@row_offset - 1, 0)\n\n max = 0\n\n @data.each_with_index do |row|\n max = row.length unless max >= row.length\n end\n\n @data.each_with_index do |row,idx|\n if row.length < max\n row = row + [ @base_cell_options.merge({content: ''}) ] * (max - row.length)\n @data[idx] = row\n end\n end\n\n end",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n if left_aligned?\n value.size\n\n else\n geometry.bordered_width\n\n end\n\n else\n value.size\n\n end\n end",
"def get_width; end",
"def width\n\t\t\t\t\t@image.base_columns\n\t\t\t\tend",
"def width\n if present?(options[:width])\n options[:width]\n\n elsif present?(options[:name])\n geometry.bordered_width\n\n else\n value.size\n\n end\n end",
"def width\n instance.options[:width]\n end",
"def min_width=(min_width)\n @min_width = min_width\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end",
"def width\r\n has_width? ? parms[0].to_i : 0\r\n end",
"def enforce\n assert_minimum_width\n padding = renderer.padding\n\n if natural_width <= renderer.width\n if renderer.resize\n expand_column_widths\n else\n renderer.column_widths.map do |width|\n padding.left + width + padding.right\n end\n end\n else\n if renderer.resize\n shrink\n else\n rotate\n end\n end\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def autowidth\n return if value.nil? || is_formula?\n\n if contains_rich_text?\n string_width('', font_size) + value.autowidth\n elsif styles.cellXfs[style].alignment && styles.cellXfs[style].alignment.wrap_text\n max_width = 0\n value.to_s.split(/\\r?\\n/).each do |line|\n width = string_width(line, font_size)\n max_width = width if width > max_width\n end\n max_width\n else\n string_width(value, font_size)\n end\n end",
"def column_space(); @column_space; end",
"def width=(width)\n if width.nil?\n fail ArgumentError, 'invalid value for \"width\", width cannot be nil.'\n end\n if width < 0\n fail ArgumentError, 'invalid value for \"width\", must be greater than or equal to 0.'\n end\n @width = width\n end",
"def width\n self.class.width\n end",
"def set_tyre_width(tyre_width)\n\t\tif tyre_width < 23 || tyre_width > 30\n\t\t\traise Exception.new \"Invalid tyre width for Road Bike\"\n\t\tend\n\t\t@tyre_width = tyre_width\n\tend",
"def column(c=0)\n percent_width(g_col_width, column_width(c))\n end",
"def width=(width)\n if !width.nil? && width < 0\n fail ArgumentError, 'invalid value for \"width\", must be greater than or equal to 0.'\n end\n\n @width = width\n end",
"def minimum_width\n table.columns_size * MIN_WIDTH + border_size\n end"
] |
[
"0.82118237",
"0.7760171",
"0.7335848",
"0.70408607",
"0.6981075",
"0.69714606",
"0.69631803",
"0.69631803",
"0.6905924",
"0.6892913",
"0.684795",
"0.68434346",
"0.6815215",
"0.6811709",
"0.6811709",
"0.6789892",
"0.6782631",
"0.67724526",
"0.67724526",
"0.6741233",
"0.67393947",
"0.6737807",
"0.6737807",
"0.67004454",
"0.6666101",
"0.66187763",
"0.6585273",
"0.6573457",
"0.6547325",
"0.6503583",
"0.6451537",
"0.64281183",
"0.64211863",
"0.6406153",
"0.6394441",
"0.6367491",
"0.6359074",
"0.63549757",
"0.6313358",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62768626",
"0.62587297",
"0.6230373",
"0.62248546",
"0.620785",
"0.620785",
"0.6197921",
"0.6193373",
"0.61557424",
"0.6155313",
"0.6150099",
"0.6117644",
"0.61174923",
"0.6114873",
"0.6073605",
"0.6053404",
"0.60492617",
"0.6049122",
"0.6049122",
"0.6049122",
"0.6017747",
"0.60157627",
"0.60094637",
"0.5985447",
"0.594024",
"0.59354645",
"0.591929",
"0.59048027",
"0.5891474",
"0.5888911",
"0.5873271",
"0.5869092",
"0.58625007",
"0.5861749",
"0.5857155",
"0.5851169",
"0.5849056",
"0.58436024",
"0.58401895",
"0.5831285",
"0.5827911",
"0.5810922",
"0.5807757",
"0.57843024",
"0.57843024",
"0.57784444",
"0.57529336",
"0.57390076",
"0.5713763",
"0.5693881",
"0.5693362",
"0.5689453",
"0.5687605"
] |
0.77122563
|
2
|
Get column width measured in number of digits, as per
|
def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)
change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def width\n @column_widths.inject(0) { |s,r| s + r }\n end",
"def column_width\n column_headings.values.collect {|l| l.to_s.length}.max + 2\n end",
"def column_width\n return @column_width\n end",
"def width\n begin\n (@num_cols.to_i) * (@col_width.to_i + @gutter.to_i)\n rescue\n 0\n end\n end",
"def width\n return 0 if columns.empty?\n\n columns.size\n end",
"def width\n @columns * @block_size\n end",
"def column_width(n=0)\n sg = 0\n if n.zero?\n n = g_total_cols\n sg = g_side_gutter_width\n end\n (n*g_col_width) + ((n - 1)*g_gutter_width).ceil + (sg*2)\n end",
"def width\n @width ||= (cells.map(&:to_s) << to_s).map(&:size).max\n end",
"def column_width\n @level_order.inject(0) do |width_, level_|\n w_ = level_.name.size\n w_ > width_ ? w_ : width_\n end\n end",
"def column_width n\n column_widths[n] || 0\n end",
"def width\n ensure_complete!\n sum_width = cell_widths.reduce(&:+)\n [param(:width, 0), sum_width].max\n end",
"def natural_width\n renderer.column_widths.inject(0, &:+) + border_size + padding_size\n end",
"def width\n cols\n end",
"def text_column_width\n (width - (columns - 1) * gutter_width) / columns\n end",
"def column_width=(value)\n @column_width = value\n end",
"def column_widths\n []\n end",
"def get_column_width(column_index = 0)\n width = get_column_width_raw(column_index)\n return RubyXL::ColumnRange::DEFAULT_WIDTH if width.nil?\n (width - (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)).round\n end",
"def column_widths\n @column_widths ||= transposed.map do |value_array|\n largest_width_in_column = value_array.flatten.map { |entry| entry.to_s.length }.max\n [[largest_width_in_column, max_width].min, min_width].max\n end\n end",
"def widthcell\n 10\n end",
"def get_col_widths()\n w_name = 0\n w_serial = 0\n\n $devices[:connected].each { |dev|\n next if dev[:disabled]\n next if not is_selected(dev)\n\n l_name = dev[:name].length\n w_name = l_name if l_name > w_name\n\n if $verbose\n l_serial = dev[:serial].length\n w_serial = l_serial if l_serial > w_serial\n end\n }\n\n if $verbose\n return [ w_name, w_serial + 1 ]\n end\n return w_name\nend",
"def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n unless @col_sizes[col].nil?\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n return (width *12).to_i\n else\n return (width *7 +5 ).to_i\n end\n else\n return 64\n end\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def get_column_width_raw(column_index = 0)\n validate_workbook\n validate_nonnegative(column_index)\n\n range = cols.locate_range(column_index)\n range && range.width\n end",
"def get_width; end",
"def width\r\n assert_exists\r\n return @o.invoke(\"width\").to_s\r\n end",
"def width\n chars.inject(0) { |length, char| length + (char.bytesize == 1 ? 1 : 2) }\n end",
"def cell_width\n @cell_width ||= @doc.bounds.right / 7\n end",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def return_a_string_to_max_column_width(string, column_width_as_integer)\n string + \" \" * (column_width_as_integer - string.length)\nend",
"def width\n rmagick_image.columns\n end",
"def columns; IO.console.winsize[1] rescue 80; end",
"def width\n dimensions()[:x]\n end",
"def column_count(string)\n Math.sqrt(string.length).ceil\nend",
"def columns\n IO.console.winsize.last\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def max_width(table_data, col)\n table_data.map do |row|\n Strings.sanitize(row[col].join).lines.map(&:length).max || 0\n end.max\n end",
"def value_width\n @width\n end",
"def column_size; end",
"def width(as: :units)\n if as == :mm\n widest_row = rows.max_by{|row| row.keys.last.row_offset + row.keys.last.width}\n\n (widest_row.keys.last.row_offset + widest_row.keys.last.width) * unit_width\n else\n rows.max_by{|row| row.keys.length}.keys.length\n end\n end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def width; end",
"def cols_len\n (0...column_size).collect {|j| max_len_column(j)}\n end",
"def calc_width(col, colspan, length, width)\n if @scale.empty?\n width = \"#{100*length/width}%\"\n else\n warr = @scale[col,colspan]\n if warr.length == 1\n if warr[0] == 'auto'\n return nil\n else\n return warr[0]\n end\n elsif warr.include?('auto') or warr.include?('')\n return nil # auto is html default \n else\n ws = 0\n apercentage = false\n afixedwidth = false\n warr.each do |w|\n ws += w.to_i\n if w[-1,1] == '%'\n apercentage = true\n else\n afixedwidth = true\n end\n end\n if apercentage and afixedwidth\n return nil # both kinds unreconcilable\n elsif apercentage and not afixedwidth\n return \"#{ws}%\"\n else\n return \"#{ws}\"\n end\n end\n end\n return nil # should never get here, but just in case\n end",
"def column\n Vedeu.width / 12\n end",
"def column\n Vedeu.width / 12\n end",
"def retrieve_terminal_width\n ts = TerminalSize::TerminalSize.new()\n @width = ts.columns - @entry_size - 3\n end",
"def column_size\n @delegate.getColSize\n end",
"def column_width colindex, width=:NONE\n if width == :NONE\n #return @cw[colindex]\n return get_column(colindex).width\n end\n @_skip_columns[colindex] = true ## don't calculate col width for this.\n get_column(colindex).width = width\n self\n end",
"def width\n @dimensions.x\n end",
"def width\n\t\t\t\t\t@image.base_columns\n\t\t\t\tend",
"def width\n self.size[:x]\n end",
"def minimum_width\n table.columns_size * MIN_WIDTH + border_size\n end",
"def calculate_width( features )\n width, gaps = 0, 0\n features.each do |feature|\n if feature.feature_name == \"gap\"\n gaps += @gap_width\n else\n width += feature.width ? feature.width : 0\n end\n end\n width = ( width + gaps ) + 1\n return width.to_i\n end",
"def column_numbers_string\n normalize_widths = (1..@width).to_a.map do |num|\n # If the column number is 1 digit, put a space in front of it\n if num > 9\n num.to_s\n else\n \" \" + num.to_s\n end\n end\n normalize_widths.join('|')\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def terminal_width\n TerminalWidthCalculator.calculate\n end",
"def width\n theWidth = 0\n @theLines.each { |l| theWidth = l.length if l.length > theWidth }\n theWidth\n end",
"def width\n @width\n end",
"def width\n string = to_s\n max_width = 0\n string.each_line do |line|\n max_width = [max_width, line.uncolored.chomp.size].max\n end\n max_width\n end",
"def width\n return @width\n end",
"def getWidth\n @width\n end",
"def getWidth\n @width\n end",
"def width\n return nil unless @width ## this is required otherwise checking for nil will fail\n if @width < 0\n return ( FFI::NCurses.COLS + @width ) - self.col + 1\n end\n @width\n end",
"def terminal_width\n if ENV['THOR_COLUMNS']\n result = ENV['THOR_COLUMNS'].to_i\n else\n result = unix? ? dynamic_width : 80\n end\n (result < 10) ? 80 : result\n rescue\n 80\n end",
"def width\n size.last\n end",
"def width\n size.last\n end",
"def column_size\n first_row = @rows[0]\n if first_row._equal?(nil)\n return 0\n end\n first_row.size\n end",
"def display_width\n @width ||= begin\n require 'curses'\n Curses.init_screen\n x = Curses.cols\n Curses.close_screen\n x\n rescue\n HELP_WIDTH\n end\n @width - HELP_INDENT\n end",
"def get_width\n # FIXME: I don't know how portable it is.\n default_width = 80\n begin\n tiocgwinsz = 0x5413\n data = [0, 0, 0, 0].pack(\"SSSS\")\n if @out.ioctl(tiocgwinsz, data) >= 0 then\n #rows, cols, xpixels, ypixels = data.unpack(\"SSSS\")\n cols = data.unpack(\"SSSS\")[1]\n if cols >= 0 then cols else default_width end\n else\n default_width\n end\n rescue Exception\n default_width\n end\n end",
"def getWidth\n @width\n end",
"def width\n length * xdim\n end",
"def width\n length * xdim\n end",
"def length_of_column n\n length_of_largest_cell_in_column n \n end",
"def width\n end",
"def width\n end",
"def getWidth\n @width\n end",
"def num_cols()\n return self[0].length\n end",
"def output_cols\n return 80 unless @output.tty?\n terminal.terminal_size.first\n rescue NoMethodError\n return 80\n end",
"def base_width; 26 + @width; end",
"def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend",
"def getWidth\n @width\n end",
"def width\n dimensions.first\n end",
"def my_width \n 0.75\n end",
"def maximum_width\n @factors.flatten.reject(&:nil?).max.to_s.size\n end",
"def expand_column_widths\n columns_count = table.columns_count\n max_width = renderer.width\n extra_column_width = ((max_width - natural_width) / columns_count.to_f).floor\n\n widths = (0...columns_count).reduce([]) do |lengths, col|\n lengths << renderer.column_widths[col] + extra_column_width\n end\n distribute_extra_width(widths)\n end",
"def column_space(); @column_space; end",
"def width\n @width ||= [title, formatted_values].flatten.map(&:length).max\n end",
"def width\n metadata[:width] if valid?\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def convert_x_to_column(x)\n\t\treturn (((@width-1)/2) + x).round\n\tend",
"def console_col_size\n IO.console.winsize[1]\n end",
"def width\n @x1 - @x0\n end",
"def width\n source_node[:width].to_i\n end"
] |
[
"0.8538969",
"0.83671516",
"0.8016057",
"0.7992989",
"0.79792637",
"0.7836938",
"0.762777",
"0.7625645",
"0.7590127",
"0.75601715",
"0.75453126",
"0.7534604",
"0.7534162",
"0.7403343",
"0.73857796",
"0.7327247",
"0.73232603",
"0.7291546",
"0.72057295",
"0.70836806",
"0.70370877",
"0.7032207",
"0.6984845",
"0.69742996",
"0.6968458",
"0.69483465",
"0.69434637",
"0.68709743",
"0.68709743",
"0.68709743",
"0.68653274",
"0.68454456",
"0.6843951",
"0.6841003",
"0.68369454",
"0.6825688",
"0.6825688",
"0.6816646",
"0.67882144",
"0.67782706",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67699456",
"0.67586535",
"0.67529345",
"0.6747037",
"0.6747037",
"0.6739628",
"0.67179644",
"0.67057085",
"0.6703286",
"0.670288",
"0.6685901",
"0.6680154",
"0.66784155",
"0.6671499",
"0.66641736",
"0.66641736",
"0.66559875",
"0.6649518",
"0.664179",
"0.6640625",
"0.66373265",
"0.66373265",
"0.6635077",
"0.66271067",
"0.6612571",
"0.6612571",
"0.66079265",
"0.6593042",
"0.65891755",
"0.65857786",
"0.65838236",
"0.65838236",
"0.6576461",
"0.65764356",
"0.65764356",
"0.65746105",
"0.65625083",
"0.65604144",
"0.65574896",
"0.6555076",
"0.6519908",
"0.65071446",
"0.6495322",
"0.64947534",
"0.6484775",
"0.6476495",
"0.64741886",
"0.647355",
"0.64734614",
"0.6467454",
"0.64664257",
"0.6459309",
"0.6451671"
] |
0.0
|
-1
|
Helper method to get the style index for a column
|
def get_col_style(column_index)
range = cols.locate_range(column_index)
(range && range.style_index) || 0
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_col_style(column_index)\n range = cols.locate_range(column_index)\n (range && range.style_index) || 0\n end",
"def get_col_style(col)\n i = get_cols_index(col)\n if @cols[i].nil?\n @workbook.fonts['0'][:count] += 1\n return 0\n else\n return Integer(@cols[i][:attributes][:style])\n end\n end",
"def column_styles\n # [\n # {:name => 'general', :column => 0},\n # {:name => 'general', :column => 1},\n # {:name => 'general', :column => 2}\n #]\n []\n end",
"def column_semantic_color(index, column_index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SplitsComponentState_column_semantic_color(@handle.ptr, index, column_index)\n result\n end",
"def get_cols_index(col)\n i = @cols.size - 1\n\n @cols.reverse_each do |column|\n if col >= (Integer(column[:attributes][:min])-1)\n if col <= (Integer(column[:attributes][:max])-1)\n break\n end\n end\n i -= 1\n end\n if i < 0\n i = @cols.size #effectively nil\n end\n i\n end",
"def column_style(field)\n\t\t\tif defined? @column_style\n\t\t\t\t@column_style[field.to_sym]\n\t\t\tend\n\t\tend",
"def get_col_from_index(idx)\n idx%cols\n end",
"def get_row_style(row)\n if @row_styles[(row+1).to_s].nil?\n @row_styles[(row+1).to_s] = {}\n @row_styles[(row+1).to_s][:style] = '0'\n @workbook.fonts['0'][:count] += 1\n end\n return @row_styles[(row+1).to_s][:style]\n end",
"def column_index(col)\n col.each_codepoint.reduce(0) do |sum, n|\n break sum - 1 if n < A_CODEPOINT # reached a number\n\n sum * 26 + (n - A_CODEPOINT + 1)\n end\n end",
"def column(index)\n end",
"def format idx\n @formats[idx] || @default_format \\\n || @worksheet.column(idx).default_format if @worksheet\n end",
"def column_index(pos)\n i = @column_names.index(pos)\n pos = i.nil? ? pos : i\n \n if pos.is_a?(String) || !(-max_y..max_y).include?(pos)\n raise NoColumnError, \"The column does not exist or the index is out of range\"\n else\n return pos\n end\n end",
"def get_column_index(line, col_name)\n line_ar = (line.is_a? Array) ? line : line.split\n line_ar.find_index(col_name)\nend",
"def column_index(column_constant)\n @headers[COLUMN_HEADERS[column_constant]]\n end",
"def column(index)\n columns[index]\n end",
"def get_rowcol_from_index(index)\n letter = get_col_from_index(index)\n number = get_row_from_index(index)\n \"#{letter}#{number}\"\n end",
"def base_column_for_normal_style(node); end",
"def style\n defined?(@style) ? @style : 0\n end",
"def on_get_item_column_image(i, col)\n -1\n end",
"def index(colour)\r\n index = @colours.index(colour)\r\n index == nil ? index : index + 1\r\n end",
"def method_index_for_columnheader(columnheader)\r\n columnheaders = Array(data_description_sheet.column(0))\r\n columnheaders.collect!{|col| clean_string(col)}.index(columnheader)\r\n end",
"def box_column_index\n\t\t\tcolumn_value / 3 #3 is number of columns in a box\n\t\tend",
"def xf_id(style_index)\n @workbook.get_style_attributes(@workbook.get_style(style_index))\n end",
"def get_col_from_index(index)\n if index % 8 == 0\n return 8\n else\n return index % 8\n end\n end",
"def get_column index\n return @chash[index] if @chash[index]\n # create a new entry since none present\n c = ColumnInfo.new\n c.index = index\n @chash[index] = c\n return c\n end",
"def get_col_from_index(index)\n index % 8 == 0 ? 8 : index % 8\n end",
"def header_row_index\n index(header)\n end",
"def column_index i\n if case_sensitive\n position = indices.find_index {|column| column == i || (@aliases.has_key?(column) && @aliases[column].member?(i))}\n else\n position = indices.find_index {|column| column.downcase == i.to_s.downcase || (aliases.has_key?(column.downcase) && aliases[column.downcase].any? {|the_alias| the_alias.downcase == i.to_s.downcase})}\n end\n\n position ||= (i.kind_of?(Fixnum) ? i : nil)\n end",
"def visual_index\n row = @current_index\n row - @prow\n end",
"def get_index_from_rowcol(row_col)\n offset = @@row_mappings[row_col[0]].to_i\n multiplier = row_col[1].to_i - 1\n return multiplier * 8 + offset\n end",
"def getColumnIndex map,ws\r\n\t#range gives a two dimensional array\r\n\theadLines = ws.range(\"a1:o1\").value[0]\r\n\tmap.each do |key,val|\r\n\t\t#Check if the given column itself exists in the workbook (Ex : CSCRM)\r\n\t\tindex = headLines.index key\r\n\t\tif index\r\n\t\t\tmap[key] = index + 1\r\n\t\telse\r\n\t\t\tkey_alias = $columnNameMap[key]\r\n\t\t\tif key_alias\r\n\t\t\t\t#if the column name alias exists, check for the alias name exists in the worksheet\r\n\t\t\t\tindex = headLines.index key_alias\r\n\t\t\t\tmap[key] = index + 1 if index\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\nend",
"def column(index)\n @columns[index]\n end",
"def rank_of_colour\r\n COLOURS.each_with_index do |colour, i|\r\n if colour == @colour\r\n return i\r\n end\r\n end\r\n raise \"colour not found: #{@colour}\"\r\n end",
"def create_column_and_return_index(file, name)\n col_index=find_col(file, name)\n return col_index if col_index\n i=file[0]&.size\n return nil if !i\n print_warning(file,0,i,name.to_s)\n return i\n end",
"def column_label_to_idx(label)\n @column_attributes.each_with_index do |attr, idx|\n return idx if attr['label'] == label\n end\n\n nil\n end",
"def xf_record_index(row, col, xf=nil)\n if xf.kind_of?(Format)\n return xf.xf_index\n elsif @row_formats.has_key?(row)\n return @row_formats[row].xf_index\n elsif @col_formats.has_key?(col)\n return @col_formats[col].xf_index\n else\n return 0x0F\n end\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def get_citation_style(style)\n style = style.to_s.downcase\n Array.wrap(self['eds_citation_styles']).find { |e|\n return e['data'] if e && e['data'].present? && (e['id'] == style)\n }\n end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def column_for_position(position); end",
"def index_of_position(row, col = 0)\n\t\tline_index(row) + col + 1\n\tend",
"def col\r\n @lines[@line_num].cursor\r\n end",
"def style\n return @style\n end",
"def cell_column(row, column, reader = true)\n return \"r#{row}_c#{column}\" if reader\n\n \"r#{row}_c#{column}=\"\n end",
"def font_id(style_index)\n xf_id(style_index)[:fontId]\n end",
"def find_index(column, row)\n\n # Column 0 is for shelf numbers, so no index.\n return nil if column == 0\n\n # Find shelf number.\n shelf = ((row + 1) / 2.0).ceil\n\n # Return index number.\n if (row % 2 != 0)\n return 3 * (shelf - 1) + 2\n else\n return 3 * (shelf - 1) + (column - 1)\n end\n\n end",
"def header_index_of(value)\n header_cell_values.index(value)\n end",
"def column(id)\n rng_val = rand(100)\n return COLUMN_INDEXES[munchlax?(id)].index { |cell| cell.include?(rng_val) } || 0\n end",
"def xf_attr_row(row)\n row_style = @row_styles[(row+1).to_s][:style]\n return @workbook.get_style_attributes(@workbook.get_style(row_style))\n end",
"def find_column_number_by_name_in_sheet(ws,col_name)\n across = 1\n down = 1\n until ws[down,across] == col_name || down == ws.num_rows\n if(across == 10 ) # ws.num_cols) # max columns in sheet\n across = 1 # reset column index to 1\n down = down + 1 # increment row count\n else\n across = across + 1 # check next column\n end\n end\n if down == ws.num_rows\n raise \"Cannot Find Column #{column_name} in #{ws}\"\n end\n across # i.e. return the column index / failure not an option!\n end",
"def style\n @style\n end",
"def column_index_from_string(s)\n s = s.upcase\n len = s.length\n case\n when len == 1\n (s[0].ord - 64)\n when len == 2\n ((1 + (s[0].ord - 65)) * 26) + (s[1].ord - 64)\n when len == 3\n ((1 + (s[0].ord - 65)) * 676) + ((1 + (s[1].ord - 65)) * 26) + (s[2].ord - 64)\n when len > 3\n raise Xl::ColumnStringIndexError, \"Column string index can't be longer than 3 characters\"\n else\n raise Xl::ColumnStringIndexError, \"Column string index can't be empty\"\n end\n end",
"def column(index)\n index = case index\n when String\n @headers.index(index)\n when Symbol\n @headers.index(index.to_s)\n else\n index\n end\n\n columns[index] if index\n end",
"def get_column(index)\n column = []\n self.rows.times do |i|\n column.push(@state[i][index])\n end\n\n column\n end",
"def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end",
"def column_width colindex, width\n @cw[colindex] ||= width\n if @chash[colindex].nil?\n @chash[colindex] = ColumnInfo.new(\"\", width) \n else\n @chash[colindex].w = width\n end\n @chash\n end",
"def column_index\n @column_index ||= @parent_proxy.send(:next_column_index)\n end",
"def find_last_column color, inimage\n m_begin \"find_last_column\"\n img = get_image(inimage)\n img.columns.times do |col|\n col_excerpt = img.excerpt(col, 0, 1, img.rows)\n col_dot = col_excerpt.scale(1, 1)\n pixelcolor = col_dot.get_pixels(0,0,1,1)[0].red\n if color == :white\n return col-1 if pixelcolor <= White * 0.75\n elsif color == :black\n return col-1 if pixelcolor >= White * 0.75\n else\n raise \"invalid color symbol in find_last_color\"\n end\n end\n nil\n ensure\n m_end \"find_last_column\"\n end",
"def index(heading)\n col = header.index(heading)\n raise \"Heading '#{heading}' not in table.\" if col.nil?\n col\n end",
"def column_index(slot)\n slot % 9\n end",
"def row index\n rows[index / 9]\n end",
"def cassandra_index_cql_name(cf, column)\n \"#{cf.to_s}_#{column.to_s}_idx\"\n end",
"def get_style(attribute)\n `var el=this.__native__,attr=attribute.__value__.replace(/[_-]\\\\D/g, function(match){return match.charAt(1).toUpperCase();}),result=el.style[attr]`\n `result===undefined?nil:$q(result)`\n end",
"def pick_col(index)\n raise ArgumentError, 'Argument (: index) is out of range' unless index < @cols\n buf = []\n @grid.each { |row| \n buf << row[index]\n }\n buf\n end",
"def [](index)\r\n @colours[index]\r\n end",
"def highlight_first_column\n return @highlight_first_column\n end",
"def column(index)\n cells.each_with_index.map{|cell,i| cell if i%9==index}.compact\n end",
"def column(index)\n column_indexes(index).map do |e|\n @input[e]\n end\n end",
"def highlight_last_column\n return @highlight_last_column\n end",
"def get_col(col_index)\n @boggle_board.map {|row| row[col_index]}\n end",
"def styles\n ANSI.constants(false).each_with_object({}) do |col, acc|\n acc[col.to_sym.downcase] = lookup(col)\n acc\n end\n end",
"def column_heading( col_index )\n col_range = @column_ranges[ col_index ]\n return send( @frequency_data[ :column ], col_range )\n end",
"def column_of(range); end",
"def getArrayIndex(row, col)\n index = 0\n case row\n when '1'\n if col == 'A'\n index = 0\n elsif col == 'D'\n index = 1\n else index = 2\n end\n when '2'\n if col == 'B'\n index = 3\n elsif col == 'D'\n index = 4\n else index = 5\n end\n when '3'\n if col == 'C'\n index = 6\n elsif col == 'D'\n index = 7\n else index = 8\n end\n when '4'\n if col == 'A'\n index = 9\n elsif col == 'B'\n index = 10\n elsif col == 'C'\n index = 11\n elsif col == 'E'\n index = 12\n elsif col == 'F'\n index = 13\n else index = 14\n end\n when '5'\n if col == 'C'\n index = 15\n elsif col == 'D'\n index = 16\n else\n index = 17\n end\n when '6'\n if col == 'B'\n index = 18\n elsif col == 'D'\n index = 19\n else\n index = 20\n end\n when '7'\n if col == 'A'\n index = 21\n elsif col == 'D'\n index = 22\n else\n index = 23\n end\n end\n return index\n end",
"def highlighted_tab_index\n @form.widgets.each_with_index{ |w, ix| \n return ix if w.state == :HIGHLIGHTED\n }\n return -1\n end",
"def get_index(position:)\n row = (position - 1) / 3\n col = (position - 1) % 3\n return row, col\n end",
"def to_col(pos)\n\t (1..@cols).include?(pos) ? pos - 1 : nil\n\tend",
"def getindicesColonne(i)\n\t\treturn @indicesColonne[i]\n\tend",
"def get_col(board, column)\n raise ArgumentError.new(\"You can't have a negative column!\") if column < 0\n board.map { |x| x[column] }\nend",
"def box_row_index\n\t\t\tcell / 27 \n\t\tend",
"def col; end",
"def index_for row\n ie = insert_error_for row\n return ie.index if ie\n nil\n end",
"def find_last_white_column inimage\n raise \"deprecated\"\n m_begin \"find_last_white_column\"\n img = get_image(image)\n img.columns.times do |col|\n col_excerpt = img.excerpt(col, 0, 1, img.rows)\n col_dot = col_excerpt.scale(1, 1)\n color = row_dot.get_pixels(0,0,1,1)[0].red\n return row-1 if color <= White * 0.75\n end\n m_end \"find_last_white_column\"\n nil\n end",
"def get_row_from_index (idx)\n (idx/@cols).floor\n end",
"def [](column_nr)\n @content[column_nr]\n end",
"def cell_name_index(study_cells)\n cluster_cells = concatenate_data_arrays('text', 'cells')\n # if cluster cells & study cells are identical, return empty array so we can set #use_default_index\n return [] if cluster_cells == study_cells\n\n all_cells_hash = array_to_hashmap(study_cells)\n cluster_cells.map { |cell| all_cells_hash[cell] }\n end",
"def identifier(style = nil)\n style and\n self.styles and\n self.styles[style] and\n self.styles[style][:identifier] or\n instance_get(:identifier)\n end",
"def getCol\n return @col\n end",
"def column_name(index)\n \"Column #{index}\"\n end",
"def column_max_index( table, column )\n\tmax = -9999999\n\tindex = 0\n\t(0...(column + 2)).each do |x|\n\t\tif table[x][column] != nil\n\t\t\tif table[x][column] > max\n\t\t\t\tmax = table[x][column]\n\t\t\t\tindex = x\n\t\t\tend\n\t\tend\n\tend\n\treturn index\nend",
"def formats_idx; end",
"def insert_column(col_index=0)\n validate_workbook\n validate_nonnegative(col_index)\n increase_columns(col_index)\n\n old_index = col_index > 0 ? col_index-1 : col_index+1\n old_col = @cols[get_cols_index(old_index)]\n if old_index == 1\n old_col = nil\n end\n\n #go through each cell in column\n @sheet_data.each_with_index do |r,i|\n #insert \"column\" in each row\n r.insert(col_index, nil)\n\n #copy styles over to each cell\n old_cell = r[old_index]\n unless old_cell.nil?\n #only add cell if style exists, not copying content\n if old_cell.style_index != 0\n if !old_col.nil? && old_cell.style_index.to_s != old_col[:attributes][:style].to_s\n c = Cell.new(self,i,col_index)\n c.style_index = old_cell.style_index\n @sheet_data[i][col_index] = c\n end\n end\n end\n end\n\n #copy over column-level styles\n new_col = change_cols(get_cols_index(old_index),old_index)\n @cols[-1] = deep_copy(old_col)#-1 = last\n\n new_col = @cols.last\n if @cols.last.nil?\n @cols.pop\n end\n\n #shift col styles 'right'\n @cols.each do |col|\n if Integer(col[:attributes][:min]) > col_index\n col[:attributes][:min] = (1 + Integer(col[:attributes][:min])).to_s\n end\n if Integer(col[:attributes][:max]) > col_index\n col[:attributes][:max] = (1 + Integer(col[:attributes][:max])).to_s\n end\n end\n unless new_col.nil?\n new_col[:attributes][:min] = (1 + Integer(new_col[:attributes][:min])).to_s\n new_col[:attributes][:max] = (1 + Integer(new_col[:attributes][:max])).to_s\n end\n\n #update column numbers\n @sheet_data.each do |row|\n (col_index+1).upto(row.size) do |j|\n unless row[j].nil?\n row[j].column += 1\n end\n end\n end\n end",
"def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend",
"def get_column(col_num)\n column = []\n @grid.each do |row|\n column << row[col_num]\n end\n column\n end",
"def column_number_for_value(value)\n cell = cells.find { |cell| clean_cell_value(cell) == value }\n cell.present? ? cell.column : nil\n end",
"def index_name\n @element[:name] || @element[:column]\n end",
"def style_for(column,present)\r\n if(present == true)\r\n class_value = \"imported\"\r\n else\r\n method_to_call = \"#{column}_data_origin\"\r\n begin\r\n case self.details[method_to_call.to_sym]\r\n when Origins::IMPORTED\r\n class_value = \"ocr_data imported\"\r\n when Origins::CERTAIN\r\n class_value = \"ocr_data certain\"\r\n when Origins::UNCERTAIN\r\n class_value = \"ocr_data uncertain\"\r\n when Origins::BLANK\r\n class_value = \"ocr_data blank\"\r\n else\r\n class_value = \"ocr_data blank\"\r\n end\r\n rescue NoMethodError\r\n # Nothing matched, assign default\r\n Origins::BLANK\r\n end\r\n end\r\n class_value \r\n end",
"def [] index_or_string\n if index_or_string.is_a? String\n match = index_or_string.match(/([A-Z]+)([0-9]*)/i)\n col_index = Workbook::Column.alpha_index_to_number_index(match[1])\n row_index = match[2].to_i - 1\n self[row_index][col_index]\n elsif index_or_string.is_a? Range\n collection = to_a[index_or_string].collect { |a| a.clone }\n Workbook::Table.new collection\n elsif index_or_string.is_a? Integer\n to_a[index_or_string]\n end\n end",
"def add_style(options={})\n if options[:type] == :dxf\n super\n else\n raw_style = {type: :xf, name: 'Arial', sz: 11, family: 1}.merge(options)\n\n if raw_style[:format_code]\n raw_style.delete(:num_fmt)\n end\n\n index = style_index.key(raw_style)\n\n if !index\n index = super \n\n style_index[index] = raw_style\n end\n end\n\n return index\n end"
] |
[
"0.84076685",
"0.74073434",
"0.6766498",
"0.6570552",
"0.65280926",
"0.6457088",
"0.64526653",
"0.6422292",
"0.6404371",
"0.6251131",
"0.62388444",
"0.6232812",
"0.61847985",
"0.61167014",
"0.610176",
"0.60612184",
"0.6059679",
"0.6050912",
"0.6019696",
"0.59665334",
"0.5955407",
"0.59388775",
"0.59282494",
"0.59221977",
"0.59202456",
"0.58876044",
"0.5881313",
"0.58769584",
"0.5830792",
"0.5825633",
"0.58246964",
"0.58139884",
"0.5784907",
"0.57840157",
"0.57681525",
"0.576112",
"0.5748514",
"0.5725346",
"0.571444",
"0.571444",
"0.571444",
"0.57002044",
"0.566399",
"0.5649077",
"0.5645076",
"0.5618429",
"0.56182736",
"0.56161",
"0.5609705",
"0.56082857",
"0.5595508",
"0.5594223",
"0.5587744",
"0.5581555",
"0.55799305",
"0.5561864",
"0.55312157",
"0.55262536",
"0.552269",
"0.5510434",
"0.54978234",
"0.5495885",
"0.54937154",
"0.54919666",
"0.5489233",
"0.5488419",
"0.54777926",
"0.5468928",
"0.5454863",
"0.5454066",
"0.54422086",
"0.5439177",
"0.54306155",
"0.54219776",
"0.5419264",
"0.54069275",
"0.540096",
"0.5367574",
"0.53622824",
"0.53483254",
"0.53454703",
"0.53402305",
"0.53365815",
"0.5333712",
"0.5320937",
"0.53037596",
"0.5299454",
"0.529911",
"0.528868",
"0.5285577",
"0.5275097",
"0.5273586",
"0.52709013",
"0.527063",
"0.5270026",
"0.52632904",
"0.5262727",
"0.5262071",
"0.52618355",
"0.5255147"
] |
0.8339601
|
1
|
Helper method to update the row styles array change_type NAME or SIZE or COLOR etc main method to change font, called from each separate font mutator method
|
def change_row_font(row_index, change_type, arg, font)
validate_workbook
ensure_cell_exists(row_index)
xf = workbook.register_new_font(font, get_row_xf(row_index))
row = sheet_data[row_index]
row.style_index = workbook.register_new_xf(xf)
row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def get_row_style(row)\n if @row_styles[(row+1).to_s].nil?\n @row_styles[(row+1).to_s] = {}\n @row_styles[(row+1).to_s][:style] = '0'\n @workbook.fonts['0'][:count] += 1\n end\n return @row_styles[(row+1).to_s][:style]\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def update!(**args)\n @font_color = args[:font_color] if args.key?(:font_color)\n @format_type = args[:format_type] if args.key?(:format_type)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def change_row_bold(row=0, bolded=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified bold settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_row_font(row, Worksheet::BOLD, bolded, font, xf_id)\n end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def set_style\r\n @style = Style.new\r\n\r\n alignment_node = @node.xpath('.//w:jc').first\r\n alignment = alignment_node ? alignment_node.attributes['val'].value : nil\r\n @style.instance_variable_set('@text_align', alignment.to_sym) if alignment\r\n\r\n size_node = @node.xpath('w:pPr//w:sz').first\r\n font_size = size_node ? size_node.attributes['val'].value.to_i / 2 : nil\r\n @style.instance_variable_set('@font_size', font_size)\r\n\r\n bold_node = @node.xpath('w:pPr//w:b').first\r\n @style.instance_variable_set('@font_weight', 'bold') if bold_node\r\n\r\n italic_node = @node.xpath('w:pPr//w:i').first\r\n @style.instance_variable_set('@font_style', 'italic') if italic_node\r\n\r\n underline_node = @node.xpath('w:pPr//w:u').first\r\n @style.instance_variable_set('@text_underline_style', 'solid') if underline_node\r\n end",
"def reload\n colors = Config.colors\n\n foreground = Config.foreground\n background = Config.background\n\n Styles[:clear] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n fmt.background = Qt::Brush.new(background)\n\n fmt.font_weight = Qt::Font::Normal\n fmt.font_italic = false\n fmt.font_underline = false\n }\n\n Styles[:normal] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n fmt.background = Qt::Brush.new(background)\n\n fmt.font_weight = Qt::Font::Normal\n fmt.font_underline = false\n }\n\n Styles[:bold] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Bold\n }\n\n Styles[:no_bold] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Normal\n }\n\n Styles[:light] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Light\n }\n\n Styles[:italic] = Qt::TextCharFormat.new { |fmt|\n fmt.font_italic = true\n }\n\n Styles[:no_italic] = Qt::TextCharFormat.new { |fmt|\n fmt.font_italic = false\n }\n\n Styles[:underline] = Qt::TextCharFormat.new { |fmt|\n fmt.font_underline = true\n }\n\n Styles[:color] = Array.new(256) do |i|\n Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(colors[i])\n }\n end\n\n Styles[:default_color] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n }\n\n Styles[:background] = Array.new(256) do |i|\n Qt::TextCharFormat.new { |fmt|\n fmt.background = Qt::Brush.new(colors[i])\n }\n end\n\n Styles[:default_background] = Qt::TextCharFormat.new { |fmt|\n fmt.background = Qt::Brush.new(background)\n }\n end",
"def change_font_size(font_size=10)\n validate_worksheet\n if font_size.is_a?(Integer) || font_size.is_a?(Float)\n # Get copy of font object with modified size\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_font(font)\n else\n raise 'Argument must be a number'\n end\n end",
"def pickerView(pickerView, didSelectRow:row, inComponent:component)\n if @switch_font.on? == true\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville-Bold\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue-Bold\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate-Bold\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n else\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def set_style(*v)\n styles = v.map { |i| @@style[i.to_sym] }.transpose\n prepend(\"\\e[\" << styles[0].join(';') << 'm')\n concat(\"\\e[\" << styles[1].join(';') << 'm')\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def style=(style)\n each_with_index do |cell, index|\n cell.style = style.is_a?(Array) ? style[index] : style\n end\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def styles=(_arg0); end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @bold = args[:bold] if args.key?(:bold)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_type = args[:font_type] if args.key?(:font_type)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @handwritten = args[:handwritten] if args.key?(:handwritten)\n @italic = args[:italic] if args.key?(:italic)\n @letter_spacing = args[:letter_spacing] if args.key?(:letter_spacing)\n @pixel_font_size = args[:pixel_font_size] if args.key?(:pixel_font_size)\n @smallcaps = args[:smallcaps] if args.key?(:smallcaps)\n @strikeout = args[:strikeout] if args.key?(:strikeout)\n @subscript = args[:subscript] if args.key?(:subscript)\n @superscript = args[:superscript] if args.key?(:superscript)\n @text_color = args[:text_color] if args.key?(:text_color)\n @underlined = args[:underlined] if args.key?(:underlined)\n end",
"def style=(style)\n cells.each_with_index do | cell, index |\n s = style.is_a?(Array) ? style[index] : style\n cell.style = s\n end\n end",
"def update!(**args)\n @color = args[:color] if args.key?(:color)\n @column = args[:column] if args.key?(:column)\n @font_style = args[:font_style] if args.key?(:font_style)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @opacity = args[:opacity] if args.key?(:opacity)\n @outline = args[:outline] if args.key?(:outline)\n @size = args[:size] if args.key?(:size)\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def cell_style(models, options={})\n [models].flatten.compact.each do |m|\n m.apply_styles(options)\n end \n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def fill_styles(wb,style_hash)\n ###NUM FORMATS###\n if style_hash[:numFmts].nil?\n style_hash[:numFmts] = {:attributes => {:count => 0}, :numFmt => []}\n elsif style_hash[:numFmts][:attributes][:count]==1\n style_hash[:numFmts][:numFmt] = [style_hash[:numFmts][:numFmt]]\n end\n wb.num_fmts = style_hash[:numFmts]\n\n wb.cell_style_xfs = style_hash[:cellStyleXfs]\n wb.cell_xfs = style_hash[:cellXfs]\n\n #fills out count information for each font, fill, and border\n if wb.cell_xfs[:xf].is_a?(::Hash)\n wb.cell_xfs[:xf] = [wb.cell_xfs[:xf]]\n end\n\n wb.cell_xfs[:xf].each do |style|\n id = Integer(style[:attributes][:fontId])\n wb.fonts[id].count += 1 unless id.nil?\n\n id = style[:attributes][:fillId]\n wb.fills[id].count += 1 unless id.nil?\n\n id = style[:attributes][:borderId]\n wb.borders[id].count += 1 unless id.nil?\n end\n\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n set_data_font(@maqj_font_data_type) if @maqj_font_data_type\n end",
"def semanticize_font_styles!\n @document.tree.css('span').each do |node|\n if node.bold?\n node.node_name = 'strong'\n elsif node.italic?\n node.node_name = 'em'\n end\n end\n end",
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @color = args[:color] if args.key?(:color)\n @font_family = args[:font_family] if args.key?(:font_family)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @text_anchor = args[:text_anchor] if args.key?(:text_anchor)\n @text_decoration = args[:text_decoration] if args.key?(:text_decoration)\n @text_style = args[:text_style] if args.key?(:text_style)\n end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_name = args[:font_name] if args.key?(:font_name)\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def style(new_styles = {})\n @style.merge! new_styles\n end",
"def read_styles(doc)\n @numFmts = []\n @cellXfs = []\n fonts = []\n \n #TODO: doc.find(\"//*[local-name()='numFmt']\").each do |numFmt|\n doc.xpath(\"//*[local-name()='numFmt']\").each do |numFmt|\n # TODO: numFmtId = numFmt.attributes.to_h['numFmtId']\n numFmtId = numFmt.attributes['numFmtId']\n #TODO: formatCode = numFmt.attributes.to_h['formatCode']\n formatCode = numFmt.attributes['formatCode']\n @numFmts << [numFmtId, formatCode]\n end\n #TODO: doc.find(\"//*[local-name()='fonts']\").each do |fonts_el|\n doc.xpath(\"//*[local-name()='fonts']\").each do |fonts_el|\n #TODO: fonts_el.each_element do |font_el|\n fonts_el.children.each do |font_el|\n #TODO: if font_el.name == 'font'\n if font_el == 'font'\n font = Excelx::Font.new\n font_el.each_element do |font_sub_el|\n case font_sub_el.name\n when 'b'\n font.bold = true\n when 'i'\n font.italic = true\n when 'u'\n font.underline = true\n end\n end\n fonts << font\n end\n end\n end\n \n #TODO: doc.find(\"//*[local-name()='cellXfs']\").each do |xfs|\n doc.xpath(\"//*[local-name()='cellXfs']\").each do |xfs|\n xfs.children.each do |xf|\n #TODO: numFmtId = xf.attributes.to_h['numFmtId']\n numFmtId = xf['numFmtId']\n @cellXfs << [numFmtId]\n #TODO: fontId = xf.attributes.to_h['fontId'].to_i\n fontId = xf['fontId'].to_i\n @style_definitions << fonts[fontId]\n end\n end\n end",
"def change_font_color\n #Code essentially used from Clay Allsop's RubyMotion: iOS Development with Ruby\n #with a few tweeks\n #\n #Get the color_field text\n color_prefix = @color_field.text\n #Downcase the color_field text and append \"Color\"\n color_method = \"#{color_prefix.downcase}Color\"\n #If the color exists, create as UIColor.colorColor\n if UIColor.respond_to?(color_method)\n @font_color = UIColor.send(color_method)\n @font_label.textColor = @font_color\n #For fun I added that the text color also becomes the toggle background color when ON\n @switch_font.onTintColor = @font_color\n @switch_font.tintColor = @font_color\n else\n #If the color is not known, display an alert to inform user\n UIAlertView.alloc.initWithTitle(\"Invalid Color\",\n message: \"#{color_prefix.capitalize} is not a usable color at this time\",\n delegate: nil,\n cancelButtonTitle: \"OK\",\n otherButtonTitles: nil).show\n end\n end",
"def maiil_reset_font\n fn = MA_IconItemList::NUM_FONTNAME ? MA_IconItemList::NUM_FONTNAME : Font.default_name\n contents.font = Font.new(fn, MA_IconItemList::NUM_FONTSIZE) # name and size\n contents.font.bold = MA_IconItemList::NUM_BOLD # Set Bold\n contents.font.italic = MA_IconItemList::NUM_ITALIC # Set Italic\n contents.font.shadow = MA_IconItemList::NUM_SHADOW # Set Shadow\n contents.font.outline = MA_IconItemList::NUM_OUTLINE # Set outline\n oc = MA_IconItemList::NUM_OUT_COLOUR ? MA_IconItemList::NUM_OUT_COLOUR : Font.default_out_color\n contents.font.out_color = text_color(oc) # outline color\n end",
"def fonts(workbook, _center, heading, _colors)\n worksheet = workbook.add_worksheet('Fonts')\n\n worksheet.set_column(0, 0, 30)\n worksheet.set_column(1, 1, 10)\n\n worksheet.write(0, 0, \"Font name\", heading)\n worksheet.write(0, 1, \"Font size\", heading)\n\n fonts = []\n fonts << [10, 'Arial']\n fonts << [12, 'Arial']\n fonts << [14, 'Arial']\n fonts << [12, 'Arial Black']\n fonts << [12, 'Arial Narrow']\n fonts << [12, 'Century Schoolbook']\n fonts << [12, 'Courier']\n fonts << [12, 'Courier New']\n fonts << [12, 'Garamond']\n fonts << [12, 'Impact']\n fonts << [12, 'Lucida Handwriting']\n fonts << [12, 'Times New Roman']\n fonts << [12, 'Symbol']\n fonts << [12, 'Wingdings']\n fonts << [12, 'A font that doesn\\'t exist']\n\n i = 0\n fonts.each do |font|\n format = workbook.add_format\n\n format.set_size(font[0])\n format.set_font(font[1])\n\n i += 1\n worksheet.write(i, 0, font[1], format)\n worksheet.write(i, 1, font[0], format)\n end\n end",
"def update!(**args)\n @base_line = args[:base_line] if args.key?(:base_line)\n @character_height = args[:character_height] if args.key?(:character_height)\n @color = args[:color] if args.key?(:color)\n @confidence = args[:confidence] if args.key?(:confidence)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_size_float = args[:font_size_float] if args.key?(:font_size_float)\n @font_type = args[:font_type] if args.key?(:font_type)\n @has_uncertain_height = args[:has_uncertain_height] if args.key?(:has_uncertain_height)\n @horizontal_scale = args[:horizontal_scale] if args.key?(:horizontal_scale)\n @is_bold = args[:is_bold] if args.key?(:is_bold)\n @is_italic = args[:is_italic] if args.key?(:is_italic)\n @is_small_caps = args[:is_small_caps] if args.key?(:is_small_caps)\n @is_strikeout = args[:is_strikeout] if args.key?(:is_strikeout)\n @is_subscript = args[:is_subscript] if args.key?(:is_subscript)\n @is_superscript = args[:is_superscript] if args.key?(:is_superscript)\n @is_suspicious = args[:is_suspicious] if args.key?(:is_suspicious)\n @is_underlined = args[:is_underlined] if args.key?(:is_underlined)\n @not_ocrable_per_qa = args[:not_ocrable_per_qa] if args.key?(:not_ocrable_per_qa)\n @penalty = args[:penalty] if args.key?(:penalty)\n @serif_probability = args[:serif_probability] if args.key?(:serif_probability)\n end",
"def add_style(options={})\n if options[:type] == :dxf\n super\n else\n raw_style = {type: :xf, name: 'Arial', sz: 11, family: 1}.merge(options)\n\n if raw_style[:format_code]\n raw_style.delete(:num_fmt)\n end\n\n index = style_index.key(raw_style)\n\n if !index\n index = super \n\n style_index[index] = raw_style\n end\n end\n\n return index\n end",
"def regularise_styles(content_raw)\n doc = REXML::Document.new(content_raw)\n\n # Get the default column types from all the sheets (tables) in\n # the workbook\n num_tables = doc.root.elements.to_a('//office:body/*/table:table').length\n (1 .. num_tables).to_a.each do |tnum|\n col_types = []\n cols = doc.root.elements.to_a(\"//table:table[#{tnum}]/table:table-column\")\n cols.each do |col|\n (0 ... (col.attributes['table:number-columns-repeated'] ||\n 1).to_i).to_a.each do\n col_types << col.attributes['table:default-cell-style-name']\n end\n end # each column\n\n # Get the number of rows for each table\n num_rows = doc.root.elements.to_a(\"//table:table[#{tnum}]/table:table-row\").length\n\n # Go through each row and process its cells\n (1 .. num_rows).to_a.each do |rnum|\n # The cells are both <table:table-cell> and\n # <table:covered-table-cell>\n cells = doc.root.elements.to_a(<<-END\n//table:table[#{tnum}]/table:table-row[#{rnum}]/(table:table-cell | table:covered-table-cell)\nEND\n )\n # Keep track of the column number, for formatting purposes\n # (c.f. col_types)\n col_num = 0\n cells.each do |cell|\n # Only need to explicitly format the <table:table-cell>s\n if cell.name == 'table-cell'\n cell.attributes['table:style-name'] ||= col_types[col_num]\n end\n # Advance the column number, based on the columns spanned\n # by the cell\n col_num += (cell.attributes['table:number-columns-repeated'] ||\n 1).to_i\n end\n\n end # each row\n end # each table\n\n return doc.to_s\n end",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_width = args[:median_width] if args.key?(:median_width)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def font=(value)\n @font = value\n end",
"def use_style=(style)\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def report_styles(size = 12)\n @org_name_style ||= style.add_style b: true,\n sz: size,\n alignment: { horizontal: :left, wrap_text: true }\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def change_column_italics(col=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_column_font(col, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def font_style(style)\n f = font\n if block_given?\n font(f.name, size: font_size, style: style) do\n yield\n end\n else\n font(f.name, size: font_size, style: style)\n end\n end",
"def load_default_styles\n @numFmts = SimpleTypedList.new NumFmt, 'numFmts'\n @numFmts << NumFmt.new(numFmtId: NUM_FMT_YYYYMMDD, formatCode: \"yyyy/mm/dd\")\n @numFmts << NumFmt.new(numFmtId: NUM_FMT_YYYYMMDDHHMMSS, formatCode: \"yyyy/mm/dd hh:mm:ss\")\n\n @numFmts.lock\n\n @fonts = SimpleTypedList.new Font, 'fonts'\n @fonts << Font.new(name: \"Arial\", sz: 11, family: 1)\n @fonts.lock\n\n @fills = SimpleTypedList.new Fill, 'fills'\n @fills << Fill.new(Axlsx::PatternFill.new(patternType: :none))\n @fills << Fill.new(Axlsx::PatternFill.new(patternType: :gray125))\n @fills.lock\n\n @borders = SimpleTypedList.new Border, 'borders'\n @borders << Border.new\n black_border = Border.new\n [:left, :right, :top, :bottom].each do |item|\n black_border.prs << BorderPr.new(name: item, style: :thin, color: Color.new(rgb: \"FF000000\"))\n end\n @borders << black_border\n @borders.lock\n\n @cellStyleXfs = SimpleTypedList.new Xf, \"cellStyleXfs\"\n @cellStyleXfs << Xf.new(borderId: 0, numFmtId: 0, fontId: 0, fillId: 0)\n @cellStyleXfs.lock\n\n @cellStyles = SimpleTypedList.new CellStyle, 'cellStyles'\n @cellStyles << CellStyle.new(name: \"Normal\", builtinId: 0, xfId: 0)\n @cellStyles.lock\n\n @cellXfs = SimpleTypedList.new Xf, \"cellXfs\"\n @cellXfs << Xf.new(borderId: 0, xfId: 0, numFmtId: 0, fontId: 0, fillId: 0)\n @cellXfs << Xf.new(borderId: 1, xfId: 0, numFmtId: 0, fontId: 0, fillId: 0)\n # default date formatting\n @cellXfs << Xf.new(borderId: 0, xfId: 0, numFmtId: 14, fontId: 0, fillId: 0, applyNumberFormat: 1)\n @cellXfs.lock\n\n @dxfs = SimpleTypedList.new(Dxf, \"dxfs\"); @dxfs.lock\n @tableStyles = TableStyles.new(defaultTableStyle: \"TableStyleMedium9\", defaultPivotStyle: \"PivotStyleLight16\"); @tableStyles.lock\n end",
"def styles; end",
"def styles; end",
"def styles; end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def s(val); @style = val; end",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def change_color(color)\n self.font.color = color\n end",
"def apply_custom_formatting(text)\n\n # Define custom formatting codes and replacement values.\n codes = []\n codes << '<code>'\n codes << '</code>'\n replacements = []\n replacements << '<font name=\"SF Mono\"><color rgb=\"e83e8c\"><b>'\n replacements << '</b></color></font>'\n\n # Process each replacement.\n codes.each_with_index do |code, index|\n text.gsub!(code, replacements[index])\n end\n\n end",
"def styles\n ANSI.constants(false).each_with_object({}) do |col, acc|\n acc[col.to_sym.downcase] = lookup(col)\n acc\n end\n end"
] |
[
"0.81528986",
"0.777216",
"0.71433884",
"0.71403795",
"0.71403795",
"0.70109606",
"0.69861317",
"0.69000655",
"0.688968",
"0.68635523",
"0.6840403",
"0.67529863",
"0.67448753",
"0.67448753",
"0.66979074",
"0.6432949",
"0.6309624",
"0.6215985",
"0.62131596",
"0.6140738",
"0.60702026",
"0.6054936",
"0.6048672",
"0.6048672",
"0.60272473",
"0.60134935",
"0.6012308",
"0.5980667",
"0.59787637",
"0.59558517",
"0.5922083",
"0.5888872",
"0.58873266",
"0.5822369",
"0.58153105",
"0.58099014",
"0.58006424",
"0.5783884",
"0.57827073",
"0.5776231",
"0.5776231",
"0.5770612",
"0.57651174",
"0.57651174",
"0.57616454",
"0.5760894",
"0.5760894",
"0.57605743",
"0.57548463",
"0.5733896",
"0.5732948",
"0.5729457",
"0.57188493",
"0.57188493",
"0.5716078",
"0.57021236",
"0.569488",
"0.568708",
"0.568708",
"0.5676284",
"0.56621534",
"0.5643844",
"0.5630425",
"0.56174856",
"0.5583965",
"0.55777717",
"0.556015",
"0.5558735",
"0.555675",
"0.55547905",
"0.551738",
"0.55151737",
"0.5495033",
"0.54735374",
"0.5469723",
"0.546302",
"0.5447586",
"0.54253364",
"0.54095596",
"0.5399353",
"0.5399353",
"0.5395103",
"0.53946424",
"0.5393447",
"0.5387767",
"0.5381251",
"0.5366483",
"0.5354677",
"0.5354677",
"0.53458226",
"0.53343105",
"0.53253424",
"0.53253424",
"0.53253424",
"0.53057474",
"0.5301219",
"0.5296335",
"0.5293985",
"0.5270394",
"0.5268202"
] |
0.77753985
|
1
|
Helper method to update the fonts and cell styles array main method to change font, called from each separate font mutator method
|
def change_column_font(column_index, change_type, arg, font, xf)
validate_workbook
ensure_cell_exists(0, column_index)
xf = workbook.register_new_font(font, xf)
cols.get_range(column_index).style_index = workbook.register_new_xf(xf)
sheet_data.rows.each { |row|
c = row && row[column_index]
c.font_switch(change_type, arg) unless c.nil?
}
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def initialize_fonts(application)\r\n\t[12, 14, 16, 18, 24].each() do |size|\r\n\t\tFONT[\"Courier #{size}\"] = FXFont.new(application, 'Courier New', size)\r\n\t\tFONT[\"Helvetica #{size}\"] = FXFont.new(application, 'Helvetica', size)\r\n\tend\r\n\t\r\n\tFONT['Courier 24 bold'] = FXFont.new(application, 'Courier New', 24, FXFont::Bold)\r\nend",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n set_data_font(@maqj_font_data_type) if @maqj_font_data_type\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def interpret(ps)\n raise Error unless ps.fonts.has_key?(@index)\n ps.font = ps.fonts[@index]\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def fonts(workbook, _center, heading, _colors)\n worksheet = workbook.add_worksheet('Fonts')\n\n worksheet.set_column(0, 0, 30)\n worksheet.set_column(1, 1, 10)\n\n worksheet.write(0, 0, \"Font name\", heading)\n worksheet.write(0, 1, \"Font size\", heading)\n\n fonts = []\n fonts << [10, 'Arial']\n fonts << [12, 'Arial']\n fonts << [14, 'Arial']\n fonts << [12, 'Arial Black']\n fonts << [12, 'Arial Narrow']\n fonts << [12, 'Century Schoolbook']\n fonts << [12, 'Courier']\n fonts << [12, 'Courier New']\n fonts << [12, 'Garamond']\n fonts << [12, 'Impact']\n fonts << [12, 'Lucida Handwriting']\n fonts << [12, 'Times New Roman']\n fonts << [12, 'Symbol']\n fonts << [12, 'Wingdings']\n fonts << [12, 'A font that doesn\\'t exist']\n\n i = 0\n fonts.each do |font|\n format = workbook.add_format\n\n format.set_size(font[0])\n format.set_font(font[1])\n\n i += 1\n worksheet.write(i, 0, font[1], format)\n worksheet.write(i, 1, font[0], format)\n end\n end",
"def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end",
"def semanticize_font_styles!\n @document.tree.css('span').each do |node|\n if node.bold?\n node.node_name = 'strong'\n elsif node.italic?\n node.node_name = 'em'\n end\n end\n end",
"def set_font_path()\n Dir.entries(@output_styles).each do |filename|\n next if filename =~ /^\\.\\.?$/\n filepath = \"#{@output_styles}/#{filename}\"\n\n text = File.read(filepath)\n new_text = text.gsub(/..\\/font/, \"#{@fonts_path}\")\n File.write(filepath, new_text)\n end\n end",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def maiil_reset_font\n fn = MA_IconItemList::NUM_FONTNAME ? MA_IconItemList::NUM_FONTNAME : Font.default_name\n contents.font = Font.new(fn, MA_IconItemList::NUM_FONTSIZE) # name and size\n contents.font.bold = MA_IconItemList::NUM_BOLD # Set Bold\n contents.font.italic = MA_IconItemList::NUM_ITALIC # Set Italic\n contents.font.shadow = MA_IconItemList::NUM_SHADOW # Set Shadow\n contents.font.outline = MA_IconItemList::NUM_OUTLINE # Set outline\n oc = MA_IconItemList::NUM_OUT_COLOUR ? MA_IconItemList::NUM_OUT_COLOUR : Font.default_out_color\n contents.font.out_color = text_color(oc) # outline color\n end",
"def font=(value)\n @font = value\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def prepare_fonts # :nodoc:\n fonts = {}\n\n @xf_formats.each { |format| format.set_font_info(fonts) }\n\n @font_count = fonts.size\n\n # For the DXF formats we only need to check if the properties have changed.\n @dxf_formats.each do |format|\n # The only font properties that can change for a DXF format are: color,\n # bold, italic, underline and strikethrough.\n format.has_dxf_font(true) if format.color? || format.bold? || format.italic? || format.underline? || format.strikeout?\n end\n end",
"def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_name = args[:font_name] if args.key?(:font_name)\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def pickerView(pickerView, didSelectRow:row, inComponent:component)\n if @switch_font.on? == true\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville-Bold\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue-Bold\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate-Bold\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n else\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n end\n end",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def set_font(key, font)\r\n # Add :Font key to content hash unless there is no key\r\n unless @content[pn(:Resources)].has_key?(pn(:Font))\r\n @content[pn(:Resources)].update(pn(:Font) => pd)\r\n end\r\n # Add font symbol to :Font hash\r\n unless @content[pn(:Resources)][pn(:Font)].has_key?(key)\r\n @content[pn(:Resources)][pn(:Font)].update(key => font.reference)\r\n end\r\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n self.contents.font.name = MARW_CONFIGURATION[:window_fontname] unless\n MARW_CONFIGURATION[:window_fontname].empty?\n self.contents.font.size = MARW_CONFIGURATION[:window_fontsize] unless\n MARW_CONFIGURATION[:window_fontsize] < 8\n end",
"def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end",
"def reset_font_settings; set_data_font(:scene_label); end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def reset_font_settings; set_data_font(:category_label); end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def read_styles(doc)\n @numFmts = []\n @cellXfs = []\n fonts = []\n \n #TODO: doc.find(\"//*[local-name()='numFmt']\").each do |numFmt|\n doc.xpath(\"//*[local-name()='numFmt']\").each do |numFmt|\n # TODO: numFmtId = numFmt.attributes.to_h['numFmtId']\n numFmtId = numFmt.attributes['numFmtId']\n #TODO: formatCode = numFmt.attributes.to_h['formatCode']\n formatCode = numFmt.attributes['formatCode']\n @numFmts << [numFmtId, formatCode]\n end\n #TODO: doc.find(\"//*[local-name()='fonts']\").each do |fonts_el|\n doc.xpath(\"//*[local-name()='fonts']\").each do |fonts_el|\n #TODO: fonts_el.each_element do |font_el|\n fonts_el.children.each do |font_el|\n #TODO: if font_el.name == 'font'\n if font_el == 'font'\n font = Excelx::Font.new\n font_el.each_element do |font_sub_el|\n case font_sub_el.name\n when 'b'\n font.bold = true\n when 'i'\n font.italic = true\n when 'u'\n font.underline = true\n end\n end\n fonts << font\n end\n end\n end\n \n #TODO: doc.find(\"//*[local-name()='cellXfs']\").each do |xfs|\n doc.xpath(\"//*[local-name()='cellXfs']\").each do |xfs|\n xfs.children.each do |xf|\n #TODO: numFmtId = xf.attributes.to_h['numFmtId']\n numFmtId = xf['numFmtId']\n @cellXfs << [numFmtId]\n #TODO: fontId = xf.attributes.to_h['fontId'].to_i\n fontId = xf['fontId'].to_i\n @style_definitions << fonts[fontId]\n end\n end\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size=10)\n validate_worksheet\n if font_size.is_a?(Integer) || font_size.is_a?(Float)\n # Get copy of font object with modified size\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_font(font)\n else\n raise 'Argument must be a number'\n end\n end",
"def settextfontprec(*)\n super\n end",
"def init_font(font)\n @font=font\n dc = Wx::WindowDC.new(self)\n dc.set_font(font)\n @asc_width, asc_h = dc.get_text_extent(\"@\")[0,2]\n @asc_width+2 # compact, but not too much so\n @hex_width, hex_h = dc.get_text_extent(\"@@\")[0,2]\n @txt_height = (hex_h > asc_h)? hex_h : asc_h\n @addr_width = dc.get_text_extent(@data.size.to_s(16).rjust(4,'@'))[0]\n @row_height = @txt_height\n\n update_dimensions() if @started\n end",
"def update!(**args)\n @font_color = args[:font_color] if args.key?(:font_color)\n @format_type = args[:format_type] if args.key?(:format_type)\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def set_font_set_and_project\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n end",
"def update!(**args)\n @background_color = args[:background_color] if args.key?(:background_color)\n @bold = args[:bold] if args.key?(:bold)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_type = args[:font_type] if args.key?(:font_type)\n @font_weight = args[:font_weight] if args.key?(:font_weight)\n @handwritten = args[:handwritten] if args.key?(:handwritten)\n @italic = args[:italic] if args.key?(:italic)\n @letter_spacing = args[:letter_spacing] if args.key?(:letter_spacing)\n @pixel_font_size = args[:pixel_font_size] if args.key?(:pixel_font_size)\n @smallcaps = args[:smallcaps] if args.key?(:smallcaps)\n @strikeout = args[:strikeout] if args.key?(:strikeout)\n @subscript = args[:subscript] if args.key?(:subscript)\n @superscript = args[:superscript] if args.key?(:superscript)\n @text_color = args[:text_color] if args.key?(:text_color)\n @underlined = args[:underlined] if args.key?(:underlined)\n end",
"def font=(font)\n set_font(font)\n generate_buffers\n end",
"def font(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @fonts[sheet][normalize(row,col).to_a]\n end",
"def set_font_from_path(font, bold_font)\n font_name = Pathname.new(font).basename\n @pdf.font_families.update(\n \"#{font_name}\" => {\n normal: font,\n italic: font,\n bold: bold_font,\n bold_italic: bold_font\n }\n )\n @pdf.font(font_name)\n end",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_width = args[:median_width] if args.key?(:median_width)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n end",
"def update\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n respond_to do |format|\n if @font_set.update(font_set_params)\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully updated.' }\n format.json { render :show, status: :ok, location: @font_set }\n else\n format.html { render :edit }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def font=(font_path)\n @title_font.path = font_path unless @title_font.path\n @marker_font.path = font_path\n @legend_font.path = font_path\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def reload\n colors = Config.colors\n\n foreground = Config.foreground\n background = Config.background\n\n Styles[:clear] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n fmt.background = Qt::Brush.new(background)\n\n fmt.font_weight = Qt::Font::Normal\n fmt.font_italic = false\n fmt.font_underline = false\n }\n\n Styles[:normal] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n fmt.background = Qt::Brush.new(background)\n\n fmt.font_weight = Qt::Font::Normal\n fmt.font_underline = false\n }\n\n Styles[:bold] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Bold\n }\n\n Styles[:no_bold] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Normal\n }\n\n Styles[:light] = Qt::TextCharFormat.new { |fmt|\n fmt.font_weight = Qt::Font::Light\n }\n\n Styles[:italic] = Qt::TextCharFormat.new { |fmt|\n fmt.font_italic = true\n }\n\n Styles[:no_italic] = Qt::TextCharFormat.new { |fmt|\n fmt.font_italic = false\n }\n\n Styles[:underline] = Qt::TextCharFormat.new { |fmt|\n fmt.font_underline = true\n }\n\n Styles[:color] = Array.new(256) do |i|\n Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(colors[i])\n }\n end\n\n Styles[:default_color] = Qt::TextCharFormat.new { |fmt|\n fmt.foreground = Qt::Brush.new(foreground)\n }\n\n Styles[:background] = Array.new(256) do |i|\n Qt::TextCharFormat.new { |fmt|\n fmt.background = Qt::Brush.new(colors[i])\n }\n end\n\n Styles[:default_background] = Qt::TextCharFormat.new { |fmt|\n fmt.background = Qt::Brush.new(background)\n }\n end",
"def another_print_fonts\n for index in 0..@fonts.size do\n puts \"#{index} -> #{@fonts[index]}\" # use of templating\n end\nend",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def init_font_families\n # Set the known family groups. These font families will be used to\n # enable bold and italic markers to be included within text\n # streams. HTML forms will be used... <b></b> <i></i>\n @font_families[\"Helvetica\"] =\n {\n \"b\" => 'Helvetica-Bold',\n \"i\" => 'Helvetica-Oblique',\n \"bi\" => 'Helvetica-BoldOblique',\n \"ib\" => 'Helvetica-BoldOblique'\n }\n @font_families['Courier'] =\n {\n \"b\" => 'Courier-Bold',\n \"i\" => 'Courier-Oblique',\n \"bi\" => 'Courier-BoldOblique',\n \"ib\" => 'Courier-BoldOblique'\n }\n @font_families['Times-Roman'] =\n {\n \"b\" => 'Times-Bold',\n \"i\" => 'Times-Italic',\n \"bi\" => 'Times-BoldItalic',\n \"ib\" => 'Times-BoldItalic'\n }\n end",
"def default_font; \"example.font\"; end",
"def load_fonts\n @@fonts[\"game\"] = Gosu::Font.new(80)\n @@fonts[\"menu\"] = Gosu::Font.new(40)\n @@fonts[\"notification\"] = Gosu::Font.new(25)\n @@fonts[\"big\"] = Gosu::Font.new(20)\n @@fonts[\"small\"] = Gosu::Font.new(14)\n @@fonts[\"button\"] = Gosu::Font.new(15)\n end",
"def set_font_size size\n @font = @font_cache[size]\n return if (@font)\n @font = Gosu::Font.new(\n size,\n name: @settings.get(:font_name)\n )\n @font_cache[size] = @font\n end",
"def load_font(family, height)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def convert_fonts\n out = \"\"\n sass.each_line do |line|\n line.gsub!(/(\\s*)(word-spacing|letter-spacing|font-size|line-height|margin-[^\\s]+|margin|padding-[\\s]+|padding)\\s*:(.*)/) do |m|\n # indent rule: value\n m = \"#{$1}#{$2}: #{CSS.val_to_em($3)}\"\n end\n out << line\n end\n self.sass = out\n end",
"def change_font_color\n #Code essentially used from Clay Allsop's RubyMotion: iOS Development with Ruby\n #with a few tweeks\n #\n #Get the color_field text\n color_prefix = @color_field.text\n #Downcase the color_field text and append \"Color\"\n color_method = \"#{color_prefix.downcase}Color\"\n #If the color exists, create as UIColor.colorColor\n if UIColor.respond_to?(color_method)\n @font_color = UIColor.send(color_method)\n @font_label.textColor = @font_color\n #For fun I added that the text color also becomes the toggle background color when ON\n @switch_font.onTintColor = @font_color\n @switch_font.tintColor = @font_color\n else\n #If the color is not known, display an alert to inform user\n UIAlertView.alloc.initWithTitle(\"Invalid Color\",\n message: \"#{color_prefix.capitalize} is not a usable color at this time\",\n delegate: nil,\n cancelButtonTitle: \"OK\",\n otherButtonTitles: nil).show\n end\n end",
"def font_setup\n font_families.update(\"Montserrat\" => {\n :normal => \"vendor/assets/fonts/Montserrat/Montserrat-Regular.ttf\",\n :italic => \"vendor/assets/fonts/Montserrat/Montserrat-Italic.ttf\",\n :bold => \"vendor/assets/fonts/Montserrat/Montserrat-Bold.ttf\",\n })\n font \"Montserrat\"\n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def update!(**args)\n @base_line = args[:base_line] if args.key?(:base_line)\n @character_height = args[:character_height] if args.key?(:character_height)\n @color = args[:color] if args.key?(:color)\n @confidence = args[:confidence] if args.key?(:confidence)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @font_size_float = args[:font_size_float] if args.key?(:font_size_float)\n @font_type = args[:font_type] if args.key?(:font_type)\n @has_uncertain_height = args[:has_uncertain_height] if args.key?(:has_uncertain_height)\n @horizontal_scale = args[:horizontal_scale] if args.key?(:horizontal_scale)\n @is_bold = args[:is_bold] if args.key?(:is_bold)\n @is_italic = args[:is_italic] if args.key?(:is_italic)\n @is_small_caps = args[:is_small_caps] if args.key?(:is_small_caps)\n @is_strikeout = args[:is_strikeout] if args.key?(:is_strikeout)\n @is_subscript = args[:is_subscript] if args.key?(:is_subscript)\n @is_superscript = args[:is_superscript] if args.key?(:is_superscript)\n @is_suspicious = args[:is_suspicious] if args.key?(:is_suspicious)\n @is_underlined = args[:is_underlined] if args.key?(:is_underlined)\n @not_ocrable_per_qa = args[:not_ocrable_per_qa] if args.key?(:not_ocrable_per_qa)\n @penalty = args[:penalty] if args.key?(:penalty)\n @serif_probability = args[:serif_probability] if args.key?(:serif_probability)\n end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def AddFont(family, style='', file='')\n\t\tif (family.empty?)\n\t\t\treturn;\n\t\tend\n\n\t\t#Add a TrueType or Type1 font\n\t\tfamily = family.downcase\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\tend\n\n\t\tstyle=style.upcase\n\t\tstyle=style.gsub('U','');\n\t\tstyle=style.gsub('D','');\n\t\tif (style == 'IB')\n\t\t\tstyle = 'BI';\n\t\tend\n\n\t\tfontkey = family + style;\n\t\t# check if the font has been already added\n\t\tif !@fonts[fontkey].nil?\n\t\t\treturn;\n\t\tend\n\n\t\tif (file=='')\n\t\t\tfile = family.gsub(' ', '') + style.downcase + '.rb';\n\t\tend\n\t\tfont_file_name = getfontpath(file)\n\t\tif (font_file_name.nil?)\n\t\t\t# try to load the basic file without styles\n\t\t\tfile = family.gsub(' ', '') + '.rb';\n \t\tfont_file_name = getfontpath(file)\n\t\tend\n if font_file_name.nil?\n\t\t\tError(\"Could not find font #{file}.\")\n end\n\t\trequire(getfontpath(file))\n\t\tfont_desc = TCPDFFontDescriptor.font(file)\n\n\t\tif (font_desc[:name].nil? and @@fpdf_charwidths.nil?)\n\t\t\tError('Could not include font definition file');\n\t\tend\n\n\t\ti = @fonts.length+1;\n\t\tif (@is_unicode)\n\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg], 'cMap' => font_desc[:cMap], 'registry' => font_desc[:registry]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\telse\n\t\t\t@fonts[fontkey]={'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\tend\n\n\t\tif (!font_desc[:diff].nil? and (!font_desc[:diff].empty?))\n\t\t\t#Search existing encodings\n\t\t\td=0;\n\t\t\tnb=@diffs.length;\n\t\t\t1.upto(nb) do |i|\n\t\t\t\tif (@diffs[i]== font_desc[:diff])\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (d==0)\n\t\t\t\td = nb+1;\n\t\t\t\t@diffs[d] = font_desc[:diff];\n\t\t\tend\n\t\t\t@fonts[fontkey]['diff'] = d;\n\t\tend\n\t\tif (font_desc[:file] and font_desc[:file].length > 0)\n\t\t\tif (font_desc[:type] == \"TrueType\") or (font_desc[:type] == \"TrueTypeUnicode\")\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:originalsize]}\n\t\t\telse\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:size1], 'length2' => font_desc[:size2]}\n\t\t\tend\n\t\tend\n\tend",
"def ctrlSetFont _obj, _args\n \"_obj ctrlSetFont _args;\" \n end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def pbSetSystemFont(bitmap)\n fontname=MessageConfig.pbGetSystemFontName\n bitmap.font.name=fontname\n if fontname==\"Pokemon FireLeaf With BLD\" || fontname==\"Power Red and Green With BLD\"\n bitmap.font.size=29\n elsif fontname==\"Pokemon Emerald Small With BLD\" || fontname==\"Power Green Small With BLD\"\n bitmap.font.size=25\n else\n bitmap.font.size=31\n end\nend",
"def parse_font_table(src, current_pos)\n group = 1\n\n font = nil\n in_extra = nil\n\n while (true)\n case(src[current_pos])\n when '{' then\n font = RubyRTF::Font.new if group == 1\n in_extra = nil\n\n group += 1\n\n when '}' then\n group -= 1\n\n if group <= 1\n break if font.nil?\n font.cleanup_names\n @doc.font_table[font.number] = font\n end\n\n in_extra = nil\n\n break if group == 0\n\n when '\\\\' then\n ctrl, val, current_pos = parse_control(src, current_pos + 1)\n\n font = RubyRTF::Font.new if font.nil?\n\n case(ctrl)\n when :f then font.number = val\n when :fprq then font.pitch = val\n when :fcharset then font.character_set = val\n when *[:flomajor, :fhimajor, :fdbmajor, :fbimajor,\n :flominor, :fhiminor, :fdbminor, :fbiminor] then\n font.theme = ctrl.to_s[1..-1].to_sym\n\n when *[:falt, :fname, :panose] then in_extra = ctrl\n else\n cmd = ctrl.to_s[1..-1].to_sym\n if RubyRTF::Font::FAMILIES.include?(cmd)\n font.family_command = cmd\n end\n end\n\n # need to next as parse_control will leave current_pos at the\n # next character already so current_pos += 1 below would move us too far\n next\n when *[\"\\r\", \"\\n\"] then ;\n else\n case(in_extra)\n when :falt then font.alternate_name << src[current_pos]\n when :panose then font.panose << src[current_pos]\n when :fname then font.non_tagged_name << src[current_pos]\n when nil then font.name << src[current_pos]\n end\n end\n current_pos += 1\n end\n\n current_pos\n end",
"def pbSetSmallFont(bitmap)\n bitmap.font.name=pbSmallFontName\n bitmap.font.size=25\nend"
] |
[
"0.76473373",
"0.76473373",
"0.7472112",
"0.72790885",
"0.7174665",
"0.70401967",
"0.69972926",
"0.69875807",
"0.6777651",
"0.67595017",
"0.66546714",
"0.66544145",
"0.66544145",
"0.66344523",
"0.6599408",
"0.6513397",
"0.64952385",
"0.6485382",
"0.64818585",
"0.64818585",
"0.6472038",
"0.6454501",
"0.6454501",
"0.6446348",
"0.6383783",
"0.63755757",
"0.6351964",
"0.6349103",
"0.6289046",
"0.6276514",
"0.62733454",
"0.6272821",
"0.6271293",
"0.62702334",
"0.6269417",
"0.6231054",
"0.6228799",
"0.62269",
"0.6226093",
"0.6221245",
"0.62081826",
"0.62081826",
"0.61758554",
"0.61531705",
"0.6145366",
"0.6138873",
"0.61239463",
"0.61059684",
"0.6101772",
"0.609789",
"0.60944694",
"0.60855836",
"0.60598975",
"0.60598975",
"0.60078025",
"0.6004435",
"0.59962124",
"0.5975405",
"0.5955001",
"0.5950692",
"0.5950626",
"0.5950626",
"0.59408945",
"0.5935648",
"0.58839405",
"0.5869059",
"0.5868626",
"0.58646756",
"0.5858097",
"0.58470994",
"0.5843341",
"0.58366954",
"0.5817394",
"0.58170706",
"0.5816838",
"0.57887685",
"0.57714295",
"0.5764469",
"0.5764469",
"0.57524276",
"0.5735365",
"0.5730321",
"0.571964",
"0.57184166",
"0.57174706",
"0.57167697",
"0.5692462",
"0.56863266",
"0.5663419",
"0.5651401",
"0.56465036",
"0.5642056",
"0.56278676",
"0.561906",
"0.5606192",
"0.55986345",
"0.5588274",
"0.5586604",
"0.55732536",
"0.55680794"
] |
0.6796224
|
8
|
Merges cells within a rectangular area
|
def merge_cells(start_row, start_col, end_row, end_col)
validate_workbook
self.merged_cells ||= RubyXL::MergedCells.new
# TODO: add validation to make sure ranges are not intersecting with existing ones
merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(start_row, end_row, start_col, end_col))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rect(a,b)\n new_cells = a.times.flat_map do |x|\n b.times.flat_map do |y|\n Cell.new(x,y,@width,@height)\n end\n end\n\n @cells.merge(new_cells)\n end",
"def merge_cells(row1=0,col1=0,row2=0,col2=0)\n validate_workbook\n @merged_cells << {\n :attributes => {\n :ref => ''\n }\n }\n cell1 = Cell.convert_to_cell(row1,col1)\n cell2 = Cell.convert_to_cell(row2,col2)\n @merged_cells.last[:attributes][:ref] = cell1+':'+cell2\n end",
"def merge_cells(row1 = 0, col1 = 0, row2 = 0, col2 = 0)\n validate_workbook\n\n self.merged_cells ||= RubyXL::MergedCells.new\n merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(row1, row2, col1, col2))\n end",
"def cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end",
"def connect_cells\n @grid.each_with_index do |columns, col_i|\n columns.each_with_index do |cell, cell_i|\n cell.left = @grid[col_i-1][cell_i] if col_i != 0 \n cell.up = @grid[col_i][cell_i+1] if cell_i + 1 < columns.length\n cell.right = @grid[col_i+1][cell_i] if col_i + 1 < @grid.length\n cell.down = @grid[col_i][cell_i-1] if cell_i != 0\n cell.lu = @grid[col_i-1][cell_i+1] if col_i != 0 && cell_i + 1 < columns.length\n cell.ld = @grid[col_i-1][cell_i-1] if col_i != 0 && cell_i != 0\n cell.ru = @grid[col_i+1][cell_i+1] if col_i + 1 < @grid.length && cell_i + 1 < columns.length\n cell.rd = @grid[col_i+1][cell_i-1] if col_i + 1 < @grid.length && cell_i != 0\n end\n end\n end",
"def merge_cells(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n\n record = 0x00E5 # Record identifier\n length = 0x000A # Bytes to follow\n\n cref = 1 # Number of refs\n rwFirst = args[0] # First row in reference\n colFirst = args[1] # First col in reference\n rwLast = args[2] || rwFirst # Last row in reference\n colLast = args[3] || colFirst # Last col in reference\n\n # Excel doesn't allow a single cell to be merged\n return if rwFirst == rwLast and colFirst == colLast\n\n # Swap last row/col with first row/col as necessary\n rwFirst, rwLast = rwLast, rwFirst if rwFirst > rwLast\n colFirst, colLast = colLast, colFirst if colFirst > colLast\n\n header = [record, length].pack(\"vv\")\n data = [cref, rwFirst, rwLast, colFirst, colLast].pack(\"vvvvv\")\n\n append(header, data)\n end",
"def each_cell(rect)\n (rect.top_left.left..rect.top_right.left).each do |left|\n (rect.top_left.top..rect.bottom_left.top).each do |top|\n yield left, top\n end\n end\nend",
"def area_span_for_numbered_tile tile\n area_span = create_general_area_span_for_numbered @b_nl[tile[0],tile[1]]\n area_span.map!{|x,y| [(x+tile[0]), (y+tile[1])] }\n area_span.reject!{|x,y| x < 0 || y < 0 || x > (@row_count-1) || y > (@col_count-1)}\n area_span\n end",
"def merge_cells(refs)\n xml = String.new(%Q{<mergeCells r=\"#{refs.length}\">})\n\n refs.each do |ref|\n xml << %Q{<mergeCell ref=\"#{ref}\"/>}\n end\n\n xml << '</mergeCells>'\n @xml_merge_cells = xml\n end",
"def mergerows(row1,row2)\n\t\tif row2 >= @text.length\n\t\t\treturn\n\t\tend\n\t\tcol = @text[row1].length\n\t\t@text[row1] = @text[row1].dup\n\t\t@text[row1] += @text[row2]\n\t\t@text.delete_at(row2)\n\tend",
"def flatten_cells() @cells.flatten end",
"def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end",
"def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end",
"def connect_cells(x1, y1, x2, y2)\n if x1 == x2\n # Cells must be above each other, remove a horizontal\n # wall.\n @horizontal_walls[ [y1, y2].min ][x1] = :open\n else\n # Cells must be next to each other, remove a vertical\n # wall.\n @vertical_walls[y1][ [x1, x2].min ] = :open\n end\n end",
"def clean\n (1..@rows).each do |x|\n (1..@cols).each do |y|\n self.cleanCell(x, y)\n end\n end\n end",
"def drawGrid(cX, cY, gX, gY)\n\t# Convert number of intersections into city blocks that start at 0\n\tgX = gX - 2\n\tgY = gY - 2\n\t\n\tg = \"\\t\"\t\n\tfor i in 0..gY\n\t\tcY == 0 && cX == i ? g << \"X____\" : g << \" ____\"\n\tend\n\tg << \"\\n\\t\"\n\tfor i in 0..gY * 2\n\t\tif i % 2 == 0\n\t\t\tfor y in 0..gX\n\t\t\t\ty == gX ? g << \"| |\" : g << \"| \"\n\t\t\tend\n\t\telse\n\t\t\tfor y in 0..gX\n\t\t\t\ty == gX ? g << \"|____|\" : g << \"|____\"\n\t\t\tend\n\t\tend\n\t\tg << \"\\n\\t\"\n end\t\n\tfor i in 0..gY\n\t\ti == gY ? g << \"|____|\" : g << \"|____\"\t\n\tend\n\n\treturn g\nend",
"def merge_cells\n inputs = []\n total_amount = 0\n total_capacity = 0\n get_unspent_cells.each do |cell|\n input = {\n previous_output: {\n hash: cell[:out_point][:hash],\n index: cell[:out_point][:index]\n },\n unlock: token_info.unlock_script_json_object(pubkey)\n }\n inputs << input\n input_capacity += cell[:capacity]\n input_amount += cell[:amount]\n end\n outputs = [\n {\n capacity: total_capacity,\n data: [total_amount].pack(\"Q<\"),\n lock: wallet.udt_cell_wallet(token_info).address,\n type: token_info.contract_script_json_object\n }\n ]\n tx = {\n version: 0,\n deps: [api.mruby_out_point],\n inputs: Ckb::Utils.sign_sighash_all_inputs(inputs, outputs, privkey),\n outputs: outputs\n }\n api.send_transaction(tx)\n end",
"def create_general_area_span_for_numbered size\n area_span = []\n row_zero = [[0,0]]\n n = size + (size - 1)\n m = ::Matrix.build(n,n){|x,y| [x,y]} #.to_a.flatten(1).to_set\n (1...size).each do |i|\n row_zero << [0,i]\n row_zero << [0,-i]\n end\n\n row_zero.sort.each do |y,x|\n # Bellow is the trick for the diagonal\n # on the diamond\n (0..(x.abs-size+1).abs).each do |i|\n area_span << [y+i,x]\n area_span << [y-i,x]\n end\n end\n\n area_span.uniq\n end",
"def eliminate_coliding_areas all_possible_areas\n puts 'All areas initial: ' + all_possible_areas.values.map{|areas| areas.count }.inspect\n\n all_possible_areas_reduced = {}\n\n # Reduce areas by eliminiting the ones which touch on another\n # numbered tile\n all_possible_areas.keys.each do |numbered_tile|\n x,y = numbered_tile.split('-').map(&:to_i)\n # Create board with compased tiles on all numbered tiles minus the\n # numbered tile\n restricted_board = create_restricted_board([x,y]).to_a\n all_compased_numbered_tiles = []\n (0..(@row_count-1)).to_a.each do |i|\n (0..(@col_count-1)).to_a.each do |j|\n all_compased_numbered_tiles << [i,j] if restricted_board[i][j] == 1\n end\n end\n\n all_areas_for_numbered_tile = all_possible_areas[numbered_tile].dup\n\n all_possible_areas_reduced[numbered_tile] = all_areas_for_numbered_tile.delete_if do |area|\n next if area.count == 1\n # Skip area, hmm do I need this bellow\n # next if (@b_nl[x,y] == 1)\n # Remove area if colinding\n area & all_compased_numbered_tiles != []\n end\n end #for each numbered_tile,area_span\n\n puts 'All numbered tile areas reduced(not coliding other numbered tiles)' + all_possible_areas_reduced.values.map{|areas| areas.count }.inspect\n all_possible_areas_reduced\n end",
"def connect_cells(x1, y1, x2, y2)\n if x1 == x2\n # Cells must be above each other, remove a horizontal\n # wall.\n @horizontal_walls[ [y1, y2].min ][x1] = false\n else\n # Cells must be next to each other, remove a vertical\n # wall.\n @vertical_walls[y1][ [x1, x2].min ] = false\n end\n end",
"def connect_cells(x1, y1, x2, y2)\n if x1 == x2\n # Cells must be above each other, remove a horizontal wall.\n @horizontal_walls[x1][ [y1, y2].min ] = false\n else\n # Cells must be next to each other, remove a vertical wall.\n @vertical_walls[ [x1, x2].min ][y1] = false\n end\n end",
"def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\nend",
"def merge_ranges(schedule)\n merged_schedule = []\n\n schedule.each do |meeting|\n overlapping_time_slots = check_times(meeting, merged_schedule)\n merged_schedule -= overlapping_time_slots if merged_schedule.include?(overlapping_time_slots)\n merged_schedule << slot_merger(overlapping_time_slots)\n end\n\n merged_schedule\nend",
"def merge_range(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute_cellref(*args)\n end\n raise \"Incorrect number of arguments\" if args.size != 6 and args.size != 7\n raise \"Format argument is not a format object\" unless args[5].kind_of?(Format)\n\n rwFirst = args[0]\n colFirst = args[1]\n rwLast = args[2]\n colLast = args[3]\n string = args[4]\n format = args[5]\n encoding = args[6] ? 1 : 0\n\n # Temp code to prevent merged formats in non-merged cells.\n error = \"Error: refer to merge_range() in the documentation. \" +\n \"Can't use previously non-merged format in merged cells\"\n\n raise error if format.used_merge == -1\n format.used_merge = 0 # Until the end of this function.\n\n # Set the merge_range property of the format object. For BIFF8+.\n format.set_merge_range\n\n # Excel doesn't allow a single cell to be merged\n raise \"Can't merge single cell\" if rwFirst == rwLast and\n colFirst == colLast\n\n # Swap last row/col with first row/col as necessary\n rwFirst, rwLast = rwLast, rwFirst if rwFirst > rwLast\n colFirst, colLast = colLast, colFirst if colFirst > colLast\n\n # Write the first cell\n if encoding != 0\n write_utf16be_string(rwFirst, colFirst, string, format)\n else\n write(rwFirst, colFirst, string, format)\n end\n\n # Pad out the rest of the area with formatted blank cells.\n (rwFirst .. rwLast).each do |row|\n (colFirst .. colLast).each do |col|\n next if row == rwFirst and col == colFirst\n write_blank(row, col, format)\n end\n end\n\n merge_cells(rwFirst, colFirst, rwLast, colLast)\n\n # Temp code to prevent merged formats in non-merged cells.\n format.used_merge = 1\n end",
"def twoPluses(grid)\n areas = []\n grid.each_index do |i|\n grid[i].chars.each_index do |j|\n explore(grid, i, j, areas) if grid[i][j] == 'G'\n end\n end\n areas.combination(2).map { |i,j| (i[:indexes] & j[:indexes]).empty? ? i[:area] * j[:area] : 0 }.max\nend",
"def kill_cells_in_borders\n (0..@long - 1).each do |long|\n (0..@width - 1).each do |width|\n @matriz[long][width] = ' . ' if long.zero? || (long == @long - 1) || width.zero? || (width == @width - 1)\n end\n end\n end",
"def union_all!(array_rects)\n array_rects.each do |r|\n self.union!(r)\n end\n return self\n end",
"def update_subrectangle(row1, col1, row2, col2, new_value)\n for i in row1..row2\n for j in col1..col2\n @rectangle[i][j] = new_value\n end\n end\n end",
"def union!(rect)\n self.normalize!\n rleft, rtop = self.topleft\n rright, rbottom = self.bottomright\n r2 = Rect.new_from_object(rect).normalize!\n\n rleft = [rleft, r2.left].min\n rtop = [rtop, r2.top].min\n rright = [rright, r2.right].max\n rbottom = [rbottom, r2.bottom].max\n\n self[0,4] = rleft, rtop, rright - rleft, rbottom - rtop\n return self\n end",
"def update_subrectangle(row1, col1, row2, col2, new_value)\n for i in row1..row2\n for j in col1..col2\n @rectangle[i][j] = new_value\n end\n end\n end",
"def intersecting_rectanges(rect1, rect2)\n\n intersecting_rect_width = 0\n intersecting_rect_height = 0\n intersecting_rect_left_x = 0\n intersecting_rect_bottom_y = 0\n\n if rect1[:left_x] + rect1[:width] > rect2[:left_x] && rect2[:left_x] > rect1[:left_x]\n intersecting_rect_width = rect1[:left_x] + rect1[:width] - rect2[:left_x]\n intersecting_rect_left_x = rect2[:left_x]\n elsif rect2[:left_x] + rect2[:width] > rect1[:left_x] && rect1[:left_x] > rect2[:left_x]\n intersecting_rect_width = rect2[:left_x] + rect2[:width] - rect1[:left_x]\n intersecting_rect_left_x = rect1[:left_x]\n end\n\n if rect1[:bottom_y] + rect1[:height] > rect2[:bottom_y] && rect2[:bottom_y] > rect1[:bottom_y]\n intersecting_rect_height = rect1[:bottom_y] + rect1[:height] - rect2[:bottom_y]\n intersecting_rect_bottom_y = rect1[:bottom_y]\n elsif rect2[:bottom_y] + rect2[:height] > rect1[:bottom_y] && rect1[:bottom_y] > rect2[:height]\n intersecting_rect_height = rect2[:bottom_y] + rect2[:height] - rect1[:bottom_y]\n intersecting_rect_bottom_y = rect2[:bottom_y]\n end\n \n {\n :left_x => intersecting_rect_left_x,\n :bottom_y => intersecting_rect_bottom_y,\n\n :width => intersecting_rect_width,\n :height => intersecting_rect_height\n }\nend",
"def connect_cells(x1, y1, x2, y2)\n if x1 == x2\n # Cells must be above each other, remove a horizontal wall.\n @horizontal_walls[x1][ [y1, y2].min ] = false\n else\n # Cells must be next to each other, remove a vertical wall.\n @vertical_walls[ [x1, x2].min ][y1] = false\n end\n end",
"def mergevalues(m, col, row, valuecell)\n if valuecell != nil\n valuecell.xlcoords=(col.col_name)+(row+1).to_s\n m[row, col]=valuecell\n return m, valuecell\n else\n valuecell=Cell.new\n valuecell.xlcoords=(col.col_name)+(row+1).to_s\n m[row, col]=valuecell\n return m, valuecell\n end\n end",
"def add_surrounding_mines\n\t\t@board.flatten.each do |square|\n\t\t\tmine_count = 0\n\t\t\tsquare.adjacent_squares.each do |adj_square|\n\t\t\t\tmine_count += 1 if get_square(adj_square).mine == true\n\t\t\tend\n\t\t\tsquare.surrounding_mines=(mine_count)\n\t\tend\n\tend",
"def to_s_v1\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" \" # <-- that's THREE (3) spaces!\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n # three spaces below, too >>-------------->> >...<\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def to_s_v2\n output = \"+\" + \"---+\" * columns + \"\\n\"\n\n each_row do |row|\n top = \"|\"\n bottom = \"+\"\n\n row.each do |cell|\n cell = Cell.new(-1, -1) unless cell\n\n body = \" #{contents_of(cell)} \"\n east_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n top << body << east_boundary\n\n south_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n corner = \"+\"\n bottom << south_boundary << corner\n end\n\n output << top << \"\\n\"\n output << bottom << \"\\n\"\n end\n\n output\n end",
"def repack\n @widths = Array.new(@rows.empty? ? 0 : @rows[0].size, 0)\n @heights = Array.new(@rows.size, 0)\n\n filled_columns = []\n filled_rows = []\n\n # Calculate the maximum widths of each column and the maximum height of each row.\n @rows.each_with_index do |row, row_num|\n row.each_with_index do |element, column_num|\n fills = (element.align_h == :fill)\n @widths[column_num] = [fills ? element.min_width : element.outer_width, @widths[column_num]].max\n filled_columns.push fills\n\n fills = (element.align_v == :fill)\n @heights[row_num] = [fills ? element.min_width : element.outer_height, @heights[row_num]].max\n filled_rows.push fills\n end\n end\n\n # Expand the size of each filled column to make the minimum size required.\n unless @widths.empty?\n num_filled_columns = filled_columns.select {|value| value }.count\n total_width = @widths.inject(0, :+) + (padding_left + padding_right) + ((@num_columns - 1) * spacing_h)\n extra_width = min_width - total_width\n if extra_width > 0\n if num_filled_columns > 0\n @widths[filled_columns.index true] += extra_width\n else\n @widths[-1] += extra_width\n end\n end\n end\n\n # Expand the size of each filled row to make the minimum size required.\n unless @heights.empty?\n num_filled_rows = filled_rows.select {|value| value }.count\n total_height = @heights.inject(0, :+) + (padding_left + padding_right) + ((@num_rows - 1) * spacing_v)\n extra_height = min_height - total_height\n if extra_height > 0\n if num_filled_rows > 0\n @heights[filled_rows.index true] += extra_height\n else\n @heights[-1] += extra_height\n end\n end\n end\n\n # Actually place all the elements into the grid positions, modified by valign and align.\n current_y = y + padding_top\n @rows.each_with_index do |row, row_num|\n current_x = x + padding_left\n\n row.each_with_index do |element, column_num|\n element.x = current_x + element.border_thickness\n\n case element.align_h # Take horizontal alignment into consideration.\n when :fill\n if element.width < @widths[column_num]\n element.width = @widths[column_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.x += (@widths[column_num] - element.width) / 2\n when :right\n element.x += @widths[column_num] - element.width\n end\n\n current_x += @widths[column_num]\n current_x += spacing_h unless column_num == @num_columns - 1\n\n element.y = current_y + element.border_thickness\n\n case element.align_v # Take horizontal alignment into consideration.\n when :fill\n if element.height < @heights[row_num]\n element.height = @heights[row_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.y += (@heights[row_num] - element.height) / 2\n when :bottom\n element.y += @heights[row_num] - element.height\n else\n end\n end\n\n self.width = current_x - x + padding_left if row_num == 0\n\n current_y += @heights[row_num] unless row.empty?\n current_y += spacing_h unless row_num == num_rows - 1\n end\n\n self.height = current_y - y + padding_top\n\n nil\n end",
"def apply_rules_part2(grid)\n new_grid = deep_copy_grid(grid)\n (0..(grid.length - 1)).each do |row|\n (0..(grid[0].length - 1)).each do |col|\n\n if grid[row][col] == 'L' && num_visible_occupied(grid, row, col) == 0\n new_grid[row][col] = '#'\n elsif grid[row][col] == '#' && num_visible_occupied(grid, row, col) >= 5\n new_grid[row][col] = 'L'\n end\n\n end\n end\n\n new_grid\n end",
"def spans_all_rows?(cells_list)\n cells_list.inject([]) {|rows, (_, r)| rows << r }.uniq.size == @board.size\n end",
"def draw_area(data,serie1,serie2,r,g,b,alpha = 50)\n validate_data(\"draw_area\",data)\n layer_width = @g_area_x2-@g_area_x1\n layer_height = @g_area_y2-@g_area_y1\n\n @layers[0] = image_create_true_color(layer_width,layer_height)\n image_filled_rectangle(@layers[0],0,0,layer_width,layer_height,255,255,255)\n image_color_transparent(@layers[0],255,255,255)\n\n x_pos = @g_area_x_offset\n last_x_pos = -1\n last_y_pos1 = nil\n last_y_pos2= nil\n data.each do |key|\n value1 = key[serie1]\n value2 = key[serie2]\n y_pos1 = layer_height - ((value1-@vmin) * @division_ratio)\n y_pos2 = layer_height - ((value2-@vmin) * @division_ratio)\n\n if ( last_x_pos != -1 )\n points = []\n points << last_x_pos\n points << last_y_pos1\n points << last_x_pos\n points << last_y_pos2\n points << x_pos\n points << y_pos2\n points << x_pos\n points << y_pos1\n image_filled_polygon(@layers[0],points,r,g,b,4)\n end\n last_y_pos1 = y_pos1\n last_y_pos2 = y_pos2\n last_x_pos = x_pos\n x_pos= x_pos+ @division_width\n end\n image_copy_merge(@layers[0],@picture,@g_area_x1,@g_area_y1,0,0,layer_width,layer_height,alpha)\n image_destroy(@layers[0])\n end",
"def build_up_cells(cells, row)\n partial_cell = parse_row_to_partial_cell(row)\n\n partial_cell.each.with_index do |cell, index|\n if cells[index]\n cells[index] += \"#{cell.strip} \"\n else\n cells[index] = \"#{cell.strip} \"\n end\n end\n\n return cells\n end",
"def get_surrounding_tiles(row, column, cell)\n surrounding_tiles = []\n index = GAME_BOARD[column-1].index(cell)\n if column == 1 \n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n end\n elsif column == 12\n if index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1]\n surrounding_tiles << GAME_BOARD[column-2][index] \n else\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n elsif index == 0\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n elsif index == 8\n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n else\n surrounding_tiles << GAME_BOARD[column-1][index+1] \n surrounding_tiles << GAME_BOARD[column-1][index-1] \n surrounding_tiles << GAME_BOARD[column][index]\n surrounding_tiles << GAME_BOARD[column-2][index]\n end\n\n surrounding_tiles\n end",
"def rect(wide, tall)\n tall.times do |row|\n wide.times do |col|\n @display[row][col] = '#'\n end\n end\n self\n end",
"def clear_full_rows\n\n\t\t# Clear all rows that are full\n\t\t@collision_map.each_with_index do |row, index|\n\t\t\t@collision_map.delete_at(index) if is_row_full?(row)\n\t\tend\n\n\t\tcleared_rows = @size_y - @collision_map.size\n\n\t\t# Create empty rows until the field is back to its original size\n\t\twhile @collision_map.size < @size_y\n\t\t\t@collision_map.unshift( Array.new(@size_x) { |i| { value: false, color: nil }})\n\t\tend\t\t\n\n\t\treturn cleared_rows\n\tend",
"def union_all(array_rects)\n self.dup.union_all!(array_rects)\n end",
"def create_cells\n (\"A\"..@height).each do |rows|\n (1..@width.to_i).each do |column|\n k=\"#{rows}#{column}\"\n cells[k]=Cell.new(k)\n end\n end\n cells\n end",
"def remove_filled_rows\n (0...@board_height).each do |row|\n index_range = row * @board_width...(row + 1) * @board_width\n if @board[index_range].reduce(:+) == @board_width\n @board[index_range] = Array.new(10, 0)\n end\n end\n end",
"def union(rect)\n self.dup.union!(rect)\n end",
"def cells_around cell, opts = {}\n opts.reverse_merge! :include_self => false\n \n ca = [Loc.new(:x => cell.x+1, :y => cell.y),\n Loc.new(:x => cell.x-1, :y => cell.y),\n Loc.new(:x => cell.x, :y => cell.y+1),\n Loc.new(:x => cell.x, :y => cell.y-1)]\n \n # add self if requested\n ca << cell if opts[:include_self] \n ca\n end",
"def merge; end",
"def fill_grid(grid)\r\n\tmax = grid.length - 1\r\n\t(1..max).each do |row|\r\n\t\t(1..max).each do |col|\r\n\t\t\tgrid[row][col] = (grid[row][col - 1]) + (grid[row -1][col])\r\n\t\tend\r\n\tend\r\nend",
"def draw_map_cells(x, y)\n for i in (0..x-1)\n for j in (0..y-1)\n MapCellEmpty.create(:x => $node_size*5 * i + $node_size *5/2.0, :y => $node_size * 5 * j + $node_size * 5/2.0)\n end\n end\n end",
"def link_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n cell = @fields[r][c]\n cell.neighbors = find_neighbors(cell)\n end\n end\n end",
"def reformat_for_next_generation!\n # create an array of dead cells and insert it as the first and last row of cells\n dead_cells = (1..@cells.first.size).map { Cell.new }\n # don't forget to deep copy the dead_cells\n @cells.unshift Marshal.load(Marshal.dump(dead_cells))\n @cells.push Marshal.load(Marshal.dump(dead_cells))\n\n # also insert a dead cell at the left and right of each row\n @cells.each do |row|\n row.unshift Cell.new\n row.push Cell.new\n end\n\n # validate to see if we broke the board\n validate\n end",
"def to_s\n result = ''\n for r in 0..height\n lines = Array.new(cell_height) { '' }\n for c in 0..width\n # Differentiate the behaviour based on the visibility state of four cells at a time\n c1, c2, c3, c4 = self[r-1, c-1], self[r-1, c], self[r, c-1], self[r, c]\n v1, v2, v3, v4 = (c1 and c1.visible), (c2 and c2.visible), (c3 and c3.visible), (c4 and c4.visible)\n if v4\n lines[0] << '#' * cell_width\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n lines[0] << if v1 or v2 or v3\n '#'\n else\n ' '\n end\n lines[0] << if v2\n '#' * (cell_width - 1)\n else\n ' ' * (cell_width - 1)\n end\n if v3\n (1...cell_height).each do | i | lines[i] << '#' end\n else\n (1...cell_height).each do | i | lines[i] << ' ' end\n end\n end\n if v4\n if c4.empty\n lines[1] << c4.number.to_s.ljust(cell_width-1)\n (2...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end \n else\n (1...cell_height).each do | i | lines[i] << '#' * (cell_width-1) end \n end\n else\n (1...cell_height).each do | i | lines[i] << ' ' * (cell_width-1) end\n end\n end\n result << lines.join(\"\\n\") << \"\\n\"\n end\n result\n end",
"def hourglassSum(arr)\r\n rc_arr = [\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0],\r\n [0, 0, 0, 0]\r\n ]\r\n\r\n arr.each_with_index do |row, i|\r\n row.each_with_index do |cell, j|\r\n rc_arr[i][j] += cell if (0..3).include?(j) && (0..3).include?(i)\r\n rc_arr[i][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i)\r\n rc_arr[i][j-2] += cell if (0..3).include?(j-2) && (0..3).include?(i)\r\n\r\n rc_arr[i-1][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i-1)\r\n\r\n rc_arr[i-2][j] += cell if (0..3).include?(j) && (0..3).include?(i-2)\r\n rc_arr[i-2][j-1] += cell if (0..3).include?(j-1) && (0..3).include?(i-2)\r\n rc_arr[i-2][j-2] += cell if (0..3).include?(j-2) && (0..3).include?(i-2)\r\n end\r\n end\r\n\r\n rc_arr.flatten.max\r\nend",
"def evolve\n\t\tcheckCells\n\t\tupdateCells\n\t\treturn @cells\n\tend",
"def get_other_block_cells cell\n\t\tblock = get_block cell\n\t\tfirst_cell = cell / 27 * 27\n\t\treturn (first_cell...first_cell + 27).select { |r| block == r / 27 * 3 + r % 9 / 3 }.to_a - [cell]\n\tend",
"def elements_grouped_by_cells\n elements.not_trashed.in_cell.group_by(&:cell)\n end",
"def map_board\n\t\t@cell_at = []\n\t\t@height.times do |row|\n\t\t\t@cell_at[row] = []\n\t\t\t@width.times do |col|\n\t\t\t\t@cell_at[row][col] = Cell.new\n\t\t\tend\n\t\tend\n\tend",
"def rect(col, row)\n row.times do |row_index|\n col.times do |col_index|\n @data[row_index][col_index] = true\n end\n end\n end",
"def break_blocks\n\t\tnew_height = 0\n\t\tnew_width = 0\n\t\t\n\t\t0.upto(height - 1) do |x|\n\t\t\tnew_height += self[x][0].height\n\t\tend\n\t\t0.upto(width - 1) do |x|\n\t\t\tnew_width += self[0][x].width\n\t\tend\n\n\t\tmatrix = Array.Make_Matrix(new_width,new_height)\n\t\tcurrent_height = 0\n\t\tcurrent_width = 0\n\t\twhile current_height < new_height\n\t\t\ti = 0\n\t\t\twhile i < height \n\t\t\t\tj = 0\n\t\t\t\twhile j < width\n\t\t\t\t\tcurrent_matrix = self[i][j]\n\t\t\t\t\ti2 = 0\n\t\t\t\t\twhile i2 < current_matrix.height \n\t\t\t\t\t\tj2 = 0\n\t\t\t\t\t\twhile j2 < current_matrix.width\n\t\t\t\t\t\t\tmatrix[current_height + i2][current_width + j2] = current_matrix[i2][j2]\n\t\t\t\t\t\t\tj2 += 1\n\t\t\t\t\t\tend\n\t\t\t\t\t\ti2 += 1\n\t\t\t\t\tend\n\t\t\t\t\tcurrent_width += current_matrix.width\n\t\t\t\t\tj += 1\n\t\t\t\tend\n\t\t\t\tcurrent_width =0\n\t\t\t\tcurrent_height += current_matrix.height\n\t\t\t\ti+=1\n\t\t\tend\n\t\tend\n\t\treturn matrix\n\tend",
"def set_all_cell_adjacent_mines\n @board.each_with_index do |row, row_index|\n @board[row_index].each_with_index do |column, column_index|\n set_cell_adjacent_mines(row_index,column_index)\n end\n end\n end",
"def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n\n x1, y1 = top_left_coords\n x2, y2 = bottom_right_coords\n sum = 0\n (x1..x2).each do |x|\n (y1..y2).each do |y|\n puts matrix[x][y]\n sum += matrix[x][y]\n end\n end\n sum\n\nend",
"def add_entity_to_grid(entity)\n cells_overlapping(entity.x, entity.y).each {|s| s << entity }\n end",
"def boundary_merge! *other_meshes\n other_meshes = [*other_meshes].flatten\n \n other_meshes.each do |variable|\n \n \n \n end\n \n \n end",
"def mergeVisual(l, m, r)\n\n lArr = Array.new\n rArr = Array.new\n\n # Create copy of left subarray\n for i in 0..(m - l)\n lArr.push(self[l + i])\n end\n\n # Create copy of right subarray\n for i in 0...(r - m)\n rArr.push(self[m + 1 + i])\n end\n \n for i in l..r\n\n # Place smaller of two subarrays first\n if not lArr.empty? and not rArr.empty?\n if lArr[0] <= rArr[0]\n self[i] = lArr.shift\n else\n self[i] = rArr.shift\n end\n # If one subarray is empty, copy the rest of the other subarray\n #into this array\n elsif lArr.empty?\n self[i] = rArr.shift\n else\n self[i] = lArr.shift\n end\n\n self.display\n \n end\n\n end",
"def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n total_sum = 0\n\n (top_left_coords[0]..bottom_right_coords[0]).each do |row_idx|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col_idx|\n total_sum += matrix[row_idx][col_idx]\n end\n end\n\n total_sum\nend",
"def rectangles_finder(arr)\n rectangle_spots = {} # will keep track of where rectangles occupy\n rectangles = [] # will keep track of the rectangle corners for output\n\n arr.each_with_index do |row, i|\n row.each_with_index do |el, j|\n if el == 1 && !rectangle_spots.include?([i, j])\n # Found a new rectangle corner\n ul = [i, j]\n br = bottom_right(arr, ul)\n\n # Add the rectangle corners to the output\n rectangles << [ul, br]\n\n # Add the new coordinates to the hash\n rectangle_spots = update_hash(rectangle_spots, [ul, br])\n end\n end\n end\n\n # Return the rectangles\n rectangles\nend",
"def generate_surrounding_spaces(x, y)\n surround_array = []\n# Loop over 3x3 grid\n for i in x-1..x+1\n for j in y-1..y+1\n # Exclude the center square and ones not on the grid\n if ((i==x) && (j==y)) || !is_on_grid(i,j)\n next\n end\n surround_array.push([j, i])\n end\n end\n\n return surround_array\nend",
"def cut_white_space_edges\n x1_array = Array.new\n x2_array = Array.new\n y1_array = Array.new\n y2_array = Array.new\n \n @groups.each do |g|\n x1_array << g.x_pos\n x2_array << g.x_pos + g.width\n y1_array << g.y_pos\n y2_array << g.y_pos + g.height\n end\n \n if @vertical\n #Normal position of the image (up)\n if values_bits[Constants::V_Image_position]< 4.5 \n @height = y2_array.max + @upper_margin\n #Alternative position(down)\n else \n new_height = @height - (y1_array.min-@upper_margin)\n \n @groups.each do |g|\n g.y_pos -= (@height - new_height)\n end\n @main_image.y_pos -= (@height - new_height)\n \n @height = new_height\n end\n else\n #Normal position of the image (left)\n if values_bits[Constants::V_Image_position]< 4.5\n @width = x2_array.max + @sides_margin\n #Alternative position of the image (right)\n else \n new_width = @width - (x1_array.min-@sides_margin)\n \n @groups.each do |g|\n g.x_pos -= (@width - new_width)\n end\n @main_image.x_pos -= (@width - new_width)\n \n @width = new_width\n end\n end\n end",
"def matrix_region_sum(matrix, top_left_coords, bottom_right_coords)\n sum = 0\n (top_left_coords[0]..bottom_right_coords[0]).each do |row|\n (top_left_coords[1]..bottom_right_coords[1]).each do |col|\n sum += matrix[row][col]\n end\n end\n\n sum\nend",
"def fill_area4(canvas, pt1, pt2, pt3, pt4, opt={})\n color = opt[:color] || opt[:c]\n color = canvas.type == :ppm ? [canvas.maxgray, canvas.maxgray, canvas.maxgray] : canvas.type == :pgm ? canvas.maxgray : 1 unless opt.has_key?(:color) || opt.has_key?(:c)\n \n ab = line(pt1, pt2)\n ad = line(pt1, pt4)\n sum_a = ab.merge(ad)\n cb = line(pt3, pt2)\n cd = line(pt3, pt4)\n sum_c = cb.merge(cd)\n \n final = []\n canvas.height.times do |y|\n row = []\n canvas.width.times do |x|\n pixel = canvas.pixels[y][x]\n if (sum_a.has_key?(x) && sum_c.has_key?(x)) && !(y >= sum_a[x] || y <= sum_c[x])\n pixel = color\n end\n row << pixel\n end\n final << row\n end\n \n PNM.create(final, {:type => :ppm, :maxgray => 255})\n end",
"def make_other_rows \n left = 2\n right = @n - 1\n\n (0..t-1).each do |c|\n (1..m-1).each do |r|\n @rounds[c][r] = \"#{left}-#{right}\"\n right = right_decrement(right)\n if r < m-1\n left = left_increment(left)\n elsif r == m-1\n left = left_increment_for_the_last_column(left)\n end\n end\n end\n end",
"def block_perimeter\n (0..width).each do |i|\n @cells[i][0].type = Cell::BLOCKED\n @cells[i][height].type = Cell::BLOCKED\n end\n (0..height).each do |j|\n @cells[0][j].type = Cell::BLOCKED\n @cells[width][j].type = Cell::BLOCKED\n end\n end",
"def to_s\n\t\t# top border\n\t\toutput = \"+\" + \"---+\" * columns + \"\\n\"\n\n\t\teach_row do |row|\n\t\t\ttop = \"|\"\n\t\t\tbottom = \"+\"\n\n\t\t\trow.each do |cell|\n\t\t\t\t# create a dummy, if no cell present (used by special geometries)\n\t\t\t\tcell = Cell.new(-1, -1) unless cell\n\n\t\t\t\tbody = \" \" # 3 spaces\n\t\t\t\teast_boundary = (cell.linked?(cell.east) ? \" \" : \"|\")\n\t\t\t\ttop << body << east_boundary\n\n\t\t\t\tsouth_boundary = (cell.linked?(cell.south) ? \" \" : \"---\")\n\t\t\t\tcorner = \"+\"\n\t\t\t\tbottom << south_boundary << corner\n\t\t\tend\n\n\t\t\toutput << top << \"\\n\"\n\t\t\toutput << bottom << \"\\n\"\n\t\tend\n\n\t\toutput\n\tend",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n # Rects Adjustments\n \n # ucEncounters\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = rect.width - rects[0][0].width - rects[0][1].width\n \n # ucDefeated\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = rect.width - rects[1][0].width - rects[1][1].width\n \n # ucEscaped\n rects[2][0].y += spacing*2\n rects[2][1].x += rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][2].x = rects[2][1].x + rects[2][1].width\n rects[2][2].y = rects[2][0].y\n rects[2][2].width = rect.width - rects[2][0].width - rects[2][1].width\n \n # ucExp\n rects[3][0].y += spacing*3\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = rect.width - rects[3][0].width - rects[3][1].width\n \n # ucGold\n rects[4][0].y += spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].x = rects[4][1].x + rects[4][1].width\n rects[4][2].y = rects[4][0].y\n rects[4][2].width = rect.width - rects[4][0].width - rects[4][1].width\n \n return rects\n end",
"def get_other_row_cells cell\n\t\treturn get_row_cells(get_row cell) - [cell]\n\tend",
"def establish_world(cell_width, cell_height)\n puts \"World is #{cell_width}x#{cell_height} cells\"\n @cell_width, @cell_height = cell_width, cell_height\n\n # Outer array is X-indexed; inner arrays are Y-indexed\n # Therefore you can look up @grid[cell_x][cell_y] ...\n # However, for convenience, we make the grid two cells wider, two cells\n # taller. Then we can populate the edge with Wall instances, and treat (0,\n # 0) as a usable coordinate. (-1, -1) contains a Wall, for example. The\n # at(), put(), and cut() methods do the translation, so only they should\n # access @grid directly\n @grid = Array.new(cell_width + 2) do |cy|\n Array.new(cell_height + 2) do |cx|\n Cell.new(cx-1, cy-1)\n end\n end\n\n # Top and bottom, including corners\n (-1 .. cell_width).each do |cell_x|\n put(cell_x, -1, Wall.new(self, cell_x, -1)) # top\n put(cell_x, cell_height, Wall.new(self, cell_x, cell_height)) # bottom\n end\n\n # Left and right, skipping corners\n (0 .. cell_height - 1).each do |cell_y|\n put(-1, cell_y, Wall.new(self, -1, cell_y)) # left\n put(cell_width, cell_y, Wall.new(self, cell_width, cell_y)) # right\n end\n\n self\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,90,24),\n Rect.new(rect.x,rect.y,100,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[10] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[11] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n gauge_value_width = rect.width - 24 - 25 - right_pad\n stats_value_width = rect.width - 24 - 50 - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0][1].x += rects[0][0].width\n \n # ucHpStat\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[2].y += rects[1][0].y+gauge_y\n rects[2].height = rects[1][0].height-gauge_y\n \n # ucMpStat\n rects[3][0].y += spacing*2\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[4].y += rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n \n # ucAtkStat\n rects[5][0].y += spacing*3\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].x = rects[5][1].x + rects[5][1].width\n rects[5][2].y = rects[5][0].y\n rects[5][2].width = stats_value_width\n \n # ucDefStat\n rects[6][0].y += spacing*4\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].x = rects[6][1].x + rects[6][1].width\n rects[6][2].y = rects[6][0].y\n rects[6][2].width = stats_value_width\n \n # ucSpiStat\n rects[7][0].y += spacing*5\n rects[7][1].x += rects[7][0].width\n rects[7][1].y = rects[7][0].y\n rects[7][2].x = rects[7][1].x + rects[7][1].width\n rects[7][2].y = rects[7][0].y\n rects[7][2].width = stats_value_width\n \n # ucAgiStat\n rects[8][0].y += spacing*6\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].x = rects[8][1].x + rects[8][1].width\n rects[8][2].y = rects[8][0].y\n rects[8][2].width = stats_value_width\n \n # ucEvaStat\n rects[9][0].y += spacing*7\n rects[9][1].x += rects[9][0].width\n rects[9][1].y = rects[9][0].y\n rects[9][2].x = rects[9][1].x + rects[9][1].width\n rects[9][2].y = rects[9][0].y\n rects[9][2].width = stats_value_width\n \n # ucHitStat\n rects[10][0].y += spacing*8\n rects[10][1].x += rects[10][0].width\n rects[10][1].y = rects[10][0].y\n rects[10][2].x = rects[10][1].x + rects[10][1].width\n rects[10][2].y = rects[10][0].y\n rects[10][2].width = stats_value_width\n \n # ucCriStat\n rects[11][0].y += spacing*9\n rects[11][1].x += rects[11][0].width\n rects[11][1].y = rects[11][0].y\n rects[11][2].x = rects[11][1].x + rects[11][1].width\n rects[11][2].y = rects[11][0].y\n rects[11][2].width = stats_value_width\n \n return rects\n end",
"def fill_matrix!\n\n @max_cell = -1 # value at max_cell\n @max_cell_row = 0 # row of max_cell\n @max_cell_column = 0 # column of max_cell\n\n (1..@height-1).each do |row|\n (1..@width-1).each do |column|\n compute(row, column)\n end\n end\n\n end",
"def merge a, b\n if a.length + b.length <= 1 then return a.concat(b) end\n # Make sure both sections have stable state within section\n a = asteroids(a)\n b = asteroids(b)\n\n # Now check what happens when they are placed next to each other.\n winner = wins(a, b)\n case winner\n when'neither'\n merge(a.slice(0, a.length - 1), b.slice(1..)) # Both asteroids at touch point are lost\n when 'left'\n merge(a, b.slice(1..)) # Left asteroid at touch point wins\n when 'right'\n merge(a.slice(0, a.length - 1), b) # Right asteroids at touch point wins\n else\n a.concat(b) # These sections are stable next to each other\n end\nend",
"def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend",
"def box_area_enlargement (rect)\n return rect.area if (@data + @children).empty?\n if leaf?\n new_area = (@data + [rect]).reduce(:enlarge).area\n else\n new_area = (@children.map(&:bounding_box) +\n [rect]).reduce(:enlarge).area\n end\n new_area - box_area\n end",
"def apply_rules(grid)\n new_grid = deep_copy_grid(grid)\n (0..(grid.length - 1)).each do |row|\n (0..(grid[0].length - 1)).each do |col|\n count = num_adjacent_occupied(grid, row, col)\n\n if grid[row][col] == 'L' && num_adjacent_occupied(grid, row, col).zero?\n new_grid[row][col] = '#'\n elsif grid[row][col] == '#' && num_adjacent_occupied(grid, row, col) >= 4\n new_grid[row][col] = 'L'\n end\n end\n end\n\n new_grid\n end",
"def neighborhood(cell)\n Set.new((cell[0]-1..cell[0]+1).map{|x| (cell[1]-1..cell[1]+1).map{|y| [x,y]}}.\n flatten(1)) - Set.new([cell])\nend",
"def merge_answer(answer)\n if answer.question_id == self.id\n q_cells = self.rows_of_cols\n a_cells = answer.rows_of_cols\n a_cells.each_pair do |row, cols| # go thru a_cells to make it faster\n cols.each_pair do |col, cell|\n if a_cells[row][col].text?\n q_cells[row][col].value = CGI.unescape(a_cells[row][col].value_text) || CGI.unescape(a_cells[row][col].value)\n else\n q_cells[row][col].value = a_cells[row][col].value.to_s || \"\" #if q_cells[row][col].eql_cell?(a_cells[row][col])\n end\n end\n end\n return q_cells\n end\n end",
"def _node_parse_table_cell(node)\n # In a Swordfish::Node::Table object, the number of table cells must equal the\n # total number of rows times the total number of columns; that is, even if\n # two cells are merged together, there must be a Swordfish::Node::TableCell for\n # each one. Merges are defined using the \"merge_up\" and \"merge_left\" properties.\n\n cell = Swordfish::Node::TableCell.new\n extra_cells = []\n\n # Get the inner content of the cell\n node.xpath(\"./w:p\").each do |paragraph|\n cell.append _node_parse_paragraph(paragraph)\n end\n \n # Determine whether this cell spans multiple rows. In Office OpenXML,\n # a table cell is defined in every row, even if the cell is vertically-merged. The representation\n # of the merged cell within each row is given a vMerge property, with the topmost one also\n # having a vMerge value of \"restart\", and the others having no vMerge value.\n if node.xpath(\"./w:tcPr/w:vMerge\").length > 0 && node.xpath(\"./w:tcPr/w:vMerge\")[0]['w:val'].nil?\n cell.merge_up = true\n end\n\n # Determine whether this cell spans multiple columns. Unlike with vertical merges,\n # a horizontally-merged Office OpenXML cell is only defined once, but is given a gridSpan\n # property defining the number of columns it spans. Since Swordfish requires a cell for each\n # column, loop to generate the additional cells, and set their merge_left values appropriately.\n if node.xpath(\"./w:tcPr/w:gridSpan\").length > 0\n node.xpath(\"./w:tcPr/w:gridSpan\")[0]['w:val'].to_i.-(1).times do\n c = Swordfish::Node::TableCell.new\n c.merge_left = true\n extra_cells << c\n end\n end\n\n # Return the generated cell or cells\n if extra_cells.empty?\n return cell\n else\n return [cell] + extra_cells\n end\n end",
"def populate_grid\n start_rows = { red: (0..2), black: (5..7) }\n\n 8.times do |x|\n 8.times do |y|\n [:red, :black].each do |color|\n if (x + y).even? && start_rows[color].include?(y)\n self[[x, y]] = Piece.new(color, [x, y], self)\n end\n end\n end\n end\n\n grid.each_with_index do |row, y|\n row.each_with_index do |cell, x|\n puts \"x=#{x}, y=#{y}, cell.class=#{cell.class}\"\n end\n end\n end",
"def generate_solution\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n until ary.count(0).zero?\n ary.each_with_index do |num, ind|\n row = calculate_area(ind + 1, :row)\n col = calculate_area(ind + 1, :col)\n box = calculate_area(ind + 1, :box)\n row_neighbours = tile_range.to_a.select {|n| calculate_area(n, :row).eql? row}\n col_neighbours = tile_range.to_a.select {|n| calculate_area(n, :col).eql? col}\n box_neighbours = tile_range.to_a.select {|n| calculate_area(n, :box).eql? box}\n neighbours = (row_neighbours + col_neighbours + box_neighbours).uniq!.map {|n| n -= 1}\n neighbouring_values = []\n neighbours.each {|n| neighbouring_values << ary[n]}\n options = (0..area_size).to_a.reject! {|x| neighbouring_values.compact.include?(x)}\n if options == []\n ary = (\"0\" * tile_count).chars.map(&:to_i)\n break\n end\n ary[ind] = options.sample\n end\n end\n return ary.join\n end",
"def construct_board_graphics_overlay(window)\n\t\tdark = false\t\t\t\t\t\t\t\t# this boolean controls the checkerboarding\n\t\tdark_hex = 0xff3f3333\n\t\tlight_hex = 0xff9e9fad\n\t\tself.board.each_with_index do |column, c|\n\t\t\tcolumn.size.times do |r|\n\t\t\t\tx = c*@cell_size\n\t\t\t\ty = r*@cell_size\n\t\t\t\tboard_cell = GraphicsLibrary::Rectangle.new(window, x, y, @cell_size, @cell_size, dark_hex, 0) if dark\n\t\t\t\tboard_cell = GraphicsLibrary::Rectangle.new(window, x, y, @cell_size, @cell_size, light_hex, 0) if !dark\n\t\t\t\tdark = !dark\n\t\t\t\t@board_graphics_overlay << board_cell\t\t\t\t\t# append the cells to the array of cells.\n\t\t\tend\n\t\t\tdark = !dark if (@stagger_cell_color_value % 2 == 0)\t\t# stagger the cell color for even sized boards so that it checkerboards properly.\n\t\t\t\t \n\t\tend\n\tend",
"def add_missing_cells_optimized\n a_cells = self.answer_cells.ratings\n count = 0\n # find missing\n cells = a_cells.map {|a| [a.row, a.col] }\n cell_arr = cells.first\n return if !(cell_arr && cell_arr.size == 2) \n\n q_cells = self.question.question_cells.ratings.map {|a| [a.row, a.col] }\n q_cells_size = q_cells.size\n missing_cells = q_cells - cells\n\n new_cells = []\n missing_cells.each do |m_cell|\n row, col = m_cell\n find_row = row - 1 # try one before this\n cells_away = 1 # how far the found cell is from the one to fill in\n while((prev_item = a_cells.detect { |c| c.row == find_row}).nil? && find_row > 0) do\n find_row -= 1\n cells_away += 1\n end\n if prev_item && (item = prev_item.item) && find_row > 0 && find_row < q_cells_size\n cells_away.times { item.succ! }\n unless exists = self.answer_cells(true).find_by_row_and_col(row, col)\n new_cells << self.answer_cells.build(:item => item, :row => row, :col => col, :answertype => 'Rating', :value => '')\n count += 1\n # puts \"AC created: #{ac.inspect}, item: #{item}, row: #{row}, m_cell: #{m_cell.inspect}\"\n end\n end\n row = col = find_row = cells_away = prev_item = exists = nil\n end if self.survey_answer.done\n new_cells\n end",
"def sum_region(row1, col1, row2, col2)\n r1,c1 = row1+1, col1+1\n r2,c2 = row2+1, col2+1\n p [\"r1c1\",r1,c1] if @d\n p [\"r2c2\",r2,c2] if @d\n a = @mx[r2][c2]\n l = @mx[r2][c1-1]\n u = @mx[r1-1][c2]\n ul = @mx[r1-1][c1-1]\n a - l - u + ul\n end",
"def build_spans on_range\n # TODO: rewrite in terms of each_row\n @spans = Array.new @size[1]\n\n @size[1].times do |y|\n spans = []\n left = (@size[1]-y-1)*@size[0]\n start = nil\n\n @size[0].times do |x|\n d = on_range.include?(@pixels[left+x])\n\n if !start && d\n start = x\n elsif start && !d\n spans << [start, x]\n start = nil\n end\n end\n\n spans << [start, @size[0]] if start\n @spans[y] = spans\n end\n end",
"def block_perimeter\n\t\t(0..width).each do |i| \n\t\t\t@cells[i][0].type \t\t\t\t= Cell::BLOCKED\n\t\t\t@cells[i][height].type \t= Cell::BLOCKED\n\t\tend\n\t\t(0..height).each do |j| \n\t\t\t@cells[0][j].type \t\t\t\t= Cell::BLOCKED\n\t\t\t@cells[width][j].type \t= Cell::BLOCKED\n\t\tend\n\tend",
"def test_merge_overlaping_2\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(y.mergeable?(x), true)\n y.merge(x)\n\n assert_equal(y.bottom, 1)\n assert_equal(y.top, 10)\n assert_equal(y.to_a, (1..10).to_a)\n\n a = each_to_a(y)\n\n assert_equal(a, (1..10).to_a)\n end",
"def summon_areas(numbered_tile,size,all_areas=[[numbered_tile]],restricted_board)\n return all_areas.uniq if all_areas[0].count >= size\n new_areas = []\n all_areas.each do |area|\n area.each do |x,y|\n directions = MODIFIERS.map do |m|\n m_x = m[0] + x\n m_y = m[1] + y\n [m_x,m_y]\n end\n # Remove reached tile if outside of board\n directions.delete_if{|i,j| i < 0 || j < 0 || i > (@row_count-1) || j > (@col_count-1) || (restricted_board[i,j] != 0) }\n # directions.delete_if{|i,j| i < 0 || j < 0 || i > 9 || j > 9 }\n # Add each valid direction to the area\n directions.each do |a,b|\n next if area.include? [a,b]\n new_area = area + [[a,b]]\n (new_areas << new_area) if (@b_nl[a,b] == 0)\n end\n end\n end\n\n # recursive action\n summon_areas(numbered_tile,size,new_areas.uniq, restricted_board)\n end",
"def merge(target)\n start, stop = if target.is_a?(String)\n [r, target]\n elsif target.is_a?(Cell)\n Axlsx.sort_cells([self, target]).map(&:r)\n end\n row.worksheet.merge_cells \"#{start}:#{stop}\" unless stop.nil?\n end",
"def cell_validate\n height = 2 * self.down - 1\n width = 2 * self.across - 1\n for i in (1..height).step(2) do\n for j in (1..width).step(2) do\n wall_num = calculate_boundary_sum(i,j)\n if(wall_num == 4 || wall_num == 0)\n puts \"[#{j/2},#{i/2}] is an invalid cell. Please enter another valid string\"\n self.valid = false\n end\n end\n end\n end",
"def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end"
] |
[
"0.6700961",
"0.65571266",
"0.6238821",
"0.60323006",
"0.5990784",
"0.59731245",
"0.5920083",
"0.58003664",
"0.5800355",
"0.57871675",
"0.57121533",
"0.56206787",
"0.56206787",
"0.560465",
"0.5599614",
"0.5568948",
"0.5552552",
"0.55465734",
"0.5524695",
"0.5521296",
"0.5500214",
"0.5496629",
"0.54932356",
"0.54893523",
"0.5483148",
"0.54755056",
"0.5463096",
"0.5458683",
"0.5457732",
"0.54483116",
"0.5442063",
"0.5424661",
"0.541205",
"0.54097533",
"0.53808963",
"0.5377264",
"0.5368752",
"0.53275824",
"0.5305597",
"0.5304339",
"0.52997404",
"0.52975345",
"0.52943194",
"0.5280741",
"0.52775574",
"0.5273038",
"0.52641416",
"0.5261766",
"0.5258007",
"0.52492416",
"0.5247947",
"0.52351624",
"0.52306604",
"0.5229199",
"0.52233714",
"0.5218432",
"0.5217124",
"0.5207335",
"0.5207182",
"0.5206541",
"0.52013",
"0.51955444",
"0.5194945",
"0.5166334",
"0.5157919",
"0.5157884",
"0.5154154",
"0.51534045",
"0.5153073",
"0.5145638",
"0.51451606",
"0.5136449",
"0.5121963",
"0.512143",
"0.51203096",
"0.5118382",
"0.51068527",
"0.51064676",
"0.5106125",
"0.51004624",
"0.5092046",
"0.5087844",
"0.5075472",
"0.5074897",
"0.5072212",
"0.5069274",
"0.5065843",
"0.5064595",
"0.5057101",
"0.5056863",
"0.50466913",
"0.50457436",
"0.5034726",
"0.50312907",
"0.5031113",
"0.50268555",
"0.5024821",
"0.5018041",
"0.5014876",
"0.5010056"
] |
0.63581824
|
2
|
Changes fill color of cell
|
def change_fill(rgb = 'ffffff')
validate_worksheet
Color.validate_color(rgb)
self.style_index = workbook.modify_fill(self.style_index, rgb)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fill(color)\n @style[:fill] = color\n end",
"def fill_color(color)\n end",
"def change_fill(rgb='ffffff')\n validate_worksheet\n Color.validate_color(rgb)\n @style_index = modify_fill(@workbook, @style_index,rgb)\n end",
"def setfillcolorind(*)\n super\n end",
"def fillColor=(color)\n @fill_color = color.CGColor\n self.setNeedsDisplay\n end",
"def fill(color)\n @window.fill_with(color)\n end",
"def fill_color()\n validate_worksheet\n xf = @workbook.get_style_attributes(@workbook.get_style(@style_index))\n return @workbook.get_fill_color(xf)\n end",
"def fill(pattern)\n @style[:fill] = pattern(pattern)\n end",
"def fill_color(color=nil)\n cur_page.fill_color(color)\n end",
"def change_row_fill(row=0,rgb='ffffff')\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n Color.validate_color(rgb)\n if @row_styles[(Integer(row)+1).to_s].nil?\n @row_styles[(Integer(row)+1).to_s] = {}\n @row_styles[(Integer(row)+1).to_s][:style] = '0'\n end\n\n @row_styles[(Integer(row)+1).to_s][:style] = modify_fill(@workbook,Integer(@row_styles[(Integer(row)+1).to_s][:style]),rgb)\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n c.change_fill(rgb)\n end\n end\n end",
"def set_fill_color_a(color = RFPDF::COLOR_PALETTE[:white], colorspace = :rgb)\n if colorspace == :cmyk\n SetCmykFillColor(color[0], color[1], color[2], color[3])\n else\n SetFillColor(color[0], color[1], color[2])\n end\n end",
"def fill=(value)\n @fill = value\n end",
"def shading_colour=(colour)\n self.each {|cell| cell.shading_colour = colour}\n end",
"def fill_cell(loc = {}, fill_color = BLUE, opacity = 255)\n fill_color.alpha = opacity\n tl, tr, bl, br = pixel_top_left(loc[:x], loc[:y]), pixel_top_right(loc[:x], loc[:y]),\n pixel_bottom_left(loc[:x], loc[:y]), pixel_bottom_right(loc[:x], loc[:y])\n make_quad(tl, tr.left(1), bl.up(1), br.left(1).up(1), fill_color, opacity, loc[:z])\n end",
"def color(val)\n raise 'Please provide a valid cell color' unless ('A'..'Z').include?(val)\n self.value = val\n end",
"def color_reset!(fill)\n save = background_color\n # Change the background color _outside_ the begin block\n # so that if this object is frozen the exeception will be\n # raised before we have to handle it explicitly.\n self.background_color = fill\n begin\n erase!\n ensure\n self.background_color = save\n end\n self\n end",
"def fill(colorspec)\n primitive \"fill #{enquote(colorspec)}\"\n end",
"def setfillstyle(*)\n super\n end",
"def modify_fill(workbook, style_index, rgb)\n xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(xf_obj)\n #modify fill array\n fill_id = xf[:fillId]\n\n fill = workbook.fills[fill_id.to_s][:fill]\n if workbook.fills[fill_id.to_s][:count] > 1 || fill_id == 0 || fill_id == 1\n old_size = workbook.fills.size.to_s\n workbook.fills[old_size] = {}\n workbook.fills[old_size][:fill] = deep_copy(fill)\n workbook.fills[old_size][:count] = 1\n workbook.fills[fill_id.to_s][:count] -= 1\n\n change_wb_fill(workbook, old_size,rgb)\n\n #modify styles array\n fill_id = old_size\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fillId] = fill_id\n xf[:applyFill] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1\n else\n change_wb_fill(workbook, fill_id.to_s,rgb)\n return style_index\n end\n end",
"def set_svg_fill_color(xml, color)\n # Find all primitives.\n primitives = ['path', 'circle', 'rect', 'line', 'ellipse', 'polyline', 'polygon', 'text']\n \n # Strip existing fills.\n primitives.each do |primitive|\n xml.xpath(\"//xmlns:#{primitive}\").each do |child|\n child['fill'] = \"##{color}\"\n end\n end\n end",
"def with_color(color=\"999999\", &block)\n fill_color color\n yield if block_given?\n # Reset the color to the default\n fill_color grey\n end",
"def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def inqfillcolorind\n inquiry_int { |pt| super(pt) }\n end",
"def set_cell(x, y, color)\n get_cell(x, y).color = color\n @last_cell_played = get_cell(x, y)\n end",
"def color=(color)\n each_with_index do |cell, index|\n cell.color = color.is_a?(Array) ? color[index] : color\n end\n end",
"def fill_setup(gc)\n if @obj.fill\n gc.set_background @obj.fill\n gc.set_alpha @obj.fill_alpha\n true\n end\n end",
"def fill_region(x, y, colour)\n return if invalid?(x,y)\n x = xform(x)\n y = xform(y)\n target_colour = @matrix.element(y, x)\n @matrix.flood_fill(x, y, target_colour, colour)\n end",
"def color_fill_to_border(x, y, fill)\n color_flood_fill(border_color, fill, x, y, Magick::FillToBorderMethod)\n end",
"def color= color\n @marker_fill_color = color\n @marker_border_color = color\n end",
"def fill(r=0, g=0, b=0, a=1)\n case r\n when Color\n g = r.g\n b = r.b\n a = r.a\n r = r.r\n end\n CGContextSetRGBFillColor(@ctx, r, g, b, a) # RGBA\n @fill = true\n end",
"def update_fill\n end",
"def fill(row, column, colour, memo = [])\n start_colour = self[row, column]\n self[row, column] = colour\n\n memo.push([row, column]) # adds coordinates to memo\n p memo\n (row - 1..row + 1).each do |i|\n (column - 1..column + 1).each do |j|\n next unless valid_coordinates?(i, j)\n next if memo.include? [i, j]\n next unless self[i, j] == start_colour\n\n fill(i, j, colour, memo)\n end\n end\n end",
"def colorize canvas, color\n canvas.itemconfigure tag, :fill => color\n rescue => ex\n if ex.message =~ /unknown option \"-fill\"/\n extend CarefulColorize\n colorize canvas, color\n else\n raise\n end\n end",
"def setfillintstyle(*)\n super\n end",
"def highlight_cell(tbl, row, col, id, check: false)\n bg_color = '&#ade6dd' unless check\n\n tbl[row + 1][col + 1] = { content: id,\n check: check,\n class: 'td-full-slot',\n style: {'background-color'=> bg_color}}\n end",
"def fill_paint(paint)\n end",
"def fill_column(x, y1, y2, colour)\n return if invalid?(x,y1) || invalid?(x,y2)\n y1.upto(y2) do |i|\n colour(x,i,colour)\n end\n end",
"def set_color(piece)\n # sets color to red if at cursor [row, col]\n if cursor.cursor_pos == piece.position\n to_color = {:color => :light_blue, :background => :red}\n # otherwise color is blue\n else\n to_color = :blue\n end\n\n to_color\n end",
"def fill\n fit\n rounding_error\n border_x = (@x - rmagick_img.columns)/2\n border_y = (@y - rmagick_img.rows)/2\n\n rmagick_img.border!(border_x,border_y,\"white\")\n end",
"def fill_and_stroke\n cur_page.fill_and_stroke\n end",
"def paint( color )\n self.update(color: color)\n end",
"def fill\n \t@fill\n end",
"def setcolorrep(*)\n super\n end",
"def flood_fill(x, y, color)\n x_i, y_i = pixel_to_index(x, y)\n original_color = bitmap[y_i][x_i]\n flood_fill_helper(x, y, original_color, color)\n end",
"def bg_color_for cell:, algo: :rotate_hue, scalar: 1.25\n\t\t\tself.send(algo, cell: cell, scalar: scalar)\n\t\tend",
"def color_floodfill(x, y, fill)\n target = pixel_color(x, y)\n color_flood_fill(target, fill, x, y, Magick::FloodfillMethod)\n end",
"def SetFillColor(r, g=-1, b=-1, storeprev=false)\n\t\t#Set color for all filling operations\n\t\tif ((r==0 and g==0 and b==0) or g==-1)\n\t\t\t@fill_color=sprintf('%.3f g', r/255.0);\n\t\telse\n\t\t\t@fill_color=sprintf('%.3f %.3f %.3f rg', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (@page>0)\n\t\t\tout(@fill_color);\n\t\tend\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevfill_color = [r, g, b]\n\t\tend\n\tend",
"def color\n @marker_fill_color || @marker_border_color || :default\n end",
"def paint_fill(screen, point, new_color, old_color = nil)\n x = point[0]\n y = point[1]\n\n old_color ||= screen[y][x]\n if screen[y][x] != old_color\n return\n else\n screen[y][x] = new_color\n paint_fill(screen, [x, y + 1], new_color, old_color) if y + 1 < screen.length\n paint_fill(screen, [x, y - 1], new_color, old_color) if y - 1 >= 0\n paint_fill(screen, [x + 1, y], new_color, old_color) if x + 1 < screen[0].length\n paint_fill(screen, [x - 1, y], new_color, old_color) if x - 1 >= 0\n end\n screen\nend",
"def background_fill\n @background_fill ||= begin\n digest = \"0.#{Digest::MD5.hexdigest(@name).to_i(16).to_s}\".to_f\n index = (digest * (@background_colors.length - 1)).round\n @background_colors[index]\n end\n end",
"def clear(fill_color = @fill)\n color = fill_color || @fill\n ext_clear([color.r, color.g, color.b, color.a])\n update_texture if @update\n end",
"def fill\n self.each {|image| image.fill}\n end",
"def fillrect(*)\n super\n end",
"def paint_fill(screen, point, new_color)\n seen = {}\n old_color = color(point, screen)\n to_fill = [point]\n\n until to_fill.empty? do\n current_point = to_fill.shift\n screen[current_point[0]][current_point[1]] = new_color\n neighbors(current_point, screen.length, screen.first.length).each do |neighbor|\n if !seen[neighbor] && color(neighbor, screen) == old_color\n to_fill.push(neighbor)\n seen[neighbor] = true\n end\n end\n end\n\n render screen\nend",
"def colour(x, y, colour)\n return if invalid?(x, y)\n x = xform(x)\n y = xform(y)\n @matrix[y, x] = colour\n end",
"def cellarray(xmin, xmax, ymin, ymax, dimx, dimy, color)\n super(xmin, xmax, ymin, ymax, dimx, dimy, 1, 1, dimx, dimy, int(color))\n end",
"def cellarray(xmin, xmax, ymin, ymax, dimx, dimy, color)\n super(xmin, xmax, ymin, ymax, dimx, dimy, 1, 1, dimx, dimy, int(color))\n end",
"def change_bg_color(color)\n @bg_color = color\n self.bitmap.fill_rect(self.bitmap.rect,color)\n end",
"def set_draw_color_a(color = RFPDF::COLOR_PALETTE[:black])\n SetDrawColor(color[0], color[1], color[2])\n end",
"def circle_filled(x, y, r)\n\t\t@screen.drawAAFilledCircle x, y, r, @color_fg\n\tend",
"def gradient_fill_region(x, y, a, b, c)\n return if invalid?(x, y)\n fill_region(x, y, c)\n colour(x, y, a)\n x = x.to_i\n y = y.to_i\n conditional_colour(x-1, y, b, c)\n conditional_colour(x+1, y, b, c)\n conditional_colour(x, y-1, b, c)\n conditional_colour(x, y+1, b, c)\n conditional_colour(x-1, y-1, b, c)\n conditional_colour(x+1, y-1, b, c)\n conditional_colour(x-1, y+1, b, c)\n conditional_colour(x+1, y+1, b, c) \n end",
"def prepare_fills # :nodoc:\n fills = {}\n index = 2 # Start from 2. See above.\n\n # Add the default fills.\n fills['0:0:0'] = 0\n fills['17:0:0'] = 1\n\n # Store the DXF colors separately since them may be reversed below.\n @dxf_formats.each do |format|\n next unless format.pattern != 0 || format.bg_color != 0 || format.fg_color != 0\n\n format.has_dxf_fill(true)\n format.dxf_bg_color = format.bg_color\n format.dxf_fg_color = format.fg_color\n end\n\n @xf_formats.each do |format|\n # The following logical statements jointly take care of special cases\n # in relation to cell colours and patterns:\n # 1. For a solid fill (_pattern == 1) Excel reverses the role of\n # foreground and background colours, and\n # 2. If the user specifies a foreground or background colour without\n # a pattern they probably wanted a solid fill, so we fill in the\n # defaults.\n #\n if format.pattern == 1 && ne_0?(format.bg_color) && ne_0?(format.fg_color)\n format.fg_color, format.bg_color = format.bg_color, format.fg_color\n elsif format.pattern <= 1 && ne_0?(format.bg_color) && eq_0?(format.fg_color)\n format.fg_color = format.bg_color\n format.bg_color = 0\n format.pattern = 1\n elsif format.pattern <= 1 && eq_0?(format.bg_color) && ne_0?(format.fg_color)\n format.bg_color = 0\n format.pattern = 1\n end\n\n key = format.get_fill_key\n\n if fills[key]\n # Fill has already been used.\n format.fill_index = fills[key]\n format.has_fill(false)\n else\n # This is a new fill.\n fills[key] = index\n format.fill_index = index\n format.has_fill(true)\n index += 1\n end\n end\n\n @fill_count = index\n end",
"def set_cellval(x,y,value, opts = {:color => 0})\n cell = @ole_worksheet.Cells.Item(x, y)\n cell.Interior.ColorIndex = opts[:color] # 42 - aqua-marin, 4-green\n @workbook.modified_cells << cell if @workbook\n cell.Value = value\n rescue WIN32OLERuntimeError\n raise RangeNotEvaluatable, \"cannot assign value #{value.inspect} to cell (#{y.inspect},#{x.inspect})\"\n end",
"def fill_row(x1, x2, y, colour)\n return if invalid?(x1,y) || invalid?(x2,y)\n x1.upto(x2) do |i|\n colour(i,y,colour)\n end\n end",
"def F(args)\n return unless check_dimensions(args, 3)\n cell = Cell.new *check_integers(args[0..1])\n return unless cell\n new_colour = args[2]\n existing_colour = @image.get_colour(cell)\n return if existing_colour == new_colour\n check_cells = [cell]\n until check_cells.empty?\n new_cells = fill(check_cells.pop, existing_colour, new_colour)\n check_cells.push(*new_cells.select{ |cell| @image.in?(cell)})\n end\n end",
"def color=(theColor)\n @shadowHash[:fillcolor] = theColor\n end",
"def recolor(color)\n @color = color\n self\n end",
"def floodFill(col, row)\r\n (col > @columns-1 || col < 0 || row > @rows-1 || row < 0) && return #Returns if the tile index is outside of the grid bounds.\r\n @tile[col][row].revealed && return #Returns if the tile is already revealed.\r\n\r\n @tile[col][row].revealed = true #Marks the tile as revealed.\r\n @hiddenCount -= 1\r\n adjacent = @tile[col][row].adjacent #Gets the adjacent count for the tile.\r\n\r\n #Reveal the adjacent count of the tile.\r\n old = @tile[col][row].btn\r\n newStyle = old.style.dup\r\n old.parent.before(old) do\r\n @btn = button(adjacent.to_s, newStyle)\r\n end\r\n old.remove\r\n\r\n #Recursively calls flood fill for the surrounding tiles.\r\n if (@tile[col][row].adjacent == 0)\r\n floodFill(col+1,row+1)\r\n floodFill(col+1,row)\r\n floodFill(col+1,row-1)\r\n floodFill(col,row+1)\r\n floodFill(col,row-1)\r\n floodFill(col-1,row+1)\r\n floodFill(col-1,row)\r\n floodFill(col-1,row-1)\r\n end\r\n\r\nend",
"def highlightCell\n disptype = @colvalues[@col]\n highlight = @highlight\n infolen = @info[@row][@col].size\n \n # Given the dominance of the color/attributes, we need to set the\n # current cell attribute.\n if @dominant == CDK::ROW\n highlight = (@rowtitle[@crow][0] || 0) & Ncurses::A_ATTRIBUTES\n elsif @dominant == CDK::COL\n highlight = (@coltitle[@ccol][0] || 0) & Ncurses::A_ATTRIBUTES\n end\n\n # If the column is only one char.\n (1..@colwidths[@ccol]).each do |x|\n ch = if x <= infolen && !Display.isHiddenDisplayType(disptype)\n then CDK.CharOf(@info[@row][@col][x - 1])\n else @filler\n end\n self.CurMatrixCell.mvwaddch(1, x, ch.ord | highlight)\n end\n self.CurMatrixCell.wmove(1, infolen + 1)\n self.CurMatrixCell.wrefresh\n end",
"def foreground_fill\n red = background_fill[1..2].to_i(16)\n green = background_fill[3..4].to_i(16)\n blue = background_fill[5..6].to_i(16)\n (red * 0.299 + green * 0.587 + blue * 0.114) > 186 ? '#000000' : '#FFFFFF'\n end",
"def floodfill(x, y, color)\n if @pixels[y-1][x-1] != color\n @pixels[y-1][x-1] = color\n floodfill(x+1, y, color)\n floodfill(x-1, y, color)\n floodfill(x, y + 1, color)\n floodfill(x, y - 1, color)\n end\n end",
"def change_grid(x:, y:, color:)\n return if (x > max_x) || (x < 0)\n return if (y > max_y) || (y < 0)\n col = effective_color(x: x, y: y, color: color)\n grid_apply_color(x, y, col)\n end",
"def new_fill(value)\n self.class.new(*shape).fill(value)\n end",
"def set_fill\n @fill = Fill.find(params[:id])\n end",
"def colour(x, y, c)\n x, y = x.to_i, y.to_i\n\n unless self.bounds?(x, y)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n self[y, x] = c\n end",
"def SetCmykFillColor(c, m, y, k, storeprev=false)\n\t\t#Set color for all filling operations\n\t\t@fill_color=sprintf('%.3f %.3f %.3f %.3f k', c, m, y, k);\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [c, m, y, k]\n\t\tend\n\t\tif (@page>0)\n\t\t\tout(@fill_color);\n\t\tend\n\tend",
"def matte_fill_to_border(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n f.matte_flood_fill(border_color, x, y, FillToBorderMethod, alpha: TransparentAlpha)\n end",
"def spray_paint(new_color)\n self.color = new_color\n end",
"def process(doc)\n doc.css('[fill^=\"url(#\"]').attr(\"fill\", \"#ffffff\")\n doc.css('[style*=\"fill:url(#\"]').each do |el|\n style = el.attribute(\"style\").to_s\n updated_style = style.gsub(/fill:url\\([^\\)]*\\)/, \"fill:#ffffff\")\n el[\"style\"] = updated_style\n end\nend",
"def draw_fill_rect(rect, color, _fill_type = fill_type)\n bmp = self.bitmap\n rect = Convert.Rect(rect) unless rect.is_a?(Rect) # Rect#try_cast\n return if rect.empty?\n case _fill_type\n ## default style\n when :null\n when :flat, :default\n bmp.fill_rect(rect, color)\n when :round\n bmp.round_fill_rect(rect, color)\n when :blend\n bmp.blend_fill_rect(rect, color)\n when :blend_round\n bmp.round_blend_fill_rect(rect, color)\n when :smooth, :smooth_round\n ## smooth style\n color2 = color.blend.darken(0.08) # kinda heavy\n r1 = rect.dup\n r2 = r1.contract(anchor: border_anchor, amount: border_size)\n if _fill_type == :smooth\n ## block\n bmp.blend_fill_rect(r1, color2)\n bmp.blend_fill_rect(r2, color)\n elsif _fill_type == :smooth_round\n ## rounded\n bmp.round_blend_fill_rect(r1, color2)\n bmp.round_blend_fill_rect(r2, color)\n end\n else\n raise ArgumentError, \"invalid fill_type #{_fill_type}\"\n end\n return rect\n end",
"def fill_rect(*args)\n raise \"not implemented\"\n end",
"def strokeColor=(color)\n @stroke_color = color.CGColor\n self.setNeedsDisplay\n end",
"def fill\n return @fill\n end",
"def fill_graphicsblock(*args)\n @p.fill_graphicsblock(self, *args)\n end",
"def floodfill(pixel, target_color, replacement_color)\n return unless pixel\n return if pixel.color == replacement_color\n return if pixel.color != target_color\n return if target_color != BLANK_COLOR && @pixel_lock # don't replace non-blank pixels with color if pixels are locked\n\n pixel.color = replacement_color\n @canvas_changed = true\n\n # UP\n _pixel = get_pixel_at(pixel.x, pixel.y - @grid_pixel_size)\n floodfill(_pixel, target_color, replacement_color)\n\n # DOWN\n _pixel = get_pixel_at(pixel.x, pixel.y + @grid_pixel_size)\n floodfill(_pixel, target_color, replacement_color)\n\n # LEFT\n _pixel = get_pixel_at(pixel.x - @grid_pixel_size, pixel.y)\n floodfill(_pixel, target_color, replacement_color)\n\n # RIGHT\n _pixel = get_pixel_at(pixel.x + @grid_pixel_size, pixel.y)\n floodfill(_pixel, target_color, replacement_color)\n end",
"def highlight\n\t\tpushStyle\n\t\t\tno_stroke\n\t\t\tfill 14, 70, 70\n\t\t\tellipse(@node_x, @node_y, @@node_size + @@expand, @@node_size + @@expand)\n\t\tpopStyle\n\tend",
"def recolor(tag, color)\r\n @listarea.tag_configure(tag, 'foreground' => color)\r\n end",
"def set_neighbour_colour(col, row)\n xd = rand(2)\n @blocks[row][col] = @blocks[row - (1 - xd)][col - xd]\n end",
"def update!(**args)\n @border = args[:border] if args.key?(:border)\n @fill = args[:fill] if args.key?(:fill)\n @shape = args[:shape] if args.key?(:shape)\n end",
"def color_point(x, y, fill)\n f = copy\n f.pixel_color(x, y, fill)\n f\n end",
"def flood_fill(image, sr, sc, new_color)\r\n queue = [[sr, sc]]\r\n old_color = image[sr][sc]\r\n until queue.empty? do \r\n start = queue.pop\r\n x, y = start\r\n image[x][y] = new_color\r\n queue << [x, y+1] if y+1 < image[x].length && image[x][y+1] == old_color\r\n queue << [x, y-1] if y-1 >= 0 && image[x][y-1] == old_color\r\n queue << [x+1, y] if x+1 < image.length && image[x+1][y] == old_color\r\n queue << [x-1, y] if x-1 >= 0 && image[x-1][y] == old_color\r\n end\r\n image\r\nend",
"def color=(value)\n @color = value\n end",
"def color=(value)\n @color = value\n end",
"def setmarkercolorind(*)\n super\n end",
"def color(color); end",
"def clear\n grid.map do |row|\n row.map! do |pixel|\n pixel = DEFAULT_FILL\n end\n end\n end",
"def []=(x, y, color)\n @modified[x, y] = color\n end",
"def setDefaultColor\n self.changeColor A_NORMAL, COLOR_WHITE, COLOR_BLACK\n end",
"def bucket_paint(x_index = nil, y_index = nil)\n if x_index.nil? || y_index.nil?\n x_index = @x_index\n y_index = @y_index\n end\n\n # Checks if the adjacent cell's color is same the current cell.\n # On success, it paints the current cell and moves to the next adjacent cells.\n return if @input_2d_array[x_index].nil? || @input_2d_array[x_index][y_index] != @old_color\n\n @input_2d_array[x_index][y_index] = @new_color\n\n # Paint right\n bucket_paint(x_index+1, y_index)\n # Paint bottom\n bucket_paint(x_index, y_index+1)\n # Paint left\n bucket_paint(x_index-1, y_index) if x_index-1 >= 0\n # Paint top\n bucket_paint(x_index, y_index-1) if y_index-1 >= 0\n end"
] |
[
"0.7817586",
"0.7680768",
"0.7537821",
"0.74548644",
"0.7234923",
"0.7226518",
"0.70177794",
"0.69221914",
"0.68277735",
"0.67624754",
"0.66980034",
"0.6589905",
"0.6563709",
"0.6500531",
"0.64753926",
"0.6473927",
"0.63611907",
"0.63611335",
"0.6320901",
"0.62614584",
"0.62032354",
"0.61087066",
"0.61087066",
"0.6101561",
"0.60948205",
"0.60713506",
"0.60606945",
"0.60553396",
"0.60447353",
"0.60416305",
"0.601891",
"0.5999653",
"0.5975085",
"0.5962525",
"0.5924309",
"0.59104276",
"0.58524483",
"0.58392084",
"0.5806253",
"0.580579",
"0.58012",
"0.5783394",
"0.5773162",
"0.5757474",
"0.5752411",
"0.5745072",
"0.57403934",
"0.5729638",
"0.57263863",
"0.5686482",
"0.56697345",
"0.56683046",
"0.5637301",
"0.5632878",
"0.55885696",
"0.5578833",
"0.5578833",
"0.5570731",
"0.5537497",
"0.5494836",
"0.5494146",
"0.54640824",
"0.5453173",
"0.544281",
"0.5419062",
"0.54175633",
"0.5414549",
"0.5392301",
"0.538533",
"0.5385325",
"0.5384122",
"0.53760815",
"0.5371713",
"0.536633",
"0.5361674",
"0.53517854",
"0.531716",
"0.53039205",
"0.53034234",
"0.53018665",
"0.5300732",
"0.5274945",
"0.5272186",
"0.526769",
"0.5267306",
"0.5266123",
"0.52617043",
"0.525021",
"0.52326703",
"0.5207748",
"0.51998264",
"0.5181946",
"0.51803184",
"0.5173454",
"0.51678836",
"0.5162485",
"0.51523364",
"0.5150673",
"0.51499456"
] |
0.75035655
|
3
|
Changes font name of cell
|
def change_font_name(new_font_name = 'Verdana')
validate_worksheet
font = get_cell_font.dup
font.set_name(new_font_name)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def font_name()\n validate_worksheet\n @workbook.fonts[font_id()][:font][:name][:attributes][:val]\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def default_font_name()\n end",
"def fontName\n return @font_name\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def font=(font)\n @label.font = font\n end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def font(name)\n primitive \"font \\'#{name}\\'\"\n end",
"def font=(value)\n @font = value\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def name\n read_attribute(:font_name)\n end",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def font(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @fonts[sheet][normalize(row,col).to_a]\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def coordinate_labels_font_family\n if self.options[:font_family].blank?\n 'Helvetica Neue'\n else\n self.options[:font_family]\n end\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def font(name=nil, size=nil, options={})\n cur_page.font(name, size, options)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def default_font; \"example.font\"; end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def cell_name\n name.underscore.sub(/_cell/, '')\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def reset_font_settings; set_data_font(:category_label); end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def reset_font_settings; set_data_font(:scene_label); end",
"def pickerView(pickerView, didSelectRow:row, inComponent:component)\n if @switch_font.on? == true\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville-Bold\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue-Bold\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate-Bold\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n else\n case row\n when 0\n @font_label.font = UIFont.fontWithName(\"Baskerville\",size:@font_size)\n @font_label.text = \"Baskerville\"\n when 1\n @font_label.font = UIFont.fontWithName(\"HelveticaNeue\",size:@font_size)\n @font_label.text = \"HelveticaNeue\"\n when 2\n @font_label.font = UIFont.fontWithName(\"Copperplate\",size:@font_size)\n @font_label.text = \"Copperplate\"\n end\n end\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def font=(font_path)\n @title_font.path = font_path unless @title_font.path\n @marker_font.path = font_path\n @legend_font.path = font_path\n end",
"def draw_name\n set_data_font(:name)\n clear_and_draw_text(0, @draw_y, contents_width, line_height, @quest.name, 1)\n end",
"def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end",
"def cell_name\n self.name.underscore.sub(/_cell\\Z/, '')\n end",
"def font(name=\"Helvetica\", size=nil)\n fontsize(size) if size\n @fname = name\n fontsize unless @fsize\n CGContextSelectFont(@ctx, @fname, @fsize, KCGEncodingMacRoman)\n end",
"def change_font_size(font_size=10)\n validate_worksheet\n if font_size.is_a?(Integer) || font_size.is_a?(Float)\n # Get copy of font object with modified size\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_font(font)\n else\n raise 'Argument must be a number'\n end\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def pbSetSmallFont(bitmap)\n bitmap.font.name=pbSmallFontName\n bitmap.font.size=25\nend",
"def stylename=(new_stylename)\n @stylename = new_stylename\n restyle!\n end",
"def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end",
"def name_cell(item)\n data = if used?(item.breakdown)\n data = [\n [{ content: item.name, padding: [5, 0, 0, 5] }],\n [{ content: item.breakdown, size: 8, padding: [2, 0, 5, 5] }]\n ]\n\n options = {\n cell_style: {\n borders: []\n },\n position: :left\n }\n\n @pdf.make_table(data, options)\n else\n item.name\n end\n end",
"def set_font(key, font)\r\n # Add :Font key to content hash unless there is no key\r\n unless @content[pn(:Resources)].has_key?(pn(:Font))\r\n @content[pn(:Resources)].update(pn(:Font) => pd)\r\n end\r\n # Add font symbol to :Font hash\r\n unless @content[pn(:Resources)][pn(:Font)].has_key?(key)\r\n @content[pn(:Resources)][pn(:Font)].update(key => font.reference)\r\n end\r\n end",
"def changeCell(cell, symbol)\n\t\t@field[cell].value = symbol\n\tend",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def set_font_from_path(font, bold_font)\n font_name = Pathname.new(font).basename\n @pdf.font_families.update(\n \"#{font_name}\" => {\n normal: font,\n italic: font,\n bold: bold_font,\n bold_italic: bold_font\n }\n )\n @pdf.font(font_name)\n end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def maiil_reset_font\n fn = MA_IconItemList::NUM_FONTNAME ? MA_IconItemList::NUM_FONTNAME : Font.default_name\n contents.font = Font.new(fn, MA_IconItemList::NUM_FONTSIZE) # name and size\n contents.font.bold = MA_IconItemList::NUM_BOLD # Set Bold\n contents.font.italic = MA_IconItemList::NUM_ITALIC # Set Italic\n contents.font.shadow = MA_IconItemList::NUM_SHADOW # Set Shadow\n contents.font.outline = MA_IconItemList::NUM_OUTLINE # Set outline\n oc = MA_IconItemList::NUM_OUT_COLOUR ? MA_IconItemList::NUM_OUT_COLOUR : Font.default_out_color\n contents.font.out_color = text_color(oc) # outline color\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def change_color(color)\n self.font.color = color\n end",
"def cell_name\n # XXX Why is this needed? Can there be cells which have a different\n # @cell_name from their class's name?\n @cell_name || self.class.cell_name\n end",
"def cell_name\n # XXX Why is this needed? Can there be cells which have a different\n # @cell_name from their class's name?\n @cell_name || self.class.cell_name\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def font=(font)\n set_font(font)\n generate_buffers\n end",
"def info_font(*args)\n @p.info_font(self, *args)\n end",
"def fonts(workbook, _center, heading, _colors)\n worksheet = workbook.add_worksheet('Fonts')\n\n worksheet.set_column(0, 0, 30)\n worksheet.set_column(1, 1, 10)\n\n worksheet.write(0, 0, \"Font name\", heading)\n worksheet.write(0, 1, \"Font size\", heading)\n\n fonts = []\n fonts << [10, 'Arial']\n fonts << [12, 'Arial']\n fonts << [14, 'Arial']\n fonts << [12, 'Arial Black']\n fonts << [12, 'Arial Narrow']\n fonts << [12, 'Century Schoolbook']\n fonts << [12, 'Courier']\n fonts << [12, 'Courier New']\n fonts << [12, 'Garamond']\n fonts << [12, 'Impact']\n fonts << [12, 'Lucida Handwriting']\n fonts << [12, 'Times New Roman']\n fonts << [12, 'Symbol']\n fonts << [12, 'Wingdings']\n fonts << [12, 'A font that doesn\\'t exist']\n\n i = 0\n fonts.each do |font|\n format = workbook.add_format\n\n format.set_size(font[0])\n format.set_font(font[1])\n\n i += 1\n worksheet.write(i, 0, font[1], format)\n worksheet.write(i, 1, font[0], format)\n end\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def font(height, font_name=Gosu::default_font_name)\n @used_fonts ||= {}\n key = [font_name, height]\n if @used_fonts.include? key\n @font = @used_fonts[key]\n else\n @font = @used_fonts[key] = Gosu::Font.new(self, font_name, height)\n end\n end",
"def postscriptfontname=(postscriptFontName)\n @elementHash[:postscriptfontname] = postscriptFontName\n @elementHash.delete(:userinterfacefont)\n end",
"def draw_actor_name(actor, x, y)\n self.contents.font.size = Scan_Window_Font_Size\n self.contents.font.color = normal_color\n self.contents.draw_text(x, y, 120, 32, actor.name)\n end",
"def setLabel ( position, font, spacing ) \n\t@sets << \"key spacing #{spacing}\"\n\t@sets << \"key font '#{font}'\"\n\t@sets << \"key #{position}\"\n end",
"def load_font(family, height)\n end"
] |
[
"0.81314415",
"0.7896164",
"0.7712866",
"0.77062994",
"0.72959864",
"0.7255562",
"0.71670526",
"0.7110613",
"0.71081805",
"0.6693014",
"0.6693014",
"0.66816",
"0.66816",
"0.66166097",
"0.6615892",
"0.65713406",
"0.65297943",
"0.6436224",
"0.6427392",
"0.6379348",
"0.6362969",
"0.6332783",
"0.633258",
"0.631478",
"0.62676936",
"0.62676936",
"0.62529284",
"0.62442535",
"0.62442535",
"0.62335247",
"0.6229093",
"0.6229093",
"0.620988",
"0.6189007",
"0.6157918",
"0.61545813",
"0.6152438",
"0.60866827",
"0.60866827",
"0.6076135",
"0.60525113",
"0.60525113",
"0.6052292",
"0.60522044",
"0.60442615",
"0.6031154",
"0.602856",
"0.6017266",
"0.5995838",
"0.5995838",
"0.59502786",
"0.5932864",
"0.5923859",
"0.5892133",
"0.58882594",
"0.58846027",
"0.5842431",
"0.5831265",
"0.58278",
"0.5803306",
"0.5803306",
"0.5799147",
"0.5787964",
"0.57809573",
"0.57702583",
"0.5763675",
"0.57472545",
"0.573796",
"0.5735604",
"0.57145244",
"0.56933975",
"0.5686498",
"0.56837165",
"0.5679866",
"0.5661748",
"0.564066",
"0.5620232",
"0.55860454",
"0.55790305",
"0.5578644",
"0.55568445",
"0.5548914",
"0.5542116",
"0.5527431",
"0.5506317",
"0.5500295",
"0.54996574",
"0.54937905",
"0.54937905",
"0.54842436",
"0.5474626",
"0.54562885",
"0.54440916",
"0.5442556",
"0.54325897",
"0.54314566",
"0.5409591",
"0.54006463",
"0.53995985"
] |
0.8321192
|
0
|
Changes font size of cell
|
def change_font_size(font_size = 10)
validate_worksheet
raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)
font = get_cell_font.dup
font.set_size(font_size)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def change_font_size(font_size=10)\n validate_worksheet\n if font_size.is_a?(Integer) || font_size.is_a?(Float)\n # Get copy of font object with modified size\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_font(font)\n else\n raise 'Argument must be a number'\n end\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * 1.5) : font.sz\n end",
"def font_size\r\n @style.font_size || @default_font_size\r\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def SetFontSize(size)\n\t\t#Set font size in points\n\t\tif (@font_size_pt== size)\n\t\t\treturn;\n\t\tend\n\t\t@font_size_pt = size;\n\t\t@font_size = size.to_f / @k;\n\t\tif (@page > 0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def set_font_size size\n @font = @font_cache[size]\n return if (@font)\n @font = Gosu::Font.new(\n size,\n name: @settings.get(:font_name)\n )\n @font_cache[size] = @font\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def text_size s, f = font\n f.text_size s\n end",
"def text_size s, f = font\n f.text_size s\n end",
"def title_font_size=(value)\n @title_font.size = value\n end",
"def fontsize=(fontSize)\n @elementHash[:fontsize] = fontSize.to_f\n end",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def font_size(size=nil)\n cur_page.font_size(size)\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def scale_fontsize(value)\n value * @scale\n end",
"def coordinate_labels_font_size\n if self.options[:font_size].blank?\n 10\n else\n self.options[:font_size]\n end\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def legend_font_size=(value)\n @legend_font.size = value\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def marker_font_size=(value)\n @marker_font.size = value\n end",
"def font_size()\n validate_worksheet\n return @workbook.fonts[font_id()][:font][:sz][:attributes][:val]\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def widthcell\n 10\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def font_descender(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hi = @fonts[@current_font].fontbbox[1].to_f\n (size * hi / 1000.0)\n end",
"def string_width(string, font_size)\n font_scale = font_size / row.worksheet.workbook.font_scale_divisor\n (string.to_s.size + 3) * font_scale\n end",
"def font_size\n styles['font-size'] ? styles['font-size'].to_f : DEFAULT_FONT_SIZE\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def adjusts_font_size_to_fit_width ; view.adjustsFontSizeToFitWidth ; end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def font_size=(font_size)\n if !font_size.nil? && font_size < 0\n fail ArgumentError, 'invalid value for \"font_size\", must be greater than or equal to 0.'\n end\n\n @font_size = font_size\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def width\n @font.text_width(self.text)\n end",
"def border_width=(width)\n self.each {|cell| cell.border_width = width}\n end",
"def configure_cell_attributes(workbook_cell)\n workbook_cell.format = template.formats[@cell.xpath(\"@table:style-name\").to_s]\n workbook_cell.colspan = @cell.xpath(\"@table:number-columns-spanned\").to_s\n workbook_cell.rowspan = @cell.xpath(\"@table:number-rows-spanned\").to_s\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def text_width(font_handle, text)\n end",
"def font_size\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def fontsize(points=20)\n @fsize = points\n font unless @fname\n #CGContextSetFontSize(@ctx,points)\n CGContextSelectFont(@ctx, @fname, @fsize, KCGEncodingMacRoman)\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def font_size\n return nil unless @styles\n\n size_tag = @styles.xpath('//w:docDefaults//w:rPrDefault//w:rPr//w:sz').first\n size_tag ? size_tag.attributes['val'].value.to_i / 2 : nil\n end",
"def font_height(size = nil)\n size = @font_size if size.nil? or size <= 0\n\n select_font(\"Helvetica\") if @fonts.empty?\n hh = @fonts[@current_font].fontbbox[3].to_f - @fonts[@current_font].fontbbox[1].to_f\n (size * hh / 1000.0)\n end",
"def set_font_sizes(font_sizes:)\n {\n method: \"Page.setFontSizes\",\n params: { fontSizes: font_sizes }.compact\n }\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def size_col(col) #:nodoc:\n # Look up the cell value to see if it has been changed\n unless @col_sizes[col].nil?\n width = @col_sizes[col]\n\n # The relationship is different for user units less than 1.\n if width < 1\n return (width *12).to_i\n else\n return (width *7 +5 ).to_i\n end\n else\n return 64\n end\n end",
"def font=(value)\n @font = value\n end",
"def stringwidth(text, fontsize)\n @p.stringwidth(text, self, fontsize)\n end",
"def setCellWidth(cellContent, width)\n numCharsTooShort = width - cellContent.length\n if numCharsTooShort < 0\n # cellContent is too long, so truncate\n return cellContent[0, [width - 3, 0].max] + '.' * [3, width].min\n else\n # cellContent is requested width or too short, so right-pad with zero or more spaces\n return cellContent + ' ' * numCharsTooShort\n end\n end",
"def height\n @font.height\n end",
"def shrink\n column_size = table.columns_size\n ratio = ((natural_width - renderer.width) / column_size.to_f).ceil\n\n widths = (0...column_size).reduce([]) do |lengths, col|\n width = (renderer.column_widths[col] - ratio)\n # basically ruby 2.4 Numeric#clamp\n width = width < minimum_width ? minimum_width : width\n width = width > renderer.width ? renderer.width : width\n lengths << width\n end\n distribute_extra_width(widths)\n end",
"def font=(font)\n @label.font = font\n end",
"def pbSetSmallFont(bitmap)\n bitmap.font.name=pbSmallFontName\n bitmap.font.size=25\nend",
"def shrink_to_fit(text)\n wrap(text)\n until @everything_printed || @font_size <= @min_font_size\n @font_size = [@font_size - 0.3, @min_font_size].max\n @document.font_size = @font_size\n wrap(text)\n end\n end",
"def text_line_width(text, size = nil)\n if text.kind_of?(Numeric) and size.kind_of?(String)\n text, size = size, text\n warn PDF::Writer::Lang[:text_width_parameters_reversed] % caller[0]\n end\n\n if size.nil? or size <= 0\n size = @font_size\n end\n\n # This function should not change any of the settings, though it will\n # need to track any tag which change during calculation, so copy them\n # at the start and put them back at the end.\n t_CTS = @current_text_state.dup\n\n select_font(\"Helvetica\") if @fonts.empty?\n # converts a number or a float to a string so it can get the width\n tt = text.to_s\n # hmm, this is where it all starts to get tricky - use the font\n # information to calculate the width of each character, add them up\n # and convert to user units\n width = 0\n font = @current_font\n\n pos = -1\n loop do\n pos += 1\n break if pos == tt.size\n font_change = true\n tag_size, text, font_change = quick_text_tags(text, pos, font_change)\n if tag_size != 0\n if font_change\n current_font!\n font = @current_font\n end\n pos += tag_size - 1\n else\n if \"<\" == tt[pos, 4]\n width += char_width(font, '<')\n pos += 3\n elsif \">\" == tt[pos, 4]\n width += char_width(font, '>')\n pos += 3\n elsif \"&\" == tt[pos, 5]\n width += char_width(font, '&')\n pos += 4\n else\n width += char_width(font, tt[pos, 1])\n end\n end\n end\n\n @current_text_state = t_CTS.dup\n current_font!\n\n (width * size / 1000.0)\n end",
"def width\n #@font.text_width(self.text)\n return 200\n end",
"def change_column_width(column_index, width_in_chars = RubyXL::ColumnRange::DEFAULT_WIDTH)\n change_column_width_raw(column_index, ((width_in_chars + (5.0 / RubyXL::Font::MAX_DIGIT_WIDTH)) * 256).to_i / 256.0)\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def table_size=(size)\n @cc.table_size = size\n end",
"def width\n @font.text_width(self.text)\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def table_question_style\n {\n column_widths: { 0 => 460 },\n cell_style: {\n border_width: 0,\n size: 12,\n align: :left,\n font_style: :bold,\n padding: [0, 0, 0, 45]\n },\n header: true\n }\n end",
"def draw_table_six_columns(table_info, width_columns = [100, 100, 100, 90, 90, 40])\n table (table_info) do\n columns(0..5).border_width = 1\n columns(0..5).size = 7\n self.column_widths = width_columns\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \"\"\n \n end",
"def reset_table_cell\n mixin({\n text_align: 'left',\n font_weight: 'normal',\n vertical_align: 'middle'\n })\n end",
"def title_size=(v)\n @title.text_size = v unless v.to_s.empty?\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def italic_cell(options = {}, &block)\n cell({ font_style: :italic }.merge(options || {}), &block)\n end"
] |
[
"0.77199495",
"0.7712393",
"0.7611653",
"0.71374416",
"0.6978516",
"0.692586",
"0.6728187",
"0.66601753",
"0.66556317",
"0.6619674",
"0.6533546",
"0.6522609",
"0.6501379",
"0.64703393",
"0.64372236",
"0.64372236",
"0.6417534",
"0.6395196",
"0.63928103",
"0.6318056",
"0.6261534",
"0.6261534",
"0.62583894",
"0.6257958",
"0.6203692",
"0.61963093",
"0.61930364",
"0.6180755",
"0.6138897",
"0.6097482",
"0.60168535",
"0.6014929",
"0.5958263",
"0.5953417",
"0.5953417",
"0.5935003",
"0.5926239",
"0.5911609",
"0.5911609",
"0.59033185",
"0.5886229",
"0.5870288",
"0.58594954",
"0.58594954",
"0.5811717",
"0.58059675",
"0.58052444",
"0.57569665",
"0.5726804",
"0.5715882",
"0.5712908",
"0.5712908",
"0.56469643",
"0.56469643",
"0.55837214",
"0.5552504",
"0.5532719",
"0.5509251",
"0.55013317",
"0.5501064",
"0.5501064",
"0.5473179",
"0.5469995",
"0.5463156",
"0.544655",
"0.5438885",
"0.5424099",
"0.5393868",
"0.53864694",
"0.5383967",
"0.53564763",
"0.5356279",
"0.5321718",
"0.531514",
"0.5310223",
"0.5292902",
"0.5286555",
"0.525576",
"0.52331257",
"0.52266836",
"0.5218274",
"0.52103996",
"0.5209626",
"0.51957774",
"0.518029",
"0.51714194",
"0.51714194",
"0.51700324",
"0.5166933",
"0.5152656",
"0.51398915",
"0.5138928",
"0.5135754",
"0.5130375",
"0.51166993",
"0.5107312",
"0.5107312",
"0.51071316",
"0.51016176"
] |
0.7972899
|
0
|
Changes font color of cell
|
def change_font_color(font_color = '000000')
validate_worksheet
Color.validate_color(font_color)
font = get_cell_font.dup
font.set_rgb_color(font_color)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def change_text_color(color)\n @text_color = color\n @text_entry.refresh\n self.redraw\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def change_color(color)\n self.font.color = color\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def font_color()\n validate_worksheet\n if @workbook.fonts[font_id()][:font][:color].nil?\n '000000' #black\n else\n @workbook.fonts[font_id()][:font][:color][:attributes][:rgb]\n end\n end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def ansi_formatting(cell, col, row); end",
"def after_cell_render_styling(column_name,cell_value,record)\n \"\"\n \n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def set_rgb_color(font_color)\n self.color = RubyXL::Color.new(:rgb => font_color.to_s)\n end",
"def font_color=(value)\n @title_font.color = value\n @marker_font.color = value\n @legend_font.color = value\n end",
"def textColor=(color)\n @label.textColor = color\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def before_cell_render_styling(column_name,cell_value,record)\n \"\"\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def coordinate_labels_font_color\n if self.options[:font_color].blank?\n '#333333'\n else\n self.options[:font_color]\n end\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def color(val)\n raise 'Please provide a valid cell color' unless ('A'..'Z').include?(val)\n self.value = val\n end",
"def font_color(color=nil)\n cur_page.font_color(color)\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def SetTextColor(r, g=-1, b=-1, storeprev=false)\n\t\t#Set color for text\n\t\tif ((r==0 and :g==0 and :b==0) or :g==-1)\n\t\t\t@text_color=sprintf('%.3f g', r/255.0);\n\t\telse\n\t\t\t@text_color=sprintf('%.3f %.3f %.3f rg', r/255.0, g/255.0, b/255.0);\n\t\tend\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [r, g, b]\n\t\tend\n\tend",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def highlight_cell(tbl, row, col, id, check: false)\n bg_color = '&#ade6dd' unless check\n\n tbl[row + 1][col + 1] = { content: id,\n check: check,\n class: 'td-full-slot',\n style: {'background-color'=> bg_color}}\n end",
"def shading_colour=(colour)\n self.each {|cell| cell.shading_colour = colour}\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def textColor\n return @text_color\n end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def cell_renderer(*val)\n if val.empty?\n @cell_renderer ||= create_default_cell_renderer\n else\n @cell_renderer = val[0] \n end\n end",
"def cell_renderer(*val)\n if val.empty?\n @cell_renderer ||= create_default_cell_renderer\n else\n @cell_renderer = val[0] \n end\n end",
"def TreeView_SetTextColor(hwnd, clr) send_treeview_message(hwnd, :SETTEXTCOLOR, lparam: clr) end",
"def change_font_color\n #Code essentially used from Clay Allsop's RubyMotion: iOS Development with Ruby\n #with a few tweeks\n #\n #Get the color_field text\n color_prefix = @color_field.text\n #Downcase the color_field text and append \"Color\"\n color_method = \"#{color_prefix.downcase}Color\"\n #If the color exists, create as UIColor.colorColor\n if UIColor.respond_to?(color_method)\n @font_color = UIColor.send(color_method)\n @font_label.textColor = @font_color\n #For fun I added that the text color also becomes the toggle background color when ON\n @switch_font.onTintColor = @font_color\n @switch_font.tintColor = @font_color\n else\n #If the color is not known, display an alert to inform user\n UIAlertView.alloc.initWithTitle(\"Invalid Color\",\n message: \"#{color_prefix.capitalize} is not a usable color at this time\",\n delegate: nil,\n cancelButtonTitle: \"OK\",\n otherButtonTitles: nil).show\n end\n end",
"def settextcolorind(*)\n super\n end",
"def repaint graphic, r=@row,c=@col, row_index=-1,value=@text, focussed=false, selected=false\n\n select_colors focussed, selected \n\n value=value.to_s\n if !@display_length.nil?\n if value.length > @display_length\n value = value[0..@display_length-1]\n end\n end\n len = @display_length || value.length\n graphic.printstring r, c, \"%-*s\" % [len, value], @color_pair, @attr\n end",
"def set_text_color_a(color = RFPDF::COLOR_PALETTE[:black], colorspace = :rgb)\n if colorspace == :cmyk\n SetCmykTextColor(color[0], color[1], color[2], color[3])\n else\n SetTextColor(color[0], color[1], color[2])\n end\n end",
"def color(text, color)\n if COLORS[color]\n \"#{start_color color}#{text}#{reset_color}\"\n end\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def bold_red(output)\n color('1;31', output)\n end",
"def draw_text_cs(x, y, w, h, t, a = 0)\r\n original_color = self.font.color.clone\r\n self.font.color = Color.new(0,0,0,100)\r\n draw_text(x + 2, y + 2, w, h, t, a)\r\n self.font.color = original_color\r\n draw_text(x, y, w, h, t, a) \r\n end",
"def ctrlSetTextColor _obj, _args\n \"_obj ctrlSetTextColor _args;\" \n end",
"def color(text, color, bold = false)\n bold = bold ? BOLD : \"\"\n \"#{bold}#{color}#{text}#{CLEAR}\"\n end",
"def init_colors\n $desc_color = \"#{GREEN}\" # color of description portion\n # color the title based on priority\n $p5color = \"#{BLUE}#{BOLD}\" \n $p4color = \"#{MAGENTA}\" \n $p3color = \"#{CYAN}#{BOLD}\" \n $p2color = \"#{BOLD}\"\n $p1color = \"#{YELLOW}#{ON_RED}\"\n #\n # color for only the type column\n $bugcolor = \"#{BLACK}#{ON_RED}\"\n $enhcolor = \"#{GREEN}\"\n $feacolor = \"#{CYAN}\"\n\n # color for row of started event\n $startedcolor = \"#{STANDOUT}\"\n\n cols = %x[tput colors] rescue 8\n cols = cols.to_i\n if cols >= 256\n $desc_color = \"\\x1b[38;5;236m\" # 256 colors, grey\n $p5color = \"\\x1b[38;5;57m\" # some kinda blue\n $p4color = \"\\x1b[38;5;239m\" # grey. 256 colors\n $p3color = \"\\x1b[38;5;244m\" # grey, 256 colors\n end\n end",
"def crisis_color\n return text_color(17)\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def red(text)\n colorize text, \"\\033[1;31m\"\n end",
"def color(text)\n \"\\e[31m#{text}\\e[0m\"\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def bolden(issue, row, color=:bold)\n bld = issue[@bolden_tag]\n bld = @custom_tags[@bolden_tag] if bld.nil?\n bld = bld.call(issue.dup) if bld.kind_of? Proc\n # ? truthy other than Ruby default?\n return row unless bld\n if row.kind_of? Array then\n row.map{|r| HighLine.color(r, color)}\n elsif row.kind_of? Hash then\n hsh={}\n row.each_pair{|k,v| hsh[k] = HighLine.color(v, color)}\n else\n HighLine.color(row.to_s, color)\n end\n end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def green(text)\n colorize text, \"\\033[1;32m\"\n end",
"def style=(style)\n cells.each_with_index do | cell, index |\n s = style.is_a?(Array) ? style[index] : style\n cell.style = s\n end\n end",
"def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end",
"def colorize(text, color)\n\t\"\\e[#{Colors[color]}m#{text}\\e[0m\"\nend",
"def text_colors\n @colors = {\n red: 31,\n yellow: 33,\n green: 32\n }\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def header_text_color\n block_for('header_text_color', '#dcdcdc')\n end",
"def colorize(color, text)\n \"\\e[#{color}m#{text}\\e[0m\"\n end",
"def highlight(row,scol,ecol)\n\t\t# only do rows that are on the screen\n\t\tif row < @linefeed then return end\n\t\tif row > (@linefeed + $screen.rows - 2) then return end\n\n\t\tif @text[row].length < 1 then return end\n\n\t\t# convert pos in text to pos on screen\n\t\tsc = bc2sc(row,scol)\n\t\tec = bc2sc(row,ecol)\n\n\t\t# replace tabs with spaces\n\t\tsline = tabs2spaces(@text[row])\n\t\t# get just string of interest\n\t\tif sc < @colfeed then sc = @colfeed end\n\t\tif ec < @colfeed then return end\n\t\tstr = sline[sc..ec]\n\t\tif ec == sline.length then str += \" \" end\n\t\tssc = sc - @colfeed\n\t\tsec = ec - @colfeed\n\n\t\tif (str.length+ssc) >= $screen.cols\n\t\t\tstr = str[0,($screen.cols-ssc)]\n\t\tend\n\n\t\t$screen.text_reverse(true)\n\t\t$screen.write_str((row-@linefeed+1),ssc,str)\n\t\t$screen.text_reverse(false)\n\tend",
"def SetCmykTextColor(c, m, y, k, storeprev=false)\n\t\t#Set color for text\n\t\t@text_color=sprintf('%.3f %.3f %.3f %.3f k', c, m, y, k);\n\t\t@color_flag=(@fill_color!=@text_color);\n\t\tif (storeprev)\n\t\t\t# store color as previous value\n\t\t\t@prevtext_color = [c, m, y, k]\n\t\tend\n\tend",
"def color_table\n [0, 1, 4, 5, 7].each do |attr|\n puts '----------------------------------------------------------------'\n puts \"ESC[#{attr};Foreground;Background\"\n 30.upto(37) do |fg|\n 40.upto(47) do |bg|\n print \"\\033[#{attr};#{fg};#{bg}m #{fg};#{bg} \"\n end\n puts \"\\033[0m\"\n end\n end\n end",
"def ListView_SetTextColor(hwnd, clrText) send_listview_message(hwnd, :SETTEXTCOLOR, lparam: clrText) end",
"def color(text, color_code)\n \"#{color_code}#{text}\\e[0m\"\n end",
"def colored_char\n color(char)\n end",
"def foreground_color(index)\n \"\\e[38;5;#{index}m\"\nend",
"def font(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @fonts[sheet][normalize(row,col).to_a]\n end",
"def blue = \"\\e[36m#{self}\\e[0m\"",
"def colorize(text, color_code); \"\\e[#{color_code}m#{text}\\e[0m\"; end",
"def cell_style(models, options={})\n [models].flatten.compact.each do |m|\n m.apply_styles(options)\n end \n end",
"def color=(color)\n each_with_index do |cell, index|\n cell.color = color.is_a?(Array) ? color[index] : color\n end\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def set_cell(x, y, color)\n get_cell(x, y).color = color\n @last_cell_played = get_cell(x, y)\n end",
"def render pad, lineno, text\n if @hash\n dim = match_line text\n fg = dim.first\n bg = dim[1] || @default_colors[1]\n if dim.size == 3\n att = dim.last\n else\n att = @default_colors.last\n end\n cp = get_color($datacolor, fg, bg)\n else\n cp = @pair\n att = @default_colors[2]\n end\n\n FFI::NCurses.wattron(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n FFI::NCurses.mvwaddstr(pad, lineno, 0, text)\n FFI::NCurses.wattroff(pad,FFI::NCurses.COLOR_PAIR(cp) | att)\n end",
"def colortable\n names = %w(black red green yellow blue pink cyan white default)\n fgcodes = (30..39).to_a - [38]\n\n s = ''\n reg = \"\\e[%d;%dm%s\\e[0m\"\n bold = \"\\e[1;%d;%dm%s\\e[0m\"\n puts ' color table with these background codes:'\n puts ' 40 41 42 43 44 45 46 47 49'\n names.zip(fgcodes).each {|name,fg|\n s = \"#{fg}\"\n puts \"%7s \"%name + \"#{reg} #{bold} \"*9 % [fg,40,s,fg,40,s, fg,41,s,fg,41,s, fg,42,s,fg,42,s, fg,43,s,fg,43,s, \n fg,44,s,fg,44,s, fg,45,s,fg,45,s, fg,46,s,fg,46,s, fg,47,s,fg,47,s, fg,49,s,fg,49,s ]\n }\nend",
"def ListView_SetTextBkColor(hwnd, clrTextBk) send_listview_message(hwnd, :SETTEXTBKCOLOR, lparam: clrTextBk) end",
"def highlightCell\n disptype = @colvalues[@col]\n highlight = @highlight\n infolen = @info[@row][@col].size\n \n # Given the dominance of the color/attributes, we need to set the\n # current cell attribute.\n if @dominant == CDK::ROW\n highlight = (@rowtitle[@crow][0] || 0) & Ncurses::A_ATTRIBUTES\n elsif @dominant == CDK::COL\n highlight = (@coltitle[@ccol][0] || 0) & Ncurses::A_ATTRIBUTES\n end\n\n # If the column is only one char.\n (1..@colwidths[@ccol]).each do |x|\n ch = if x <= infolen && !Display.isHiddenDisplayType(disptype)\n then CDK.CharOf(@info[@row][@col][x - 1])\n else @filler\n end\n self.CurMatrixCell.mvwaddch(1, x, ch.ord | highlight)\n end\n self.CurMatrixCell.wmove(1, infolen + 1)\n self.CurMatrixCell.wrefresh\n end",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def red(string)\n \"\\033[0;33m#{string}\\033[0m\"\nend",
"def highlight text\n color_code = 7\n \"\\e[#{color_code}m#{text}\\e[0m\"\nend",
"def get_col_style(col)\n i = get_cols_index(col)\n if @cols[i].nil?\n @workbook.fonts['0'][:count] += 1\n return 0\n else\n return Integer(@cols[i][:attributes][:style])\n end\n end",
"def red(str)\n \"\\e[31m#{str}\\e[0m\"\nend"
] |
[
"0.7461787",
"0.7249745",
"0.72065777",
"0.71350855",
"0.712429",
"0.71065754",
"0.7073131",
"0.7073131",
"0.70110637",
"0.70012754",
"0.6859599",
"0.68218386",
"0.68218386",
"0.6811806",
"0.6794766",
"0.67469627",
"0.6735331",
"0.6648561",
"0.664566",
"0.64648116",
"0.6400001",
"0.6361593",
"0.6356961",
"0.63117534",
"0.6257498",
"0.6217439",
"0.6213034",
"0.61420804",
"0.613975",
"0.60809636",
"0.6075733",
"0.6074497",
"0.60637045",
"0.60066485",
"0.5992922",
"0.5992922",
"0.5987912",
"0.597868",
"0.5967768",
"0.5967768",
"0.5939611",
"0.5939611",
"0.59260815",
"0.5921509",
"0.58395875",
"0.58395875",
"0.58315444",
"0.5820413",
"0.5812842",
"0.5812276",
"0.57813174",
"0.57731086",
"0.5765461",
"0.57424253",
"0.57424253",
"0.5707704",
"0.56794083",
"0.5671477",
"0.56643677",
"0.56602293",
"0.5654571",
"0.56508625",
"0.5649024",
"0.56486475",
"0.56312054",
"0.56020516",
"0.5598496",
"0.55912733",
"0.5590448",
"0.5575669",
"0.5554018",
"0.55500984",
"0.55453944",
"0.5543654",
"0.55396384",
"0.55386454",
"0.55320215",
"0.55314124",
"0.5526994",
"0.5517162",
"0.55148",
"0.5502128",
"0.54912883",
"0.5489294",
"0.5489062",
"0.5488998",
"0.5477359",
"0.5467379",
"0.5467379",
"0.54579955",
"0.54473925",
"0.5444988",
"0.5433712",
"0.542793",
"0.54254895",
"0.54254895",
"0.54200536",
"0.54179794",
"0.54073226"
] |
0.7695715
|
0
|
Changes font italics settings of cell
|
def change_font_italics(italicized = false)
validate_worksheet
font = get_cell_font.dup
font.set_italic(italicized)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def change_column_italics(col=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_column_font(col, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def italic_cell(options = {}, &block)\n cell({ font_style: :italic }.merge(options || {}), &block)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def bold_italic_cell(options = {}, &block)\n cell({ font_style: :bold_italic }.merge(options || {}), &block)\n end",
"def settextfontprec(*)\n super\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def maiil_reset_font\n fn = MA_IconItemList::NUM_FONTNAME ? MA_IconItemList::NUM_FONTNAME : Font.default_name\n contents.font = Font.new(fn, MA_IconItemList::NUM_FONTSIZE) # name and size\n contents.font.bold = MA_IconItemList::NUM_BOLD # Set Bold\n contents.font.italic = MA_IconItemList::NUM_ITALIC # Set Italic\n contents.font.shadow = MA_IconItemList::NUM_SHADOW # Set Shadow\n contents.font.outline = MA_IconItemList::NUM_OUTLINE # Set outline\n oc = MA_IconItemList::NUM_OUT_COLOUR ? MA_IconItemList::NUM_OUT_COLOUR : Font.default_out_color\n contents.font.out_color = text_color(oc) # outline color\n end",
"def italic; end",
"def italic; end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def set_text(font, size)\n\t \t@pdf.setfont(font, size)\n\t end",
"def set_font_bitmap(bitmap)\n bitmap.font.bold = false\n bitmap.font.italic = false\n bitmap.font.color = Color::WHITE\n end",
"def set_font_bitmap(bitmap)\n bitmap.font.bold = false\n bitmap.font.italic = false\n bitmap.font.color = Color::WHITE\n end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def font=(value)\n @font = value\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def is_italicized()\n validate_worksheet\n if @workbook.fonts[font_id()][:font][:i].nil?\n false\n else\n true\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def reset_font_settings; set_data_font(:category_label); end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n set_data_font(@maqj_font_data_type) if @maqj_font_data_type\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def font(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @fonts[sheet][normalize(row,col).to_a]\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def configure_cell_attributes(workbook_cell)\n workbook_cell.format = template.formats[@cell.xpath(\"@table:style-name\").to_s]\n workbook_cell.colspan = @cell.xpath(\"@table:number-columns-spanned\").to_s\n workbook_cell.rowspan = @cell.xpath(\"@table:number-rows-spanned\").to_s\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def semanticize_font_styles!\n @document.tree.css('span').each do |node|\n if node.bold?\n node.node_name = 'strong'\n elsif node.italic?\n node.node_name = 'em'\n end\n end\n end",
"def bold_italic\n @font.fullname = 'MS-Mincho.BoldItalic'\n @desc.flags = flag_value(\n @desc_flags.merge(italic: true, force_bold: true)\n )\n @desc.italic_angle = -11\n @desc.stem_v = 156\n @font\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def default_font; \"example.font\"; end",
"def set_text\n @text_field.text = @str\n @formats.each do |start, n, style|\n case style\n when FoxTextFormatter::STYLE_BOLD\n @text_field.changeStyle(start, n, 2)\n when FoxTextFormatter::STYLE_H1\n @text_field.changeStyle(start, n, 3)\n when FoxTextFormatter::STYLE_H2\n @text_field.changeStyle(start, n, 4)\n when FoxTextFormatter::STYLE_H3\n @text_field.changeStyle(start, n, 5)\n when FoxTextFormatter::STYLE_TELETYPE\n @text_field.changeStyle(start, n, 6)\n when FoxTextFormatter::STYLE_CODE\n @text_field.changeStyle(start, n, 7)\n when FoxTextFormatter::STYLE_EMPHASIS\n @text_field.changeStyle(start, n, 8)\n when FoxTextFormatter::STYLE_CLASS\n @text_field.changeStyle(start, n, 9)\n else\n @text_field.changeStyle(start, n, 1)\n end\n\n end\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def italic\n @info[:italic]\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def ansi_formatting(cell, col, row); end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def font=(font)\n @label.font = font\n end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def after_cell_render_styling(column_name,cell_value,record)\n \"\"\n \n end",
"def reset_font_settings; set_data_font(:scene_label); end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n self.contents.font.name = MARW_CONFIGURATION[:window_fontname] unless\n MARW_CONFIGURATION[:window_fontname].empty?\n self.contents.font.size = MARW_CONFIGURATION[:window_fontsize] unless\n MARW_CONFIGURATION[:window_fontsize] < 8\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def bold; end",
"def bold; end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def pbSetSmallFont(bitmap)\n bitmap.font.name=pbSmallFontName\n bitmap.font.size=25\nend",
"def change_color(color)\n self.font.color = color\n end",
"def font_weight=(value)\n allow_symbols_as_values(value)\n @style.set_property(StyleTextPropertiesElement::FontWeight, value)\n @style.set_property(StyleTextPropertiesElement::FontWeightAsian, value)\n @style.set_property(StyleTextPropertiesElement::FontWeightComplex, value)\n end",
"def display_text\n\t\t\t#specifying font to be used\n\t\t\t#text_font @font, 16\n\t\t\t#text \"Mmmmm ... Strings .... \", 10, 100\n\t\tend",
"def set_font_path()\n Dir.entries(@output_styles).each do |filename|\n next if filename =~ /^\\.\\.?$/\n filepath = \"#{@output_styles}/#{filename}\"\n\n text = File.read(filepath)\n new_text = text.gsub(/..\\/font/, \"#{@fonts_path}\")\n File.write(filepath, new_text)\n end\n end",
"def reset_table_cell\n mixin({\n text_align: 'left',\n font_weight: 'normal',\n vertical_align: 'middle'\n })\n end",
"def info_font(*args)\n @p.info_font(self, *args)\n end",
"def change_font_strikethrough(struckthrough=false)\n validate_worksheet\n # Get copy of font object with modified strikethrough settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_strikethrough(font, struckthrough)\n # Update font and xf array\n change_font(font)\n end",
"def change_text_color(color)\n @text_color = color\n @text_entry.refresh\n self.redraw\n end"
] |
[
"0.72236353",
"0.678297",
"0.6767767",
"0.6639636",
"0.6613759",
"0.6494832",
"0.6494832",
"0.64336115",
"0.6389968",
"0.63753814",
"0.63357896",
"0.6335046",
"0.63281983",
"0.63196945",
"0.62855744",
"0.62762696",
"0.62762696",
"0.6264959",
"0.6257875",
"0.6174606",
"0.6145247",
"0.6145247",
"0.6112318",
"0.6064588",
"0.6064588",
"0.6062564",
"0.60602087",
"0.6043203",
"0.6043203",
"0.60109603",
"0.5994572",
"0.5994572",
"0.5992222",
"0.5989679",
"0.5942911",
"0.5931636",
"0.5931636",
"0.5914268",
"0.5907564",
"0.5890915",
"0.58767354",
"0.5856688",
"0.5846747",
"0.5846747",
"0.58425444",
"0.58413935",
"0.5791151",
"0.5772798",
"0.5754055",
"0.5725109",
"0.5714058",
"0.57121927",
"0.5676343",
"0.5676343",
"0.56703967",
"0.5664205",
"0.5663779",
"0.56570566",
"0.5649774",
"0.5601911",
"0.5589193",
"0.5581941",
"0.5561017",
"0.5542462",
"0.55332416",
"0.55332416",
"0.55116934",
"0.55116934",
"0.550301",
"0.5499373",
"0.54985684",
"0.54920584",
"0.5489602",
"0.5489298",
"0.5483334",
"0.5445888",
"0.5431445",
"0.54202676",
"0.53976613",
"0.5391886",
"0.5389167",
"0.53543997",
"0.5351362",
"0.5351362",
"0.53395104",
"0.53264886",
"0.5324627",
"0.5321088",
"0.5321088",
"0.53199315",
"0.5311553",
"0.5309114",
"0.5289856",
"0.5264891",
"0.5246467",
"0.5236725",
"0.5230217",
"0.52187127",
"0.52119285"
] |
0.78815913
|
0
|
Changes font bold settings of cell
|
def change_font_bold(bolded = false)
validate_worksheet
font = get_cell_font.dup
font.set_bold(bolded)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def bold= bool\n self.weight = bool ? :bold : nil\n end",
"def change_column_bold(col=0, bolded=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified bold settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_column_font(col, Worksheet::BOLD, bolded, font, xf_id)\n end",
"def change_row_bold(row=0, bolded=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified bold settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_row_font(row, Worksheet::BOLD, bolded, font, xf_id)\n end",
"def bold_italic_cell(options = {}, &block)\n cell({ font_style: :bold_italic }.merge(options || {}), &block)\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def bold\n surround_with_ansi(ANSI_BOLD)\n end",
"def bold; end",
"def bold; end",
"def bold; \"\\e[1m#{self}\\e[22m\" end",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def setBold(btn, nom)\n label = Gtk::Label.new\n label.set_markup(\"<span weight = 'ultrabold'>#{nom}</span>\")\n btn.add(label)\n btn.set_height_request(60)\n end",
"def bold(text)\n \"\\e[1m#{text}\\e[0m\"\n end",
"def bold(id)\n {\n 0x0190 => :BLSNORMAL, # Normal font weight\n 0x02BC => :BLSBOLD, # Bold font weight\n 0xFFFF => :ignored # Indicates that this specification is to be ignored\n }[id]\n end",
"def bold_italic\n @font.fullname = 'MS-Mincho.BoldItalic'\n @desc.flags = flag_value(\n @desc_flags.merge(italic: true, force_bold: true)\n )\n @desc.italic_angle = -11\n @desc.stem_v = 156\n @font\n end",
"def bold_title=(value)\n @title_font.bold = value\n end",
"def bold\n @info[:bold]\n end",
"def bold(string_to_bold)\n Term::ANSIColor.bold string_to_bold\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def bold(str)\n console_bold=\"\\e[1m\"\n console_reset=\"\\e[0m\"\n \"#{console_bold}#{str}#{console_reset}\"\nend",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def scr_bold\n print \"\\33[1m\"\nend",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def to_bold\n %(<strong>#{self}</strong>)\n end",
"def font_size\n return sz if sz\n\n font = styles.fonts[styles.cellXfs[style].fontId] || styles.fonts[0]\n font.b || (defined?(@b) && @b) ? (font.sz * row.worksheet.workbook.bold_font_multiplier) : font.sz\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def bolden(issue, row, color=:bold)\n bld = issue[@bolden_tag]\n bld = @custom_tags[@bolden_tag] if bld.nil?\n bld = bld.call(issue.dup) if bld.kind_of? Proc\n # ? truthy other than Ruby default?\n return row unless bld\n if row.kind_of? Array then\n row.map{|r| HighLine.color(r, color)}\n elsif row.kind_of? Hash then\n hsh={}\n row.each_pair{|k,v| hsh[k] = HighLine.color(v, color)}\n else\n HighLine.color(row.to_s, color)\n end\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def font_weight=(value)\n allow_symbols_as_values(value)\n @style.set_property(StyleTextPropertiesElement::FontWeight, value)\n @style.set_property(StyleTextPropertiesElement::FontWeightAsian, value)\n @style.set_property(StyleTextPropertiesElement::FontWeightComplex, value)\n end",
"def bold\n \"<b>#{self}</b>\".html_safe\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def semanticize_font_styles!\n @document.tree.css('span').each do |node|\n if node.bold?\n node.node_name = 'strong'\n elsif node.italic?\n node.node_name = 'em'\n end\n end\n end",
"def bold(*args)\n color('1', *args)\n end",
"def bold(output)\n color('1', output)\n end",
"def change_column_italics(col=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_column_font(col, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def bold(*args); end",
"def change_column_font_size(col=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_column_font(col, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def bold_message(message)\n Format(:bold, message)\n end",
"def configure_cell_attributes(workbook_cell)\n workbook_cell.format = template.formats[@cell.xpath(\"@table:style-name\").to_s]\n workbook_cell.colspan = @cell.xpath(\"@table:number-columns-spanned\").to_s\n workbook_cell.rowspan = @cell.xpath(\"@table:number-rows-spanned\").to_s\n end",
"def to_bold_s\n \"\\e[1m#{titre}\\e[22m: #{summary}.\"\n end",
"def change_column_font_name(col=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_column_font(col, Worksheet::NAME, font_name, font, xf_id)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def cnt_bold(c)\n \"#{c}\"\n end",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_font_underline(underlined = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_underline(underlined)\n update_font_references(font)\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def italic_cell(options = {}, &block)\n cell({ font_style: :italic }.merge(options || {}), &block)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def set_font_bitmap(bitmap)\n bitmap.font.bold = false\n bitmap.font.italic = false\n bitmap.font.color = Color::WHITE\n end",
"def set_font_bitmap(bitmap)\n bitmap.font.bold = false\n bitmap.font.italic = false\n bitmap.font.color = Color::WHITE\n end",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def change_column_font_color(col=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_column_font(col, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def font_switch(change_type, arg)\n case change_type\n when Worksheet::NAME then change_font_name(arg)\n when Worksheet::SIZE then change_font_size(arg)\n when Worksheet::COLOR then change_font_color(arg)\n when Worksheet::ITALICS then change_font_italics(arg)\n when Worksheet::BOLD then change_font_bold(arg)\n when Worksheet::UNDERLINE then change_font_underline(arg)\n when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)\n else raise 'Invalid change_type'\n end\n end",
"def set_font_from_path(font, bold_font)\n font_name = Pathname.new(font).basename\n @pdf.font_families.update(\n \"#{font_name}\" => {\n normal: font,\n italic: font,\n bold: bold_font,\n bold_italic: bold_font\n }\n )\n @pdf.font(font_name)\n end",
"def bold_puts(msg)\n output.puts(bold(msg))\n end",
"def key_value(options = {}, &block)\n options ||= {}\n\n if options[:key]\n options[:values] ||= []\n options[:values][0] = options[:key]\n end\n if options[:value]\n options[:values] ||= []\n options[:values][1] = options[:value]\n end\n\n options = {\n cell_1_font_style: :bold\n }.merge(options.except(:key, :value))\n\n cells options, &block\n end",
"def bold?\n parent?(Tree::Bold)\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def font_weight(weight)\n if weight.is_a?(WeightType)\n primitive \"font-weight #{FONT_WEIGHT_NAMES[weight.to_i]}\"\n else\n primitive \"font-weight #{Integer(weight)}\"\n end\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def change_font_size(font_size=10)\n validate_worksheet\n if font_size.is_a?(Integer) || font_size.is_a?(Float)\n # Get copy of font object with modified size\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_font(font)\n else\n raise 'Argument must be a number'\n end\n end",
"def bold_print(text)\n text.split(//).each do |ch|\n print ch, BS, ch\n end\n end",
"def change_column_strikethrough(col=0, struckthrough=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified strikethrough settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_strikethrough(font, struckthrough)\n # Update font and xf array\n change_column_font(col, Worksheet::STRIKETHROUGH, struckthrough, font, xf_id)\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def font(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n style_name = @style[sheet][[row, col]] || @style_defaults[sheet][col - 1] || 'Default'\n @font_style_definitions[style_name]\n end",
"def bold text, pry=(defined?(_pry_) && _pry_) || Pry\n (pry and pry.color) ? \"\\e[1m#{text}\\e[0m\" : text\n end",
"def change_font_underline(underlined=false)\n validate_worksheet\n # Get copy of font object with modified underline settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_font(font)\n end",
"def bold?\n @node.name == 'span' &&\n @node.has_attribute?('class') &&\n @css_analyzer.bold?(@node.attribute('class').value)\n end",
"def setBKattr(attrib)\n @win.wbkgd(attrib)\n (0..@vrows).each do |x|\n (0..@vcols).each do |y|\n # wbkgd (MATRIX_CELL (widget, x, y), attrib);\n end\n end\n end",
"def colored_string\n color(to_bold_s)\n end",
"def h3; self.green.bold end",
"def change_font_color(font_color='000000')\n validate_worksheet\n #if arg is a color name, convert to integer\n Color.validate_color(font_color)\n # Get copy of font object with modified color\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_font(font)\n end",
"def table_content\n # This makes a call to gift_rows and gets back an array of data that will \n # populate the columns and rows of a table I then included some styling to \n # include a header and make its text bold. I made the row background colors \n # alternate between grey and white Then I set the table column widths\n table gift_rows do\n row(0).font_style = :bold\n self.header = true\n self.row_colors = ['DDDDDD', 'FFFFFF']\n self.column_widths = [180, 180, 180]\n end\n end"
] |
[
"0.8035638",
"0.7800186",
"0.73778224",
"0.7356081",
"0.7309667",
"0.70927423",
"0.6959655",
"0.69148815",
"0.6847863",
"0.6847863",
"0.67769545",
"0.67683005",
"0.674681",
"0.674681",
"0.66853034",
"0.66853034",
"0.66616106",
"0.66564745",
"0.6619126",
"0.6587305",
"0.65795684",
"0.65689945",
"0.6386688",
"0.63277584",
"0.63129693",
"0.63065016",
"0.62924314",
"0.627787",
"0.62609434",
"0.6221754",
"0.6204245",
"0.6182182",
"0.61703545",
"0.61377084",
"0.6117152",
"0.6105179",
"0.60689443",
"0.6042911",
"0.6013855",
"0.60116255",
"0.60011953",
"0.60011953",
"0.5902722",
"0.5891608",
"0.58734703",
"0.58572453",
"0.58538157",
"0.58236927",
"0.58221275",
"0.57751346",
"0.5755175",
"0.57543045",
"0.57511246",
"0.57012266",
"0.56124073",
"0.56009877",
"0.56009877",
"0.55934983",
"0.55862844",
"0.5579039",
"0.5572352",
"0.5572352",
"0.55685776",
"0.5554549",
"0.55192316",
"0.55192316",
"0.5495589",
"0.5495589",
"0.5453459",
"0.5442696",
"0.5442696",
"0.54325265",
"0.54325265",
"0.54236495",
"0.53780603",
"0.5346485",
"0.53449976",
"0.53449976",
"0.5331659",
"0.5313713",
"0.52942455",
"0.5291035",
"0.52873594",
"0.5251057",
"0.52471375",
"0.5242146",
"0.5225947",
"0.5219159",
"0.52101254",
"0.52033705",
"0.5180202",
"0.51688766",
"0.51376283",
"0.511466",
"0.5101056",
"0.50947183",
"0.50932753",
"0.50656265",
"0.5065564"
] |
0.8302406
|
0
|
Changes font underline settings of cell
|
def change_font_underline(underlined = false)
validate_worksheet
font = get_cell_font.dup
font.set_underline(underlined)
update_font_references(font)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_font_underline(underlined=false)\n validate_worksheet\n # Get copy of font object with modified underline settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_font(font)\n end",
"def change_row_underline(row=0, underlined=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified underline settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_row_font(row, Worksheet::UNDERLINE, underlined, font, xf_id)\n end",
"def change_column_underline(col=0, underlined=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified underline settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_underline(font, underlined)\n # Update font and xf array\n change_column_font(col, Worksheet::UNDERLINE, underlined, font, xf_id)\n end",
"def underline_cell(options = {}, &block)\n cell({ borders: [ :bottom ], border_width: 0.5 }.merge(options || {}), &block)\n end",
"def underline; end",
"def underline; end",
"def underline(underline=nil)\n cur_page.underline(underline)\n end",
"def underline\n surround_with_ansi(ANSI_UNDERLINE)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if @strong_on\n \"</strong></font>\"\n else\n \"</font>\"\n end\n \n end",
"def header_format; self.underline end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</strong></font>'\n \n end",
"def no_underline\n reset_prev_formatting self, :underline\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>'\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n\n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \n \"</font>\"\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n '</font>' if column_name != \"id\"\n \n end",
"def underline(text, options = {})\n options = { at: [0, 0] }.merge(options || {})\n text ||= ''\n text = Prawn::Text::NBSP if text.empty?\n text_width = options[:width] || width_of(text)\n text_height = options[:height] || height_of(text, width: text_width)\n text_box text, at: options[:at], width: text_width, height: text_height\n stored_line_width = line_width\n stored_stroke_color = stroke_color\n self.line_width = 0.5\n self.stroke_color = '000000'\n y = options[:at][1] - text_height + 2.pt\n x = options[:at][0]\n stroke_line [x, y], [ x + text_width, y ]\n self.line_width = stored_line_width\n self.stroke_color = stored_stroke_color\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_font_bold(bolded = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_bold(bolded)\n update_font_references(font)\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf, get_row_style(row_index))\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def change_row_font(row_index, change_type, arg, font)\n validate_workbook\n ensure_cell_exists(row_index)\n\n xf = workbook.register_new_font(font, get_row_xf(row_index))\n row = sheet_data[row_index]\n row.style_index = workbook.register_new_xf(xf)\n row.cells.each { |c| c.font_switch(change_type, arg) unless c.nil? }\n end",
"def underline_on(weight=1)\n write_bytes(27, 45, weight)\n end",
"def bold; \"\\e[1m#{self}\\e[22m\" end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def change_font_italics(italicized = false)\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_italic(italicized)\n update_font_references(font)\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n if column_name!=\"id\"\n '</font>'\n end\n end",
"def add_underline symbol\n ('_' + symbol.to_s).to_sym\nend",
"def mystdfmt(ws)\n return if !(ws.is_a?(WIN32OLE))\n ws.rows(1).Font.Bold=true\n ws.UsedRange.Font.size=8\n ws.columns.autofit\nend",
"def css_inline_config\n {\n css: {\n properties: %w(font-style font-weight text-decoration)\n }\n }\n end",
"def change_row_strikethrough(row=0, struckthrough=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified strikethrough settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_strikethrough(font, struckthrough)\n # Update font and xf array\n change_row_font(row, Worksheet::STRIKETHROUGH, struckthrough, font, xf_id)\n end",
"def change_row_bold(row=0, bolded=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified bold settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_row_font(row, Worksheet::BOLD, bolded, font, xf_id)\n end",
"def underline(str)\n str += \"\\n\" + \"-\"*str.length\n end",
"def change_row_italics(row=0, italicized=false)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified italics settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_row_font(row, Worksheet::ITALICS, italicized, font, xf_id)\n end",
"def underline(str)\n \"<u>#{str.to_s}</u>\"\n end",
"def setarrowstyle(*)\n super\n end",
"def after_cell_render_styling(column_name,cell_value,record)\n \"\"\n \n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def ansi_formatting(cell, col, row); end",
"def line_style(data_set_index, options={})\n @line_styles[data_set_index] = \"#{options[:line_thickness]}\"\n @line_styles[data_set_index] += \",#{options[:length_segment]},#{options[:length_blank]}\" if options[:length_segment]\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def update_font_references(modified_font)\n xf = workbook.register_new_font(modified_font, get_cell_xf)\n self.style_index = workbook.register_new_xf(xf)\n end",
"def before_cell_render_styling(column_name,cell_value,record)\n \"\"\n end",
"def bold_cell(options = {}, &block)\n cell({ font_style: :bold }.merge(options || {}), &block)\n end",
"def process(type, text, page)\n if type == \"Underline\"\n if @out[-1].index(text.strip)\n @out << @out.pop.gsub(text.strip,\"::::#{text.strip}::::\")\n else\n type = \"Underline-standalone\"\n end\n end\n return type == \"Underline\" ? nil : format(type, text, page) \nend",
"def scr_bold\n print \"\\33[1m\"\nend",
"def change_column_strikethrough(col=0, struckthrough=false)\n # Get style object\n xf_id = xf_id(get_col_style(col))\n # Get copy of font object with modified strikethrough settings\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_strikethrough(font, struckthrough)\n # Update font and xf array\n change_column_font(col, Worksheet::STRIKETHROUGH, struckthrough, font, xf_id)\n end",
"def underline_message(message)\n Format(:underline, message)\n end",
"def settextfontprec(*)\n super\n end",
"def change_font_strikethrough(struckthrough=false)\n validate_worksheet\n # Get copy of font object with modified strikethrough settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_strikethrough(font, struckthrough)\n # Update font and xf array\n change_font(font)\n end",
"def set_user_font model\n model.unread?(@user) ? 'font-bold' : '' rescue ''\n end",
"def h3; self.green.bold end",
"def resize_strike_through\n text_size = text.sizeWithAttributes({ NSFontAttributeName => font })\n strikethrough_layer.frame = CGRectMake(0, self.bounds.size.height/2,\n text_size.width, STRIKEOUT_THICKNESS)\n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def table_answer_style\n {\n cell_style: {\n border_width: 0,\n size: 12,\n align: :left,\n padding: [0, 0, 0, 35]\n },\n header: true\n }\n end",
"def bold\n surround_with_ansi(ANSI_BOLD)\n end",
"def setBold(btn, nom)\n label = Gtk::Label.new\n label.set_markup(\"<span weight = 'ultrabold'>#{nom}</span>\")\n btn.add(label)\n btn.set_height_request(60)\n end",
"def set_style(*v)\n styles = v.map { |i| @@style[i.to_sym] }.transpose\n prepend(\"\\e[\" << styles[0].join(';') << 'm')\n concat(\"\\e[\" << styles[1].join(';') << 'm')\n end",
"def process(type, text, page)\n if type == \"Underline\"\n if @out[-1] && @out[-1].index(text.strip)\n @out << @out.pop.gsub(text.strip,\"::::#{text.strip}::::\")\n else\n type = \"Underline-standalone\"\n end\n end\n return type == \"Underline\" ? nil : format(type, text, page)\nend",
"def misc(workbook, _center, _heading, _colors)\n worksheet = workbook.add_worksheet('Miscellaneous')\n\n worksheet.set_column(2, 2, 25)\n\n format01 = workbook.add_format\n format02 = workbook.add_format\n format03 = workbook.add_format\n format04 = workbook.add_format\n format05 = workbook.add_format\n format06 = workbook.add_format\n format07 = workbook.add_format\n\n format01.set_underline(0x01)\n format02.set_underline(0x02)\n format03.set_underline(0x21)\n format04.set_underline(0x22)\n format05.set_font_strikeout\n format06.set_font_outline\n format07.set_font_shadow\n\n worksheet.write(1, 2, 'Underline 0x01', format01)\n worksheet.write(3, 2, 'Underline 0x02', format02)\n worksheet.write(5, 2, 'Underline 0x21', format03)\n worksheet.write(7, 2, 'Underline 0x22', format04)\n worksheet.write(9, 2, 'Strikeout', format05)\n worksheet.write(11, 2, 'Outline (Macintosh only)', format06)\n worksheet.write(13, 2, 'Shadow (Macintosh only)', format07)\n end",
"def change_row_font_size(row=0, font_size=10)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified size\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:sz][:attributes][:val] = font_size\n # Update font and xf array\n change_row_font(row, Worksheet::SIZE, font_size, font, xf_id)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_row_font_color(row=0, font_color='000000')\n Color.validate_color(font_color)\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified color\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font = modify_font_color(font, font_color.to_s)\n # Update font and xf array\n change_row_font(row, Worksheet::COLOR, font_color, font, xf_id)\n end",
"def bold; end",
"def bold; end",
"def default_line_style\n [1.5, 1, 0]\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def table_question_style\n {\n column_widths: { 0 => 460 },\n cell_style: {\n border_width: 0,\n size: 12,\n align: :left,\n font_style: :bold,\n padding: [0, 0, 0, 45]\n },\n header: true\n }\n end",
"def change_font_bold(bolded=false)\n validate_worksheet\n # Get copy of font object with modified bold settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_bold(font, bolded)\n # Update font and xf array\n change_font(font)\n end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def makeAttributed(parameters = {})\n options = { text: 'text',\n font: NSFont.fontWithName( 'Menlo', size: 12 ),\n traits: 0, # trait mask (NSBoldFontMask, NSItalicFontMask, etc)\n textColor: NSColor.textColor,\n backgroundColor: NSColor.clearColor, # use textView background\n underline: false\n }.merge(parameters)\n return options[:text] if options[:text].class.to_s.end_with?('AttributedString')\n paraStyle = NSMutableParagraphStyle.alloc.init.tap do |style|\n style.tabStops = (1..21).each_with_object([]) do |index, tabArray| # add a few more\n tabArray.addObject(NSTextTab.alloc\n .initWithType( NSLeftTabStopType,\n location: index * 27.0 ))\n end\n end\n underline = options[:underline] ? NSUnderlineStyleSingle : NSUnderlineStyleNone\n NSMutableAttributedString.alloc.initWithString(options[:text]).tap do |attrText|\n attrText.beginEditing\n [[NSParagraphStyleAttributeName, paraStyle],\n [NSUnderlineStyleAttributeName, underline],\n [NSForegroundColorAttributeName, options[:textColor]],\n [NSBackgroundColorAttributeName, options[:backgroundColor]],\n [NSFontAttributeName, options[:font]]].each do |attribute, value|\n attrText.addAttribute(attribute, value: value, range: [0, attrText.length])\n end\n attrText.applyFontTraits(options[:traits], range: [0, attrText.length])\n attrText.endEditing\n end\nend",
"def italic; end",
"def italic; end",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def ignored_submission_style(s)\n \"text-decoration: \" + (s.ignored? ? \"line-through\" : \"none\") + \";\"\n end",
"def underline(string)\n '-' * string.size\n end",
"def get_row_style(row)\n if @row_styles[(row+1).to_s].nil?\n @row_styles[(row+1).to_s] = {}\n @row_styles[(row+1).to_s][:style] = '0'\n @workbook.fonts['0'][:count] += 1\n end\n return @row_styles[(row+1).to_s][:style]\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def change_font_color(font_color = '000000')\n validate_worksheet\n Color.validate_color(font_color)\n\n font = get_cell_font.dup\n font.set_rgb_color(font_color)\n update_font_references(font)\n end",
"def set_textborderwidth(width)\n @text.borderwidth(width)\n end",
"def paint_row(dc, y, addr, row_num)\n dc.set_pen(Wx::TRANSPARENT_PEN)\n dc.set_text_foreground(@addr_color)\n addr_str = addr.to_s(16).rjust(2,\"0\")\n w = dc.get_text_extent(addr_str)[0]\n dc.draw_text(addr_str, (@hex0 - w - @asc_width), y) \n if row_num\n dc.set_brush(@alt_row_bgs[ row_num % @alt_row_bgs.size ])\n dc.draw_rectangle(@hex0, y, @row_width, @txt_height)\n end\n end",
"def bold_italic_cell(options = {}, &block)\n cell({ font_style: :bold_italic }.merge(options || {}), &block)\n end",
"def font_size\n @font_size ||= [cell_height, cell_width].sort.shift * 0.8\n end",
"def emit_text_span_strong(colspan, textline, text_class=nil, options_hash={})\n if text_class\n options_hash[:class] = text_class\n end\n div :class => \"column span-#{colspan}\" do\n strong options_hash do\n text(textline)\n end\n end\n end",
"def change_font_size\n @font_size = 20*(@size_slider.value*2)+20\n #Use change_font_decor to maintain if font is bold or not\n change_font_decor\n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def change_font_size(font_size = 10)\n validate_worksheet\n raise 'Argument must be a number' unless font_size.is_a?(Integer) || font_size.is_a?(Float)\n\n font = get_cell_font.dup\n font.set_size(font_size)\n update_font_references(font)\n end",
"def setlinewidth(*)\n super\n end",
"def reset_table_cell\n mixin({\n text_align: 'left',\n font_weight: 'normal',\n vertical_align: 'middle'\n })\n end",
"def no_strikethrough\n reset_prev_formatting self, :strikethrough\n end",
"def set_line_style(width=1,dot_size=0)\n @line_width = width\n @line_dot_size = dot_size\n end",
"def use_default_style!\n @use_default_style = true\n end",
"def configure_cell_attributes(workbook_cell)\n workbook_cell.format = template.formats[@cell.xpath(\"@table:style-name\").to_s]\n workbook_cell.colspan = @cell.xpath(\"@table:number-columns-spanned\").to_s\n workbook_cell.rowspan = @cell.xpath(\"@table:number-rows-spanned\").to_s\n end",
"def style_on(*v)\n styles = v.map { |i| EscSequence::STYLE[i.to_sym] }.transpose\n \"\\e[\" << styles[0].join(';') << 'm'\n end",
"def font(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n s_attribute = @s_attribute[sheet][[row,col]]\n s_attribute ||= 0\n s_attribute = s_attribute.to_i\n @style_definitions[s_attribute]\n end",
"def settextalign(*)\n super\n end"
] |
[
"0.7695589",
"0.7397015",
"0.7152001",
"0.6990113",
"0.66901463",
"0.66901463",
"0.63874716",
"0.637665",
"0.6372925",
"0.6372925",
"0.63182336",
"0.6254913",
"0.61407024",
"0.6133203",
"0.6093899",
"0.60723346",
"0.60723346",
"0.59276927",
"0.58676517",
"0.5845751",
"0.5845751",
"0.58191836",
"0.57837224",
"0.5740428",
"0.55542123",
"0.55540085",
"0.55540085",
"0.5551214",
"0.55219495",
"0.55138284",
"0.54823995",
"0.54621094",
"0.5445998",
"0.5430654",
"0.54041654",
"0.54001564",
"0.5375739",
"0.5375491",
"0.53697693",
"0.5356219",
"0.5354512",
"0.5344812",
"0.5344812",
"0.53319305",
"0.5307129",
"0.53051674",
"0.5291981",
"0.52890795",
"0.5288736",
"0.52626264",
"0.5238949",
"0.5226564",
"0.5196808",
"0.5194131",
"0.5176479",
"0.5167873",
"0.51599026",
"0.51477265",
"0.5137757",
"0.5120887",
"0.5113022",
"0.51105195",
"0.5105386",
"0.5105386",
"0.50937647",
"0.50545037",
"0.50545037",
"0.5050825",
"0.503374",
"0.5030362",
"0.5022614",
"0.50124234",
"0.5006659",
"0.49764672",
"0.49764672",
"0.49668708",
"0.49486238",
"0.49481052",
"0.49304482",
"0.4922504",
"0.4922504",
"0.4907662",
"0.49032804",
"0.48976997",
"0.48844948",
"0.48735836",
"0.48346332",
"0.48336244",
"0.48277354",
"0.48277354",
"0.48221463",
"0.479901",
"0.47978455",
"0.47852916",
"0.4783099",
"0.4781748",
"0.4777849",
"0.47765455",
"0.47755715"
] |
0.826207
|
0
|
Helper method to update the font array and xf array
|
def update_font_references(modified_font)
xf = workbook.register_new_font(modified_font, get_cell_xf)
self.style_index = workbook.register_new_xf(xf)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def prepare_fonts # :nodoc:\n fonts = {}\n\n @xf_formats.each { |format| format.set_font_info(fonts) }\n\n @font_count = fonts.size\n\n # For the DXF formats we only need to check if the properties have changed.\n @dxf_formats.each do |format|\n # The only font properties that can change for a DXF format are: color,\n # bold, italic, underline and strikethrough.\n format.has_dxf_font(true) if format.color? || format.bold? || format.italic? || format.underline? || format.strikeout?\n end\n end",
"def update_font\n self.contents.font.name = @window.fontName\n #self.recalculate_maxlength\n self.refresh\n end",
"def change_font(font)\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, font_id())\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id())\n xf[:fontId] = Integer(font_id.to_i)\n # Modify xf array and retrieve new xf id\n @style_index = modify_xf(@workbook, xf)\n end",
"def initialize_fonts(application)\r\n\t[12, 14, 16, 18, 24].each() do |size|\r\n\t\tFONT[\"Courier #{size}\"] = FXFont.new(application, 'Courier New', size)\r\n\t\tFONT[\"Helvetica #{size}\"] = FXFont.new(application, 'Helvetica', size)\r\n\tend\r\n\t\r\n\tFONT['Courier 24 bold'] = FXFont.new(application, 'Courier New', 24, FXFont::Bold)\r\nend",
"def interpret(ps)\n raise Error unless ps.fonts.has_key?(@index)\n ps.font = ps.fonts[@index]\n end",
"def modify_font(workbook, style_index)\n # xf_obj = workbook.get_style(style_index)\n xf = workbook.get_style_attributes(workbook.get_style(style_index))\n\n #modify fonts array\n font_id = xf[:fontId]\n font = workbook.fonts[font_id.to_s][:font]\n\n #else, just change the attribute itself, done in calling method.\n if workbook.fonts[font_id.to_s][:count] > 1 || font_id == 0\n old_size = workbook.fonts.size.to_s\n workbook.fonts[old_size] = {}\n workbook.fonts[old_size][:font] = deep_copy(font)\n workbook.fonts[old_size][:count] = 1\n workbook.fonts[font_id.to_s][:count] -= 1\n\n #modify styles array\n font_id = old_size\n\n if workbook.cell_xfs[:xf].is_a?Array\n workbook.cell_xfs[:xf] << deep_copy({:attributes=>xf})\n else\n workbook.cell_xfs[:xf] = [workbook.cell_xfs[:xf], deep_copy({:attributes=>xf})]\n end\n\n xf = workbook.get_style_attributes(workbook.cell_xfs[:xf].last)\n xf[:fontId] = font_id\n xf[:applyFont] = '1'\n workbook.cell_xfs[:attributes][:count] += 1\n return workbook.cell_xfs[:xf].size-1 #returns new style_index\n else\n return style_index\n end\n end",
"def ctrlSetFont _obj, _args\n \"_obj ctrlSetFont _args;\" \n end",
"def load_fonts\n\n # Load fonts.\n self.load_single_font('Across The Road')\n self.load_single_font('Alabama')\n self.load_single_font('Arial')\n self.load_single_font('Arial Narrow')\n self.load_single_font('Arty Signature')\n self.load_single_font('Asem Kandis')\n self.load_single_font('Autograf')\n self.load_single_font('Born Ready')\n self.load_single_font('Brittany Signature')\n self.load_single_font('Bulgatti')\n self.load_single_font('Courier New')\n self.load_single_font('Estelly')\n self.load_single_font('Friday Vibes')\n self.load_single_font('From Skyler')\n self.load_single_font('Gallatone')\n self.load_single_font('Halimun')\n self.load_single_font('Hello Santtiny')\n self.load_single_font('Just Realize')\n self.load_single_font('Just Signature')\n self.load_single_font('Mayestica')\n self.load_single_font('Menlo')\n self.load_single_font('Notera')\n self.load_single_font('Prestige Signature')\n self.load_single_font('Reinata')\n self.load_single_font('Santos Dumont')\n self.load_single_font('SF Mono')\n self.load_single_font('Shopping List')\n self.load_single_font('Signatures')\n self.load_single_font('Signerica')\n self.load_single_font('Silver Pen')\n self.load_single_font('Sophistica')\n self.load_single_font('Source Code Pro')\n self.load_single_font('Southampton')\n self.load_single_font('Thankfully')\n self.load_single_font('The Jacklyn')\n self.load_single_font('Tomatoes')\n self.load_single_font('Wanted Signature')\n self.load_single_font('White Angelica')\n self.load_single_font('Whitney')\n self.load_single_font('Whitney Bold')\n self.load_single_font('Whitney Index Rounded')\n self.load_single_font('Whitney Index Squared')\n self.load_single_font('Xtreem')\n self.load_single_font('Gotham Condensed')\n\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n set_data_font(@maqj_font_data_type) if @maqj_font_data_type\n end",
"def init_font(font)\n @font=font\n dc = Wx::WindowDC.new(self)\n dc.set_font(font)\n @asc_width, asc_h = dc.get_text_extent(\"@\")[0,2]\n @asc_width+2 # compact, but not too much so\n @hex_width, hex_h = dc.get_text_extent(\"@@\")[0,2]\n @txt_height = (hex_h > asc_h)? hex_h : asc_h\n @addr_width = dc.get_text_extent(@data.size.to_s(16).rjust(4,'@'))[0]\n @row_height = @txt_height\n\n update_dimensions() if @started\n end",
"def reset_font_settings; set_data_font(:scene_label); end",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_name = args[:font_name] if args.key?(:font_name)\n end",
"def ctrlSetFontH6 _obj, _args\n \"_obj ctrlSetFontH6 _args;\" \n end",
"def change_font_name(fontname)\n @font_name = fontname\n @text_entry.update_font\n self.redraw\n end",
"def set_font\n font_families.update(\n 'HealthQuestPDF' => {\n normal: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-regular-webfont.ttf'),\n medium: HealthQuest::Engine.root.join('lib', 'fonts', 'sourcesanspro-bold-webfont.ttf'),\n bold: HealthQuest::Engine.root.join('lib', 'fonts', 'bitter-bold.ttf')\n }\n )\n font 'HealthQuestPDF'\n end",
"def ctrlSetFontPB _obj, _args\n \"_obj ctrlSetFontPB _args;\" \n end",
"def ctrlSetFontH3 _obj, _args\n \"_obj ctrlSetFontH3 _args;\" \n end",
"def change_font_name(font_name='Verdana')\n validate_worksheet\n # Get copy of font object with modified name\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_font(font)\n end",
"def another_print_fonts\n for index in 0..@fonts.size do\n puts \"#{index} -> #{@fonts[index]}\" # use of templating\n end\nend",
"def build_fonts(raw_fonts)\n wrapped_fonts = raw_fonts.map { |label, font|\n [label, PDF::Reader::Font.new(@objects, @objects.deref(font))]\n }\n\n ::Hash[wrapped_fonts]\n end",
"def build_fonts(raw_fonts)\n wrapped_fonts = raw_fonts.map { |label, font|\n [label, PDF::Reader::Font.new(@objects, @objects.deref(font))]\n }\n\n ::Hash[wrapped_fonts]\n end",
"def set_font_path()\n Dir.entries(@output_styles).each do |filename|\n next if filename =~ /^\\.\\.?$/\n filepath = \"#{@output_styles}/#{filename}\"\n\n text = File.read(filepath)\n new_text = text.gsub(/..\\/font/, \"#{@fonts_path}\")\n File.write(filepath, new_text)\n end\n end",
"def ctrlSetFontH6B _obj, _args\n \"_obj ctrlSetFontH6B _args;\" \n end",
"def ctrlSetFontH4 _obj, _args\n \"_obj ctrlSetFontH4 _args;\" \n end",
"def ctrlSetFontP _obj, _args\n \"_obj ctrlSetFontP _args;\" \n end",
"def load_fonts\n @@fonts[\"game\"] = Gosu::Font.new(80)\n @@fonts[\"menu\"] = Gosu::Font.new(40)\n @@fonts[\"notification\"] = Gosu::Font.new(25)\n @@fonts[\"big\"] = Gosu::Font.new(20)\n @@fonts[\"small\"] = Gosu::Font.new(14)\n @@fonts[\"button\"] = Gosu::Font.new(15)\n end",
"def ctrlSetFontH2 _obj, _args\n \"_obj ctrlSetFontH2 _args;\" \n end",
"def change_row_font(row, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(row)\n increase_rows(row)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n @row_styles[(row+1).to_s][:style] = modify_xf(@workbook, xf)\n\n if @sheet_data[row].nil?\n @sheet_data[row] = []\n end\n\n @sheet_data[Integer(row)].each do |c|\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def ctrlSetFontH3B _obj, _args\n \"_obj ctrlSetFontH3B _args;\" \n end",
"def setfont(*args)\n @p.setfont(self, *args)\n end",
"def reset_font_settings(*args, &block)\n super(*args, &block)\n self.contents.font.name = MARW_CONFIGURATION[:window_fontname] unless\n MARW_CONFIGURATION[:window_fontname].empty?\n self.contents.font.size = MARW_CONFIGURATION[:window_fontsize] unless\n MARW_CONFIGURATION[:window_fontsize] < 8\n end",
"def set_fonts\n font_families.update(\"Arial\" => {\n :normal => \"#{Rails.root}/vendor/assets/fonts/Arial.ttf\",\n :bold => \"#{Rails.root}/vendor/assets/fonts/Arial-Bold.ttf\"\n })\n font \"Arial\"\n end",
"def ctrlSetFontH2B _obj, _args\n \"_obj ctrlSetFontH2B _args;\" \n end",
"def explode_fonts\n puts 'Explode fonts...'.yellow\n FileUtils.rm_rf(@glyphs)\n FileUtils.mkdir_p(@glyphs)\n Dir.chdir(@sources) do\n for font_fullname in Dir['*'].sort\n font_dir = @sources.join(font_fullname)\n font_name = font_fullname.split('-')[1..-1].join('-')\n font_file = font_dir.join('font.svg')\n config_file = font_dir.join('config.yml')\n if font_file.exist? && config_file.exist?\n command(\"node_modules/.bin/svg-font-dump -n -c #{config_file} -f -i #{font_file} -o #{@glyphs}\")\n end\n end\n end\n # Removes weird icons\n Dir.chdir(@glyphs) do\n Dir.glob('{*,.*}').sort.collect do |cf|\n next if cf.to_s =~ /\\A[a-z0-9]+(\\-[a-z0-9]+)*\\.svg\\z/\n next if ['..', '.'].include? cf\n puts ' - ' + \"Remove #{cf}\".red\n FileUtils.rm_f(cf)\n end\n end\n end",
"def set_font_set_and_project\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n end",
"def ctrlSetFontH5 _obj, _args\n \"_obj ctrlSetFontH5 _args;\" \n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def set_font(font_name)\n itr = @form.getFields.keySet.iterator\n while itr.hasNext\n field = itr.next\n @form.setFieldProperty(field, 'textfont', create_font(font_name), nil)\n end\n end",
"def font=(f)\n\t\traise 'Font must respond to char_bitmap' if !f.nil? && !f.respond_to?(:char_bitmap)\n\t\t@font = f\n\tend",
"def ctrlSetFontH4B _obj, _args\n \"_obj ctrlSetFontH4B _args;\" \n end",
"def font=(value)\n @font = value\n end",
"def ctrlSetFontH1 _obj, _args\n \"_obj ctrlSetFontH1 _args;\" \n end",
"def font idx\n @fonts[idx]\n end",
"def setup\r\n background 0\r\n font = load_font \"data/DroidSansMono-24.vlw\"\r\n text_font(font)\r\n\r\n @c = []\r\n generate\r\n end",
"def maiil_reset_font\n fn = MA_IconItemList::NUM_FONTNAME ? MA_IconItemList::NUM_FONTNAME : Font.default_name\n contents.font = Font.new(fn, MA_IconItemList::NUM_FONTSIZE) # name and size\n contents.font.bold = MA_IconItemList::NUM_BOLD # Set Bold\n contents.font.italic = MA_IconItemList::NUM_ITALIC # Set Italic\n contents.font.shadow = MA_IconItemList::NUM_SHADOW # Set Shadow\n contents.font.outline = MA_IconItemList::NUM_OUTLINE # Set outline\n oc = MA_IconItemList::NUM_OUT_COLOUR ? MA_IconItemList::NUM_OUT_COLOUR : Font.default_out_color\n contents.font.out_color = text_color(oc) # outline color\n end",
"def build_common\n @font.encoding = 'UniJIS-UCS2-H'\n @font.names = NAMES\n # Initialize font dictionary.\n @dict.registry = 'Adobe'\n @dict.ordering = 'Japan1'\n @dict.supplement = 2\n @dict.default_width = 1000\n @dict.default_vertical_widths = [880, -1000]\n # Initialize font descriptor.\n @desc.b_box = [0, -136, 1000, 859]\n @desc.italic_angle = 0\n @desc.ascent = 859\n @desc.descent = -140\n @desc.cap_height = 769\n @desc.stem_v = 78\n end",
"def test_fontDiff\n f = Font.new()\n f.color = Color.power_up_color()\n f.size = 20\n f.bold = true\n [@window, @sprite, @bitmap].each{|container|\n uc = UCNumericUpDown.new(container, Rect.new(0, 48, 100, 24), 5, nil, 0, 99, 1, 0, f)\n uc.draw()\n }\n return true\n end",
"def change_font_decor\n #If toggled to on, font is bold, otherwise not bold.\n # Best case here is to use NSAttributedString\n if @switch_font.on? == true\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}-Bold\",size:@font_size)\n else\n @font_label.font = UIFont.fontWithName(\"#{@font_label.text}\",size:@font_size)\n end\n end",
"def ctrlSetFontH1B _obj, _args\n \"_obj ctrlSetFontH1B _args;\" \n end",
"def settextfontprec(*)\n super\n end",
"def ctrlSetFontH5B _obj, _args\n \"_obj ctrlSetFontH5B _args;\" \n end",
"def set_font(key, font)\r\n # Add :Font key to content hash unless there is no key\r\n unless @content[pn(:Resources)].has_key?(pn(:Font))\r\n @content[pn(:Resources)].update(pn(:Font) => pd)\r\n end\r\n # Add font symbol to :Font hash\r\n unless @content[pn(:Resources)][pn(:Font)].has_key?(key)\r\n @content[pn(:Resources)][pn(:Font)].update(key => font.reference)\r\n end\r\n end",
"def font_setup\n %Q(font \"#{@font},#{@fontsize}\")\n end",
"def test_fontDiff\n f = Font.new()\n f.color = Color.power_up_color()\n f.size = 12\n f.bold = true\n [@window, @sprite, @bitmap].each{|container|\n uc = UCGraph.new(container, 300, 180, 50, @elements, nil, 100, -100, f,\n Color.hp_gauge_color1, Color.hp_gauge_color2,\n Color.mp_gauge_color1, Color.mp_gauge_color2)\n uc.draw()\n }\n return true\n end",
"def normalize_font(source, destination, options = {})\n hexa = options[:hexa] || {}\n interm = source.dirname.join(source.basename('.*').to_s + '.svg')\n if interm.exist?\n puts \"No conversion needed for #{interm}\".white\n else\n command(\"fontforge -quiet -script #{@convert_script} #{source} svg\")\n end\n i = File.open(interm)\n doc = Nokogiri::XML(i) do |config|\n config.nonet.strict.noblanks\n end\n i.close\n doc.root.xpath('//svg:glyph[@d]', SVG_NAMESPACES).each do |glyph|\n name = glyph.attr('glyph-name')\n unicode = glyph.attr('unicode').to_s\n if unicode[0]\n hex = '%4.4x' % unicode[0].ord\n name = hexa[hex] if hexa[hex]\n end\n if name && name =~ /^[a-z0-9]+((\\_|\\-)[a-z0-9]+)*$/\n glyph['glyph-name'] = name.gsub(/[^a-z0-9]+/, '-')\n else\n puts \" - weird name (#{unicode.inspect}): #{name.inspect.red} \"\n end\n end\n doc.root.default_namespace = SVG_NAMESPACES[:svg]\n for name, url in SVG_NAMESPACES\n doc.root.add_namespace(name.to_s, url)\n end\n File.open(destination, 'wb') do |f|\n f.write doc.to_s\n end\n end",
"def setup_ft\n unless face\n @face = FT2::Face.load(@font)\n face.set_char_size 0, size * ONE64POINT, RESOLUTION, RESOLUTION\n end\n end",
"def change_font_italics(italicized=false)\n validate_worksheet\n # Get copy of font object with modified italics settings\n font = deep_copy(workbook.fonts[font_id().to_s][:font])\n font = modify_font_italics(font, italicized)\n # Update font and xf array\n change_font(font)\n end",
"def reset_font_settings; set_data_font(:category_label); end",
"def refresh\n contents.clear\n for i in 0...(@cw_data.size / 2)\n draw_text_ex(0, line_height*i, \"\\\\c[16]\" + @cw_data[i*2])\n reset_font_settings\n draw_text(0, line_height*i, contents_width, line_height, value(@cw_data[i*2 + 1]), 2)\n end\n end",
"def info_font(*args)\n @p.info_font(self, *args)\n end",
"def add_font_family(pdf:, name:, root:)\n if root == 'OldStandard'\n # No Bold-Italic variant in OldStandard\n bold_italic_name = \"#{root}-Bold.ttf\"\n else\n bold_italic_name = \"#{root}-BoldItalic.ttf\"\n end\n\n pdf.font_families.update(\n name => {\n normal: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Regular.ttf\").to_s,\n italic: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Italic.ttf\").to_s,\n bold: Rails.root.join('vendor', 'fonts', root,\n \"#{root}-Bold.ttf\").to_s,\n bold_italic: Rails.root.join('vendor', 'fonts', root,\n bold_italic_name).to_s\n }\n )\n end",
"def font=(font)\n set_font(font)\n generate_buffers\n end",
"def init_font_families\n # Set the known family groups. These font families will be used to\n # enable bold and italic markers to be included within text\n # streams. HTML forms will be used... <b></b> <i></i>\n @font_families[\"Helvetica\"] =\n {\n \"b\" => 'Helvetica-Bold',\n \"i\" => 'Helvetica-Oblique',\n \"bi\" => 'Helvetica-BoldOblique',\n \"ib\" => 'Helvetica-BoldOblique'\n }\n @font_families['Courier'] =\n {\n \"b\" => 'Courier-Bold',\n \"i\" => 'Courier-Oblique',\n \"bi\" => 'Courier-BoldOblique',\n \"ib\" => 'Courier-BoldOblique'\n }\n @font_families['Times-Roman'] =\n {\n \"b\" => 'Times-Bold',\n \"i\" => 'Times-Italic',\n \"bi\" => 'Times-BoldItalic',\n \"ib\" => 'Times-BoldItalic'\n }\n end",
"def parse_font_table(src, current_pos)\n group = 1\n\n font = nil\n in_extra = nil\n\n while (true)\n case(src[current_pos])\n when '{' then\n font = RubyRTF::Font.new if group == 1\n in_extra = nil\n\n group += 1\n\n when '}' then\n group -= 1\n\n if group <= 1\n break if font.nil?\n font.cleanup_names\n @doc.font_table[font.number] = font\n end\n\n in_extra = nil\n\n break if group == 0\n\n when '\\\\' then\n ctrl, val, current_pos = parse_control(src, current_pos + 1)\n\n font = RubyRTF::Font.new if font.nil?\n\n case(ctrl)\n when :f then font.number = val\n when :fprq then font.pitch = val\n when :fcharset then font.character_set = val\n when *[:flomajor, :fhimajor, :fdbmajor, :fbimajor,\n :flominor, :fhiminor, :fdbminor, :fbiminor] then\n font.theme = ctrl.to_s[1..-1].to_sym\n\n when *[:falt, :fname, :panose] then in_extra = ctrl\n else\n cmd = ctrl.to_s[1..-1].to_sym\n if RubyRTF::Font::FAMILIES.include?(cmd)\n font.family_command = cmd\n end\n end\n\n # need to next as parse_control will leave current_pos at the\n # next character already so current_pos += 1 below would move us too far\n next\n when *[\"\\r\", \"\\n\"] then ;\n else\n case(in_extra)\n when :falt then font.alternate_name << src[current_pos]\n when :panose then font.panose << src[current_pos]\n when :fname then font.non_tagged_name << src[current_pos]\n when nil then font.name << src[current_pos]\n end\n end\n current_pos += 1\n end\n\n current_pos\n end",
"def setFontLib(name,location)\n\t\t\t@font = name\n\t\t\t@font_lib = CaptchaFont.new(name,location)\n\n\t\tend",
"def time_to_font(time,font)\n output = []\n for i in 0...time.length()\n converted_font = convert_1_number_to_1_font(time[i],font)\n output.append(converted_font)\n end\n return output\nend",
"def type1_font_names\n if @options[:built_in_fonts]\n PdfK::FONT_NAMES\n else\n AFM::font_names\n end\n end",
"def initiate_library\n # do nothing if the library is already initiated\n return false if FONTS_LIBRARY.key? :Helvetica\n # font metrics objects to be used\n times_metrics = { \"\\u0000\" => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [130, -9, 238, 676] }, '\"' => { wx: 408, boundingbox: [77, 431, 331, 676] }, '#' => { wx: 500, boundingbox: [5, 0, 496, 662] }, '$' => { wx: 500, boundingbox: [44, -87, 457, 727] }, '%' => { wx: 833, boundingbox: [61, -13, 772, 676] }, '&' => { wx: 778, boundingbox: [42, -13, 750, 676] }, \"'\" => { wx: 333, boundingbox: [79, 433, 218, 676] }, '(' => { wx: 333, boundingbox: [48, -177, 304, 676] }, ')' => { wx: 333, boundingbox: [29, -177, 285, 676] }, '*' => { wx: 500, boundingbox: [69, 265, 432, 676] }, '+' => { wx: 564, boundingbox: [30, 0, 534, 506] }, ',' => { wx: 250, boundingbox: [56, -141, 195, 102] }, '-' => { wx: 333, boundingbox: [39, 194, 285, 257] }, '.' => { wx: 250, boundingbox: [70, -11, 181, 100] }, '/' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 676] }, '1' => { wx: 500, boundingbox: [111, 0, 394, 676] }, '2' => { wx: 500, boundingbox: [30, 0, 475, 676] }, '3' => { wx: 500, boundingbox: [43, -14, 431, 676] }, '4' => { wx: 500, boundingbox: [12, 0, 472, 676] }, '5' => { wx: 500, boundingbox: [32, -14, 438, 688] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 684] }, '7' => { wx: 500, boundingbox: [20, -8, 449, 662] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 676] }, '9' => { wx: 500, boundingbox: [30, -22, 459, 676] }, ':' => { wx: 278, boundingbox: [81, -11, 192, 459] }, ';' => { wx: 278, boundingbox: [80, -141, 219, 459] }, '<' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '=' => { wx: 564, boundingbox: [30, 120, 534, 386] }, '>' => { wx: 564, boundingbox: [28, -8, 536, 514] }, '?' => { wx: 444, boundingbox: [68, -8, 414, 676] }, '@' => { wx: 921, boundingbox: [116, -14, 809, 676] }, 'A' => { wx: 722, boundingbox: [15, 0, 706, 674] }, 'B' => { wx: 667, boundingbox: [17, 0, 593, 662] }, 'C' => { wx: 667, boundingbox: [28, -14, 633, 676] }, 'D' => { wx: 722, boundingbox: [16, 0, 685, 662] }, 'E' => { wx: 611, boundingbox: [12, 0, 597, 662] }, 'F' => { wx: 556, boundingbox: [12, 0, 546, 662] }, 'G' => { wx: 722, boundingbox: [32, -14, 709, 676] }, 'H' => { wx: 722, boundingbox: [19, 0, 702, 662] }, 'I' => { wx: 333, boundingbox: [18, 0, 315, 662] }, 'J' => { wx: 389, boundingbox: [10, -14, 370, 662] }, 'K' => { wx: 722, boundingbox: [34, 0, 723, 662] }, 'L' => { wx: 611, boundingbox: [12, 0, 598, 662] }, 'M' => { wx: 889, boundingbox: [12, 0, 863, 662] }, 'N' => { wx: 722, boundingbox: [12, -11, 707, 662] }, 'O' => { wx: 722, boundingbox: [34, -14, 688, 676] }, 'P' => { wx: 556, boundingbox: [16, 0, 542, 662] }, 'Q' => { wx: 722, boundingbox: [34, -178, 701, 676] }, 'R' => { wx: 667, boundingbox: [17, 0, 659, 662] }, 'S' => { wx: 556, boundingbox: [42, -14, 491, 676] }, 'T' => { wx: 611, boundingbox: [17, 0, 593, 662] }, 'U' => { wx: 722, boundingbox: [14, -14, 705, 662] }, 'V' => { wx: 722, boundingbox: [16, -11, 697, 662] }, 'W' => { wx: 944, boundingbox: [5, -11, 932, 662] }, 'X' => { wx: 722, boundingbox: [10, 0, 704, 662] }, 'Y' => { wx: 722, boundingbox: [22, 0, 703, 662] }, 'Z' => { wx: 611, boundingbox: [9, 0, 597, 662] }, '[' => { wx: 333, boundingbox: [88, -156, 299, 662] }, '\\\\' => { wx: 278, boundingbox: [-9, -14, 287, 676] }, ']' => { wx: 333, boundingbox: [34, -156, 245, 662] }, '^' => { wx: 469, boundingbox: [24, 297, 446, 662] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [115, 433, 254, 676] }, 'a' => { wx: 444, boundingbox: [37, -10, 442, 460] }, 'b' => { wx: 500, boundingbox: [3, -10, 468, 683] }, 'c' => { wx: 444, boundingbox: [25, -10, 412, 460] }, 'd' => { wx: 500, boundingbox: [27, -10, 491, 683] }, 'e' => { wx: 444, boundingbox: [25, -10, 424, 460] }, 'f' => { wx: 333, boundingbox: [20, 0, 383, 683] }, 'g' => { wx: 500, boundingbox: [28, -218, 470, 460] }, 'h' => { wx: 500, boundingbox: [9, 0, 487, 683] }, 'i' => { wx: 278, boundingbox: [16, 0, 253, 683] }, 'j' => { wx: 278, boundingbox: [-70, -218, 194, 683] }, 'k' => { wx: 500, boundingbox: [7, 0, 505, 683] }, 'l' => { wx: 278, boundingbox: [19, 0, 257, 683] }, 'm' => { wx: 778, boundingbox: [16, 0, 775, 460] }, 'n' => { wx: 500, boundingbox: [16, 0, 485, 460] }, 'o' => { wx: 500, boundingbox: [29, -10, 470, 460] }, 'p' => { wx: 500, boundingbox: [5, -217, 470, 460] }, 'q' => { wx: 500, boundingbox: [24, -217, 488, 460] }, 'r' => { wx: 333, boundingbox: [5, 0, 335, 460] }, 's' => { wx: 389, boundingbox: [51, -10, 348, 460] }, 't' => { wx: 278, boundingbox: [13, -10, 279, 579] }, 'u' => { wx: 500, boundingbox: [9, -10, 479, 450] }, 'v' => { wx: 500, boundingbox: [19, -14, 477, 450] }, 'w' => { wx: 722, boundingbox: [21, -14, 694, 450] }, 'x' => { wx: 500, boundingbox: [17, 0, 479, 450] }, 'y' => { wx: 500, boundingbox: [14, -218, 475, 450] }, 'z' => { wx: 444, boundingbox: [27, 0, 418, 450] }, '{' => { wx: 480, boundingbox: [100, -181, 350, 680] }, '|' => { wx: 200, boundingbox: [67, -218, 133, 782] }, '}' => { wx: 480, boundingbox: [130, -181, 380, 680] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 333, boundingbox: [97, -218, 205, 467] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -138, 448, 579] }, \"\\u00A3\" => { wx: 500, boundingbox: [12, -8, 490, 676] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -14, 331, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [-53, 0, 512, 662] }, \"\\u00A6\" => { wx: 500, boundingbox: [7, -189, 490, 676] }, \"\\u00A7\" => { wx: 500, boundingbox: [70, -148, 426, 676] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 58, 522, 602] }, \"\\u00A9\" => { wx: 180, boundingbox: [48, 431, 133, 676] }, \"\\u00AA\" => { wx: 444, boundingbox: [43, 433, 414, 676] }, \"\\u00AB\" => { wx: 500, boundingbox: [42, 33, 456, 416] }, \"\\u00AC\" => { wx: 333, boundingbox: [63, 33, 285, 416] }, \"\\u00AD\" => { wx: 333, boundingbox: [48, 33, 270, 416] }, \"\\u00AE\" => { wx: 556, boundingbox: [31, 0, 521, 683] }, \"\\u00AF\" => { wx: 556, boundingbox: [32, 0, 521, 683] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 201, 500, 250] }, \"\\u00B2\" => { wx: 500, boundingbox: [59, -149, 442, 676] }, \"\\u00B3\" => { wx: 500, boundingbox: [58, -153, 442, 676] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 453, boundingbox: [-22, -154, 450, 662] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 196, 310, 466] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -141, 218, 102] }, \"\\u00B9\" => { wx: 444, boundingbox: [45, -141, 416, 102] }, \"\\u00BA\" => { wx: 444, boundingbox: [30, 433, 401, 676] }, \"\\u00BB\" => { wx: 500, boundingbox: [44, 33, 458, 416] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -11, 888, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 706] }, \"\\u00BF\" => { wx: 444, boundingbox: [30, -218, 376, 466] }, \"\\u00C1\" => { wx: 333, boundingbox: [19, 507, 242, 678] }, \"\\u00C2\" => { wx: 333, boundingbox: [93, 507, 317, 678] }, \"\\u00C3\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00C4\" => { wx: 333, boundingbox: [1, 532, 331, 638] }, \"\\u00C5\" => { wx: 333, boundingbox: [11, 547, 322, 601] }, \"\\u00C6\" => { wx: 333, boundingbox: [26, 507, 307, 664] }, \"\\u00C7\" => { wx: 333, boundingbox: [118, 581, 216, 681] }, \"\\u00C8\" => { wx: 333, boundingbox: [18, 581, 315, 681] }, \"\\u00CA\" => { wx: 333, boundingbox: [67, 512, 266, 711] }, \"\\u00CB\" => { wx: 333, boundingbox: [52, -215, 261, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-3, 507, 377, 678] }, \"\\u00CE\" => { wx: 333, boundingbox: [62, -165, 243, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [11, 507, 322, 674] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 201, 1000, 250] }, \"\\u00E1\" => { wx: 889, boundingbox: [0, 0, 863, 662] }, \"\\u00E3\" => { wx: 276, boundingbox: [4, 394, 270, 676] }, \"\\u00E8\" => { wx: 611, boundingbox: [12, 0, 598, 662] }, \"\\u00E9\" => { wx: 722, boundingbox: [34, -80, 688, 734] }, \"\\u00EA\" => { wx: 889, boundingbox: [30, -6, 885, 668] }, \"\\u00EB\" => { wx: 310, boundingbox: [6, 394, 304, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [38, -10, 632, 460] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 253, 460] }, \"\\u00F8\" => { wx: 278, boundingbox: [19, 0, 259, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [29, -112, 470, 551] }, \"\\u00FA\" => { wx: 722, boundingbox: [30, -10, 690, 460] }, \"\\u00FB\" => { wx: 500, boundingbox: [12, -9, 468, 683] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bold_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [81, -13, 251, 691] }, '\"' => { wx: 555, boundingbox: [83, 404, 472, 691] }, '#' => { wx: 500, boundingbox: [4, 0, 496, 700] }, '$' => { wx: 500, boundingbox: [29, -99, 472, 750] }, '%' => { wx: 1000, boundingbox: [124, -14, 877, 692] }, '&' => { wx: 833, boundingbox: [62, -16, 787, 691] }, \"'\" => { wx: 333, boundingbox: [79, 356, 263, 691] }, '(' => { wx: 333, boundingbox: [46, -168, 306, 694] }, ')' => { wx: 333, boundingbox: [27, -168, 287, 694] }, '*' => { wx: 500, boundingbox: [56, 255, 447, 691] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [39, -180, 223, 155] }, '-' => { wx: 333, boundingbox: [44, 171, 287, 287] }, '.' => { wx: 250, boundingbox: [41, -13, 210, 156] }, '/' => { wx: 278, boundingbox: [-24, -19, 302, 691] }, '0' => { wx: 500, boundingbox: [24, -13, 476, 688] }, '1' => { wx: 500, boundingbox: [65, 0, 442, 688] }, '2' => { wx: 500, boundingbox: [17, 0, 478, 688] }, '3' => { wx: 500, boundingbox: [16, -14, 468, 688] }, '4' => { wx: 500, boundingbox: [19, 0, 475, 688] }, '5' => { wx: 500, boundingbox: [22, -8, 470, 676] }, '6' => { wx: 500, boundingbox: [28, -13, 475, 688] }, '7' => { wx: 500, boundingbox: [17, 0, 477, 676] }, '8' => { wx: 500, boundingbox: [28, -13, 472, 688] }, '9' => { wx: 500, boundingbox: [26, -13, 473, 688] }, ':' => { wx: 333, boundingbox: [82, -13, 251, 472] }, ';' => { wx: 333, boundingbox: [82, -180, 266, 472] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [57, -13, 445, 689] }, '@' => { wx: 930, boundingbox: [108, -19, 822, 691] }, 'A' => { wx: 722, boundingbox: [9, 0, 689, 690] }, 'B' => { wx: 667, boundingbox: [16, 0, 619, 676] }, 'C' => { wx: 722, boundingbox: [49, -19, 687, 691] }, 'D' => { wx: 722, boundingbox: [14, 0, 690, 676] }, 'E' => { wx: 667, boundingbox: [16, 0, 641, 676] }, 'F' => { wx: 611, boundingbox: [16, 0, 583, 676] }, 'G' => { wx: 778, boundingbox: [37, -19, 755, 691] }, 'H' => { wx: 778, boundingbox: [21, 0, 759, 676] }, 'I' => { wx: 389, boundingbox: [20, 0, 370, 676] }, 'J' => { wx: 500, boundingbox: [3, -96, 479, 676] }, 'K' => { wx: 778, boundingbox: [30, 0, 769, 676] }, 'L' => { wx: 667, boundingbox: [19, 0, 638, 676] }, 'M' => { wx: 944, boundingbox: [14, 0, 921, 676] }, 'N' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'O' => { wx: 778, boundingbox: [35, -19, 743, 691] }, 'P' => { wx: 611, boundingbox: [16, 0, 600, 676] }, 'Q' => { wx: 778, boundingbox: [35, -176, 743, 691] }, 'R' => { wx: 722, boundingbox: [26, 0, 715, 676] }, 'S' => { wx: 556, boundingbox: [35, -19, 513, 692] }, 'T' => { wx: 667, boundingbox: [31, 0, 636, 676] }, 'U' => { wx: 722, boundingbox: [16, -19, 701, 676] }, 'V' => { wx: 722, boundingbox: [16, -18, 701, 676] }, 'W' => { wx: 1000, boundingbox: [19, -15, 981, 676] }, 'X' => { wx: 722, boundingbox: [16, 0, 699, 676] }, 'Y' => { wx: 722, boundingbox: [15, 0, 699, 676] }, 'Z' => { wx: 667, boundingbox: [28, 0, 634, 676] }, '[' => { wx: 333, boundingbox: [67, -149, 301, 678] }, '\\\\' => { wx: 278, boundingbox: [-25, -19, 303, 691] }, ']' => { wx: 333, boundingbox: [32, -149, 266, 678] }, '^' => { wx: 581, boundingbox: [73, 311, 509, 676] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [70, 356, 254, 691] }, 'a' => { wx: 500, boundingbox: [25, -14, 488, 473] }, 'b' => { wx: 556, boundingbox: [17, -14, 521, 676] }, 'c' => { wx: 444, boundingbox: [25, -14, 430, 473] }, 'd' => { wx: 556, boundingbox: [25, -14, 534, 676] }, 'e' => { wx: 444, boundingbox: [25, -14, 426, 473] }, 'f' => { wx: 333, boundingbox: [14, 0, 389, 691] }, 'g' => { wx: 500, boundingbox: [28, -206, 483, 473] }, 'h' => { wx: 556, boundingbox: [16, 0, 534, 676] }, 'i' => { wx: 278, boundingbox: [16, 0, 255, 691] }, 'j' => { wx: 333, boundingbox: [-57, -203, 263, 691] }, 'k' => { wx: 556, boundingbox: [22, 0, 543, 676] }, 'l' => { wx: 278, boundingbox: [16, 0, 255, 676] }, 'm' => { wx: 833, boundingbox: [16, 0, 814, 473] }, 'n' => { wx: 556, boundingbox: [21, 0, 539, 473] }, 'o' => { wx: 500, boundingbox: [25, -14, 476, 473] }, 'p' => { wx: 556, boundingbox: [19, -205, 524, 473] }, 'q' => { wx: 556, boundingbox: [34, -205, 536, 473] }, 'r' => { wx: 444, boundingbox: [29, 0, 434, 473] }, 's' => { wx: 389, boundingbox: [25, -14, 361, 473] }, 't' => { wx: 333, boundingbox: [20, -12, 332, 630] }, 'u' => { wx: 556, boundingbox: [16, -14, 537, 461] }, 'v' => { wx: 500, boundingbox: [21, -14, 485, 461] }, 'w' => { wx: 722, boundingbox: [23, -14, 707, 461] }, 'x' => { wx: 500, boundingbox: [12, 0, 484, 461] }, 'y' => { wx: 500, boundingbox: [16, -205, 480, 461] }, 'z' => { wx: 444, boundingbox: [21, 0, 420, 461] }, '{' => { wx: 394, boundingbox: [22, -175, 340, 698] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 394, boundingbox: [54, -175, 372, 698] }, '~' => { wx: 520, boundingbox: [29, 173, 491, 333] }, \"\\u00A1\" => { wx: 333, boundingbox: [82, -203, 252, 501] }, \"\\u00A2\" => { wx: 500, boundingbox: [53, -140, 458, 588] }, \"\\u00A3\" => { wx: 500, boundingbox: [21, -14, 477, 684] }, \"\\u00A4\" => { wx: 167, boundingbox: [-168, -12, 329, 688] }, \"\\u00A5\" => { wx: 500, boundingbox: [-64, 0, 547, 676] }, \"\\u00A6\" => { wx: 500, boundingbox: [0, -155, 498, 706] }, \"\\u00A7\" => { wx: 500, boundingbox: [57, -132, 443, 691] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 61, 526, 613] }, \"\\u00A9\" => { wx: 278, boundingbox: [75, 404, 204, 691] }, \"\\u00AA\" => { wx: 500, boundingbox: [32, 356, 486, 691] }, \"\\u00AB\" => { wx: 500, boundingbox: [23, 36, 473, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 36, 305, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [28, 36, 282, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00AF\" => { wx: 556, boundingbox: [14, 0, 536, 691] }, \"\\u00B1\" => { wx: 500, boundingbox: [0, 181, 500, 271] }, \"\\u00B2\" => { wx: 500, boundingbox: [47, -134, 453, 691] }, \"\\u00B3\" => { wx: 500, boundingbox: [45, -132, 456, 691] }, \"\\u00B4\" => { wx: 250, boundingbox: [41, 248, 210, 417] }, \"\\u00B6\" => { wx: 540, boundingbox: [0, -186, 519, 676] }, \"\\u00B7\" => { wx: 350, boundingbox: [35, 198, 315, 478] }, \"\\u00B8\" => { wx: 333, boundingbox: [79, -180, 263, 155] }, \"\\u00B9\" => { wx: 500, boundingbox: [14, -180, 468, 155] }, \"\\u00BA\" => { wx: 500, boundingbox: [14, 356, 468, 691] }, \"\\u00BB\" => { wx: 500, boundingbox: [27, 36, 477, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [82, -13, 917, 156] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 995, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [55, -201, 443, 501] }, \"\\u00C1\" => { wx: 333, boundingbox: [8, 528, 246, 713] }, \"\\u00C2\" => { wx: 333, boundingbox: [86, 528, 324, 713] }, \"\\u00C3\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00C4\" => { wx: 333, boundingbox: [-16, 547, 349, 674] }, \"\\u00C5\" => { wx: 333, boundingbox: [1, 565, 331, 637] }, \"\\u00C6\" => { wx: 333, boundingbox: [15, 528, 318, 691] }, \"\\u00C7\" => { wx: 333, boundingbox: [103, 536, 258, 691] }, \"\\u00C8\" => { wx: 333, boundingbox: [-2, 537, 335, 667] }, \"\\u00CA\" => { wx: 333, boundingbox: [60, 527, 273, 740] }, \"\\u00CB\" => { wx: 333, boundingbox: [68, -218, 294, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [-13, 528, 425, 713] }, \"\\u00CE\" => { wx: 333, boundingbox: [90, -193, 319, 24] }, \"\\u00CF\" => { wx: 333, boundingbox: [-2, 528, 335, 704] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 181, 1000, 271] }, \"\\u00E1\" => { wx: 1000, boundingbox: [4, 0, 951, 676] }, \"\\u00E3\" => { wx: 300, boundingbox: [-1, 397, 301, 688] }, \"\\u00E8\" => { wx: 667, boundingbox: [19, 0, 638, 676] }, \"\\u00E9\" => { wx: 778, boundingbox: [35, -74, 743, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [22, -5, 981, 684] }, \"\\u00EB\" => { wx: 330, boundingbox: [18, 397, 312, 688] }, \"\\u00F1\" => { wx: 722, boundingbox: [33, -14, 693, 473] }, \"\\u00F5\" => { wx: 278, boundingbox: [16, 0, 255, 461] }, \"\\u00F8\" => { wx: 278, boundingbox: [-22, 0, 303, 676] }, \"\\u00F9\" => { wx: 500, boundingbox: [25, -92, 476, 549] }, \"\\u00FA\" => { wx: 722, boundingbox: [22, -14, 696, 473] }, \"\\u00FB\" => { wx: 556, boundingbox: [19, -12, 517, 691] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_italic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [39, -11, 302, 667] }, '\"' => { wx: 420, boundingbox: [144, 421, 432, 666] }, '#' => { wx: 500, boundingbox: [2, 0, 540, 676] }, '$' => { wx: 500, boundingbox: [31, -89, 497, 731] }, '%' => { wx: 833, boundingbox: [79, -13, 790, 676] }, '&' => { wx: 778, boundingbox: [76, -18, 723, 666] }, \"'\" => { wx: 333, boundingbox: [151, 436, 290, 666] }, '(' => { wx: 333, boundingbox: [42, -181, 315, 669] }, ')' => { wx: 333, boundingbox: [16, -180, 289, 669] }, '*' => { wx: 500, boundingbox: [128, 255, 492, 666] }, '+' => { wx: 675, boundingbox: [86, 0, 590, 506] }, ',' => { wx: 250, boundingbox: [-4, -129, 135, 101] }, '-' => { wx: 333, boundingbox: [49, 192, 282, 255] }, '.' => { wx: 250, boundingbox: [27, -11, 138, 100] }, '/' => { wx: 278, boundingbox: [-65, -18, 386, 666] }, '0' => { wx: 500, boundingbox: [32, -7, 497, 676] }, '1' => { wx: 500, boundingbox: [49, 0, 409, 676] }, '2' => { wx: 500, boundingbox: [12, 0, 452, 676] }, '3' => { wx: 500, boundingbox: [15, -7, 465, 676] }, '4' => { wx: 500, boundingbox: [1, 0, 479, 676] }, '5' => { wx: 500, boundingbox: [15, -7, 491, 666] }, '6' => { wx: 500, boundingbox: [30, -7, 521, 686] }, '7' => { wx: 500, boundingbox: [75, -8, 537, 666] }, '8' => { wx: 500, boundingbox: [30, -7, 493, 676] }, '9' => { wx: 500, boundingbox: [23, -17, 492, 676] }, ':' => { wx: 333, boundingbox: [50, -11, 261, 441] }, ';' => { wx: 333, boundingbox: [27, -129, 261, 441] }, '<' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '=' => { wx: 675, boundingbox: [86, 120, 590, 386] }, '>' => { wx: 675, boundingbox: [84, -8, 592, 514] }, '?' => { wx: 500, boundingbox: [132, -12, 472, 664] }, '@' => { wx: 920, boundingbox: [118, -18, 806, 666] }, 'A' => { wx: 611, boundingbox: [-51, 0, 564, 668] }, 'B' => { wx: 611, boundingbox: [-8, 0, 588, 653] }, 'C' => { wx: 667, boundingbox: [66, -18, 689, 666] }, 'D' => { wx: 722, boundingbox: [-8, 0, 700, 653] }, 'E' => { wx: 611, boundingbox: [-1, 0, 634, 653] }, 'F' => { wx: 611, boundingbox: [8, 0, 645, 653] }, 'G' => { wx: 722, boundingbox: [52, -18, 722, 666] }, 'H' => { wx: 722, boundingbox: [-8, 0, 767, 653] }, 'I' => { wx: 333, boundingbox: [-8, 0, 384, 653] }, 'J' => { wx: 444, boundingbox: [-6, -18, 491, 653] }, 'K' => { wx: 667, boundingbox: [7, 0, 722, 653] }, 'L' => { wx: 556, boundingbox: [-8, 0, 559, 653] }, 'M' => { wx: 833, boundingbox: [-18, 0, 873, 653] }, 'N' => { wx: 667, boundingbox: [-20, -15, 727, 653] }, 'O' => { wx: 722, boundingbox: [60, -18, 699, 666] }, 'P' => { wx: 611, boundingbox: [0, 0, 605, 653] }, 'Q' => { wx: 722, boundingbox: [59, -182, 699, 666] }, 'R' => { wx: 611, boundingbox: [-13, 0, 588, 653] }, 'S' => { wx: 500, boundingbox: [17, -18, 508, 667] }, 'T' => { wx: 556, boundingbox: [59, 0, 633, 653] }, 'U' => { wx: 722, boundingbox: [102, -18, 765, 653] }, 'V' => { wx: 611, boundingbox: [76, -18, 688, 653] }, 'W' => { wx: 833, boundingbox: [71, -18, 906, 653] }, 'X' => { wx: 611, boundingbox: [-29, 0, 655, 653] }, 'Y' => { wx: 556, boundingbox: [78, 0, 633, 653] }, 'Z' => { wx: 556, boundingbox: [-6, 0, 606, 653] }, '[' => { wx: 389, boundingbox: [21, -153, 391, 663] }, '\\\\' => { wx: 278, boundingbox: [-41, -18, 319, 666] }, ']' => { wx: 389, boundingbox: [12, -153, 382, 663] }, '^' => { wx: 422, boundingbox: [0, 301, 422, 666] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [171, 436, 310, 666] }, 'a' => { wx: 500, boundingbox: [17, -11, 476, 441] }, 'b' => { wx: 500, boundingbox: [23, -11, 473, 683] }, 'c' => { wx: 444, boundingbox: [30, -11, 425, 441] }, 'd' => { wx: 500, boundingbox: [15, -13, 527, 683] }, 'e' => { wx: 444, boundingbox: [31, -11, 412, 441] }, 'f' => { wx: 278, boundingbox: [-147, -207, 424, 678] }, 'g' => { wx: 500, boundingbox: [8, -206, 472, 441] }, 'h' => { wx: 500, boundingbox: [19, -9, 478, 683] }, 'i' => { wx: 278, boundingbox: [49, -11, 264, 654] }, 'j' => { wx: 278, boundingbox: [-124, -207, 276, 654] }, 'k' => { wx: 444, boundingbox: [14, -11, 461, 683] }, 'l' => { wx: 278, boundingbox: [41, -11, 279, 683] }, 'm' => { wx: 722, boundingbox: [12, -9, 704, 441] }, 'n' => { wx: 500, boundingbox: [14, -9, 474, 441] }, 'o' => { wx: 500, boundingbox: [27, -11, 468, 441] }, 'p' => { wx: 500, boundingbox: [-75, -205, 469, 441] }, 'q' => { wx: 500, boundingbox: [25, -209, 483, 441] }, 'r' => { wx: 389, boundingbox: [45, 0, 412, 441] }, 's' => { wx: 389, boundingbox: [16, -13, 366, 442] }, 't' => { wx: 278, boundingbox: [37, -11, 296, 546] }, 'u' => { wx: 500, boundingbox: [42, -11, 475, 441] }, 'v' => { wx: 444, boundingbox: [21, -18, 426, 441] }, 'w' => { wx: 667, boundingbox: [16, -18, 648, 441] }, 'x' => { wx: 444, boundingbox: [-27, -11, 447, 441] }, 'y' => { wx: 444, boundingbox: [-24, -206, 426, 441] }, 'z' => { wx: 389, boundingbox: [-2, -81, 380, 428] }, '{' => { wx: 400, boundingbox: [51, -177, 407, 687] }, '|' => { wx: 275, boundingbox: [105, -217, 171, 783] }, '}' => { wx: 400, boundingbox: [-7, -177, 349, 687] }, '~' => { wx: 541, boundingbox: [40, 183, 502, 323] }, \"\\u00A1\" => { wx: 389, boundingbox: [59, -205, 322, 473] }, \"\\u00A2\" => { wx: 500, boundingbox: [77, -143, 472, 560] }, \"\\u00A3\" => { wx: 500, boundingbox: [10, -6, 517, 670] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -10, 337, 676] }, \"\\u00A5\" => { wx: 500, boundingbox: [27, 0, 603, 653] }, \"\\u00A6\" => { wx: 500, boundingbox: [25, -182, 507, 682] }, \"\\u00A7\" => { wx: 500, boundingbox: [53, -162, 461, 666] }, \"\\u00A8\" => { wx: 500, boundingbox: [-22, 53, 522, 597] }, \"\\u00A9\" => { wx: 214, boundingbox: [132, 421, 241, 666] }, \"\\u00AA\" => { wx: 556, boundingbox: [166, 436, 514, 666] }, \"\\u00AB\" => { wx: 500, boundingbox: [53, 37, 445, 403] }, \"\\u00AC\" => { wx: 333, boundingbox: [51, 37, 281, 403] }, \"\\u00AD\" => { wx: 333, boundingbox: [52, 37, 282, 403] }, \"\\u00AE\" => { wx: 500, boundingbox: [-141, -207, 481, 681] }, \"\\u00AF\" => { wx: 500, boundingbox: [-141, -204, 518, 682] }, \"\\u00B1\" => { wx: 500, boundingbox: [-6, 197, 505, 243] }, \"\\u00B2\" => { wx: 500, boundingbox: [101, -159, 488, 666] }, \"\\u00B3\" => { wx: 500, boundingbox: [22, -143, 491, 666] }, \"\\u00B4\" => { wx: 250, boundingbox: [70, 199, 181, 310] }, \"\\u00B6\" => { wx: 523, boundingbox: [55, -123, 616, 653] }, \"\\u00B7\" => { wx: 350, boundingbox: [40, 191, 310, 461] }, \"\\u00B8\" => { wx: 333, boundingbox: [44, -129, 183, 101] }, \"\\u00B9\" => { wx: 556, boundingbox: [57, -129, 405, 101] }, \"\\u00BA\" => { wx: 556, boundingbox: [151, 436, 499, 666] }, \"\\u00BB\" => { wx: 500, boundingbox: [55, 37, 447, 403] }, \"\\u00BC\" => { wx: 889, boundingbox: [57, -11, 762, 100] }, \"\\u00BD\" => { wx: 1000, boundingbox: [25, -19, 1010, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [28, -205, 368, 471] }, \"\\u00C1\" => { wx: 333, boundingbox: [121, 492, 311, 664] }, \"\\u00C2\" => { wx: 333, boundingbox: [180, 494, 403, 664] }, \"\\u00C3\" => { wx: 333, boundingbox: [91, 492, 385, 661] }, \"\\u00C4\" => { wx: 333, boundingbox: [100, 517, 427, 624] }, \"\\u00C5\" => { wx: 333, boundingbox: [99, 532, 411, 583] }, \"\\u00C6\" => { wx: 333, boundingbox: [117, 492, 418, 650] }, \"\\u00C7\" => { wx: 333, boundingbox: [207, 548, 305, 646] }, \"\\u00C8\" => { wx: 333, boundingbox: [107, 548, 405, 646] }, \"\\u00CA\" => { wx: 333, boundingbox: [155, 492, 355, 691] }, \"\\u00CB\" => { wx: 333, boundingbox: [-30, -217, 182, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [93, 494, 486, 664] }, \"\\u00CE\" => { wx: 333, boundingbox: [20, -169, 203, 40] }, \"\\u00CF\" => { wx: 333, boundingbox: [121, 492, 426, 661] }, \"\\u00D0\" => { wx: 889, boundingbox: [-6, 197, 894, 243] }, \"\\u00E1\" => { wx: 889, boundingbox: [-27, 0, 911, 653] }, \"\\u00E3\" => { wx: 276, boundingbox: [42, 406, 352, 676] }, \"\\u00E8\" => { wx: 556, boundingbox: [-8, 0, 559, 653] }, \"\\u00E9\" => { wx: 722, boundingbox: [60, -105, 699, 722] }, \"\\u00EA\" => { wx: 944, boundingbox: [49, -8, 964, 666] }, \"\\u00EB\" => { wx: 310, boundingbox: [67, 406, 362, 676] }, \"\\u00F1\" => { wx: 667, boundingbox: [23, -11, 640, 441] }, \"\\u00F5\" => { wx: 278, boundingbox: [49, -11, 235, 441] }, \"\\u00F8\" => { wx: 278, boundingbox: [41, -11, 312, 683] }, \"\\u00F9\" => { wx: 500, boundingbox: [28, -135, 469, 554] }, \"\\u00FA\" => { wx: 667, boundingbox: [20, -12, 646, 441] }, \"\\u00FB\" => { wx: 500, boundingbox: [-168, -207, 493, 679] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n times_bolditalic_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 389, boundingbox: [67, -13, 370, 684] }, '\"' => { wx: 555, boundingbox: [136, 398, 536, 685] }, '#' => { wx: 500, boundingbox: [-33, 0, 533, 700] }, '$' => { wx: 500, boundingbox: [-20, -100, 497, 733] }, '%' => { wx: 833, boundingbox: [39, -10, 793, 692] }, '&' => { wx: 778, boundingbox: [5, -19, 699, 682] }, \"'\" => { wx: 333, boundingbox: [98, 369, 302, 685] }, '(' => { wx: 333, boundingbox: [28, -179, 344, 685] }, ')' => { wx: 333, boundingbox: [-44, -179, 271, 685] }, '*' => { wx: 500, boundingbox: [65, 249, 456, 685] }, '+' => { wx: 570, boundingbox: [33, 0, 537, 506] }, ',' => { wx: 250, boundingbox: [-60, -182, 144, 134] }, '-' => { wx: 333, boundingbox: [2, 166, 271, 282] }, '.' => { wx: 250, boundingbox: [-9, -13, 139, 135] }, '/' => { wx: 278, boundingbox: [-64, -18, 342, 685] }, '0' => { wx: 500, boundingbox: [17, -14, 477, 683] }, '1' => { wx: 500, boundingbox: [5, 0, 419, 683] }, '2' => { wx: 500, boundingbox: [-27, 0, 446, 683] }, '3' => { wx: 500, boundingbox: [-15, -13, 450, 683] }, '4' => { wx: 500, boundingbox: [-15, 0, 503, 683] }, '5' => { wx: 500, boundingbox: [-11, -13, 487, 669] }, '6' => { wx: 500, boundingbox: [23, -15, 509, 679] }, '7' => { wx: 500, boundingbox: [52, 0, 525, 669] }, '8' => { wx: 500, boundingbox: [3, -13, 476, 683] }, '9' => { wx: 500, boundingbox: [-12, -10, 475, 683] }, ':' => { wx: 333, boundingbox: [23, -13, 264, 459] }, ';' => { wx: 333, boundingbox: [-25, -183, 264, 459] }, '<' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '=' => { wx: 570, boundingbox: [33, 107, 537, 399] }, '>' => { wx: 570, boundingbox: [31, -8, 539, 514] }, '?' => { wx: 500, boundingbox: [79, -13, 470, 684] }, '@' => { wx: 832, boundingbox: [63, -18, 770, 685] }, 'A' => { wx: 667, boundingbox: [-67, 0, 593, 683] }, 'B' => { wx: 667, boundingbox: [-24, 0, 624, 669] }, 'C' => { wx: 667, boundingbox: [32, -18, 677, 685] }, 'D' => { wx: 722, boundingbox: [-46, 0, 685, 669] }, 'E' => { wx: 667, boundingbox: [-27, 0, 653, 669] }, 'F' => { wx: 667, boundingbox: [-13, 0, 660, 669] }, 'G' => { wx: 722, boundingbox: [21, -18, 706, 685] }, 'H' => { wx: 778, boundingbox: [-24, 0, 799, 669] }, 'I' => { wx: 389, boundingbox: [-32, 0, 406, 669] }, 'J' => { wx: 500, boundingbox: [-46, -99, 524, 669] }, 'K' => { wx: 667, boundingbox: [-21, 0, 702, 669] }, 'L' => { wx: 611, boundingbox: [-22, 0, 590, 669] }, 'M' => { wx: 889, boundingbox: [-29, -12, 917, 669] }, 'N' => { wx: 722, boundingbox: [-27, -15, 748, 669] }, 'O' => { wx: 722, boundingbox: [27, -18, 691, 685] }, 'P' => { wx: 611, boundingbox: [-27, 0, 613, 669] }, 'Q' => { wx: 722, boundingbox: [27, -208, 691, 685] }, 'R' => { wx: 667, boundingbox: [-29, 0, 623, 669] }, 'S' => { wx: 556, boundingbox: [2, -18, 526, 685] }, 'T' => { wx: 611, boundingbox: [50, 0, 650, 669] }, 'U' => { wx: 722, boundingbox: [67, -18, 744, 669] }, 'V' => { wx: 667, boundingbox: [65, -18, 715, 669] }, 'W' => { wx: 889, boundingbox: [65, -18, 940, 669] }, 'X' => { wx: 667, boundingbox: [-24, 0, 694, 669] }, 'Y' => { wx: 611, boundingbox: [73, 0, 659, 669] }, 'Z' => { wx: 611, boundingbox: [-11, 0, 590, 669] }, '[' => { wx: 333, boundingbox: [-37, -159, 362, 674] }, '\\\\' => { wx: 278, boundingbox: [-1, -18, 279, 685] }, ']' => { wx: 333, boundingbox: [-56, -157, 343, 674] }, '^' => { wx: 570, boundingbox: [67, 304, 503, 669] }, '_' => { wx: 500, boundingbox: [0, -125, 500, -75] }, '`' => { wx: 333, boundingbox: [128, 369, 332, 685] }, 'a' => { wx: 500, boundingbox: [-21, -14, 455, 462] }, 'b' => { wx: 500, boundingbox: [-14, -13, 444, 699] }, 'c' => { wx: 444, boundingbox: [-5, -13, 392, 462] }, 'd' => { wx: 500, boundingbox: [-21, -13, 517, 699] }, 'e' => { wx: 444, boundingbox: [5, -13, 398, 462] }, 'f' => { wx: 333, boundingbox: [-169, -205, 446, 698] }, 'g' => { wx: 500, boundingbox: [-52, -203, 478, 462] }, 'h' => { wx: 556, boundingbox: [-13, -9, 498, 699] }, 'i' => { wx: 278, boundingbox: [2, -9, 263, 684] }, 'j' => { wx: 278, boundingbox: [-189, -207, 279, 684] }, 'k' => { wx: 500, boundingbox: [-23, -8, 483, 699] }, 'l' => { wx: 278, boundingbox: [2, -9, 290, 699] }, 'm' => { wx: 778, boundingbox: [-14, -9, 722, 462] }, 'n' => { wx: 556, boundingbox: [-6, -9, 493, 462] }, 'o' => { wx: 500, boundingbox: [-3, -13, 441, 462] }, 'p' => { wx: 500, boundingbox: [-120, -205, 446, 462] }, 'q' => { wx: 500, boundingbox: [1, -205, 471, 462] }, 'r' => { wx: 389, boundingbox: [-21, 0, 389, 462] }, 's' => { wx: 389, boundingbox: [-19, -13, 333, 462] }, 't' => { wx: 278, boundingbox: [-11, -9, 281, 594] }, 'u' => { wx: 556, boundingbox: [15, -9, 492, 462] }, 'v' => { wx: 444, boundingbox: [16, -13, 401, 462] }, 'w' => { wx: 667, boundingbox: [16, -13, 614, 462] }, 'x' => { wx: 500, boundingbox: [-46, -13, 469, 462] }, 'y' => { wx: 444, boundingbox: [-94, -205, 392, 462] }, 'z' => { wx: 389, boundingbox: [-43, -78, 368, 449] }, '{' => { wx: 348, boundingbox: [5, -187, 436, 686] }, '|' => { wx: 220, boundingbox: [66, -218, 154, 782] }, '}' => { wx: 348, boundingbox: [-129, -187, 302, 686] }, '~' => { wx: 570, boundingbox: [54, 173, 516, 333] }, \"\\u00A1\" => { wx: 389, boundingbox: [19, -205, 322, 492] }, \"\\u00A2\" => { wx: 500, boundingbox: [42, -143, 439, 576] }, \"\\u00A3\" => { wx: 500, boundingbox: [-32, -12, 510, 683] }, \"\\u00A4\" => { wx: 167, boundingbox: [-169, -14, 324, 683] }, \"\\u00A5\" => { wx: 500, boundingbox: [33, 0, 628, 669] }, \"\\u00A6\" => { wx: 500, boundingbox: [-87, -156, 537, 707] }, \"\\u00A7\" => { wx: 500, boundingbox: [36, -143, 459, 685] }, \"\\u00A8\" => { wx: 500, boundingbox: [-26, 34, 526, 586] }, \"\\u00A9\" => { wx: 278, boundingbox: [128, 398, 268, 685] }, \"\\u00AA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00AB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00AC\" => { wx: 333, boundingbox: [32, 32, 303, 415] }, \"\\u00AD\" => { wx: 333, boundingbox: [10, 32, 281, 415] }, \"\\u00AE\" => { wx: 556, boundingbox: [-188, -205, 514, 703] }, \"\\u00AF\" => { wx: 556, boundingbox: [-186, -205, 553, 704] }, \"\\u00B1\" => { wx: 500, boundingbox: [-40, 178, 477, 269] }, \"\\u00B2\" => { wx: 500, boundingbox: [91, -145, 494, 685] }, \"\\u00B3\" => { wx: 500, boundingbox: [10, -139, 493, 685] }, \"\\u00B4\" => { wx: 250, boundingbox: [51, 257, 199, 405] }, \"\\u00B6\" => { wx: 500, boundingbox: [-57, -193, 562, 669] }, \"\\u00B7\" => { wx: 350, boundingbox: [0, 175, 350, 525] }, \"\\u00B8\" => { wx: 333, boundingbox: [-5, -182, 199, 134] }, \"\\u00B9\" => { wx: 500, boundingbox: [-57, -182, 403, 134] }, \"\\u00BA\" => { wx: 500, boundingbox: [53, 369, 513, 685] }, \"\\u00BB\" => { wx: 500, boundingbox: [12, 32, 468, 415] }, \"\\u00BC\" => { wx: 1000, boundingbox: [40, -13, 852, 135] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -29, 996, 706] }, \"\\u00BF\" => { wx: 500, boundingbox: [30, -205, 421, 492] }, \"\\u00C1\" => { wx: 333, boundingbox: [85, 516, 297, 697] }, \"\\u00C2\" => { wx: 333, boundingbox: [139, 516, 379, 697] }, \"\\u00C3\" => { wx: 333, boundingbox: [40, 516, 367, 690] }, \"\\u00C4\" => { wx: 333, boundingbox: [48, 536, 407, 655] }, \"\\u00C5\" => { wx: 333, boundingbox: [51, 553, 393, 623] }, \"\\u00C6\" => { wx: 333, boundingbox: [71, 516, 387, 678] }, \"\\u00C7\" => { wx: 333, boundingbox: [163, 550, 298, 684] }, \"\\u00C8\" => { wx: 333, boundingbox: [55, 550, 402, 684] }, \"\\u00CA\" => { wx: 333, boundingbox: [127, 516, 340, 729] }, \"\\u00CB\" => { wx: 333, boundingbox: [-80, -218, 156, 5] }, \"\\u00CD\" => { wx: 333, boundingbox: [69, 516, 498, 697] }, \"\\u00CE\" => { wx: 333, boundingbox: [15, -183, 244, 34] }, \"\\u00CF\" => { wx: 333, boundingbox: [79, 516, 411, 690] }, \"\\u00D0\" => { wx: 1000, boundingbox: [-40, 178, 977, 269] }, \"\\u00E1\" => { wx: 944, boundingbox: [-64, 0, 918, 669] }, \"\\u00E3\" => { wx: 266, boundingbox: [16, 399, 330, 685] }, \"\\u00E8\" => { wx: 611, boundingbox: [-22, 0, 590, 669] }, \"\\u00E9\" => { wx: 722, boundingbox: [27, -125, 691, 764] }, \"\\u00EA\" => { wx: 944, boundingbox: [23, -8, 946, 677] }, \"\\u00EB\" => { wx: 300, boundingbox: [56, 400, 347, 685] }, \"\\u00F1\" => { wx: 722, boundingbox: [-5, -13, 673, 462] }, \"\\u00F5\" => { wx: 278, boundingbox: [2, -9, 238, 462] }, \"\\u00F8\" => { wx: 278, boundingbox: [-7, -9, 307, 699] }, \"\\u00F9\" => { wx: 500, boundingbox: [-3, -119, 441, 560] }, \"\\u00FA\" => { wx: 722, boundingbox: [6, -13, 674, 462] }, \"\\u00FB\" => { wx: 500, boundingbox: [-200, -200, 473, 705] }, \"\\xFF\" => { wx: 500, boundingbox: [0, 0, 0, 0] } }\n helvetica_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 187, 718] }, '\"' => { wx: 355, boundingbox: [70, 463, 285, 718] }, '#' => { wx: 556, boundingbox: [28, 0, 529, 688] }, '$' => { wx: 556, boundingbox: [32, -115, 520, 775] }, '%' => { wx: 889, boundingbox: [39, -19, 850, 703] }, '&' => { wx: 667, boundingbox: [44, -15, 645, 718] }, \"'\" => { wx: 222, boundingbox: [53, 463, 157, 718] }, '(' => { wx: 333, boundingbox: [68, -207, 299, 733] }, ')' => { wx: 333, boundingbox: [34, -207, 265, 733] }, '*' => { wx: 389, boundingbox: [39, 431, 349, 718] }, '+' => { wx: 584, boundingbox: [39, 0, 545, 505] }, ',' => { wx: 278, boundingbox: [87, -147, 191, 106] }, '-' => { wx: 333, boundingbox: [44, 232, 289, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 191, 106] }, '/' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, '0' => { wx: 556, boundingbox: [37, -19, 519, 703] }, '1' => { wx: 556, boundingbox: [101, 0, 359, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 507, 703] }, '3' => { wx: 556, boundingbox: [34, -19, 522, 703] }, '4' => { wx: 556, boundingbox: [25, 0, 523, 703] }, '5' => { wx: 556, boundingbox: [32, -19, 514, 688] }, '6' => { wx: 556, boundingbox: [38, -19, 518, 703] }, '7' => { wx: 556, boundingbox: [37, 0, 523, 688] }, '8' => { wx: 556, boundingbox: [38, -19, 517, 703] }, '9' => { wx: 556, boundingbox: [42, -19, 514, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 191, 516] }, ';' => { wx: 278, boundingbox: [87, -147, 191, 516] }, '<' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '=' => { wx: 584, boundingbox: [39, 115, 545, 390] }, '>' => { wx: 584, boundingbox: [48, 11, 536, 495] }, '?' => { wx: 556, boundingbox: [56, 0, 492, 727] }, '@' => { wx: 1015, boundingbox: [147, -19, 868, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 627, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 681, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 674, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 616, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 583, 718] }, 'G' => { wx: 778, boundingbox: [48, -19, 704, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 646, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 188, 718] }, 'J' => { wx: 500, boundingbox: [17, -19, 428, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 663, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 537, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 761, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 646, 718] }, 'O' => { wx: 778, boundingbox: [39, -19, 739, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 622, 718] }, 'Q' => { wx: 778, boundingbox: [39, -56, 739, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 684, 718] }, 'S' => { wx: 667, boundingbox: [49, -19, 620, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 597, 718] }, 'U' => { wx: 722, boundingbox: [79, -19, 644, 718] }, 'V' => { wx: 667, boundingbox: [20, 0, 647, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 928, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'Y' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 588, 718] }, '[' => { wx: 278, boundingbox: [63, -196, 250, 722] }, '\\\\' => { wx: 278, boundingbox: [-17, -19, 295, 737] }, ']' => { wx: 278, boundingbox: [28, -196, 215, 722] }, '^' => { wx: 469, boundingbox: [-14, 264, 483, 688] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 222, boundingbox: [65, 470, 169, 725] }, 'a' => { wx: 556, boundingbox: [36, -15, 530, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 517, 718] }, 'c' => { wx: 500, boundingbox: [30, -15, 477, 538] }, 'd' => { wx: 556, boundingbox: [35, -15, 499, 718] }, 'e' => { wx: 556, boundingbox: [40, -15, 516, 538] }, 'f' => { wx: 278, boundingbox: [14, 0, 262, 728] }, 'g' => { wx: 556, boundingbox: [40, -220, 499, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 491, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'j' => { wx: 222, boundingbox: [-16, -210, 155, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 501, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 155, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 769, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 491, 538] }, 'o' => { wx: 556, boundingbox: [35, -14, 521, 538] }, 'p' => { wx: 556, boundingbox: [58, -207, 517, 538] }, 'q' => { wx: 556, boundingbox: [35, -207, 494, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 332, 538] }, 's' => { wx: 500, boundingbox: [32, -15, 464, 538] }, 't' => { wx: 278, boundingbox: [14, -7, 257, 669] }, 'u' => { wx: 556, boundingbox: [68, -15, 489, 523] }, 'v' => { wx: 500, boundingbox: [8, 0, 492, 523] }, 'w' => { wx: 722, boundingbox: [14, 0, 709, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 490, 523] }, 'y' => { wx: 500, boundingbox: [11, -214, 489, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 469, 523] }, '{' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '|' => { wx: 260, boundingbox: [94, -225, 167, 775] }, '}' => { wx: 334, boundingbox: [42, -196, 292, 722] }, '~' => { wx: 584, boundingbox: [61, 180, 523, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [118, -195, 215, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [51, -115, 513, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [33, -16, 539, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-166, -19, 333, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [3, 0, 553, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-11, -207, 501, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [43, -191, 512, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [28, 99, 528, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [59, 463, 132, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [38, 470, 307, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [88, 108, 245, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [14, 0, 434, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [14, 0, 432, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 240, 556, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [43, -159, 514, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [77, 190, 202, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [18, -173, 497, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [18, 202, 333, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [53, -149, 157, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [26, -149, 295, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [26, 463, 295, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [97, 108, 459, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 885, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [7, -19, 994, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [91, -201, 527, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [14, 593, 211, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [122, 593, 319, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [-4, 606, 337, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [10, 627, 323, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [13, 595, 321, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [121, 604, 212, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [40, 604, 293, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [75, 572, 259, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [45, -225, 259, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [31, 593, 409, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [73, -225, 287, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [21, 593, 312, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 240, 1000, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 951, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [24, 405, 346, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [-20, 0, 537, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [39, -19, 740, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [36, -19, 965, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [25, 405, 341, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [36, -15, 847, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 183, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [-20, 0, 242, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [28, -22, 537, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [35, -15, 902, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 571, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_bold_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [90, 0, 244, 718] }, '\"' => { wx: 474, boundingbox: [98, 447, 376, 718] }, '#' => { wx: 556, boundingbox: [18, 0, 538, 698] }, '$' => { wx: 556, boundingbox: [30, -115, 523, 775] }, '%' => { wx: 889, boundingbox: [28, -19, 861, 710] }, '&' => { wx: 722, boundingbox: [54, -19, 701, 718] }, \"'\" => { wx: 278, boundingbox: [69, 445, 209, 718] }, '(' => { wx: 333, boundingbox: [35, -208, 314, 734] }, ')' => { wx: 333, boundingbox: [19, -208, 298, 734] }, '*' => { wx: 389, boundingbox: [27, 387, 362, 718] }, '+' => { wx: 584, boundingbox: [40, 0, 544, 506] }, ',' => { wx: 278, boundingbox: [64, -168, 214, 146] }, '-' => { wx: 333, boundingbox: [27, 215, 306, 345] }, '.' => { wx: 278, boundingbox: [64, 0, 214, 146] }, '/' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, '0' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '1' => { wx: 556, boundingbox: [69, 0, 378, 710] }, '2' => { wx: 556, boundingbox: [26, 0, 511, 710] }, '3' => { wx: 556, boundingbox: [27, -19, 516, 710] }, '4' => { wx: 556, boundingbox: [27, 0, 526, 710] }, '5' => { wx: 556, boundingbox: [27, -19, 516, 698] }, '6' => { wx: 556, boundingbox: [31, -19, 520, 710] }, '7' => { wx: 556, boundingbox: [25, 0, 528, 698] }, '8' => { wx: 556, boundingbox: [32, -19, 524, 710] }, '9' => { wx: 556, boundingbox: [30, -19, 522, 710] }, ':' => { wx: 333, boundingbox: [92, 0, 242, 512] }, ';' => { wx: 333, boundingbox: [92, -168, 242, 512] }, '<' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '=' => { wx: 584, boundingbox: [40, 87, 544, 419] }, '>' => { wx: 584, boundingbox: [38, -8, 546, 514] }, '?' => { wx: 611, boundingbox: [60, 0, 556, 727] }, '@' => { wx: 975, boundingbox: [118, -19, 856, 737] }, 'A' => { wx: 722, boundingbox: [20, 0, 702, 718] }, 'B' => { wx: 722, boundingbox: [76, 0, 669, 718] }, 'C' => { wx: 722, boundingbox: [44, -19, 684, 737] }, 'D' => { wx: 722, boundingbox: [76, 0, 685, 718] }, 'E' => { wx: 667, boundingbox: [76, 0, 621, 718] }, 'F' => { wx: 611, boundingbox: [76, 0, 587, 718] }, 'G' => { wx: 778, boundingbox: [44, -19, 713, 737] }, 'H' => { wx: 722, boundingbox: [71, 0, 651, 718] }, 'I' => { wx: 278, boundingbox: [64, 0, 214, 718] }, 'J' => { wx: 556, boundingbox: [22, -18, 484, 718] }, 'K' => { wx: 722, boundingbox: [87, 0, 722, 718] }, 'L' => { wx: 611, boundingbox: [76, 0, 583, 718] }, 'M' => { wx: 833, boundingbox: [69, 0, 765, 718] }, 'N' => { wx: 722, boundingbox: [69, 0, 654, 718] }, 'O' => { wx: 778, boundingbox: [44, -19, 734, 737] }, 'P' => { wx: 667, boundingbox: [76, 0, 627, 718] }, 'Q' => { wx: 778, boundingbox: [44, -52, 737, 737] }, 'R' => { wx: 722, boundingbox: [76, 0, 677, 718] }, 'S' => { wx: 667, boundingbox: [39, -19, 629, 737] }, 'T' => { wx: 611, boundingbox: [14, 0, 598, 718] }, 'U' => { wx: 722, boundingbox: [72, -19, 651, 718] }, 'V' => { wx: 667, boundingbox: [19, 0, 648, 718] }, 'W' => { wx: 944, boundingbox: [16, 0, 929, 718] }, 'X' => { wx: 667, boundingbox: [14, 0, 653, 718] }, 'Y' => { wx: 667, boundingbox: [15, 0, 653, 718] }, 'Z' => { wx: 611, boundingbox: [25, 0, 586, 718] }, '[' => { wx: 333, boundingbox: [63, -196, 309, 722] }, '\\\\' => { wx: 278, boundingbox: [-33, -19, 311, 737] }, ']' => { wx: 333, boundingbox: [24, -196, 270, 722] }, '^' => { wx: 584, boundingbox: [62, 323, 522, 698] }, '_' => { wx: 556, boundingbox: [0, -125, 556, -75] }, '`' => { wx: 278, boundingbox: [69, 454, 209, 727] }, 'a' => { wx: 556, boundingbox: [29, -14, 527, 546] }, 'b' => { wx: 611, boundingbox: [61, -14, 578, 718] }, 'c' => { wx: 556, boundingbox: [34, -14, 524, 546] }, 'd' => { wx: 611, boundingbox: [34, -14, 551, 718] }, 'e' => { wx: 556, boundingbox: [23, -14, 528, 546] }, 'f' => { wx: 333, boundingbox: [10, 0, 318, 727] }, 'g' => { wx: 611, boundingbox: [40, -217, 553, 546] }, 'h' => { wx: 611, boundingbox: [65, 0, 546, 718] }, 'i' => { wx: 278, boundingbox: [69, 0, 209, 725] }, 'j' => { wx: 278, boundingbox: [3, -214, 209, 725] }, 'k' => { wx: 556, boundingbox: [69, 0, 562, 718] }, 'l' => { wx: 278, boundingbox: [69, 0, 209, 718] }, 'm' => { wx: 889, boundingbox: [64, 0, 826, 546] }, 'n' => { wx: 611, boundingbox: [65, 0, 546, 546] }, 'o' => { wx: 611, boundingbox: [34, -14, 578, 546] }, 'p' => { wx: 611, boundingbox: [62, -207, 578, 546] }, 'q' => { wx: 611, boundingbox: [34, -207, 552, 546] }, 'r' => { wx: 389, boundingbox: [64, 0, 373, 546] }, 's' => { wx: 556, boundingbox: [30, -14, 519, 546] }, 't' => { wx: 333, boundingbox: [10, -6, 309, 676] }, 'u' => { wx: 611, boundingbox: [66, -14, 545, 532] }, 'v' => { wx: 556, boundingbox: [13, 0, 543, 532] }, 'w' => { wx: 778, boundingbox: [10, 0, 769, 532] }, 'x' => { wx: 556, boundingbox: [15, 0, 541, 532] }, 'y' => { wx: 556, boundingbox: [10, -214, 539, 532] }, 'z' => { wx: 500, boundingbox: [20, 0, 480, 532] }, '{' => { wx: 389, boundingbox: [48, -196, 365, 722] }, '|' => { wx: 280, boundingbox: [84, -225, 196, 775] }, '}' => { wx: 389, boundingbox: [24, -196, 341, 722] }, '~' => { wx: 584, boundingbox: [61, 163, 523, 343] }, \"\\u00A1\" => { wx: 333, boundingbox: [90, -186, 244, 532] }, \"\\u00A2\" => { wx: 556, boundingbox: [34, -118, 524, 628] }, \"\\u00A3\" => { wx: 556, boundingbox: [28, -16, 541, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 336, 710] }, \"\\u00A5\" => { wx: 556, boundingbox: [-9, 0, 565, 698] }, \"\\u00A6\" => { wx: 556, boundingbox: [-10, -210, 516, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [34, -184, 522, 727] }, \"\\u00A8\" => { wx: 556, boundingbox: [-3, 76, 559, 636] }, \"\\u00A9\" => { wx: 238, boundingbox: [70, 447, 168, 718] }, \"\\u00AA\" => { wx: 500, boundingbox: [64, 454, 436, 727] }, \"\\u00AB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00AC\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AD\" => { wx: 333, boundingbox: [83, 76, 250, 484] }, \"\\u00AE\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00AF\" => { wx: 611, boundingbox: [10, 0, 542, 727] }, \"\\u00B1\" => { wx: 556, boundingbox: [0, 227, 556, 333] }, \"\\u00B2\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [36, -171, 520, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [58, 172, 220, 334] }, \"\\u00B6\" => { wx: 556, boundingbox: [-8, -191, 539, 700] }, \"\\u00B7\" => { wx: 350, boundingbox: [10, 194, 340, 524] }, \"\\u00B8\" => { wx: 278, boundingbox: [69, -146, 209, 127] }, \"\\u00B9\" => { wx: 500, boundingbox: [64, -146, 436, 127] }, \"\\u00BA\" => { wx: 500, boundingbox: [64, 445, 436, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [88, 76, 468, 484] }, \"\\u00BC\" => { wx: 1000, boundingbox: [92, 0, 908, 146] }, \"\\u00BD\" => { wx: 1000, boundingbox: [-3, -19, 1003, 710] }, \"\\u00BF\" => { wx: 611, boundingbox: [55, -195, 551, 532] }, \"\\u00C1\" => { wx: 333, boundingbox: [-23, 604, 225, 750] }, \"\\u00C2\" => { wx: 333, boundingbox: [108, 604, 356, 750] }, \"\\u00C3\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00C4\" => { wx: 333, boundingbox: [-17, 610, 350, 737] }, \"\\u00C5\" => { wx: 333, boundingbox: [-6, 604, 339, 678] }, \"\\u00C6\" => { wx: 333, boundingbox: [-2, 604, 335, 750] }, \"\\u00C7\" => { wx: 333, boundingbox: [104, 614, 230, 729] }, \"\\u00C8\" => { wx: 333, boundingbox: [6, 614, 327, 729] }, \"\\u00CA\" => { wx: 333, boundingbox: [59, 568, 275, 776] }, \"\\u00CB\" => { wx: 333, boundingbox: [6, -228, 245, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [9, 604, 486, 750] }, \"\\u00CE\" => { wx: 333, boundingbox: [71, -228, 304, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [-10, 604, 343, 750] }, \"\\u00D0\" => { wx: 1000, boundingbox: [0, 227, 1000, 333] }, \"\\u00E1\" => { wx: 1000, boundingbox: [5, 0, 954, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [22, 401, 347, 737] }, \"\\u00E8\" => { wx: 611, boundingbox: [-20, 0, 583, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [33, -27, 744, 745] }, \"\\u00EA\" => { wx: 1000, boundingbox: [37, -19, 961, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [6, 401, 360, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [29, -14, 858, 546] }, \"\\u00F5\" => { wx: 278, boundingbox: [69, 0, 209, 532] }, \"\\u00F8\" => { wx: 278, boundingbox: [-18, 0, 296, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [22, -29, 589, 560] }, \"\\u00FA\" => { wx: 944, boundingbox: [34, -14, 912, 546] }, \"\\u00FB\" => { wx: 611, boundingbox: [69, -14, 579, 731] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n helvetica_oblique_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 278, boundingbox: [90, 0, 340, 718] }, '\"' => { wx: 355, boundingbox: [168, 463, 438, 718] }, '#' => { wx: 556, boundingbox: [73, 0, 631, 688] }, '$' => { wx: 556, boundingbox: [69, -115, 617, 775] }, '%' => { wx: 889, boundingbox: [147, -19, 889, 703] }, '&' => { wx: 667, boundingbox: [77, -15, 647, 718] }, \"'\" => { wx: 222, boundingbox: [151, 463, 310, 718] }, '(' => { wx: 333, boundingbox: [108, -207, 454, 733] }, ')' => { wx: 333, boundingbox: [-9, -207, 337, 733] }, '*' => { wx: 389, boundingbox: [165, 431, 475, 718] }, '+' => { wx: 584, boundingbox: [85, 0, 606, 505] }, ',' => { wx: 278, boundingbox: [56, -147, 214, 106] }, '-' => { wx: 333, boundingbox: [93, 232, 357, 322] }, '.' => { wx: 278, boundingbox: [87, 0, 214, 106] }, '/' => { wx: 278, boundingbox: [-21, -19, 452, 737] }, '0' => { wx: 556, boundingbox: [93, -19, 608, 703] }, '1' => { wx: 556, boundingbox: [207, 0, 508, 703] }, '2' => { wx: 556, boundingbox: [26, 0, 617, 703] }, '3' => { wx: 556, boundingbox: [75, -19, 610, 703] }, '4' => { wx: 556, boundingbox: [61, 0, 576, 703] }, '5' => { wx: 556, boundingbox: [68, -19, 621, 688] }, '6' => { wx: 556, boundingbox: [91, -19, 615, 703] }, '7' => { wx: 556, boundingbox: [137, 0, 669, 688] }, '8' => { wx: 556, boundingbox: [74, -19, 607, 703] }, '9' => { wx: 556, boundingbox: [82, -19, 609, 703] }, ':' => { wx: 278, boundingbox: [87, 0, 301, 516] }, ';' => { wx: 278, boundingbox: [56, -147, 301, 516] }, '<' => { wx: 584, boundingbox: [94, 11, 641, 495] }, '=' => { wx: 584, boundingbox: [63, 115, 628, 390] }, '>' => { wx: 584, boundingbox: [50, 11, 597, 495] }, '?' => { wx: 556, boundingbox: [161, 0, 610, 727] }, '@' => { wx: 1015, boundingbox: [215, -19, 965, 737] }, 'A' => { wx: 667, boundingbox: [14, 0, 654, 718] }, 'B' => { wx: 667, boundingbox: [74, 0, 712, 718] }, 'C' => { wx: 722, boundingbox: [108, -19, 782, 737] }, 'D' => { wx: 722, boundingbox: [81, 0, 764, 718] }, 'E' => { wx: 667, boundingbox: [86, 0, 762, 718] }, 'F' => { wx: 611, boundingbox: [86, 0, 736, 718] }, 'G' => { wx: 778, boundingbox: [111, -19, 799, 737] }, 'H' => { wx: 722, boundingbox: [77, 0, 799, 718] }, 'I' => { wx: 278, boundingbox: [91, 0, 341, 718] }, 'J' => { wx: 500, boundingbox: [47, -19, 581, 718] }, 'K' => { wx: 667, boundingbox: [76, 0, 808, 718] }, 'L' => { wx: 556, boundingbox: [76, 0, 555, 718] }, 'M' => { wx: 833, boundingbox: [73, 0, 914, 718] }, 'N' => { wx: 722, boundingbox: [76, 0, 799, 718] }, 'O' => { wx: 778, boundingbox: [105, -19, 826, 737] }, 'P' => { wx: 667, boundingbox: [86, 0, 737, 718] }, 'Q' => { wx: 778, boundingbox: [105, -56, 826, 737] }, 'R' => { wx: 722, boundingbox: [88, 0, 773, 718] }, 'S' => { wx: 667, boundingbox: [90, -19, 713, 737] }, 'T' => { wx: 611, boundingbox: [148, 0, 750, 718] }, 'U' => { wx: 722, boundingbox: [123, -19, 797, 718] }, 'V' => { wx: 667, boundingbox: [173, 0, 800, 718] }, 'W' => { wx: 944, boundingbox: [169, 0, 1081, 718] }, 'X' => { wx: 667, boundingbox: [19, 0, 790, 718] }, 'Y' => { wx: 667, boundingbox: [167, 0, 806, 718] }, 'Z' => { wx: 611, boundingbox: [23, 0, 741, 718] }, '[' => { wx: 278, boundingbox: [21, -196, 403, 722] }, '\\\\' => { wx: 278, boundingbox: [140, -19, 291, 737] }, ']' => { wx: 278, boundingbox: [-14, -196, 368, 722] }, '^' => { wx: 469, boundingbox: [42, 264, 539, 688] }, '_' => { wx: 556, boundingbox: [-27, -125, 540, -75] }, '`' => { wx: 222, boundingbox: [165, 470, 323, 725] }, 'a' => { wx: 556, boundingbox: [61, -15, 559, 538] }, 'b' => { wx: 556, boundingbox: [58, -15, 584, 718] }, 'c' => { wx: 500, boundingbox: [74, -15, 553, 538] }, 'd' => { wx: 556, boundingbox: [84, -15, 652, 718] }, 'e' => { wx: 556, boundingbox: [84, -15, 578, 538] }, 'f' => { wx: 278, boundingbox: [86, 0, 416, 728] }, 'g' => { wx: 556, boundingbox: [42, -220, 610, 538] }, 'h' => { wx: 556, boundingbox: [65, 0, 573, 718] }, 'i' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'j' => { wx: 222, boundingbox: [-60, -210, 308, 718] }, 'k' => { wx: 500, boundingbox: [67, 0, 600, 718] }, 'l' => { wx: 222, boundingbox: [67, 0, 308, 718] }, 'm' => { wx: 833, boundingbox: [65, 0, 852, 538] }, 'n' => { wx: 556, boundingbox: [65, 0, 573, 538] }, 'o' => { wx: 556, boundingbox: [83, -14, 585, 538] }, 'p' => { wx: 556, boundingbox: [14, -207, 584, 538] }, 'q' => { wx: 556, boundingbox: [84, -207, 605, 538] }, 'r' => { wx: 333, boundingbox: [77, 0, 446, 538] }, 's' => { wx: 500, boundingbox: [63, -15, 529, 538] }, 't' => { wx: 278, boundingbox: [102, -7, 368, 669] }, 'u' => { wx: 556, boundingbox: [94, -15, 600, 523] }, 'v' => { wx: 500, boundingbox: [119, 0, 603, 523] }, 'w' => { wx: 722, boundingbox: [125, 0, 820, 523] }, 'x' => { wx: 500, boundingbox: [11, 0, 594, 523] }, 'y' => { wx: 500, boundingbox: [15, -214, 600, 523] }, 'z' => { wx: 500, boundingbox: [31, 0, 571, 523] }, '{' => { wx: 334, boundingbox: [92, -196, 445, 722] }, '|' => { wx: 260, boundingbox: [46, -225, 332, 775] }, '}' => { wx: 334, boundingbox: [0, -196, 354, 722] }, '~' => { wx: 584, boundingbox: [111, 180, 580, 326] }, \"\\u00A1\" => { wx: 333, boundingbox: [77, -195, 326, 523] }, \"\\u00A2\" => { wx: 556, boundingbox: [95, -115, 584, 623] }, \"\\u00A3\" => { wx: 556, boundingbox: [49, -16, 634, 718] }, \"\\u00A4\" => { wx: 167, boundingbox: [-170, -19, 482, 703] }, \"\\u00A5\" => { wx: 556, boundingbox: [81, 0, 699, 688] }, \"\\u00A6\" => { wx: 556, boundingbox: [-52, -207, 654, 737] }, \"\\u00A7\" => { wx: 556, boundingbox: [76, -191, 584, 737] }, \"\\u00A8\" => { wx: 556, boundingbox: [60, 99, 646, 603] }, \"\\u00A9\" => { wx: 191, boundingbox: [157, 463, 285, 718] }, \"\\u00AA\" => { wx: 333, boundingbox: [138, 470, 461, 725] }, \"\\u00AB\" => { wx: 556, boundingbox: [146, 108, 554, 446] }, \"\\u00AC\" => { wx: 333, boundingbox: [137, 108, 340, 446] }, \"\\u00AD\" => { wx: 333, boundingbox: [111, 108, 314, 446] }, \"\\u00AE\" => { wx: 500, boundingbox: [86, 0, 587, 728] }, \"\\u00AF\" => { wx: 500, boundingbox: [86, 0, 585, 728] }, \"\\u00B1\" => { wx: 556, boundingbox: [51, 240, 623, 313] }, \"\\u00B2\" => { wx: 556, boundingbox: [135, -159, 622, 718] }, \"\\u00B3\" => { wx: 556, boundingbox: [52, -159, 623, 718] }, \"\\u00B4\" => { wx: 278, boundingbox: [129, 190, 257, 315] }, \"\\u00B6\" => { wx: 537, boundingbox: [126, -173, 650, 718] }, \"\\u00B7\" => { wx: 350, boundingbox: [91, 202, 413, 517] }, \"\\u00B8\" => { wx: 222, boundingbox: [21, -149, 180, 106] }, \"\\u00B9\" => { wx: 333, boundingbox: [-6, -149, 318, 106] }, \"\\u00BA\" => { wx: 333, boundingbox: [124, 463, 448, 718] }, \"\\u00BB\" => { wx: 556, boundingbox: [120, 108, 528, 446] }, \"\\u00BC\" => { wx: 1000, boundingbox: [115, 0, 908, 106] }, \"\\u00BD\" => { wx: 1000, boundingbox: [88, -19, 1029, 703] }, \"\\u00BF\" => { wx: 611, boundingbox: [85, -201, 534, 525] }, \"\\u00C1\" => { wx: 333, boundingbox: [170, 593, 337, 734] }, \"\\u00C2\" => { wx: 333, boundingbox: [248, 593, 475, 734] }, \"\\u00C3\" => { wx: 333, boundingbox: [147, 593, 438, 734] }, \"\\u00C4\" => { wx: 333, boundingbox: [125, 606, 490, 722] }, \"\\u00C5\" => { wx: 333, boundingbox: [143, 627, 468, 684] }, \"\\u00C6\" => { wx: 333, boundingbox: [167, 595, 476, 731] }, \"\\u00C7\" => { wx: 333, boundingbox: [249, 604, 362, 706] }, \"\\u00C8\" => { wx: 333, boundingbox: [168, 604, 443, 706] }, \"\\u00CA\" => { wx: 333, boundingbox: [214, 572, 402, 756] }, \"\\u00CB\" => { wx: 333, boundingbox: [2, -225, 232, 0] }, \"\\u00CD\" => { wx: 333, boundingbox: [157, 593, 565, 734] }, \"\\u00CE\" => { wx: 333, boundingbox: [43, -225, 249, 0] }, \"\\u00CF\" => { wx: 333, boundingbox: [177, 593, 468, 734] }, \"\\u00D0\" => { wx: 1000, boundingbox: [51, 240, 1067, 313] }, \"\\u00E1\" => { wx: 1000, boundingbox: [8, 0, 1097, 718] }, \"\\u00E3\" => { wx: 370, boundingbox: [127, 405, 449, 737] }, \"\\u00E8\" => { wx: 556, boundingbox: [41, 0, 555, 718] }, \"\\u00E9\" => { wx: 778, boundingbox: [43, -19, 890, 737] }, \"\\u00EA\" => { wx: 1000, boundingbox: [98, -19, 1116, 737] }, \"\\u00EB\" => { wx: 365, boundingbox: [141, 405, 468, 737] }, \"\\u00F1\" => { wx: 889, boundingbox: [61, -15, 909, 538] }, \"\\u00F5\" => { wx: 278, boundingbox: [95, 0, 294, 523] }, \"\\u00F8\" => { wx: 222, boundingbox: [41, 0, 347, 718] }, \"\\u00F9\" => { wx: 611, boundingbox: [29, -22, 647, 545] }, \"\\u00FA\" => { wx: 944, boundingbox: [83, -15, 964, 538] }, \"\\u00FB\" => { wx: 611, boundingbox: [67, -15, 658, 728] }, \"\\xFF\" => { wx: 556, boundingbox: [0, 0, 0, 0] } }\n courier_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [236, -15, 364, 572] }, '\"' => { wx: 600, boundingbox: [187, 328, 413, 562] }, '#' => { wx: 600, boundingbox: [93, -32, 507, 639] }, '$' => { wx: 600, boundingbox: [105, -126, 496, 662] }, '%' => { wx: 600, boundingbox: [81, -15, 518, 622] }, '&' => { wx: 600, boundingbox: [63, -15, 538, 543] }, \"'\" => { wx: 600, boundingbox: [213, 328, 376, 562] }, '(' => { wx: 600, boundingbox: [269, -108, 440, 622] }, ')' => { wx: 600, boundingbox: [160, -108, 331, 622] }, '*' => { wx: 600, boundingbox: [116, 257, 484, 607] }, '+' => { wx: 600, boundingbox: [80, 44, 520, 470] }, ',' => { wx: 600, boundingbox: [181, -112, 344, 122] }, '-' => { wx: 600, boundingbox: [103, 231, 497, 285] }, '.' => { wx: 600, boundingbox: [229, -15, 371, 109] }, '/' => { wx: 600, boundingbox: [125, -80, 475, 629] }, '0' => { wx: 600, boundingbox: [106, -15, 494, 622] }, '1' => { wx: 600, boundingbox: [96, 0, 505, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 471, 622] }, '3' => { wx: 600, boundingbox: [75, -15, 466, 622] }, '4' => { wx: 600, boundingbox: [78, 0, 500, 622] }, '5' => { wx: 600, boundingbox: [92, -15, 497, 607] }, '6' => { wx: 600, boundingbox: [111, -15, 497, 622] }, '7' => { wx: 600, boundingbox: [82, 0, 483, 607] }, '8' => { wx: 600, boundingbox: [102, -15, 498, 622] }, '9' => { wx: 600, boundingbox: [96, -15, 489, 622] }, ':' => { wx: 600, boundingbox: [229, -15, 371, 385] }, ';' => { wx: 600, boundingbox: [181, -112, 371, 385] }, '<' => { wx: 600, boundingbox: [41, 42, 519, 472] }, '=' => { wx: 600, boundingbox: [80, 138, 520, 376] }, '>' => { wx: 600, boundingbox: [66, 42, 544, 472] }, '?' => { wx: 600, boundingbox: [129, -15, 492, 572] }, '@' => { wx: 600, boundingbox: [77, -15, 533, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 597, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 559, 562] }, 'C' => { wx: 600, boundingbox: [41, -18, 540, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 574, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 550, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 545, 562] }, 'G' => { wx: 600, boundingbox: [31, -18, 575, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 568, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 504, 562] }, 'J' => { wx: 600, boundingbox: [34, -18, 566, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 582, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 554, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 596, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 593, 562] }, 'O' => { wx: 600, boundingbox: [43, -18, 557, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 558, 562] }, 'Q' => { wx: 600, boundingbox: [43, -138, 557, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 588, 562] }, 'S' => { wx: 600, boundingbox: [72, -20, 529, 580] }, 'T' => { wx: 600, boundingbox: [38, 0, 563, 562] }, 'U' => { wx: 600, boundingbox: [17, -18, 583, 562] }, 'V' => { wx: 600, boundingbox: [-4, -13, 604, 562] }, 'W' => { wx: 600, boundingbox: [-3, -13, 603, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 577, 562] }, 'Y' => { wx: 600, boundingbox: [24, 0, 576, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 514, 562] }, '[' => { wx: 600, boundingbox: [269, -108, 442, 622] }, '\\\\' => { wx: 600, boundingbox: [118, -80, 482, 629] }, ']' => { wx: 600, boundingbox: [158, -108, 331, 622] }, '^' => { wx: 600, boundingbox: [94, 354, 506, 622] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [224, 328, 387, 562] }, 'a' => { wx: 600, boundingbox: [53, -15, 559, 441] }, 'b' => { wx: 600, boundingbox: [14, -15, 575, 629] }, 'c' => { wx: 600, boundingbox: [66, -15, 529, 441] }, 'd' => { wx: 600, boundingbox: [45, -15, 591, 629] }, 'e' => { wx: 600, boundingbox: [66, -15, 548, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 531, 629] }, 'g' => { wx: 600, boundingbox: [45, -157, 566, 441] }, 'h' => { wx: 600, boundingbox: [18, 0, 582, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 505, 657] }, 'j' => { wx: 600, boundingbox: [82, -157, 410, 657] }, 'k' => { wx: 600, boundingbox: [43, 0, 580, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 505, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 605, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 575, 441] }, 'o' => { wx: 600, boundingbox: [62, -15, 538, 441] }, 'p' => { wx: 600, boundingbox: [9, -157, 555, 441] }, 'q' => { wx: 600, boundingbox: [45, -157, 591, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 559, 441] }, 's' => { wx: 600, boundingbox: [80, -15, 513, 441] }, 't' => { wx: 600, boundingbox: [87, -15, 530, 561] }, 'u' => { wx: 600, boundingbox: [21, -15, 562, 426] }, 'v' => { wx: 600, boundingbox: [10, -10, 590, 426] }, 'w' => { wx: 600, boundingbox: [-4, -10, 604, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 580, 426] }, 'y' => { wx: 600, boundingbox: [7, -157, 592, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 502, 426] }, '{' => { wx: 600, boundingbox: [182, -108, 437, 622] }, '|' => { wx: 600, boundingbox: [275, -250, 326, 750] }, '}' => { wx: 600, boundingbox: [163, -108, 418, 622] }, '~' => { wx: 600, boundingbox: [63, 197, 540, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [236, -157, 364, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [96, -49, 500, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [84, -21, 521, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [92, -57, 509, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [26, 0, 574, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [4, -143, 539, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [113, -78, 488, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [73, 58, 527, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [259, 328, 341, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [143, 328, 471, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [149, 70, 451, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 597, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [75, 231, 525, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [141, -78, 459, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [222, 189, 378, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [50, -78, 511, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [172, 130, 428, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [213, -134, 376, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [143, -134, 457, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [143, 328, 457, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [37, 70, 563, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [37, -15, 563, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [3, -15, 600, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [108, -157, 471, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [151, 497, 378, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [242, 497, 469, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [124, 477, 476, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [105, 489, 503, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [120, 525, 480, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [153, 501, 447, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [249, 537, 352, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [148, 537, 453, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [218, 463, 382, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [224, -151, 362, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [133, 497, 540, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [211, -172, 407, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [124, 492, 476, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [0, 231, 600, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 550, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [156, 249, 442, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 554, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [43, -80, 557, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [7, 0, 567, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [157, 249, 443, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [19, -15, 570, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 505, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 505, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [62, -80, 538, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [19, -15, 559, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 588, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_bold_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [202, -15, 398, 572] }, '\"' => { wx: 600, boundingbox: [135, 277, 465, 562] }, '#' => { wx: 600, boundingbox: [56, -45, 544, 651] }, '$' => { wx: 600, boundingbox: [82, -126, 519, 666] }, '%' => { wx: 600, boundingbox: [5, -15, 595, 616] }, '&' => { wx: 600, boundingbox: [36, -15, 546, 543] }, \"'\" => { wx: 600, boundingbox: [171, 277, 423, 562] }, '(' => { wx: 600, boundingbox: [219, -102, 461, 616] }, ')' => { wx: 600, boundingbox: [139, -102, 381, 616] }, '*' => { wx: 600, boundingbox: [91, 219, 509, 601] }, '+' => { wx: 600, boundingbox: [71, 39, 529, 478] }, ',' => { wx: 600, boundingbox: [123, -111, 393, 174] }, '-' => { wx: 600, boundingbox: [100, 203, 500, 313] }, '.' => { wx: 600, boundingbox: [192, -15, 408, 171] }, '/' => { wx: 600, boundingbox: [98, -77, 502, 626] }, '0' => { wx: 600, boundingbox: [87, -15, 513, 616] }, '1' => { wx: 600, boundingbox: [81, 0, 539, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 499, 616] }, '3' => { wx: 600, boundingbox: [63, -15, 501, 616] }, '4' => { wx: 600, boundingbox: [53, 0, 507, 616] }, '5' => { wx: 600, boundingbox: [70, -15, 521, 601] }, '6' => { wx: 600, boundingbox: [90, -15, 521, 616] }, '7' => { wx: 600, boundingbox: [55, 0, 494, 601] }, '8' => { wx: 600, boundingbox: [83, -15, 517, 616] }, '9' => { wx: 600, boundingbox: [79, -15, 510, 616] }, ':' => { wx: 600, boundingbox: [191, -15, 407, 425] }, ';' => { wx: 600, boundingbox: [123, -111, 408, 425] }, '<' => { wx: 600, boundingbox: [66, 15, 523, 501] }, '=' => { wx: 600, boundingbox: [71, 118, 529, 398] }, '>' => { wx: 600, boundingbox: [77, 15, 534, 501] }, '?' => { wx: 600, boundingbox: [98, -14, 501, 580] }, '@' => { wx: 600, boundingbox: [16, -15, 584, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 609, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 573, 562] }, 'C' => { wx: 600, boundingbox: [22, -18, 560, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 594, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 560, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 570, 562] }, 'G' => { wx: 600, boundingbox: [22, -18, 594, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 580, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 523, 562] }, 'J' => { wx: 600, boundingbox: [37, -18, 601, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 599, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 578, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 602, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 610, 562] }, 'O' => { wx: 600, boundingbox: [22, -18, 578, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 559, 562] }, 'Q' => { wx: 600, boundingbox: [32, -138, 578, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 599, 562] }, 'S' => { wx: 600, boundingbox: [47, -22, 553, 582] }, 'T' => { wx: 600, boundingbox: [21, 0, 579, 562] }, 'U' => { wx: 600, boundingbox: [4, -18, 596, 562] }, 'V' => { wx: 600, boundingbox: [-13, 0, 613, 562] }, 'W' => { wx: 600, boundingbox: [-18, 0, 618, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 588, 562] }, 'Y' => { wx: 600, boundingbox: [12, 0, 589, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 539, 562] }, '[' => { wx: 600, boundingbox: [245, -102, 475, 616] }, '\\\\' => { wx: 600, boundingbox: [99, -77, 503, 626] }, ']' => { wx: 600, boundingbox: [125, -102, 355, 616] }, '^' => { wx: 600, boundingbox: [108, 250, 492, 616] }, '_' => { wx: 600, boundingbox: [0, -125, 600, -75] }, '`' => { wx: 600, boundingbox: [178, 277, 428, 562] }, 'a' => { wx: 600, boundingbox: [35, -15, 570, 454] }, 'b' => { wx: 600, boundingbox: [0, -15, 584, 626] }, 'c' => { wx: 600, boundingbox: [40, -15, 545, 459] }, 'd' => { wx: 600, boundingbox: [20, -15, 591, 626] }, 'e' => { wx: 600, boundingbox: [40, -15, 563, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 547, 626] }, 'g' => { wx: 600, boundingbox: [30, -146, 580, 454] }, 'h' => { wx: 600, boundingbox: [5, 0, 592, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 523, 658] }, 'j' => { wx: 600, boundingbox: [63, -146, 440, 658] }, 'k' => { wx: 600, boundingbox: [20, 0, 585, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 523, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 626, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 592, 454] }, 'o' => { wx: 600, boundingbox: [30, -15, 570, 454] }, 'p' => { wx: 600, boundingbox: [-1, -142, 570, 454] }, 'q' => { wx: 600, boundingbox: [20, -142, 591, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 580, 454] }, 's' => { wx: 600, boundingbox: [68, -17, 535, 459] }, 't' => { wx: 600, boundingbox: [47, -15, 532, 562] }, 'u' => { wx: 600, boundingbox: [-1, -15, 569, 439] }, 'v' => { wx: 600, boundingbox: [-1, 0, 601, 439] }, 'w' => { wx: 600, boundingbox: [-18, 0, 618, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 594, 439] }, 'y' => { wx: 600, boundingbox: [-4, -142, 601, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 520, 439] }, '{' => { wx: 600, boundingbox: [160, -102, 464, 616] }, '|' => { wx: 600, boundingbox: [255, -250, 345, 750] }, '}' => { wx: 600, boundingbox: [136, -102, 440, 616] }, '~' => { wx: 600, boundingbox: [71, 153, 530, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [202, -146, 398, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [66, -49, 518, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [72, -28, 558, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [25, -60, 576, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [10, 0, 590, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-30, -131, 572, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [83, -70, 517, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [54, 49, 546, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [227, 277, 373, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [71, 277, 535, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [8, 70, 553, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [141, 70, 459, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 593, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [65, 203, 535, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [106, -70, 494, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [196, 165, 404, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [6, -70, 576, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [140, 132, 460, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [175, -142, 427, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [65, -142, 529, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [61, 277, 525, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [47, 70, 592, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [26, -15, 574, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-113, -15, 713, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [99, -146, 502, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [132, 508, 395, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [205, 508, 468, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [103, 483, 497, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [89, 493, 512, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [88, 505, 512, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [83, 468, 517, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [230, 498, 370, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [128, 498, 472, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [198, 481, 402, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [205, -206, 387, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [68, 488, 588, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [169, -199, 400, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [103, 493, 497, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [-10, 203, 610, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 602, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 578, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [22, -22, 578, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [-25, 0, 595, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [147, 196, 453, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [-4, -15, 601, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 523, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 523, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [30, -24, 570, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [-18, -15, 611, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 596, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_oblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [243, -15, 464, 572] }, '\"' => { wx: 600, boundingbox: [273, 328, 532, 562] }, '#' => { wx: 600, boundingbox: [133, -32, 596, 639] }, '$' => { wx: 600, boundingbox: [108, -126, 596, 662] }, '%' => { wx: 600, boundingbox: [134, -15, 599, 622] }, '&' => { wx: 600, boundingbox: [87, -15, 580, 543] }, \"'\" => { wx: 600, boundingbox: [283, 328, 495, 562] }, '(' => { wx: 600, boundingbox: [313, -108, 572, 622] }, ')' => { wx: 600, boundingbox: [137, -108, 396, 622] }, '*' => { wx: 600, boundingbox: [212, 257, 580, 607] }, '+' => { wx: 600, boundingbox: [129, 44, 580, 470] }, ',' => { wx: 600, boundingbox: [157, -112, 370, 122] }, '-' => { wx: 600, boundingbox: [152, 231, 558, 285] }, '.' => { wx: 600, boundingbox: [238, -15, 382, 109] }, '/' => { wx: 600, boundingbox: [112, -80, 604, 629] }, '0' => { wx: 600, boundingbox: [154, -15, 575, 622] }, '1' => { wx: 600, boundingbox: [98, 0, 515, 622] }, '2' => { wx: 600, boundingbox: [70, 0, 568, 622] }, '3' => { wx: 600, boundingbox: [82, -15, 538, 622] }, '4' => { wx: 600, boundingbox: [108, 0, 541, 622] }, '5' => { wx: 600, boundingbox: [99, -15, 589, 607] }, '6' => { wx: 600, boundingbox: [155, -15, 629, 622] }, '7' => { wx: 600, boundingbox: [182, 0, 612, 607] }, '8' => { wx: 600, boundingbox: [132, -15, 588, 622] }, '9' => { wx: 600, boundingbox: [93, -15, 574, 622] }, ':' => { wx: 600, boundingbox: [238, -15, 441, 385] }, ';' => { wx: 600, boundingbox: [157, -112, 441, 385] }, '<' => { wx: 600, boundingbox: [96, 42, 610, 472] }, '=' => { wx: 600, boundingbox: [109, 138, 600, 376] }, '>' => { wx: 600, boundingbox: [85, 42, 599, 472] }, '?' => { wx: 600, boundingbox: [222, -15, 583, 572] }, '@' => { wx: 600, boundingbox: [127, -15, 582, 622] }, 'A' => { wx: 600, boundingbox: [3, 0, 607, 562] }, 'B' => { wx: 600, boundingbox: [43, 0, 616, 562] }, 'C' => { wx: 600, boundingbox: [93, -18, 655, 580] }, 'D' => { wx: 600, boundingbox: [43, 0, 645, 562] }, 'E' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'F' => { wx: 600, boundingbox: [53, 0, 660, 562] }, 'G' => { wx: 600, boundingbox: [83, -18, 645, 580] }, 'H' => { wx: 600, boundingbox: [32, 0, 687, 562] }, 'I' => { wx: 600, boundingbox: [96, 0, 623, 562] }, 'J' => { wx: 600, boundingbox: [52, -18, 685, 562] }, 'K' => { wx: 600, boundingbox: [38, 0, 671, 562] }, 'L' => { wx: 600, boundingbox: [47, 0, 607, 562] }, 'M' => { wx: 600, boundingbox: [4, 0, 715, 562] }, 'N' => { wx: 600, boundingbox: [7, -13, 712, 562] }, 'O' => { wx: 600, boundingbox: [94, -18, 625, 580] }, 'P' => { wx: 600, boundingbox: [79, 0, 644, 562] }, 'Q' => { wx: 600, boundingbox: [95, -138, 625, 580] }, 'R' => { wx: 600, boundingbox: [38, 0, 598, 562] }, 'S' => { wx: 600, boundingbox: [76, -20, 650, 580] }, 'T' => { wx: 600, boundingbox: [108, 0, 665, 562] }, 'U' => { wx: 600, boundingbox: [125, -18, 702, 562] }, 'V' => { wx: 600, boundingbox: [105, -13, 723, 562] }, 'W' => { wx: 600, boundingbox: [106, -13, 722, 562] }, 'X' => { wx: 600, boundingbox: [23, 0, 675, 562] }, 'Y' => { wx: 600, boundingbox: [133, 0, 695, 562] }, 'Z' => { wx: 600, boundingbox: [86, 0, 610, 562] }, '[' => { wx: 600, boundingbox: [246, -108, 574, 622] }, '\\\\' => { wx: 600, boundingbox: [249, -80, 468, 629] }, ']' => { wx: 600, boundingbox: [135, -108, 463, 622] }, '^' => { wx: 600, boundingbox: [175, 354, 587, 622] }, '_' => { wx: 600, boundingbox: [-27, -125, 584, -75] }, '`' => { wx: 600, boundingbox: [343, 328, 457, 562] }, 'a' => { wx: 600, boundingbox: [76, -15, 569, 441] }, 'b' => { wx: 600, boundingbox: [29, -15, 625, 629] }, 'c' => { wx: 600, boundingbox: [106, -15, 608, 441] }, 'd' => { wx: 600, boundingbox: [85, -15, 640, 629] }, 'e' => { wx: 600, boundingbox: [106, -15, 598, 441] }, 'f' => { wx: 600, boundingbox: [114, 0, 662, 629] }, 'g' => { wx: 600, boundingbox: [61, -157, 657, 441] }, 'h' => { wx: 600, boundingbox: [33, 0, 592, 629] }, 'i' => { wx: 600, boundingbox: [95, 0, 515, 657] }, 'j' => { wx: 600, boundingbox: [52, -157, 550, 657] }, 'k' => { wx: 600, boundingbox: [58, 0, 633, 629] }, 'l' => { wx: 600, boundingbox: [95, 0, 515, 629] }, 'm' => { wx: 600, boundingbox: [-5, 0, 615, 441] }, 'n' => { wx: 600, boundingbox: [26, 0, 585, 441] }, 'o' => { wx: 600, boundingbox: [102, -15, 588, 441] }, 'p' => { wx: 600, boundingbox: [-24, -157, 605, 441] }, 'q' => { wx: 600, boundingbox: [85, -157, 682, 441] }, 'r' => { wx: 600, boundingbox: [60, 0, 636, 441] }, 's' => { wx: 600, boundingbox: [78, -15, 584, 441] }, 't' => { wx: 600, boundingbox: [167, -15, 561, 561] }, 'u' => { wx: 600, boundingbox: [101, -15, 572, 426] }, 'v' => { wx: 600, boundingbox: [90, -10, 681, 426] }, 'w' => { wx: 600, boundingbox: [76, -10, 695, 426] }, 'x' => { wx: 600, boundingbox: [20, 0, 655, 426] }, 'y' => { wx: 600, boundingbox: [-4, -157, 683, 426] }, 'z' => { wx: 600, boundingbox: [99, 0, 593, 426] }, '{' => { wx: 600, boundingbox: [233, -108, 569, 622] }, '|' => { wx: 600, boundingbox: [222, -250, 485, 750] }, '}' => { wx: 600, boundingbox: [140, -108, 477, 622] }, '~' => { wx: 600, boundingbox: [116, 197, 600, 320] }, \"\\u00A1\" => { wx: 600, boundingbox: [225, -157, 445, 430] }, \"\\u00A2\" => { wx: 600, boundingbox: [151, -49, 588, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [124, -21, 621, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [84, -57, 646, 665] }, \"\\u00A5\" => { wx: 600, boundingbox: [120, 0, 693, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-26, -143, 671, 622] }, \"\\u00A7\" => { wx: 600, boundingbox: [104, -78, 590, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [94, 58, 628, 506] }, \"\\u00A9\" => { wx: 600, boundingbox: [345, 328, 460, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [262, 328, 541, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [92, 70, 652, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [204, 70, 540, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [170, 70, 506, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00AF\" => { wx: 600, boundingbox: [3, 0, 619, 629] }, \"\\u00B1\" => { wx: 600, boundingbox: [124, 231, 586, 285] }, \"\\u00B2\" => { wx: 600, boundingbox: [217, -78, 546, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [163, -78, 546, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [275, 189, 434, 327] }, \"\\u00B6\" => { wx: 600, boundingbox: [100, -78, 630, 562] }, \"\\u00B7\" => { wx: 600, boundingbox: [224, 130, 485, 383] }, \"\\u00B8\" => { wx: 600, boundingbox: [185, -134, 397, 100] }, \"\\u00B9\" => { wx: 600, boundingbox: [115, -134, 478, 100] }, \"\\u00BA\" => { wx: 600, boundingbox: [213, 328, 576, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [58, 70, 618, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [46, -15, 575, 111] }, \"\\u00BD\" => { wx: 600, boundingbox: [59, -15, 627, 622] }, \"\\u00BF\" => { wx: 600, boundingbox: [105, -157, 466, 430] }, \"\\u00C1\" => { wx: 600, boundingbox: [294, 497, 484, 672] }, \"\\u00C2\" => { wx: 600, boundingbox: [348, 497, 612, 672] }, \"\\u00C3\" => { wx: 600, boundingbox: [229, 477, 581, 654] }, \"\\u00C4\" => { wx: 600, boundingbox: [212, 489, 629, 606] }, \"\\u00C5\" => { wx: 600, boundingbox: [232, 525, 600, 565] }, \"\\u00C6\" => { wx: 600, boundingbox: [279, 501, 576, 609] }, \"\\u00C7\" => { wx: 600, boundingbox: [373, 537, 478, 640] }, \"\\u00C8\" => { wx: 600, boundingbox: [272, 537, 579, 640] }, \"\\u00CA\" => { wx: 600, boundingbox: [332, 463, 500, 627] }, \"\\u00CB\" => { wx: 600, boundingbox: [197, -151, 344, 10] }, \"\\u00CD\" => { wx: 600, boundingbox: [239, 497, 683, 672] }, \"\\u00CE\" => { wx: 600, boundingbox: [189, -172, 377, 4] }, \"\\u00CF\" => { wx: 600, boundingbox: [262, 492, 614, 669] }, \"\\u00D0\" => { wx: 600, boundingbox: [49, 231, 661, 285] }, \"\\u00E1\" => { wx: 600, boundingbox: [3, 0, 655, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [209, 249, 512, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [47, 0, 607, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [94, -80, 625, 629] }, \"\\u00EA\" => { wx: 600, boundingbox: [59, 0, 672, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [210, 249, 535, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [41, -15, 626, 441] }, \"\\u00F5\" => { wx: 600, boundingbox: [95, 0, 515, 426] }, \"\\u00F8\" => { wx: 600, boundingbox: [95, 0, 587, 629] }, \"\\u00F9\" => { wx: 600, boundingbox: [102, -80, 588, 506] }, \"\\u00FA\" => { wx: 600, boundingbox: [54, -15, 615, 441] }, \"\\u00FB\" => { wx: 600, boundingbox: [48, -15, 617, 629] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n courier_boldoblique_metrics = { ' ' => { wx: 600, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 600, boundingbox: [215, -15, 495, 572] }, '\"' => { wx: 600, boundingbox: [211, 277, 585, 562] }, '#' => { wx: 600, boundingbox: [88, -45, 641, 651] }, '$' => { wx: 600, boundingbox: [87, -126, 630, 666] }, '%' => { wx: 600, boundingbox: [101, -15, 625, 616] }, '&' => { wx: 600, boundingbox: [61, -15, 595, 543] }, \"'\" => { wx: 600, boundingbox: [229, 277, 543, 562] }, '(' => { wx: 600, boundingbox: [265, -102, 592, 616] }, ')' => { wx: 600, boundingbox: [117, -102, 444, 616] }, '*' => { wx: 600, boundingbox: [179, 219, 598, 601] }, '+' => { wx: 600, boundingbox: [114, 39, 596, 478] }, ',' => { wx: 600, boundingbox: [99, -111, 430, 174] }, '-' => { wx: 600, boundingbox: [143, 203, 567, 313] }, '.' => { wx: 600, boundingbox: [206, -15, 427, 171] }, '/' => { wx: 600, boundingbox: [90, -77, 626, 626] }, '0' => { wx: 600, boundingbox: [135, -15, 593, 616] }, '1' => { wx: 600, boundingbox: [93, 0, 562, 616] }, '2' => { wx: 600, boundingbox: [61, 0, 594, 616] }, '3' => { wx: 600, boundingbox: [71, -15, 571, 616] }, '4' => { wx: 600, boundingbox: [81, 0, 559, 616] }, '5' => { wx: 600, boundingbox: [77, -15, 621, 601] }, '6' => { wx: 600, boundingbox: [135, -15, 652, 616] }, '7' => { wx: 600, boundingbox: [147, 0, 622, 601] }, '8' => { wx: 600, boundingbox: [115, -15, 604, 616] }, '9' => { wx: 600, boundingbox: [75, -15, 592, 616] }, ':' => { wx: 600, boundingbox: [205, -15, 480, 425] }, ';' => { wx: 600, boundingbox: [99, -111, 481, 425] }, '<' => { wx: 600, boundingbox: [120, 15, 613, 501] }, '=' => { wx: 600, boundingbox: [96, 118, 614, 398] }, '>' => { wx: 600, boundingbox: [97, 15, 589, 501] }, '?' => { wx: 600, boundingbox: [183, -14, 592, 580] }, '@' => { wx: 600, boundingbox: [65, -15, 642, 616] }, 'A' => { wx: 600, boundingbox: [-9, 0, 632, 562] }, 'B' => { wx: 600, boundingbox: [30, 0, 630, 562] }, 'C' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'D' => { wx: 600, boundingbox: [30, 0, 664, 562] }, 'E' => { wx: 600, boundingbox: [25, 0, 670, 562] }, 'F' => { wx: 600, boundingbox: [39, 0, 684, 562] }, 'G' => { wx: 600, boundingbox: [74, -18, 675, 580] }, 'H' => { wx: 600, boundingbox: [20, 0, 700, 562] }, 'I' => { wx: 600, boundingbox: [77, 0, 643, 562] }, 'J' => { wx: 600, boundingbox: [58, -18, 721, 562] }, 'K' => { wx: 600, boundingbox: [21, 0, 692, 562] }, 'L' => { wx: 600, boundingbox: [39, 0, 636, 562] }, 'M' => { wx: 600, boundingbox: [-2, 0, 722, 562] }, 'N' => { wx: 600, boundingbox: [8, -12, 730, 562] }, 'O' => { wx: 600, boundingbox: [74, -18, 645, 580] }, 'P' => { wx: 600, boundingbox: [48, 0, 643, 562] }, 'Q' => { wx: 600, boundingbox: [83, -138, 636, 580] }, 'R' => { wx: 600, boundingbox: [24, 0, 617, 562] }, 'S' => { wx: 600, boundingbox: [54, -22, 673, 582] }, 'T' => { wx: 600, boundingbox: [86, 0, 679, 562] }, 'U' => { wx: 600, boundingbox: [101, -18, 716, 562] }, 'V' => { wx: 600, boundingbox: [84, 0, 733, 562] }, 'W' => { wx: 600, boundingbox: [79, 0, 738, 562] }, 'X' => { wx: 600, boundingbox: [12, 0, 690, 562] }, 'Y' => { wx: 600, boundingbox: [109, 0, 709, 562] }, 'Z' => { wx: 600, boundingbox: [62, 0, 637, 562] }, '[' => { wx: 600, boundingbox: [223, -102, 606, 616] }, '\\\\' => { wx: 600, boundingbox: [222, -77, 496, 626] }, ']' => { wx: 600, boundingbox: [103, -102, 486, 616] }, '^' => { wx: 600, boundingbox: [171, 250, 556, 616] }, '_' => { wx: 600, boundingbox: [-27, -125, 585, -75] }, '`' => { wx: 600, boundingbox: [297, 277, 487, 562] }, 'a' => { wx: 600, boundingbox: [61, -15, 593, 454] }, 'b' => { wx: 600, boundingbox: [13, -15, 636, 626] }, 'c' => { wx: 600, boundingbox: [81, -15, 631, 459] }, 'd' => { wx: 600, boundingbox: [60, -15, 645, 626] }, 'e' => { wx: 600, boundingbox: [81, -15, 605, 454] }, 'f' => { wx: 600, boundingbox: [83, 0, 677, 626] }, 'g' => { wx: 600, boundingbox: [40, -146, 674, 454] }, 'h' => { wx: 600, boundingbox: [18, 0, 615, 626] }, 'i' => { wx: 600, boundingbox: [77, 0, 546, 658] }, 'j' => { wx: 600, boundingbox: [36, -146, 580, 658] }, 'k' => { wx: 600, boundingbox: [33, 0, 643, 626] }, 'l' => { wx: 600, boundingbox: [77, 0, 546, 626] }, 'm' => { wx: 600, boundingbox: [-22, 0, 649, 454] }, 'n' => { wx: 600, boundingbox: [18, 0, 615, 454] }, 'o' => { wx: 600, boundingbox: [71, -15, 622, 454] }, 'p' => { wx: 600, boundingbox: [-32, -142, 622, 454] }, 'q' => { wx: 600, boundingbox: [60, -142, 685, 454] }, 'r' => { wx: 600, boundingbox: [47, 0, 655, 454] }, 's' => { wx: 600, boundingbox: [66, -17, 608, 459] }, 't' => { wx: 600, boundingbox: [118, -15, 567, 562] }, 'u' => { wx: 600, boundingbox: [70, -15, 592, 439] }, 'v' => { wx: 600, boundingbox: [70, 0, 695, 439] }, 'w' => { wx: 600, boundingbox: [53, 0, 712, 439] }, 'x' => { wx: 600, boundingbox: [6, 0, 671, 439] }, 'y' => { wx: 600, boundingbox: [-21, -142, 695, 439] }, 'z' => { wx: 600, boundingbox: [81, 0, 614, 439] }, '{' => { wx: 600, boundingbox: [203, -102, 595, 616] }, '|' => { wx: 600, boundingbox: [201, -250, 505, 750] }, '}' => { wx: 600, boundingbox: [114, -102, 506, 616] }, '~' => { wx: 600, boundingbox: [120, 153, 590, 356] }, \"\\u00A1\" => { wx: 600, boundingbox: [196, -146, 477, 449] }, \"\\u00A2\" => { wx: 600, boundingbox: [121, -49, 605, 614] }, \"\\u00A3\" => { wx: 600, boundingbox: [106, -28, 650, 611] }, \"\\u00A4\" => { wx: 600, boundingbox: [22, -60, 708, 661] }, \"\\u00A5\" => { wx: 600, boundingbox: [98, 0, 710, 562] }, \"\\u00A6\" => { wx: 600, boundingbox: [-57, -131, 702, 616] }, \"\\u00A7\" => { wx: 600, boundingbox: [74, -70, 620, 580] }, \"\\u00A8\" => { wx: 600, boundingbox: [77, 49, 644, 517] }, \"\\u00A9\" => { wx: 600, boundingbox: [303, 277, 493, 562] }, \"\\u00AA\" => { wx: 600, boundingbox: [190, 277, 594, 562] }, \"\\u00AB\" => { wx: 600, boundingbox: [62, 70, 639, 446] }, \"\\u00AC\" => { wx: 600, boundingbox: [195, 70, 545, 446] }, \"\\u00AD\" => { wx: 600, boundingbox: [165, 70, 514, 446] }, \"\\u00AE\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00AF\" => { wx: 600, boundingbox: [12, 0, 644, 626] }, \"\\u00B1\" => { wx: 600, boundingbox: [108, 203, 602, 313] }, \"\\u00B2\" => { wx: 600, boundingbox: [175, -70, 586, 580] }, \"\\u00B3\" => { wx: 600, boundingbox: [121, -70, 587, 580] }, \"\\u00B4\" => { wx: 600, boundingbox: [248, 165, 461, 351] }, \"\\u00B6\" => { wx: 600, boundingbox: [61, -70, 700, 580] }, \"\\u00B7\" => { wx: 600, boundingbox: [196, 132, 523, 430] }, \"\\u00B8\" => { wx: 600, boundingbox: [144, -142, 458, 143] }, \"\\u00B9\" => { wx: 600, boundingbox: [34, -142, 560, 143] }, \"\\u00BA\" => { wx: 600, boundingbox: [119, 277, 645, 562] }, \"\\u00BB\" => { wx: 600, boundingbox: [71, 70, 647, 446] }, \"\\u00BC\" => { wx: 600, boundingbox: [35, -15, 587, 116] }, \"\\u00BD\" => { wx: 600, boundingbox: [-45, -15, 743, 616] }, \"\\u00BF\" => { wx: 600, boundingbox: [100, -146, 509, 449] }, \"\\u00C1\" => { wx: 600, boundingbox: [272, 508, 503, 661] }, \"\\u00C2\" => { wx: 600, boundingbox: [312, 508, 609, 661] }, \"\\u00C3\" => { wx: 600, boundingbox: [212, 483, 607, 657] }, \"\\u00C4\" => { wx: 600, boundingbox: [199, 493, 643, 636] }, \"\\u00C5\" => { wx: 600, boundingbox: [195, 505, 637, 585] }, \"\\u00C6\" => { wx: 600, boundingbox: [217, 468, 652, 631] }, \"\\u00C7\" => { wx: 600, boundingbox: [348, 498, 493, 638] }, \"\\u00C8\" => { wx: 600, boundingbox: [246, 498, 595, 638] }, \"\\u00CA\" => { wx: 600, boundingbox: [319, 481, 528, 678] }, \"\\u00CB\" => { wx: 600, boundingbox: [168, -206, 368, 0] }, \"\\u00CD\" => { wx: 600, boundingbox: [171, 488, 729, 661] }, \"\\u00CE\" => { wx: 600, boundingbox: [143, -199, 367, 0] }, \"\\u00CF\" => { wx: 600, boundingbox: [238, 493, 633, 667] }, \"\\u00D0\" => { wx: 600, boundingbox: [33, 203, 677, 313] }, \"\\u00E1\" => { wx: 600, boundingbox: [-29, 0, 708, 562] }, \"\\u00E3\" => { wx: 600, boundingbox: [188, 196, 526, 580] }, \"\\u00E8\" => { wx: 600, boundingbox: [39, 0, 636, 562] }, \"\\u00E9\" => { wx: 600, boundingbox: [48, -22, 673, 584] }, \"\\u00EA\" => { wx: 600, boundingbox: [26, 0, 701, 562] }, \"\\u00EB\" => { wx: 600, boundingbox: [188, 196, 543, 580] }, \"\\u00F1\" => { wx: 600, boundingbox: [21, -15, 652, 454] }, \"\\u00F5\" => { wx: 600, boundingbox: [77, 0, 546, 439] }, \"\\u00F8\" => { wx: 600, boundingbox: [77, 0, 587, 626] }, \"\\u00F9\" => { wx: 600, boundingbox: [54, -24, 638, 463] }, \"\\u00FA\" => { wx: 600, boundingbox: [18, -15, 662, 454] }, \"\\u00FB\" => { wx: 600, boundingbox: [22, -15, 629, 626] }, \"\\xFF\" => { wx: 600, boundingbox: [0, 0, 0, 0] } }\n symbol_metrics = { ' ' => { wx: 250, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 333, boundingbox: [128, -17, 240, 672] }, '\"' => { wx: 713, boundingbox: [31, 0, 681, 705] }, '#' => { wx: 500, boundingbox: [20, -16, 481, 673] }, '$' => { wx: 549, boundingbox: [25, 0, 478, 707] }, '%' => { wx: 833, boundingbox: [63, -36, 771, 655] }, '&' => { wx: 778, boundingbox: [41, -18, 750, 661] }, \"'\" => { wx: 439, boundingbox: [48, -17, 414, 500] }, '(' => { wx: 333, boundingbox: [53, -191, 300, 673] }, ')' => { wx: 333, boundingbox: [30, -191, 277, 673] }, '*' => { wx: 500, boundingbox: [65, 134, 427, 551] }, '+' => { wx: 549, boundingbox: [10, 0, 539, 533] }, ',' => { wx: 250, boundingbox: [56, -152, 194, 104] }, '-' => { wx: 549, boundingbox: [11, 233, 535, 288] }, '.' => { wx: 250, boundingbox: [69, -17, 181, 95] }, '/' => { wx: 278, boundingbox: [0, -18, 254, 646] }, '0' => { wx: 500, boundingbox: [24, -14, 476, 685] }, '1' => { wx: 500, boundingbox: [117, 0, 390, 673] }, '2' => { wx: 500, boundingbox: [25, 0, 475, 685] }, '3' => { wx: 500, boundingbox: [43, -14, 435, 685] }, '4' => { wx: 500, boundingbox: [15, 0, 469, 685] }, '5' => { wx: 500, boundingbox: [32, -14, 445, 690] }, '6' => { wx: 500, boundingbox: [34, -14, 468, 685] }, '7' => { wx: 500, boundingbox: [24, -16, 448, 673] }, '8' => { wx: 500, boundingbox: [56, -14, 445, 685] }, '9' => { wx: 500, boundingbox: [30, -18, 459, 685] }, ':' => { wx: 278, boundingbox: [81, -17, 193, 460] }, ';' => { wx: 278, boundingbox: [83, -152, 221, 460] }, '<' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '=' => { wx: 549, boundingbox: [11, 141, 537, 390] }, '>' => { wx: 549, boundingbox: [26, 0, 523, 522] }, '?' => { wx: 444, boundingbox: [70, -17, 412, 686] }, '@' => { wx: 549, boundingbox: [11, 0, 537, 475] }, 'A' => { wx: 722, boundingbox: [4, 0, 684, 673] }, 'B' => { wx: 667, boundingbox: [29, 0, 592, 673] }, 'C' => { wx: 722, boundingbox: [-9, 0, 704, 673] }, 'D' => { wx: 612, boundingbox: [6, 0, 608, 688] }, 'E' => { wx: 611, boundingbox: [32, 0, 617, 673] }, 'F' => { wx: 763, boundingbox: [26, 0, 741, 673] }, 'G' => { wx: 603, boundingbox: [24, 0, 609, 673] }, 'H' => { wx: 722, boundingbox: [39, 0, 729, 673] }, 'I' => { wx: 333, boundingbox: [32, 0, 316, 673] }, 'J' => { wx: 631, boundingbox: [18, -18, 623, 689] }, 'K' => { wx: 722, boundingbox: [35, 0, 722, 673] }, 'L' => { wx: 686, boundingbox: [6, 0, 680, 688] }, 'M' => { wx: 889, boundingbox: [28, 0, 887, 673] }, 'N' => { wx: 722, boundingbox: [29, -8, 720, 673] }, 'O' => { wx: 722, boundingbox: [41, -17, 715, 685] }, 'P' => { wx: 768, boundingbox: [25, 0, 745, 673] }, 'Q' => { wx: 741, boundingbox: [41, -17, 715, 685] }, 'R' => { wx: 556, boundingbox: [28, 0, 563, 673] }, 'S' => { wx: 592, boundingbox: [5, 0, 589, 673] }, 'T' => { wx: 611, boundingbox: [33, 0, 607, 673] }, 'U' => { wx: 690, boundingbox: [-8, 0, 694, 673] }, 'V' => { wx: 439, boundingbox: [40, -233, 436, 500] }, 'W' => { wx: 768, boundingbox: [34, 0, 736, 688] }, 'X' => { wx: 645, boundingbox: [40, 0, 599, 673] }, 'Y' => { wx: 795, boundingbox: [15, 0, 781, 684] }, 'Z' => { wx: 611, boundingbox: [44, 0, 636, 673] }, '[' => { wx: 333, boundingbox: [86, -155, 299, 674] }, '\\\\' => { wx: 863, boundingbox: [163, 0, 701, 487] }, ']' => { wx: 333, boundingbox: [33, -155, 246, 674] }, '^' => { wx: 658, boundingbox: [15, 0, 652, 674] }, '_' => { wx: 500, boundingbox: [-2, -125, 502, -75] }, '`' => { wx: 500, boundingbox: [480, 881, 1090, 917] }, 'a' => { wx: 631, boundingbox: [41, -18, 622, 500] }, 'b' => { wx: 549, boundingbox: [61, -223, 515, 741] }, 'c' => { wx: 549, boundingbox: [12, -231, 522, 499] }, 'd' => { wx: 494, boundingbox: [40, -19, 481, 740] }, 'e' => { wx: 439, boundingbox: [22, -19, 427, 502] }, 'f' => { wx: 521, boundingbox: [28, -224, 492, 673] }, 'g' => { wx: 411, boundingbox: [5, -225, 484, 499] }, 'h' => { wx: 603, boundingbox: [0, -202, 527, 514] }, 'i' => { wx: 329, boundingbox: [0, -17, 301, 503] }, 'j' => { wx: 603, boundingbox: [36, -224, 587, 499] }, 'k' => { wx: 549, boundingbox: [33, 0, 558, 501] }, 'l' => { wx: 549, boundingbox: [24, -17, 548, 739] }, 'm' => { wx: 576, boundingbox: [33, -223, 567, 500] }, 'n' => { wx: 521, boundingbox: [-9, -16, 475, 507] }, 'o' => { wx: 549, boundingbox: [35, -19, 501, 499] }, 'p' => { wx: 549, boundingbox: [10, -19, 530, 487] }, 'q' => { wx: 521, boundingbox: [43, -17, 485, 690] }, 'r' => { wx: 549, boundingbox: [50, -230, 490, 499] }, 's' => { wx: 603, boundingbox: [30, -21, 588, 500] }, 't' => { wx: 439, boundingbox: [10, -19, 418, 500] }, 'u' => { wx: 576, boundingbox: [7, -18, 535, 507] }, 'v' => { wx: 713, boundingbox: [12, -18, 671, 583] }, 'w' => { wx: 686, boundingbox: [42, -17, 684, 500] }, 'x' => { wx: 493, boundingbox: [27, -224, 469, 766] }, 'y' => { wx: 686, boundingbox: [12, -228, 701, 500] }, 'z' => { wx: 494, boundingbox: [60, -225, 467, 756] }, '{' => { wx: 480, boundingbox: [58, -183, 397, 673] }, '|' => { wx: 200, boundingbox: [65, -293, 135, 707] }, '}' => { wx: 480, boundingbox: [79, -183, 418, 673] }, '~' => { wx: 549, boundingbox: [17, 203, 529, 307] }, \"\\u00A0\" => { wx: 750, boundingbox: [20, -12, 714, 685] }, \"\\u00A1\" => { wx: 620, boundingbox: [-2, 0, 610, 685] }, \"\\u00A2\" => { wx: 247, boundingbox: [27, 459, 228, 735] }, \"\\u00A3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00A4\" => { wx: 167, boundingbox: [-180, -12, 340, 677] }, \"\\u00A5\" => { wx: 713, boundingbox: [26, 124, 688, 404] }, \"\\u00A6\" => { wx: 500, boundingbox: [2, -193, 494, 686] }, \"\\u00A7\" => { wx: 753, boundingbox: [86, -26, 660, 533] }, \"\\u00A8\" => { wx: 753, boundingbox: [142, -36, 600, 550] }, \"\\u00A9\" => { wx: 753, boundingbox: [117, -33, 631, 532] }, \"\\u00AA\" => { wx: 753, boundingbox: [113, -36, 629, 548] }, \"\\u00AB\" => { wx: 1042, boundingbox: [24, -15, 1024, 511] }, \"\\u00AC\" => { wx: 987, boundingbox: [32, -15, 942, 511] }, \"\\u00AD\" => { wx: 603, boundingbox: [45, 0, 571, 910] }, \"\\u00AE\" => { wx: 987, boundingbox: [49, -15, 959, 511] }, \"\\u00AF\" => { wx: 603, boundingbox: [45, -22, 571, 888] }, \"\\u00B0\" => { wx: 400, boundingbox: [50, 385, 350, 685] }, \"\\u00B1\" => { wx: 549, boundingbox: [10, 0, 539, 645] }, \"\\u00B2\" => { wx: 411, boundingbox: [20, 459, 413, 737] }, \"\\u00B3\" => { wx: 549, boundingbox: [29, 0, 526, 639] }, \"\\u00B4\" => { wx: 549, boundingbox: [17, 8, 533, 524] }, \"\\u00B5\" => { wx: 713, boundingbox: [27, 123, 639, 404] }, \"\\u00B6\" => { wx: 494, boundingbox: [26, -20, 462, 746] }, \"\\u00B7\" => { wx: 460, boundingbox: [50, 113, 410, 473] }, \"\\u00B8\" => { wx: 549, boundingbox: [10, 71, 536, 456] }, \"\\u00B9\" => { wx: 549, boundingbox: [15, -25, 540, 549] }, \"\\u00BA\" => { wx: 549, boundingbox: [14, 82, 538, 443] }, \"\\u00BB\" => { wx: 549, boundingbox: [14, 135, 527, 394] }, \"\\u00BC\" => { wx: 1000, boundingbox: [111, -17, 889, 95] }, \"\\u00BD\" => { wx: 603, boundingbox: [280, -120, 336, 1010] }, \"\\u00BE\" => { wx: 1000, boundingbox: [-60, 220, 1050, 276] }, \"\\u00BF\" => { wx: 658, boundingbox: [15, -16, 602, 629] }, \"\\u00C0\" => { wx: 823, boundingbox: [175, -18, 661, 658] }, \"\\u00C1\" => { wx: 686, boundingbox: [10, -53, 578, 740] }, \"\\u00C2\" => { wx: 795, boundingbox: [26, -15, 759, 734] }, \"\\u00C3\" => { wx: 987, boundingbox: [159, -211, 870, 573] }, \"\\u00C4\" => { wx: 768, boundingbox: [43, -17, 733, 673] }, \"\\u00C5\" => { wx: 768, boundingbox: [43, -15, 733, 675] }, \"\\u00C6\" => { wx: 823, boundingbox: [39, -24, 781, 719] }, \"\\u00C7\" => { wx: 768, boundingbox: [40, 0, 732, 509] }, \"\\u00C8\" => { wx: 768, boundingbox: [40, -17, 732, 492] }, \"\\u00C9\" => { wx: 713, boundingbox: [20, 0, 673, 470] }, \"\\u00CA\" => { wx: 713, boundingbox: [20, -125, 673, 470] }, \"\\u00CB\" => { wx: 713, boundingbox: [36, -70, 690, 540] }, \"\\u00CC\" => { wx: 713, boundingbox: [37, 0, 690, 470] }, \"\\u00CD\" => { wx: 713, boundingbox: [37, -125, 690, 470] }, \"\\u00CE\" => { wx: 713, boundingbox: [45, 0, 505, 468] }, \"\\u00CF\" => { wx: 713, boundingbox: [45, -58, 505, 555] }, \"\\u00D0\" => { wx: 768, boundingbox: [26, 0, 738, 673] }, \"\\u00D1\" => { wx: 713, boundingbox: [36, -19, 681, 718] }, \"\\u00D2\" => { wx: 790, boundingbox: [50, -17, 740, 673] }, \"\\u00D3\" => { wx: 790, boundingbox: [51, -15, 741, 675] }, \"\\u00D4\" => { wx: 890, boundingbox: [18, 293, 855, 673] }, \"\\u00D5\" => { wx: 823, boundingbox: [25, -101, 803, 751] }, \"\\u00D6\" => { wx: 549, boundingbox: [10, -38, 515, 917] }, \"\\u00D7\" => { wx: 250, boundingbox: [69, 210, 169, 310] }, \"\\u00D8\" => { wx: 713, boundingbox: [15, 0, 680, 288] }, \"\\u00D9\" => { wx: 603, boundingbox: [23, 0, 583, 454] }, \"\\u00DA\" => { wx: 603, boundingbox: [30, 0, 578, 477] }, \"\\u00DB\" => { wx: 1042, boundingbox: [27, -20, 1023, 510] }, \"\\u00DC\" => { wx: 987, boundingbox: [30, -15, 939, 513] }, \"\\u00DD\" => { wx: 603, boundingbox: [39, 2, 567, 911] }, \"\\u00DE\" => { wx: 987, boundingbox: [45, -20, 954, 508] }, \"\\u00DF\" => { wx: 603, boundingbox: [44, -19, 572, 890] }, \"\\u00E0\" => { wx: 494, boundingbox: [18, 0, 466, 745] }, \"\\u00E1\" => { wx: 329, boundingbox: [25, -198, 306, 746] }, \"\\u00E2\" => { wx: 790, boundingbox: [50, -20, 740, 670] }, \"\\u00E3\" => { wx: 790, boundingbox: [49, -15, 739, 675] }, \"\\u00E4\" => { wx: 786, boundingbox: [5, 293, 725, 673] }, \"\\u00E5\" => { wx: 713, boundingbox: [14, -108, 695, 752] }, \"\\u00E6\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E7\" => { wx: 384, boundingbox: [24, -85, 108, 925] }, \"\\u00E8\" => { wx: 384, boundingbox: [24, -293, 436, 926] }, \"\\u00E9\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EA\" => { wx: 384, boundingbox: [0, -79, 77, 925] }, \"\\u00EB\" => { wx: 384, boundingbox: [0, -80, 349, 926] }, \"\\u00EC\" => { wx: 494, boundingbox: [209, -85, 445, 925] }, \"\\u00ED\" => { wx: 494, boundingbox: [20, -85, 284, 935] }, \"\\u00EE\" => { wx: 494, boundingbox: [209, -75, 445, 935] }, \"\\u00EF\" => { wx: 494, boundingbox: [209, -85, 284, 935] }, \"\\u00F1\" => { wx: 329, boundingbox: [21, -198, 302, 746] }, \"\\u00F2\" => { wx: 274, boundingbox: [2, -107, 291, 916] }, \"\\u00F3\" => { wx: 686, boundingbox: [308, -88, 675, 920] }, \"\\u00F4\" => { wx: 686, boundingbox: [308, -88, 378, 975] }, \"\\u00F5\" => { wx: 686, boundingbox: [11, -87, 378, 921] }, \"\\u00F6\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F7\" => { wx: 384, boundingbox: [382, -85, 466, 925] }, \"\\u00F8\" => { wx: 384, boundingbox: [54, -293, 466, 926] }, \"\\u00F9\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FA\" => { wx: 384, boundingbox: [294, -79, 371, 925] }, \"\\u00FB\" => { wx: 384, boundingbox: [22, -80, 371, 926] }, \"\\u00FC\" => { wx: 494, boundingbox: [48, -85, 284, 925] }, \"\\u00FD\" => { wx: 494, boundingbox: [209, -85, 473, 935] }, \"\\u00FE\" => { wx: 494, boundingbox: [48, -75, 284, 935] }, \"\\xFF\" => { wx: 790, boundingbox: [56, -3, 733, 808] } }\n zapfdingbats_metrics = { ' ' => { wx: 278, boundingbox: [0, 0, 0, 0] }, '!' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '\"' => { wx: 961, boundingbox: [35, 81, 927, 611] }, '#' => { wx: 974, boundingbox: [35, 72, 939, 621] }, '$' => { wx: 980, boundingbox: [35, 0, 945, 692] }, '%' => { wx: 719, boundingbox: [34, 139, 685, 566] }, '&' => { wx: 789, boundingbox: [35, -14, 755, 705] }, \"'\" => { wx: 790, boundingbox: [35, -14, 755, 705] }, '(' => { wx: 791, boundingbox: [35, -13, 761, 705] }, ')' => { wx: 690, boundingbox: [34, 138, 655, 553] }, '*' => { wx: 960, boundingbox: [35, 123, 925, 568] }, '+' => { wx: 939, boundingbox: [35, 134, 904, 559] }, ',' => { wx: 549, boundingbox: [29, -11, 516, 705] }, '-' => { wx: 855, boundingbox: [34, 59, 820, 632] }, '.' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '/' => { wx: 933, boundingbox: [35, 139, 899, 550] }, '0' => { wx: 911, boundingbox: [35, 50, 876, 642] }, '1' => { wx: 945, boundingbox: [35, 139, 909, 553] }, '2' => { wx: 974, boundingbox: [35, 104, 938, 587] }, '3' => { wx: 755, boundingbox: [34, -13, 721, 705] }, '4' => { wx: 846, boundingbox: [36, -14, 811, 705] }, '5' => { wx: 762, boundingbox: [35, 0, 727, 692] }, '6' => { wx: 761, boundingbox: [35, 0, 727, 692] }, '7' => { wx: 571, boundingbox: [-1, -68, 571, 661] }, '8' => { wx: 677, boundingbox: [36, -13, 642, 705] }, '9' => { wx: 763, boundingbox: [35, 0, 728, 692] }, ':' => { wx: 760, boundingbox: [35, 0, 726, 692] }, ';' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '<' => { wx: 754, boundingbox: [35, 0, 720, 692] }, '=' => { wx: 494, boundingbox: [35, 0, 460, 692] }, '>' => { wx: 552, boundingbox: [35, 0, 517, 692] }, '?' => { wx: 537, boundingbox: [35, 0, 503, 692] }, '@' => { wx: 577, boundingbox: [35, 96, 542, 596] }, 'A' => { wx: 692, boundingbox: [35, -14, 657, 705] }, 'B' => { wx: 786, boundingbox: [35, -14, 751, 705] }, 'C' => { wx: 788, boundingbox: [35, -14, 752, 705] }, 'D' => { wx: 788, boundingbox: [35, -14, 753, 705] }, 'E' => { wx: 790, boundingbox: [35, -14, 756, 705] }, 'F' => { wx: 793, boundingbox: [35, -13, 759, 705] }, 'G' => { wx: 794, boundingbox: [35, -13, 759, 705] }, 'H' => { wx: 816, boundingbox: [35, -14, 782, 705] }, 'I' => { wx: 823, boundingbox: [35, -14, 787, 705] }, 'J' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'K' => { wx: 841, boundingbox: [35, -14, 807, 705] }, 'L' => { wx: 823, boundingbox: [35, -14, 789, 705] }, 'M' => { wx: 833, boundingbox: [35, -14, 798, 705] }, 'N' => { wx: 816, boundingbox: [35, -13, 782, 705] }, 'O' => { wx: 831, boundingbox: [35, -14, 796, 705] }, 'P' => { wx: 923, boundingbox: [35, -14, 888, 705] }, 'Q' => { wx: 744, boundingbox: [35, 0, 710, 692] }, 'R' => { wx: 723, boundingbox: [35, 0, 688, 692] }, 'S' => { wx: 749, boundingbox: [35, 0, 714, 692] }, 'T' => { wx: 790, boundingbox: [34, -14, 756, 705] }, 'U' => { wx: 792, boundingbox: [35, -14, 758, 705] }, 'V' => { wx: 695, boundingbox: [35, -14, 661, 706] }, 'W' => { wx: 776, boundingbox: [35, -6, 741, 699] }, 'X' => { wx: 768, boundingbox: [35, -7, 734, 699] }, 'Y' => { wx: 792, boundingbox: [35, -14, 757, 705] }, 'Z' => { wx: 759, boundingbox: [35, 0, 725, 692] }, '[' => { wx: 707, boundingbox: [35, -13, 672, 704] }, '\\\\' => { wx: 708, boundingbox: [35, -14, 672, 705] }, ']' => { wx: 682, boundingbox: [35, -14, 647, 705] }, '^' => { wx: 701, boundingbox: [35, -14, 666, 705] }, '_' => { wx: 826, boundingbox: [35, -14, 791, 705] }, '`' => { wx: 815, boundingbox: [35, -14, 780, 705] }, 'a' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'b' => { wx: 789, boundingbox: [35, -14, 754, 705] }, 'c' => { wx: 707, boundingbox: [34, -14, 673, 705] }, 'd' => { wx: 687, boundingbox: [36, 0, 651, 692] }, 'e' => { wx: 696, boundingbox: [35, 0, 661, 691] }, 'f' => { wx: 689, boundingbox: [35, 0, 655, 692] }, 'g' => { wx: 786, boundingbox: [34, -14, 751, 705] }, 'h' => { wx: 787, boundingbox: [35, -14, 752, 705] }, 'i' => { wx: 713, boundingbox: [35, -14, 678, 705] }, 'j' => { wx: 791, boundingbox: [35, -14, 756, 705] }, 'k' => { wx: 785, boundingbox: [36, -14, 751, 705] }, 'l' => { wx: 791, boundingbox: [35, -14, 757, 705] }, 'm' => { wx: 873, boundingbox: [35, -14, 838, 705] }, 'n' => { wx: 761, boundingbox: [35, 0, 726, 692] }, 'o' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'p' => { wx: 762, boundingbox: [35, 0, 727, 692] }, 'q' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 'r' => { wx: 759, boundingbox: [35, 0, 725, 692] }, 's' => { wx: 892, boundingbox: [35, 0, 858, 705] }, 't' => { wx: 892, boundingbox: [35, -14, 858, 692] }, 'u' => { wx: 788, boundingbox: [35, -14, 754, 705] }, 'v' => { wx: 784, boundingbox: [35, -14, 749, 705] }, 'w' => { wx: 438, boundingbox: [35, -14, 403, 705] }, 'x' => { wx: 138, boundingbox: [35, 0, 104, 692] }, 'y' => { wx: 277, boundingbox: [35, 0, 242, 692] }, 'z' => { wx: 415, boundingbox: [35, 0, 380, 692] }, '{' => { wx: 392, boundingbox: [35, 263, 357, 705] }, '|' => { wx: 392, boundingbox: [34, 263, 357, 705] }, '}' => { wx: 668, boundingbox: [35, 263, 633, 705] }, '~' => { wx: 668, boundingbox: [36, 263, 634, 705] }, \"\\u0080\" => { wx: 390, boundingbox: [35, -14, 356, 705] }, \"\\u0081\" => { wx: 390, boundingbox: [35, -14, 355, 705] }, \"\\u0082\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0083\" => { wx: 317, boundingbox: [35, 0, 283, 692] }, \"\\u0084\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0085\" => { wx: 276, boundingbox: [35, 0, 242, 692] }, \"\\u0086\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0087\" => { wx: 509, boundingbox: [35, 0, 475, 692] }, \"\\u0088\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u0089\" => { wx: 410, boundingbox: [35, 0, 375, 692] }, \"\\u008A\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008B\" => { wx: 234, boundingbox: [35, -14, 199, 705] }, \"\\u008C\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u008D\" => { wx: 334, boundingbox: [35, 0, 299, 692] }, \"\\u00A1\" => { wx: 732, boundingbox: [35, -143, 697, 806] }, \"\\u00A2\" => { wx: 544, boundingbox: [56, -14, 488, 706] }, \"\\u00A3\" => { wx: 544, boundingbox: [34, -14, 508, 705] }, \"\\u00A4\" => { wx: 910, boundingbox: [35, 40, 875, 651] }, \"\\u00A5\" => { wx: 667, boundingbox: [35, -14, 633, 705] }, \"\\u00A6\" => { wx: 760, boundingbox: [35, -14, 726, 705] }, \"\\u00A7\" => { wx: 760, boundingbox: [0, 121, 758, 569] }, \"\\u00A8\" => { wx: 776, boundingbox: [35, 0, 741, 705] }, \"\\u00A9\" => { wx: 595, boundingbox: [34, -14, 560, 705] }, \"\\u00AA\" => { wx: 694, boundingbox: [35, -14, 659, 705] }, \"\\u00AB\" => { wx: 626, boundingbox: [34, 0, 591, 705] }, \"\\u00AC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00AF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00B9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00BF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C4\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C5\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C6\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C7\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C8\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00C9\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CA\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CB\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CC\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CD\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CE\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00CF\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D0\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D1\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D2\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D3\" => { wx: 788, boundingbox: [35, -14, 754, 705] }, \"\\u00D4\" => { wx: 894, boundingbox: [35, 58, 860, 634] }, \"\\u00D5\" => { wx: 838, boundingbox: [35, 152, 803, 540] }, \"\\u00D6\" => { wx: 1016, boundingbox: [34, 152, 981, 540] }, \"\\u00D7\" => { wx: 458, boundingbox: [35, -127, 422, 820] }, \"\\u00D8\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00D9\" => { wx: 924, boundingbox: [35, 140, 890, 552] }, \"\\u00DA\" => { wx: 748, boundingbox: [35, 94, 698, 597] }, \"\\u00DB\" => { wx: 918, boundingbox: [35, 166, 884, 526] }, \"\\u00DC\" => { wx: 927, boundingbox: [35, 32, 892, 660] }, \"\\u00DD\" => { wx: 928, boundingbox: [35, 129, 891, 562] }, \"\\u00DE\" => { wx: 928, boundingbox: [35, 128, 893, 563] }, \"\\u00DF\" => { wx: 834, boundingbox: [35, 155, 799, 537] }, \"\\u00E0\" => { wx: 873, boundingbox: [35, 93, 838, 599] }, \"\\u00E1\" => { wx: 828, boundingbox: [35, 104, 791, 588] }, \"\\u00E2\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E3\" => { wx: 924, boundingbox: [35, 98, 889, 594] }, \"\\u00E4\" => { wx: 917, boundingbox: [35, 0, 882, 692] }, \"\\u00E5\" => { wx: 930, boundingbox: [35, 84, 896, 608] }, \"\\u00E6\" => { wx: 931, boundingbox: [35, 84, 896, 608] }, \"\\u00E7\" => { wx: 463, boundingbox: [35, -99, 429, 791] }, \"\\u00E8\" => { wx: 883, boundingbox: [35, 71, 848, 623] }, \"\\u00E9\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EA\" => { wx: 836, boundingbox: [35, 44, 802, 648] }, \"\\u00EB\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00EC\" => { wx: 867, boundingbox: [35, 101, 832, 591] }, \"\\u00ED\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EE\" => { wx: 696, boundingbox: [35, 44, 661, 648] }, \"\\u00EF\" => { wx: 874, boundingbox: [35, 77, 840, 619] }, \"\\u00F1\" => { wx: 874, boundingbox: [35, 73, 840, 615] }, \"\\u00F2\" => { wx: 760, boundingbox: [35, 0, 725, 692] }, \"\\u00F3\" => { wx: 946, boundingbox: [35, 160, 911, 533] }, \"\\u00F4\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F5\" => { wx: 865, boundingbox: [35, 207, 830, 481] }, \"\\u00F6\" => { wx: 771, boundingbox: [34, 37, 736, 655] }, \"\\u00F7\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00F8\" => { wx: 967, boundingbox: [35, 124, 932, 568] }, \"\\u00F9\" => { wx: 888, boundingbox: [34, -19, 853, 712] }, \"\\u00FA\" => { wx: 831, boundingbox: [35, 113, 796, 579] }, \"\\u00FB\" => { wx: 873, boundingbox: [36, 118, 838, 578] }, \"\\u00FC\" => { wx: 927, boundingbox: [35, 150, 891, 542] }, \"\\u00FD\" => { wx: 970, boundingbox: [35, 76, 931, 616] }, \"\\u00FE\" => { wx: 918, boundingbox: [34, 99, 884, 593] } }\n # make two correlating arrays (indexes reffer to the same data), one for font names and the other for the fonts matrics.\n fonts_metrics_array = [times_metrics, times_bold_metrics, times_italic_metrics, times_bolditalic_metrics,\n helvetica_metrics, helvetica_bold_metrics, helvetica_oblique_metrics, helvetica_oblique_metrics,\n courier_metrics, courier_bold_metrics, courier_oblique_metrics, courier_boldoblique_metrics,\n symbol_metrics, zapfdingbats_metrics]\n fonts_names_array = [:\"Times-Roman\",\n :\"Times-Bold\",\n :\"Times-Italic\",\n :\"Times-BoldItalic\",\n :Helvetica,\n :\"Helvetica-Bold\",\n :\"Helvetica-BoldOblique\",\n :\"Helvetica-Oblique\",\n :Courier,\n :\"Courier-Bold\",\n :\"Courier-Oblique\",\n :\"Courier-BoldOblique\",\n :Symbol,\n :ZapfDingbats]\n\n # create the font object and register the font for each one of the 14 fonts\n fonts_names_array.each_index do |i|\n CombinePDF::Fonts.register_font fonts_names_array[i], fonts_metrics_array[i], Type: :Font, Subtype: :Type1, BaseFont: fonts_names_array[i]\n end\n end",
"def parse_fnt_file(filename)\n fontFile = File.open(filename)\n \n fontFile.each_line { |line|\n \n entries = line.split(\" \")\n \n case entries[0]\n # Info about the font\n when \"info\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"size\", \"stretchH\", \"spacing\", \"outline\"\n @info[key_value[0].to_sym] = key_value[1].to_i\n when \"bold\", \"italic\", \"unicode\", \"smooth\", \"aa\"\n @info[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info common to all characters\n when \"common\"\n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"lineHeight\", \"base\", \"scaleW\", \"scaleH\", \"pages\"\n @common[key_value[0].to_sym] = key_value[1].to_i\n when \"packed\"\n @common[key_value[0].to_sym] = (key_value[1].to_i == 1)\n end\n end\n \n # Info about the bitmap pages that contain the characters\n when \"page\"\n page = Page.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\"\n page[key_value[0].to_sym] = key_value[1].to_i\n when \"file\"\n page[key_value[0].to_sym] = key_value[1].tr(\"\\\"\", \"\")\n end\n end\n \n @pages[page.id] = page\n \n # Info about individual characters\n when \"char\"\n char = Char.new\n \n for i in 1...entries.length\n key_value = entries[i].split(\"=\")\n case key_value[0]\n when \"id\", \"x\", \"y\", \"width\", \"height\", \"xoffset\", \"yoffset\", \"xadvance\", \"page\"\n char[key_value[0].to_sym] = key_value[1].to_i\n end\n end\n \n @chars[char.id] = char\n end\n }\n end",
"def update\n @project = Project.find(params[:project_id])\n @font_set = @project.font_sets.find(params[:id])\n @font_families = get_font_family_array(@project)\n respond_to do |format|\n if @font_set.update(font_set_params)\n format.html { redirect_to project_details_url(@project), notice: 'Font set was successfully updated.' }\n format.json { render :show, status: :ok, location: @font_set }\n else\n format.html { render :edit }\n format.json { render json: @font_set.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set(asset,new_value,slide_name_or_index)\n\t\t\t# TODO: how to support non-ttf fonts?\n\t\t\tsuper( asset, new_value.sub(%r{^\\.[/\\\\]},'').sub(%r{^fonts[/\\\\]},'').sub(%r{\\.ttf$},''), slide_name_or_index )\n\t\tend",
"def change_column_font(col, change_type, arg, font, xf_id)\n validate_workbook\n validate_nonnegative(col)\n increase_columns(col)\n\n i = get_cols_index(col)\n\n # Modify font array and retrieve new font id\n font_id = modify_font(@workbook, font, xf_id[:fontId].to_s)\n # Get copy of xf object with modified font id\n xf = deep_copy(xf_id)\n xf[:fontId] = Integer(font_id)\n # Modify xf array and retrieve new xf id\n modify_xf(@workbook, xf)\n\n change_cols(i, col)\n\n @sheet_data.each_with_index do |row, i|\n c = row[col]\n unless c.nil?\n font_switch(c, change_type, arg)\n end\n end\n end",
"def parse_font_options(options = {})\n return if (options.keys & [:fg_color, :sz, :b, :i, :u, :strike, :outline, :shadow, :charset, :family, :font_name]).empty?\n\n Axlsx.instance_values_for(fonts.first).each do |key, value|\n # Thanks for that 1.8.7 - cant do a simple merge...\n options[key.to_sym] = value unless options.key?(key.to_sym)\n end\n font = Font.new(options)\n font.color = Color.new(rgb: options[:fg_color]) if options[:fg_color]\n font.name = options[:font_name] if options[:font_name]\n options[:type] == :dxf ? font : fonts << font\n end",
"def fonts(workbook, _center, heading, _colors)\n worksheet = workbook.add_worksheet('Fonts')\n\n worksheet.set_column(0, 0, 30)\n worksheet.set_column(1, 1, 10)\n\n worksheet.write(0, 0, \"Font name\", heading)\n worksheet.write(0, 1, \"Font size\", heading)\n\n fonts = []\n fonts << [10, 'Arial']\n fonts << [12, 'Arial']\n fonts << [14, 'Arial']\n fonts << [12, 'Arial Black']\n fonts << [12, 'Arial Narrow']\n fonts << [12, 'Century Schoolbook']\n fonts << [12, 'Courier']\n fonts << [12, 'Courier New']\n fonts << [12, 'Garamond']\n fonts << [12, 'Impact']\n fonts << [12, 'Lucida Handwriting']\n fonts << [12, 'Times New Roman']\n fonts << [12, 'Symbol']\n fonts << [12, 'Wingdings']\n fonts << [12, 'A font that doesn\\'t exist']\n\n i = 0\n fonts.each do |font|\n format = workbook.add_format\n\n format.set_size(font[0])\n format.set_font(font[1])\n\n i += 1\n worksheet.write(i, 0, font[1], format)\n worksheet.write(i, 1, font[0], format)\n end\n end",
"def set_fonts\n font_families.update Elegant.configuration.fonts\n fallback_fonts ['Fallback']\n end",
"def convert_font_args(params)\n return unless params\n font = {\n :_name => params[:name],\n :_color => params[:color],\n :_size => params[:size],\n :_bold => params[:bold],\n :_italic => params[:italic],\n :_underline => params[:underline],\n :_pitch_family => params[:pitch_family],\n :_charset => params[:charset],\n :_baseline => params[:baseline] || 0\n }\n\n # Convert font size units.\n font[:_size] *= 100 if font[:_size] && font[:_size] != 0\n\n font\n end",
"def update!(**args)\n @font_id = args[:font_id] if args.key?(:font_id)\n @font_size = args[:font_size] if args.key?(:font_size)\n @median_height = args[:median_height] if args.key?(:median_height)\n @median_line_height = args[:median_line_height] if args.key?(:median_line_height)\n @median_line_space = args[:median_line_space] if args.key?(:median_line_space)\n @median_line_span = args[:median_line_span] if args.key?(:median_line_span)\n @median_width = args[:median_width] if args.key?(:median_width)\n @num_line_spaces = args[:num_line_spaces] if args.key?(:num_line_spaces)\n @num_lines = args[:num_lines] if args.key?(:num_lines)\n @num_symbols = args[:num_symbols] if args.key?(:num_symbols)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def change_font_name(new_font_name = 'Verdana')\n validate_worksheet\n\n font = get_cell_font.dup\n font.set_name(new_font_name)\n update_font_references(font)\n end",
"def convert_fonts\n out = \"\"\n sass.each_line do |line|\n line.gsub!(/(\\s*)(word-spacing|letter-spacing|font-size|line-height|margin-[^\\s]+|margin|padding-[\\s]+|padding)\\s*:(.*)/) do |m|\n # indent rule: value\n m = \"#{$1}#{$2}: #{CSS.val_to_em($3)}\"\n end\n out << line\n end\n self.sass = out\n end",
"def add_font font\n @fonts.push(font).uniq! if font\n font\n end",
"def pbSetSystemFont(bitmap)\n fontname=MessageConfig.pbGetSystemFontName\n bitmap.font.name=fontname\n if fontname==\"Pokemon FireLeaf With BLD\" || fontname==\"Power Red and Green With BLD\"\n bitmap.font.size=29\n elsif fontname==\"Pokemon Emerald Small With BLD\" || fontname==\"Power Green Small With BLD\"\n bitmap.font.size=25\n else\n bitmap.font.size=31\n end\nend",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf)\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def font_set(regex, &block)\n Ray::FontSet.add_set(regex, &block)\n end",
"def read_styles(doc)\n @numFmts = []\n @cellXfs = []\n fonts = []\n \n #TODO: doc.find(\"//*[local-name()='numFmt']\").each do |numFmt|\n doc.xpath(\"//*[local-name()='numFmt']\").each do |numFmt|\n # TODO: numFmtId = numFmt.attributes.to_h['numFmtId']\n numFmtId = numFmt.attributes['numFmtId']\n #TODO: formatCode = numFmt.attributes.to_h['formatCode']\n formatCode = numFmt.attributes['formatCode']\n @numFmts << [numFmtId, formatCode]\n end\n #TODO: doc.find(\"//*[local-name()='fonts']\").each do |fonts_el|\n doc.xpath(\"//*[local-name()='fonts']\").each do |fonts_el|\n #TODO: fonts_el.each_element do |font_el|\n fonts_el.children.each do |font_el|\n #TODO: if font_el.name == 'font'\n if font_el == 'font'\n font = Excelx::Font.new\n font_el.each_element do |font_sub_el|\n case font_sub_el.name\n when 'b'\n font.bold = true\n when 'i'\n font.italic = true\n when 'u'\n font.underline = true\n end\n end\n fonts << font\n end\n end\n end\n \n #TODO: doc.find(\"//*[local-name()='cellXfs']\").each do |xfs|\n doc.xpath(\"//*[local-name()='cellXfs']\").each do |xfs|\n xfs.children.each do |xf|\n #TODO: numFmtId = xf.attributes.to_h['numFmtId']\n numFmtId = xf['numFmtId']\n @cellXfs << [numFmtId]\n #TODO: fontId = xf.attributes.to_h['fontId'].to_i\n fontId = xf['fontId'].to_i\n @style_definitions << fonts[fontId]\n end\n end\n end",
"def SetFont(family, style='', size=0)\n\t\t# save previous values\n\t\t@prevfont_family = @font_family;\n\t\t@prevfont_style = @font_style;\n\n\t\tfamily=family.downcase;\n\t\tif (family=='')\n\t\t\tfamily=@font_family;\n\t\tend\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\telsif ((family==\"symbol\") or (family==\"zapfdingbats\"))\n\t\t\tstyle='';\n\t\tend\n\t\t\n\t\tstyle=style.upcase;\n\n\t\tif (style.include?('U'))\n\t\t\t@underline=true;\n\t\t\tstyle= style.gsub('U','');\n\t\telse\n\t\t\t@underline=false;\n\t\tend\n\t\tif (style.include?('D'))\n\t\t\t@deleted=true;\n\t\t\tstyle= style.gsub('D','');\n\t\telse\n\t\t\t@deleted=false;\n\t\tend\n\t\tif (style=='IB')\n\t\t\tstyle='BI';\n\t\tend\n\t\tif (size==0)\n\t\t\tsize=@font_size_pt;\n\t\tend\n\n\t\t# try to add font (if not already added)\n\t\tAddFont(family, style);\n\t\t\n\t\t#Test if font is already selected\n\t\tif ((@font_family == family) and (@font_style == style) and (@font_size_pt == size))\n\t\t\treturn;\n\t\tend\n\t\t\n\t\tfontkey = family + style;\n\t\tstyle = '' if (@fonts[fontkey].nil? and !@fonts[family].nil?)\n \n\t\t#Test if used for the first time\n\t\tif (@fonts[fontkey].nil?)\n\t\t\t#Check if one of the standard fonts\n\t\t\tif (!@core_fonts[fontkey].nil?)\n\t\t\t\tif @@fpdf_charwidths[fontkey].nil?\n\t\t\t\t\t#Load metric file\n\t\t\t\t\tfile = family;\n\t\t\t\t\tif ((family!='symbol') and (family!='zapfdingbats'))\n\t\t\t\t\t\tfile += style.downcase;\n\t\t\t\t\tend\n\t\t\t\t\tif (getfontpath(file + '.rb').nil?)\n\t\t\t\t\t\t# try to load the basic file without styles\n\t\t\t\t\t\tfile = family;\n\t\t\t\t\t\tfontkey = family;\n\t\t\t\t\tend\n\t\t\t\t\trequire(getfontpath(file + '.rb'));\n \t\tfont_desc = TCPDFFontDescriptor.font(file)\n\t\t\t\t\tif ((@is_unicode and ctg.nil?) or ((!@is_unicode) and (@@fpdf_charwidths[fontkey].nil?)) )\n\t\t\t\t\t\tError(\"Could not include font metric file [\" + fontkey + \"]: \" + getfontpath(file + \".rb\"));\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti = @fonts.length + 1;\n\n\t\t\t\tif (@is_unicode)\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\telse\n\t\t\t\t\t@fonts[fontkey] = {'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tError('Undefined font: ' + family + ' ' + style);\n\t\t\tend\n\t\tend\n\t\t#Select it\n\t\t@font_family = family;\n\t\t@font_style = style;\n\t\t@font_size_pt = size;\n\t\t@font_size = size / @k;\n\t\t@current_font = @fonts[fontkey]; # was & may need deep copy?\n\t\tif (@page>0)\n\t\t\tout(sprintf('BT /F%d %.2f Tf ET', @current_font['i'], @font_size_pt));\n\t\tend\n\tend",
"def load_font(family, height)\n end",
"def AddFont(family, style='', file='')\n\t\tif (family.empty?)\n\t\t\treturn;\n\t\tend\n\n\t\t#Add a TrueType or Type1 font\n\t\tfamily = family.downcase\n\t\tif ((!@is_unicode) and (family == 'arial'))\n\t\t\tfamily = 'helvetica';\n\t\tend\n\n\t\tstyle=style.upcase\n\t\tstyle=style.gsub('U','');\n\t\tstyle=style.gsub('D','');\n\t\tif (style == 'IB')\n\t\t\tstyle = 'BI';\n\t\tend\n\n\t\tfontkey = family + style;\n\t\t# check if the font has been already added\n\t\tif !@fonts[fontkey].nil?\n\t\t\treturn;\n\t\tend\n\n\t\tif (file=='')\n\t\t\tfile = family.gsub(' ', '') + style.downcase + '.rb';\n\t\tend\n\t\tfont_file_name = getfontpath(file)\n\t\tif (font_file_name.nil?)\n\t\t\t# try to load the basic file without styles\n\t\t\tfile = family.gsub(' ', '') + '.rb';\n \t\tfont_file_name = getfontpath(file)\n\t\tend\n if font_file_name.nil?\n\t\t\tError(\"Could not find font #{file}.\")\n end\n\t\trequire(getfontpath(file))\n\t\tfont_desc = TCPDFFontDescriptor.font(file)\n\n\t\tif (font_desc[:name].nil? and @@fpdf_charwidths.nil?)\n\t\t\tError('Could not include font definition file');\n\t\tend\n\n\t\ti = @fonts.length+1;\n\t\tif (@is_unicode)\n\t\t\t@fonts[fontkey] = {'i' => i, 'type' => font_desc[:type], 'name' => font_desc[:name], 'desc' => font_desc[:desc], 'up' => font_desc[:up], 'ut' => font_desc[:ut], 'cw' => font_desc[:cw], 'enc' => font_desc[:enc], 'file' => font_desc[:file], 'ctg' => font_desc[:ctg], 'cMap' => font_desc[:cMap], 'registry' => font_desc[:registry]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\telse\n\t\t\t@fonts[fontkey]={'i' => i, 'type'=>'core', 'name'=>@core_fonts[fontkey], 'up'=>-100, 'ut'=>50, 'cw' => font_desc[:cw]}\n\t\t\t@@fpdf_charwidths[fontkey] = font_desc[:cw];\n\t\tend\n\n\t\tif (!font_desc[:diff].nil? and (!font_desc[:diff].empty?))\n\t\t\t#Search existing encodings\n\t\t\td=0;\n\t\t\tnb=@diffs.length;\n\t\t\t1.upto(nb) do |i|\n\t\t\t\tif (@diffs[i]== font_desc[:diff])\n\t\t\t\t\td = i;\n\t\t\t\t\tbreak;\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (d==0)\n\t\t\t\td = nb+1;\n\t\t\t\t@diffs[d] = font_desc[:diff];\n\t\t\tend\n\t\t\t@fonts[fontkey]['diff'] = d;\n\t\tend\n\t\tif (font_desc[:file] and font_desc[:file].length > 0)\n\t\t\tif (font_desc[:type] == \"TrueType\") or (font_desc[:type] == \"TrueTypeUnicode\")\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:originalsize]}\n\t\t\telse\n\t\t\t\t@font_files[font_desc[:file]] = {'length1' => font_desc[:size1], 'length2' => font_desc[:size2]}\n\t\t\tend\n\t\tend\n\tend",
"def change_column_font(column_index, change_type, arg, font, xf)\n validate_workbook\n ensure_cell_exists(0, column_index)\n\n xf = workbook.register_new_font(font, xf)\n cols.get_range(column_index).style_index = workbook.register_new_xf(xf, get_col_style(column_index))\n\n sheet_data.rows.each { |row|\n c = row && row[column_index]\n c.font_switch(change_type, arg) unless c.nil?\n }\n end",
"def set_data_font(data_type)\n @maqj_default_font = contents.font.dup unless @maqj_default_font\n contents.font.name = QuestData::FONTNAMES[data_type] ? \n QuestData::FONTNAMES[data_type] : @maqj_default_font.name\n contents.font.size = QuestData::FONTSIZES[data_type] ? \n QuestData::FONTSIZES[data_type] : @maqj_default_font.size\n contents.font.bold = QuestData::FONTBOLDS.keys.include?(data_type) ? \n QuestData::FONTBOLDS[data_type] : @maqj_default_font.bold\n contents.font.italic = QuestData::FONTITALICS.keys.include?(data_type) ?\n QuestData::FONTITALICS[data_type] : @maqj_default_font.italic\n case data_type\n when :objectives then change_color(@maqj_objective_color) if @maqj_objective_color\n when :name then change_color(quest_name_colour(@quest)) if @quest\n else\n change_color(text_color(QuestData::COLOURS[data_type])) if QuestData::COLOURS.keys.include?(data_type)\n end\n end",
"def change_row_font_name(row=0, font_name='Verdana')\n # Get style object\n xf_id = xf_id(get_row_style(row))\n # Get copy of font object with modified name\n font = deep_copy(@workbook.fonts[xf_id[:fontId].to_s][:font])\n font[:name][:attributes][:val] = font_name.to_s\n # Update font and xf array\n change_row_font(row, Worksheet::NAME, font_name, font, xf_id)\n end",
"def load_single_font(name)\n\n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end",
"def fonts\n package 'ttf-freefarsi', :ensure => :installed\n package 'ttf-farsiweb', :ensure => :installed\n end",
"def update!(**args)\n @font_color = args[:font_color] if args.key?(:font_color)\n @format_type = args[:format_type] if args.key?(:format_type)\n end",
"def set_font_from_path(font, bold_font)\n font_name = Pathname.new(font).basename\n @pdf.font_families.update(\n \"#{font_name}\" => {\n normal: font,\n italic: font,\n bold: bold_font,\n bold_italic: bold_font\n }\n )\n @pdf.font(font_name)\n end",
"def new_font(*args)\n font = Font.new\n return font_config_abs(font, *args)\n end",
"def set_font(face, size)\n @curr_font = Gauges::FontRef.get(face, size)\n end",
"def fonts_list\n initiate_library\n FONTS_LIBRARY.keys\n end",
"def load_single_font(name)\n \n # Determine path to font file.\n font_file_name = name.gsub(/\\s+/, \"\")\n path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}.ttf\")\n return unless File.file?(path)\n\n # Determine variants.\n italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Italic.ttf\")\n bold_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-Bold.ttf\")\n bold_italics_path = Rails.root.join('lib', 'assets', 'fonts', \"#{font_file_name}-BoldItalic.ttf\")\n\n # Build hash of variants.\n font_hash = { normal: path }\n font_hash[:italic] = italics_path if File.file?(italics_path)\n font_hash[:bold] = bold_path if File.file?(bold_path)\n font_hash[:bold_italic] = bold_italics_path if File.file?(bold_italics_path)\n\n # Add font.\n self.font_families.update(name => font_hash)\n\n end"
] |
[
"0.721714",
"0.71970063",
"0.67808133",
"0.6753224",
"0.65124375",
"0.6366285",
"0.6298438",
"0.6283791",
"0.62599903",
"0.62576646",
"0.61224043",
"0.6081554",
"0.60470194",
"0.6039597",
"0.6025617",
"0.6017465",
"0.60067147",
"0.5992943",
"0.597199",
"0.5971267",
"0.5971267",
"0.5968901",
"0.5959579",
"0.59582627",
"0.5949183",
"0.59487367",
"0.5940942",
"0.5931826",
"0.5927485",
"0.5913417",
"0.58840203",
"0.5881043",
"0.58583266",
"0.5855185",
"0.5850207",
"0.5830426",
"0.58250827",
"0.58250827",
"0.5819435",
"0.58029574",
"0.5795055",
"0.5779306",
"0.5761488",
"0.57607675",
"0.57603174",
"0.5755689",
"0.57459134",
"0.5735969",
"0.57332975",
"0.57322454",
"0.57110995",
"0.56730855",
"0.5664528",
"0.566137",
"0.5660012",
"0.5635439",
"0.5606747",
"0.56025124",
"0.55982727",
"0.55982375",
"0.5586931",
"0.55740947",
"0.55686456",
"0.5566737",
"0.5561219",
"0.5558625",
"0.5557603",
"0.5556244",
"0.5551042",
"0.5550958",
"0.55492306",
"0.5538554",
"0.5530782",
"0.5509098",
"0.5508653",
"0.55014515",
"0.5495445",
"0.5489188",
"0.5489188",
"0.548593",
"0.5443517",
"0.5436568",
"0.5423377",
"0.5408482",
"0.54033244",
"0.5394496",
"0.53925824",
"0.5388655",
"0.53869873",
"0.53867406",
"0.53729784",
"0.5364064",
"0.535254",
"0.53459585",
"0.5344788",
"0.5330471",
"0.5320061",
"0.5313868",
"0.5305007"
] |
0.69522786
|
2
|
Performs correct modification based on what type of change_type is specified
|
def font_switch(change_type, arg)
case change_type
when Worksheet::NAME then change_font_name(arg)
when Worksheet::SIZE then change_font_size(arg)
when Worksheet::COLOR then change_font_color(arg)
when Worksheet::ITALICS then change_font_italics(arg)
when Worksheet::BOLD then change_font_bold(arg)
when Worksheet::UNDERLINE then change_font_underline(arg)
when Worksheet::STRIKETHROUGH then change_font_strikethrough(arg)
else raise 'Invalid change_type'
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def change_type=(value)\n @change_type = value\n end",
"def change_type\n return @change_type\n end",
"def change?\n type == 'change'\n end",
"def changeType(newType)\n\t\t\t#remove accessors for old type\n\t\t\tremoveAccessors()\n\t\t\t@type = newType\n\n\t\t\t#produce accessors for the newly set type\n\t\t\tproduceAccessors()\n\t\tend",
"def change_type_set?\n self.change_type\n end",
"def change_type(prev_type, new_type, key)\n require_writeable_layers!\n file = get(prev_type, key)\n store_immediately!(new_type, file)\n layers.immediate.writeable.each do |layer|\n layer.delete(prev_type, key)\n end\n if layers.delayed.writeable.any?\n Dis::Jobs::ChangeType.perform_later(prev_type, new_type, key)\n end\n key\n end",
"def record_relationship_change(field_name, change_type, change_id)\n\t\t\t\t\tself.changed_attributes_aado ||= []\n\t\t\t\t\tif change_type == :add then\n\t\t\t\t\t\tlast_change = self.changed_attributes_aado.last\n\t\t\t\t\t\t# if the last change was for this same field\n\t\t\t\t\t\tif last_change && last_change.name == field_name then\n\t\t\t\t\t\t\t# we combine the removal and add into one replace change\n\t\t\t\t\t\t\tself.changed_attributes_aado.delete_at(self.changed_attributes_aado.size-1)\n\t\t\t\t\t\t\tself.changed_attributes_aado << Change.new(field_name, last_change.old_value, change_id)\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t# its just an add\n\t\t\t\t\t\t\tself.changed_attributes_aado << Change.new(field_name, nil, change_id)\n\t\t\t\t\t\tend\n\t\t\t\t\telsif change_type == :remove then\n\t\t\t\t\t\tself.changed_attributes_aado << Change.new(field_name, change_id, nil)\n\t\t\t\t\tend\n\t\t\t \t $TRACE.debug 5, \"record_relationship_change: #{self.class}:#{self.id}: changed_attributes = #{changed_attributes_aado.inspect}\"\n\t\t\t\tend",
"def font_switch(c,change_type,arg)\n case change_type\n when Worksheet::NAME\n unless arg.is_a?String\n raise 'Not a String'\n end\n c.change_font_name(arg)\n when Worksheet::SIZE\n unless arg.is_a?(Integer) || arg.is_a?(Float)\n raise 'Not a Number'\n end\n c.change_font_size(arg)\n when Worksheet::COLOR\n Color.validate_color(arg)\n c.change_font_color(arg)\n when Worksheet::ITALICS\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_italics(arg)\n when Worksheet::BOLD\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_bold(arg)\n when Worksheet::UNDERLINE\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_underline(arg)\n when Worksheet::STRIKETHROUGH\n unless arg == !!arg\n raise 'Not a boolean'\n end\n c.change_font_strikethrough(arg)\n else\n raise 'Invalid change_type'\n end\n end",
"def change_type_of_issue(issue_name, new_type_id)\n\tissue = @client.Issue.find(issue_name)\n\tissue.save({\"fields\"=>{\"issuetype\"=>{\"id\"=>new_type_id}}})\nend",
"def process_genomic_change(genotype, record)\n genomic_change = record.raw_fields['genomicchange']\n case genomic_change.strip\n when /NC_0*(?<chr_num>\\d+)\\.\\d+:g\\.(?<genomicchange>.+)/i\n genotype.add_parsed_genomic_change($LAST_MATCH_INFO[:chr_num].to_i,\n $LAST_MATCH_INFO[:genomicchange])\n when nil, ''\n @logger.warn 'Genomic change was empty'\n else\n @logger.warn 'Genomic change did not match expected format,'\\\n \"adding raw: #{genomic_change}\"\n genotype.add_raw_genomic_change(genomic_change)\n end\n end",
"def mutate!(type)\n set_type(type)\n end",
"def type\n if changes.length > 0 && changes[0].defect_type\n \"#{changes[0].defect_type.capitalize} \"\n else\n \"\"\n end\n end",
"def replace_update_type # abstract\n raise 'abstract'\n end",
"def run(changes)\n changes.each do |(id, salesforce_model), accumulator|\n next unless salesforce_model == @mapping.salesforce_model\n\n database_instance = @mapping.database_record_type.find(id)\n salesforce_instance = @mapping.salesforce_record_type.find(id)\n next unless database_instance && salesforce_instance\n\n update(database_instance, accumulator) if @strategy.to_database?\n update(salesforce_instance, accumulator) if @strategy.to_salesforce?\n end\n end",
"def can_change_type?\n new_record? || self.class.valid_migration_paths[self.field_type].present?\n end",
"def get_data(type, change_id = nil)\n case type\n when \"details\"\n when \"messages\"\n when \"basic\"\n else\n end\nend",
"def change_type\n\t\t\trender json: User.update_type_by_id(params[:id], params[:type], params[:is])\n\t\tend",
"def type= new_type\n @gapi.update! type: verify_type(new_type)\n end",
"def change(params); end",
"def changeMetadataType\n begin\n old_type = params[:metadatatypename].to_s.strip.downcase\n new_type = params[:new_metadata_type].to_s.strip.downcase\n puts \"old_t: \" + old_type\n puts \"new_t: \" + new_type\n\n if old_type == \"\"\n render :text => \"Type of metadata not given\", :status => 404\n return\n end\n\n if new_type == \"\"\n render :text => \"Type of new metadata not given\", :status => 404\n return\n end\n\n # Find old metadata type\n @metadatatype = MetadataType.find_by_name(old_type)\n\n # If old metadata type was not found\n if @metadatatype == nil\n render :text => \"Old metadata type not found\", :status => 404\n return\n end\n\n # Check that new type doesn't exist already\n # @@existing_metadata_types listed in the beginning of file\n if MetadataType.find_by_name(new_type) or @@existing_metadata_types.include?(new_type)\n render :text => \"Type of new metadata already exists\", :status => 404\n return\n end\n\n # Change metadata type name\n @metadatatype.update_attribute(:name, new_type)\n render :text => \"Metadata type changed\", :status => 200\n return\n\n rescue => e\n puts \"Error in changing metadatatype: #{e.to_s}\".background(:red)\n render :text => \"Conflict\", :status => 409\n return\n end\n end",
"def set_type\n case content\n when \"empty\" then self.content_type = \"empty\"\n when /ire/ then self.content_type = \"ire\"\n when /hill|tree/ then self.content_type = \"obstacle\"\n when /axe|sword|lance/ then self.content_type = \"enemy\"\n else raise \"Change type\"\n end\n end",
"def update\n\n @specline_update = @specline\n #private method to update txt1 values following change to specline_line linetype\n \n old_linetype = Linetype.find(@specline.linetype_id)\n new_linetype = Linetype.find(params[:specline][:linetype_id]) \n \n if old_linetype.txt1 != new_linetype.txt1 \n txt1_change_linetype(@specline, old_linetype, new_linetype)\n if !@subsequent_prefixes.blank?\n @subsequent_prefixes.compact\n end \n end\n #call to private method that records change to line in Changes table\n \n #only record change if linetype is changed ignoring txt1 \n old_linetype_array = [old_linetype.txt3, old_linetype.txt4, old_linetype.txt5, old_linetype.txt6] \n new_linetype_array = [new_linetype.txt3, new_linetype.txt4, new_linetype.txt5, new_linetype.txt6] \n if new_linetype_array != old_linetype_array\n record_change \n end\n #if new linetype is for product data set identity and perform value pairs to 'not specified'\n if [10,11].include?(params[:specline][:linetype_id])\n @specline_update.update_attributes(:linetype_id => new_linetype.id, :perform_id => 1, :identity_id => 1)\n else\n @specline_update.update_attributes(params[:specline])\n end \n \n end",
"def change_type_required?\n self.change_class_set? && self.change_class.change_types.size > 0\n end",
"def global_registry_relationship_change_action(type)\n [global_registry_relationship(type).primary_foreign_key,\n global_registry_relationship(type).related_foreign_key].each do |key|\n if previous_changes.key?(key)\n # Delete if changed from anything to nil\n return :delete if previous_changes[key].last.nil?\n # Replace if value changed\n return :replace if previous_changes[key].first != previous_changes[key].last &&\n !previous_changes[key].first.nil?\n elsif key.present? && send(key).nil?\n # Ignore if value didn't change and foreign_key is nil\n return :ignore\n end\n end\n # otherwise Create/Update\n :push\n end",
"def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @change_type = args[:change_type] if args.key?(:change_type)\n @index = args[:index] if args.key?(:index)\n end",
"def update_type\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname){\"params=#{params.inspect}\"}\n\t\t@object_plm = Customer.find(params[:id])\n\t\tctrl_update_type @object_plm, params[:object_type]\n\tend",
"def can_change( record, type = '*' )\n name, type = get_name_and_type_from_param( record, type )\n self.permissions['allowed'] << [ name, type ]\n end",
"def modify( inputs, type )\n if subfilter\n inputs = subfilter.modify( inputs, type )\n end\n result = self.transforms( inputs, type )\n return result \n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def change\n # just use this for now\nend",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def update!(**args)\n @type = args[:type] if args.key?(:type)\n end",
"def can_modify\n\t\tself.changed_attributes.each do |attr|\n\n\t\t\tif attr.to_s == \"reports\"\n\t\t\t\tself.reports.each do |r|\n\t\t\t\t\tunless r.changed_attributes.blank?\n\t\t\t\t\t\tif r.owner_ids.include? self.created_by_user_id\n\t\t\t\t\t\telsif r.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself.errors.add(:reports,\"You cannot edit #{attr.name.to_s}\")\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\n\t\t\telsif attr.to_s == \"recipients\"\n\t\t\t\trecipients_changed\n\t\t\telsif attr.to_s == \"payments\"\n\t\t\t\told_payment_not_deleted\n\t\t\telse\n\t\t\t\t## only in case of \n\t\t\t\tif self.owner_ids.include? self.created_by_user.id.to_s\n\t\t\t\telsif self.owner_ids.include? self.created_by_user.organization.id.to_s\n\t\t\t\telse\n\t\t\t\t\tself.errors.add(:owner_ids,\"You cannot edit the field: #{attr.to_s}\")\n\t\t\t\tend\n\t\t\tend\n\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @affected_type.update(affected_type_params)\n format.html { redirect_to @affected_type, notice: 'Affected type was successfully updated.' }\n format.json { render :show, status: :ok, location: @affected_type }\n else\n format.html { render :edit }\n format.json { render json: @affected_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(type, *args)\n change_class = Duxml::const_get \"#{type.to_s}Class\".to_sym\n change_comp = change_class.new *args\n @nodes.unshift change_comp\n changed\n notify_observers(change_comp) unless change_comp.respond_to?(:error?)\n raise(Exception, change_comp.description) if strict? && type == :QualifyError\n end",
"def time_type=(new_time_type)\n write_attribute(:time_type, new_time_type)\n swap_start_finish\n end",
"def update\n respond_to do |format|\n if @comment_status_type.update(comment_status_type_params)\n if @comment_status_type.previous_changes.any?\n save_change_log(current_user,{object_type: 'comment status type', action_type: 'edit', description: \"edited comment status type ID ##{@comment_status_type.id} to '#{@comment_status_type.status_text}', '#{@comment_status_type.color_name}'\"})\n end\n format.html { redirect_to comment_status_types_path, notice: 'Comment status type was successfully updated.' }\n format.json { render :show, status: :ok, location: @comment_status_type }\n else\n set_select_options\n format.html { render :edit }\n format.json { render json: @comment_status_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def can_change?( record, type = '*' )\n name, type = get_name_and_type_from_param( record, type )\n\n # NS records?\n return false if type == 'NS' || type == 'SOA'\n\n # Type protected?\n return false if self.permissions['protected_types'].include?( type )\n\n # RR protected?\n return false if self.permissions['protected'].detect do |r|\n r[0] == name && (r[1] == type || r[1] == '*' || type == '*')\n end\n\n # Allowed?\n return true if self.permissions['allowed'].detect do |r|\n r[0] == name && (r[1] == type || r[1] == '*' || type == '*')\n end\n\n # Default policy\n return self.permissions['policy'] == 'allow'\n end",
"def change\n attributes.fetch(:change)\n end",
"def tell_change(change)\n puts \"You will need to give the customer\"\n if change[:dollars] !=0\n puts \"#{change[:dollars]} dollars\"\n else\n puts \"\"\n end\n if change[:quarters] != 0\n puts \"#{change[:quarters]} quarters\"\n else\n puts \"\"\n end\n if change[:dimes] != 0\n puts \"#{change[:dimes]} dimes\"\n else\n puts \"\"\n end\n if change[:nickels] != 0\n puts \"#{change[:nickels]} nickels\"\n else\n puts \"\"\n end\n if change[:pennies] != 0\n puts \"#{change[:pennies]} pennies\"\n else\n puts \"\"\n end\n end",
"def should_skip_based_on?(old_type)\n if old_type != CURRENT_TYPE_TO_REPLACE\n return true\n end\n\n false\nend",
"def test_truth\n assert_kind_of Change, @change\n end",
"def change\n change_column(:table_name, :column_name, :new_type)\nend",
"def change_branch(branch_type, event_type, old_branch, new_branch)\n body =\n case event_type.to_s\n when 'delete'\n \"deleted the `#{old_branch}` branch. This merge request now targets the `#{new_branch}` branch\"\n when 'update'\n \"changed #{branch_type} branch from `#{old_branch}` to `#{new_branch}`\"\n else\n raise ArgumentError, \"invalid value for event_type: #{event_type}\"\n end\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'branch'))\n end",
"def update_type\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname){\"params=#{params.inspect}\"}\n\t\t@relation = Relation.find(params[:id])\n\t\t@types = Typesobject.get_types(\"relation\")\n\t\t@status = Statusobject.get_status(\"relation\")\n\t\tctrl_update_type @relation, params[:object_type]\n\tend",
"def set_content_type old_type, old_resource_type, new_type, new_resource_type\n xml=self.ng_xml\n xml.search('/contentMetadata[@type=\\''+old_type+'\\']').each do |node|\n node['type']=new_type\n xml.search('//resource[@type=\\''+old_resource_type+'\\']').each do |resource|\n resource['type']=new_resource_type\n end\n end\n self.content=xml.to_s\n end",
"def after_save(change)\n timing \"Expiring change cache\"\n case change.change_type\n when Change::OWNERSHIP\n expire_item_cache(change)\n when Change::PERSON_LOCATION\n expire_map_cache(change)\n when Change::PERSON_MAIN_LOCATION\n expire_map_cache(change)\n end\n end",
"def type=(type); end",
"def create_change(change)\n Change.create(:changeset => self,\n :action => change[:action],\n :path => change[:path],\n :from_path => change[:from_path],\n :from_revision => change[:from_revision])\n end",
"def set_type\n end",
"def source_change(change, filename)\n end",
"def find_and_trigger_event(event_type, args = nil)\r\n \r\n case event_type\r\n when :before_change\r\n \r\n if respond_to?(:before_change)\r\n \r\n results = send(:before_change, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :after_change\r\n \r\n if respond_to?(:after_change)\r\n \r\n results = send(:after_change, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :before_change_field\r\n \r\n #CALL FOR A SPECIFIC FIELD THAT HAS CHANGED\r\n trigger_function_name = \"#{:before_change_field}_#{args.field_name}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n #CALL FOR ANY FIELD THAT CHANGES\r\n trigger_function_name = \"#{:before_change_field}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n when :after_change_field\r\n #looks in own class for :after_change_field for the field passed, requires the parameter of a Field object to be passed\r\n \r\n #SAPPHIRE UPDATE\r\n #SEARCH FOR ACTIVE MAP DEFINITION THAT INCLUDES THE CURRENT TABLE AND FIELD.\r\n #IF ANY ARE FOUND QUEUE THE PROCESS\r\n if args.table.field_order.include?(\"student_id\")\r\n \r\n if map_id = $tables.attach(\"SAPPHIRE_INTERFACE_MAP\").field_value(\r\n \"primary_id\",\r\n \"WHERE athena_table = '#{table_name }'\r\n AND athena_field = '#{args.field_name }'\r\n AND trigger_event = 'after_change_field'\"\r\n )\r\n \r\n sid = $tables.attach(args.table.table_name).field_value(\"student_id\", \"WHERE primary_id = '#{args.primary_id}'\")\r\n student = $students.get(sid)\r\n \r\n if student && student.active.is_true?\r\n \r\n queue_record = $tables.attach(\"SAPPHIRE_INTERFACE_QUEUE\").new_row\r\n queue_record.fields[\"map_id\" ].value = map_id\r\n queue_record.fields[\"athena_pid\" ].value = args.primary_id\r\n queue_record.save\r\n \r\n end\r\n \r\n end\r\n \r\n end\r\n \r\n #CALL FOR A SPECIFIC FIELD THAT HAS CHANGED\r\n trigger_function_name = \"#{:after_change_field}_#{args.field_name}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args) \r\n return false if results == false\r\n \r\n end\r\n \r\n #CALL FOR ANY FIELD THAT CHANGES\r\n trigger_function_name = \"#{:after_change_field}\"\r\n if respond_to?(trigger_function_name)\r\n \r\n results = send(trigger_function_name, args)\r\n return false if results == false\r\n \r\n end\r\n \r\n when :before_load #any table can have this event for self table\r\n \r\n continue_with_load = true\r\n \r\n this_trigger_event = \"before_load_#{table_name.downcase}\"\r\n \r\n tables_with_before_load_events = args ? args : event_array(this_trigger_event)\r\n \r\n tables_with_before_load_events.each{|file|\r\n this_table = $tables.attach(file)\r\n \r\n begin\r\n continue_with_load = this_table.send(this_trigger_event)\r\n \r\n rescue=> e\r\n #raise e #THIS SHOULD HAVE BEEN A SYSTEM NOTIFICATION - ADDING NOW BUT LEACING THIS NOTE HERE TO HELP IDENTIFY ANY ISSUES THAT MAY COME TO LIGHT WHICH WERE CONCEALED BY THIS BEFORE...\r\n $base.system_notification(\r\n subject = \"BEFORE LOAD FAILED - #{file}\",\r\n content = \"Don't just stand there and shout it; do something about it... Here's the error:\r\n #{e.message}\r\n <br>\r\n <br>\r\n #{e.backtrace}\"\r\n )\r\n \r\n end\r\n \r\n } if tables_with_before_load_events\r\n \r\n return continue_with_load\r\n \r\n when :after_load #any table can have this event for self table\r\n \r\n this_trigger_event = \"after_load_#{table_name.downcase}\"\r\n \r\n tables_with_after_load_events = args ? args.dup : event_array(this_trigger_event)\r\n \r\n db_config_record(\r\n field_name = \"phase_total\",\r\n new_value = tables_with_after_load_events.join(\",\")\r\n )\r\n db_config_record(\r\n field_name = \"phase_completed\",\r\n new_value = nil\r\n )\r\n \r\n if !args || args.include?(\"move_source_to_dest\")\r\n tables_with_after_load_events.delete(\"move_source_to_dest\")\r\n move_source_to_dest\r\n end\r\n \r\n tables_with_after_load_events.each{|file|\r\n this_table = $tables.attach(file)\r\n db_config_record(\r\n field_name = \"after_load_status\",\r\n new_value = \"Started #{file} - #{DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")}\"\r\n )\r\n \r\n begin\r\n this_table.send(this_trigger_event)\r\n db_config_record = $tables.attach(\"Db_Config\").by_table_name(table_name)\r\n phase_completed = db_config_record.fields[\"phase_completed\"].value\r\n phase_completed = (phase_completed ? \"#{phase_completed},#{file}\" : file)\r\n db_config_record(\r\n field_name = \"phase_completed\",\r\n new_value = phase_completed\r\n )\r\n db_config_record(\r\n field_name = \"after_load_status\",\r\n new_value = \"Completed #{file} - #{DateTime.now.strftime(\"%Y-%m-%d %H:%M:%S\")}\"\r\n )\r\n \r\n rescue=> e\r\n after_load_failed(message = \"#{file} - #{e.message} <br><br> #{e.backtrace}\", e)\r\n raise e\r\n end\r\n \r\n } if tables_with_after_load_events\r\n \r\n when :after_insert\r\n send(:after_insert, args) if respond_to?(:after_insert)\r\n \r\n when :after_save\r\n send(:after_save, args) if respond_to?(:after_save)\r\n \r\n when :before_insert\r\n #Looks in own class for before_insert event, requires the parameter of a Row object to be passed\r\n if respond_to?(:before_insert)\r\n send(:before_insert, args)\r\n else\r\n return true\r\n end\r\n \r\n end\r\n \r\n return true\r\n \r\n end",
"def apply_rules(record)\n rules.each do |rule|\n if record.note =~ Regexp.new(rule.trigger)\n rule.effects.each do |effect|\n if effect.change_kind?\n record.kind = effect.value if effect.value.to_i.in? Record.kinds\n elsif effect.change_source_account?\n record.source_account = Account.find(effect.value)\n elsif effect.change_target_account?\n record.target_account = Account.find(effect.value)\n record.target_currency = record.source_currency\n record.kind = Record::KIND_TRANSFER\n record.target_amount = record.source_amount\n elsif effect.add_tag?\n record.tags << Tag.find(effect.value)\n elsif effect.change_party?\n record.party = Party.find(effect.value)\n elsif effect.change_group?\n record.group = Group.find(effect.value)\n elsif effect.change_source_sign?\n record.source_amount *= -1\n elsif effect.change_target_sign?\n record.target_amount *= -1\n elsif effect.remove_record?\n record.destroy\n end\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @adjustment_type.update(adjustment_type_params)\n format.html { redirect_to @adjustment_type, notice: 'Adjustment type was successfully updated.' }\n format.json { render :show, status: :ok, location: @adjustment_type }\n else\n format.html { render :edit }\n format.json { render json: @adjustment_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_entry_type(entry_type)\n # settings is required to trigger exceptions, which set the definition\n HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)\n @definition = entry_type\n rescue\n # if no exact match then try a string match just using entry definition value\n case entry_type\n when 'Medication', 'Medications'\n @definition = 'medication'\n @status = 'active' unless @status\n when 'RX'\n @definition = 'medication'\n @status = 'dispensed' unless @status\n when nil\n definition_for_nil_entry\n else\n @definition = extract_definition_from_entry_type(entry_type)\n end\n end",
"def handle_entry_type(entry_type)\n # settings is required to trigger exceptions, which set the definition\n HQMF::DataCriteria.get_settings_for_definition(entry_type, @status)\n @definition = entry_type\n rescue\n # if no exact match then try a string match just using entry definition value\n case entry_type\n when 'Medication', 'Medications'\n @definition = 'medication'\n @status = 'active' unless @status\n when 'RX'\n @definition = 'medication'\n @status = 'dispensed' unless @status\n when nil\n definition_for_nil_entry\n else\n @definition = extract_definition_from_entry_type(entry_type)\n end\n end",
"def update_from_old_member\n if self.old_member\n old_member = self.old_member\n\n # If this member is a committee member\n if old_member.tier_id == 3\n\n name = old_member.position.chomp(\"Committee Member\").strip\n committee_type = CommitteeType.committee\n cm_type = CommitteeMemberType.cm\n\n # If this member is a committee chair\n elsif old_member.tier_id == 4\n\n name = old_member.position.chomp(\"Chair\").strip\n committee_type = CommitteeType.committee\n cm_type = CommitteeMemberType.chair\n\n # If this member is an executive\n elsif old_member.tier_id == 5\n\n name = \"Executive\"\n committee_type = CommitteeType.admin\n cm_type = CommitteeMemberType.exec(old_member.position)\n\n # Exit with nil if the correct cm_type was not found\n return nil if cm_type.nil?\n\n # If this member is a general member\n elsif old_member.tier_id == 2\n\n name = \"General Members\"\n committee_type = CommitteeType.general\n cm_type = CommitteeMemberType.gm\n\n end\n\n self.add_to_committee(name, committee_type, cm_type)\n\n # Remove from any general committees unless the member belongs there\n self.remove_from_general unless old_member.tier_id == 2\n\n return self.save\n end\n end",
"def change(column_name, type, **options)\n raise_on_if_exist_options(options)\n @base.change_column(name, column_name, type, **options)\n end",
"def type=(new_type)\n self[:type_flags] = (flags | TYPES[new_type])\n end",
"def set_affected_type\n @affected_type = AffectedType.find(params[:id])\n end",
"def toggle_content_type\n @blog = Blog.find(params[:blog_id])\n @blog.change_content_type\n respond_to do |format|\n format.html {render :edit}\n end\n end"
] |
[
"0.7415962",
"0.70975107",
"0.65295625",
"0.63964105",
"0.6308899",
"0.62117475",
"0.6207137",
"0.60622466",
"0.6033784",
"0.59838253",
"0.5969564",
"0.59412515",
"0.57860947",
"0.57648253",
"0.5755102",
"0.57204807",
"0.56712013",
"0.5636245",
"0.56282115",
"0.55879545",
"0.55736655",
"0.55703455",
"0.55702186",
"0.5549111",
"0.5516173",
"0.55053234",
"0.5489521",
"0.5489449",
"0.5411645",
"0.53967893",
"0.5396211",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53950053",
"0.53698194",
"0.53689384",
"0.53627867",
"0.5356191",
"0.5349465",
"0.5342814",
"0.53427076",
"0.53375477",
"0.53372",
"0.5328907",
"0.5310305",
"0.5306763",
"0.5305665",
"0.5294322",
"0.5285219",
"0.5277086",
"0.5274542",
"0.52636176",
"0.526241",
"0.52577645",
"0.5248385",
"0.5234953",
"0.52187365",
"0.52187365",
"0.52095276",
"0.51938134",
"0.51933014",
"0.51916575",
"0.5189543"
] |
0.62650555
|
5
|
Some users may not have this set yet
|
def ensure_last_signed_in_at_set
return unless current_user.present?
return if current_user.last_signed_in_at.present?
current_user.update last_signed_in_at: current_user.updated_at
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def is_user_specific?\n false\n end",
"def user_defined?\n !@user.nil? || !@user['userId'].nil?\n end",
"def settings\n\t\tcheck_if_myself\n\t\t@user = current_user\n\tend",
"def set_user; end",
"def first_time_user=(value)\n @first_time_user = !!value\n end",
"def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end",
"def is_potential_user?\n\t\ttrue\n\tend",
"def set?\n @auth_default || @auth.any?\n end",
"def user\n\t\tfalse\n\tend",
"def current_user_method=(null) ; end",
"def autoset_owner\n bypass_auth do\n if accessor\n self.owner_id ||= accessor.id\n end\n end\n\n true # this is very important!\n end",
"def writable?\n !(@settings[:user].nil?)\n end",
"def safe_by_default; end",
"def current_user\n nil\n end",
"def current_user\n !session[:uid].nil?\n end",
"def set_defaults\n self.state ||= 'NEW'\n self.user_id ||= Gizmo::Util::Uuid.generate\n end",
"def access_locked?; end",
"def set?\n @auth.any?\n end",
"def set_default!\n @@default_user = self\n end",
"def sharded?; false; end",
"def setuid?() end",
"def originator\n self.user ? self.user.name : NOT_SET\n end",
"def add_defaults_local\n super\n self.timestamp ||= Java.now\n self.user ||= default_user\n end",
"def enduser_ignored?\n true\n end",
"def disabled?\n user.nil?\n end",
"def user_on\n session[:user_id] = '3980284084'\n end",
"def current_user()\n nil\n end",
"def set_user_id\n User.stats.limit(2).each do |user|\n self.user_id = user['id']\n\n # prevents us from setting back to the same user\n if self.changes['user_id'][0] != self.changes['user_id'][0]\n break\n end\n end\n end",
"def is_this_user\n\t\t@user.id == current_user.id\n\tend",
"def current_user\n nil\n end",
"def initialize\n super\n \n @users = UNSET_VALUE\n end",
"def usermode; @user_mode; end",
"def effective_user\r\n self.current_proxy || self.current_user\r\n end",
"def shadow_user?\n return !session[:shadow_user_id].blank?\n end",
"def set\n false\n end",
"def sharded?; true; end",
"def set?\n @cred || @auth.any?\n end",
"def readonly_user\n super\n end",
"def super_check\n if self.user_name == 'profbill'\n self.admin = true\n self.suspended = false\n self.icon = \"hand-peace-o\"\n end\n end",
"def off_org_users\n \n end",
"def user_set\n return true if no_user_validation\n\n unless user\n errors.add :user, 'must be authenticated and set'\n logger.warn \"User is not set. Failed user_set validation for #{inspect}\"\n end\n user\n end",
"def used?; end",
"def set_audit_me_whodunnit\n ::AuditMe.whodunnit = user_for_audit_me\n end",
"def set_user\n @user = User.find(params[:id])\n\n return if unauthorized_local_access(@user.uo_id)\n end",
"def user?\n get_mode == :user\n end",
"def on_users_account\n true\n end",
"def user\n cached(:user_uncached)\n end",
"def check_user_default_profile\n if user.default_profile.nil?\n user.default_profile = self\n end\n end",
"def foreign_visitor?\n not user\n end",
"def user_setup\n\t\tif self.id.blank?\n\t\t\tself.id = self.email\n\t\t\n\t\tend\n\tend",
"def user_id\n\t\t@user_id || nil\n\tend",
"def applies_to?(user); false end",
"def allow_token_to_be_used_only_once_for(user)\n\t\tuser.regenerate_auth_token\n\tend",
"def gricer_user_id\n nil\n end",
"def permitted?; end",
"def allow_access_by_any_user\n @attributes[:allow_access_by_any_user]\n end",
"def set_current_user_to_creator_if_empty(options, current_user:, **)\n if options['contract.default'].creator_id\n true\n else\n options['contract.default'].creator_id = current_user.id\n end\n end",
"def user_is_current\n @user_is_current || 'Y'\n end",
"def check_if_current_user\r\n User.current_user && User.current_user != self\r\n end",
"def default_user\r\n [nil, nil]\r\n end",
"def system?\n id == User::SYSTEM_USER_ID\n end",
"def system?\n id == User::SYSTEM_USER_ID\n end",
"def logged_in_user\n @logged_in_user || raise('User has not been assigned')\n end",
"def user_verified?; end",
"def user_can_save?\n false\n end",
"def this_user!\n this_user || User.new(permission: :unapproved)\n end",
"def if_access_locked; end",
"def user\n self.class == User ? self : super\n end",
"def running_as_normaluser?\n Kitchenplan::Log.debug \"#{self.class} : Running as normal user? UID = #{Process.uid} != 0?\"\n Process.uid != 0\n end",
"def save\n super if self.user_id.present?\n # Else do nothing (dont call save)\n end",
"def enabled?\n user.present?\n end",
"def do_before_save\n self.dc_user_id = nil if self.public\nend",
"def user_id; 1; end",
"def usable?; end",
"def ensure_no_user\n !current_user? || redirect_back_or_default\n end",
"def check_current_user\n if !current_user.nil?\n Thread.current[:user] = current_user\n end\n end",
"def default?\n is_default == true or user.accounts.count == 1\n end",
"def set_self_as_user\n @user = self.current_user\n end",
"def allow_access\n !@current_user.nil?\n end",
"def set_defaults\n self.state ||= 'ACTIVE'\n self.account_user_id ||= Gizmo::Util::Uuid.generate\n self.is_owner ||= false\n end",
"def manage?\n super || (@user && @user.is_curator?)\n end",
"def default_user\n ['', '']\n end",
"def overriding_user_value\n clone(:override=>:user)\n end",
"def true_user\n @impersonated_user || current_user\n end",
"def true_user\n @impersonated_user || current_user\n end",
"def can_be_seen_by(current_user)\n self.probably_dead? || (current_user != nil && current_user.editor?)\n end",
"def set_current_user\n if logged_in?\n whodat = send(Lockdown::Configuration.who_did_it)\n Thread.current[:who_did_it] = whodat\n end\n end",
"def users_only\n deny_access(\"Necesitas crear una cuenta para entrar a esta sección\") unless signed_in?\n end",
"def sysuser_\n RequestStore[:current_user] = User.system_user\nend",
"def modified_by(user)\n #none by default\n end",
"def modified_by(user)\n #none by default\n end",
"def require_user\n end",
"def owner_required?\n !Refinery::Multisites.user_class.nil?\n end",
"def set_change_log_whodidit\n ::ChangeLog.whodidit = user_for_change_log\n end",
"def stored_offsite?\n (@trustee == true || (! billing_key.blank? && !changed?))\n end",
"def effective_user\n current_user || demo_user\n end",
"def current_user\n@current_user ||= (login_from_session || login_from_basic_auth || login_from_cookie) unless @current_user == false\nend",
"def remember_me\n\t\t(super == nil) ? '1' : super\n\tend",
"def user_init; end",
"def user\n raise NotImplementedError\n end",
"def resident_key?; end"
] |
[
"0.6671882",
"0.6390072",
"0.6336448",
"0.6301435",
"0.6270995",
"0.6263012",
"0.6255055",
"0.6175542",
"0.61709267",
"0.61237425",
"0.6068995",
"0.60667264",
"0.6038787",
"0.60378563",
"0.60347223",
"0.6006036",
"0.59983134",
"0.5982156",
"0.5980341",
"0.59708387",
"0.5970218",
"0.59688133",
"0.5962429",
"0.5953833",
"0.59392244",
"0.5926284",
"0.5925007",
"0.5923266",
"0.5916548",
"0.5912865",
"0.59062696",
"0.59001875",
"0.5867099",
"0.584418",
"0.58418584",
"0.583965",
"0.5833859",
"0.58319914",
"0.5826705",
"0.5819881",
"0.5808984",
"0.58025545",
"0.5801666",
"0.57856923",
"0.57820475",
"0.57680553",
"0.5755976",
"0.57557565",
"0.57555914",
"0.5754543",
"0.575316",
"0.5749729",
"0.5729154",
"0.57288975",
"0.57283694",
"0.5727102",
"0.5722575",
"0.5720313",
"0.57110536",
"0.57106763",
"0.57098377",
"0.57098377",
"0.57097584",
"0.5707946",
"0.57006377",
"0.5697558",
"0.569683",
"0.5696506",
"0.5695277",
"0.5690525",
"0.5685032",
"0.5682789",
"0.5676303",
"0.56754345",
"0.5666447",
"0.56660306",
"0.5664634",
"0.5663426",
"0.56631404",
"0.56619626",
"0.56608474",
"0.5655969",
"0.56548095",
"0.56516033",
"0.5651443",
"0.56421775",
"0.56379837",
"0.5634939",
"0.56230646",
"0.5622363",
"0.5622363",
"0.562087",
"0.56199896",
"0.56184083",
"0.56084865",
"0.56039876",
"0.56036836",
"0.56001717",
"0.5597141",
"0.5594224",
"0.5588108"
] |
0.0
|
-1
|
Sign out users that expired, but check each 5min or so
|
def sign_out_expired_session
return unless current_user.present?
return if current_user.last_sign_in_check.present? && current_user.last_sign_in_check <= 5.minutes.ago
current_user.update last_sign_in_check: Time.now
if UniversumSsoClient.signed_out?(current_user.uid)
session[:user_id] = nil
@current_user = nil
clear_iris_session
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def clean_expired!\n sessions.remove( { :expire => { '$lt' => Time.now } } )\n end",
"def expire\n touch :expires_at\n\n user.subscriptions.facebook.each do |subscription|\n subscription.deactivate\n end\n\n UserMailer.access_token_expired_email(user).deliver\n end",
"def perform\n inactive_users = User.inactive_for_more_than(2.days)\n inactive_users.destroy_all\n end",
"def expired?\n if user.where(:username => current_user).where(:expiration_time) < Time.now\n\n end\n end",
"def remove_expired_keys\n self.user_key.each do |user_key|\n if user_key.expired?\n self.remove_user_key(user_key)\n user_key.delete\n end\n end\n end",
"def deactivate_account!\n time_since_sign_in = Time.now - self.last_sign_in_at\n inactive_days = Time.now - 60.days\n if last_signed_in_at.where(inactive_days > time_since_sign_in)\n update_attribute :is_active, false\n end\n end",
"def limit_session_time\n set_session_time(Settings.gitlab['unauthenticated_session_expire_delay'])\n end",
"def mark_expired\n all.each do |u|\n u.expire! if u.expired? && u.expired_at.nil?\n end\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def clear_expired_tokens\n access_tokens.where(\"token_expire < ?\", Time.now).destroy_all\n end",
"def check_session_time\n if !Rails.env.test? && @current_user && (@current_user.current_sign_in_at + 8.hours) < Time.now\n sign_out @current_user\n unless request[:path] == root_path\n redirect_to new_user_session_path\n end\n end\n end",
"def signed_out\n @time = Time.now\n end",
"def notify_member_expire_1\n users, event = User.unpaid_membership_expires_in_1_day\n users.each do |user|\n UserMailer.deliver_membership_expires_in_1_day(user)\n User.add_email_event(user, event)\n end\n end",
"def expired?; end",
"def check_expiration\n handle_link_expired if @user.password_reset_expired?\n end",
"def delete_all_expired_for(time)\n expired_for(time).delete_all\n end",
"def session_expiry\n get_session_time_left\n unless @session_time_left > 0\n # Commented this out as this was showing when the server comes up after being idle\n # If a user's session times out, the user is shown the message in sessions_helper.rb, deny_access method\n # flash.now[:error] = \"Your session has timed out or you haven't logged in. Please log in.\"\n sign_out\n \n end\n end",
"def start_expiry_period!\n self.update_attribute(:access_token_expires_at, Time.now + Devise.timeout_in)\n end",
"def authorize_time_check(user)\n\n if (user.access_token_expiry < Time.now)\n refresh_authorisation(user)\n end\n end",
"def clear_expired(request)\n entries_for(request)\n .where {|t| t.created_at < Time.now - ttl }\n .delete\n end",
"def password_reset_expired?\n reset_sent_at < 15.days.ago\n end",
"def will_expire_on\n cfm = AWS::CloudFormation.new # calling aws cloudformation api\n if self.users.length > 0 # users length is more then 0\n self.users.each do |user| \n if user.stacks.length > 0\n user.stacks.each do |stack|\n stackaws = cfm.stacks[\"#{stack.stack_name}\"] # get that stack from aws \n if stackaws.exists? \n stackaws.delete # delete that aws stack\n sleep (1) # delay or sleep for 1 second\n end\n stack.destroy # delete that stack now from database\n end\n end\n end\n end\t\n end",
"def check_expiration\n if @user.password_reset_expired?\n flash[:danger] = \"Tempo de solicitacao expirada, por favor solicite novamente\"\n redirect_to new_password_reset_url\n end\n end",
"def expire_all\n true\n end",
"def check_session_validity\n if @current_user && @current_user.disabled_at\n sign_out @current_user\n redirect_to root_path, alert: 'Your account has been disabled by an administrator. Please contact us if you think this is incorrect.'\n end\n end",
"def password_reset_expired?\n reset_sent_at < 15.minutes.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def session_expiry\n unless session[:expires_at].nil?\n @time_left = (session[:expires_at] - Time.now).to_i\n unless @time_left > 0 \n logout_killing_session!\n gflash :notice => 'Your session expired. Please, login again.'\n redirect_to login_url\n end \n end \n end",
"def verify_expiration; end",
"def verify_expiration; end",
"def session_expiry\n @time_left = (expiry_time - Time.now).to_i\n do_flash = false\n unless @time_left > 0\n unless current_user_session.nil?\n current_user_session.destroy\n do_flash = true\n end\n reset_session\n store_location\n flash[:notice] = t('app.security.session_expired',\n :default => \"Your session has been expired by inactivity.\") if do_flash\n redirect_to new_session_url\n end\n end",
"def confirmation_period_expired?; end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago #invalidate the password reset request if sent link expired earlier than 2 hours ago\n end",
"def reap_expired_sessions\n @timestamps.each do |session_id,stamp|\n delete_session(session_id) if (stamp + @session_ttl) < Time.now \n end\n GC.start\n end",
"def flush_expired\n if gc_last && gc_time && gc_last+gc_time <= Time.now\n flush_expired!\n end\n end",
"def notify_member_expire_7\n users, event = User.unpaid_membership_expires_in_7_days\n users.each do |user|\n UserMailer.deliver_membership_expires_in_7_days(user)\n User.add_email_event(user, event)\n end\n end",
"def cleanup\n Authie.notify(:cleanup) do\n # Invalidate transient sessions that haven't been used\n active.where('expires_at IS NULL AND last_activity_at < ?',\n Authie.config.session_inactivity_timeout.ago).each(&:invalidate!)\n # Invalidate persistent sessions that have expired\n active.where('expires_at IS NOT NULL AND expires_at < ?', Time.now).each(&:invalidate!)\n end\n true\n end",
"def password_reset_expired?\n \t\treset_sent_at < 3.hours.ago\n \tend",
"def password_reset_expired?\n\t\treset_sent_at < 2.hours.ago\t\t\n\tend",
"def activation_token_expired?\n activation_sent_at < 7.days.ago\n end",
"def check_expiration\n if @user.password_reset_expired?\n flash[:danger] = \"Password reset has expired.\"\n redirect_to new_password_reset_url\n end\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago # reset_sent_at db polje datetime\n end",
"def password_reset_expired?\n \treset_sent_at < 2.hours.ago\n \tend",
"def clean_tokens\n @db.execute(\"DELETE FROM request_tokens WHERE strftime('%s','now') - strftime('%s',time) > 900\")\n end",
"def signout\n #Made changes to show feedback form at certain intervals as per discussion & also signout auditors gracefully\n #Author: Ashish Wadekar\n #Date: 16th February 2017\n if @current_user.auditor?\n logout_user\n elsif @current_user.login_count < 6 || @current_user.login_count % 50 == 0\n redirect_to login_logout_feedback_path\n else\n logout_user\n end\n end",
"def expire_tokens!\n update_tokens(nil)\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def days_to_password_expiry\n no_of_days_remaining = (password_expiry_date.to_date - Time.zone.today).to_i\n no_of_days_remaining.to_i unless no_of_days_remaining >= Rails.configuration.x.authentication.password_due_period\n end",
"def check_expired \n\t\t@current_epoch_time = DateTime.now.strftime('%s').to_i\n\t\texpired_required_trips = []\n\t\texpired_listed_trips = []\n\n\t\t# Find the expired trips and add them to the expired arrays\n\t\tcurrent_user.trips_requested.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index) \n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_required_trips << trip_index\n\t\t\tend\n\t\tend\n\t\tcurrent_user.trips_driving.each do |trip_index|\n\t\t\t@trip = Trip.find_by(_id: trip_index)\n\t\t\tif @trip.date < @current_epoch_time\n\t\t\t\texpired_listed_trips << trip_index\n\t\t\tend\n\t\tend\n\n\t\tcurrent_user.trips_requested = current_user.trips_requested - expired_required_trips\n\t\tcurrent_user.trips_driving = current_user.trips_driving - expired_listed_trips\n\n\t\tcurrent_user.past_trips_requested = current_user.past_trips_driven + expired_required_trips\n\t\tcurrent_user.past_trips_driven = current_user.past_trips_driven + expired_listed_trips\n\n\t\tcurrent_user.save!\n\n\t\trender json: {\n\t\t\tstatus: 'success',\n\t\t\tuser: current_user\n\t\t}\n\n\tend",
"def session_check\n return if (t_last = last_operation_time).zero?\n return if (t_boot = BOOT_TIME.to_i) < t_last\n __debug { \"last_operation_time #{t_last} < BOOT_TIME #{t_boot}\" }\n Log.info { \"Signed out #{current_user&.to_s || 'user'} after reboot.\" }\n local_sign_out\n end",
"def password_reset_token_expired?\n sent_reset_at < 1.hour.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end",
"def password_reset_expired?\n reset_sent_at < 2.hours.ago\n end"
] |
[
"0.709647",
"0.6901253",
"0.68786657",
"0.6667334",
"0.64914",
"0.646918",
"0.642632",
"0.63955027",
"0.637446",
"0.637446",
"0.6355509",
"0.6298883",
"0.62933177",
"0.626521",
"0.62438047",
"0.62311155",
"0.6220791",
"0.62164086",
"0.61930686",
"0.6187678",
"0.61816233",
"0.6179091",
"0.61771977",
"0.6108248",
"0.61072165",
"0.610721",
"0.60959905",
"0.60941184",
"0.60880506",
"0.60880506",
"0.6074482",
"0.6058229",
"0.60511315",
"0.6047666",
"0.60474557",
"0.6046779",
"0.60403925",
"0.6032304",
"0.6030055",
"0.6023571",
"0.60234624",
"0.6021925",
"0.6021902",
"0.6019192",
"0.60189486",
"0.5999164",
"0.59965384",
"0.59950876",
"0.5977254",
"0.5972079",
"0.5970251",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648",
"0.5966648"
] |
0.7406081
|
0
|
instantiate car, beginning with an empty cars array, then running ready_go method
|
def initialize
@cars = []
ready_go
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ready_go\n @cars << Car.new\n @cars << Car.new\n\n @cars.first.accelerate(random_speed)\n @cars.last.accelerate(random_speed)\n end",
"def initialize\n\t\t@cars = Array.new(2) { |i| Car.new }\n\t\t@cars.each { |car| car.accelerate(rand(1..100)) }\n\tend",
"def initialize\n\t\t@@cars_created += 1\n\t\t@gasoline = 0\n\tend",
"def init\n\n newCar = Showcar.create(name: \"Reventon\",\n description: \"It was the most expensive Lamborghini road car until the Lamborghini Sesto Elemento was launched, costing two million dollars (~$1.5 million, or ~£840,000). Its top speed was recorded in UAE at 221 miles per hour (355.7 km/h).\",\n photo_link: \"reventon.jpg\")\n newCar.save\n\n newCar = Showcar.create(name: \"Diablo\",\n description: \"The Lamborghini Diablo is a high-performance mid-engined sports car that was built by Italian automaker Lamborghini between 1990 and 2001. It was the first Lamborghini capable of attaining a top speed in excess of 200 miles per hour (320 km/h). After the end of its production run in 2001, the Diablo was replaced by the Lamborghini Murciélago. Diablo means @\\\"devil@\\\" in Spanish.\",\n photo_link: \"diablo.jpg\")\n newCar.save\n\n newCar = Showcar.create(name: \"Veneno\",\n description: \"Lamborthini Veneno is consistently focused on optimum aerodynamics and cornering stability, giving the Veneno the real dynamic experience of a racing prototype, yet it is full homologated for the road.\",\n photo_link: \"veneno.jpg\")\n newCar.save\n\n end",
"def initialize (make, model, miles, type, color, year, used)\n\t\t@make = make\n\t\t@model = model\n\t\t@miles = miles\n\t\t@type = type\n\t\t@color = color\n\t\t@year = year\n\t\t@used = used\n\t\tputs \"New car created.\"\n\tend",
"def setup\n @car = Car.new\n end",
"def get_cars\n CarWorker.new.perform\n end",
"def initialize()\n\t\tcards = []\n\t\t@board = cards\n\t\t@deck = Deck.new\n\t\tSTARTINGCARDS.times { @board << @deck.draw }\n\tend",
"def create\n\t\t\t\tcurrent_driver.create_car(car_params)\n\t\t\tend",
"def initialize(params)\n setMake(params[:make]);\n setModel(params[:model]);\n setYear(params[:year]);\n commitCar!();\n\n end",
"def start\n # Since I am not doing Deck.new.build, I am building the class itself, not an instance of it\n @cards = Deck.build # as_stubbed_const is what changes the calls from the Deck class to the double\n end",
"def initialize\n puts \"MyCar subclass was just instantiated. Bitches!\"\n end",
"def initialize(params, cars, additional_features)\n @id = params['id']\n @car = cars[params['car_id']]\n @start_date = Date.parse params['start_date']\n @end_date = Date.parse params['end_date']\n @distance = params['distance']\n @commission = Commission.new(self)\n @features = []\n additional_features.each do |feature|\n if feature['rental_id'] == @id\n @features << feature['type']\n end\n end\n end",
"def set_next_carb(cbhd)\n\t# Check if the next carbohydrate to eat is valid\n\t#check_carbo(cbhd)\n\t\n\t$cur_carb = cbhd\nend",
"def reset\n @car = Car.new\n @car.model= random_model \n @car.year=Time.current.year\n end",
"def new\n @car = Car.new\n end",
"def new_cars(*args)\n # set @new_cars to a new hash so args can be passed in as a key\n @new_cars ||= {}\n @new_cars[args] ||= add_cars(*args)\n end",
"def start\n\t\t@state=\"started\"\n\t\tp \"Car has started\"\n\tend",
"def create\n @car = Car.new(car_params)\n if @car.save\n bay = Bay.find(car_params['bay_id'])\n bay.cars << @car\n bay.update(is_available: false) if (bay.size == 'single' && bay.bays_cars.where(left_at: nil).size == 1) || ((bay.size == 'double' && bay.bays_cars.where(left_at: nil).size == 2))\n bay.bays_cars.find_by(car_id: @car.id).update(parked_at: Time.now)\n flash[:notice] = 'Car was successfully parked.'\n redirect_to :controller => 'bays'\n else\n render :new\n end\n end",
"def initialize(lanes, cars, rounds)\n raise \"Need at least #{lanes} cars\" unless cars >= lanes\n raise \"Need at least 1 round\" unless rounds >= 1\n @lanes = lanes\n @cars = cars\n @rounds = rounds\n @chart = []\n end",
"def initialize\n @drivers = Array.new\n end",
"def initialize\n @bets = Array.new()\n end",
"def createCarpool\n puts \"Create a New Carpool\"\n print \"Name: \"\n name = gets.strip\n\n print \"Type (school, personal, work): \"\n type = gets.strip\n\n puts \"\\n\\n\"\n @carpools << Carpool.new(name, type)\n puts \"Creating carpool #{name}\"\n\n # Back to Main Menu\n mainMenu()\nend",
"def make_cards\n #14 restuarants\n scrape_cards.each do |res|\n binding.pry\n ResInfo::Restaurant.new_from_scraper(res)\n end\n end",
"def activate_cars\n unless self.cars.nil?\n self.cars.each do |car|\n car.ativo = \"#{VEHICLE_STATUS.index 'ON_TRANSIT'}\"\n car.save\n end\n end\n end",
"def list_cars\n puts \"===================================================================\"\n Car.print_all\n puts \"===================================================================\"\n puts \"\\nEnter a number and press 'enter' to pick the desired vehicle.\" \n puts \"Type 'exit' to quit.\"\n puts \"\\nTo see the cheapest car type 'cheap'.\"\n end",
"def manage_cars_add_car\n @ui.manage_cars_add_car_msg(cars)\n car_type = gets.chomp\n case car_type\n when 'cargo'\n manage_cars_add_cargo_car\n when 'passenger'\n manage_cars_add_passenger_car\n else\n Car.new('false')\n end\n rescue RuntimeError => e\n puts e.inspect\n @attempt += 1\n if @attempt < 3\n @ui.wrong_input_msg\n retry\n end\n @attempt = 0\n end",
"def initialize(odometer, gas_used)\n @this_odometer = odometer\n @this_gas_used = gas_used\n @@Vehicle_count +=1\n end",
"def initialize\n @screen = Game_Screen.new\n @interpreter = Game_Interpreter.new(0, true)\n @map_id = 0\n @display_x = 0\n @display_y = 0\n create_vehicles\n end",
"def initialize\n @drivers = []\n end",
"def initialize(make, model) #these 2 - make, model - are parameters\n @wheels = 4\n @make = make\n @model = model\n end",
"def initialize(motor, brick)\n validate_constant!(motor, 'motor', self.class)\n validate_type!(brick, 'brick', EV3::Brick)\n\n @motor = motor\n @brick = brick\n # Setting the motor speed before calling start appears to be necessary\n self.speed = 0\n stop\n end",
"def launch_vehicle; end",
"def initialize(backwards_pin=24,\n forwards_pin=23,\n right_pin=17,\n left_pin=22)\n @pins = [\n @backwards_pin = RPi_GPIO_Pin.new(backwards_pin,\"out\"),\n @forwards_pin = RPi_GPIO_Pin.new(forwards_pin,\"out\"),\n @right_pin = RPi_GPIO_Pin.new(right_pin,\"out\"),\n @left_pin = RPi_GPIO_Pin.new(left_pin,\"out\"),\n ]\n ObjectSpace.define_finalizer(self, RC_Car.create_finalizer(*@pins))\n drive(0)\n steer(0)\n end",
"def my_initialize\n\t\t@classes = 1\n\t\t@toys = 0\n\t\t@books = 0\t\t\n\t\tsrand seed.to_i\n\t\t@location = nil\n\t\tnext_spot()\n\t\t@random_number = 0\n\t\ttrue\n\tend",
"def initialize(make, model, year, color, trans, msrp)\n @make = make\n @model = model\n @model_year = year\n @color = color\n @transmission = trans\n @msrp = msrp\n @inventory_id = Car.gen_inventory_id\n end",
"def create_cars\n my_cars = []\n #create 6 cars and shovel/push 6 cars into the my_cars array\n my_cars<<my_tesla=Tesla.new(2016)\n my_cars<<my_tata=Tata.new(2012)\n my_cars<<my_toyota=Toyota.new(1994)\n my_cars<<my_tesla=Tesla.new(2015)\n my_cars<<my_tata=Tata.new(2013)\n my_cars<<my_toyota=Toyota.new(1999)\nend\nmy_cars = []\n#create 6 cars and shovel/push 6 cars into the my_cars array\nmy_cars<<my_tesla=Tesla.new(2016)\nmy_cars<<my_tata=Tata.new(2012)\nmy_cars<<my_toyota=Toyota.new(1994)\nmy_cars<<my_tesla=Tesla.new(2015)\nmy_cars<<my_tata=Tata.new(2013)\nmy_cars<<my_toyota=Toyota.new(1999)\n\nmy_cars.sort\n#sort my_cars by year\nmy_cars.sort{ |x,y| x.year <=> y.year }\n#sort my_cars by name\nmy_cars.sort{ |x,y| x.class.to_s <=> y.class.to_s }\n#sort my_cars by name and year\nmy_cars.sort{ |x,y| [x.class.to_s, x.year] <=> [y.class.to_s, y.year] }\n",
"def initialize()\n # Cards table, containing cards hashes\n setAllCards()\n end",
"def init_deck\n @deck = Deck.new\nend",
"def initialize()\n @cards = []\n end",
"def test_create_my_cars\n assert_equal(@test_car.speed, 0, 'Speed of new car should be 0')\n assert_equal(MyCar.new.model, '')\n assert_equal(MyCar.new.year, 1999)\n assert_equal(MyCar.new.color, 'primer')\n assert_equal(MyCar.new(model:TEST_CAR_MODEL).model, TEST_CAR_MODEL)\n assert_equal(MyCar.new(year:TEST_CAR_YEAR).year, TEST_CAR_YEAR)\n assert_equal(MyCar.new(color:TEST_CAR_COLOR).color, TEST_CAR_COLOR)\n end",
"def initialize\n # @all_bikes_in_van = [] \n @broken_bikes_for_garage = []\n @fixed_bikes_to_distribute = []\n end",
"def init_city\n\n @city = City.new(5900, 70)\n\n house = Seitch.new()\n init_building(house,34,24)\n init_building(house,35,24)\n init_building(house,34,25)\n init_building(house,33,36)\n init_building(house,34,37)\n init_building(house,35,37)\n init_building(house,36,37)\n init_building(house,37,34)\n\n starport = Starport.new()\n init_building(starport ,30,30)\n\n farm = FarmA.new()\n init_building(farm ,37,24)\n\n atmo = AtmoGen.new()\n init_building(atmo ,34,30)\n end",
"def settle_car(car)\n\t\tcar.outOfRange = true if(car.x<0 || car.x>@right || car.y < 0 || car.y > @top)\n\t\tcar.playground = self\n\tend",
"def initialize(card_array) # creates an array of cards\n @cards = card_array\n end",
"def create\n @vehicle = Vehicle.new()\n\n \n # Populate the basic information from the form\n @vehicle.make = params[:vehicle][:make]\n @vehicle.model = params[:vehicle][:model]\n @vehicle.miles = params[:vehicle][:miles]\n @vehicle.colour = params[:vehicle][:colour]\n @vehicle.image = params[:vehicle][:image]\n @vehicle.owners = params[:vehicle][:owners]\n @vehicle.reg = params[:vehicle][:reg]\n @vehicle.price = params[:vehicle][:price]\n @vehicle.description = params[:vehicle][:description]\n \n myCar = BasicModelCar.new(@vehicle.make, @vehicle.model, @vehicle.miles, @vehicle.colour, @vehicle.image, @vehicle.owners, @vehicle.reg, @vehicle.price, @vehicle.description)\n crashLogger = CrashLogger.instance\n # Add some additional features to our new car\n # the statements could be written inline: params[:newcar][:fireExt].to_s.length > 0 ? myCar = FireExtinguisher.new(myCar) : null\n if params[:vehicle][:NCT].to_s.length > 0 then\n myCar = NCT.new(myCar)\n end\n if params[:vehicle][:Taxed].to_s.length > 0 then\n myCar = Taxed.new(myCar)\n end\n if params[:vehicle][:ExtendedWarranty].to_s.length > 0 then\n myCar = ExtendedWarranty.new(myCar)\n end\n if params[:vehicle][:Crashed].to_s.length > 0 then\n crashLogger.logCrash(@vehicle.reg.to_s)\n end\n \n ##Populate the cost and description information\n @vehicle.price = myCar.getPrice\n @vehicle.description = myCar.getDescription\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_car\n \n @car = Car.find(params[:id])\n end",
"def initialize\n\t\t@planets = [gallifrey, xander] # initialize hard coded planets\n\t\t#@planets.push(@new_planet) # adds new planets via user input to planets array\n\t\t@number_planets = @planets.length #counts planets by counting array elements\n\t\t@formation_year = rand(-3000000..2015)\n\t\t@age_of_system = 2015 - @formation_year\n\t\t\t\n\tend",
"def populate_deck\n # self.initial_size.times do\n # new_card_class = Card.library.values.sample\n # new_card = new_card_class.new\n # self.cards << new_card\n # end\n 40.times do\n new_card_type = Card.library.values.sample\n new_card = new_card_type.create\n self.cards << new_card\n end\n end",
"def get_carb\n\t# Return the current carbohydrate to eat\n\treturn $cur_carb\nend",
"def initialize(name, breed, age) #initialize with 3 arguments.\n @name = name\n @breed = breed\n @age = age\n DOGS << self #showell into empty DOGS array. \nend",
"def initialize (number, type, car_count)\n @number = number\n @type = type\n @car_count = car_count\n @speed = 0\n end",
"def initialize(length = 15, driver = nil, passengers = nil, currentLane = nil, exitLane = nil)\n if (length < MinimumLength)\n raise ArgumentError, \"Car below minimum length of #{Car.minimumLength}: #{length}\"\n end\n\n @bodyStart = 0\n @length = length ? length : 15\n @bodyEnd = @bodyStart - @length\n @driver = driver ? driver : Driver.select\n @passengers = passengers ? passengers : Roadway.passengers.select\n @createTime = World.time\n @distance = 0\n @currentLane = currentLane\n @exitLane = exitLane\n @fixTime = nil\n\n @maxAccel = @driver.maxAccel\n @changeLead = @driver.changeLead\n @changeTrail = @driver.changeTrail\n\n # if the current lane is undefined, then we choose a lane to put ourselves into.\n # Keep on choosing until we get a valid entry/exit pair.\n unless @currentLane\n begin\n @currentLane = Lane.generate.chooseObject\n @exitLane = Lane.absorb.chooseObject\n end until @currentLane.exitTo[@exitLane]\n\n @currentLane.addCar self\n end\n\n @lastSpeed = @currentLane.initialSpeed\n @nextSpeed = Velocity::Zero\n\n @totalLaneChanges = 0\n @totalAccidents = 0\n @totalBreakdowns = 0\n\n updateLane\n end",
"def initialize(self)\n self.objects = []\n self.agents = []\n end",
"def set_car\n @car = Car.find(params[:car_id]) if params[:car_id]\n end",
"def index\n get_cars\n @cars = Car.all\n @cars = @cars.order(:id)\n car_array = []\n @cars.each do |car|\n car_array << car\n end\n gon.cars = car_array # Using gon to make the car's data accessible to JavaScript for mapping purposes\n end",
"def initialize\n @model = \"BMW\"\n @color = \"Red\"\n @plate = \"#{(\"a\"..\"z\").to_a.sample}-#{rand(1..100)}\"\n @chassis = \"topsecret\"\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def initialize(capacity = DEFAULT_CAPACITY)\n @capacity = capacity\n @bikes = []\n\n # @bikes << Bike.new\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end",
"def set_car\n @car = Car.find(params[:id])\n end",
"def initialize(capacity = DEFAULT_CAPACITY) # <--- Initializes the array that represents the dock and its capacity ~\n\t\t@bikes = []\n\t\t@capacity = capacity\n\tend",
"def new\n @carrier = Carrier.new\n @carrier.vehicles.build\n end",
"def setup\n @wheel = Wheel.new(26,1.5)\n @gear = Gear.new(52,11,@wheel)\n end",
"def create\n @car = Car.find(params[:car_id])\n @driver = @car.drivers.create(params[:driver])\n redirect_to car_path(@car)\n end",
"def add_car_to_train\n train = grep_train\n return 'Some problem with train' unless train\n case train.type\n when :passenger\n train.add_train_car(PassengerCar.new)\n when :cargo\n train.add_train_car(CargoCar.new)\n else\n puts 'Train was not found'\n end\n end",
"def car_options\n Array.new(rand(5...10)) { fetch('vehicle.car_options') }\n end",
"def initialize(cards = Deck.all_cards)\n end",
"def initialize(stap=5,aantal=34)\n @stap = stap\n @monte_carlos = []\n aantal.times do |x|\n van = x*stap\n tot = (x+1)*stap-1\n @monte_carlos[tot] = MonteCarlo.from_db(van,tot)\n end\n end",
"def initialize\n @cards = []\n end",
"def initiate_parking(command)\n\t\tif is_a_create_command?(command[:method])\n\t\t\tsetup_lot_and_slots(command)\n\t\telse\n\t\t\tputs \"You should create a parking lot first\"\n\t\tend\n\tend",
"def initialize ()\n\t\t# inicializa la variable baraja como un array vacio\n\t\t@baraja = []\n\t\t# recorre el array con todos los palos\n\t\tConstantes::PALOS.each do |p|\n\t\t\t# Recorre el array con todos los valores\n\t\t\tConstantes::VALORES.each do |v|\n\t\t\t\t# Para cada combinacion de palo/valor crea un objeto Carta y lo guarda en la baraja\n\t\t\t\tc = Carta.new v,p\n\t\t\t\t@baraja << (Carta.new v,p)\n\n\t\t\tend\n\t\tend\n\tend",
"def initialize\n @capacity_bikes = 10\n @available_bikes = []\n end",
"def initialize \n @guests = [] #constructor,array vacio \n end",
"def create_rover(c)\n @rover_bay = []\n c.each_with_index do |x,i|\n @rover_bay.push(Rover.new(x.movement,x.position,i+1))\n end\n end",
"def test_can_create_instance_of_class_via_bang_method \n cars = Lumberjack.construct do\n vehicle :name => 'Prius (are owned by rich hippies)' do\n person! 'Ryan' do # i so put my foot in here, i'm not a rich hippy!\n age 25\n end\n end\n end\n assert_kind_of Person, cars[0].person\n assert_equal 'Ryan', cars[0].person.given_name\n assert_equal 25, cars[0].person.age\n end",
"def setup\n @test_car = MyCar.new(model:TEST_CAR_MODEL,\n year:TEST_CAR_YEAR,\n color:TEST_CAR_COLOR)\n end",
"def initialize(params = {})\n run_callbacks :create do\n super\n @cards ||= []\n end\n end",
"def release_bike\n# the method will 'raise' an exception stating no bikes, if\n# the @rack array is empty\n raise \"No bikes available\" if @rack.empty?\n# Otherwise by implicit return it will instantiate a new Bike\n Bike.new\n end"
] |
[
"0.7600033",
"0.687104",
"0.66208076",
"0.6409292",
"0.6236859",
"0.622376",
"0.5987254",
"0.59474766",
"0.5944182",
"0.5929732",
"0.5876827",
"0.5736802",
"0.5665938",
"0.56465334",
"0.56434804",
"0.56250894",
"0.561246",
"0.5570857",
"0.5555686",
"0.55537194",
"0.5498692",
"0.54813373",
"0.54559004",
"0.5451255",
"0.54415196",
"0.54159915",
"0.541284",
"0.53913563",
"0.5386337",
"0.5373375",
"0.53517133",
"0.53512084",
"0.5339425",
"0.5337546",
"0.5332072",
"0.53268176",
"0.5319371",
"0.53050226",
"0.52829355",
"0.5282129",
"0.52544993",
"0.5248962",
"0.5242079",
"0.52402484",
"0.5229854",
"0.5222441",
"0.52165383",
"0.521373",
"0.5213271",
"0.52094287",
"0.5197445",
"0.51950526",
"0.51941204",
"0.5189475",
"0.5170704",
"0.5170614",
"0.51524836",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5150058",
"0.5149988",
"0.5148861",
"0.51450366",
"0.51432335",
"0.5140445",
"0.51372296",
"0.5132058",
"0.5119417",
"0.51111686",
"0.50979495",
"0.5095941",
"0.50933",
"0.5088579",
"0.5086654",
"0.50839394",
"0.5076807",
"0.5075866",
"0.5075004",
"0.50742537",
"0.50721276",
"0.50657433",
"0.506391"
] |
0.8353904
|
0
|
method runs when race is instantiated; creates 2 new car instances runs accelerate method from Car class on both new cars and sets random speed
|
def ready_go
@cars << Car.new
@cars << Car.new
@cars.first.accelerate(random_speed)
@cars.last.accelerate(random_speed)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def initialize\n\t\t@cars = Array.new(2) { |i| Car.new }\n\t\t@cars.each { |car| car.accelerate(rand(1..100)) }\n\tend",
"def accelerate\n @speed = @speed + @accelerator\n end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def race; end",
"def accelerate (rateOfAcceleration)\n @speed = @speed + rateOfAcceleration\n end",
"def accelerate\n if !@parkingbrake\n @speed += 10\n end\n end",
"def accelerate\n @speed += 1\n end",
"def change_speed\n @statistics[:speed_changes] += 1\n # pick a coordination to change speed for\n @changed_coord = @coordinations.rand\n @previous_speed = @current_speed[@changed_coord]\n @current_speed[@changed_coord] = @previous_speed + SPEED_CHANGE_OPTIONS.rand\n delta_eval(@changed_coord)\n end",
"def accelerate\n self.current_speed += 1 \n end",
"def accelerate(speed_wanted)\n @speed = speed_wanted\n puts \"The #{@color} #{@model} accelerated to #{@speed} mph.\"\n end",
"def reevaluate_car_strategies\n # puts \"Evaluating strategies. Current time is #{@t}\"\n\n if @t > 300\n puts \"Cars left at time 300 (much to late):\"\n @cars.each { |c| puts c.uid }\n exit -1\n end\n\n #if @t < 200 and @t < @t.round + 0.05 and @t > @t.round - 0.05\n # puts \"Time #{@t}. Car positions are:\"\n # @cars.each { |c| puts \"#{c.uid}\\tat #{c.position}\" }\n #end\n\n\t @cars.each do |car|\n # If the car is past the simulation, stop moving it, and schedule its leave event\n if car.position*MILES_FT >= 2*DISTANCE_EDGE_MIDDLE\n puts \"Scheduling that #{car.uid} must leave at time #{@t}. It's at #{car.position*MILES_FT}\"\n # Schedule that the car leaves ALMOST now\n queue_event @t+0.0000001, Event.new(:car_finished, {:car => car})\n end\n\n # Move the car first to calculate is current position\n if !car.waiting\n car.position += car.current_speed * TRACE_PERIOD / (MINUTE*MINUTE) # position is in miles\n end\n\n # Re-evaluate the speed to be taken\n if car.position*MILES_FT <= DISTANCE_EDGE_MIDDLE - DISTANCE_TO_CROSSWALK/2 and car.position*MILES_FT > DISTANCE_EDGE_MIDDLE - DISTANCE_TO_CROSSWALK/2 - car.speed * MPH_FTPS * TRACE_PERIOD\n puts \"Car #{car.uid} is near the stoplight. It's at position #{car.position*MILES_FT}. Stoplight is #{@stoplight_state}\"\n if @stoplight_state == :GREEN\n # We're good to go forth\n car.at_stoplight = false\n car.waiting = false\n car.current_speed = car.speed\n\n # Both are conditionally set, since the light may be green, and thus we have no wait time\n car.wait_start ||= @t\n car.wait_finish ||= @t\n add_wait_point_for_car car\n else\n # Stop for the light\n car.at_stoplight = true\n car.waiting = true\n car.current_speed = 0\n\n # Conditional set, since this will continually happen as the light is waited on\n car.wait_start ||= @t\n end\n else\n # Not at the stoplight yet.\n car.at_stoplight = false\n ahead = get_car_ahead car\n if ahead.nil?\n # Go ahead normally; at full speed, no acceleration (those are default current_speed and current_acceleration)\n car.waiting = false\n car.current_speed = car.speed\n else\n car_bubble = 40\n brake_distance = 0\n # if where i will wind up (including the evolution of what my speed could be) is going to wind up inside (or after) the car in front's bubble, then stop\n if car.position*MILES_FT + brake_distance + car.speed*MPH_FTPS*TRACE_PERIOD >= ahead.position*MILES_FT - car_bubble\n car.waiting = true\n car.current_speed = 0\n else\n # Full speed ahead!\n car.waiting = false\n car.current_speed = car.speed\n end\n\n # inherit the ahead car's wait times iff we haven't reached the crosswalk yet (which is why it's a conditional set)\n justset_start = false\n justset_finish = false\n if !ahead.wait_start.nil? and car.wait_start.nil?\n car.wait_start ||= ahead.wait_start\n justset_start = true\n end\n if !ahead.wait_finish.nil? and car.wait_finish.nil?\n car.wait_finish ||= ahead.wait_finish\n justset_finish = true\n end\n\n if (justset_start or justset_finish) and !car.wait_start.nil? and !car.wait_finish.nil?\n add_wait_point_for_car car\n end\n end\n end\n end\n\tend",
"def mutate\n d=MyDriver.new\n d.clutch=@clutch.map {|c| \n c*(0.9+0.2*rand)\n }\n d.gas=@gas.map {|c| \n c*(0.9+0.2*rand)\n }\n d\n end",
"def test_brake\n @slow_car.accelerate # accelerate before brake +10\n @slow_car.accelerate # accelerate before brake +10\n @slow_car.brake\n assert_equal(10,@slow_car.speed)\n end",
"def accel\n @speed += 7\n end",
"def run\n @speed = 5\n end",
"def initialize\n\t\t@@cars_created += 1\n\t\t@gasoline = 0\n\tend",
"def gen_speed\n rand + 15.0\n end",
"def random_restart\n @controllers.each{|sc| @current_offset[sc] = rand(@current_cycle_time || sc.cycle_time)}\n if @change_probability[:speed].nonzero?\n @coordinations.each do |coord|\n @current_speed[coord] = coord.default_speed + SPEED_CHANGE_OPTIONS_WITH_ZERO.rand\n end\n end\n full_evaluation # all coordinations change, must do full reevaluation\n end",
"def with_arrival_rate(species, *args)\n @arrival_rate = RandomVariate.send(species, *args)\n end",
"def initialize(distance, diameter)\n @distance = distance\n @diameter = diameter\n @theta = 0\n @orbit_speed = rand(-0.01 .. 0.01) \n end",
"def new_race(car_1,car_2)\n # binding.pry\n uc = user.user_cars.find{|current_uc| current_uc.car.model == car_1.model}\n system(\"clear\")\n if uc.condition < 75\n uc.top_speed_nerf()\n elsif uc.condition < 50 \n uc.top_speed_heavy_nerf()\n end \n # binding.pry \n if uc.uc_top_speed > car_2.top_speed\n system(\"say 'Congratulations #{user.name} You Won!'\") \n puts \"#{car_1.make} #{car_1.model} vs #{car_2.make} #{car_2.model}\"\nputs \" 🚁 \\n \n🏢 🏢 🌴🏦 🏚️ 🏫 🌳 ⛪ 🏥 🏪 🏠🏠🌴 🏤 🌴 🏢 🌳🌳 \\n\n🚙 🚓 🚓 🚓 \\n\n 🚗 🚓 🚓 🚓 🚓 \\n\\n\\n\"\n puts \"YOU WIN! \\n\\n\\n$#{(car_2.value * 0.65).to_i} will be added to your balance.😎 Your record is now #{user.wins}-#{user.losses}!\" \n user.last_desc = \"W\"\n uc.won(car_1,car_2) \n uc.deteriorate()\n menu()\n else \n system(\"say 'Gotta be quicker than that!'\")\n puts \"#{car_1.make} #{car_1.model} vs #{car_2.make} #{car_2.model}\"\n puts \"Hold this L. \\n\\n\\nYou lost $#{(car_2.value * 0.65).to_i}.😤 You are now #{user.wins}-#{user.losses}\"\n $user.last_desc = \"L\"\n uc.lost(car_1,car_2)\n uc.deteriorate()\n menu()\n end \nend",
"def accelerate(mph)\n @speed += mph\n puts \"You accelerate the car by #{mph} miles per hour\"\n end",
"def jet_accelerate\n @speed = get_speed * 2\n end",
"def class Vehicle\r\n attr_accessor :make, :model, :capacity\r\n def initialize(make, model, capacity)\r\n @make = make\r\n @model = model\r\n @fuel_capacity = capacity\r\n @fuel = 50\r\n end\r\n def refuel(litres)\r\n if litres > @fuel_capacity\r\n @fuel = @fuel_capacity\r\n else\r\n @fuel += litres\r\n end\r\n end\r\nend",
"def test_accelerate\n @slow_car.accelerate\n assert_equal(10,@slow_car.speed)\n assert_equal(95,@slow_car.fuel_level)\n end",
"def start\n @speed = 10\n end",
"def forceSpeed _obj, _args\n \"_obj forceSpeed _args;\" \n end",
"def test_accelerate\n @speedy_car.accelerate\n assert_equal(25,@speedy_car.speed)\n assert_equal(90,@speedy_car.fuel_level)\n end",
"def drive \n while self.current_speed < self.max_speed\n accelerate()\n end \n # and print that it hit the cars max speed \n puts \"drive method was called\"\n puts \"The current car speed is : #{self.current_speed}\"\n puts \"The car hit it max speed\" \n # The execution of drive should then also stop\n end",
"def initialize \n @model = \"Generic\"\n @wheels = 2 \n @current_speed = 0\n end",
"def pedal_faster\n @speedometer = @speedometer + 10\n end",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend",
"def accelerate strength = 1.0\n self.speed += self.rotation_vector * strength/SUBSTEPS\n end",
"def mass_accelerate!(time, cost)\n player = self.planet.player\n raise GameLogicError, \"You must be VIP to mass accelerate!\" \\\n unless player.vip?\n\n has_not_prepaid = construction_queue_entries.\n where(ConstructionQueueEntry.not_prepaid_condition).exists?\n raise GameLogicError,\n \"Cannot accelerate all if constructor has non-prepaid entries in \" +\n \"queue!\" if has_not_prepaid\n\n constructable = self.constructable\n raise GameLogicError, \"Cannot mass accelerate if not constructing!\" \\\n if constructable.nil?\n\n flank = build_in_2nd_flank? ? 1 : 0\n hidden = build_hidden?\n location = planet.location_point\n construction_mod = model_construction_mod\n class_cache = {}\n\n units = []\n total_time = 0\n # Cannot explode data into (array, time) because time is a primitive\n # value ant we need to increment it.\n construction_queue_entries.each do |entry|\n raise GameLogicError,\n \"Cannot only mass accelerate units, but wanted to accelerate #{\n entry.constructable_type}!\" \\\n unless entry.constructable_type.starts_with?(\"Unit::\")\n\n entry.count.times do\n type = entry.constructable_type\n klass = class_cache[type] ||= type.constantize\n model = klass.new(entry.params)\n # To get time calculations right.\n model.construction_mod = construction_mod\n model.level = 1\n model.flank = flank\n model.hidden = hidden\n model.location = location\n\n units << model\n total_time += model.upgrade_time(1)\n end\n end\n\n total_time += constructable.calculate_pause_remainder\n\n raise GameLogicError,\n \"Time for all units is #{total_time}s, but only #{time}s were given!\" \\\n if total_time > time\n\n raise GameLogicError,\n \"Needed #{cost} creds, but player only had #{player.creds}!\" \\\n if cost > player.creds\n\n # Clear entries because they will be included into population otherwise.\n ConstructionQueue.clear(id, false)\n\n player.creds -= cost\n Unit.give_units_raw(units, planet, player) # This also saves player\n\n # Reload queue entries after clearing.\n construction_queue_entries(true)\n on_construction_finished!\n CallbackManager.\n unregister(self, CallbackManager::EVENT_CONSTRUCTION_FINISHED)\n\n all_units = [constructable] + units\n grouped_counts = all_units.grouped_counts { |unit| unit.class.to_s }\n CredStats.mass_accelerate(\n player, self, cost, total_time, time, grouped_counts\n ).save!\n\n # Return constructed units.\n all_units\n end",
"def initialize(speed,strength)\n if speed > @@max_speed\n @speed = @@default_speed\n else\n @speed = speed \n end\n if strength >= @@max_strength\n @strength = @@default_strength\n else\n @strength = strength\n end\n @@horde << self \nend",
"def addrandomcars(lat0,lon0,lat1,lon1, count )\n Fiber.new do\n count.times do\n lat = (lat1-lat0) * rand() + lat0\n lon = (lon1-lon0) * rand() + lon0\n @pgconn.query(\"insert into cars(lat,lon,avail) values(#{lat},#{lon}, true)\")\n end\n end.resume\n end",
"def initialize(length = 15, driver = nil, passengers = nil, currentLane = nil, exitLane = nil)\n if (length < MinimumLength)\n raise ArgumentError, \"Car below minimum length of #{Car.minimumLength}: #{length}\"\n end\n\n @bodyStart = 0\n @length = length ? length : 15\n @bodyEnd = @bodyStart - @length\n @driver = driver ? driver : Driver.select\n @passengers = passengers ? passengers : Roadway.passengers.select\n @createTime = World.time\n @distance = 0\n @currentLane = currentLane\n @exitLane = exitLane\n @fixTime = nil\n\n @maxAccel = @driver.maxAccel\n @changeLead = @driver.changeLead\n @changeTrail = @driver.changeTrail\n\n # if the current lane is undefined, then we choose a lane to put ourselves into.\n # Keep on choosing until we get a valid entry/exit pair.\n unless @currentLane\n begin\n @currentLane = Lane.generate.chooseObject\n @exitLane = Lane.absorb.chooseObject\n end until @currentLane.exitTo[@exitLane]\n\n @currentLane.addCar self\n end\n\n @lastSpeed = @currentLane.initialSpeed\n @nextSpeed = Velocity::Zero\n\n @totalLaneChanges = 0\n @totalAccidents = 0\n @totalBreakdowns = 0\n\n updateLane\n end",
"def pedal_faster accel\n #Increment speed by the value of the argument\n @speedometer += accel\n #Display updated speed\n speed\n end",
"def walk\n @speed = 2\n end",
"def initialize(odometer, gas_used)\n @this_odometer = odometer\n @this_gas_used = gas_used\n @@Vehicle_count +=1\n end",
"def accelerate(increment, seconds)\n fail 'Engine Off Error' unless engine_on\n\n seconds.times do\n break if speed >= top_speed\n @speed += increment\n end\n end",
"def update\n @velocity.add(@acceleration)\n @location.add(@velocity)\n @acceleration.mult(0)\n @lifespan -= 2.0\n end",
"def update\n @velocity.add(@acceleration)\n @location.add(@velocity)\n @acceleration.mult(0)\n @lifespan -= 2.0\n end",
"def accelerate\n puts \"Stepping on the gas\"\n puts \"Speeding up\"\nend",
"def move\n return if @fixTime || handlePossibleBreakdown\n\n old_bodyStart = @bodyStart\n @bodyStart += @nextSpeed.fps_i\n\n if self.carAhead && (self.carAhead >= self)\n @bodyStart = carAhead.bodyEnd - 1\n\n actualDistance = @bodyStart - old_bodyStart\n ratio = actualDistance / @nextSpeed.fps\n\n return if 0.5 > ratio && handlePossibleAccident\n end\n\n @nextSpeed = Velocity::Zero\n @lastSpeed = Velocity.FPS(@bodyStart - old_bodyStart)\n @distance += @lastSpeed.fps_i\n\n @bodyEnd = @bodyStart - @length\n @bodyStart\n end",
"def increase_speed(delta=10)\n @speed += delta\n end",
"def setSpeedMode _obj, _args\n \"_obj setSpeedMode _args;\" \n end",
"def setup\n @car = Car.new\n end",
"def pedal_faster\n\t\t@speed += 10\n\tend",
"def walk\n @speed = @speed + (0.2 * @legs)\n end",
"def initialize # every time an object is instantiated, this runs and mileage\n @mileage = 0 # instance varialbe is assigned 0\n end",
"def accelerate\n @shape.body.apply_force((@shape.body.a.radians_to_vec2 * (20000.0)), CP::Vec2.new(0.0, 0.0))\n end",
"def test_accel\n assert_equal(@test_car.accel(20).speed, 20)\n assert_equal(@test_car.accel(10).speed, 20+10)\n assert_equal(@test_car.accel(0).speed, 20+10+0)\n assert_raise(RangeError) {@test_car.accel(-1)}\n end",
"def initialize\n @cars = []\n ready_go\n end",
"def initialize(name, speed, times, rt, status)\n @name = name\n @max_speed = speed\n @time_max_speed = times\n @rest_time = rt\n @status = status \n @distance = 0\n @time_running = 0\n @time_resting = 0\n end",
"def set_race_car\n @race_car = RaceCar.find(params[:id])\n end",
"def simulate\n initWater = Vector[ 500 - @xs[0], 0]\n # while true\n addWater(initWater)\n # end\n # while true\n # self.spawn(initWater)\n # self.update\n # end\n end",
"def pedal_faster\n @current_speed = @current_speed+1\n end",
"def initialize(vehicle, direction)\n super()\n @vehicle = vehicle\n @direction = direction\n # temporary variables to handle rotation\n @incr = Matrix3f.new\n @tempMa = Matrix3f.new\n @tempMb = Matrix3f.new\n\n # we are using +Y as our up\n @up_axis = Vector3f.new 0,1,0\n @modifier = 1\n end",
"def initialize(position, top_speed, acc, hf)\n @id = @@count + 1\n @position = position\n @speed = 0\n @top_speed = top_speed\n @acc = acc\n @hf = hf\n @nitro_used = false\n @running = true\n @@count = @id\n end",
"def initialize (attr)\n @engine = attr[:engine]\n @make = attr[:make]\n @model = attr[:model]\n @color = attr[:color]\n self.current_speed = 0 #self calls a method, @ sets a variable\n end",
"def speedup(amount)\n @speed += amount\n end",
"def initialize (number, type, car_count)\n @number = number\n @type = type\n @car_count = car_count\n @speed = 0\n end",
"def accelerate(time) \n @velocity += time * @acceleration;\n @velocity = @max_speed if @velocity > @max_speed\n end",
"def update\n # Update velocity\n @velocity.add(@acceleration)\n # Limit speed\n @velocity.limit(@maxspeed)\n @location.add(@velocity)\n # Reset accelerationelertion to 0 each cycle\n @acceleration.mult(0)\n end",
"def speed_up\n self.speed += 5\n info\n end",
"def speed_up\n self.speed += 5\n info\n end",
"def update()\n # Update velocity\n @velocity.add(@acceleration)\n # Limit speed\n @velocity.limit(@maxspeed)\n @location.add(@velocity)\n # Reset accelertion to 0 each cycle\n @acceleration.mult(0)\n end",
"def update\n @velocity += acceleration\n @location += velocity\n @lifespan -= 2.0\n end",
"def perform(airplane_id = nil)\n airplane = Airplane.find airplane_id\n\n airplane.go_to_accelerate!\n \n # Simulation of receipt a signal of take-off from the airplane\n # We should use for lock ConditionVariable and Mutex\n sleep Airplane::TIME_FOR_TAKE_OFF # HACK\n\n airplane.accelerated!\n end",
"def acccelerate\n puts \"stepping on the gas\"\n puts \"Speeding up\"\nend",
"def getSpeed _obj, _args\n \"_obj getSpeed _args;\" \n end",
"def reset\n @car = Car.new\n @car.model= random_model \n @car.year=Time.current.year\n end",
"def initialize(wind_speed = 0.0, wind_direction = :n, weather = :normal)\n @wind_speed = (wind_speed.to_f * 1000) / 3600\n @wind_direction = wind_direction\n @weather = weather\n\n if @weather == :snow\n @flakes = []\n Flakes.times do\n @flakes << Snowflake.new(rand($window.width), rand($window.height))\n end\n end\n\n if @weather == :rain\n @darkness_opacity = 1.0\n @next_flash = 0\n\n @raindrops = []\n Raindrops.times do\n @raindrops << Raindrop.new(rand($window.width), rand($window.height))\n end\n end\n end",
"def spawned; end",
"def spawned; end",
"def speed_of_spread() #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @speed = 0.0\n\n case @population_density\n when 200..1000\n @speed += 0.5\n when 150...200\n @speed += 1\n when 100...200\n @speed += 1.5\n when 50...100\n @speed += 2\n else\n @speed += 2.5\n\n end\n\n end",
"def setup\n @wheel = Wheel.new(26,1.5)\n @gear = Gear.new(52,11,@wheel)\n end",
"def brake\n self.speed -= 5\n info\n end",
"def brake\n self.speed -= 5\n info\n end",
"def set_speed(new_speed:)\n if new_speed > 30\n new_speed = 30\n elsif new_speed < 0\n new_speed = 0\n end\n @curr_speed = new_speed \n end",
"def initialize(speed, strength) \n\t\t \t#If the speed argument is greater than @@max_speed then @@default_speed should be used as the new zombie's speed instead\n\t\tif speed > @@max_speed \n\t\t\t@speed = @@default_speed\n\t\telse @speed = speed\n\t\tend \n\t\t\t#strength argument is less than or equal to @@max_strength, otherwise @@default_strength should be used as the new zombie's strength attribute.\n\t\tif strength >= @@max_strength\n\t\t\t@strength = @@default_strength\n\t\telse @strength = strength\n\t\tend \n\tend",
"def speedIncrease(value)\n self.speedSet = self.speedGet + value\n end",
"def initialize(modelArg, colorArg)\n @model = modelArg\n @color = colorArg\n #to see the speed I am traveling, so I can properly accelerate or decelerate.\n @speed = 0\n #to keep track of the total distance I have travelled, so I can get paid for mileage.\n @cum_distance = 0.0\n end",
"def initialize(ac,ve,lo,r) \n @acc = PVector.new(ac.x, ac.y, ac.z)\n @vel = PVector.new(ve.x, ve.y, ve.z)\n @loc = PVector.new(lo.x, lo.y, lo.z)\n @r = 10\n @timer = 100.0\n @maxspeed = 2\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def apply_force(force:)\n f = force / @mass\n @acceleration += f\n end",
"def setVehicleArmor _obj, _args\n \"_obj setVehicleArmor _args;\" \n end",
"def initialize\n @model = \"BMW\"\n @color = \"Red\"\n @plate = \"#{(\"a\"..\"z\").to_a.sample}-#{rand(1..100)}\"\n @chassis = \"topsecret\"\n end",
"def speed\n end",
"def brake\n @speed -= 5\n end",
"def travel\n @prev_city = @current_city\n case @current_city\n when 'Enumerable Canyon'\n @random_num = @prng.rand(2)\n @current_city = ec_travel\n when 'Duck Type Beach'\n @random_num = @prng.rand(2)\n @current_city = dtb_travel\n when 'Monkey Patch City'\n @random_num = @prng.rand(3)\n @current_city = mpc_travel\n when 'Nil Town'\n @random_num = @prng.rand(3)\n @current_city = nt_travel\n when 'Matzburg'\n @random_num = @prng.rand(4)\n @current_city = m_travel\n when 'Hash Crossing'\n @random_num = @prng.rand(3)\n @current_city = hc_travel\n when 'Dynamic Palisades'\n @random_num = @prng.rand(2)\n @current_city = dp_travel\n end\n end",
"def initialize(freq = DEFAULT_UPDATE_FREQUENCY, clip = DEFAULT_CLIPPING_PLANE)\n @clipping_plane = clip\n @dxs = rand(20) - 10 # X-axis movement per wall second.\n @dys = rand(20) - 10 # Y-axis movement per wall second.\n @dzs = rand(200) * 2 # Z-axis movement per wall second.\n set_random_position\n \n super(freq) # We have to do this last since a +Thread+ will be created that needs our instance variables instantiated.\n end"
] |
[
"0.7564324",
"0.63941765",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.6352995",
"0.62272406",
"0.6182051",
"0.6178175",
"0.6166637",
"0.60955286",
"0.60896087",
"0.6033562",
"0.60181546",
"0.6006431",
"0.5977956",
"0.59735227",
"0.5850408",
"0.5843975",
"0.5741405",
"0.5732317",
"0.5708073",
"0.570066",
"0.566191",
"0.56615746",
"0.5628758",
"0.5588546",
"0.5587828",
"0.5575095",
"0.5556238",
"0.5501258",
"0.54855627",
"0.5469573",
"0.5438949",
"0.5438949",
"0.5438949",
"0.5428189",
"0.54147196",
"0.5387387",
"0.5374624",
"0.5335781",
"0.53223777",
"0.5296661",
"0.52953625",
"0.52876127",
"0.52627534",
"0.52627534",
"0.51988554",
"0.5187644",
"0.51691073",
"0.5168553",
"0.5166218",
"0.5164991",
"0.51594675",
"0.51578915",
"0.5156227",
"0.5147883",
"0.51461405",
"0.51426035",
"0.5141492",
"0.51387924",
"0.5132172",
"0.5108326",
"0.5105312",
"0.50936514",
"0.50931656",
"0.50810355",
"0.507949",
"0.5074901",
"0.5066855",
"0.5066855",
"0.5061585",
"0.506123",
"0.5055711",
"0.5055295",
"0.5043026",
"0.5041146",
"0.5034336",
"0.50284564",
"0.50284564",
"0.5022899",
"0.5019608",
"0.50176346",
"0.50176346",
"0.5006536",
"0.5003655",
"0.49897233",
"0.49890387",
"0.49889278",
"0.49774414",
"0.49774414",
"0.49774414",
"0.49762872",
"0.49742377",
"0.49708524",
"0.49666774",
"0.49657303",
"0.4963776"
] |
0.79100513
|
0
|
gets winner by sorting the two cars by speed; car with higher speed will be last and is the winner
|
def winner
@cars.sort_by(&:speed).last
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def loser\n @cars.sort_by(&:speed).first\n end",
"def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend",
"def winner(speed1, speed2, speed3)\nif speed3 > speed2 && speed3 > speed1\n puts \"Person 3 was the fastest at #{speed3} m/s\"\nelsif speed2 > speed3 && speed2 > speed1\n puts \"Person 2 was the fastest at #{speed2} m/s\"\nelsif speed1 > speed3 && speed1 > speed2\n puts \"Person 1 was the fastest at #{speed1} m/s\"\nelsif speed1 == speed2 && speed2 == speed3\n puts \"Everyone tied at #{speed1} m/s\"\nelse\n puts \"Well done everyone!\"\nend\nend",
"def winner\n players.sort.last\n end",
"def winner\n\t\tbest_for_1 = best_hand(@hand1)\n\t\tbest_for_2 = best_hand(@hand2)\n\t\tcase best_for_1[:rank] <=> best_for_2[:rank]\n\t\t\twhen -1 then 2\n\t\t\twhen 1 then 1\n\t\t\twhen 0 then check_kicker(best_for_1, best_for_2)\n\t\tend\n\tend",
"def calculate_winner\n self.winner = case human.move <=> computer.move\n when 1\n human\n when -1\n computer\n when 0\n 'tie'\n end\n end",
"def winner player1, player2\n player1.health > player2.health ? player1 : player2\n end",
"def calculate_winner players\n\n sorted_cards = @card_list.sort # sort cards in 'poker' order\n players.each_with_index {|player, i|\n if sorted_cards[-1] == player.get_last_card_played\n @last_winner=player.name\n end\n }\n # Switched off this observation for the moment\n #changed\n #notify_observers(sorted_cards[-1].to_string)\n\n if sorted_cards[-1].to_string_other.include?(\"FIVE\") then\n changed\n notify_observers(@last_winner,sorted_cards[-1].to_string)\n end\n\n sorted_cards[-1] # return best card\n end",
"def winner\n @board.sort_by {|player, board_position| board_position}.last.first\n end",
"def first_turn(pokemon1, pokemon2)\n if pokemon1.base_stats[:speed] > pokemon2.base_stats[:speed]\n 1\n elsif pokemon1.base_stats[:speed] == pokemon2.base_stats[:speed]\n rand(1..2)\n else\n 2\n end\n end",
"def winner?(p1, p2)\n if p1.points > p2.points \n return p1\n elsif p1.points < p2.points \n return p2\n else \n return nil\n end\n end",
"def speed_order\r\n\t\t\tall_champions = @team.concat(@opp_team)\r\n\t\t\tspeed_hash = Hash.new\r\n\t\t\tfor x in 0..9\r\n\t\t\t\tspeed_hash[x] = all_champions[x].ms\r\n\t\t\t\tcreate_speed_record(x,all_champions[x].ms)\r\n\t\t\tend\r\n\t\t\tsorted_speed_hash = speed_hash.sort_by{|num,speed| speed}.reverse\r\n\t\t\tnew_speed_array = Array.new\r\n\t\t\tsorted_speed_hash.each do |num, speed|\r\n\t\t\t\tnew_speed_array << num\r\n\t\t\tend\r\n\t\t\tcreate_order_record(new_speed_array)\r\n\t\t\tnew_speed_array\r\n\t\tend",
"def calculate_winner players\r\n\r\n sorted_cards = @card_list.sort # sort cards in 'poker' order\r\n found=0\r\n winning_card_index=-1\r\n\r\n while found==0\r\n players.each_with_index do |player, i|\r\n # if we have the same winner twice in a row, we return the next best card (i.e. let someone else win)\r\n if sorted_cards[winning_card_index] == player.get_last_card_played\r\n if player.name==@last_winner\r\n\r\n changed\r\n notify_observers player.name,player.get_last_card_played.to_string\r\n\r\n winning_card_index=-2\r\n break\r\n else\r\n @last_winner=player.name\r\n found=1\r\n break\r\n end\r\n end\r\n end\r\n end\r\n\r\n # Switched off this observation for the moment\r\n #changed\r\n #notify_observers(sorted_cards[-1].to_string)\r\n\r\n #if sorted_cards[@winning_card_index].to_string_other.include?(\"WHITE\") then\r\n # changed\r\n # notify_observers(@last_winner,sorted_cards[@winning_card_index].to_string)\r\n #end\r\n\r\n #sorted_cards[@winning_card_index] # return best card\r\n sorted_cards[winning_card_index]\r\n\r\n end",
"def compute_team_winner\n if completed?\n team_winner\n else\n if first_team && second_team\n if sets_won(first_team) == min_sets_to_play\n first_team\n elsif sets_won(second_team) == min_sets_to_play\n second_team\n end\n end\n end\n end",
"def winner\n count1, count2 = @cups[6].count, @cups[13].count\n if count1 > count2\n @name1\n elsif count2 > count1\n @name2\n else\n :draw\n end\n end",
"def compare (player1, player2)\n if player1 == player2\n @winner = \"Parità\"\n else\n player1_weaknesses = universal_dictionary[player1]\n @winner = \"#{player1} batte #{player2} vince il giocatore 1\"\n player1_weaknesses.each do |weakness|\n if weakness == player2\n @winner = \"#{player2} batte #{player1} vince il giocatore 2\"\n end\n end\n end\n @winner\n end",
"def winner\n if (self.homeScore > self.awayScore)\n return self.home_team\n elsif (self.awayScore > self.homeScore)\n return self.away_team\n else\n return nil\n end\n end",
"def determine_match_winner\n @games_to_win = ((total_number_of_games / 2.0).floor) + 1\n if player1.score == games_to_win\n return player1\n elsif player2.score == games_to_win\n return player2\n else\n return nil\n end\n end",
"def tie_breaker_cards\n matched = self.matched_cards\n sorted = @cards.sort.reverse\n # sorted so the card with highest value is first \n if five_of_a_kind? \n # All cards break the tie\n return sorted \n elsif flush?\n # All cards break the tie\n return sorted \n elsif four_of_a_kind?\n four = matched.find{ |rank, cards| cards.size == 4}\n # quads break the tie first, then the other card \n return four + [(sorted - four).first] \n elsif full_house?\n three = matched.find{ |rank, cards| cards.size == 3}\n two = matched.find{ |rank, cards| cards.size == 2}\n return three + two\n elsif straight?\n # Special case for ace, 2, 3, 4 ,5 straight, which sorts as\n # 2,3,4,5,A \n if sorted.first.rank == Rank::Ace && sorted.last.rank == Rank::Two \n ace = sorted.pop \n sorted.unshift(ace) # put ace at the back\n return [ sorted.first ] # should be the 5 now \n else\n return [ sorted.first ] \n end\n elsif three_of_a_kind?\n three = matched.find{ |rank, cards| cards.size == 3} \n return three + (sorted - three).first(2)\n elsif two_pair?\n pairs = [] \n matched.each{ |rank, cards| pairs << cards if cards.size == 2 } \n two_pair = pairs[0] + pairs[1]\n two_pair + [(sorted - two_pair).first]\n elsif pair?\n two = matched.find{ |rank, cards| cards.size == 2} \n two + (sorted - two).first(3)\n else\n sorted.first(5)\n end\n end",
"def winner(array)\n\t#first sort our players by score, highest to lowest\n\tarray.sort! {|a,b| b <=> a}\n\thighest = array[0]\n\tsecond = array[1]\n\n\tif highest.score >= 21\n\t\t#make sure the winner wins by at least 2 points\n\t\tunless (highest - second).abs < 2\n\t\t\treturn highest\n\t\tend\n\tend\nend",
"def winner_of_match\n puts \"#{@p1.name}: #{@p1.score}\"\n puts \"#{@p2.name}: #{@p2.score}\"\n if @p1.score > @p2.score\n puts \"#{@p1.name} is the winner of the match!\"\n elsif @p2.score > @p1.score\n puts \"#{@p2.name} is the winner of the match!\"\n else\n puts \"#{@p1.name} and #{@p2.name} had the same score. The match is a tie!\"\n end\n end",
"def overall_winner?(p1_wins,p2_wins)\n if p1_wins > p2_wins\n return 1\n elsif p2_wins > p1_wins\n return 2\n else\n return nil\n end\nend",
"def turn_winner(move1,move2) \n if move1 > move2\n return @Player1\n elsif move2 > move1\n return @Player2\n end\n end",
"def sort_drivers\n @drivers.sort! {|x, y| y.miles_driven <=> x.miles_driven}\n end",
"def calculate_computers_move\n available_squares.zip(next_scores).sort_by { |key, value| value }.reverse.first.first\n end",
"def winner\n @players.max_by do |player|\n player.score\n end\n end",
"def winner\n return nil if player_one_move == player_two_move\n winning_combinations = { 'rock' => 'scissors', 'scissors' => 'paper', 'paper' => 'rock' }\n {\n true => player_one,\n false => player_two,\n }[winning_combinations[player_one_move] == player_two_move]\n end",
"def tie_winner \n\t\t# Store the winner information if there is a tie for player 1 and 2 \n\t\t@tie_1 = Array.new\n\t\t@tie_2 = Array.new\n\n\t\tfor i in 0..@best_hand_value_1.length-1 do \n\n\t\t\tif @best_hand_value_1[i] == @best_hand_value_2[i]\n\n\t\t\t\t# This cannot happen but included to be complete \n\t\t\t\tif @combo_name_1[i][0] == \"A Royal Flush\"\n\t\t\t\t\t@tie_1[i] = 0 \n\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\tend \n\t\t\t\t# find winner with two straight flushes\n\t\t\t\t# larger straight flush will be the largest value in the values array\n\t\t\t\tif @combo_name_1[i][0] == \"A Straight Flush\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-1] > @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-1] < @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-1]\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\t\t# find winner with 2 four of a kinds\n\t\t\t\t# larger 4 of a kind will be the mode of the value array\n\t\t\t\tif @combo_name_1[i][0] == \"Four of a Kind\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two three of a kinds\n\t\t\t\t# larger 3 of a kind will be the mode of the values array \n\t\t\t\tif @combo_name_1[i][0] == \"Three of a Kind\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two full houses. Larger full house will be larger 3 of a kind, \n\t\t\t\t# which can be found as the mode of the values array \n\t\t\t\tif @combo_name_1[i][0] == \"A Full House\"\n\t\t\t\t\tif @hand_information_player_1[i]['vals'].mode > @hand_information_player_2[i]['vals'].mode\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].mode\n\t\t\t\t\t\t@tie_2[i] = 0 \n\t\t\t\t\telsif @hand_information_player_1[i]['vals'].mode < @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \t\t@tie_1[i] = 0\n\t\t\t\t \t\t@tie_2[i] = @hand_information_player_2[i]['vals'].mode\n\t\t\t\t \tend \n\t\t\t\tend \n\t\t\t\t# find winner with two flushes. Since a flush is 5 cards, max will store largest. \n\t\t\t\tif @combo_name_1[i][0] == \"A Flush\"\n\t\t\t\t\tif @hand_information_player_1[i]['max'] > @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['max']\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['max'] < @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['max']\n\t\t\t\t\tend \n\t\t\t\tend \n\t\t\t\t# find winner with two straights. Since a straight is 5 cards, the max will have \n\t\t\t\t# the larger of the two saved \n\t\t\t\tif @combo_name_1[i][0] == \"A Straight\"\n\t\t\t\t\tif @hand_information_player_1[i]['max'] > @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['max']\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['max'] < @hand_information_player_2[i]['max'] \n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['max']\n\t\t\t\t\tend \n\t\t\t\tend \n\t\t\t\t# find winner with same high card. Itterate through all 5 cards until one is bigger (in order from highest)\n\t\t\t\tif @combo_name_1[i][0] == \"High Card\"\n\t\t\t\t\tfor k in 1..5 do\n\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\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\tend\n\t\t\t\t# find winner with same two pairs. First check each of the pair values (high to low) then check\n\t\t\t\t# the remaining cards high to low \n\t\t\t\tif @combo_name_1[i][0] == \"Two Pair\" \n\t\t\t\t\tif @hand_information_player_1[i]['pairvals'].sort[-1] > @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-1] < @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-1] == @hand_information_player_2[i]['pairvals'].sort[-1]\n\t\t\t\t\t\tif @hand_information_player_1[i]['pairvals'].sort[-2] > @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-2] < @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'].sort[-2] == @hand_information_player_2[i]['pairvals'].sort[-2]\n\t\t\t\t\t\t\tfor k in 1..3 do\n\t\t\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t\tbreak\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\t\t# find winner with same pairs, first check pair value (high to low), then itterate through all remaining cards\n\t\t\t\t# high to low \n\t\t\t\tif @combo_name_1[i][0] == \"A Pair\"\n\t\t\t\t\tif @hand_information_player_1[i]['pairvals'][0] > @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'][0] < @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\telsif @hand_information_player_1[i]['pairvals'][0] == @hand_information_player_2[i]['pairvals'][0]\n\t\t\t\t\t\tfor k in 1..4 do\n\t\t\t\t\t\t\tif @hand_information_player_1[i]['vals'].sort[-k] > @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_1[i] = @hand_information_player_1[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_2[i] = 0\n\t\t\t\t\t\t\t\tbreak \n\t\t\t\t\t\t\telsif @hand_information_player_1[i]['vals'].sort[-k] < @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\t@tie_1[i] = 0\n\t\t\t\t\t\t\t\t@tie_2[i] = @hand_information_player_2[i]['vals'].sort[-k]\n\t\t\t\t\t\t\t\tbreak\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\telse \n\t\t\t\t# if no tie, tie should be zero\n\t\t\t\t@tie_1[i] = 0\n\t\t\t\t@tie_2[i] = 0\n\t\t\tend\n\n\t\tend # Ends the loop for the different types of tied hands \n\n\tend",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by {|team_info| [-team_info[1][:wins], -team_info[1][:ties], team_info[1][:losses]]}\nend",
"def detect_result(player, dealer)\n if player > WINNING_SCORE\n :player_busted\n elsif dealer > WINNING_SCORE\n :dealer_busted\n elsif dealer < player\n :player\n elsif dealer > player\n :dealer\n else\n :tie\n end\nend",
"def show_winner()\n\t\tif player1_count() > player2_count\n\t\t\treturn @player1 \n\t\telsif player2_count() > player1_count\n\t\t\treturn @player2\n\t\telse \n\t\t\treturn nil \n\t\tend\n\tend",
"def winner\n match = horizontal_match || vertical_match || diagonal_match\n match ? @last_drop[:piece] : nil\n end",
"def winner\n @players.max_by{ |player| player.score}\n end",
"def winner &block\n if block_given?\n @hands.sort(&block)\n end\n end",
"def determine_score\n point1 = @player1.points\n point2 = @player2.points\n\n if point1 > 2 and point2 > 2\n if point1 == point2\n @player1.deuce = true\n @player2.deuce = true\n elsif point1 > point2\n @player1.advantage = true\n elsif point2 > point1\n @player2.advantage = true\n end\n end\n end",
"def detect_result\n case\n when player.busted? then :player_busted\n when dealer.busted? then :dealer_busted\n when player.total > dealer.total then :player_higher\n when dealer.total > player.total then :dealer_higher\n else :tie\n end\n end",
"def determine_game_winner(player1,player2)\n if player1.score > player2.score\n puts \"#{player1.name} is the winner!\"\n elsif player1.score < player2.score\n puts \"#{player2.name} is the winner!\"\n else\n puts \"It's a tie.\"\n end\nend",
"def determine_winner(p1, p2)\n p1.acquire_move(@rules)\n p2.acquire_move(@rules)\n @rules.winner_of_game(p1, p2)\n end",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by! {|team_info| [team_info[1][:wins], team_info[1][:ties], -team_info[1][:losses]]}.reverse!\nend",
"def compare\n if self.terms.all? { |t| t.results[:count] }\n @winner, @loser = self.count_winner_loser\n elsif self.terms.all? { |t| t.results[:seconds] }\n @winner, @loser = terms.sort_by { |t| t.results[:seconds] }\n else\n @winner = terms.select { |t| t.results[:seconds]}[0]\n @loser = terms.select { |t| t.results[:count]}[0]\n end\n end",
"def check_last_winner\n if @player1.player_victory\n @player2\n elsif @player2.player_victory\n @player1\n else\n @player1\n end\n end",
"def cars_sorted_by_price\n @inventory.sort_by { |car| car.total_cost }\n end",
"def winner\n @player_positions.max_by{|player, position| position}[0]\n end",
"def get_winner_fight(pokemon1, pokemon2)\n current_hp_pokemon1 = pokemon1.base_stats[:hp].to_f\n current_hp_pokemon2 = pokemon2.base_stats[:hp].to_f\n while current_hp_pokemon1 >= 0 && current_hp_pokemon2 >= 0\n case first_turn(pokemon1, pokemon2)\n when 1\n current_hp_pokemon2 -= pokemon_attack(pokemon1, pokemon2)\n current_hp_pokemon1 -= pokemon_attack(pokemon2, pokemon1)\n when 2\n current_hp_pokemon1 -= pokemon_attack(pokemon2, pokemon1)\n current_hp_pokemon2 -= pokemon_attack(pokemon1, pokemon2)\n end\n end\n if current_hp_pokemon1 > current_hp_pokemon2\n pokemon1\n else\n pokemon2\n end\n end",
"def play_best_of()\n\n while @rounds != 0\n clear(); Banner::print_banner()\n play()\n sleep(2.7)\n\n if @player_wins > @computer_wins\n\n puts \"[$] Player win (#{@player_wins}/3) rounds !\"\n\n elsif @computer_wins > @player_wins\n\n puts \"[$] Computer win (#{@computer_wins}/3) rounds !\"\n\n\n elsif @player_wins == @computer_wins\n\n puts \"[~] No one win, Equals !\"\n\n end\n\n \n\n end\n\n again()\n\n end",
"def final_results_list\n winners = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id == 100 })\n losers = sort_group_of_teams(self.teams.select { |team| team.playoffs && team.court_id != 100 })\n\n #only for kob, game play will not have a losers court\n ## winner of consolation court kob, become overall 4th place\n if (losers)\n third_place = losers.shift\n winners.insert(3, third_place).concat(losers)\n end\n winners\n end",
"def winner\n\n if type == :basic\n if @player_1.deck.cards[0].rank > @player_2.deck.cards[0].rank\n return @player_1\n else\n return @player_2\n end\n elsif type == :mutually_assured_destruction\n return \"No winner.\"\n elsif type == :war\n if @player_1.deck.cards[2].rank > @player_2.deck.cards[2].rank\n return @player_1\n else\n return @player_2\n end\n end\n end",
"def winner\n if type == :basic\n if get_rank(@player1, 0) > get_rank(@player2, 0)\n @player1\n else\n @player2\n end\n elsif type == :war\n if get_rank(@player1, 2) > get_rank(@player2, 2)\n @player1\n else\n @player2\n end\n elsif type == :mutually_assured_destruction\n 'No Winner'\n end\n end",
"def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend",
"def get_best_rated(drivers)\n best_rated = nil\n best_avg = 0\n drivers.each do |driver, rides|\n current_avg = get_avg_rating(rides)\n if best_avg < current_avg\n best_rated = driver\n best_avg = current_avg\n end\n end\n return best_rated\nend",
"def most_expensive_player_on_team \n\n the_club = choose_club #user chooses club they want to see most expensive player for\n my_club = Club.find_by(name: the_club) #use class instance find_by to find the instance of club with the name provided by user (the_club)\n club_players = my_club.players.sort_by do |player| #loops through instance of club and sorts the players by their market value (remember to change market_value from string to integer)\n player.market_value.to_i\n end\n\n most_expensive_player = club_players.last #in ascending order the last item of the sorted array is the player with the highest market value\n puts \"#{the_club}'s most expensive player is #{most_expensive_player.name}. He is worth £#{most_expensive_player.market_value}M\"\n #the_club --> user choice of club name\n #most_expensive_player.name --> use the_club name to find the specific instance of Club class. \n #Use \".players\" method to find all player instances of that specifc club (the instances of players that \n #belong to that instance of club). Use \".name\" method to retrieve attribute \"name\" of player instance. \n #Use \".market_value\" to retrieve attribute \"market_value\" of the player instance. \n\nend",
"def runCase player_index\n\tp = player_index.sort_by{|val| val[0].power[1]}.reverse\n\ts = 0\n\ttemp = p[s][0]\n\tfor i in 0..player_index.length-2\n\t\tif(temp.power[1]==p[i+1][0].power[1])\n\t\t\twinner = 0\n\t\telsif(temp.power[1]<p[i+1][0].power[1] && temp.power[1]!=3)\n\t\t\twinner = p[i+1][1]\n\t\t\ttemp = p[i+1][0]\n\t\t\ts =i+1\n\t\telsif(temp.power[1]==3 && p[i+1][0].power[1]==14)\n\t\t\twinner = p[i+1][1]\n\t\t\ttemp = p[i+1][0]\n\t\t\ts =i+1\n\t\telse\n\t\t\twinner = p[s][1]\t\t\t\n\t\tend\t\n\tend\nend",
"def best_target\n far_enough = competitors.select do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) >= RTanque::Bot::Turret::LENGTH\n end\n far_enough.sort_by do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) +\n (competitor.name == NAME ? 1000 : 0)\n end.first\n end",
"def break_tie(other_hand) \n mycards = self.tie_breaker_cards\n othertb = other_hand.tie_breaker_cards\n stop = mycards.size\n for i in (0...stop) do\n res = mycards[i] <=> othertb[i]\n # Tie is broken\n # Note that wildcards will retain their own value\n # This means that, for example if deuces are wild,\n # a K K K three of a kind will beat a K K 2 three of a kind \n return res if res != 0 \n end \n # If we came here it's a split pot\n return 0\n end",
"def display_winner\n\t\tif @player_one.return_number_of_win > @player_two.return_number_of_win # on fait une condition qui compare le nombre de victoire des joueurs pour savoir lequel a gagner la partie\n\t\t\tputs \"\\n\\n\\nBravo #{@player_one.return_name.colorize(:green)} Vous avez battu #{@player_two.return_name.colorize(:red)}\"\n\t\telsif @player_one.return_number_of_win < @player_two.return_number_of_win\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:green)} Vous avez battu #{@player_one.return_name.colorize(:red)}\"\n\t\telse\n\t\t\tputs \"\\n\\n\\nBravo #{@player_two.return_name.colorize(:blue)} et #{@player_one.return_name.colorize(:blue)} Vous avez fait un match nul!\"\n\t\tend\n\tend",
"def winning_player\n played_cards.max_by { |_, card| card_scores[card] }.first\n end",
"def winner_of_game(p1, p2)\n if @rules[p1.move] == p2.move\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move] == p1.move\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end",
"def winner\n horizontal_winner || vertical_winner || diagonal_winner\n end",
"def >(rhs)\n if @rank == rhs.rank\n if @rank == 0\n #compare highest cards\n if @cards[4] == rhs.cards[4]\n if @cards[3] == rhs.cards[3]\n if @cards[2] == rhs.cards[2]\n if @cards[1] == rhs.cards[1]\n return @cards[0] > rhs.cards[0]\n else\n return @cards[1] > rhs.cards[1]\n end\n else\n return @cards[2] > rhs.cards[2]\n end\n else\n return @cards[3] > rhs.cards[3]\n end\n else\n return @cards[4] > rhs.cards[4]\n end\n elsif @rank == 1\n #find higher pair\n return @cards[@handStart] > rhs.cards[rhs.handStart]\n elsif @rank == 2\n #find higher pair\n if @cards[@handStart] == rhs.cards[rhs.handStart]\n return @cards[@handSubstart] > rhs.cards[rhs.handSubstart]\n else\n return @cards[@handStart] > rhs.cards[rhs.handStart]\n end\n elsif @rank == 3\n #find higher triplet\n return @cards[@handStart] > rhs.cards[rhs.handStart]\n elsif @rank == 4\n #find higher straight\n return @cards[0] > rhs.cards[0]\n elsif @rank == 5\n #find higher flush\n return @cards[4] > rhs.cards[4]\n elsif @rank == 6\n #find higher full house\n if @handSubstart == 3\n if rhs.handSubstart == 3\n #both trips in front\n if @cards[@handStart] == rhs.cards[rhs.handStart]\n return @cards[@handSubstart] > rhs.cards[rhs.handSubstart]\n else\n return @cards[@handStart] > rhs.cards[rhs.handStart]\n end\n else\n #trip in front vs trip in back\n if @cards[@handStart] == rhs.cards[rhs.handSubstart]\n return @cards[@handSubstart] > rhs.cards[rhs.handStart]\n else\n return @cards[@handStart] > rhs.cards[rhs.handSubstart]\n end\n end\n elsif @handSubstart == 2\n #both trips in back\n if rhs.handSubstart == 2\n if @cards[@handSubstart] == rhs.cards[rhs.handSubstart]\n return @cards[@handStart] > rhs.cards[rhs.handStart]\n else\n return @cards[@handSubstart] > rhs.cards[rhs.handSubstart]\n end\n else\n #trip in back vs trip in front\n if @cards[@handSubstart] == rhs.cards[rhs.handStart]\n return @cards[@handStart] > rhs.cards[rhs.handSubstart]\n else\n return @cards[@handSubstart] > rhs.cards[rhs.handStart]\n end\n end\n \n end\n elsif @rank == 7\n #find higher quadruplet\n return @cards[self.handStart] > rhs.cards[rhs.handStart]\n elsif @rank == 8\n #find higher straight flush\n return @cards[0] > rhs.cards[0]\n elsif @rank == 9\n #find higher royal flush\n end\n else\n return @rank > rhs.rank\n end\n end",
"def winning_team\n self.teams.order('score DESC').first\n end",
"def winner\n player_alive?(Player1) ? Player1 : Player2\n end",
"def winning_team\n blue_team.winner? ? blue_team : red_team\n end",
"def find_winner\n if @player_1.life == 0\n return 2\n end\n return 1\n end",
"def winner\n (score1 > score2 ? 1 : 2) if won?\n end",
"def compare_further p1hand, p2hand, rank, secondary\n p1values = p1hand.map{|c| $value_map[c[0]]}.sort\n p2values = p2hand.map{|c| $value_map[c[0]]}.sort\n # no further comparison if it's a straight\n return 0 if rank == 9 || rank == 8 || rank == 4\n if rank == 7 # four of a kind\n comp1 = (p1values[0] == secondary ? p1values[4] : p1values[0])\n comp2 = (p2values[0] == secondary ? p2values[4] : p2values[0])\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank == 6 # full house\n comp1 = (p1values - [secondary]).uniq[0]\n comp2 = (p2values - [secondary]).uniq[0]\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank <= 5 # all remaining ranks\n comp1 = (p1values - [secondary]).uniq.reverse\n comp2 = (p2values - [secondary]).uniq.reverse\n comp1.each_with_index do |e,i|\n return 1 if e > comp2[i]\n return 2 if comp2[i] > e\n end\n return 0\n end\nend",
"def determine_winner\n blackjack\n bust\n if player.score == dealer.score\n puts \"---------Tie - Player Wins!---------\"\n elsif player.score > dealer.score\n puts \"------------Player Wins!------------\"\n puts \"Dealer had #{dealer.score}.\"\n else dealer.score > player.score\n puts \"-------------Dealer Wins------------\"\n puts \"Dealer Score: #{dealer.score}\"\n end\n end",
"def populate_winner\n if competitor_1_score > competitor_2_score\n self.winner_id = match.get_competitor_1.id\n elsif competitor_1_score < competitor_2_score\n self.winner_id = match.get_competitor_2.id\n else\n self.winner_id = nil\n end\n end",
"def winner_of_game(p1, p2)\n if @rules[p1.move].include?(p2.move) == true\n @winner = p1.name\n p1.score += 1\n elsif @rules[p2.move].include?(p1.move) == true\n @winner = p2.name\n p2.score += 1\n else\n @winner = \"Tie\"\n end\n @winner\n end",
"def find_best_score(total_per_player)\n best_score = 0\n winner = ''\n total_per_player.each do |player_name,total|\n\n if total > best_score\n best_score = total\n winner = player_name\n end\n end\n return winner\n end",
"def compare_kickers(other)\n kicker_cards.each_with_index do |kicker, i|\n other_kicker = other.kicker_cards[i]\n compared_by_kicker = kicker <=> other_kicker\n return compared_by_kicker unless compared_by_kicker == 0\n end\n 0\n end",
"def players\n [@player1, @player2].sort_by { |player| player.first ? 0 : 1 }\n end",
"def leaster_winner\n players.inject(players.first) do |winner, player|\n (player.points <= winner.points && player.tricks_won.any?) ? player : winner\n end\n end",
"def most_likely_play\n @must_learn = true\n best_move = nil\n max = 0\n\n search_space = SearchSpace.new(@board, @most_alike_board, @color)\n search_space.each do |move|\n prob = probability_of(move)\n return move if prob >= Config::PROBS_THRESHOLD\n if max < prob\n max = prob\n best_move = move\n end\n end\n\n best_move\n end",
"def compare_by_points(other, break_ties = true)\n diff = other.points <=> points\n return diff if diff != 0 || !break_ties\n\n diff = compare_by_highest_place(other)\n return diff if diff != 0\n\n diff = compare_by_most_recent_place(other)\n return diff if diff != 0\n\n 0\n end",
"def find_winning_hand\n results = self.hands.collect { |x| [x.id, x.rank] }.sort { |x, y|\n [Hand::RANKS[x.last[0]][:rank], Hand::CARD_ORDER[x.last.last.first]] <=> [Hand::RANKS[y.last[0]][:rank], Hand::CARD_ORDER[y.last.last.first]] }\n Win.find_or_create_by!(round: self, hand_id: results.last.first, status: true, rank: results.last.last.first)\n end",
"def compare_hands\n players_hash = Hash.new(0)\n @active_players.each do |player|\n players_hash[player] = player.hand.analyze_hand_value\n end\n\n highest_val = players_hash.values.max\n winners = players_hash.reject { |_, val| val != highest_val }\n\n winners.keys.each do |winner|\n winner.chip_count += @pot.to_f / winners.length.to_f\n end\n winners_str = \"This rounds winner(s) is/are\"\n winners.keys.each do |winner|\n winners_str << \" #{winner.name}\"\n end\n winners_str << \"!!!!\\n\"\n puts winners_str\n end",
"def loser\n return winner == :player_a ? :player_b : :player_a\n end",
"def tie_breaker_single hand2\n values.sort.reverse <=> hand2.values.sort.reverse\n end",
"def winner(returned_type)\n if returned_type == :basic\n if @player1.deck.cards[0].rank > @player2.deck.cards[0].rank\n @player1\n else\n @player2\n end\n elsif returned_type == :war\n if @player1.deck.cards[2].rank > @player2.deck.cards[2].rank\n @player1\n else\n @player2\n end\n else\n \"No Winner\"\n end\n end",
"def tournament_players_sorted_by_prestige\n TournamentPlayer.where(:tournament_id => self.id).order(\"prestige DESC\").order(\"match_points DESC\")\n end",
"def match!(teams,team)\n my_rating = team_rating(team)\n best = nil\n best_team = nil\n teams.teams.each do |other|\n\n if other.members.size < other.min_for_match\n next\n end\n\n if rating = team_rating(other)\n diff = my_rating > rating ? my_rating - rating : rating - my_rating\n if best.nil? || diff < best\n best = diff\n best_team = other\n end\n end\n end\n\n if best_team\n GameMachine::Models::StartMatch.new(:team_names => [team.name,best_team.name])\n else\n nil\n end\n end",
"def detect_result(dealer_total, player_total)\n if dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend",
"def <=> other\n high_place, low_place = *Player.find(self.players)\n .map { |ply| ply.place }.sort\n high_other, low_other = *Player.find(other.players)\n .map { |ply| ply.place }.sort\n cmp = low_place <=> low_other\n return cmp if cmp != 0\n cmp = high_place <=> high_other\n return cmp if cmp != 0\n return self.round <=> other.round\n end",
"def who_win\n @players.each do |player|\n result_sum = 0\n player.cards_wins.each do |cards|\n result_sum += cards.value.to_i\n end\n player.points = result_sum\n end\n players_win = @players.sort_by(&:points).reverse![0]\n puts 'GANADOR--------GANADOR---------GANADOR----'\n puts \"Nombre: #{players_win.name} || Puntos: #{players_win.points}\"\n #players_win.cards_wins.each do |cards|\n # puts cards.id\n #end\n @players.each do |player|\n puts ''\n puts player.name\n puts 'Cartas: '\n player.cards_wins.each do |cards|\n print \"#{cards.id}\"\n print ' || '\n end\n end\n end",
"def winner\n return self.player_a_pyre_end_health <= 0 ? :player_b : :player_a\n end",
"def print_game_result\n # Winners stored in list in case of tie\n winners = []\n highestScore = @player_list[0].score\n\n # Determine who has the highest score\n @player_list.each do |player|\n\n # Highest score thus far is matched\n if highestScore == player.score\n winners.append(player.name)\n # Highest score is beaten\n elsif highestScore < player.score\n # Empty list of winners\n winners.clear\n # Add the current winner's name to the winner list\n winners.append(player.name)\n # Update current high score\n highestScore = player.score\n end\n\n end\n\n # Print the winner(s)\n if winners.size > 1\n puts(\"It's a tie! The winners:\")\n else\n puts(\"Winner:\")\n end\n\n winners.each { |winner| puts(winner) }\n end",
"def min_speed\r\n if @pitches.size > 0\r\n return (@pitches.min {|a,b| a.start_speed.to_f <=> b.start_speed.to_f }).start_speed\r\n end\r\n return 0\r\n end",
"def get_winner(ballots)\n ballots.uniq.map do |candidate|\n return candidate if ballots.count(candidate) > ballots.size / 2\n end\n nil\nend",
"def winner\n return @winner\n end",
"def tie_breaker_multi hand2\n values1 = values.sort.reverse\n values2 = hand2.values.sort.reverse\n 4.downto(1).each do |num|\n pick1 = values1.select {|card| values1.count(card) == num}\n pick2 = values2.select {|card| values2.count(card) == num}\n return pick1 <=> pick2 if pick1 != pick2\n end\n 0 # hands are identical\n end",
"def high_card_winner\n\n\t # find high card winner card from numerical representation\n\t for i in 0..@best_hand_value_1.length-1 do \n\t if @best_hand_value_1[i] <= 10\n\t @high_card_winner_1[i] = @best_hand_value_1[i]\n\t elsif @best_hand_value_1[i] == 11\n\t @high_card_winner_1[i] = 'J'\n\t elsif @best_hand_value_1[i] == 12\n\t @high_card_winner_1[i] = 'Q'\n\t elsif @best_hand_value_1[i] == 13\n\t @high_card_winner_1[i] = 'K'\n\t elsif @best_hand_value_1[i] == 14\n\t @high_card_winner_1[i] = \"A\"\n\t end \n\t if @best_hand_value_2[i]<=10\n\t @high_card_winner_2[i] = @best_hand_value_2[i]\n\t elsif @best_hand_value_2[i] == 11\n\t @high_card_winner_2[i] = 'J'\n\t elsif @best_hand_value_2[i] == 12\n\t @high_card_winner_2[i] = 'Q'\n\t elsif @best_hand_value_2[i] == 13\n\t @high_card_winner_2[i] = 'K'\n\t elsif @best_hand_value_2[i] == 14\n\t @high_card_winner_2[i] = \"A\"\n\t end \n\t end\n\tend",
"def winner\n\t\ts = {}\n\t\t@vPlayers.each {|player|\n\t\t\ts[player.name.to_s] = player.score.totalScore\n\t\t}\n\t\tmax = s.values.max\n\t\tname = s.select{|k, v| v == max}.keys\n\t\tscore = s.select{|k, v| v == max}.values\n\t\t\n\t\tprint \"The winner is \" + name[0].to_s + \" with a total score of \" + score[0].to_s\n\t\tputs \"\",\"\"\n\t\t\n\tend",
"def choose_winner; end",
"def best_hand\n @active_players.map do |player|\n # Creates an array storing all possible 5 card combinations.\n @all_combos = (player.hole_cards + @community_cards).combination(5).to_a\n @best_hand = PokerHand.new\n @current_hand = nil\n\n # Loops through every hand combination, comparing the current hand to the best hand. If the current hand is better than the best hand, it becomes the best hand, otherwise it is deleted.\n @all_combos.map do |hand|\n next unless @all_combos.length > 1\n\n @current_hand = PokerHand.new(hand)\n if @current_hand > @best_hand\n @best_hand = @current_hand\n else\n @all_combos.delete(hand)\n end\n end\n\n # After finding the best hand it stores it for the player and outputs it.\n player.strongest_hand = @best_hand\n puts \"#{player.player_name} has #{player.strongest_hand}\"\n sleep(1)\n end\nend",
"def find_winner(move)\n condition1 = (move / 3).ceil * 3\n condition2 = (move - 1) % 3\n line = players[turn % 2].symbol + players[turn % 2].symbol + players[turn % 2].symbol\n winner_conditions(condition1, condition2, line)\n end",
"def determine_game_winner(p1, p2)\n winning_choices = {spock: [\"scissors\", \"rock\"], paper: [\"rock\", \"spock\"], scissors: [\"paper\", \"lizard\"], rock: [\"scissors\", \"lizard\"], lizard: [\"spock\", \"paper\"]}\n \n if p1.move == p2.move\n winner = Player.new(\"Neither\")\n elsif\n winning_choices[p1.move.to_sym].include?(p2.move.to_s)\n winner = p1\n else\n winner = p2\n end\n winner.score += 1\n return winner\n end",
"def best_distance_attempts\n best_attempts_for_each_competitor = competitors.map(&:max_successful_distance_attempt).compact\n\n best_attempts_for_each_competitor.sort{ |a, b| b.distance <=> a.distance }\n end",
"def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_TOTAL\n :player_busted\n elsif dealer_total > WINNING_TOTAL\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend",
"def best_match(reviewer_similarity)\n sorted_list = reviewer_similarity.sort_by {|k,v| -v}\n sorted_list[0..20].each do |val|\n @best_match.push(val[0])\n end\n end",
"def detect_result(dealer_cards, player_cards)\n player_total = total(player_cards)\n dealer_total = total(dealer_cards)\n\n if player_total > WINNING_VALUE\n :player_busted\n elsif dealer_total > WINNING_VALUE\n :dealer_busted\n elsif dealer_total < player_total\n :player\n elsif dealer_total > player_total\n :dealer\n else\n :tie\n end\nend"
] |
[
"0.7321418",
"0.71831596",
"0.67357004",
"0.66314554",
"0.6460764",
"0.6365369",
"0.6320158",
"0.6278198",
"0.6260675",
"0.623123",
"0.61076343",
"0.6069894",
"0.6042041",
"0.59932053",
"0.5979605",
"0.5977265",
"0.5960466",
"0.595597",
"0.5953762",
"0.59519035",
"0.59418917",
"0.5916464",
"0.5911291",
"0.58974695",
"0.5894445",
"0.5883176",
"0.5870173",
"0.58433014",
"0.58349484",
"0.58234006",
"0.5820278",
"0.5802062",
"0.5788991",
"0.57734466",
"0.5769341",
"0.5762804",
"0.57592285",
"0.5757557",
"0.57489544",
"0.5736368",
"0.57274187",
"0.5711857",
"0.5706155",
"0.57050973",
"0.5698645",
"0.5698026",
"0.56863004",
"0.5677352",
"0.5661303",
"0.56494987",
"0.56329626",
"0.56155014",
"0.5613259",
"0.5610232",
"0.56061506",
"0.56054723",
"0.5601681",
"0.5593205",
"0.5583692",
"0.55721587",
"0.55632484",
"0.55613774",
"0.5546006",
"0.55437803",
"0.55381477",
"0.553536",
"0.5534704",
"0.55329674",
"0.55224955",
"0.55190873",
"0.551787",
"0.55080473",
"0.55070704",
"0.55068624",
"0.55065024",
"0.5494595",
"0.5487503",
"0.5464492",
"0.54644066",
"0.545745",
"0.5437087",
"0.54295146",
"0.5428314",
"0.54244643",
"0.5417479",
"0.54134804",
"0.54012537",
"0.5390188",
"0.5386253",
"0.53817207",
"0.5380545",
"0.53803426",
"0.5374245",
"0.5373081",
"0.53708017",
"0.5367588",
"0.5367079",
"0.5364308",
"0.5363231",
"0.5362877"
] |
0.85961664
|
0
|
gets loser by sorting the two cars by speed; car with lower speed will be first and is the loser
|
def loser
@cars.sort_by(&:speed).first
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def winner\n @cars.sort_by(&:speed).last\n end",
"def sort_drivers\n @drivers.sort! {|x, y| y.miles_driven <=> x.miles_driven}\n end",
"def cars_sorted_by_price\n @inventory.sort_by { |car| car.total_cost }\n end",
"def sortByDistanceFrom(otherLocation)\n ParkingSpots.new(@_parkingSpots.sort { |a, b|\n a.metersFromLocation(otherLocation) <=> b.metersFromLocation(otherLocation)\n })\n end",
"def speed_order\r\n\t\t\tall_champions = @team.concat(@opp_team)\r\n\t\t\tspeed_hash = Hash.new\r\n\t\t\tfor x in 0..9\r\n\t\t\t\tspeed_hash[x] = all_champions[x].ms\r\n\t\t\t\tcreate_speed_record(x,all_champions[x].ms)\r\n\t\t\tend\r\n\t\t\tsorted_speed_hash = speed_hash.sort_by{|num,speed| speed}.reverse\r\n\t\t\tnew_speed_array = Array.new\r\n\t\t\tsorted_speed_hash.each do |num, speed|\r\n\t\t\t\tnew_speed_array << num\r\n\t\t\tend\r\n\t\t\tcreate_order_record(new_speed_array)\r\n\t\t\tnew_speed_array\r\n\t\tend",
"def determine_winner\n @active_players.sort! do |player1, player2|\n if player1.strongest_hand > player2.strongest_hand\n -1\n elsif player1.strongest_hand < player2.strongest_hand\n 1\n else\n 0\n end\n end\nend",
"def sort_drivers_by_miles\n\t\t@drivers.sort_by { |key,driver| -driver.trip_total_miles }\n\tend",
"def first_turn(pokemon1, pokemon2)\n if pokemon1.base_stats[:speed] > pokemon2.base_stats[:speed]\n 1\n elsif pokemon1.base_stats[:speed] == pokemon2.base_stats[:speed]\n rand(1..2)\n else\n 2\n end\n end",
"def locate_restro_with_price\n @restro.each do |restaurant, menu|\n @restaurants.concat optimal_price_restaurant(menu, restaurant)\n end\n @restaurants.sort! do |x,y|\n x[:price] <=> y[:price]\n end\n end",
"def sort_by_model_then_year\n @garage.sort_by{\n |car1, car2| (car1.class.to_s, car1.model_year) <=> (car2.class.to_s, car2.model_year)\n }\n end",
"def min_speed\r\n if @pitches.size > 0\r\n return (@pitches.min {|a,b| a.start_speed.to_f <=> b.start_speed.to_f }).start_speed\r\n end\r\n return 0\r\n end",
"def best_lap\n best_lap = []\n self.voltas.each { |lap_num, lap_stat| best_lap << [lap_num, lap_stat] }\n best_lap.sort! {|x,y| x[1][:tempo] <=> y[1][:tempo]}\n best_lap = best_lap[0]\n return best_lap\n end",
"def get_best_rated(drivers)\n best_rated = nil\n best_avg = 0\n drivers.each do |driver, rides|\n current_avg = get_avg_rating(rides)\n if best_avg < current_avg\n best_rated = driver\n best_avg = current_avg\n end\n end\n return best_rated\nend",
"def best_target\n far_enough = competitors.select do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) >= RTanque::Bot::Turret::LENGTH\n end\n far_enough.sort_by do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) +\n (competitor.name == NAME ? 1000 : 0)\n end.first\n end",
"def sorted_races\n races.sort\n end",
"def best_distance_attempts\n best_attempts_for_each_competitor = competitors.map(&:max_successful_distance_attempt).compact\n\n best_attempts_for_each_competitor.sort{ |a, b| b.distance <=> a.distance }\n end",
"def update_speed (orbit)\n self.top_speed > orbit.traffic_speed ? orbit.traffic_speed : self.top_speed\n end",
"def try_sort\n # Sort the table if the first element next_start_time has changed\n if false && @next_start_time != @sprinkles[0].next_start_time\n @sprinkles.sort_by! {|s| s.next_start_time}\n @next_start_time = @sprinkles[0].next_start_time\n end\n end",
"def winner(speed1, speed2, speed3)\nif speed3 > speed2 && speed3 > speed1\n puts \"Person 3 was the fastest at #{speed3} m/s\"\nelsif speed2 > speed3 && speed2 > speed1\n puts \"Person 2 was the fastest at #{speed2} m/s\"\nelsif speed1 > speed3 && speed1 > speed2\n puts \"Person 1 was the fastest at #{speed1} m/s\"\nelsif speed1 == speed2 && speed2 == speed3\n puts \"Everyone tied at #{speed1} m/s\"\nelse\n puts \"Well done everyone!\"\nend\nend",
"def dominant_octopus(fishes)\n prc = Proc.new { |a, b| a <=> b }\n\n fishes.merge_sort(prc).first\nend",
"def get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend",
"def max_speed\r\n if @pitches.size > 0\r\n return (@pitches.max {|a,b| a.start_speed.to_f <=> b.start_speed.to_f }).start_speed\r\n end\r\n return 0\r\n end",
"def calculate_computers_move\n available_squares.zip(next_scores).sort_by { |key, value| value }.reverse.first.first\n end",
"def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is one cycle with 3 registers.\n spillee = component.first.src\n end\n end\n\n # Break the cycle.\n spill(spillee) if spillee\n\n tsort\n end",
"def order_by_value\n @hand = @hand.sort_by{|card| card.point }\n end",
"def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end",
"def compute_best_distance sec\n min_improper,sec_improper=(min_proper,sec_proper=sec.divmod(60))\n if min_improper>0 and sec_improper<40\n min_improper-=1\n sec_improper+=60\n else\n #the improper time will be the same as the proper time, which\n #isn't a problem\n end\n proper=make_array(min_proper,sec_proper)\n improper=make_array(min_improper,sec_improper)\n [[\n compute_dist(proper,Primary),\n compute_dist(proper,Tiebreaker),\n proper\n ],[\n compute_dist(improper,Primary),\n compute_dist(improper,Tiebreaker),\n improper\n ]].sort[0][-1].join\nend",
"def tournament_players_sorted_by_prestige\n TournamentPlayer.where(:tournament_id => self.id).order(\"prestige DESC\").order(\"match_points DESC\")\n end",
"def tie_breaker_single hand2\n values.sort.reverse <=> hand2.values.sort.reverse\n end",
"def <=>(other)\n @logger = Logger.new(\"#{Rails.root}/log/cache_read.log\")\n @logger.debug \"--sort: comparing: #{other.match_rate} vs #{@match_rate}\"\n return (other.match_rate <=> @match_rate)\n end",
"def dominant_octopus(fish)\n merge_sort(fish)[-1]\nend",
"def players\n [@player1, @player2].sort_by { |player| player.first ? 0 : 1 }\n end",
"def best_match(reviewer_similarity)\n sorted_list = reviewer_similarity.sort_by {|k,v| -v}\n sorted_list[0..20].each do |val|\n @best_match.push(val[0])\n end\n end",
"def find_vehicle_by_price(vehicle_type, price)\n vehicle = @list_vehicles[vehicle_type] ||= @list_vehicles[SMALLEST_VEHICLE]\n while( price > vehicle.price_limit)\n vehicle = @list_vehicles[vehicle.next_vehicle]\n end\n return vehicle\n end",
"def best_picks\n self.picks.sort_by{|pick| pick.points}.reverse!.first(5)\n end",
"def sort_pets_by_breed(shelter)\n shelter.pets.group_by do |pet|\n pet.breed\n end\n end",
"def determine_score\n point1 = @player1.points\n point2 = @player2.points\n\n if point1 > 2 and point2 > 2\n if point1 == point2\n @player1.deuce = true\n @player2.deuce = true\n elsif point1 > point2\n @player1.advantage = true\n elsif point2 > point1\n @player2.advantage = true\n end\n end\n end",
"def player_sort()\n\t\tsession[:player].sort {|a, b| a.total_score <=> b.total_score }\n\tend",
"def reevaluate_car_strategies\n # puts \"Evaluating strategies. Current time is #{@t}\"\n\n if @t > 300\n puts \"Cars left at time 300 (much to late):\"\n @cars.each { |c| puts c.uid }\n exit -1\n end\n\n #if @t < 200 and @t < @t.round + 0.05 and @t > @t.round - 0.05\n # puts \"Time #{@t}. Car positions are:\"\n # @cars.each { |c| puts \"#{c.uid}\\tat #{c.position}\" }\n #end\n\n\t @cars.each do |car|\n # If the car is past the simulation, stop moving it, and schedule its leave event\n if car.position*MILES_FT >= 2*DISTANCE_EDGE_MIDDLE\n puts \"Scheduling that #{car.uid} must leave at time #{@t}. It's at #{car.position*MILES_FT}\"\n # Schedule that the car leaves ALMOST now\n queue_event @t+0.0000001, Event.new(:car_finished, {:car => car})\n end\n\n # Move the car first to calculate is current position\n if !car.waiting\n car.position += car.current_speed * TRACE_PERIOD / (MINUTE*MINUTE) # position is in miles\n end\n\n # Re-evaluate the speed to be taken\n if car.position*MILES_FT <= DISTANCE_EDGE_MIDDLE - DISTANCE_TO_CROSSWALK/2 and car.position*MILES_FT > DISTANCE_EDGE_MIDDLE - DISTANCE_TO_CROSSWALK/2 - car.speed * MPH_FTPS * TRACE_PERIOD\n puts \"Car #{car.uid} is near the stoplight. It's at position #{car.position*MILES_FT}. Stoplight is #{@stoplight_state}\"\n if @stoplight_state == :GREEN\n # We're good to go forth\n car.at_stoplight = false\n car.waiting = false\n car.current_speed = car.speed\n\n # Both are conditionally set, since the light may be green, and thus we have no wait time\n car.wait_start ||= @t\n car.wait_finish ||= @t\n add_wait_point_for_car car\n else\n # Stop for the light\n car.at_stoplight = true\n car.waiting = true\n car.current_speed = 0\n\n # Conditional set, since this will continually happen as the light is waited on\n car.wait_start ||= @t\n end\n else\n # Not at the stoplight yet.\n car.at_stoplight = false\n ahead = get_car_ahead car\n if ahead.nil?\n # Go ahead normally; at full speed, no acceleration (those are default current_speed and current_acceleration)\n car.waiting = false\n car.current_speed = car.speed\n else\n car_bubble = 40\n brake_distance = 0\n # if where i will wind up (including the evolution of what my speed could be) is going to wind up inside (or after) the car in front's bubble, then stop\n if car.position*MILES_FT + brake_distance + car.speed*MPH_FTPS*TRACE_PERIOD >= ahead.position*MILES_FT - car_bubble\n car.waiting = true\n car.current_speed = 0\n else\n # Full speed ahead!\n car.waiting = false\n car.current_speed = car.speed\n end\n\n # inherit the ahead car's wait times iff we haven't reached the crosswalk yet (which is why it's a conditional set)\n justset_start = false\n justset_finish = false\n if !ahead.wait_start.nil? and car.wait_start.nil?\n car.wait_start ||= ahead.wait_start\n justset_start = true\n end\n if !ahead.wait_finish.nil? and car.wait_finish.nil?\n car.wait_finish ||= ahead.wait_finish\n justset_finish = true\n end\n\n if (justset_start or justset_finish) and !car.wait_start.nil? and !car.wait_finish.nil?\n add_wait_point_for_car car\n end\n end\n end\n end\n\tend",
"def kangaroo(kanga1, rate1, kanga2, rate2)\n if kanga1 == kanga2\n return true\n end\n if kanga1 < kanga2 && rate1 < rate2 || kanga2 < kanga1 && rate2 < rate1\n return false\n end\n\n if kanga1 < kanga2\n first = kanga1\n last = kanga2\n first_speed = rate1\n last_speed = rate2\n else\n first = kanga2\n last = kanga1\n first_speed = rate2\n last_speed = rate1\n end\n\n while first <= last do \n last += last_speed\n first += first_speed\n if first == last \n return true\n end\n end\n false\nend",
"def compare\n if self.terms.all? { |t| t.results[:count] }\n @winner, @loser = self.count_winner_loser\n elsif self.terms.all? { |t| t.results[:seconds] }\n @winner, @loser = terms.sort_by { |t| t.results[:seconds] }\n else\n @winner = terms.select { |t| t.results[:seconds]}[0]\n @loser = terms.select { |t| t.results[:count]}[0]\n end\n end",
"def compare_further p1hand, p2hand, rank, secondary\n p1values = p1hand.map{|c| $value_map[c[0]]}.sort\n p2values = p2hand.map{|c| $value_map[c[0]]}.sort\n # no further comparison if it's a straight\n return 0 if rank == 9 || rank == 8 || rank == 4\n if rank == 7 # four of a kind\n comp1 = (p1values[0] == secondary ? p1values[4] : p1values[0])\n comp2 = (p2values[0] == secondary ? p2values[4] : p2values[0])\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank == 6 # full house\n comp1 = (p1values - [secondary]).uniq[0]\n comp2 = (p2values - [secondary]).uniq[0]\n return 1 if comp1 > comp2\n return 2 if comp2 > comp1\n return 0\n end\n if rank <= 5 # all remaining ranks\n comp1 = (p1values - [secondary]).uniq.reverse\n comp2 = (p2values - [secondary]).uniq.reverse\n comp1.each_with_index do |e,i|\n return 1 if e > comp2[i]\n return 2 if comp2[i] > e\n end\n return 0\n end\nend",
"def sort\n @pokers.sort.reverse\n end",
"def ready_go\n @cars << Car.new\n @cars << Car.new\n\n @cars.first.accelerate(random_speed)\n @cars.last.accelerate(random_speed)\n end",
"def average_descending_speed(ride)\n duration = descending_duration(ride)\n return 0 if duration == 0\n descending_distance(ride) / duration\n end",
"def tie_breaker_cards\n matched = self.matched_cards\n sorted = @cards.sort.reverse\n # sorted so the card with highest value is first \n if five_of_a_kind? \n # All cards break the tie\n return sorted \n elsif flush?\n # All cards break the tie\n return sorted \n elsif four_of_a_kind?\n four = matched.find{ |rank, cards| cards.size == 4}\n # quads break the tie first, then the other card \n return four + [(sorted - four).first] \n elsif full_house?\n three = matched.find{ |rank, cards| cards.size == 3}\n two = matched.find{ |rank, cards| cards.size == 2}\n return three + two\n elsif straight?\n # Special case for ace, 2, 3, 4 ,5 straight, which sorts as\n # 2,3,4,5,A \n if sorted.first.rank == Rank::Ace && sorted.last.rank == Rank::Two \n ace = sorted.pop \n sorted.unshift(ace) # put ace at the back\n return [ sorted.first ] # should be the 5 now \n else\n return [ sorted.first ] \n end\n elsif three_of_a_kind?\n three = matched.find{ |rank, cards| cards.size == 3} \n return three + (sorted - three).first(2)\n elsif two_pair?\n pairs = [] \n matched.each{ |rank, cards| pairs << cards if cards.size == 2 } \n two_pair = pairs[0] + pairs[1]\n two_pair + [(sorted - two_pair).first]\n elsif pair?\n two = matched.find{ |rank, cards| cards.size == 2} \n two + (sorted - two).first(3)\n else\n sorted.first(5)\n end\n end",
"def find_closest_pair(pairs)\n zz = {:x => 0, :y => 0}\n distances_from_zz = pairs.map { |p| {:distance => distance(p, zz), :point => p} } # O(n)\n cloest_pair = distances_from_zz.sort { |p1, p2|\n dist = abs(p1[:distance] - p2[:distance])\n puts dist\n dist\n }.take(2)\n cloest_pair.map { |p| \"#{p[:point][:x]}, #{p[:point][:y]} -- distance: #{p[:distance]}\" }\nend",
"def sort_by_price_usd\n coins.sort_by { |coin| coin.price_usd }.reverse\n end",
"def sort_by_size(x,y)\n sizes = [\"Small\",\"Medium\",\"Large\",\"X-Large\",\"2X-Large\",\"3X-Large\"]\n cmp = sizes.index(x.tshirt) <=> sizes.index(y.tshirt)\n if cmp == 0\n x.name <=> y.name\n else\n cmp\n end\n end",
"def dominant_octopus(fishes)\n fishes.merge_sort[-1]\nend",
"def determine_speed(speed, change)\n\t\tif speed + change < 0\n\t\t\tif speed + change > -3\n\t\t\t\treturn speed += change\n\t\t\telse\n\t\t\t\treturn speed = -2\n\t\t\tend\n\t\telse\n\t\t\tif speed + change < 3\n\t\t\t\treturn speed += change\n\t\t\telse\n\t\t\t\treturn speed = 2\n\t\t\tend\n\t\tend\n\tend",
"def break_tie(other_hand) \n mycards = self.tie_breaker_cards\n othertb = other_hand.tie_breaker_cards\n stop = mycards.size\n for i in (0...stop) do\n res = mycards[i] <=> othertb[i]\n # Tie is broken\n # Note that wildcards will retain their own value\n # This means that, for example if deuces are wild,\n # a K K K three of a kind will beat a K K 2 three of a kind \n return res if res != 0 \n end \n # If we came here it's a split pot\n return 0\n end",
"def new_race(car_1,car_2)\n # binding.pry\n uc = user.user_cars.find{|current_uc| current_uc.car.model == car_1.model}\n system(\"clear\")\n if uc.condition < 75\n uc.top_speed_nerf()\n elsif uc.condition < 50 \n uc.top_speed_heavy_nerf()\n end \n # binding.pry \n if uc.uc_top_speed > car_2.top_speed\n system(\"say 'Congratulations #{user.name} You Won!'\") \n puts \"#{car_1.make} #{car_1.model} vs #{car_2.make} #{car_2.model}\"\nputs \" 🚁 \\n \n🏢 🏢 🌴🏦 🏚️ 🏫 🌳 ⛪ 🏥 🏪 🏠🏠🌴 🏤 🌴 🏢 🌳🌳 \\n\n🚙 🚓 🚓 🚓 \\n\n 🚗 🚓 🚓 🚓 🚓 \\n\\n\\n\"\n puts \"YOU WIN! \\n\\n\\n$#{(car_2.value * 0.65).to_i} will be added to your balance.😎 Your record is now #{user.wins}-#{user.losses}!\" \n user.last_desc = \"W\"\n uc.won(car_1,car_2) \n uc.deteriorate()\n menu()\n else \n system(\"say 'Gotta be quicker than that!'\")\n puts \"#{car_1.make} #{car_1.model} vs #{car_2.make} #{car_2.model}\"\n puts \"Hold this L. \\n\\n\\nYou lost $#{(car_2.value * 0.65).to_i}.😤 You are now #{user.wins}-#{user.losses}\"\n $user.last_desc = \"L\"\n uc.lost(car_1,car_2)\n uc.deteriorate()\n menu()\n end \nend",
"def comparePrice(x,y)\n if x.price < y.price\n result = -1\n elsif x.price > y.price\n result = 1\n elsif x.price == y.price\n result = 0\n end\n \n # Switch when in descendant order\n case @order\n when 1\n result *= -1 \n end\n \n return result\n end",
"def sort_cyclists_race(race)\n sorted_cyclists = []\n nil_cyclists = []\n stage_max_points = Array.new(race.stages.count, 1)\n\n race.stages.each_with_index do |stage, index|\n race.cyclists.each do |cyclist| \n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage)\n stage_max_points[index] = stage_max_points[index] + 1 if stage_effort\n end\n end\n\n race.cyclists.each_with_index do |cyclist, index| \n total_time = 0\n total_points = 0\n stage_effort = nil\n\n race.stages.each_with_index do |stage, ix_stage|\n today = Time.now.to_date # race.stages.last.close_date\n if stage.close_date >= today\n stage_effort = cyclist.stage_efforts.find_by(stage_id: stage)\n if stage_effort\n total_time = total_time + stage_effort.elapsed_time.to_i\n total_points = total_points + stage_effort.points.to_i\n else\n #break\n total_points = total_points + stage_max_points[ix_stage]\n end\n end\n end\n\n if total_time > 0\n sorted_cyclists << { 'cyclist' => cyclist, 'total_time' => total_time, 'total_points' => total_points} \n else\n nil_cyclists << { 'cyclist' => cyclist, 'total_time' => 'DNF', 'total_points' => total_points} \n end\n end\n\n nil_cyclists.sort_by!{|a| a['total_points']}\n\n #sorted_cyclists.sort_by!{|k| k['total_points'].to_i}.reverse!\n sorted_cyclists.sort! do |a, b|\n [a['total_points'], a['total_time']] <=> [b['total_points'], b['total_time']]\n end\n\n return sorted_cyclists + nil_cyclists\n end",
"def train_travel(first_stop, last_stop, line)\n line_stop = @railwayslines[line]\n\n stop_a = line_stop.index(first_stop)\n stop_b = line_stop.index(last_stop)\n if stop_a < stop_b\n travelled = line_stop[stop_a..stop_b]\n else\n travelled = line_stop[stop_b..stop_a]\n travelled = travelled.reverse\n # return travelled\n end\n travelled\nend",
"def sort_trips_by_driver(trips, number_of_drivers)\n trips_sorted_by_driver_id = Array.new(number_of_drivers) { |i| i = [] }\n trips.each do |trip|\n number_of_drivers.times do |i|\n trips_sorted_by_driver_id[i] << trip if trip.driver_id == i\n end\n end\n trips_sorted_by_driver_id\n end",
"def compile_report\n sorted_drivers = @drivers.sort_by { |driver| driver.total_distance }\n sorted_drivers.each do |driver|\n if driver.average_speed.to_i >= 5 && driver.average_speed.to_i <= 100\n puts \"#{driver.name}: #{driver.total_distance.to_i} miles @ #{driver.average_speed.to_i} mph\"\n end\n end\n end",
"def <=>(hand)\n result = set_tiers[self.tier] <=> set_tiers[hand.tier]\n \n return result unless result == 0\n ke_sort(self.numbers) <=> ke_sort(hand.numbers)\n end",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def elo_rating(score1,score2)\n \tif score1 < 2100 or score2 < 2100\n \t\tk = 32\n \telsif score1 < 2401 or score2 < 2401\n \t\tk = 24\n \telse\n \t\tk = 16\n \tend\n\n \td = score1 - score2\n \tf = 400\n\n \twinner = k*(1 - (1/(10**((-d/f)+1))))\n \tloser = k*(-(1/(10**((d/f)+1))))\n\n \treturn [winner,loser]\n end",
"def average_ascending_speed(ride)\n duration = ascending_duration(ride)\n return 0 if duration == 0\n ascending_distance(ride) / duration\n end",
"def loser\n return winner == :player_a ? :player_b : :player_a\n end",
"def agents_nearest(coord, count)\n living_agents.sort_by{ |a| coord.vector_to(a.tank).length }[0...count]\n end",
"def pedal_faster\n @speedometer = @speedometer + 10\n end",
"def calculate_drivers_overhead_using_google_api()\n \n # Batching Google APIs\n p \"Batch drivers Sources #{batch_drivers_sources}\"\n p \"passenger_source #{passenger_source}\"\n p \"API #{GoogleMapsApi::DRIVERS_OVERHEAD}\"\n drivers_srcs_passenger_src = GoogleMapsApi.calculate_batch_cost_metric(\n batch_drivers_sources, [passenger_source],\n GoogleMapsApi::DRIVERS_OVERHEAD)\n @drivers.each_with_index do |driver,i|\n value = drivers_srcs_passenger_src[i]\n unless value.blank?\n driver[:distance] = {:distance => value[0], :time => value[1]}\n else\n @drivers -=[driver]\n end\n end\n end",
"def clip_speed\n @speed = [@speed, @top_speed].min\n end",
"def winner\n players.sort.last\n end",
"def winner player1, player2\n player1.health > player2.health ? player1 : player2\n end",
"def sort_by_rating(nearby_places)\n nearby_places.sort_by! {|place| place.values[0][:rating]}\n\n nearby_places.reverse\nend",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by {|team_info| [-team_info[1][:wins], -team_info[1][:ties], team_info[1][:losses]]}\nend",
"def get_from_direction(fromsc,tosc)\n ((fromsc.number < tosc.number) ? ARTERY[:sc1] : ARTERY[:sc2])[:from_direction] \nend",
"def get_loser\n if self.hero_1_id != self.winner_id\n self.hero_1_id\n else \n self.hero_2_id\n end\n end",
"def sort_actors(x, y)\n if x < y\n result = -1\n elsif x > y\n result = 1\n elsif x == y\n result = 0\n end\n \n return result\n end",
"def compare_kickers(other)\n kicker_cards.each_with_index do |kicker, i|\n other_kicker = other.kicker_cards[i]\n compared_by_kicker = kicker <=> other_kicker\n return compared_by_kicker unless compared_by_kicker == 0\n end\n 0\n end",
"def sort_player_cards(player)\n p_cards = player.get_player_cards\n p_cards.sort! { |a,b| a.card_weight <=> b.card_weight }\n p_cards.each_with_index do |card, index|\n if self.trump_card.card_type.name == card.card_type.name\n p_cards.delete_at(index)\n p_cards.push(card)\n end\n end\n player.player_cards = p_cards\n send_update\n end",
"def dominant_octopus(fishes)\n prc = Proc.new { |x, y| x.length <=> y.length }\n fishes.merge_sort(&prc).last\nend",
"def cheapest_price\n # CARYN SAYS: this should be cheapest restaurant! \n Recipe.all.min { |recipe_a, recipe_b| recipe_a.average_price <=> recipe_b.average_price }\n end",
"def sort2 (a,b)\n if a > b\n return a,b\n else\n return b,a\n end\nend",
"def best_laps\n best_laps = []\n RACER_RECORDS.each {|racer| best_laps << [ racer.piloto, racer.best_lap ]}\n @view.display_best_laps(best_laps)\n end",
"def max_ascent_speed; end",
"def most_money(rideshare)\n highest_earned = 0.0\n high_earner = \"\"\n # call method from #2\n money_made(rideshare).map do |driver, cost|\n if cost > highest_earned\n highest_earned = cost\n high_earner = driver\n end\n end\n return high_earner\nend",
"def dominant_sort(fish)\n return fish if fish.length <= 1\n\n mid = fish.length / 2\n\n left = fish[0...mid]\n right = fish[mid..-1]\n\n left_sorted = dominant_sort(left)\n right_sorted = dominant_sort(right)\n\n sorted = dominant_merge(left_sorted, right_sorted)\nend",
"def detect_result(player, dealer)\n if player > WINNING_SCORE\n :player_busted\n elsif dealer > WINNING_SCORE\n :dealer_busted\n elsif dealer < player\n :player\n elsif dealer > player\n :dealer\n else\n :tie\n end\nend",
"def sort_snps\n @snps.sort!{|x,y| x.location <=> y.location}\n end",
"def normal_speed(speed,takeoff_speed)\n return speed/takeoff_speed\nend",
"def pedal_faster\n @current_speed = @current_speed+1\n end",
"def <=>(other_home)\n price <=> other_home.price\n end",
"def compare_by_points(other, break_ties = true)\n diff = other.points <=> points\n return diff if diff != 0 || !break_ties\n\n diff = compare_by_highest_place(other)\n return diff if diff != 0\n\n diff = compare_by_most_recent_place(other)\n return diff if diff != 0\n\n 0\n end",
"def rule2\n c = V::ZERO\n\n hits = 0\n\n nearby.each do |b|\n next if self == b\n diff = b.position - self.position\n next unless diff.magnitude.abs < TOO_CLOSE\n hits += 1\n c -= diff if diff.magnitude.abs < TOO_CLOSE\n end\n\n c /= hits unless hits == 0 # average it out so they don't overdo it\n\n c / 8\n end",
"def traveling_time(distance)\n \n hour = Time.new.hour\n bus_speed = 0\n taxi_speed = 0\n \n # vehicle speeds depend on time of day\n case hour\n when 5..8\n bus_speed = 0.6 # km/minute 30km/hour\n \n when 9..13\n bus_speed = 0.5\n \n when 14..16\n bus_speed = 0.6\n \n when 17..20\n bus_speed = 0.4\n \n when 21..23\n bus_speed = 0.8\n \n when 0..4\n bus_speed = 0.000001\n end\n\n case hour\n when 5..8\n taxi_speed = 0.9 # km/minute 30km/hour\n \n when 9..13\n taxi_speed = 0.8\n \n when 14..16\n taxi_speed = 0.9\n \n when 17..20\n taxi_speed = 0.6\n \n when 21..23\n taxi_speed = 0.9\n \n when 0..4\n taxi_speed = 1.0\n end\n \n time_taken_in_bus = distance.to_f / bus_speed.to_f\n time_taken_in_taxi = distance.to_f / taxi_speed.to_f\n return time_taken_in_bus #, time_taken_in_taxi\nend",
"def recombine (halved)\n left = halved.first\n right = halved.last\n sorted = []\n\n\n\nend",
"def prefered_vendor\n vendors_array = vendors\n\n highest_revenue = 0\n best_vendor = nil\n\n vendors_array.each do |vendor|\n vendor_revenue = vendor.revenue\n if vendor_revenue > highest_revenue\n highest_revenue = vendor_revenue\n best_vendor = vendor\n end\n end\n\n return best_vendor\n end",
"def |(other)\n vals = [\n first,\n other.first,\n actual_last,\n other.actual_last\n ].sort\n\n (vals.first..vals.last)\n end",
"def descending_distance(ride)\n descending_point_pairs(ride).inject(0) { |total, pair| total + distance_between(*pair) }\n end",
"def cards_sorted_ace_high\n @cards_sorted_ace_high ||= @cards.sort!.reverse!\n end",
"def sort_by_decending_rating\n self.find_recipe_card_by_user.sort_by {|recipe| recipe.rating}.reverse\n end",
"def create_leaderboard(team_scorecard)\n #sort scorecard first by wins in decending order\n #sort scorecard then by ties in decending order\n #sort scorecard last by losses in ascending order\n team_scorecard.sort_by! {|team_info| [team_info[1][:wins], team_info[1][:ties], -team_info[1][:losses]]}.reverse!\nend",
"def SecondGreatLow(arr)\n second_low = \"\"\n second_high = \"\"\n \n arr = arr.uniq\t\n if arr.length > 2 \n arr = arr.sort!\n second_low = arr[1]\n second_high = arr[-2]\n \n elsif arr.length == 2 \n arr.sort\n second_low = arr[1]\n second_high = arr[0]\n end\n return [second_low, second_high].join(\" \")\n \nend",
"def calculate_winner players\n\n sorted_cards = @card_list.sort # sort cards in 'poker' order\n players.each_with_index {|player, i|\n if sorted_cards[-1] == player.get_last_card_played\n @last_winner=player.name\n end\n }\n # Switched off this observation for the moment\n #changed\n #notify_observers(sorted_cards[-1].to_string)\n\n if sorted_cards[-1].to_string_other.include?(\"FIVE\") then\n changed\n notify_observers(@last_winner,sorted_cards[-1].to_string)\n end\n\n sorted_cards[-1] # return best card\n end"
] |
[
"0.73397356",
"0.6214933",
"0.61986405",
"0.5973509",
"0.593515",
"0.5872672",
"0.5830151",
"0.5787065",
"0.5775618",
"0.5654479",
"0.556985",
"0.53686947",
"0.5350722",
"0.5286217",
"0.52636844",
"0.5244282",
"0.5231909",
"0.52247494",
"0.52035016",
"0.52019566",
"0.519644",
"0.51648194",
"0.5163064",
"0.5162334",
"0.51594007",
"0.51570433",
"0.5127807",
"0.5098415",
"0.50929546",
"0.50885403",
"0.5080768",
"0.5072217",
"0.5069526",
"0.50611407",
"0.50472444",
"0.5044502",
"0.504078",
"0.5039237",
"0.5038211",
"0.5033906",
"0.5011196",
"0.5004764",
"0.5000252",
"0.49908945",
"0.49899086",
"0.4986038",
"0.49779785",
"0.49764392",
"0.49682987",
"0.49590263",
"0.49583998",
"0.49579972",
"0.49402836",
"0.4939949",
"0.49190348",
"0.49159077",
"0.4912736",
"0.4900235",
"0.4896681",
"0.48961878",
"0.4884229",
"0.48780718",
"0.48776504",
"0.4865334",
"0.48606095",
"0.4858956",
"0.48559538",
"0.48509678",
"0.48422775",
"0.48386186",
"0.4836461",
"0.48356247",
"0.482819",
"0.48199937",
"0.4816605",
"0.48141676",
"0.4813947",
"0.48106548",
"0.48078886",
"0.48072553",
"0.48070148",
"0.47978985",
"0.4793237",
"0.4788598",
"0.47807306",
"0.477953",
"0.4778419",
"0.47782817",
"0.47771686",
"0.47547838",
"0.4753088",
"0.4741553",
"0.47370854",
"0.47349358",
"0.47348723",
"0.4732169",
"0.47310024",
"0.47246584",
"0.47234067",
"0.47231066"
] |
0.84053016
|
0
|
Wait for the poller thread to finish.
|
def join
@poller.join if @poller
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def wait\n @thread.join\n end",
"def wait\n # Here we use a loop-sleep combination instead of using\n # ThreadPoolExecutor's `wait_for_termination`. See issue #21 for more\n # information.\n loop do\n break if @executor.shutdown?\n sleep 0.1\n end\n end",
"def wait\n @timer_thread.join\n end",
"def wait!\n Thread.pass until @pool.njobs == 0\n end",
"def wait!\n until query_done?\n check_cancel\n periodic_callback\n sleep @poll_every\n end\n check_errors\n end",
"def wait_until_available\n return unless @locked\n\n @mutex.lock\n @mutex.unlock\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait\n @notifier.wait if @notifier\n end",
"def wait_until_available\n return unless locked?\n\n @mutex.synchronize {}\n end",
"def wait_for_thread_pool!\n @thread_pool.join_pool_threads!\n end",
"def wait\n @running.reset\n @waiting.set\n @running.wait\n end",
"def wait\n # it might be awaken by some other futures!\n mutex.synchronize{ condv.wait(mutex) until done? } unless done?\n end",
"def wait\n\t\t\t\t@available.wait\n\t\t\tend",
"def wait\n self.listener.wait if self.listener\n end",
"def wait\n waitUntilStarted\n\n @resultsSemaphore.wait\n end",
"def wait_for_shutdown\n @rufus.join\n end",
"def wait\n @wait.synchronize do\n sleep 1 while @count >= THREAD_MAX\n @count += 1\n end\n end",
"def wait\n loop do\n refresh\n fail Exceptions::PushJobFailed, @job if timed_out?\n fail Exceptions::PushJobFailed, @job if failed?\n break if successful?\n pause\n end\n end",
"def wait\n if defined? @result\n return @result\n else\n @waiters << Eventlet.current\n Eventlet.sleep\n end\n end",
"def wait\n # it might be awaken by some other futures!\n mutex.synchronize{ condv.wait(mutex) until resolved? } unless resolved?\n end",
"def wait\n if job = @queue.last\n EM::Synchrony.sync(job.request)\n EM::Synchrony.sync(job.response.body) if job.response\n end\n end",
"def wait_done\n sleep 0.01 until done?\n end",
"def blocking_thread\n poller_thread\n end",
"def wait\n @future.value\n end",
"def wait\n @t.each{|t| t.join}\n end",
"def wait_for_complete\n @logger.debug(\"Waiting for workers to complete their work - #{@available_workers.length}\")\n count = 0\n while count < @workers.length\n @available_workers.pop\n count += 1\n @logger.debug(\"#{count} Worker(s) done, out of #{@workers.length}\")\n end\n\n # Put the workers back into the available workers pool\n @workers.each { |w| @available_workers.push(w) }\n\n @logger.debug(\"All workers done.\")\n end",
"def wait_for_running\n while !self.running?\n sleep Profitbricks::Config.polling_interval\n end\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable\n end",
"def await_completion\n @latch.wait(@options[:timeout]) || status.timeout!\n return unless status.result == :answer\n logger.debug \"Main calls were completed, waiting for any added calls: #{@waiters.inspect}\"\n @waiters.each(&:wait)\n logger.debug \"All calls were completed, unblocking.\"\n end",
"def join\n @cond.wait if not finished?\n end",
"def wait_for\n @mutex.synchronize { @token.wait(@mutex) unless @task_complete }\n end",
"def wait_for_ready\n @logger.debug(\"Waiting for workers to be ready\")\n @workers.each(&:verify)\n @logger.debug(\"Workers are ready\")\n end",
"def wait_until_running\n until @running\n ControllableThread.sleep POLL_INTERVAL\n check_key\n end\n end",
"def wait\n\t\t\t\t@notification.wait\n\t\t\tend",
"def wait_until_complete\n tries = 0\n status = nil\n sleep 1\n while tries < 100\n status = self.status\n puts \"Waiting... status=\" + status[\"status\"]\n if status[\"status\"] != \"queued\" && status[\"status\"] != \"running\"\n break\n end\n sleep 2\n end\n status\n end",
"def wait(timeout = nil)\n @latch.wait(timeout)\n end",
"def wait!\n wait\n raise @error if timeout?\n @messages\n end",
"def wait_until_not_full; end",
"def wait_until_finished\n @active_requests.dup.each do |n|\n n.join\n end\n end",
"def wait_end()\n begin\n loop do\n sleep(TICK/1000.0) while (self.connected?() rescue nil)\n break\n end\n rescue Exception => e\n end\n end",
"def wait\n return if @op_notifier.nil?\n GRPC.logger.debug(\"active_call.wait: on #{@op_notifier}\")\n @op_notifier.wait\n end",
"def wait_until\n until yield\n wait\n end\n end",
"def wait!\n sleep(@sleep)\n end",
"def wait\n sleep WAIT_TIME unless @skip_wait\n end",
"def wait_for_free\n worker = @available_workers.pop\n @available_workers.push(worker)\n end",
"def wait_until\n until yield\n wait\n end\n end",
"def pause_for_poller\n logger.info \"Waiting for the Canvas poller for #{wait = Utils.canvas_poller_wait} seconds\"\n sleep wait\n end",
"def wait; end",
"def wait; end",
"def wait; end",
"def wait(interval)\n wq = Queue.new\n onTimeout(interval) do\n wq.push nil\n end\n wq.pop\n end",
"def wait(timeout=60)\n countdown = timeout.to_f\n\n while countdown > 0\n if @zmq_thread and @zmq_thread.alive?\n sleep 0.1\n countdown = countdown - 0.1\n else\n break\n end\n end\n\n super()\n end",
"def poll\n # can be optimised to swap out the queue \n # will require a mutex \n rval = Queue.new\n while @queue.length > 0 \n begin \n rval.enq @queue.deq(true) \n rescue ThreadError\n break \n end\n end\n rval \n end",
"def wait_while\n while yield\n wait\n end\n end",
"def wait_until_ready\n # this method may be left unimplemented if that is applicable log\n end",
"def wait_and_proceed\n Thread.new do\n sleep TIMEOUT\n proceed\n end\n end",
"def wait_for_provisioning\n while !self.provisioned?\n sleep Profitbricks::Config.polling_interval\n end\n end",
"def wait_until\n until yield\n\twait\n end\n end",
"def wait_until\n poll do\n transition! if yield\n end\n end",
"def wait_until_finished()\n\t\t\t@threads.each do |t| \n\t\t\t\tif (t.status==\"run\")\n\t\t\t\t\tt.join; # wait to finish\n\n\t\t\t\t\t# log\n\t\t\t\t\tif @logger!=nil\n\t\t\t\t\t\t@logger.debug \"action=stop|name=thread\"\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# log\n\t\t\tif @logger!=nil\n\t\t\t\t@logger.debug \"transactions=#{@transactions}|threads=#{@num_threads}|failures=#{@failures}|duration=#{Time.now - @start_time}\"\n\t\t\tend\n\t\tend",
"def check_again\n if @thread.alive?\n wait 20\n else\n 'done'\n end\n end",
"def wait\n sleep 0.0001\n end",
"def wait\n Kernel.sleep self.interval until check_files\n end",
"def wait_while\n while yield\n wait\n end\n end",
"def wait\n true\n end",
"def wait_for_reader\n @reader.wait if @reader\n end",
"def wait\r\n Ragweed::Wrap32::wait_for_single_object @h\r\n end",
"def wait_while\n while yield\n\twait\n end\n end",
"def wait\n\tend",
"def wait\n\t\t\t\t@group.wait\n\t\t\tend",
"def wait_for_launching\n sleep @delay\n end",
"def join()\n @watchThread.join() if @watchThread\n end",
"def waiting; end",
"def waiting; end",
"def wait\n loop do sleep 1 end\n end",
"def join()\r\n @watchThread.join() if @watchThread\r\n end",
"def wait\n #$_api_queue.clear\n wait_for(/>/)\nend",
"def wait(timeout = nil)\n\t\t\tbegin\n\t\t\t\t@queue.wait(timeout)\n\t\t\trescue DRb::DRbConnError\n\t\t\tend\n\t\tend",
"def wait_until_done!(backoff_settings: nil)\n unless backoff_settings\n backoff_settings = BackoffSettings.new(\n 10 * MILLIS_PER_SECOND,\n 1.3,\n 5 * 60 * MILLIS_PER_SECOND,\n 0,\n 0,\n 0,\n 60 * 60 * MILLIS_PER_SECOND\n )\n end\n\n delay = backoff_settings.initial_retry_delay_millis / MILLIS_PER_SECOND\n max_delay = backoff_settings.max_retry_delay_millis / MILLIS_PER_SECOND\n delay_multiplier = backoff_settings.retry_delay_multiplier\n total_timeout =\n backoff_settings.total_timeout_millis / MILLIS_PER_SECOND\n deadline = Time.now + total_timeout\n until done?\n sleep(delay)\n if Time.now >= deadline\n raise RetryError.new('Retry total timeout exceeded with exception')\n end\n delay = [delay * delay_multiplier, max_delay].min\n reload!\n end\n yield(self) if block_given?\n end",
"def wait_for_callback\n turnstile.wait unless paused\n end",
"def wait_for_ready\n sleep 0.1 until ready?\n end",
"def wait(timeout = nil)\n @threads.wait_for_termination(timeout)\n Disquo.logger.info \"Worker shutdown complete\"\n end",
"def wait_async\n @wait_async = true\n end",
"def wait\n if collecting?\n if @options[:timeout]\n @task.with_timeout(@options[:timeout]) { @condition.wait }\n else\n @condition.wait\n end\n end\n @status\n rescue Async::TimeoutError\n @error = RSMP::TimeoutError.new describe_progress\n @status = :timeout\n end",
"def wait\n 0\n end",
"def wait\n\t\t\t\tif @count > 0\n\t\t\t\t\tFiber.yield\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tsucceeded?\n\t\t\tend",
"def wait\n done = @ractor.take\n yield(self) if block_given?\n done\n end",
"def wait\n status = @wthr.value\n\n @log_threads.each { |thr| thr.join }\n [ @stdin, @stdout, @stderr ].each do |stream|\n stream.close unless stream.closed?\n end\n status\n end",
"def finish_wait\n if @thread\n unless @thread.alive?\n breakpoints = @thread[:breakpoints] || []\n breakpoints_reached = @thread[:breakpoints_reached] || []\n missed_breakpoints = breakpoints - breakpoints_reached\n if missed_breakpoints.any?\n raise \"Breakpoint(s) #{missed_breakpoints.to_a.join(', ')}\" +\n \"not reached!\"\n end\n end\n @thread.wakeup\n ::Thread.stop\n else\n run_until(nil)\n end\n end",
"def wait\n return if @timers.empty?\n\n interval = wait_interval\n sleep interval if interval >= Timer::QUANTUM\n fire\n end",
"def finish!\n @queue.push nil\n @thread.join\n end",
"def wait_final_result()\n @queue.pop\n @pipeline.stop\n return @result\n end",
"def wait(timeout = nil)\n event.wait(timeout) if timeout != 0 && incomplete?\n self\n end",
"def wait\n \n # If the command has not been sent, or a response was already received. a\n # call to this method doesn't make any sense.\n raise Exception.new(\"Can't wait for response. The command was not send yet, or a response was already received.\") if @response_received == nil\n \n # Wait until a response was received from the server.\n synchronize do\n @response_received.wait_until { response != nil }\n end\n \n end",
"def wait_for_pending_sends; end",
"def wait\n t = @ractor.take\n yield(self) if block_given?\n t\n rescue Ractor::ClosedError\n raise ErrorTerminated, \"ticker stopped\"\n end",
"def wait_for_download\n if @pending\n logger.info(\"Waiting for first sync\")\n logger.flush if logger.respond_to?(:flush)\n while @pending\n sleep(0.1)\n end\n end\n end",
"def wait_for_callback\n @turnstile.wait unless @paused\n end",
"def wait(timeout = nil)\n @mu.synchronize do\n next @pstate unless @pstate.nil?\n\n @cond.wait(@mu, timeout)\n @pstate\n end\n end",
"def wait_until_ready\n\t\t\t\twhile true\n\t\t\t\t\tConsole.logger.debug(self) do |buffer|\n\t\t\t\t\t\tbuffer.puts \"Waiting for ready:\"\n\t\t\t\t\t\t@state.each do |child, state|\n\t\t\t\t\t\t\tbuffer.puts \"\\t#{child.class}: #{state.inspect}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\tself.sleep\n\t\t\t\t\t\n\t\t\t\t\tif self.status?(:ready)\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def wait\n assert !@waited\n pid, status = Process.waitpid2(@pid)\n @waited = true\n status\n end"
] |
[
"0.74571145",
"0.7377745",
"0.73485595",
"0.7260831",
"0.72405624",
"0.7181136",
"0.71810913",
"0.71810913",
"0.7121612",
"0.710995",
"0.70700026",
"0.70470744",
"0.7032115",
"0.7021413",
"0.69822943",
"0.69539857",
"0.68975854",
"0.6882598",
"0.68608737",
"0.6858086",
"0.68568873",
"0.6846498",
"0.6817719",
"0.6721086",
"0.67193544",
"0.670276",
"0.6693613",
"0.66924983",
"0.6669864",
"0.66587114",
"0.6619027",
"0.6603099",
"0.65831065",
"0.65660137",
"0.6555955",
"0.6552853",
"0.65447736",
"0.65243834",
"0.65223783",
"0.65217197",
"0.6516557",
"0.6478661",
"0.6452404",
"0.6449897",
"0.643404",
"0.6433665",
"0.6413933",
"0.64044344",
"0.64044344",
"0.64044344",
"0.6392531",
"0.6388192",
"0.63801503",
"0.637992",
"0.63720244",
"0.6370549",
"0.6365323",
"0.63481843",
"0.63366693",
"0.63294864",
"0.631437",
"0.63078016",
"0.63073575",
"0.6303998",
"0.6294396",
"0.62751275",
"0.6269564",
"0.6251309",
"0.6232806",
"0.62274736",
"0.6221713",
"0.6214701",
"0.62124574",
"0.62124574",
"0.61894095",
"0.61867774",
"0.6183005",
"0.6179814",
"0.61641866",
"0.6157954",
"0.6157654",
"0.61560863",
"0.6154294",
"0.61425966",
"0.6134039",
"0.61327016",
"0.6131996",
"0.61236435",
"0.6123478",
"0.6092892",
"0.6073908",
"0.5993435",
"0.5987174",
"0.5986485",
"0.59651935",
"0.5956578",
"0.59324414",
"0.5914509",
"0.5903924",
"0.5894176",
"0.5891676"
] |
0.0
|
-1
|
Hackish stub: Noah Paessel
|
def offerings
[]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def stubs=(_arg0); end",
"def stub_implementation; end",
"def stubs; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def private; end",
"def hunter_stub\n\tend",
"def spec; end",
"def spec; end",
"def stubbed_params=(_arg0); end",
"def weber; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def call; end",
"def awaken!\n\t\traise 'Not implemented'\n\tend",
"def probers; end",
"def internship_passed; end",
"def internal; end",
"def verify_stubbed_calls; end",
"def ibu; end",
"def berlioz; end",
"def pass; end",
"def pass; end",
"def wrapper; end",
"def jack_handey; end",
"def hiss; end",
"def spec=(_arg0); end",
"def calls; end",
"def calls; end",
"def implementation; end",
"def implementation; end",
"def sandbox; end",
"def sandbox; end",
"def call() end",
"def schubert; end",
"def get(*params); raise('Stub or mock required.') end",
"def preflight=(_arg0); end",
"def call(*) end",
"def call(*) end",
"def original; end",
"def slop!; end",
"def slop!; end",
"def standalone=(_arg0); end",
"def stub\n argc = @iseq[4][:arg_size]\n args = (1..argc).map{|i| \", VALUE arg#{i}\"}.join\n func_call_str = get_func_call('self.d', @func_name)\n casted_args = [\"(nabi_t)(VALUE)(0)\"] * (@local_size-argc-1)\n casted_args += argc.downto(1).map{|i| \"(nabi_t)(arg#{i})\"}\n casted_args.unshift(\"\") unless casted_args.empty?\n casted_args = casted_args.join(\", \")\n n_args = @local_size + 1 # locals + self\n tpl(\"method_stub\", name: @func_name, args: args, call_str: func_call_str, casted_args: casted_args).join(\"\\n\")\n end",
"def probers=(_arg0); end",
"def refutal()\n end",
"def __dummy_test__\n end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def macro; raise NotImplementedError; end",
"def whiny=(_arg0); end",
"def sandbox=(_arg0); end",
"def sandbox=(_arg0); end",
"def hidden_apis=(_arg0); end",
"def herald; end",
"def bellini; end",
"def respond(); end",
"def original_result; end",
"def suivre; end",
"def spice; end",
"def get_hash(*params); raise('Stub or mock required.') end",
"def verdi; end",
"def who_we_are\r\n end",
"def get_version(*params); raise('Stub or mock required.') end",
"def stubbed?\n raise NotImplementedError\n end",
"def r; end",
"def r; end",
"def how_it_works\r\n end",
"def proceed!; end",
"def proceed!; end",
"def play_dealer_hand(hand)\n\tputs \"stub: play_dealer_hand\"\nend",
"def my955; end",
"def villian; end",
"def sandbox?; end",
"def sandbox?; end",
"def method_731(base); end",
"def ignores; end",
"def returns=(_arg0); end",
"def invoke; end",
"def buzzword; end",
"def buzzword; end",
"def missing; end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def response=(_arg0); end",
"def lsi; end",
"def custom; end",
"def custom; end",
"def called_from; end",
"def called_from; end",
"def returns; end",
"def rossini; end",
"def contract; end"
] |
[
"0.7181337",
"0.6988685",
"0.69544655",
"0.6822215",
"0.6822215",
"0.6822215",
"0.6822215",
"0.68051285",
"0.66895676",
"0.6655732",
"0.6655732",
"0.65847474",
"0.65661377",
"0.64519495",
"0.64519495",
"0.64519495",
"0.64519495",
"0.64519495",
"0.64519495",
"0.64519495",
"0.64519495",
"0.63906777",
"0.6384987",
"0.6384341",
"0.6362339",
"0.63404953",
"0.633193",
"0.6320659",
"0.6310143",
"0.6310143",
"0.6309282",
"0.62609184",
"0.6241137",
"0.62395024",
"0.6226614",
"0.6226614",
"0.6204838",
"0.6204838",
"0.6166506",
"0.6166506",
"0.6147565",
"0.6124055",
"0.60943455",
"0.609359",
"0.6076251",
"0.6076251",
"0.60710806",
"0.6059467",
"0.6059467",
"0.60543007",
"0.60531855",
"0.6042119",
"0.60312134",
"0.6028718",
"0.60216993",
"0.60216993",
"0.60216993",
"0.6008813",
"0.60068744",
"0.60068744",
"0.6004759",
"0.60020596",
"0.60003495",
"0.5990606",
"0.59872156",
"0.5985616",
"0.5954225",
"0.5942785",
"0.59398484",
"0.5932031",
"0.59306073",
"0.59277",
"0.5919231",
"0.5919231",
"0.59127927",
"0.59064406",
"0.59064406",
"0.5903823",
"0.58984375",
"0.5894316",
"0.58942443",
"0.58942443",
"0.5891584",
"0.5891123",
"0.5888256",
"0.5888052",
"0.5879696",
"0.5879696",
"0.5878411",
"0.5871252",
"0.5871252",
"0.5871252",
"0.5871252",
"0.5862224",
"0.58531916",
"0.58531916",
"0.58525795",
"0.58525795",
"0.58446",
"0.58438724",
"0.58426875"
] |
0.0
|
-1
|
def self.display_name 'Activity' end
|
def left_nav_panel_width
300
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def name\n # activities have names, so to be consistent ...\n self.title\n end",
"def name\n # activities have names, so to be consistent ...\n self.title\n end",
"def activity_name\n plan.activity.name\n end",
"def kind\n :activity\n end",
"def type_name\n activity_types(true)[self.activity_type]\n end",
"def display_name\n NAME\n end",
"def display_name\n NAME\n end",
"def display_name\n status\n end",
"def display_name\n class_name\n end",
"def display_name\n\t\tself.short_name\n\tend",
"def display_name\n @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n self.name\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def display_name\n name\n end",
"def display_name\n\t\tself.name.titleize\n\tend",
"def display_name\n @_context[:display_name]\n end",
"def name\n display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n return @display_name\n end",
"def display_name\n \"#{name}\"\n end",
"def display_name\n \"#{name}\"\n end",
"def display_name\n \"#{name}\"\n end",
"def display_name\n public_name\n end",
"def display_name\n @name\n end",
"def display_name\n subject\n end",
"def display_name\n @name.titlecase\n end",
"def activity\n end",
"def display_name\n \t\"#{name}\"\n end",
"def display_name\n titre\n end",
"def name\n\t\tfac_displayname\n\tend",
"def display_name\n prefered_name\n end",
"def title_name; end",
"def name\n\t\tself.title\n\tend",
"def name; title end",
"def get_audit_label\n \"#{self.action_type.name} #{self.name}\"\n end",
"def activity_name\n @prefix_name\n end",
"def name() title; end",
"def name() title; end",
"def display_name\n read_attribute(:title).humanize\n end",
"def display_name\n @name.capitalize.freeze\n end",
"def name\n description\n end",
"def name\n description\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def full_title\n name\n end",
"def name\n 'Asset Allocation Reporter'\nend",
"def description\n self.class.name.underscore.humanize.downcase\n end",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def display\n\t\tname\n\tend",
"def name\n @display_name || @name\n end",
"def name\n self.title\n end"
] |
[
"0.8318254",
"0.8318254",
"0.7651418",
"0.7540521",
"0.7509528",
"0.74540603",
"0.74540603",
"0.7407833",
"0.7319619",
"0.7311845",
"0.7307437",
"0.72926927",
"0.7292656",
"0.7283055",
"0.7283055",
"0.7283055",
"0.72351533",
"0.72351533",
"0.719235",
"0.71819127",
"0.71756685",
"0.7174146",
"0.7120906",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.7090907",
"0.70748705",
"0.70748705",
"0.70748705",
"0.7063771",
"0.7055187",
"0.7018378",
"0.7017443",
"0.70101714",
"0.6987216",
"0.6978761",
"0.6950642",
"0.6927562",
"0.6915306",
"0.68888515",
"0.6868976",
"0.68533146",
"0.68519974",
"0.6841756",
"0.6841756",
"0.6837591",
"0.68256086",
"0.6789536",
"0.6789536",
"0.6788163",
"0.6788163",
"0.6788163",
"0.67569077",
"0.6754437",
"0.6745793",
"0.6745793",
"0.6745793",
"0.6745793",
"0.67370147",
"0.6732835"
] |
0.0
|
-1
|
Use callbacks to share common setup or constraints between actions.
|
def set_supplier
@supplier = Supplier.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
|
Only allow a trusted parameter "white list" through.
|
def supplier_params
params.require(:supplier).permit(:name, :active, :description, notes_attributes:[:id,:origin,:origin_id,:private,:text,:title,:_destroy],
document_files_attributes:[:description,:id,:title,:file,:origin, :origin_id,:esign,:esign_data,:photo,:photo_date,:photo_description,:_destroy],
contacts_attributes:[:id, :category,:origin, :origin_id,:title,{data:[:address,:zipcode,:zipcode,:state,:lat,:lng,:city,:email, :ddd,:phone]},:_destroy])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
"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 filtered_parameters; end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n 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 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 [:rating, :review]\n end",
"def valid_params?; end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\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 filter_parameters; end",
"def filter_parameters; end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def check_params; true; end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def list_params\n params.permit(:name)\n end",
"def check_params\n true\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"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 additional_permitted_params\n []\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end",
"def allow_params_authentication!; 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 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 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 paramunold_params\n params.require(:paramunold).permit!\n end",
"def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end",
"def quote_params\n params.permit!\n end",
"def list_params\n params.permit(:list_name)\n end",
"def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def all_params; end",
"def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end",
"def source_params\n params.require(:source).permit(all_allowed_params)\n end",
"def user_params\n end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def params; end",
"def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end",
"def permitted_params\n @wfd_edit_parameters\n end",
"def user_params\r\n end",
"def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend",
"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 valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def params_permit\n params.permit(:id)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\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 filter_params\n params.permit(*resource_filter_permitted_params)\n end",
"def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end",
"def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend",
"def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end",
"def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\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 argument_params\n params.require(:argument).permit(:name)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\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 sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def parameters\n nil\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end",
"def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end",
"def normal_params\n reject{|param, val| param_definitions[param][:internal] }\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 special_device_list_params\n params.require(:special_device_list).permit(:name)\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"
] |
[
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.63804525",
"0.6373396",
"0.6360051",
"0.6355191",
"0.62856233",
"0.627813",
"0.62451434",
"0.6228103",
"0.6224965",
"0.6222941",
"0.6210244",
"0.62077755",
"0.61762565",
"0.61711127",
"0.6168448",
"0.6160164",
"0.61446255",
"0.6134175",
"0.6120522",
"0.6106709",
"0.60981655",
"0.6076113",
"0.60534036",
"0.60410434",
"0.6034582",
"0.6029977",
"0.6019861",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.6019158",
"0.60184896",
"0.60157263",
"0.6005857",
"0.6003803",
"0.60012573",
"0.59955895",
"0.5994598",
"0.5993604",
"0.5983824",
"0.5983166",
"0.5977431",
"0.597591",
"0.5968824",
"0.5965953",
"0.59647584",
"0.59647584",
"0.59566855",
"0.59506303",
"0.5950375",
"0.59485626",
"0.59440875",
"0.5930872",
"0.5930206",
"0.5925668",
"0.59235454",
"0.5917905",
"0.59164816",
"0.5913821",
"0.59128743",
"0.5906617",
"0.59053683",
"0.59052664",
"0.5901591",
"0.58987755",
"0.5897456",
"0.58970183",
"0.58942604"
] |
0.0
|
-1
|
Returns an adjacent enemy with the lowest HP and in reading order.
|
def find_adjacent_enemy(unit)
neighbors(unit.pos)
.map { |p| @units.find { |u| u.pos == p } }
.select { |u| u&.alive? && u.type != unit.type }
.min_by { |u| [u.hp, u.pos] }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_next_free_enemy(event_id)\n i = 1\n while i < $Enemies.length \n if !$Enemies[i].active\n $Enemies[i].set_id(event_id)\n $Enemies[i].set_active\n $Enemies[i].set_map_id\n return i\n break\n end\n i += 1 \n end\n end",
"def enemy_attack!\n begin\n cell = nil\n if @enemy_moves.any? && @enemy_moves.last.hit? && !@enemy_moves.last.ship.sunk?\n if @enemy_moves[-2].nil? || !@enemy_moves[-2].hit?\n orientation = Ship::ORIENTATIONS[(rand * 2).to_i]\n else\n orientation = @enemy_moves.last.row_index == @enemy_moves[-2].row_index ? :horizontal : :vertical\n end\n offset = 1 * ((rand * 2).to_i == 1 ? 1 : -1)\n if orientation == :horizontal\n offset *= -1 if [-1, Grid::WIDTH].include?(@enemy_moves.last.column_index + offset)\n cell = opposite_grid.cell_rows[@enemy_moves.last.row_index][@enemy_moves.last.column_index + offset]\n else\n offset *= -1 if [-1, Grid::HEIGHT].include?(@enemy_moves.last.row_index + offset)\n cell = opposite_grid.cell_rows[@enemy_moves.last.row_index + offset][@enemy_moves.last.column_index]\n end\n cell = nil if cell.hit?\n end\n if cell.nil?\n random_row_index = (rand * Grid::HEIGHT).to_i\n random_column_index = (rand * Grid::WIDTH).to_i\n cell = opposite_grid.cell_rows[random_row_index][random_column_index]\n end\n end until cell.hit.nil?\n attack!(cell.row_index, cell.column_index)\n @enemy_moves << cell\n end",
"def strongest_in_front elephant\n# YOUR CODE GOES HERE\n last_elephant = elephant\n\n while elephant.elephant_in_front != nil\n if elephant.strength > elephant.elephant_in_front.strength\n switching_elephant = elephant.elephant_in_front\n elephant.elephant_in_front = switching_elephant.elephant_in_front\n switching_elephant.elephant_in_front = last_elephant\n last_elephant = switching_elephant\n end\n end\n return last_elephant\nend",
"def smooth_target_enemy(enemy_index)\n # Get an enemy\n enemy = @enemies[enemy_index]\n # If an enemy exists\n if enemy != nil and enemy.exist?\n return enemy\n end\n # Loop\n for enemy in @enemies\n # If an enemy exists\n if enemy.exist?\n return enemy\n end\n end\n end",
"def find_most_dangerous_enemy(warrior)\n # archers or wizards in any direction?\n if %w{ Wizard Archer }.include? nearest_enemy( warrior, opposite_direction() ).to_s\n opposite_direction()\n elsif %w{ Wizard Archer }.include? nearest_enemy( warrior, @@direction ).to_s\n @@direction\n elsif enemies_ahead?( warrior, opposite_direction() )\n opposite_direction()\n else\n @@direction \n end\n end",
"def get_avail_edg(player, opponent)\n taken = player + opponent # all occupied board positions\n avail_edg = @edges - (@edges & taken) # determine which edges are taken\n position = avail_edg.sample # take one of them\n end",
"def hunt(square, enemies)\n victim = enemies.min_by { |enemy| @map.distance_between(square.loc, enemy.loc)}\n \n # If enemy is close do the most damage\n return overkill(square, enemies) if @map.distance_between(square.loc, victim.loc) <= 3\n \n # If the enemy is far, move toward it\n return direction_to_square(square, victim)\n end",
"def random_target_enemy_hp0\n return random_target_enemy(true)\n end",
"def adjacentEnemies(carr)\n # puts \"Character: #{self.to_s}\"\n enemies = []\n carr.each do |c|\n # If adjacent, enemy, and alive, add to list\n if self.adjacent?(c.pos) && self.isEnemy?(c) && c.alive?\n # puts \"Adjacent: #{c.to_s}\"\n enemies << c\n end\n end\n # Sort enemies by health, then read order (health => x => y)\n enemies = Game.sortCharactersByHPandPos(enemies)\n if enemies.length >= 1\n return enemies\n else\n return nil\n end\n end",
"def item() $data_enemies[SES::Bestiary.get_enemy_list[@index]] end",
"def enemy(n)\n $game_troop.members[n - 1]\n end",
"def xp\n self.encounter_enemies.inject(0) { |acc, encounter_enemy| acc += encounter_enemy.number * encounter_enemy.xp }\n end",
"def overkill(square, enemies)\n no_overkill_check = 0;\n best_overkill = square.neighbors.max_by do |adjacent_square|\n overall_str = 0\n adjacent_square.neighbors.each do |neighbor|\n overall_str += neighbor.strength if (neighbor.tag != 0 and neighbor.tag != @tag)\n end\n no_overkill_check += overall_str;\n overall_str\n end \n\n # If no spaces contain an overkill\n if no_overkill_check > 0\n return Move.new(square.loc, best_overkill.direction)\n else\n closest_enemy = enemies.min_by { |enemy| @map.distance_between(square.loc, enemy.loc)}\n return direction_to_square(square, closest_enemy)\n end\n end",
"def calculate_minimum_hp(dungeon)\n return 1 if dungeon.empty?\n n = dungeon.size\n m = dungeon[0].size\n max_int = 2 ** (0.size * 8 - 1)\n dp = Array.new(n + 1) {\n Array.new(m + 1)\n }\n \n dp[n][m - 1], dp[n - 1][m] = 1, 1\n (n - 1).downto(0).each { |i|\n (m - 1).downto(0).each { |j|\n energy = [dp[i][j + 1] || max_int, dp[i + 1][j] || max_int].min - dungeon[i][j]\n puts \"#{energy}\"\n dp[i][j] = energy > 0 ? energy : 1\n }\n }\n \n dp[0][0]\nend",
"def base_maxhp\n return $data_enemies[@enemy_id].maxhp\n end",
"def base_atk\n return $data_enemies[@enemy_id].atk\n end",
"def child_index_left index\n [@d * index + 1, @heap.length-1].min\n end",
"def base_maxhp\n return enemy.maxhp\n end",
"def choose_item_and_on_whom(enemy)\n item = @inventory[Random.rand(@inventory.length)].first\n whom = [self, enemy].sample\n return C[item, whom]\n end",
"def enemies_ahead?(warrior, direction = @@direction)\n not nearest_enemy(warrior, direction).nil?\n end",
"def best_move_for(player)\n return minimax(player)[1]\n end",
"def get_exp\n exp = 0\n exp = (((@hero.max_health - @hero.cur_health) * 0.85) * @monster.level).round if @winner\n return exp\n end",
"def get_enemy(id)\n # get enemies\n enemies = get_enemies(id)\n # return result\n return enemies[0].battler\n end",
"def high_card\n @hand.max_by{|card| card.point}.point.to_i\n end",
"def random_target_enemy(hp0 = false)\n # Initialize roulette\n roulette = []\n # Loop\n for enemy in @enemies\n # If it fits the conditions\n if (not hp0 and enemy.exist?) or (hp0 and enemy.hp0?)\n # Add an enemy to the roulette\n roulette.push(enemy)\n end\n end\n # If roulette size is 0\n if roulette.size == 0\n return nil\n end\n # Spin the roulette, choose an enemy\n return roulette[rand(roulette.size)]\n end",
"def get_enemy_stat(stat)\n enemy.get_stat(stat)\n end",
"def reveal_bestiary_enemy(enemy)\n add_bestiary_enemy(enemy)\n de = $data_enemies[enemy]\n de.drop_items.each do |d|\n add_bestiary_data(enemy, :dro, \"#{d.kind}-#{d.data_id}\")\n end\n $data_system.elements.each_index { |i| add_bestiary_data(enemy, :ele, i) }\n $data_states.compact.size.times { |i| add_bestiary_data(enemy, :sta, i+1) }\n de.actions.each { |a| add_bestiary_data(enemy, :ski, a.skill_id) }\n end",
"def findNearestEnemy _obj, _args\n \"_obj findNearestEnemy _args;\" \n end",
"def get_max_over(stat)\n max = 0\n $data_enemies.each { |enemy|\n next if enemy.nil?\n next if enemy.hidden_best\n next unless $game_party.known_enemy?(enemy.id)\n value = enemy.get_stat(stat)\n max = value if value > max\n }\n max\n end",
"def next_move\n moves.max{ |a, b| a.rank <=> b.rank }\n end",
"def worst\n @heap.top\n end",
"def exp_result(enemy)\n # stop if enemy gives no EXP\n return 0 if enemy.exp == 0\n # get EXP\n exp = enemy.exp\n # if Tons is there\n if $tons_version != nil\n # if version is correct and using Different Difficulties\n if $tons_version >= 6.4 && TONS_OF_ADDONS::DIFFICULTY\n # multiply gained gold\n exp = exp * $game_system.exp_rate / 100\n end\n # if version is correct and using Passive Skills\n if $tons_version >= 6.5 && $game_system.PASSIVE_SKILLS\n # multiply gained gold with each actor's rate\n $game_party.actors.each {|actor| exp *= actor.exp_rate}\n exp = exp.to_i\n end\n end\n # iterate through all actors and pets\n ($BlizzABS.actors + $BlizzABS.pets).each {|b|\n # increase EXP if actor is valid and actor can get EXP\n b.battler.exp += exp if b.valid? && !b.battler.cant_get_exp?}\n # return exp value for further processing\n return exp\n end",
"def enemy_direction()\r\n for i in 0..3\r\n if @warrior.feel(DIRECTIONS[i]).enemy?\r\n return DIRECTIONS[i]\r\n end\r\n end\r\n end",
"def current_hp\n\t\t@current_hp + temp_hp\n\tend",
"def enemy;\n @item;\n end",
"def next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1]-@exp_list[@level] : 0)\n end",
"def dealer\n first_dealer = self.game.first_dealer\n if not first_dealer\n return nil\n end\n first_dealer_position = self.game.first_dealer.position\n p = self.position + first_dealer_position\n while p > self.game.size - 1\n p = p - self.game.size\n end\n return self.game.game_players.where(position: p).first\n end",
"def get_target(map, loc)\n owned = nil\n owned_min = 1000\n GameMap::CARDINALS.each do |l|\n new_loc = map.find_location(loc, l)\n site = map.site(new_loc)\n if site.owner != $tag && site.strength < owned_min\n owned_min = site.strength\n owned = l\n end\n end\n owned\nend",
"def child_index_right index\n [@d*index+@d, @heap.length-1].min\n end",
"def find_enemy_with_id(event_id)\n i = 0\n p event_id\n while i < $Enemies.length\n p $Enemies[i].id\n if $Enemies[i].id == event_id then\n return i\n end\n i += 1\n end\n return nil\n end",
"def known_enemies\n defeated_enemies\n end",
"def nearest_mine\n src = @pos\n shortest_dst = 63\n nearest = [0,0]\n unowned_mines = @game.mines_locs.reject { |pos, hero_id| hero_id == @hero_id }\n unowned_mines.each do |pos, hero_id|\n build_branching_paths(src, pos)\n path = find_path(pos)\n if path.length < shortest_dst\n shortest_dst = path.length\n nearest = pos\n end\n end\n nearest\n end",
"def find_attack_target(unit, state)\n # determine if in range to attack\n neighbors = DIRECTIONS.values.\n map {|d| [unit[:x] + d[:x], unit[:y] + d[:y]] }.\n map {|x, y| state[:units].detect {|u| u[:x] == x && u[:y] == y} }.\n reject(&:nil?).\n reject {|u| u[:deleted] }\n\n # find neighbor with fewest hit points\n targets = neighbors.\n reject {|n| unit[:type] == n[:type]}.\n sort_by {|t| t[:hp]} # todo: use multi value sort\n\n # break ties by \"up-down, left-right\" order\n ties = targets.partition {|t| t[:hp] == targets.first[:hp]}.first\n\n return targets.first unless !ties.empty?\n ties.sort_by {|t| [t[:y], t[:x]]}.first\nend",
"def hit(enemy_fleet_array, user)\n index = 0\n hit_index = random_to_x(user)\n if (hit_index <= 1)\n if (@fight_shield > 0)\n return -1\n end\n enemy_fleet_array.each do |sg|\n hit_index = hit_index - sg[-1]\n if (hit_index < 0)\n return index\n end\n index = index + 1\n end \n end\n return -2\n end",
"def hit(enemy_fleet_array, user)\n index = 0\n hit_index = random_to_x(user)\n if (hit_index <= 1)\n if (@fight_shield > 0)\n return -1\n end\n enemy_fleet_array.each do |sg|\n hit_index = hit_index - sg[-1]\n if (hit_index < 0)\n return index\n end\n index = index + 1\n end \n end\n return -2\n end",
"def enemies_nearby?(warrior)\n warrior.feel(@@direction).enemy?\n end",
"def leader\n new_leader = nil\n for person in @person_array\n new_leader = person if new_leader.nil?\n new_leader = person unless person.awesomeness < new_leader.awesomeness\n end\n return new_leader\n end",
"def observation_target(char, ai, enemies)\n # initialize dps array\n dps = {}\n # iterate through all enemies\n enemies.each {|b|\n # if being observed\n if b.is_a?(Map_Actor) && ai.observation[b.battler] != nil\n # associate battler with his dps within observation intervals\n dps[b] = get_observation(b.battler, ai.observation[b.battler].clone)\n end}\n # find the battler closest to a dps of 1/5 of the maxhp\n ai.target = dps.keys.min {|a, b|\n (char.battler.maxhp/5 - dps[a]).abs <=> (char.battler.maxhp/5 - dps[b]).abs}\n end",
"def get_hit(a_point)\n\toccupied_points.reject! { |point| point.is_equal(a_point) }\n\tset_state('damage') \n\tcheck_if_is_sink()\n end",
"def threatened_line\n mark = @board.other_player.mark\n sorted_lines = sort_by_mark(mark)\n most_threatened_line = sorted_lines[0]\n most_threatened_line if most_threatened_line.marks(mark) == @board.size - 1\n end",
"def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end",
"def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end",
"def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end",
"def next_exp\n return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0\n end",
"def energy\n combatant.maximum_energy\n end",
"def leader\n self.players.order(score: :desc).first\n end",
"def get_best_side_to_the_bomb\n return false if !check_for_a_bomb\n @captive_unit = nil\n @enemy_unit = nil\n warrior.listen.each do |unit|\n if Captives.include? unit.to_s.to_sym and unit.ticking? #Captive with bomb found\n if warrior.feel(warrior.direction_of(unit)).empty? or warrior.feel(warrior.direction_of(unit)).captive?\n puts \"Captive is accesible to the #{warrior.direction_of(unit)}\"\n return warrior.direction_of(unit)\n elsif warrior.feel(warrior.direction_of(unit)).enemy? or warrior.feel(warrior.direction_of(unit)).stairs?\n @enemy_unit = unit\n Directions.each do |dir|\n return dir if warrior.feel(dir).empty? and !warrior.feel(dir).wall? and\n !warrior.feel(dir).stairs? and dir != warrior.direction_of(@enemy_unit)\n !is_oposite_direction(dir, warrior.direction_of(unit)) \n end\n end\n end \n end\n return false\n end",
"def h_reach_low(pos)\n shape = shape_in_pos(pos)\n -@board.num_rows + 1 +\n lowest_extent(shape)\n end",
"def getMin()\n element=@store[1]\n\n #copy last element to the first...\n @store[1]=@store[@store.length-1]\n @store.delete_at(@store.length-1) #delete the last element \n\n #We need to restore the Heap Structure if altered\n heapify(1)\n return element\n end",
"def healthy_enough_to_beat_enemy_at?(enemy_location)\n turns = turns_required_to_beat_enemy_at(enemy_location)\n enemy_info = @map.get_info_about_enemy_at(enemy_location)\n # Archers attack from a distance of 2 squares, but if we're right next\n # to them then we need fewer turns\n turns += [2, @map.get_distance_away(enemy_info[:location])].min if enemy_info[:character] == :a\n predicted_damage_taken = turns * enemy_info[:damage]\n predicted_damage_taken < current_health\n end",
"def min(board)\n #Generate all enemy moves\n moves = minmax_moves(board, @enemy)\n #Placeholder for max score, even the best score is < 2\n min = 2\n #Find terminal and check terminal nodes and delete them from move array. If any of them are -1 instantly return\n moves.delete_if do |index, board|\n if over?(board)\n #If board is terminal get score\n res = minmax_score(board)\n #If terminal score is losing instantly return it\n return res if res == -1\n min = res if res > min\n true\n else\n false\n end\n end\n\n #Else get best scores of new board states\n moves.each do |index, board|\n res = max(board)\n return res if res == -1\n min = res if res < min\n end\n min\n end",
"def is_health_point_low()\r\n if @warrior.health <= LOW_HEALTH && @warrior.health != MAX_HEALTH\r\n return true\r\n end\r\n return false\r\n end",
"def high_card\n high_value = 0\n @grip.each do |card|\n new_value = FACE_VALUES.find_index(card.value)\n if new_value > high_value\n high_value = new_value\n end\n end\n FACE_VALUES[high_value]\n end",
"def full_next_exp\n return (@exp_list[@level+1] > 0 ? @exp_list[@level+1] : 0)\n end",
"def get_random_next_move(arena)\n head = get_head_coords\n moves = []\n # N\n cell = arena.get(head[:x], head[:y] - 1)\n moves << 'N' if cell == 'empty' || cell[0..3] == 'tail'\n # S\n cell = arena.get(head[:x], head[:y] + 1)\n moves << 'S' if cell == 'empty' || cell[0..3] == 'tail'\n # E\n cell = arena.get(head[:x] + 1, head[:y])\n moves << 'E' if cell == 'empty' || cell[0..3] == 'tail'\n # W\n cell = arena.get(head[:x] - 1, head[:y])\n moves << 'W' if cell == 'empty' || cell[0..3] == 'tail'\n\n # Return any direction or nil\n moves.sample\n end",
"def choose_attack_direction\n @enemies_direction = Array.new\n Directions.each do |dir|\n if warrior.feel(dir).enemy? != nil\n @enemies_direction.push dir\n end\n end\n return false \n end",
"def kill_if_enemy_ahead(agent, enemy_color)\n Proc.new {\n nearby = tanks_nearby(agent.tank, enemy_color, 50)\n ahead = tanks_ahead(agent.tank, agent.tank.angle, enemy_color, Math::PI/6)\n target = nearby.first || ahead.first\n if target and @tank.vector_to(target).length < 375\n agent.set_state(:assassinate, :target_tank => target)\n end\n }\n end",
"def best_chromosome\n the_best = @population[0]\n @population.each do |chromosome|\n the_best = chromosome if chromosome.fitness > the_best.fitness\n end\n return the_best\n end",
"def attack(enemy)\n if enemy.dead\n puts \"#{enemy.name} is already dead\"\n return false\n end\n damage = (rand * 10 + 10).round(0) #=> random number\n enemy.take_damage(damage) #=> eneny takes damage using random damge\n end",
"def adjacent_ladder\n $app.ladders.find { |_|\n _.pieces.find { |piece| (piece[0]-20..(piece[0]+height-10)).include?(left) && (top <= piece[3] && top >= piece[1]) }\n }\n end",
"def damage_potential(warrior, enemy_health)\n distance = @probable_archer_distance \n if distance == nil\n distance = 0\n end\n warrior_attack = 5\n enemy_attack = 3\n warrior_health = warrior.health\n while enemy_health > 0 && warrior_health > 0 do\n if distance == 0\n enemy_health -= warrior_attack\n else\n distance -= 1\n end\n\n if enemy_health > 0\n warrior_health -= enemy_attack\n end\n end\n return warrior.health - warrior_health\n end",
"def enemies_attack\n total_bots_damage = 0\n @enemies.each do |bots_player|\n bots_damage = rand(1..6)\n @human_player.gets_damage(bots_damage)\n total_bots_damage += bots_damage\n end\n puts \"le(s) #{@enemies.length} inflige(nt) #{total_bots_damage} points de vie a #{@human_player.name}\"\n end",
"def probable_enemy_occupations(options = {})\n fail 'Position not given!' unless options[:pos]\n # starting with the rightmost...leftmost. Then bottommost...topmost\n occupation_points = []\n center = Vector[*options[:pos]]\n # horizontally, until ship goes too left\n head = center.dup\n until head == center + Vector[-(options[:ship_length]), 0]\n body = body_from_head(head, options[:ship_length], ACROSS)\n occupation_points << body if valid?(body, options[:board])\n head -= ACROSS\n end\n # vertically, again until ship goes too far up\n head = center.dup\n until head == center + Vector[0, -(options[:ship_length])]\n body = body_from_head(head, options[:ship_length], DOWN)\n occupation_points << body if valid?(body, options[:board])\n head -= DOWN\n end\n points = remove_invalid_shots!(occupation_points.flatten, options[:board])\n EdenPlayer.prob_board_matrix points\n end",
"def get_direction_to_avoiding_enemies\n Directions.each do |dir|\n if !warrior.feel(dir).wall? and\n warrior.feel(dir).empty? and\n !is_oposite_direction(dir, get_bomb_direction)\n return dir\n end\n end\n return false\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def takeHit(x)\n @hp = @hp - x\n return @hp\n end",
"def next_x\n if state.dx < 0 # if the player moves left\n return state.x - (state.tile_size - state.player_width) # subtracts since the change in x is negative (player is moving left)\n else\n return state.x + (state.tile_size - state.player_width) # adds since the change in x is positive (player is moving right)\n end\n end",
"def choose_item_and_on_whom(enemy)\n C[@inventory.random_item, [self, enemy].sample]\n end",
"def enemy; end",
"def min_under_node node\n current = node.right\n while current.left\n current = current.left\n end\n current\n end",
"def highest_attack_power_weapon\n weapon = self.weapons.sort_by do |weapon|\n weapon.attack_power\n end.last\n weapon\n end",
"def get_min()\n # smallest = Float::INFINITY\n # @stack.each do |item|\n # if item < smallest\n # smallest = item\n # end\n # end\n # return smallest\n @stack.min\n end",
"def nextMonster\n if (@unusedMonsters.empty?)\n usedMonsters_copy = ArrayList.new(@usedMonsters)\n @unusedMonsters = usedMonsters_copy\n shuffleMonsters\n @usedMonsters.clear\n end\n \n m = @unusedMonsters.at(0)\n @usedMonsters << m\n @unusedMonsters.delete(m)\n \n return m\n end",
"def get_wielded(hand = nil)\n if hand\n case hand\n when \"left\"\n hand = :left_wield\n when \"right\"\n hand = :right_wield\n when \"dual\"\n hand = :dual_wield\n else\n return get_wielded\n end\n\n item = ((@equipment[hand] && @equipment[hand][0]))\n else\n item = ((@equipment[:left_wield] and @equipment[:left_wield][0]) || (@equipment[:right_wield] and @equipment[:right_wield][0]) || (@equipment[:dual_wield] and @equipment[:dual_wield][0]))\n end\n\n if item\n @inventory[item]\n else\n nil\n end\n end",
"def best_chromosome()\n the_best = @population[0]\n @population.each do |chromosome|\n the_best = chromosome if chromosome.fitness > the_best.fitness\n end\n return the_best\n end",
"def get_min()\n @min_stack[-1]\n end",
"def getHealth()\n return @hp\n end",
"def getHealth()\n return @hp\n end",
"def winner player1, player2\n player1.health > player2.health ? player1 : player2\n end",
"def next\r\n if !@neighbors.count.zero?\r\n @neighbors[@random.rand(num_neighbors)]\r\n else\r\n nil\r\n end\r\n end",
"def fight(enemy, weapon)\n if life <= 0\n puts \"[#{self.class} is too dead!]\"\n return\n end\n\n #Attack the opponent\n your_hit = rand(strength+weapon)\n puts \"[you hit with #{your_hit} points of damage!]\"\n enemy.hit(your_hit)\n\n #Retaliation\n p enemy\n if enemy.life >0\n enemy_hit = rand(enemy.strength + enemy.weapon)\n puts \"[your enemy hit with #{enemy_hit} points of damage!]\"\n self.hit(enemy_hit)\n end\n end",
"def get_min()\n @min_stack[-1]\n end",
"def pika_attack(enemy_hp)\n #randomization\n random = rand(10) + 1 #includes 10\n if random == 1 || random == 2\n puts \"Oh no, Pikachu missed!\".colorize(:yellow)\n elsif random == 3 || random == 4 || random == 5\n enemy_hp = enemy_hp - 2\n puts \"Pikachu used Tail Whip. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n elsif random == 6 || random || 7 || random == 8\n enemy_hp = enemy_hp - 3\n puts \"Pikachu used ThunderShock. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n else\n enemy_hp = enemy_hp - 4\n puts \"Pikachu used Slam. Enemy's hp is reduced to #{enemy_hp}.\".colorize(:yellow)\n end\n return enemy_hp\nend",
"def base_maxsp\n return $data_enemies[@enemy_id].maxsp\n end",
"def get_cpu_move(board, player)\n # for the first move, the cpu will pick one of the four corners randomly.\n if board.is_empty then\n if rand(2) == 1 then\n row = 0\n else \n row = 2\n end\n\n if rand(2) == 1 then\n col = 0\n else\n col = 2\n end\n return row, col \n else\n # otherwise, it will find the best move to play that eliminates\n # its chances of losing\n return minimax(board, player)[1]\n end\nend",
"def assign_enemy\n\t\t@has_enemy = rand(1..2)==1 ? true : false\n\t\t#need an enemy value for the room.\n\tend",
"def enemies_in_range(range)\n return case attacking_direction\n when :right\n @game_state.enemies.select do |e| \n (e.x > @x && e.x < (self.right + range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :left\n @game_state.enemies.select do |e| \n (e.right < @x && e.right > (@x - range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :up\n @game_state.enemies.select do |e| \n (e.bottom < @y && e.bottom > (@y - range)) && (e.right > @x && e.x < self.right)\n end\n when :down\n @game_state.enemies.select do |e| \n (e.y > self.bottom && e.y < (self.bottom + range)) && (e.right > @x && e.x < self.right)\n end\n end\n end",
"def player_with_most(stat)\n value = nil\n owner = nil\n players.each do |player, stats|\n if value == nil || stats[stat] > value\n value = stats[stat]\n owner = player\n end\n end\n owner\nend",
"def best_target\n far_enough = competitors.select do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) >= RTanque::Bot::Turret::LENGTH\n end\n far_enough.sort_by do |competitor|\n competitor.projected_position_at(current_tick_index).distance(self.sensors.position) +\n (competitor.name == NAME ? 1000 : 0)\n end.first\n end",
"def look_ahead(board, current_hand, ai_hand)\n #n = NegamaxAgent.new(board, current_hand, ai_hand)\n #n_suggested_move = n.invoke\n #n_suggested_card = n_suggested_move.first\n #n_x = n_suggested_move[1]\n #n_y = n_suggested_move[2]\n #n_s = n_suggested_move[3]\n\n #puts \"DEBUG: negamax suggested #{@player_hand.key(n_suggested_card)} @ #{n_x + 1}, #{n_y + 1} with score of #{n_s}\"\n #return\n\n available_cards = current_hand.values.compact\n available_spaces = board.open_spaces\n possible_moves = available_cards.product(available_spaces)\n\n best_moves = []\n value_of_best_move = -10\n\n possible_moves.each do |card, space|\n x, y = space\n value = board.next_state(card, x, y).score\n if value > value_of_best_move\n best_moves = [[card, x, y]]\n value_of_best_move = value\n elsif value == value_of_best_move\n \tbest_moves << [card, x, y]\n end\n end\n\n chosen_move = best_moves.sample\n card, x, y = chosen_move\n\n puts \"HINT: placing #{current_hand.key(card).rstrip} at #{x+1}, #{y+1} gives a good score of #{value_of_best_move}\"\n end"
] |
[
"0.5935563",
"0.5862665",
"0.5827971",
"0.5814727",
"0.5625451",
"0.5602667",
"0.5598812",
"0.55414605",
"0.5518041",
"0.54982936",
"0.54871815",
"0.54761016",
"0.5450481",
"0.5411065",
"0.5398956",
"0.53613365",
"0.5348235",
"0.534339",
"0.5309293",
"0.5302371",
"0.5261282",
"0.52611744",
"0.5253834",
"0.5232265",
"0.522105",
"0.5213831",
"0.51675737",
"0.51672554",
"0.5145287",
"0.5108067",
"0.507644",
"0.50510365",
"0.5047817",
"0.5046462",
"0.5017424",
"0.5008895",
"0.5002704",
"0.5002273",
"0.4988116",
"0.49724683",
"0.49711168",
"0.4964322",
"0.49493182",
"0.49488696",
"0.49488696",
"0.49473646",
"0.4942181",
"0.49360508",
"0.4931168",
"0.4925832",
"0.4916693",
"0.4916693",
"0.4916693",
"0.4916693",
"0.49099568",
"0.48950806",
"0.48940516",
"0.48913914",
"0.48904255",
"0.48899066",
"0.48890087",
"0.48856795",
"0.48819846",
"0.48800972",
"0.48796538",
"0.48753172",
"0.48653635",
"0.48623592",
"0.4856885",
"0.48548952",
"0.48541847",
"0.48515287",
"0.48502323",
"0.484804",
"0.483758",
"0.483758",
"0.48372146",
"0.48321274",
"0.4832048",
"0.48219827",
"0.4820619",
"0.48199192",
"0.48191777",
"0.48159853",
"0.481444",
"0.48122177",
"0.48090127",
"0.48090127",
"0.48061162",
"0.4796787",
"0.479098",
"0.4790562",
"0.47814378",
"0.47786498",
"0.47751972",
"0.47740278",
"0.47720757",
"0.47703543",
"0.4770208",
"0.47620034"
] |
0.6385588
|
0
|
Returns all unoccupied cells adjacent to any enemy units.
|
def find_destinations(unit)
@units
.select { |u| u.alive? && u.type != unit.type }
.flat_map { |u| neighbors(u.pos).to_a }
.reject { |p| occupied?(p) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def find_adjacent_enemy(unit)\n neighbors(unit.pos)\n .map { |p| @units.find { |u| u.pos == p } }\n .select { |u| u&.alive? && u.type != unit.type }\n .min_by { |u| [u.hp, u.pos] }\n end",
"def nearby_dead_cells(live_cells)\n live_cells.map { |p| neighborhood(p) }.reduce(:|) - live_cells\nend",
"def occupied_positions\n cells.select {|cell| cell.occupied?}\n end",
"def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end",
"def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end",
"def neighbor_cells\n @neighbor_cells ||= neighbor_cell_coordinates.map do |coordinates|\n board.at(coordinates[0], coordinates[1]) if board.cell_exists?(coordinates[0], coordinates[1])\n end.compact\n end",
"def cells_near cell\n near_cells = []\n CELL_NEIGHBOURHOOD.each do |state|\n c = [cell[0] + state[0], cell[1] + state[1]]\n if @cells.include? c then\n near_cells.push c\n end\n end\n return near_cells\n end",
"def attack_cells(from, _chessboard)\n (DiagonalMoves.directions + AxisAlignedMoves.directions)\n .map { |direction| from + direction }\n .reject(&:nil?)\n end",
"def attack_cells(_from_cell, _chessboard)\n []\n end",
"def available_moves\n adjacent_tiles(*@hole)\n end",
"def occupied_spaces\n objects = []\n grid_iterator.each do |cell|\n objects << cell unless cell.nil?\n end\n objects\n end",
"def get_adjacent_tiles(tile)\n positions = tile.get_adjacent_positions\n\n tiles.select { |tile| positions.include? tile.position }\n end",
"def neighbors cell\n [\n above_cell(cell),\n below_cell(cell),\n left_cell(cell),\n right_cell(cell),\n ]\n end",
"def neighbors\n @neighbors ||= [-1, 0, 1].repeated_permutation(2).map do |dx, dy|\n @grid[x + dx, y + dy] unless dx.zero? && dy.zero?\n end.compact\n end",
"def unassigned_cells\n grid.cells.to_a.reject { |cell| cell.value }\n end",
"def adjacent_cells(i_index, j_index)\n return [] if out_of_bounds?(i_index, j_index)\n\n cells = [\n [i_index - 1, j_index - 1], # a\n [i_index - 1, j_index], # b\n [i_index - 1, j_index + 1], # c\n [i_index, j_index + 1], # d\n [i_index + 1, j_index + 1], # e\n [i_index + 1, j_index], # f\n [i_index + 1, j_index - 1], # g\n [i_index, j_index - 1] # h\n ]\n cells.reject do |pair|\n i_index, j_index = pair\n out_of_bounds?(i_index, j_index)\n end\n end",
"def neighbors\n neighbors = []\n for row in (x - 1)..(x + 1)\n for col in (y - 1)..(y + 1)\n if (0...FIELD_SIZE).cover?(row) && (0...FIELD_SIZE).cover?(col)\n if row != x || col != y\n neighbors.push(@battle_field[row, col])\n end\n end\n end\n end\n neighbors\n end",
"def available_cells\n cells = []\n rows.each_with_index do |row, ri|\n row.each_with_index do |cell, ci|\n cells << [ri, ci] if cell.nil?\n end\n end\n cells\n end",
"def get_allocated_cells\n allocated_cells = 0.0;\n @cells.each { |i| i.each { |j| allocated_cells += 1 if j.type != Cell::BLOCKED } }\n (allocated_cells*Dungeon::ROOM_ALLOCATION_WEIGHT).floor\n end",
"def reachable_cells(x, y, world)\n visited = []\n queue = [[x, y]]\n\n while !queue.empty?\n start = queue.pop\n neighbors = DIRECTIONS.values.\n map {|d| [start[0] + d[:x], start[1] + d[:y]]}.\n select {|x,y| world[y][x] == '.' }\n new_cells = neighbors - visited\n queue = queue + new_cells\n visited.push(start)\n end\n\n visited\nend",
"def get_other_block_cells cell\n\t\tblock = get_block cell\n\t\tfirst_cell = cell / 27 * 27\n\t\treturn (first_cell...first_cell + 27).select { |r| block == r / 27 * 3 + r % 9 / 3 }.to_a - [cell]\n\tend",
"def get_allocated_cells\n\t\tallocated_cells = 0.0;\n\t\t@cells.each { |i| i.each { |j| allocated_cells += 1 if j.type != Cell::BLOCKED } }\n\t\treturn (allocated_cells*Dungeon::ROOM_ALLOCATION_WEIGHT).floor\n\tend",
"def adjacent_mines(row, col)\n mines_nearby = 0\n range = [-1, 0, 1]\n range.each do |range_x|\n range.each do |range_y|\n x_adj = row + range_x\n y_adj = col + range_y\n if cell_exists?(x_adj,y_adj)\n mines_nearby += 1 if contains_mine?(x_adj, y_adj)\n end\n end\n end\n mines_nearby\n end",
"def enemy_neighbors(v)\n Set.new neighbors(v).select { |p| p.color != v.color && p.color != Move.colors[\"blank\"] }\n end",
"def adjacent_mines(row, col)\n adjacent_list = adjacent_cells(row, col)\n mine_count = 0\n adjacent_list.each do |cell|\n if cell.has_bomb\n mine_count = mine_count + 1\n end\n end\n mine_count\n end",
"def reveal_adjacent_cells(coords)\n self[coords].flip\n return if self[coords].value.is_a?(Integer)\n left = [coords[0], coords[1]-1]\n reveal_adjacent_cells(left) if within_boundaries?(left[0], left[1]) && self[left].flippable?\n right = [coords[0], coords[1]+1]\n reveal_adjacent_cells(right) if within_boundaries?(right[0], right[1]) && self[right].flippable?\n up = [coords[0]+1, coords[1]]\n reveal_adjacent_cells(up) if within_boundaries?(up[0], up[1]) && self[up].flippable?\n down = [coords[0]-1, coords[1]]\n reveal_adjacent_cells(down) if within_boundaries?(down[0], down[1]) && self[down].flippable?\n end",
"def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end",
"def diagonal_cells(koordinates)\n cells.select do |cell|\n koordinates.include?([cell.coordinate.x,cell.coordinate.y])\n end\n end",
"def neighbor_cells(n, m)\n cells = []\n cells << [n-1, m] if n > 0\n cells << [n+1, m] if n < height\n cells << [n, m-1] if m > 0\n cells << [n, m+1] if m < width\n return cells\n end",
"def neighbours(x, y)\n # With permutation() we can exclude diagonal cells in the square around a cell\n [-1, 0, 1].permutation(2).map { |(dx, dy)| [x + dx, y + dy]}\n .select { |(c, r)| c >= 0 && r >= 0 && !@board[r].nil? && @board[r][c] == @board[y][x] }\n end",
"def enemies_in_range(range)\n return case attacking_direction\n when :right\n @game_state.enemies.select do |e| \n (e.x > @x && e.x < (self.right + range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :left\n @game_state.enemies.select do |e| \n (e.right < @x && e.right > (@x - range)) && (e.bottom > @y || e.y < self.bottom)\n end\n when :up\n @game_state.enemies.select do |e| \n (e.bottom < @y && e.bottom > (@y - range)) && (e.right > @x && e.x < self.right)\n end\n when :down\n @game_state.enemies.select do |e| \n (e.y > self.bottom && e.y < (self.bottom + range)) && (e.right > @x && e.x < self.right)\n end\n end\n end",
"def neighbor_possibilities(coords_of_neighborhood)\n coords_of_neighborhood.map do |coords|\n filled_in_board.cell_possibilities(*coords)\n end.compact\n end",
"def set_all_cell_adjacent_mines\n @board.each_with_index do |row, row_index|\n @board[row_index].each_with_index do |column, column_index|\n set_cell_adjacent_mines(row_index,column_index)\n end\n end\n end",
"def get_neighbours(n, m)\n [[n - 1, m],[n + 1, m],[n, m - 1],[n, m + 1]].select do |coords| \n coords.first.between?(0, rows - 1) && coords.last.between?(0, cols - 1)\n end\n end",
"def find_adjacent_rooms(from)\r\n return from.return_adjacent_rooms\r\n end",
"def adjacentEnemies(carr)\n # puts \"Character: #{self.to_s}\"\n enemies = []\n carr.each do |c|\n # If adjacent, enemy, and alive, add to list\n if self.adjacent?(c.pos) && self.isEnemy?(c) && c.alive?\n # puts \"Adjacent: #{c.to_s}\"\n enemies << c\n end\n end\n # Sort enemies by health, then read order (health => x => y)\n enemies = Game.sortCharactersByHPandPos(enemies)\n if enemies.length >= 1\n return enemies\n else\n return nil\n end\n end",
"def neighbours()\n @map.neighbours(@x, @y, true)\n end",
"def all_occupied_spaces\n occupied_spaces('black') + occupied_spaces('white')\n end",
"def neighboors\n coordneighboors = [@x - 1, @x, @x + 1].product([@y - 1, @y, @y + 1])\n coordneighboors.delete([@x, @y])\n coordneighboors.select { |coord| coord[0] >= 0 && coord[0] < @matrix.rows && coord[1] >= 0 && coord[1] < @matrix.columns }\n end",
"def get_living_neighbours(cell)\n living_neighbours = []\n\n #Checking the status of neighbouring cells, with checks for cases where the cell resides on the edge of the grid.\n if cell.y < rows - 1\n neighbour = game_grid[cell.x][cell.y + 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x < cols - 1 && cell.y < rows - 1\n neighbour = game_grid[cell.x + 1][cell.y + 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x < cols - 1\n neighbour = game_grid[cell.x + 1][cell.y]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x < rows - 1 && cell.y > 0\n neighbour = game_grid[cell.x + 1][cell.y - 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.y > 0\n neighbour = game_grid[cell.x][cell.y - 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x > 0 && cell.y > 0\n neighbour = game_grid[cell.x - 1][cell.y - 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x > 0\n neighbour = game_grid[cell.x - 1][cell.y]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n if cell.x > 0 && cell.y < rows - 1\n neighbour = game_grid[cell.x - 1][cell.y + 1]\n living_neighbours.push(neighbour) if neighbour.alive?\n end\n\n return living_neighbours\n\n end",
"def actual_cells\n @cells.compact\n end",
"def rooms_unavailable\n return @occupied.keys\n end",
"def find_all_empty_cells\n @board_array.each_index do |i|\n row = @board_array[i]\n row_index = i\n row.each_index do |i|\n char = row[i]\n column_index = i\n if char == \"-\"\n return [row_index,column_index]\n end\n end\n end\n end",
"def find_neighbors(cell)\n min_r = [0, cell.row - 1].max\n max_r = [cell.row + 1, rows - 1].min\n min_c = [0, cell.column - 1].max\n max_c = [cell.column + 1, columns - 1].min\n\n get_cells(min_r..max_r, min_c..max_c).select { |x| x unless x == cell }\n end",
"def cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end",
"def adjacent_neighbors(cell)\n neighbors = []\n\n # Gets all the valid neighbors into the array\n # From southern neighbor, clockwise\n neighbors << [cell.x, cell.y - 1] unless cell.y == 0\n neighbors << [cell.x - 1, cell.y] unless cell.x == 0\n neighbors << [cell.x, cell.y + 1] unless cell.y == grid.height - 1\n neighbors << [cell.x + 1, cell.y] unless cell.x == grid.width - 1\n\n # Sorts the neighbors so the rendered path is a zigzag path\n # Cells in a diagonal direction are given priority\n # Comment this line to see the difference\n neighbors = neighbors.sort_by { |neighbor_x, neighbor_y| proximity_to_star(neighbor_x, neighbor_y) }\n\n neighbors\n end",
"def connected_rooms\n return (self.exits.map(&:destination) + @entrances.to_a).reject{ |room| room == self }\n end",
"def adjacent_rooms(map, y, x)\n \n north = map[y-1][x]\n south = map[y+1][x]\n west = map[y][x-1]\n east = map[y][x+1]\n\n [north, south, west, east]\nend",
"def adjacent_neighbors(cell)\n neighbors = []\n\n # Gets all the valid neighbors into the array\n # From southern neighbor, clockwise\n neighbors << [cell.x , cell.y - 1] unless cell.y == 0\n neighbors << [cell.x - 1, cell.y ] unless cell.x == 0\n neighbors << [cell.x , cell.y + 1] unless cell.y == grid.height - 1\n neighbors << [cell.x + 1, cell.y ] unless cell.x == grid.width - 1\n\n # Sorts the neighbors so the rendered path is a zigzag path\n # Cells in a diagonal direction are given priority\n # Comment this line to see the difference\n neighbors = neighbors.sort_by { |neighbor_x, neighbor_y| proximity_to_star(neighbor_x, neighbor_y) }\n\n neighbors\n end",
"def neighbor_cell_coordinates\n NEIGHBOR_OFFSETS.map { |coordinates| [row + coordinates[0], col + coordinates[1]] }\n end",
"def remove_inaccessible_cells(map, goal)\n # Use a flood fill to keep cells; everything not flooded gets a 99.\n basin = Set.new\n flood_fill(map, basin, goal[0], goal[1])\n map.height.times do |row|\n map.width.times do |col|\n map.set(row, col, 99) unless basin.include?([row, col])\n end\n end\n end",
"def neighborhood(cell)\n Set.new((cell[0]-1..cell[0]+1).map{|x| (cell[1]-1..cell[1]+1).map{|y| [x,y]}}.\n flatten(1)) - Set.new([cell])\nend",
"def enemy_attack!\n begin\n cell = nil\n if @enemy_moves.any? && @enemy_moves.last.hit? && !@enemy_moves.last.ship.sunk?\n if @enemy_moves[-2].nil? || !@enemy_moves[-2].hit?\n orientation = Ship::ORIENTATIONS[(rand * 2).to_i]\n else\n orientation = @enemy_moves.last.row_index == @enemy_moves[-2].row_index ? :horizontal : :vertical\n end\n offset = 1 * ((rand * 2).to_i == 1 ? 1 : -1)\n if orientation == :horizontal\n offset *= -1 if [-1, Grid::WIDTH].include?(@enemy_moves.last.column_index + offset)\n cell = opposite_grid.cell_rows[@enemy_moves.last.row_index][@enemy_moves.last.column_index + offset]\n else\n offset *= -1 if [-1, Grid::HEIGHT].include?(@enemy_moves.last.row_index + offset)\n cell = opposite_grid.cell_rows[@enemy_moves.last.row_index + offset][@enemy_moves.last.column_index]\n end\n cell = nil if cell.hit?\n end\n if cell.nil?\n random_row_index = (rand * Grid::HEIGHT).to_i\n random_column_index = (rand * Grid::WIDTH).to_i\n cell = opposite_grid.cell_rows[random_row_index][random_column_index]\n end\n end until cell.hit.nil?\n attack!(cell.row_index, cell.column_index)\n @enemy_moves << cell\n end",
"def neighbors(x,y)\n valid = 0..127\n [[x,y-1],[x,y+1],[x-1,y],[x+1,y]].select {|(h,v)| valid.cover?(h) && valid.cover?(v)}\nend",
"def adjacent_mines(row, col)\n 0\n end",
"def adjacent_mines(row, col)\n 0\n end",
"def adjacent_mines(row, col)\n 0\n end",
"def move_neighbours()\n # Make sure to check for doorways that can't be passed through diagonally!\n # Start with the current list from neighbours()\n # foreach cell in that list, remove that cell if either of the conditions are met:\n # it is not passable\n # it is diagonal, and either it or this square is a doorway\n end",
"def neighbors(x, y)\n neighbors = []\n neighbors << [(x + 1), y] if (x + 1) < grid.count\n neighbors << [(x - 1), y] if x > 0\n neighbors << [x, (y + 1)] if (y + 1) < grid[0].count\n neighbors << [x, (y - 1)] if y > 0\n neighbors.select { |pos| self[*pos] != -1 }\n end",
"def neighbours\n neighbours = []\n [@x-1, @x, @x+1].each do |x|\n [@y-1, @x, @y+1].each do |y|\n if x >= 0 && y >= 0 && x <= MAX_X && y <= MAX_Y && !(x == @x && y == @y)\n neighbours << [x,y]\n end\n end\n end\n return neighbours\n end",
"def util_targetselection_adjacent_foe(launcher)\n enemies = ::BattleEngine.get_enemies!(launcher)\n position = -launcher.position-1\n other = nil\n arr = []\n enemies.each do |other|\n unless !other or other.dead?\n arr << other if (other.position-position).abs <= 1\n end\n end\n return arr\n end",
"def adjacent_tiles(dx, dy)\n tiles = []\n @tiles.size.times do |x|\n @tiles.size.times do |y|\n if ((x+1 == dx || x-1 == dx) && y == dy) || \n ((y+1 == dy || y-1 == dy) && x == dx)\n tiles << [x, y]\n end\n end\n end\n tiles\n end",
"def occupants\n return @mobiles.to_a | @players.to_a\n end",
"def find_unassigned_array(grid)\n unassigned_array = Array.new\n row = 0\n while row < N\n column = 0\n while column < N\n if unassigned_cells(grid, row, column)\n unassigned_array << [row, column]\n end\n column += 1\n end\n row += 1\n end\n return unassigned_array\nend",
"def adjacent_cell(x,y)\n if has_adjacent_cell?(x,y)\n [x+1, y]\n else\n nil\n end\n end",
"def find_hole\n @tiles.size.times do |x|\n @tiles.size.times do |y|\n return [x,y] if @tiles[y][x].nil?\n end\n end\n end",
"def get_neighbors(tile)\n @tiles.flatten.select { |t|\n (t.x <= (tile.x + 1) && t.x >= (tile.x - 1)) &&\n (t.y <= (tile.y + 1) && t.y >= (tile.y - 1)) &&\n tile != t\n }\n end",
"def get_other_col_cells cell\n\t\treturn get_col_cells(get_col cell) - [cell]\n\tend",
"def get_other_row_cells cell\n\t\treturn get_row_cells(get_row cell) - [cell]\n\tend",
"def tick!\n to_die = []\n to_live = []\n\n @cells.each do |row|\n row.each do |cell|\n\n # Add up the number of 'alive' neighbouring cells\n live_neighbour_count = neighbours(cell.x, cell.y).select { |n| n.alive? }.count\n\n if cell.alive? and (live_neighbour_count < 2 || live_neighbour_count > 3)\n to_die << cell\n elsif cell.dead? and live_neighbour_count == 3\n to_live << cell\n end\n end\n end\n\n to_die.each { |cell| cell.die! }\n to_live.each { |cell| cell.live! }\n end",
"def occupied_spaces\n spaces = []\n return spaces unless @page\n @page.occupied_spaces.each do |coord|\n spaces << [@x + coord[0], @y + coord[1]]\n end\n return spaces\n end",
"def valid_neighbours(current)\n DIRECTION_VECTORS.values\n .map { |dir_vec| current + dir_vec }\n .select { |loc| OPEN_TILES.include?(@points[loc]) }\n end",
"def neighbors\n return roomAdj.to_a\n end",
"def live_neighbours_around_cell(cell)\n live_neighbours = []\n # Neighbour to the North-East\n if cell.y > 0 and cell.x < (cols - 1)\n candidate = @cell_board[cell.y - 1][cell.x + 1]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbour to the South-East\n if cell.y < (rows - 1) and cell.x < (cols - 1)\n candidate = @cell_board[cell.y + 1][cell.x + 1]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbours to the South-West\n if cell.y < (rows - 1) and cell.x > 0\n candidate = @cell_board[cell.y + 1][cell.x - 1]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbours to the North-West\n if cell.y > 0 and cell.x > 0\n candidate = @cell_board[cell.y - 1][cell.x - 1]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbour to the North\n if cell.y > 0\n candidate = @cell_board[cell.y - 1][cell.x]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbour to the East\n if cell.x < (cols - 1)\n candidate = @cell_board[cell.y][cell.x + 1]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbour to the South\n if cell.y < (rows - 1)\n candidate = @cell_board[cell.y + 1][cell.x]\n live_neighbours << candidate if candidate.alive?\n end\n # Neighbours to the West\n if cell.x > 0\n candidate = @cell_board[cell.y][cell.x - 1]\n live_neighbours << candidate if candidate.alive?\n end\n live_neighbours\n end",
"def know_neighbors\n bomb_neighbors = 0\n neighbor_coords = []\n rel_neighbor_coords = [[0, 1], [1, 1], [-1, 0], [-1, 1], [1, 0], [1, -1], [0, -1], [-1, -1]]\n rel_neighbor_coords.each do | coord |\n neighbor_coords << [@coords[0] + coord[0], @coords[1] + coord[1]]\n end\n neighbor_coords.select! {|pos| pos.all? { |coord| (0..8).cover? coord }}\n neighbor_coords\n end",
"def get_moves\n [\n { row: @row + 1, col: @col + 2 },\n { row: @row + 1, col: @col - 2 },\n { row: @row + 2, col: @col + 1 },\n { row: @row + 2, col: @col - 1 },\n { row: @row - 1, col: @col + 2 },\n { row: @row - 1, col: @col - 2 },\n { row: @row - 2, col: @col + 1 },\n { row: @row - 2, col: @col - 1 }\n ].select do |move|\n [:blank_space, :enemy_piece].include? describe_location(move[:row], move[:col])\n end\n end",
"def neighbors(x, y)\n\t\tn = []\n\t\t\n\t\tn << [x-1, y] if x > 0 && @grid[y][x-1] & @@IN != 0\n\t\tn << [x+1, y] if x+1 < @grid[y].length && @grid[y][x+1] & @@IN != 0\n\t\tn << [x, y-1] if y > 0 && @grid[y-1][x] & @@IN != 0\n\t\tn << [x, y+1] if y+1 < @grid.length && @grid[y+1][x] & @@IN != 0\n\t\n\t\tn\n\tend",
"def get_empty_cells(cells)\r\n arr = []\r\n cells.each_with_index { |cell, i| arr << i if cell.nil? }\r\n arr\r\n end",
"def cells\n Enumerator.new do |yielder|\n buffer.each do |row|\n row.each do |cell|\n yielder << cell\n end\n end\n end\n end",
"def cells_grid_1by1\n [\n [\n MazeMagic::Maze::Edge.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::Edge.instance\n ],\n [\n MazeMagic::Maze::VerticalWall.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::VerticalWall.instance\n ]\n ]\n end",
"def adjacent_mines(row, col)\n count = 0\n adjacent_cells(row,col).each do |cell|\n if @mine_field[cell]\n count += 1\n end\n end\n\n count\n end",
"def adjacent_tiles(row, col)\n adj_tiles = []\n\n if row.positive?\n adj_tiles << tile_at(row - 1, col)\n adj_tiles << tile_at(row - 1, col - 1) unless col.zero?\n adj_tiles << tile_at(row - 1, col + 1) unless col == @size - 1\n end\n\n adj_tiles << tile_at(row, col - 1) unless col.zero?\n adj_tiles << tile_at(row, col + 1) unless col == @size - 1\n\n if row < @size - 1\n adj_tiles << tile_at(row + 1, col - 1) unless col.zero?\n adj_tiles << tile_at(row + 1, col)\n adj_tiles << tile_at(row + 1, col + 1) unless col == @size - 1\n end\n\n adj_tiles\n end",
"def get_adjacent_floors tile\n floors = Array.new\n @maze.get_adjacent_tiles(tile).each do |tile|\n floors.push tile if tile.is_floor\n end\n floors\n end",
"def pieces\n self.cells.values.map {|c| c.piece }.compact.uniq\n end",
"def neighbor_coords\r\n coordinates = [\r\n up,\r\n down,\r\n right, \r\n left,\r\n # Diagonals\r\n # Move.new(up).right,\r\n # Move.new(up).left,\r\n # Move.new(down).right,\r\n # Move.new(down).left\r\n up_right,\r\n up_left,\r\n down_right,\r\n down_left\r\n ]\r\n\r\n coordinates.compact\r\n end",
"def legal_moves\n moves = []\n\n # FOR SIMPLICITY require move to be within outer bounds\n # Calculate range of space to check\n\n row_min = [@outer_bounds[:top] - 1, 0].max\n row_max = [@outer_bounds[:bottom] + 1, 18].min\n\n column_min = [@outer_bounds[:left] - 1, 0].max\n column_max = [@outer_bounds[:right] + 1, 18].min\n (row_min..row_max).each do |i|\n (column_min..column_max).each do |j|\n if position[i][j] == \".\" # && !moves.index([i, j])\n moves << [i, j]\n end\n end\n end\n\n moves\n end",
"def get_direction_to_avoiding_enemies\n Directions.each do |dir|\n if !warrior.feel(dir).wall? and\n warrior.feel(dir).empty? and\n !is_oposite_direction(dir, get_bomb_direction)\n return dir\n end\n end\n return false\n end",
"def unblocked_cells(options = {})\n cells.select {|c, v| v.empty? || v.content == 'R' || v.content == 'C' }\n end",
"def next_life_span!\n next_round_dead_cells = []\n next_round_live_cells = []\n\n world.cells.each do |cell|\n #under population rule\n # puts cell.inspect\n # puts world.live_neighbours_around_cell(cell).count\n if cell.alive? and world.live_neighbours_around_cell(cell).count < 2\n next_round_dead_cells << cell\n end\n #cell to next gen\n if cell.alive? and ([2,3].include? world.live_neighbours_around_cell(cell).count)\n next_round_live_cells << cell\n end\n #over population\n if cell.alive? and world.live_neighbours_around_cell(cell).count > 3\n next_round_dead_cells << cell\n end\n #reproduction\n if cell.dead? and world.live_neighbours_around_cell(cell).count == 3\n next_round_live_cells << cell\n end\n end\n #revive cells for next span\n next_round_live_cells.each do |cell|\n cell.revive!\n end\n #kill cells\n next_round_dead_cells.each do |cell|\n cell.die!\n end\n end",
"def adjacent_tile_coords(coords)\n tile_offsets = {\n :nw => [-2, 1, 1], :w => [-1, 2, -1],\n :sw => [1, 1, -2], :se => [2, -1, -1],\n :e => [1, -2, 1], :ne => [-1, -1, 2]\n }\n result = coords.clone\n coords.each_value do | coord |\n tile_offsets.each_value do | offsets |\n new_coord = [coord[0] + offsets[0], coord[1] + offsets[1], coord[2] + offsets[2]]\n result[Board.key(*new_coord)] = new_coord\n end\n end\n result\n end",
"def available_page_cells(page)\n page.cells.select do |cell|\n cell.available_elements.include?(self.name)\n end\n end",
"def check_each_cell_status\n rows = grid.row_count\n cols = grid.column_count\n Matrix.build(rows, cols) { |row, col| find_live_neighbours(row, col) }\n end",
"def cells\n @cells ||= []\n end",
"def get_cells(missile)\n all_affected_cells = []\n missile.split(\"=>\").length > 1 ? (type, start_at = missile.split(\"=>\")) : (return missile)\n height, width = start_at.split(\"\")\n start_height_at = get_start_height(height)\n start_width_at = width.to_i > 1 ? width.to_i - 1 : width.to_i\n (start_height_at..height.next).each do |rows|\n (start_width_at..width.to_i+1).each do |column|\n if type == \"b\"\n all_affected_cells << \"#{rows}#{column}\" if (rows == height || column == width.to_i)\n elsif type == \"c\"\n all_affected_cells << \"#{rows}#{column}\" unless (rows == height || column == width.to_i)\n all_affected_cells << start_at unless all_affected_cells.include?(start_at)\n else\n all_affected_cells << \"#{rows}#{column}\"\n end\n end\n end\n return all_affected_cells\n end",
"def empty_cells\n cells.values.select {|cell| cell.empty? }\n end",
"def probable_enemy_occupations(options = {})\n fail 'Position not given!' unless options[:pos]\n # starting with the rightmost...leftmost. Then bottommost...topmost\n occupation_points = []\n center = Vector[*options[:pos]]\n # horizontally, until ship goes too left\n head = center.dup\n until head == center + Vector[-(options[:ship_length]), 0]\n body = body_from_head(head, options[:ship_length], ACROSS)\n occupation_points << body if valid?(body, options[:board])\n head -= ACROSS\n end\n # vertically, again until ship goes too far up\n head = center.dup\n until head == center + Vector[0, -(options[:ship_length])]\n body = body_from_head(head, options[:ship_length], DOWN)\n occupation_points << body if valid?(body, options[:board])\n head -= DOWN\n end\n points = remove_invalid_shots!(occupation_points.flatten, options[:board])\n EdenPlayer.prob_board_matrix points\n end",
"def live_neighbours_around_cell(cell)\n live_neighbours = []\n\n #check top cell\n if cell.x_axis > 0\n # puts \"Cell dimen1: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check right cell\n if cell.y_axis < (columns-1)\n # puts \"Cell dimen2: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check left cell\n if cell.y_axis > 0\n # puts \"Cell dimen3: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom cell\n if cell.x_axis < (rows-1)\n # puts \"Cell dimen4: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top left\n if cell.x_axis > 0 and cell.y_axis > 0\n # puts \"Cell dimen5: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top right\n if cell.x_axis > 0 and cell.y_axis < (columns-1)\n # puts \"Cell dimen6: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom left\n if cell.x_axis < (rows - 1) and cell.y_axis > 0\n # puts \"Cell dimen7: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom right\n if cell.x_axis < (rows - 1) and cell.y_axis < (columns - 1)\n # puts \"Cell dimen8: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n live_neighbours\n end",
"def neighbours(x, y)\n # If the x, y arguments are out of bounds we raise our custom `OutOfBoundError`.\n raise OutOfBoundsError if out_of_bounds x, y\n neighbours_found = 0\n # This method is compuationally expensive. As such, the performance degrades \n # as our cells count grows.\n @cells.each do |cx, cy|\n neighbours_found += 1 if neighbour? cx, cy, x, y\n end\n neighbours_found\n end",
"def neighbors\n neighbor_pos = []\n row, col = @pos\n # every permutation of\n # [row -1 , row , row + 1 && col - 1, col, col+1] not including [row,col]\n\n 3.times do |indx1|\n 3.times do |indx2|\n neighbor_pos << [row+indx1-1, col+indx2-1]\n end\n end\n # need to remove negatives, values > 8, and its own coordinate\n neighbor_pos.delete([row, col])\n neighbor_pos.reject do |pos|\n r, c = pos\n r < 0 || c < 0 || r > 8 || c > 8\n end\n end",
"def neighbours(pos_x, pos_y)\n cells = neighbours_coords(pos_x, pos_y).flatten.each_slice(2).map do |c|\n next if invalid_cell? c\n cell(c[0], c[1])\n end\n\n cells.delete_if(&:nil?)\n\n cells.nil? ? 0 : cells.inject(0, :+)\n end"
] |
[
"0.7447935",
"0.69975096",
"0.692523",
"0.6865361",
"0.6865361",
"0.68157977",
"0.66270554",
"0.6532827",
"0.6495445",
"0.6459816",
"0.64525163",
"0.64149356",
"0.637686",
"0.63372386",
"0.6317639",
"0.6266547",
"0.6243248",
"0.6235778",
"0.62256867",
"0.6197037",
"0.6154198",
"0.61242247",
"0.6114557",
"0.60304815",
"0.6023175",
"0.601885",
"0.6010975",
"0.600542",
"0.5931779",
"0.59316427",
"0.5920664",
"0.59197235",
"0.59134877",
"0.5855754",
"0.5847012",
"0.5839045",
"0.58272266",
"0.5810829",
"0.5805707",
"0.58010745",
"0.5787623",
"0.57761025",
"0.5772766",
"0.57509875",
"0.57499903",
"0.57261497",
"0.5720138",
"0.5713801",
"0.57082325",
"0.57074827",
"0.57006055",
"0.5695219",
"0.56944203",
"0.5678476",
"0.5677061",
"0.5677061",
"0.5677061",
"0.56767017",
"0.56719184",
"0.56707764",
"0.56705964",
"0.5667012",
"0.56604576",
"0.5659343",
"0.5658265",
"0.5657457",
"0.56546926",
"0.56538516",
"0.564319",
"0.5631642",
"0.56315",
"0.56203854",
"0.55978304",
"0.55927396",
"0.5589965",
"0.55773985",
"0.55746365",
"0.5564274",
"0.5563562",
"0.55577904",
"0.55481404",
"0.55346787",
"0.5533167",
"0.55292064",
"0.55170214",
"0.55139065",
"0.5508696",
"0.54966486",
"0.54887605",
"0.547639",
"0.5467901",
"0.5466162",
"0.54652417",
"0.5464941",
"0.54627657",
"0.5462197",
"0.5457145",
"0.5455502",
"0.5454401",
"0.5453388"
] |
0.6336466
|
14
|
Returns the shortest path from src to one of the destinations. If there are multiple shortest paths, e.g. A>B has the same length as A>C, returns all of them.
|
def shortest_paths(src, destinations)
return [] if destinations.empty?
paths = []
visited = Set.new([src])
queue = Containers::MinHeap.new
queue.push([1, [src]])
until queue.empty?
_, path = queue.pop
# Not going to find shorter paths than current best, return.
break if paths.any? && paths[0].size < path.size
cur = path.last
paths << path if destinations.include?(cur)
neighbors(cur).each do |pos|
next if visited.include?(pos) || occupied?(pos)
visited.add(pos)
new_path = Array.new(path.size) { |i| path[i].dup }
new_path << pos
queue.push([new_path.size, new_path])
end
end
paths
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def shortest_paths(source, dest)\n\t\t\t@source = source\n\t\t\tdijkstra source\n\t\t\tprint_path dest\n\t\t\treturn @distance[dest]\n\t\tend",
"def shortest_way(source, dest)\n\t\t@source = source\n dijkstra source\n \n if @distances[dest] != @infinity\n return @distances[dest]\n end\n\tend",
"def shortest_path\n dist, previous = Hash.new(Infinity), {}\n dist[@source] = 0.0\n queue = @graph.vertex_set.dup\n\n until queue.empty?\n u = queue.min { |a,b| dist[a.name] <=> dist[b.name] }\n break if dist[u.name].infinite?\n queue.delete(u)\n\n u.each_edge do |e, v|\n alt = dist[u.name] + e.weight\n if alt < dist[v.name]\n dist[v.name] = alt\n previous[v.name] = u.name\n end\n end\n end\n\n path = []\n u = @dest\n until previous[u].nil?\n path.unshift(u)\n u = previous[u]\n end\n\n path.unshift(@source)\n end",
"def shortest_path_to(dest_node)\n return unless has_path_to?(dest_node)\n path = []\n while (dest_node != @node) do\n path.unshift(dest_node)\n dest_node = @edge_to[dest_node]\n end\n path.unshift(@node)\n end",
"def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return path_to_destination(current_position, initial_position_obj)\n end\n\n add_possible_destination(position, current_position, knights_path)\n end\n end",
"def shortest_paths(source, dest)\n @graph_paths=[]\n @source = source\n dijkstra source\n @path=[]\n find_path dest\n actual_distance=if @distance[dest] != INFINITY\n @distance[dest]\n else\n \"no path\"\n end\n \"Shortest route and distance : #{@path.join(\"-->\")}, #{actual_distance} km\"\n end",
"def shortest_path( dest, exclusions = [] )\n exclusions ||= []\n previous = shortest_paths( exclusions )\n s = []\n u = dest.hex\n while previous[ u ]\n s.unshift u\n u = previous[ u ]\n end\n s\n end",
"def shortest_route visit_path, dst, condition=nil\n return route(visit_path, dst).first.cost\n end",
"def shortest_paths(dest)\n position = dest\n final = {}\n analisados = {}\n route = []\n route << dest\n @previous['a'] = -1\n\n @nodes.each do |n|\n analisados[n] = false\n end\n analisados[position] = true\n\n while analisados(analisados)\n adyacentes(position, analisados).each do |n|\n if @distance[n] == (@distance[position] - graph[n][position])\n @previous[position] = n\n position = n\n route << n\n end\n analisados[n] = true\n end\n\n end\n route << 'a'\n route\n end",
"def shortest_paths(s)\n @source = s\n dijkstra s\n puts \"Source: #{@source}\"\n @nodes.each do |dest|\n puts \"\\nTarget: #{dest}\"\n print_path dest\n if @d[dest] != @INFINITY\n puts \"\\nDistance: #{@d[dest]}\"\n else\n puts \"\\nNO PATH\"\n end\n end\n end",
"def shortest_path(src, dst = nil)\n distances = {}\n previouses = {}\n self.each do |node|\n distances[node] = nil\n previouses[node] = nil\n end\n distances[src] = 0\n nodes = self.clone\n until nodes.empty?\n nearest_node = nodes.inject do |a, b|\n next b unless distances[a]\n next a unless distances[b]\n next a if distances[a] < distances[b]\n b\n end\n break unless distances[nearest_node] # Infinity\n if dst and nearest_node == dst\n return distances[dst]\n end\n neighbors = nodes.neighbors_from(nearest_node)\n neighbors.each do |node|\n alt = distances[nearest_node] + nodes.distance(nearest_node, node)\n if distances[node].nil? or alt < distances[node]\n distances[node] = alt\n previouses[node] = nearest_node\n # decrease-key v in Q # ???\n end\n end\n nodes.delete nearest_node\n end\n if dst\n return nil\n else\n return distances\n end\n end",
"def path_from_src_to_dest(graph, src=0, dest=0)\n\t\t# Update source and destination\n\t\t@source, @destination = src, dest\n\n\t\t# Check if source is undefined, if so return empty path\n\t\tif @source == 0\n\t\t\treturn []\n\t\tend\n\n\t\t# Generate a connections hash based on graph edges\n\t\toutgoing = Hash.new()\n\t\tnodes = graph.nodes.keys\n\t\tresult = Array.new()\n\n\t\tgraph.nodes.keys.each {|key| outgoing[key] = Hash.new() }\n\t\tgraph.edges.values.each do |edge|\n\t\t\t# Is it possible for any two issues to have multiple links\n\t\t\t# between them?\n\t\t\toutgoing[edge.a.id][edge.b.id] = edge\t\t\n\t\tend\n\n\t\t# If an edge already exists in the graph from source to destination\n\t\tif outgoing[@source].has_key?(@destination)\n\t\t\tresult.push(outgoing[@source][@destination].id)\n\t\t\treturn result\n\t\tend\n\t\t\t\n\t\t# Compute all paths from source\n\t\tpaths_tracer, paths_distances, relationships_on_paths = compute_paths_from_source(outgoing, nodes)\n\t\t\n\t\t# Find the shortest path through the graph between source and destination\n\t\tif destination != 0\n\t\t\treturn trace_path_src_to_dest(outgoing, paths_tracer)\n\t\tend\n\n\t\t# This happens only if the destination is 0, as it would have returned otherwise.\n\t\t# Return available relationships, distances, \n\t\treturn important_relationships_from_source(paths_tracer, paths_distances, relationships_on_paths)\n\tend",
"def shortest_path(start_coord, destination_coord)\n queue = Queue.new\n queue << [start_coord]\n seen = Set.new([start_coord])\n while queue\n begin\n path = queue.pop(non_block = true)\n rescue ThreadError\n return nil\n end\n x, y = path[-1]\n if [x, y] == destination_coord\n return path\n end\n for x2, y2 in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]\n if (0 <= x2 && x2 < @map[0].length) && (0 <= y2 && y2 < @map.length) && (@map[y2][x2] != @WALL && @map[y2][x2] != @PERMANENT_WALL) && !seen.include?([x2, y2])\n queue << (path + [[x2, y2]])\n seen.add([x2, y2])\n end\n end\n end\n end",
"def shortest_paths(s)\n\t\t@source = s\n\t\tdijkstra s\n\t\tputs \"Source: #{@source}\"\n\t\t@nodes.each do |dest|\n\t\t\tputs \"\\nTarget: #{dest}\"\n\t\t\tprint_path dest\n\t\t\tif @d[dest] != @INFINITY\n\t\t\t\tputs \"\\nDistance: #{@d[dest]}\"\n\t\t\telse\n\t\t\t\tputs \"\\nNO PATH\"\n\t\t\tend\n\t\tend\n\tend",
"def compute_shortest_path\n update_distance_of_all_edges_to(Float::INFINITY)\n @distance_to[@source_node] = 0\n\n # The prioriy queue holds a node and its distance from the source node.\n @pq.insert(@source_node, 0)\n while @pq.any?\n node = @pq.remove_min\n node.adjacent_edges.each do |adj_edge|\n relax(adj_edge)\n end\n end\n end",
"def dijkstra_shortest_path(source, destination, graph)\n distances, previouses = Hash.new(Float::INFINITY), Hash.new\n distances[source] = 0\n\n vertices = graph.vertices.dup\n\n while !vertices.empty?\n closest_vertex = vertices.min_by { |v| distances[v] }\n vertices.delete closest_vertex\n\n if closest_vertex == destination\n return path(previouses, destination, [])\n end\n\n closest_vertex.adjacent_edges.each do |e|\n neighbor = e.destination\n distance = e.weight + distances[closest_vertex]\n\n if distance < distances[neighbor]\n distances[neighbor] = distance\n previouses[neighbor] = closest_vertex\n end\n end\n end\n\n return [] #no path to destination\nend",
"def dijkstra(src, target = nil)\n frontier = PriorityQueue.new\n shortest_paths = {src => 0}\n frontier[src] = 0\n\n until frontier.empty?\n v, c = frontier.pop_min # much faster\n\n return c if target == v\n shortest_paths[v] = c\n\n v.outer_edges.each do |e|\n v2, c2 = e.to, e.cost\n next if shortest_paths[v2]\n\n frontier.insert([v2, c + c2]) # faster\n end\n end\n\n shortest_paths\nend",
"def shortest_path(start, finish)\n queue << [start, 0]\n loop do\n break if queue.empty?\n vertex, d = queue.pop\n graph[*vertex] = d\n break if vertex == finish\n enqueue_neighbours(*vertex, d + 1)\n end\n queue.clear\n !blank?(finish) ? build_path(start, finish) : []\n end",
"def shortest_path_between_nodes(initial, destination)\n initial.distance = 0\n\n current = initial\n loop do\n # at the destination node, stop calculating\n break if current == destination\n\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return nil if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n\n destination.path\n end",
"def shortest_paths(source)\n init(source)\n relax_edges\n PathBuilder.new(source, @visitor.parents_map).paths(@graph.vertices)\n end",
"def shortest_path(root, dest)\n priority = Hash.new\n visited = Hash.new\n previous = Hash.new\n q = PriorityQueue.new\n @vertices.each do |k, up|\n if up\n priority[k] = @@infinity\n visited[k] = false\n previous[k] = nil\n end\n end\n priority[root] = 0\n q[root] = 0\n until q.empty?\n u = q.delete_min\n visited[u[0]] = true\n break if u[1] == @@infinity\n @edges_cost.each_key do |s|\n @edges_cost[s].each_key do |d|\n if edges_up[s].fetch(d) and vertices[s] and vertices[d]\n if !visited[d] and priority[s] + @edges_cost[s].fetch(d) < priority[d]\n previous[d] = s\n priority[d] = priority[s] + @edges_cost[s].fetch(d)\n q[d] = priority[d]\n end\n end\n end\n end\n end\n prior = dest\n out = \"#{prior} \"\n while previous[prior]\n out = \"#{previous[prior]} \" + out\n prior = previous[prior]\n end\n out += \"#{priority[dest]}\\n\"\n print out\n priority[dest]\n end",
"def shortest_distances( src )\n \n raise ArgumentError if (not @graph.has_key? src)\n\n # keep a priority queue of nodes, ordered by known distances\n distances = CPriorityQueue.new\n @nodes.each { |node|\n distances[node] = INFINITY\n }\n distances[src] = 0;\n\n # results accumulator\n results = {}\n\n while( not distances.empty? ) do\n \n # get the shortest known\n pair = distances.delete_min\n node = pair[0]\n node_dist = pair[1]\n \n # record\n results[node] = node_dist \n\n # traverse all neighbors\n neighbors = @graph[node] || {}\n neighbors.each { |neighbor, dist|\n # if it's nearer to go by me, update\n neighbor_d = distances[neighbor] || -1 # neighbor may have been found already\n if (node_dist + dist < neighbor_d)\n distances[neighbor] = node_dist + dist\n end\n }\n\n end\n\n return results\n\n end",
"def get_path(start, stop)\n @graph.dijkstra_shortest_path(@weight_map, start, stop)\n end",
"def call\n return nil unless on_the_graph? # Prevents a stack overflow in the gem\n return shortest_path[1..-1] if shortest_path.length > 1\n end",
"def shortest_path(nodes, starting, ending)\n queue = [starting]\n previous = {}\n previous[starting] = nil\n while !queue.empty?\n p queue\n last_node = queue.pop\n if last_node == ending\n path = []\n while previous[last_node]\n path.unshift(last_node)\n last_node = previous[last_node]\n end\n path.unshift(starting)\n return path\n end\n if neighbors = nodes[last_node]\n neighbors.each do |neighbor|\n unless previous.has_key?(neighbor)\n queue.unshift(neighbor) \n previous[neighbor] = last_node\n end\n end\n end\n end\nend",
"def next_step_to_shortest_path(from_x, from_y, to_x, to_y)\n move = shortest_path(from_x, from_y, to_x, to_y)&.first\n return nil unless move\n if move[0] == from_x && move[1] == from_y + 1\n return 'S'\n elsif move[0] == from_x && move[1] == from_y - 1\n return 'N'\n elsif move[0] == from_x + 1 && move[1] == from_y\n return 'E'\n elsif move[0] == from_x - 1 && move[1] == from_y\n return 'W'\n end\n raise 'This should not happen'\n end",
"def dijkstra(src, dest)\n\t\tdistances = {}\n\t\tprevious = {}\n\n\t\t# set all values to infinity\n\t\tself.each do |vertex|\n\t\t\tdistances[vertex] = $inf\n\t\t\tprevious[vertex] = $inf\n\t\tend\n\n\t\t# set the source vertice to 0\n\t\tdistances[src] = 0\n\t\tq = self.clone\n\n\t\twhile !q.empty?\n\t\t\t# get the nearest vertice\n\t\t\tu = smallest_key(q, distances)\n\t\t\tbreak if distances[u] == $inf\n\n\t\t\t# if smallest is destination, return \n\t\t\tif u == dest\n\t\t\t\treturn distances[dest] \n\t\t\tend\n\t\t\t\n\t\t\t# iterate all neighbours of the nearest vertice\t\t\t\t\n\t\t\tneighbours(u).each do |v|\n\t\t\t\t# calculate distances from neighbour nodes\n\t\t\t\t# and add cumulated distance\n\t\t\t\talt = distances[u] + length_between(u, v)\n\t\t\t\t# update vertice distances accordingly\n\t\t\t\tif alt < distances[v]\n\t\t\t\t\tdistances[v] = alt\n\t\t\t\t\tprevious[q] = u\n\t\t\t\tend\n\t\t\tend\n\t\t\t# delete vertice from array\n\t\t\tq.delete(u)\n\t\tend\n\t\tdistances\n\tend",
"def shortest_paths(source)\n level = 0\n nextlevel = [source]\n seen = { source => level }\n pred = { source => [] }\n until nextlevel.empty?\n level += 1\n thislevel = nextlevel\n nextlevel = []\n thislevel.each do |v|\n neighbors_of(v).each do |w|\n next if (seen.keys.include? w) && (seen[w] != level)\n unless seen.keys.include? w\n pred[w] = []\n seen[w] = level\n nextlevel << w\n end\n pred[w] << v\n end\n end\n end\n [pred, seen]\n end",
"def get_path_recursively(previouses, src, dest)\n return src if src == dest\n raise ArgumentError, \"No path from #{src} to #{dest}\" if previouses[dest].nil?\n [dest, get_path_recursively(previouses, src, previouses[dest])].flatten\n end",
"def shortest_path(start_node, end_node, graph)\n adjacent_edges = graph.select{ | edge | edge[NODES].include?(start_node) }\n remaining_edges = graph - adjacent_edges\n shortest_path = Path.new\n adjacent_edges.each do | edge |\n path = Path.new [edge]\n neighbor_node = (edge[NODES] - [start_node])[0] # ['A', 'B'] - ['A'] => ['B']\n unless neighbor_node == end_node\n path_ahead = shortest_path(neighbor_node, end_node, remaining_edges)\n (path_ahead.empty?)? path.clear : path.concat(path_ahead)\n end \n shortest_path = path if path.distance < shortest_path.distance\n end\n shortest_path\n end",
"def dijkstra_shortest_path(start, finish)\n visited, unvisited = Array.new, Array.new\n distances = Hash.new\n\n distances[start] = 0\n unvisited << start\n\n # find the distance\n while not unvisited.empty?\n curr_node = unvisited.pop\n visited << curr_node\n get_edges(curr_node).each do |edge| \n if visited.find_index(edge.out_vertex) == nil\n unvisited.unshift(edge.out_vertex) if unvisited.find_index(edge.out_vertex) == nil\n curr_distance, min_distance = distances[curr_node], distances[edge.out_vertex] || 1.0 / 0.0\n if curr_distance + edge.distance < min_distance\n distances[edge.out_vertex] = curr_distance + edge.distance\n end\n end\n end\n end\n\n # figure out the path\n previous = finish\n path = Array.new() \n path << previous\n while distances[previous] != 0\n get_edges(previous).each do |edge|\n if previous != edge.in_vertex && distances[edge.in_vertex] + edge.distance == distances[previous]\n previous = edge.in_vertex\n path << previous\n break\n end\n end\n end\n \n return distances[finish], path.reverse\n end",
"def shortest_path_from(from, check=nil)\n dirs = [ [1,0], [0,1], [0,-1], [-1,0] ]\n \n #return [1,0]\n \n unless @cache and @cached_for == towers.keys+[check]\n\tmarked = {}\n\tmarked.default = false\n\n\tq = [Config.monsters_end_at]\n\tfirst = 0\n\t\n\tmarked[Config.monsters_end_at] = true\n\t\n\twhile first < q.size\n\t v = q[first]\n\t first += 1\n\t for i in dirs\n\t w = [v[0]+i[0], v[1]+i[1]]\n\t next if w != Config.monsters_start_at and w != Config.monsters_end_at and\n\t\t (w[0] < 0 or w[1] < 0 or w[0] >= Config.map_size[0] or w[1] >= Config.map_size[1])\n\t next if marked[w] or w == check or towers[w]\n\t marked[w] = [-i[0], -i[1] ]\n\t q << w\n\t end\n\tend\n\t\n\t@cached_for = towers.keys+[check]\n\t@cache = marked\n end\n \n return @cache[from]\n end",
"def path src, dest\n path = _path srcPaths: [[@nodes[src]]], dest: @nodes[dest]\n if !path.nil?\n path.map(&:value)\n end\n end",
"def shortest_path(from_x, from_y, to_x, to_y)\n @visited = Array.new(@matrix.size) { Array.new(@matrix.first.size) { false } }\n @farthest_node = nil\n queue = Queue.new\n queue << Node.new(from_x, from_y, 0)\n\n while !queue.empty? do\n node = queue.pop\n\n if !@farthest_node || node.dist > @farthest_node.dist\n @farthest_node =node\n end\n\n if node.x == to_x && node.y == to_y\n # We pathed to the target\n target_node = node\n break\n end\n [[-1,0],[1,0],[0,1],[0,-1]].each do |dir|\n x = node.x + dir[0]\n y = node.y + dir[1]\n if is_valid?(x, y)\n @visited[y][x] = true\n queue.push(Node.new(x, y, node.dist + 1, node))\n end\n end\n end\n\n # We didn't find a path to the target\n return nil unless target_node\n\n # Trace back the journey\n journey = []\n journey.push [node.x,node.y]\n while !node.parent.nil? do\n node = node.parent\n journey.push [node.x,node.y]\n end\n journey.reverse.drop(1)\n end",
"def shortest_single_flight\n\n min_distance = @largest_integer\n flight = \"\"\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n if dist < min_distance\n min_distance = dist\n flight = \"#{get_city_info(city,\"name\")}-#{dest}\"\n end\n end\n end\n\n return flight\n\n end",
"def shortest_length(start, finish)\n infinity = (2**(0.size * 8 - 2) - 1) # max Fixnum integer value\n distances = {} # smallest distance from starting vertex to this one\n previous = {}\n cyclic = start == finish # true if starting vertex = ending vertex\n loops = 0 # useful for cyclic path\n vertex_pq = PriorityQueue.new\n\n adj_lists.each do |vertex|\n vname = vertex.name\n if vname == start\n distances[vname] = 0\n vertex_pq.enq(vname, 0)\n else\n distances[vname] = infinity\n vertex_pq.enq(vname, infinity)\n end\n previous[vname] = nil\n end\n\n while vertex_pq\n loops += 1\n # if cyclic, pretend starting vertex is unvisited. put it back in queue.\n if cyclic && loops == 2\n vertex_pq.enq(start, infinity)\n distances[start] = infinity\n end\n # vertex currently being checked. picks closest one first.\n current = vertex_pq.deq\n vname = current.keys.first\n\n # if we've arrived at final vertex, return shortest distance\n # if cyclic, skip this code during first loop\n if vname == finish && loops > 1\n shortest_path = []\n vname2 = vname\n while previous[vname2]\n shortest_path << vname2\n vname2 = previous[vname2]\n previous[start] = nil if cyclic # pretend starting vertex is unvisited\n end\n shortest_path = [start] + shortest_path.reverse\n print \"Shortest path: #{shortest_path}, Length = #{path_length(shortest_path)}\\n\"\n return distances[finish]\n end\n\n # leave if we never get to final vertex\n break if vname == nil || distances[vname] == infinity\n\n adj_vertices(vname, adj_lists).each do |vertex|\n alt_distance = distances[vname] + dist(vname, vertex)\n # if total distance to neighbor < last minimum total distance\n # to neighbor, replace it with this new distance\n if alt_distance < distances[vertex]\n distances[vertex] = alt_distance\n previous[vertex] = vname\n vertex_pq.enq(vertex, alt_distance)\n end\n end\n end\n\n end",
"def shortest_distance()\n min = 1000000\n s = \"\"\n @edges.each do |city, dests|\n dests.each do |dest|\n if min > dest.distance\n min = dest.distance\n s = \"#{city} to #{dest.name}\"\n end\n end\n end\n \"Shortest distance is #{min} from #{s}\"\n end",
"def shortest_path_to(node)\n return nil if @previous_nodes[node].nil?\n\n nodes = [node]\n while previous_node = @previous_nodes[nodes[0]] do\n nodes.unshift(previous_node)\n end\n\n nodes\n end",
"def get_allpaths(source, dest, visited, path)\n # mark visited\n visited[source] = 1\n path << source\n\n if source.eql? dest\n @paths << path.dup\n else\n # recurse for all neighboring nodes\n @nnmap[source].each do |n|\n get_allpaths(n, dest, visited, path) if visited[n].eql? 0\n end\n end\n\n path.pop\n visited[source] = 0\n end",
"def shortest_path_to(other, options = {:method => :djikstra})\n latch = options[:method] == :breadth_first ? 2 : 1\n self.class.shortest_path(latch, id, other.id)\n end",
"def shortest_path\n pa = AI::AStarAlgorithm.new($map.grid, $map.gen_coordinates)\n pa.astar\n end",
"def dijkstra(src, tar = nil)\n distances = {}\n @nodes.each do |vertex|\n distances[vertex] = nil\n end\n distances[src] = 0\n vertices = @nodes.clone\n until vertices.empty?\n nearest_vertex = vertices.inject do |a, b|\n next b unless distances[a]\n next a unless distances[b]\n next a if distances[a] < distances[b]\n b\n end\n break unless distances[nearest_vertex]\n if tar and nearest_vertex == tar\n return distances[tar]\n end\n neighbors = self.neighbors(nearest_vertex)\n neighbors.each do |vertex|\n alt = distances[nearest_vertex] + self.distance_between(nearest_vertex, vertex)\n if distances[vertex].nil? or alt < distances[vertex]\n distances[vertex] = alt\n end\n end\n vertices.delete nearest_vertex\n end\n \n return nil\n end",
"def return_shortest_path(from)\r\n\r\n queue = Queue.new\r\n queue << from\r\n from.distance = 0\r\n while(!queue.empty?)\r\n v= queue.pop\r\n count=0\r\n adjDir = find_adjacent_rooms(v.roomObject)\r\n while(count < adjDir.length)\r\n w = @vertices[v.roomObject.return_title(adjDir[count])]\r\n\r\n if(w.distance==Float::INFINITY)\r\n w.distance = v.distance + 1\r\n w.path = v.path + \" \" + adjDir[count].to_s()\r\n queue << w\r\n end\r\n count = count + 1\r\n end\r\n count=0\r\n end\r\n\r\n end",
"def shortest_distance_between_nodes(initial, destination)\n shortest_path_between_nodes(initial, destination).last.distance\n end",
"def travel_cost( dest )\n sp = shortest_path( dest )\n path_cost( sp )\n end",
"def find_any_path_between_vertices(source_vertex, destination_vertex)\n validate_integer(source_vertex, destination_vertex)\n return nil if @vertices[source_vertex].nil? || @vertices[destination_vertex].nil?\n return path_between_vertices(source_vertex, destination_vertex)\n end",
"def plan(s1, s2)\r\n if s1 == s2\r\n return []\r\n end\r\n\r\n condensed_path = Array.new\r\n full_path = Array.new\r\n temp = BFS.new(graph, find_node(s1)).shortest_path_to(find_node(s2))\r\n\r\n temp.each {|x| full_path.push(x.to_s)}\r\n condensed_path.push(full_path.first)\r\n condensed_path = condensed_path + transfer_stations(full_path)\r\n \r\n if condensed_path.last != full_path.last #need to test this more\r\n condensed_path << full_path.last\r\n end\r\n\r\n return condensed_path\r\n end",
"def find_shortest_path(start_node, end_node)\n\n\t\tif (!start_node || !end_node)\n\t\t\traise \"start and end nodes must be specified\"\n\t\tend\n\n\t\tqueue = Hash[@edges.keys.map { |k| [k, nil] }]\n\t\tqueue[start_node] = 0\n\n\t\tdistances = queue.dup\n\t\tcrumbs = {}\n\n\t\twhile queue.size > 0\n\n\t\t\texpanded_node = get_min(queue)\n\n\t\t\t# Check if the current path to each neighbor of the expanded_node\n\t\t\t# is shorter than the path currently stored on the distances hash\n\t\t\t@edges[expanded_node].each do |node, edge|\n\n\t\t\t\tif distances[expanded_node]\n\t\t\t\t\n\t\t\t\t\tcurrent_path_distance = distances[expanded_node] + edge.weight\n\n\t\t\t\t\t# The distance to node is shorter via the current path or the distance to node hasn't yet been computed.\n\t\t\t\t\t# Either way, the distance from start_node->node is updated with the current distance (since it is shorter)\n\t\t\t\t\tif (!distances[node] || current_path_distance < distances[node])\n\t\t\t\t\t\tdistances[node], queue[node] = current_path_distance, current_path_distance\n\t\t\t\t\t\tcrumbs[node] = expanded_node\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\tend\n\n\t\t\tqueue.delete(expanded_node)\n\n\t\tend\n\n\t\t# List of edges representing the shortest path from start_node to end_node\n\t\tshortest_path = []\n\t\tcurrent_node = end_node\n\n\t\twhile (current_node && current_node != start_node && crumbs.size > 0)\n\t\t\tprevious_node = crumbs[current_node]\n\t\t\tif (previous_node)\n\t\t\t\tshortest_path << @edges[previous_node][current_node]\n\t\t\t\tcrumbs.delete(current_node)\n\t\t\tend\n\t\t\tcurrent_node = previous_node\n\t\tend\n\n\t\treturn shortest_path.reverse\n\n\tend",
"def select_possible_path(possible_paths)\n vertex, data = possible_paths.min_by do |vertex, data|\n data[:cost]\n end\n vertex\nend",
"def find_shortest_path(initial_node, final_node)\n\t\tunless @nodes.include?(initial_node) && @nodes.include?(final_node)\n\t\t raise(\"Either of the nodes not found in the Graph\") \n\t\tend\n\t\tdistance = {}\n\t previous = {}\n\t\tdistance[initial_node] = 0 # Distance from initial_node to initial_node\n\t previous[initial_node] = nil\n\t\tnodes_counted = @nodes\n\t\t\t\n\t\tnodes_counted.each do |n|\n\t\t if n != initial_node \n\t\t\t distance[n] = Float::INFINITY # Unknown distance function from initial_node to final_node\n\t\t\t previous[n] = nil \t # Previous node in optimal path from initial_node\n\t\t\tend\n\t\tend\n\n\t\tuntil nodes_counted.empty? \n\t\t\n\t\t\tu = distance.select{|k,v| nodes_counted.include?(k)}.min_by{|k,v| v}.first # Source node in first case\n\t\t\tbreak if (distance[u] == Float::INFINITY)\n\t\t\tnodes_counted.delete(u)\n\t\t\t\n\t\t\t@paths[u].keys.each do |v|\n\t\t\t\talt = distance[u] + @paths[u][v]\n\t\t\t\tif alt < distance[v] # A shorter path to v has been found\n\t\t\t\t\tdistance[v] = alt\n\t\t\t\t\tprevious[v] = u\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t \n\t\tpath = []\n\t\tcurrent = final_node\n\t\twhile current\n\t\t\tpath.unshift(current)\n\t\t\tcurrent = previous[current]\n\t\tend\n \n\t\treturn distance[final_node], path\n\n\tend",
"def find_path(start, goal)\n raise \"loc1 must not be the same as loc2\" if start == goal\n\n # Using A* path-finding algorithm\n # See pseudocode here: https://en.wikipedia.org/wiki/A*_search_algorithm\n # https://www.redblobgames.com/pathfinding/a-star/introduction.html\n # NOTE that this is overkill for this problem...\n open_set = Set.new([start])\n came_from = {}\n\n # Default value of \"Infinity\", but we can just use nil\n g_score = {}\n g_score[start] = 0\n\n # f_score = g_score[node] + h_score[node]\n # This uses both current best path (g score) aka similar to Djikstra's algorithm,\n # plus the heuristic score.\n f_score = {}\n # g_score[start] is 0, so not included here\n f_score[start] = h_score(start, goal)\n\n # Note that we add d_score as the weight of the edge, but in our\n # case, we consider all edges equally, so hardcode 1\n d_score = 1\n\n until open_set.empty? do\n # Node in open set with lowest f score (would ideally use PriorityQueue)\n current = open_set.min_by { |node| f_score[node] }\n\n if current == goal\n return reconstruct_path(came_from, current)\n end\n\n open_set.delete(current)\n\n valid_neighbours(current).each do |neighbour_loc|\n tentative_g_score = g_score[current] + d_score\n if g_score[neighbour_loc].nil? || tentative_g_score < g_score[neighbour_loc]\n # This path to neighbor is better than any previous one. Record it!\n came_from[neighbour_loc] = current\n g_score[neighbour_loc] = tentative_g_score\n f_score[neighbour_loc] = g_score[neighbour_loc] + h_score(neighbour_loc, goal)\n if !open_set.include?(neighbour_loc)\n open_set << neighbour_loc\n end\n end\n end\n end\n\n raise \"error, no path found!\"\n end",
"def shortest_paths( exclusions = [] )\n # Initialization\n exclusions ||= []\n source = hex\n dist = Hash.new\n previous = Hash.new\n q = []\n @game.map.each do |h|\n if not exclusions.include? h\n dist[ h ] = INFINITY\n q << h\n end\n end\n dist[ source ] = 0\n \n # Work\n while not q.empty?\n u = q.inject { |best,h| dist[ h ] < dist[ best ] ? h : best }\n q.delete u\n @game.map.hex_neighbours( u ).each do |v|\n next if exclusions.include? v\n alt = dist[ u ] + entrance_cost( v )\n if alt < dist[ v ]\n dist[ v ] = alt\n previous[ v ] = u\n end\n end\n end\n \n # Results\n previous\n end",
"def best_path(start, target)\n queue = []\n path = []\n targetX = target[0]\n targetY = target[1] \n update_possible_moves(start)\n path << [@x, @y]\n until @x == targetX && @y == targetY\n @moves.each do |valid_move|\n queue << valid_move unless out_of_bounds?(valid_move) \n end\n #shift because we want bread-first search\n next_move = queue.shift\n update_possible_moves(next_move)\n path << [@x, @y] \n end\n # Filter out the best path and present it\n best_possible_path = filter_path(path)\n puts \"You made it in #{best_possible_path.length} moves! The path is:\\n#{best_possible_path}\"\n end",
"def shortest_walk(arr)\n short_path=[]\n # outer loop continues until we can't eliminate any more directions\n done = false\n while !done do\n done = true\n i=0\n while (i < arr.length) \n if ((arr[i] == \"NORTH\" and arr[i+1] == \"SOUTH\") or (arr[i] == \"SOUTH\" and arr[i+1] == \"NORTH\") or (arr[i] == \"EAST\" and arr[i+1] == \"WEST\") or (arr[i] == \"WEST\" and arr[i+1] == \"EAST\"))\n # if adjacent directions are opposite, skip them both and reset done to false\n # because we may need to make another pass of the resulting array\n i+=2\n done = false\n else\n # Otherwise, store this direction in our shortest path and move to the next direction\n short_path << arr[i]\n i+=1\n end \n end\n # Set our arr in the loop to the shortest path. We'll check it again if we've\n # removed anything from the previous iteration\n arr = short_path\n # Empty the shortest path array for the next round if needed\n short_path = [] \n end\n # now arr stores the shortest path\n return arr\n end",
"def bfs_shortest_path(node1, node2)\n distance, route = breadth_first_search(node1)\n step = distance[node2]\n node = node2\n path = [ node2 ]\n while node != node1 and route[node]\n node = route[node]\n path.unshift(node)\n end\n return step, path\n end",
"def solve_dijkstra\n\n unvisited_set = @unvisited_set.dup\n\n # create a queue for nodes to check\n @queue = []\n current_node = @start_node\n @queue << current_node\n\n # Stop If there are no unvisited nodes or the queue is empty\n while unvisited_set.size > 0 && @queue.size > 0 do\n\n # set the current node as visited and remove it from the unvisited set\n current_node = @queue.shift\n\n # remove visited node from the list of unvisited nodes\n unvisited_set.delete(current_node)\n\n # find the current node's neighbours and add them to the queue\n rolling_node = @node_list.find { |hash| hash[:id] == current_node }\n rolling_node[:neighs].each do |p|\n # only add them if they are unvisited and they are not in the queue\n if unvisited_set.index(p) && !@queue.include?(p)\n @queue << p\n # set the previous node as the current for its neighbours\n change_node = @node_list.find { |hash| hash[:id] == p }\n change_node[:prev] = current_node\n # increase the distance of each node visited\n change_node[:dist] = rolling_node[:dist] + @step\n end\n end\n\n if current_node == @goal_node\n find_shortest_path(rolling_node)\n break\n end\n end\n return @shortest_path_coords\n end",
"def shortest_path(v,w)\n raise ArgumentError unless path?(v,w) \n to_edge = []\n bfs(w) { |v1,v2| to_edge[v2] = v1 }\n result = []\n x = v\n while x != w\n result << x\n x = to_edge[x]\n end\n result << x\n end",
"def find_shortest_path(exclude_path_with_tile = nil)\n node = find_end_tile(exclude_path_with_tile)\n return [@start_tile, @end_tile] if node.nil?\n expand_path(node)\n end",
"def breadth_first_search(graph, source, target = nil)\n # queue: first-in, first-out (FIFO). keeps track of which vertices have already\n # been visited but have not yet been visited from, so we know where to search.\n queue = Queue.new\n\n # a `Set` instance is a collection of unordered values with no duplicates\n # maintain a list of visited nodes and prevent checking a node more than once\n visited = Set.new\n\n # shortest path information, if applicable\n meta = {}\n\n # enqueue the source key (push it to the empty queue)\n queue.enq(source)\n\n until queue.empty?\n # current node, which we `shift` from the queue\n current = queue.deq\n\n # print the shortest path if it was found\n return path(source, current, meta) if target && current == target\n\n # we don't have to keep track of distance here, since we have a method\n # to access each of the node's neighbors. the neighbors are stored in a set.\n # process each neighboring vertex of the current node,\n # i.e. traverse all outgoing edges from the current node.\n current.neighbors.each do |neighbor|\n # if the neighbor node is unvisited, we ignore this edge\n unless visited.include?(neighbor)\n queue.enq(neighbor)\n visited.add(neighbor) # we just enqueued this node, so mark it as visited\n meta[neighbor] = current # record the path (only done once, b/c of `unless`)\n end\n end\n end\nend",
"def shortest_path_to_all_nodes(initial)\n initial.distance = 0\n\n current = initial\n loop do\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return graph.vertices if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n end",
"def shortest_circuit()\n shortest_cir = Array.new\n shortest_weight = 99999\n\n vert = vertex_list()\n start_point = vert[0]\n vert.delete_at(0)\n\n vert_perm = vert.permutation.to_a()\n\n vert_perm.each{ |x|\n x.insert(0,start_point)\n x.insert(x.length,start_point)\n weight = path_weight(x)\n \n if weight == nil\n weight = 99999\n end\n\n if weight < shortest_weight\n shortest_weight = path_weight(x)\n shortest_cir = x\n end\n }\n return \"Shortest Circuit = \",shortest_cir.inspect, \"\\nWeight = \", shortest_weight\n\n end",
"def shortest_path_lengths(source)\n seen = {}\n level = 0\n nextlevel = { source => 1 }\n until nextlevel.empty?\n thislevel = nextlevel\n nextlevel = {}\n thislevel.each do |v, _|\n if seen[v].nil?\n seen[v] = level\n nextlevel.update(neighbors_of(v).map { |w| [w, nil] }.to_h)\n end\n end\n level += 1\n end\n seen\n end",
"def dijkstra(source)\n\t\t@distances = {}\n\t\t@predecessor_node = {}\n\t\t@nodes.each do |node|\n\t\t\t@distances[node] = @infinity\n\t\t\t@predecessor_node[node] = -1\n\t\tend\t\n\t\t@distances[source] = 0\n\t\tnodes_compressed = @nodes.compact\n\t\twhile (nodes_compressed.size > 0)\n\t\t\tnode_near = nil;\n\t\t\tnodes_compressed.each do |node_compressed|\n\t\t\t\tif (not node_near) or (@distances[node_compressed] and @distances[node_compressed] < @distances[node_near])\n\t\t\t\t\tnode_near = node_compressed\n\t\t\t\tend\n\t\t\tend\n\t\t\tif (@distances[node_near] == @infinity)\n\t\t\t\tbreak\n\t\t\tend\n\t\t\tnodes_compressed = nodes_compressed - [node_near]\n\t\t\t@graph[node_near].keys.each do |neighbor_node|\n\t\t\t\ttotal_distance = @distances[node_near] + @graph[node_near][neighbor_node]\n\t\t\t\tif (total_distance < @distances[neighbor_node])\n\t\t\t\t\t@distances[neighbor_node] = total_distance\n\t\t\t\t\t@predecessor_node[neighbor_node] = node_near\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def shortest_distance_to(node)\n @distances[node]\n end",
"def get_paths(source, target, iterate_only_if=nil, &result_filter)\n iterate_only_if = result_filter if iterate_only_if.nil?\n queue=[[0, source]]\n result=[]\n while queue.any?\n node = queue.shift\n @graph.each_adjacent(node.last) do |edge, weight|\n nnode = node.dup\n nnode[0]= node[0] + weight\n nnode << edge\n nlevel = nnode.length - 2\n if edge == target\n if result_filter.call(nnode[0], nlevel)\n result << nnode\n end\n end\n\n if iterate_only_if.call(nnode[0], nlevel)\n queue << nnode\n end\n end\n end\n result\n end",
"def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node\n\t\t\tcurrent = unvisited.collect { |node| [@vertices[node],node] }\n\t\t\tcurrent.empty? ? current = @infinity : current = current.min[1]\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend",
"def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end",
"def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node, could use a PQueue instead\n\t\t\tsmallest = @infinity\n\t\t\tcurrent = @infinity\n\t\t\tunvisited.each do |node|\n\t\t\t\tif @vertices[node] < smallest\n\t\t\t\t\tsmallest = @vertices[node]\n\t\t\t\t\t# Step 6\n\t\t\t\t\t# - Set smallest weighted node as current node, continue\n\t\t\t\t\tcurrent = node\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend",
"def find_shortest_path(rolling_node)\n\n @backtrack = []\n @backtrack << @goal_node\n\n # iterate until we arrive at the start node\n while rolling_node[:prev] != nil do\n temp_node = @node_list.find { |hash| hash[:id] == rolling_node[:prev] }\n @backtrack << temp_node[:id]\n rolling_node = temp_node\n end\n\n # create a table with the 1d and the 2d array node values\n @shortest_path = []\n\n @backtrack.each do |p|\n @shortest_path << [p, @table_convert[p]]\n @shortest_path_coords << @table_convert[p][1]\n end\n end",
"def shortest\n '-shortest'\n end",
"def find_path()\n visited = Array.new(8) {Array.new(8)}\n return [] if @destination == @currentPosition\n paths = [[@currentPosition]]\n visited[@currentPosition[0]][@currentPosition[1]] = true\n\n until paths.empty?\n new_paths = []\n paths.each do |path|\n next_positions = possibleMoves(path.last, visited)\n next_positions.each do |move|\n newpath = path.dup << move\n if move == @destination #if we reached our destination stop and return the path\n return newpath\n end\n visited[move[0]][move[1]] = true\n new_paths.push(newpath)\n end\n end\n paths = new_paths\n end\n end",
"def get_path(dest,path)\n if @prev[dest] != -1\n path += get_path(@prev[dest],\"\")\n end\n path += \">#{dest}\"\n end",
"def route visit_path, dst=nil, limits=nil, condition=UNTIL\n paths = trips(visit_path, dst, limits, condition)\n return paths\n end",
"def endpoints\n connectors = {\n :NW => [2, 2],\n :SE => [98, 98],\n :NE => [98, 2],\n :SW => [2, 98],\n :N => [50, 0],\n :S => [50, 100],\n :E => [100, 50],\n :W => [0, 50]\n }\n shortest_path = 1000000\n generated_endpoints = []\n connectors.each do |from_key, from_connector|\n ep_from = [from.x + from_connector[0], from.y + from_connector[1]]\n connectors.each do |to_key, to_connector|\n ep_to = [to.x + to_connector[0], to.y + to_connector[1]]\n path = Math.sqrt(((ep_from[0] - ep_to[0]).abs ** 2) + ((ep_from[1] - ep_to[1]).abs ** 2)).to_i\n if path < shortest_path + 25\n shortest_path = path\n generated_endpoints = [ep_from, ep_to]\n end\n end\n end\n return generated_endpoints\n end",
"def trips visit_path, dst, limits, condition, paths=Array.new, dst_paths=Array.new\n node = visit_path.nodes.last\n neighbors = @nodes[node]\n if neighbors.empty?\n visit_path.fanal = true\n paths << visit_path\n return paths\n end\n\n neighbors = neighbors.sort_by {|node| node.length}\n neighbors.each do |neighbor|\n path = Path.new visit_path.nodes.clone\n path.cost = visit_path.cost + neighbor.length\n path.final = path.nodes.include? neighbor.dst\n path.final = eval final_eval( condition, limits ) unless limits.nil?\n path.nodes << neighbor.dst\n if (neighbor.dst == dst && !path.final)\n d_path = Path.new path.nodes.clone\n d_path.cost = path.cost\n d_path.final = true\n dst_paths << d_path\n end\n\n paths << path\n end\n\n while(paths.length > 0 && paths.map {|path| path.final}.include?(false))\n path = paths.shift\n unless path.final\n trips( path, dst, limits, condition, paths, dst_paths)\n else\n dst_paths << path\n end\n end\n\n paths = (dst_paths + paths).select { |path| path.nodes.last == dst && path.final == true }\n return paths\n end",
"def all_paths(source, target, graph)\n\n def search(source, target, graph, all_paths)\n return all_paths[source] if all_paths.key?(source)\n return [[target]] if source == target\n source_paths = []\n graph.each_adjacent(source) { |v| source_paths += search(v, target, graph, all_paths) }\n all_paths[source] = source_paths.map { |path| [source] + path }\n end\n\n search(source, target, graph, {})\n end",
"def solve(from_word, to_word)\n return @word_graph.shortest_path(from_word, to_word)\n end",
"def astar_search(origin:, target:)\n costs = {}\n seen = {}\n path = {}\n initial_estimate = heuristic(current: origin, target: target)\n costs[origin] = 0\n\n pq = PriorityQueue.new\n\n pq.push(origin, initial_estimate)\n\n loop do\n current = pq.delete_min_return_key\n\n # made it\n return path if current == target\n\n seen[current] = true\n\n # get moves and estimate costs\n moves(current).each do |move|\n move_pair = move[0]\n cost = move[1]\n\n next if seen[move_pair]\n\n new_cost = costs[current] + cost\n\n # skip if more costly\n next if pq.has_key?(move_pair) && !costs[move_pair].nil? && new_cost >= costs[move_pair]\n\n path[move_pair] = current\n costs[move_pair] = new_cost\n estimate = new_cost + heuristic(current: move_pair, target: target)\n\n if pq.has_key?(move_pair)\n pq.change_priority(move_pair, estimate)\n else\n pq.push(move_pair, estimate)\n end\n end\n end\nend",
"def find_path(start, finish, *avoid_sectors)\n shortest_path(start, finish, avoid_sectors.flatten)\n end",
"def find_path(dest)\n if @previous[dest] != -1\n find_path @previous[dest]\n end\n @path << dest\n end",
"def djikstra(graph, start_node, end_node)\n path_weights = {}\n previous_shortest_path = {}\n remaining = graph.nodes\n\n # Begin by setting weight of start node to 0, others to infinity\n graph.nodes.each do |node|\n if node == start_node\n path_weights[node] = 0\n else\n path_weights[node] = Float::INFINITY\n end\n end\n\n #TODO: can stop when we reach destination\n\n # pluck the node in remaining with lowest path weight. this will always be the start node to begin\n while remaining.length > 0\n min_index = nil\n lowest_score = Float::INFINITY\n remaining.each_with_index do |remaining_node, i|\n if path_weights[remaining_node] < lowest_score\n min_index = i\n lowest_score = path_weights[remaining_node]\n end\n end\n node = remaining.delete_at(min_index)\n\n # Update path_weight/previous of neighboring nodes based on shortest path\n # Also notice how we consider there may be no connections for the min_node.\n (node.connections || []).each do |neighbor, weight|\n if path_weights[neighbor] > (path_weights[node] + weight)\n path_weights[neighbor] = path_weights[node] + weight\n previous_shortest_path[neighbor] = node\n end\n end\n end\n\n node = end_node\n shortest_path = []\n\n while node\n shortest_path.unshift(node)\n node = previous_shortest_path[node]\n end\n\n puts path_weights[end_node]\n shortest_path.map{|node| node.value}\nend",
"def path_to(v)\n return nil unless @visited.include?(v)\n\n path = []\n cur_node = v\n while (cur_node != source_node)\n path << cur_node\n cur_node = @edge_to[cur_node]\n end\n path << source_node\n path.reverse\n end",
"def has_path_bfs?(source_id, dest_id)\n visited = Set.new\n source = get_node(source_id)\n dest = get_node(dest_id)\n\n to_visit = [source].concat(source.adjacent)\n\n to_visit.each do |node|\n unless visited.include?(node.id)\n return true if node.id == dest.id\n visited << node.id\n to_visit.concat(node.adjacent)\n end\n end\n\n return false\n end",
"def path(start, goals, mode=:move_to, ignore={})\n start = start.map(&:to_i)\n goals = goals.flatten.size == 3 ? [goals.flatten] : goals\n\n if goals.reject { |goal| (start[0] - goal[0]).abs + (start[1] - goal[1]).abs + (start[2] - goal[2]).abs > MAX_PATH_SIZE }.empty?\n puts \"target too far away\"\n return nil\n elsif mode == :move_to && goals.select { |g| allowed?(*g) }.empty?\n puts \"can't go there...\"\n return nil\n # elsif mode == :next_to && goals.map { |g| available(*g, :next_to).any? { |l| allowed?(*l) } }.empty?\n # puts \"nothing to move next to anymore...\"\n # return nil\n end\n visited = {}\n next_to = {}\n examined = 0\n\n heap = Heap.new { |a, b| a.cost <=> b.cost }\n heap.add Path.new(start, goals, [])\n\n while !heap.empty?\n point = heap.next\n\n if point.path.size > MAX_PATH_SIZE\n puts \"examined #{examined} paths before giving up\"\n return nil\n end\n\n next if visited[point.point]\n visited[point.point] = point\n\n examined += 1\n\n case mode\n when :move_to\n if goals.include?(point.point)\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n when :away_from\n above = point.point.dup\n above[1] += 1\n if !goals.include?(point.point) && !goals.include?(above)\n final_path = point.path + [point.point]\n return final_path\n end\n\n when :next_to\n next_to[point.point] ||= available(*point.point, :build)\n available_for_building = next_to[point.point]\n if available_for_building.any? { |a| goals.include? a }\n final_path = point.path + [point.point]\n final_path.shift # don't need the start point, we're already there\n # puts \"examined #{examined} paths\"\n return final_path\n end\n\n else\n raise \"unknown pathfinding mode: #{mode.inspect}\"\n end\n\n next_available = available(*point.point, :move, ignore).each do |test|\n next if visited[test]\n heap.add Path.new(test, goals, point.path + [point.point])\n end\n end\n nil\n end",
"def path(source, target)\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\n end",
"def all_paths_source_target(graph)\n current_path = []\n results = []\n\n dfs(graph, results, 0, current_path)\n return results\nend",
"def get_path( source_node, *path )\n h = source_node.to_hash\n path.inject(h) { |obj, item| obj[item.to_s] || break }\nend",
"def find_min_path(i, j)\n return 1 if i == 0 || j == 0\n return find_min_path(i-1, j) + find_min_path(i, j-1)\nend",
"def get_spaces_to_pass\n return nil unless @start_space\n return nil unless @end_space\n\n dijkstra = Dijkstra.new(SpaceConnection.all)\n path = dijkstra.shortest_path(@start_space.id, @end_space.id)\n path\n end",
"def dijkstra\n # Intialise the algorithom if first run\n init_dijkstra if empty_path?\n\n # Stop the execution if all the nides have been reached\n return path if completed_path?\n\n # Make sure that all the weights are updated\n current_node[:node].adjacent_nodes.values.each do |node|\n @pool << node.merge(\n from: current_node[:node],\n weight: node[:weight] + current_node[:weight]\n )\n end\n\n # Sort the pool of nodes/edges by weight so to be able to grab the smallest\n # weight.\n pool.sort_by! { |edge| edge[:weight] }\n\n # Pick the next untouched node by shifting the nodes in the pool starting\n # from the smallest to the greatest.\n next_node = nil\n loop do\n next_node = pool.shift\n break unless values_in_path.include?(next_node[:node].value)\n end\n\n # Push the next step (from -> to) in the path\n @path << \"#{next_node[:from].value} ==> #{next_node[:node].value}\"\n\n # Track the node as seen\n @values_in_path += [next_node[:node].value, current_node[:node].value]\n\n # Update the current node\n @current_node = next_node\n\n # Keep the execution going\n dijkstra\n end",
"def test_shortest_path\n expected = Amazeingly::Path.new([\n { step_number: 1, room: @rooms_collection.find(6), collected_objects: [] },\n { step_number: 2, room: @rooms_collection.find(5), collected_objects: [] },\n { step_number: 3, room: @rooms_collection.find(7), collected_objects: [] },\n { step_number: 4, room: @rooms_collection.find(4), collected_objects: [] }\n ])\n\n assert_equal expected, @path_finder.shortest_path(from_room: @rooms_collection.find(6), to_room: @rooms_collection.find(4))\n end",
"def grue_path(grue_room, player_room, edges)\n shortest_path = []\n\n edges_to_check = edges.select do |arr|\n arr.first == grue_room\n end\n\n unchecked_edges = edges - edges_to_check\n\n edges_to_check.each do |e|\n path = [e]\n if e[1] != player_room\n\n next_node = (e - [grue_room]).first\n\n remaining_path = grue_path(next_node, player_room, unchecked_edges)\n\n if remaining_path.empty?\n path.clear\n else\n path += remaining_path\n end\n else\n path\n end\n\n if path_distance(path) < path_distance(shortest_path)\n shortest_path = path\n end\n end\n\n shortest_path\n end",
"def shortest_path_to_user(start_coord)\n queue = Queue.new\n queue << [start_coord]\n seen = Set.new([start_coord])\n while queue\n begin\n path = queue.pop(non_block = true)\n rescue ThreadError\n return nil\n end\n x, y = path[-1]\n if @map[y][x] == @USER\n return path\n end\n for x2, y2 in [[x + 1, y], [x - 1, y], [x, y + 1], [x, y - 1]]\n if (0 <= x2 && x2 < @map[0].length) && (0 <= y2 && y2 < @map.length) && (@map[y2][x2] != @WALL && @map[y2][x2] != @PERMANENT_WALL) && !seen.include?([x2, y2])\n queue << (path + [[x2, y2]])\n seen.add([x2, y2])\n end\n end\n end\n end",
"def all_paths_source_target(graph, results=[], current_node=0, current_path=[])\n if current_node == graph.length - 1\n return results << (current_path + [current_node])\n end\n\n graph[current_node].each do |node|\n all_paths_source_target(graph, results, node, (current_path + [current_node]))\n end\n\n return results\nend",
"def path(source, target, meta)\n # retrieve the path to the target node, using the meta hash\n # that was constructed at each iteration of the `each` iteration\n predecessor = target\n result_path = []\n\n # follow the leads from the back\n until predecessor == source\n result_path << predecessor.number\n predecessor = meta[predecessor]\n end\n\n # add the source, since now `predecessor == source` is true\n result_path << source.number\n result_path.reverse.join(\", \")\nend",
"def build_path(start, finish)\n path = [finish]\n loop do\n vertex = path.last\n d = graph[*vertex]\n neighbours = get_neighbours(*vertex)\n next_vertex = neighbours.select{|n_vert| graph[*n_vert] == d - 1}.first\n path << next_vertex if next_vertex\n break if vertex == start\n end\n path\n end",
"def get_redundant_resistors(nw)\n#\n# Get a unique list of path names.\n# Get the list of paths in the shortest route.\n# Get the difference - this is the redundant set of paths (bi-directional).\n# Remove the duplicates to get the required result (see below)\n#\n all_paths = (nw.path_list.collect {|p| [p.from, p.to]})\n min_paths = nw.min_cost_routes.first.path_list.collect {|p| [p.from, p.to]}\n #\n # The difference (all_paths - min_paths) is the true list of redundant paths\n # taking into account that the network is implemented as bidirectional, so\n # that each path exists twice, once in each direction, from one node to the\n # other.\n # The reverse paths are therefore removed to arrive at the required output\n # list of redundant resistors.\n #\n redundant_resistors = (all_paths.collect {|p| p.sort.join('_')}).uniq - (min_paths.collect {|p| p.join('_')})\n redundant_resistors.collect {|r| nw.path(r).to_a}\nend",
"def dijkstra(g, source)\n\tdistances, parents = initialize_table(g, source)\n\tqueue = PriorityQueue.new(distances.slice(source))\n\n\t# Queue will have all nodes O(V)\n\twhile queue.size > 0 \n\t\t# potentially have as many nodes as there are in the graph\n\t\t# pop the min O(log V)\n\t\tparent = queue.pop_min.keys.first # { book: 0 }.keys.first\n\t\t# do we need to worry about cycles?\n\t\t# Will go through every single O(E)\n\t\tg[parent].each do |name, distance|\n\t\t\t# Do we care about nodes being seen already?\n\t\t\t# does this ever happend if there are not cycles?\n\t\t\tnew_distance = distances[parent] + distance\n\n\t\t\tif new_distance < distances[name]\n\t\t\t\tdistances[name] = new_distance\n\t\t\t\tparents[name] = parent\n\t\t\tend\n\n\t\t\t# O(logV)\n\t\t\tqueue.add(distances.slice(name)) \n\t\tend\n\tend\n\n\t[distances, parents]\n\t# O(V * logV + E * logV) => logV*(V + E)\nend",
"def shortest_path_with_topsort(graph, source)\n n = graph.vertices.count\n # an iterator that helps us go through vertices\n # in topo order\n #O(V+E)\n topsort_iter = RGL::TopsortIterator.new(graph)\n \n #O(V)\n # init vertex states for each vertex\n vertex_states = Hash.new{ |hash,key| hash[key] = VertexState.new(key)}\n graph.each_vertex do |vertex|\n vertex_states[vertex]\n end\n \n # handle the source node\n vertex_states[source].shortest_distance = 0\n vertex_states[source].visited = true\n \n #O(V + E)\n topsort_iter.each do |u|\n vertex_states[u].visited = true\n graph.each_adjacent(u) do |v|\n relax(graph,u,v,vertex_states)\n end\n end\n vertex_states\n end",
"def distance *path\n cost, edge_exists = 0, false\n\n # Adds the cost of the next move\n neighbors = @nodes[path.shift]\n neighbors.each do |node|\n if node.dst == path.first\n edge_exists = true\n cost += node.length\n break\n end\n end\n\n # Iterates in depth when neighbor exists\n return -1 unless edge_exists\n if path.length > 1\n sub_cost = distance *path\n return -1 if sub_cost == -1\n cost += sub_cost\n end\n cost\n end"
] |
[
"0.7356156",
"0.72956985",
"0.7255069",
"0.7244874",
"0.7243841",
"0.7241848",
"0.7071049",
"0.69669163",
"0.6962118",
"0.6934361",
"0.6930844",
"0.6899296",
"0.68192947",
"0.68038255",
"0.6680243",
"0.6653647",
"0.65617514",
"0.65464807",
"0.6481064",
"0.64776665",
"0.6466067",
"0.6309077",
"0.62801397",
"0.62031907",
"0.61690664",
"0.6156425",
"0.6148909",
"0.6132869",
"0.6131279",
"0.6070433",
"0.6066324",
"0.6005929",
"0.59938574",
"0.5972654",
"0.5956601",
"0.59272075",
"0.5926745",
"0.59120697",
"0.588969",
"0.58794355",
"0.58713025",
"0.5839717",
"0.5834292",
"0.5818509",
"0.58161926",
"0.58043176",
"0.5766888",
"0.57603437",
"0.5745795",
"0.5715616",
"0.5678863",
"0.56763273",
"0.56551397",
"0.5644423",
"0.56017685",
"0.55640703",
"0.5554428",
"0.5541752",
"0.55207264",
"0.5515971",
"0.54657966",
"0.54598665",
"0.54534954",
"0.54425913",
"0.5390749",
"0.5358734",
"0.5357857",
"0.53472465",
"0.5345864",
"0.5332748",
"0.5297501",
"0.52766305",
"0.5271662",
"0.5265913",
"0.5259808",
"0.5257533",
"0.524843",
"0.5245414",
"0.5213972",
"0.52092886",
"0.5205995",
"0.5200054",
"0.519639",
"0.51891017",
"0.518821",
"0.5177818",
"0.51761436",
"0.5170173",
"0.514876",
"0.51435083",
"0.51413894",
"0.5135234",
"0.5120367",
"0.5115491",
"0.5085648",
"0.5077869",
"0.507442",
"0.50674736",
"0.50650686",
"0.5056704"
] |
0.804517
|
0
|
The introspection system is prepared with a bunch of LateBoundTypes. Replace those with the objects that they refer to, since LateBoundTypes aren't handled at runtime.
|
def resolve_late_bindings
@types.each do |name, t|
if t.kind.fields?
t.fields.each do |_name, field_defn|
field_defn.type = resolve_late_binding(field_defn.type)
end
end
end
@entry_point_fields.each do |name, f|
f.type = resolve_late_binding(f.type)
end
@dynamic_fields.each do |name, f|
f.type = resolve_late_binding(f.type)
end
nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def replace_late_bound_types_with_built_in(types)\n GraphQL::Schema::BUILT_IN_TYPES.each do |scalar_name, built_in_scalar|\n existing_type = types[scalar_name]\n if existing_type.is_a?(GraphQL::Schema::LateBoundType)\n types[scalar_name] = built_in_scalar\n end\n end\n end",
"def break_types!\n # The created types by structure.\n types = {}\n # Break the local types.\n self.each_type {|type| type.break_types!(types)}\n # Break the types in the inners.\n # self.each_inner {|inner| inner.type.break_types!(types) }\n self.each_inner do |inner|\n inner.set_type!(inner.type.break_types!(types))\n end\n # Break the types in the connections.\n self.each_connection do |connection| \n connection.left.break_types!(types)\n connection.right.break_types!(types)\n end\n # Break the types in the behaviors.\n self.each_behavior do |behavior|\n behavior.each_event do |event|\n event.ref.break_types!(types) \n end\n behavior.block.break_types!(types)\n end\n\n # Add the resulting types.\n types.each_value {|type| self.add_type(type) }\n end",
"def break_types!\n self.scope.break_types!\n end",
"def load_additional_types(oids = nil)\n if @config[:use_follower_reads_for_type_introspection]\n initializer = OID::TypeMapInitializer.new(type_map)\n\n query = <<~SQL\n SELECT t.oid, t.typname, t.typelem, t.typdelim, t.typinput, r.rngsubtype, t.typtype, t.typbasetype\n FROM pg_type as t\n LEFT JOIN pg_range as r ON oid = rngtypid AS OF SYSTEM TIME '-10s'\n SQL\n\n if oids\n query += \"WHERE t.oid IN (%s)\" % oids.join(\", \")\n else\n query += initializer.query_conditions_for_initial_load\n end\n\n execute_and_clear(query, \"SCHEMA\", []) do |records|\n initializer.run(records)\n end\n else\n super\n end\n rescue ActiveRecord::StatementInvalid => e\n raise e unless e.cause.is_a? PG::InvalidCatalogName\n # use original if database is younger than 10s\n super\n end",
"def fix_basic_object_inheritance\n basic = classes_hash['BasicObject']\n return unless basic\n basic.superclass = nil\n end",
"def registered_types\n end",
"def type_name_resolver; end",
"def visit_reference(binding_type)\n visit(binding_type.resolved_type)\n end",
"def replace_names!(former,nname)\n # Stop here if the name is redeclared.\n return if self.each_type.find {|type| type.name == former }\n return if self.each_systemT.find {|systemT| systemT.name == former }\n return if self.each_inner.find {|inner| inner.name == former }\n # Recurse on the internals.\n replace_names_subs!(former,nname)\n end",
"def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend",
"def fixup(name)\n @@typedef_table['table_data'].each do |e|\n if e[1].has_key?('.forward_base_name') && e[1]['.forward_base_name'].eql?(name)\n table = (e[1]['.type'].eql?'union') ? @@uniontag_table : @@structtag_table\n table['table_data'].each do |g|\n if g[0].eql?(name)\n e[1]['.members'] = Marshal.load(Marshal.dump(g[1]['.members']))\n e[1].delete('.forward_base_name')\n end\n end\n end\n end\nend",
"def resolve\n @super_class = @snapshot.id2class @super_id\n # all classes but java.lang.Object\n @super_class.add_subclass self if @super_class \n @snapshot.java_lang_class.add_instance self\n end",
"def fix_up_references\n if self.group_type.nil? and !self.group_type_id.nil?\n self.group_type = GroupType.find(self.group_type_id)\n end\n if self.region.nil? and !self.region_id.nil?\n self.region = Region.find(self.region_id)\n end\n end",
"def cast_types; end",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t\t[]\n\tend",
"def update_types\n\t[]\nend",
"def update_types\n\t[]\nend",
"def resolve_opaques\n # First do typedefs. Search for the typedefs that are named like our\n # type, if we find one, alias it\n opaques.dup.each do |opaque_name|\n if node = find_node_by_name(opaque_name, node_type: 'Typedef')\n type_node = node_from_id(node[\"type\"].to_s)\n full_name = resolve_node_typelib_name(type_node)\n normalized_name = normalize_type_name(full_name)\n\n opaques << full_name << normalized_name\n opaque_t = registry.get(opaque_name)\n set_source_file(opaque_t, node)\n opaque_t.metadata.set('opaque_is_typedef', '1')\n registry.alias full_name, opaque_name\n registry.alias normalized_name, opaque_name\n end\n end\n end",
"def types(types); end",
"def type_names\n { :Word => {:char_length => :Integer} ,\n :List => {:indexed_length => :Integer} ,\n :Message => { :next_message => :Message, :receiver => :Object, :frame => :Frame ,\n :return_address => :Integer, :return_value => :Integer,\n :caller => :Message , :name => :Word , :indexed_length => :Integer },\n :MetaClass => {:object => :Object},\n :Integer => {},\n :Object => {},\n :Kernel => {}, #fix, kernel is a class, but should be a module\n :BinaryCode => {:char_length => :Integer} ,\n :Space => {:classes => :Dictionary , :types => :Dictionary , :first_message => :Message},\n :Frame => {:next_frame => :Frame, :indexed_length => :Integer},\n :Type => {:object_class => :Class, :instance_methods => :List , :indexed_length => :Integer} ,\n :Class => {:instance_methods => :List, :instance_type => :Type, :name => :Word,\n :super_class_name => :Word , :instance_names => :List },\n :Dictionary => {:keys => :List , :values => :List } ,\n :TypedMethod => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object,\n :arguments => :Type , :for_type => :Type, :locals => :Type } ,\n :Value => {},\n }\n end",
"def proxy_types; end",
"def break_types!(types)\n self.each_node do |node|\n # Need to break only in the case of a cast.\n if node.is_a?(Cast) then\n # node.type.break_types!(types)\n node.set_type!(node.type.break_types!(types))\n end\n end\n end",
"def safe_reify\n reify\n rescue ActiveRecord::SubclassNotFound\n raise unless monkey_patch_safe_reify?\n\n # https://github.com/paper-trail-gem/paper_trail/blob/1fe26c9e445b0bcb2f7c20a5791ec01003632517/lib/paper_trail/reifier.rb#L132\n def self.object_deserialized # rubocop:disable Lint/NestedMethodDefinition\n super.dup.tap do |hsh|\n hsh['type'] = item_type\n end\n end\n\n retry\n end",
"def boot_types\n @types = {}\n type_names.each do |name , ivars |\n @types[name] = type_for( name , ivars)\n end\n type_type = @types[:Type]\n @types.each do |name , type |\n type.set_type(type_type)\n end\n end",
"def fix_person_type\n self.person_type = self.person.class.name\n end",
"def typify(api_map); end",
"def pre_process_exposed_object(resource, type, singular)\n end",
"def parse_types_1(v)\n #if $catalog[:builtins].keys.size== 0\n # STDERR.puts 'parse_directives() must be called before parse_types_1(); exiting.'\n # exit 1\n #end\n\n builtins = Dir[\"#{$graphql_ruby_dir}/lib/graphql/types/*.rb\"]\n builtins.each do |b|\n bc = File.read b\n bc =~ /class\\s+(\\w+)\\s+</\n next unless $1\n $log.debug \"Registering type '#{$1}' as built-in type supported by graphql-ruby.\"\n $catalog[:type_names][$1] = \"::GraphQL::Types::#{$1}\"\n $catalog[:builtins][$1] = true\n next\n end\n\n # Do just some basic things here, which need to be done in 1st pass.\n # The types are parsed \"for real\" later, in pass 2. This 1st pass is here\n # to solve a chicken-or-egg problem.\n v.each do |t|\n $schema_type_map[t['name']] = t\n next if check_skip(t)\n\n name = t['name']\n\n # Do not overwrite (just skip) built-in types\n next if $catalog[:type_names][name]\n\n if $catalog[:type_names][name]\n $log.fatal \"Duplicate type name #{name}. This represents an unhandled case in the script and should be looked into manually; exiting.\"\n exit 1\n end\n\n new_name= old_to_new_name(t)\n $catalog[:type_names][name] = new_name\n\n $catalog[:base_type][new_name] ||=\n if new_name=~ /^Payloads::/\n 'Payloads::BasePayload'\n else\n case t['kind']\n when 'ENUM'\n 'Types::BaseEnum'\n when 'SCALAR'\n 'Types::BaseScalar'\n when 'INPUT_OBJECT'\n 'Inputs::BaseInput'\n when 'INTERFACE'\n 'Interfaces::BaseInterface'\n when 'UNION'\n 'Types::BaseUnion'\n else\n 'Types::BaseObject'\n end\n end\n\n # Even though contents will be filled in later, register files for output to disk here.\n of= new_name.dup\n of.gsub! '::', '/'\n # This is the schema-related part (should be non-modifiable by user)\n $catalog[:schema_outputs][new_name]= of.underscore\n\n if new_name=~ /^(?:Types|Interfaces)::/\n # This is the implementation-related part (user should add implementation code)\n $catalog[:outputs][new_name]= of.underscore\n\n # Implementation test (user should also review/modify test)\n $catalog[:spec_outputs][new_name]= of.underscore\n end\n end\nend",
"def break_types!(types)\n self.each_node do |node|\n # Need to break only in the case of a cast.\n if node.is_a?(Cast) then\n node.type.break_types!(types)\n end\n end\n end",
"def highlight_and_link(source, remove_top_namespace = false)\n\n # debug\n # is_page_of_interest = @context.registers[:page]['fancy_name'] =='reshape') \n \n if remove_top_namespace then \n page_namespace = @context.registers[:page]['namespace'] + \"::\"\n ns = page_namespace.split(\"::\")[0] + \"::\"\n end\n\n highlighted_types = @context.registers[:site].data['highlighted_types'] \n \n # for all types in highlighted_types, \n # - find them \n # - replace them with _X0001X_, _X0002X, which the highlighter will not cut\n # - highlight by calling Rouge\n # - replace back the _X0001X_, _X0002X with the name and adequate url\n # if remove_top_namespace is true, we rerun this a second type with the top namespace removed from the type\n # It is useful for signature when the namespace is not always explicit and would be verbose (e.g. nda:: everywhere in all nda:: functions ?)\n #\n repl_to_original = {}\n c = 1\n highlighted_types.each do |type, url|\n\n type_to_replace = type\n # we are going to run this twice : once with the full type, \n # once with the type_to_replace truncated from top ns if remove_top_namespace is true\n # lambda are closure, it will see the change in type_to_replace\n worker = lambda { \n # the type_to_replace, not followed by a word (e.g. array does not match array_adapter, and not preceded by a :)\n # e.g. array will match array, not nda::array (which could be matched in another part of the loop...), and NOT std::array !\n re = Regexp.new '(?<!:)' + type_to_replace + '(?!\\w)' \n source = source.gsub(re){ |w|\n repl = \"_X000\" + c.to_s + \"X_\"\n repl_to_original[repl] = type # Must be the full type\n c = c + 1\n repl\n }\n }\n worker.call\n if remove_top_namespace then\n type_to_replace = type.gsub(ns, '')\n worker.call\n end\n end\n\n formatter = Rouge::Formatters::HTML.new\n lexer = Rouge::Lexers::Cpp.new\n r = formatter.format(lexer.lex(source))\n r = '<figure class=\"highlight\"><pre><code class=\"language-c--\" data-lang=\"c++\">' + r.strip + '</code></pre></figure>'\n\n repl_to_original.each do |repl, type|\n url = highlighted_types[type] \n\n if remove_top_namespace then\n type = type.gsub(ns, '')\n end\n re = Regexp.new '(' + repl + ')(?!\\w)'\n r = r.gsub(re){ |w| '<a href=\"%s\">%s</a>' %[url, type]}\n end\n\n return r\n end",
"def fix_unknown_service\n new_services = Types::Base.new\n services.each do |service_name, service|\n unless data_types[service_name]\n service.operations.each do |operation_name, operation|\n if data_types[operation.request]\n new_services[operation.request] ||= Types::Base.new( :operations => {} )\n new_services[operation.request].operations[operation_name] = operation\n elsif data_types[operation.response]\n new_services[operation.response] ||= Types::Base.new( :operations => {} )\n new_services[operation.response].operations[operation_name] = operation\n end\n end\n end\n end\n services.merge!(new_services)\n end",
"def transform_simple_types(types)\n @types ||= {}\n types.each do |type|\n @types[type.name.to_sym] = type\n end\n end",
"def boot_classes\n classes = space.classes\n type_names.each do |name , vars|\n cl = object_with_type Parfait::Class\n cl.instance_type = @types[name]\n @types[name].object_class = cl\n @types[name].instance_methods = object_with_type Parfait::List\n cl.instance_methods = object_with_type Parfait::List\n #puts \"instance_methods is #{cl.instance_methods.class}\"\n cl.name = name\n classes[name] = cl\n end\n # superclasses other than default object\n supers = { :Object => :Kernel , :Kernel => :Value,\n :Integer => :Value , :BinaryCode => :Word }\n type_names.each do |classname , ivar|\n next if classname == :Value # has no superclass\n clazz = classes[classname]\n super_name = supers[classname] || :Object\n clazz.set_super_class_name super_name\n end\n end",
"def add_subtypes_to_definitions\n # to augment all types definitions\n lolsoap_parser.types.each_value do |content|\n add_subtypes(content[:elements])\n end\n # we have to augment operations because some Requests are abstract, for instance:\n # ReportRequest which can be AccountPerformanceReportRequest etc...\n lolsoap_parser.operations.each_value do |content|\n content[:input][:body].each do |full_name|\n add_subtypes(lolsoap_parser.elements[full_name][:type][:elements])\n end\n end\n @grouped_subtypes = nil # we can reset this as its not needed anymore\n end",
"def initTypes\n raise NotImplementedError\n # local = new ArrayList<>();\n # localContext = new ArrayList<>();\n # dynamic = new ArrayList<>();\n #\n # for(int i=0; i<v.length; ++i) {\n # Extractor e = v[i];\n # if(e.isLocal() && e.isDynamic())\n # throw new RuntimeException(\"Extractors can't both be local and dynamic!\");\n # if(e.isLocal()) {\n # local.add(Pair.makePair(i,e));\n # //localContext.put(i,e);\n # } else if(e.isDynamic()) {\n # dynamic.add(Pair.makePair(i,e));\n # } else {\n # localContext.add(Pair.makePair(i,e));\n # }\n # }\n # if(DEBUG) {\n # log.info(\"Extractors: \"+this);\n # System.err.printf(\"Local: %d extractors\\n\",local.size());\n # System.err.printf(\"Local context: %d extractors\\n\",localContext.size());\n # System.err.printf(\"Dynamic: %d extractors\\n\",dynamic.size());\n # }\n end",
"def resolve_type(object)\n @possible_types.find {|t| t.name == object.class.name }\n end",
"def defined_types\n @title = 'Defined Type Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_defined_type)\n erb(:objects)\nend",
"def torque_load_additional_types(oids = nil)\n filter = \"AND a.typelem::integer IN (%s)\" % oids.join(\", \") if oids\n\n query = <<-SQL\n SELECT a.typelem AS oid, t.typname, t.typelem,\n t.typdelim, t.typbasetype, t.typtype,\n t.typarray\n FROM pg_type t\n INNER JOIN pg_type a ON (a.oid = t.typarray)\n LEFT JOIN pg_catalog.pg_namespace n ON n.oid = t.typnamespace\n WHERE n.nspname NOT IN ('pg_catalog', 'information_schema')\n AND t.typtype IN ( 'e' )\n #{filter}\n AND NOT EXISTS(\n SELECT 1 FROM pg_catalog.pg_type el\n WHERE el.oid = t.typelem AND el.typarray = t.oid\n )\n AND (t.typrelid = 0 OR (\n SELECT c.relkind = 'c' FROM pg_catalog.pg_class c\n WHERE c.oid = t.typrelid\n ))\n SQL\n\n execute_and_clear(query, 'SCHEMA', []) do |records|\n records.each do |row|\n case row['typtype']\n when 'e' then OID::Enum.create(row, type_map)\n end\n end\n end\n end",
"def type_definitions_to_references(json_obj)\n case json_obj\n when Hash\n type = json_obj['type']\n if PRIMITIVE_TYPES.include?(type)\n type\n elsif NAMED_TYPES.include?(type)\n [json_obj['namespace'], json_obj['name']].compact.join('.')\n elsif type == 'array' || type == 'map'\n {'type' => type, 'items' => type_definitions_to_references(json_obj['items'])}\n else\n raise Avro::SchemaParseError.new(\"Unknown type: #{json_obj.inspect}\")\n end\n when Array\n json_obj.map(&method(:type_definitions_to_references))\n when String\n json_obj\n else\n raise Avro::SchemaParseError.new(\"Unknown schema: #{json_obj.inspect}\")\n end\n end",
"def register_references_to(live_objects, options = Hash.new)\n orig_options = options # to exclude it from the graph\n options = Kernel.validate_options options,\n :roots => [Object], :excluded_classes => [], :excluded_objects => [],\n :include_class_relation => false\n roots_class, roots = options[:roots].partition { |obj| obj.kind_of?(Class) }\n excluded_classes = options[:excluded_classes]\n excluded_objects = options[:excluded_objects]\n include_class_relation = options[:include_class_relation]\n\n # Create a single ObjectRef per (interesting) live object, so that we\n # can use a BGL::Graph to represent the reference graph. This will be\n # what we are going to access later on. Use object IDs since we really\n # want to refer to objects and not use eql? comparisons\n desired_seeds = roots.map(&:object_id)\n excludes = [live_objects, self, graph, references, orig_options, options, roots, roots_class].to_value_set\n live_objects_total = live_objects.size\n live_objects.delete_if do |obj|\n if obj.kind_of?(DRbObject)\n true\n elsif excludes.include?(obj) || obj.respond_to?(:__ruby_object_graph_internal__)\n true\n else\n references[obj.object_id] ||= ObjectRef.new(obj)\n if roots_class.any? { |k| obj.kind_of?(k) }\n if !excluded_classes.any? { |k| obj.kind_of?(k) }\n if !excluded_objects.include?(obj)\n desired_seeds << obj.object_id\n end\n end\n end\n false\n end\n end\n\n desired_seeds.each do |obj_id|\n graph.insert(references[obj_id])\n end\n ignored_enumeration = Hash.new\n\n names = Hash[\n :array => \"Array\",\n :value_set => \"ValueSet[]\",\n :vertex => \"Vertex[]\",\n :edge => \"Edge[]\",\n :hash_key => \"Hash[key]\",\n :hash_value => \"Hash[value]\",\n :proc => \"Proc\",\n :ancestor => \"Ancestor\"]\n puts \"RubyObjectGraph: #{live_objects.size} objects found, #{desired_seeds.size} seeds and #{live_objects_total} total live objects\"\n loop do\n old_graph_size = graph.size\n live_objects.each do |obj|\n obj_ref = references[obj.object_id]\n\n if include_class_relation\n test_and_add_reference(obj_ref, obj.class, \"class\")\n end\n\n for var_name in obj.instance_variables\n var = obj.instance_variable_get(var_name)\n test_and_add_reference(obj_ref, var, var_name.to_s)\n end\n\n case obj\n when Array\n for var in obj\n test_and_add_reference(obj_ref, var, names[:array])\n end\n when ValueSet\n for var in obj\n test_and_add_reference(obj_ref, var, names[:value_set])\n end\n when BGL::Graph\n obj.each_vertex do\n test_and_add_reference(obj_ref, var, names[:vertex])\n end\n obj.each_edge do |_, _, info|\n test_and_add_reference(obj_ref, info, names[:edge])\n end\n when Hash\n for var in obj\n test_and_add_reference(obj_ref, var[0], names[:hash_key])\n test_and_add_reference(obj_ref, var[1], names[:hash_value])\n end\n when Proc\n if obj.respond_to?(:references)\n for var in obj.references\n begin\n test_and_add_reference(obj_ref, ObjectSpace._id2ref(var), names[:proc])\n rescue RangeError\n end\n end\n end\n when Class\n for ref in obj.ancestors\n test_and_add_reference(obj_ref, ref, names[:ancestor])\n end\n else\n if obj.respond_to?(:each)\n if obj.kind_of?(Module) || obj.kind_of?(Class)\n if !ignored_enumeration[obj]\n ignored_enumeration[obj] = true\n puts \"ignoring enumerator class/module #{obj}\"\n end\n else\n if !ignored_enumeration[obj.class]\n ignored_enumeration[obj.class] = true\n puts \"ignoring enumerator object of class #{obj.class}\"\n end\n end\n end\n end\n end\n if old_graph_size == graph.size\n break\n end\n end\n live_objects.clear # to avoid making it a central node in future calls\n return graph\n end",
"def build_reference_types(inventory_collection)\n class_name = inventory_collection.model_class.to_s\n\n reference_types[class_name] ||= []\n reference_types[class_name] << \"#{inventory_collection.name.to_s.singularize.camelize}Reference\"\n inventory_collection.secondary_refs.each do |key, _value|\n reference_types[class_name] << \"#{inventory_collection.name.to_s.singularize.camelize}Reference#{key.to_s.camelize}\"\n end\n end",
"def build_entity_dependencies\n @vocabulary.all_object_type.inject([{},{}]) { |a, o|\n if o.is_a?(ActiveFacts::Metamodel::EntityType)\n precursor = a[0]\n follower = a[1]\n blocked = false\n pi = o.preferred_identifier\n if pi\n pi.role_sequence.all_role_ref.each{|rr|\n role = rr.role\n player = role.object_type\n # REVISIT: If we decide to emit value types on demand, need to remove this:\n next unless player.is_a?(ActiveFacts::Metamodel::EntityType)\n # player is a precursor of o\n (precursor[o] ||= []) << player if (player != o)\n (follower[player] ||= []) << o if (player != o)\n }\n end\n if o.fact_type\n o.fact_type.all_role.each do |role|\n next unless role.object_type.is_a?(ActiveFacts::Metamodel::EntityType)\n (precursor[o] ||= []) << role.object_type\n (follower[role.object_type] ||= []) << o\n end\n end\n\n # Supertypes are precursors too:\n subtyping = o.all_type_inheritance_as_supertype\n next a if subtyping.size == 0\n subtyping.each{|ti|\n # debug ti.class.roles.verbalise; trace \"all_type_inheritance_as_supertype\"; exit\n s = ti.subtype\n (precursor[s] ||= []) << o\n (follower[o] ||= []) << s\n }\n # REVISIT: Need to use this to order ValueTypes after their supertypes\n # else\n # o.all_value_type_as_supertype.each { |s|\n # (precursor[s] ||= []) << o\n # (follower[o] ||= []) << s\n # }\n end\n a\n }\n end",
"def free_type_ids\n @type.var_ids - @ids\n end",
"def types\n @types.dup\n end",
"def types\n @types.dup\n end",
"def proxy_for(type)\n find_type(type).dup\n end",
"def resolve_polymorphic\n end",
"def register_dynamic(object); end",
"def resolve_polymorphic\n target_class.module_eval <<-EOS, __FILE__, __LINE__\n joins_many :#{owner_class.to_s.demodulize.underscore.pluralize}\n EOS\n end",
"def reload\n klasses = if @reflection.polymorphic?\n @reflection.active_record.distinct.order(reflection.foreign_type).pluck(reflection.foreign_type).map(&:safe_constantize)\n else\n [@reflection.klass]\n end\n @models = klasses.map { |k| @dump.model_for(k) }\n end",
"def subtypes(allow_caching = true)\n my_node(allow_caching).subclasses.collect { |st| SourceClass.new(st.uri) }\n end",
"def resolve(namespace, name, inheritance = T.unsafe(nil), proxy_fallback = T.unsafe(nil), type = T.unsafe(nil)); end",
"def transform_PAnyType(o, scope)\n assert_catalog_type(o, scope)\n end",
"def MapOracleToOSSCR_RelationshipSubjObjType(type)\n type.gsub!(\"PERSON\",\"INDIVIDUAL\") if (type==\"PERSON\")\n type.gsub!(\"ORGANIZATION\",\"INSTITUTION\") if (type==\"ORGANIZATION\")\n return type\nend",
"def break_types!(types)\n self.each_node do |node|\n node.break_types!(types)\n end\n end",
"def object_types\n feature_object_types.collect(&:category).select{|c| c}\n end",
"def polymorphic_mappings; end",
"def resolve_references(obj)\n case obj\n when PDF::Reader::Stream then\n obj.hash = resolve_references(obj.hash)\n obj\n when PDF::Reader::Reference then\n resolve_references(@xref.object(obj))\n when Hash then obj.each { |key,val| obj[key] = resolve_references(val) }\n when Array then obj.collect { |item| resolve_references(item) }\n else\n obj\n end\n end",
"def minimal_without(removed_types, with_aliases: true)\n removed_types =\n removed_types.map { |t| validate_type_argument(t) }.\n to_set\n\n result = Registry.new\n each do |type|\n next if removed_types.include?(type) || result.include?(type.name)\n type.copy_to(result)\n end\n\n if with_aliases\n each_alias do |name, type|\n if result.include?(type.name)\n result.create_alias(name, type.name)\n end\n end\n end\n result\n end",
"def revert_type_literal_internal( type, ruby_type )\n return :boolean, :default_size => 1 if ruby_type == :boolean\n\n method = \"revert_#{db.database_type}_type\"\n specific_type = send( method, type ) if respond_to?( method, true )\n\n specific_type || revert_generic_type( type ) || ruby_type\n end",
"def types=(_arg0); end",
"def load_types\n ObjectSpace.enum_for(:each_object, class << NotificationSystem::Notification; self; end).to_a - [NotificationSystem::Notification]\n end",
"def unresolve_refs(rrefs)\r\n # make sure any removed_urefs have been removed, \r\n # otherwise they will be removed later even if this method actually re-added them\r\n unresolved_refs\r\n rrefs.each do |rr|\r\n ur = rr.uref\r\n refs = ur.element.getGeneric(ur.feature_name)\r\n if refs.is_a?(Array)\r\n index = refs.index(rr.target)\r\n ur.element.removeGeneric(ur.feature_name, rr.target)\r\n ur.element.addGeneric(ur.feature_name, ur.proxy, index)\r\n else\r\n ur.element.setGeneric(ur.feature_name, ur.proxy)\r\n end\r\n @unresolved_refs << ur\r\n end\r\n end",
"def resolve_types(packages)\n # Build a hash of qualified names to type objects.\n types = packages.values.map do |names|\n names.values\n end.flatten.inject(Hash.new) do |hash, type|\n hash[type.qualified_name] = type\n hash\n end\n\n # Check if an import's \"package\" is itself an entity.\n @imports.values.each do |import|\n actual_type = types[import.qualified_name]\n if actual_type && import != actual_type\n @imports[import.name] = actual_type\n end\n end\n\n # Resolve all contained entity types.\n @entities.each do |entity|\n entity.supertype = resolve(packages, entity.supertype)\n entity.interfaces = entity.interfaces.map do |interface|\n resolve(packages, interface)\n end\n end\n end",
"def needed_types\n self.scan unless @needed_types\n @needed_types\n end",
"def normalize(type); end",
"def reference_types\n types = []\n\n # Will need the 008[24] and 006[7]\n f8_24 = self['008[24]']\n f6_7 = self['006[7]']\n\n\n\n if (f8_24.include? 'e') || (f6_7.include? 'e')\n types << 'EN'\n end\n\n if f6_7.include? 'd'\n types << 'DI'\n types << 'DR'\n end\n\n if f8_24.include? 'd'\n types << 'DI'\n end\n\n if f8_24.include? 'r'\n types << 'DR'\n end\n\n types << 'EN' if @xv6XX.match? /encyclopedias/i\n types << 'DI' if @xv6XX.match? /dictionaries/i\n types << 'DR' if @xv6XX.match? /directories/i\n\n types.uniq!\n return types\n end",
"def direct_types\n (self[\"directTypes\"] || ['*']).map { |t| Registry.get_type(t) }\n end",
"def resolve_type(object)\n instance_exec(object, &@resolve_type_proc)\n end",
"def explain_types; end",
"def nonregular_type; end",
"def replace(other)\n case other\n when Manager\n @ledger.replace(other.ledger)\n when Hash\n initialize # reinitialize\n other.each do |name, value|\n @ledger[name.to_s] = (\n case value\n when Library then value\n when Hash then Library.new(value['location'], value)\n when Array\n value.map do |val|\n case val\n when Library then val\n when Hash then Library.new(val['location'], val)\n else raise TypeError\n end\n end\n else raise TypeError\n end\n )\n end\n else\n raise TypeError\n end\n end",
"def run_with_new_then_restore\n old, @type_casting_procs = type_casting_procs, MapWithNormalizing.new\n yield\n @type_casting_procs = old\n nil\n end",
"def unmodify_nilclass; end",
"def partial_resolve(namespace, name, type = T.unsafe(nil)); end",
"def show_references\n trace :composition, \"Displaying the mappings:\" do\n @binary_mappings.keys.sort_by(&:name).each do |object_type|\n mapping = @binary_mappings[object_type]\n trace :composition, \"#{object_type.name}\" do\n mapping.all_member.each do |component|\n trace :composition, component.inspect\n end\n end\n end\n end\n end",
"def objects_with_references\n end",
"def locate_internal_refs\n #require 'debug'; binding.b\n refs = gather_internal_refs\n #@files.keys.reject { |k| @files[k][:attachment] }.each do |identifier|\n @files.keys.reject { |k| @files.get(k,:attachment) }.each do |identifier|\n #id = @c.decode(@isodoc.docid_prefix(\"\", identifier.dup))\n #locate_internal_refs1(refs, identifier, @files[id])\n id = @isodoc.docid_prefix(\"\", identifier.dup)\n locate_internal_refs1(refs, identifier, id)\n end\n refs.each do |schema, ids|\n ids.each do |id, key|\n key == true and refs[schema][id] = \"Missing:#{schema}:#{id}\"\n end\n end\n refs\n end",
"def clean_referenced_patterns\n refs = [:referenced_patterns]\n # refs << :referenced_subroutine_patterns if Origen.tester.v93k?\n refs.each do |ref|\n var = send(ref)\n var = var.uniq.map do |pat|\n pat = pat.sub(/\\..*/, '')\n pat unless pat =~ /_part\\d+$/\n end.uniq.compact\n singleton_class.class_variable_set(\"@@#{ref}\", var)\n end\n end",
"def ref_types\n response = request(:eve, :ref_types)\n result = {}\n response.ref_types.each do |row|\n result[row.ref_type_id] = row.ref_type_name\n end\n result\n end",
"def replace_on(*types)\n types.map do |type|\n self.class.send :define_method, \"on_#{type}\" do |node|\n if captures = match?(node) # rubocop:disable Lint/AssignmentInCondition\n @match_index += 1\n execute_replacement(node, captures)\n end\n super(node)\n end\n end\n end",
"def replace_on(*types)\n types.map do |type|\n self.class.send :define_method, \"on_#{type}\" do |node|\n if captures = match?(node) # rubocop:disable Lint/AssignmentInCondition\n @match_index += 1\n execute_replacement(node, captures)\n end\n super(node)\n end\n end\n end",
"def create_types\n @types.each do |type|\n create_type(type) unless Type.where(name: type['name']).first\n end\n end",
"def rdl_do_typecheck(sym)\n if RDL.to_do_at[sym]\n RDL.to_do_at[sym].each { |blk| blk.call(sym) }\n end\n RDL.to_do_at[sym] = Array.new\n return unless RDL.to_typecheck[sym]\n RDL.to_typecheck[sym].each { |klass, meth|\n RDL::Typecheck.typecheck(klass, meth)\n }\n RDL.to_typecheck[sym] = Set.new\n nil\n end",
"def handle_disabled\n Rails.logger.info 'Refreshing item types'\n begin\n Classification::GeneralSelection.item_types refresh: true\n rescue NameError => e\n Rails.logger.info \"Failed to clear general selections for #{model_class_name}\"\n end\n\n remove_model_from_list\n remove_assoc_class 'Master'\n remove_implementation_class\n remove_implementation_controller_class\n end",
"def __object_type \n @object_type \n end",
"def __object_type \n @object_type \n end",
"def replace_types(strings, include_colon=true)\n suffix = include_colon ? \":\" : \"\"\n if acts_as_solr_configuration[:solr_fields] && acts_as_solr_configuration[:solr_fields].is_a?(Array)\n acts_as_solr_configuration[:solr_fields].each do |solr_field|\n field_type = get_solr_field_type(:text)\n if solr_field.is_a?(Hash)\n solr_field.each do |name,value|\n \t if value.respond_to?(:each_pair)\n field_type = get_solr_field_type(value[:type]) if value[:type]\n else\n field_type = get_solr_field_type(value)\n end\n field = \"#{name.to_s}_#{field_type}#{suffix}\"\n strings.each_with_index {|s,i| strings[i] = s.gsub(/#{name.to_s}_t#{suffix}/,field) }\n end\n end\n end\n end\n strings\n end",
"def determine_type_all(doc,reference)\n\n type = determine_type_locally(doc,reference)\n type = determine_type_globally(doc,reference) if type.nil?\n return type\n\n end",
"def defense_use\n use = []\n @type.not_effected_by.each {|type| use << type if !use.include?(type)}\n @type.strong_against.each {|type| use << type if !use.include?(type)}\n \n puts \"\"\n puts \"#{@type.name.upcase} POKEMON ARE RESISTANT TO:\"\n use.each_with_index {|other_type, index| puts \"#{index+1}. #{other_type.name}\"}\n end",
"def reassociate_types\n # DecisionReview is parent class of Appeal, HLR, SC. We want associations to Appeals to be reassociated.\n @reassociate_types ||= (configuration.keys - id_mapping_types + [DecisionReview]).uniq\n end",
"def refute_kind_of(cls, obj, msg=nil)\n KindAssay.refute!(obj, cls, :message=>msg, :backtrace=>caller)\n end",
"def replace_types(strings, include_colon=true)\n suffix = include_colon ? \":\" : \"\"\n if configuration[:solr_fields] && configuration[:solr_fields].is_a?(Array)\n configuration[:solr_fields].each do |solr_field|\n field_type = get_solr_field_type(:text)\n if solr_field.is_a?(Hash)\n solr_field.each do |name,value|\n \t if value.respond_to?(:each_pair)\n field_type = get_solr_field_type(value[:type]) if value[:type]\n else\n field_type = get_solr_field_type(value)\n end\n field = \"#{name.to_s}_#{field_type}#{suffix}\"\n strings.each_with_index {|s,i| strings[i] = s.gsub(/#{name.to_s}_t#{suffix}/,field) }\n end\n end\n end\n end\n strings\n end",
"def init\n parent = ancestors[1]\n unless /^Objectify::(Xml|ElementParser|DocumentParser)$/ =~ parent.name\n @collections = parent.instance_variable_get('@collections').clone || []\n @attributes = parent.instance_variable_get('@attributes').clone || []\n @qualified_attributes = parent.instance_variable_get('@qualified_attributes').clone || {}\n @flatten = parent.instance_variable_get('@flatten').clone || []\n @namespaces = parent.instance_variable_get('@namespaces').clone || {}\n @types = parent.instance_variable_get('@types').clone || {}\n else\n @collections = []\n @attributes = []\n @qualified_attributes = {}\n @flatten = []\n @namespaces = {}\n @types = {}\n end\n end",
"def reflection; end",
"def reflection; end",
"def type_klass=(_arg0); end",
"def determine_type_globally(doc,reference)\n\n return nil if doc.nil?\n\n log_append(\"Looking for '#{reference}'\")\n\n # TODO: Consider the logic of what we are doing here, specifically do we\n # need to introduce a 'public' only match as we are only interested\n # in public variables once @type_depth > 0 IF we are inspecting a\n # a chain of property references. So in: thing.foo.bar thing is\n # local to the class and could be ppp (pp in the supers), but foo\n # can only be a public property.\n\n namespace = \"protected|public\"\n namespace = \"private|protected|public\" if @type_depth == 0\n namespace = \"\" if is_interface(doc)\n\n # Variables and Constants\n var_regexp = /^\\s*(#{namespace})\\s+(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n if $4 != nil\n log_append(\"Type determined as '#{reference}:#{$4}' in global scope.\")\n return [doc,$4]\n end\n\n # Statics.\n var_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)\\s+\\b(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n\n if $5 != nil\n log_append(\"Type determined as '#{reference}:#{$5}' in global scope.\")\n return [doc,$5]\n end\n\n # Also picks up single line methods.\n # TODO: public static function getInstance():IFacade {\n if namespace == \"\"\n # Handle interfaces.\n get_regexp = /^\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $3\n else\n get_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)?\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $6\n end\n\n if found_type != nil\n if found_type == \"void\"\n @return_type_void = true\n log_append(\"Return Type determined as '#{reference}:#{found_type}' (void) in global scope.\")\n return nil\n end\n log_append(\"Type determined as '#{reference}:#{found_type}' in global scope.\")\n return [doc,found_type]\n end\n\n @type_depth += 1\n\n # Try the superclass.\n # We check is_interface earlier in the method and set namespace accordingly.\n if namespace == \"\"\n\n # TODO: Check how we track type_depth and it's implications.\n ip = load_interface_parents(doc)\n next_docs = ip[:parents] || nil unless ip.nil?\n\n unless next_docs.nil? or next_docs.empty?\n\n log_append(\"Starting to recurse interface parents #{next_docs.size.to_s}\")\n\n next_docs.each do |d|\n\n found = determine_type_globally(d,reference)\n\n if found.instance_of? Array\n\n if found.size == 2\n log_append(\"found[0] = \\n#{found[0]} \\nfound[1] = \\n#{found[1]}\")\n return found\n else\n log_append(\"Error Expected an Array with 2 elements got #{found.size}\")\n end\n end\n end\n\n else\n nil\n end\n\n else\n next_doc = load_parent(doc);\n found = determine_type_globally(next_doc,reference)\n return found\n end\n\n nil\n end",
"def __type_for_hit(hit)\n @@__types ||= {}\n\n key = \"#{hit[:_index]}::#{hit[:_type]}\" if hit[:_type] && hit[:_type] != '_doc'\n key = hit[:_index] unless key\n\n @@__types[key] ||= begin\n Registry.all.detect do |model|\n (model.index_name == hit[:_index] && __no_type?(hit)) ||\n (model.index_name == hit[:_index] && model.document_type == hit[:_type])\n end\n end\n end"
] |
[
"0.6899712",
"0.6023782",
"0.58795905",
"0.5839059",
"0.5776291",
"0.55884314",
"0.55273604",
"0.5485643",
"0.5435414",
"0.54223526",
"0.5421705",
"0.5408585",
"0.54031736",
"0.5332975",
"0.5289836",
"0.5289836",
"0.52734077",
"0.52734077",
"0.526387",
"0.5257885",
"0.52480084",
"0.5247683",
"0.5247589",
"0.5227565",
"0.52254957",
"0.522253",
"0.5189285",
"0.51796484",
"0.51713336",
"0.51505494",
"0.5138431",
"0.513606",
"0.5132259",
"0.5118288",
"0.511776",
"0.5104647",
"0.5100221",
"0.50932086",
"0.5079822",
"0.5074246",
"0.50620097",
"0.5039243",
"0.50102717",
"0.500757",
"0.5000599",
"0.5000599",
"0.5000534",
"0.49707803",
"0.49676853",
"0.49636245",
"0.49577513",
"0.49568707",
"0.49533156",
"0.49362773",
"0.49327666",
"0.49312735",
"0.49234077",
"0.49182567",
"0.49151328",
"0.49063277",
"0.49047172",
"0.49028543",
"0.49027056",
"0.48945957",
"0.48824653",
"0.4875634",
"0.48747355",
"0.48559263",
"0.48552743",
"0.48416352",
"0.4839446",
"0.48360756",
"0.48309937",
"0.48240757",
"0.4804607",
"0.4794277",
"0.4791787",
"0.47913745",
"0.47856125",
"0.47804958",
"0.47795007",
"0.47784787",
"0.47784787",
"0.47724003",
"0.47720802",
"0.47685146",
"0.47665393",
"0.47665393",
"0.47658733",
"0.475353",
"0.47475022",
"0.47429845",
"0.47389236",
"0.47387308",
"0.47378057",
"0.47350636",
"0.47350636",
"0.4729945",
"0.4727031",
"0.47225833"
] |
0.6422491
|
1
|
This is probably not 100% robust but it has to be good enough to avoid modifying the builtin introspection types
|
def dup_type_class(type_class)
type_name = type_class.graphql_name
Class.new(type_class) do
# This won't be inherited like other things will
graphql_name(type_name)
if type_class.kind.fields?
type_class.fields.each do |_name, field_defn|
dup_field = field_defn.dup
dup_field.owner = self
add_field(dup_field)
end
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def explain_types; end",
"def reflection; end",
"def reflection; end",
"def nonregular_type; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def types; end",
"def cast_types; end",
"def types(types); end",
"def type(type); end",
"def type_name_resolver; end",
"def registered_types\n end",
"def types=(_arg0); end",
"def value_types=(_arg0); end",
"def type() end",
"def validated_parser_type(type); end",
"def get_type; raise NotImplementedError end",
"def infer_type( name )\n as_string = name.to_s\n parts = as_string.split(\"_\")\n if( [\"reg\" , \"obj\" , \"tmp\" , \"self\" , \"const\", \"1\" , \"2\"].include?( parts.last ) )\n parts.pop\n as_string = parts.join(\"_\")\n end\n as_string = \"word\" if as_string == \"name\"\n as_string = \"message\" if as_string == \"next_message\"\n as_string = \"message\" if as_string == \"caller\"\n sym = as_string.camelise.to_sym\n clazz = Parfait.object_space.get_class_by_name(sym)\n raise \"Not implemented/found object #{name}:#{sym}\" unless clazz\n return clazz.instance_type\n end",
"def type_klass; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def type_name; end",
"def get_primitive_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'nilclass' ? 'string' : attr_details[:primitive].to_s.downcase\n end",
"def type_names\n { :Word => {:char_length => :Integer} ,\n :List => {:indexed_length => :Integer} ,\n :Message => { :next_message => :Message, :receiver => :Object, :frame => :Frame ,\n :return_address => :Integer, :return_value => :Integer,\n :caller => :Message , :name => :Word , :indexed_length => :Integer },\n :MetaClass => {:object => :Object},\n :Integer => {},\n :Object => {},\n :Kernel => {}, #fix, kernel is a class, but should be a module\n :BinaryCode => {:char_length => :Integer} ,\n :Space => {:classes => :Dictionary , :types => :Dictionary , :first_message => :Message},\n :Frame => {:next_frame => :Frame, :indexed_length => :Integer},\n :Type => {:object_class => :Class, :instance_methods => :List , :indexed_length => :Integer} ,\n :Class => {:instance_methods => :List, :instance_type => :Type, :name => :Word,\n :super_class_name => :Word , :instance_names => :List },\n :Dictionary => {:keys => :List , :values => :List } ,\n :TypedMethod => {:name => :Word, :source => :Object, :instructions => :Object, :binary => :Object,\n :arguments => :Type , :for_type => :Type, :locals => :Type } ,\n :Value => {},\n }\n end",
"def most_specific_type(from_magic_type, fallback_type); end",
"def most_specific_type(from_magic_type, fallback_type); end",
"def know_it_all(object)\n if object.class == String\n String\n elsif object.class == Fixnum\n Fixnum\n elsif object.class == Array\n Array\n elsif object.class == Hash\n Hash\n end\nend",
"def csharp_type_for_schema_definition( schema )\n types = {\n ::Respect::ArraySchema => \"List<string>\",\n ::Respect::BooleanSchema => \"bool#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::FloatSchema => \"float#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::HashSchema => \"Dictionary<string, object>\",\n ::Respect::IntegerSchema => \"long#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::StringSchema => \"string\",\n ::Respect::AnySchema => \"object\",\n ::Respect::GeoPointSchema => \"global::#{ base_api_namespace() }.Fields.GeoPoint\",\n ::Respect::AttachmentSchema => \"global::#{ base_api_namespace() }.Fields.Attachment\"\n }\n\n types = if options[:use_noda_time] == \"true\" || options[:use_noda_time] == \"1\"\n types.merge({\n ::Respect::DatetimeSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"NodaTime.Instant#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"NodaTime.LocalDate#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n else\n types.merge({\n ::Respect::DatetimeSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::InstantSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\",\n ::Respect::DateSchema => \"DateTime#{ schema.allow_nil? ? \"?\" : \"\" }\"\n })\n end\n\n type = types[ schema.class ]\n\n custom = nil\n collection = false\n\n schema_item = schema.instance_variable_get(:@item)\n if type == \"List<string>\" && schema_item && schema_item.is_a?(::Respect::AnySchema)\n type = \"List<object>\"\n end\n\n if schema.is_a?(Respect::HasOneSchema)\n type = sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of )\n custom = type\n collection = false\n end\n\n if schema.is_a?(Respect::EnumSchema)\n type = sanitize_model_namespace( schema.values_module ) + \".\" + sanitize_model_class( schema.values_module )\n custom = type\n collection = false\n\n emit_enum!( schema.values_module )\n end\n\n if schema.is_a?(Respect::HasManySchema)\n type = \"List<\" + sanitize_model_namespace( schema.of ) + \".\" + sanitize_model_class( schema.of ) + \">\"\n custom = type\n collection = true\n end\n\n return type, custom, collection\n end",
"def spec_type(desc, *additional); end",
"def value_types; end",
"def refute_kind_of(cls, obj, msg = T.unsafe(nil)); end",
"def self_types; end",
"def self_types; end",
"def o_type\n 8 \n end",
"def signature_types(meth, link = T.unsafe(nil)); end",
"def get_member_type_string(attr_details)\n attr_details[:primitive].to_s.downcase == 'array' ? member_type_is_basic?(attr_details) : attr_details[:primitive]\n end",
"def type_klass=(_arg0); end",
"def test_types\n # rec = SourceRecord.new\n source = make_dummy_source(\"http://www.newstuff.org/createtypes\", N::FOAFX.Person, N::FOAFX.Foe)\n assert_not_nil(source)\n assert_property(source.types, N::FOAFX.Person, N::FOAFX.Foe, source.rdf_selftype)\n end",
"def type_helper \n self.type \n end",
"def typify(api_map); end",
"def know_it_all(object)\n object.class\nend",
"def get_type\n\n end",
"def builtin_type?\n\t\ttrue\n\tend",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type_params; end",
"def type ; metadata[:type] ; end",
"def determine_type_globally(doc,reference)\n\n return nil if doc.nil?\n\n log_append(\"Looking for '#{reference}'\")\n\n # TODO: Consider the logic of what we are doing here, specifically do we\n # need to introduce a 'public' only match as we are only interested\n # in public variables once @type_depth > 0 IF we are inspecting a\n # a chain of property references. So in: thing.foo.bar thing is\n # local to the class and could be ppp (pp in the supers), but foo\n # can only be a public property.\n\n namespace = \"protected|public\"\n namespace = \"private|protected|public\" if @type_depth == 0\n namespace = \"\" if is_interface(doc)\n\n # Variables and Constants\n var_regexp = /^\\s*(#{namespace})\\s+(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n if $4 != nil\n log_append(\"Type determined as '#{reference}:#{$4}' in global scope.\")\n return [doc,$4]\n end\n\n # Statics.\n var_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)\\s+\\b(var|const)\\s+\\b(#{reference})\\b\\s*:\\s*((\\w+)|\\*)/\n\n doc.scan(var_regexp)\n\n if $5 != nil\n log_append(\"Type determined as '#{reference}:#{$5}' in global scope.\")\n return [doc,$5]\n end\n\n # Also picks up single line methods.\n # TODO: public static function getInstance():IFacade {\n if namespace == \"\"\n # Handle interfaces.\n get_regexp = /^\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $3\n else\n get_regexp = /^\\s*(#{namespace}|static)\\s+(#{namespace}|static)?\\s*\\bfunction\\s+(get\\s+)?\\b(#{reference})\\b\\s*\\((?m:[^)]*)\\)\\s*:\\s*((\\w+)|\\*)/\n doc.scan(get_regexp)\n found_type = $6\n end\n\n if found_type != nil\n if found_type == \"void\"\n @return_type_void = true\n log_append(\"Return Type determined as '#{reference}:#{found_type}' (void) in global scope.\")\n return nil\n end\n log_append(\"Type determined as '#{reference}:#{found_type}' in global scope.\")\n return [doc,found_type]\n end\n\n @type_depth += 1\n\n # Try the superclass.\n # We check is_interface earlier in the method and set namespace accordingly.\n if namespace == \"\"\n\n # TODO: Check how we track type_depth and it's implications.\n ip = load_interface_parents(doc)\n next_docs = ip[:parents] || nil unless ip.nil?\n\n unless next_docs.nil? or next_docs.empty?\n\n log_append(\"Starting to recurse interface parents #{next_docs.size.to_s}\")\n\n next_docs.each do |d|\n\n found = determine_type_globally(d,reference)\n\n if found.instance_of? Array\n\n if found.size == 2\n log_append(\"found[0] = \\n#{found[0]} \\nfound[1] = \\n#{found[1]}\")\n return found\n else\n log_append(\"Error Expected an Array with 2 elements got #{found.size}\")\n end\n end\n end\n\n else\n nil\n end\n\n else\n next_doc = load_parent(doc);\n found = determine_type_globally(next_doc,reference)\n return found\n end\n\n nil\n end",
"def type\n _type\n end",
"def check_type(obj)\n if obj.kind_of? Integer\n return 'int'\n elsif obj.kind_of? Float\n return 'float'\n elsif obj.instance_of? String\n return 'string'\n elsif obj.instance_of? TrueClass\n return 'bool'\n elsif obj.instance_of? FalseClass\n return 'bool'\n elsif obj.instance_of? Array\n return 'array'\n else\n raise TypeError, \"check_type: Error - type of object does not exist\"\n end\nend",
"def reflector; end",
"def reflector; end",
"def fetch_upstream_primitive(attr)\n registered_properties[attr].type\n end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end",
"def type; end"
] |
[
"0.66166717",
"0.653142",
"0.653142",
"0.6509218",
"0.6285048",
"0.6285048",
"0.6285048",
"0.6285048",
"0.6285048",
"0.6263979",
"0.620563",
"0.61666775",
"0.6089412",
"0.5952076",
"0.5925658",
"0.59113324",
"0.59012777",
"0.58768064",
"0.5873869",
"0.58562684",
"0.585083",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5850546",
"0.5843522",
"0.57908905",
"0.5790073",
"0.5790073",
"0.5786461",
"0.57513386",
"0.5746191",
"0.5722851",
"0.5717927",
"0.5711877",
"0.5711877",
"0.5699478",
"0.5639724",
"0.56309325",
"0.5606524",
"0.5594101",
"0.55911845",
"0.55759656",
"0.5574456",
"0.5569262",
"0.5564095",
"0.55528635",
"0.55528635",
"0.55528635",
"0.55528635",
"0.55528635",
"0.55442935",
"0.55299056",
"0.5521558",
"0.5521079",
"0.54954535",
"0.54954535",
"0.5495444",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715",
"0.54845715"
] |
0.0
|
-1
|
+++++++ | Field | Type | Null | Key | Default | Extra | +++++++ | ID | int(11) | | PRI | NULL | auto_increment | | Posted | datetime | | MUL | 00000000 00:00:00 | | | AuthorID | varchar(64) | | | | | | LastMod | datetime | | | 00000000 00:00:00 | | | LastModID | varchar(64) | | | | | | Title | varchar(255) | | MUL | | | | Title_html | varchar(255) | | | | | | Body | mediumtext | | | | | | Body_html | mediumtext | | | | | | Excerpt | text | | | | | | Excerpt_html | mediumtext | | | | | | Image | varchar(255) | | | | | | Category1 | varchar(128) | | MUL | | | | Category2 | varchar(128) | | | | | | Annotate | int(2) | | | 0 | | | AnnotateInvite | varchar(255) | | | | | | comments_count | int(8) | | | 0 | | | Status | int(2) | | | 4 | | | textile_body | int(2) | | | 1 | | | textile_excerpt | int(2) | | | 1 | | | Section | varchar(64) | | | | | | override_form | varchar(255) | | | | | | Keywords | varchar(255) | | | | | | url_title | varchar(255) | | | | | | custom_1 | varchar(255) | | | | | | custom_2 | varchar(255) | | | | | | custom_3 | varchar(255) | | | | | | custom_4 | varchar(255) | | | | | | custom_5 | varchar(255) | | | | | | custom_6 | varchar(255) | | | | | | custom_7 | varchar(255) | | | | | | custom_8 | varchar(255) | | | | | | custom_9 | varchar(255) | | | | | | custom_10 | varchar(255) | | | | | | uid | varchar(32) | | | | | | feed_time | date | | | 00000000 | | +++++++
|
def to_page
u = User.find_by_login(authorid)
UserActionObserver.current_user = u
page = Page.new(
:title => title,
:created_at => lastmod,
:updated_at => lastmod,
:slug => url_title,
:status => Status[:published],
:breadcrumb => title,
:published_at => posted,
:enable_comments => annotate.to_s,
:keywords => keywords,
:created_by => u,
:updated_by => u
)
page.parts << PagePart.new(:name => 'body', :filter_id => "Textile", :content => body )
page.parts << PagePart.new(:name => 'intro', :filter_id => "Textile", :content => body.split(/\r\n\s*\r\n/).first)
page
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parse_by_feednormalizer(feed_text)\n feed_data = FeedNormalizer::FeedNormalizer.parse feed_text\n feed_data.entries.map do|e|\n metadata = {:author => e.author} if e.author\n {:did=>(e.id || e.urls.join(\" \")), :title=>e.title,:content=>e.content,:basetime=>e.date_published, \n :metadata=>metadata, :uri=>e.urls.join(\" \"), :tag_list=>e.categories.join(\",\")}\n end\n end",
"def entry_params\n params.fetch(:entry, {}).permit(:title, :sub_title, :body, :tag_id, :home_page, :summary, :img,\n :news_item, :image_in_news, :image_disable, :news_img, :newsletter_img, :merge_to_id,\n :position, :change_main_entry_position, :doc, :doc_description, :summary_length, :locale, :style_class, :header_colour, :background_colour, :colour,\n :banner_id, :partial, :entry_position, :master_entry_id, :youtube_id_str, :use_as_news_summary, :simple_text,\n :sidebar_id, :side_bar, :side_bar_news, :side_bar_social, :side_bar_search, :side_bar_gallery, :side_bar_tag_id, :unrestricted_html,\n :merge_with_previous, :raw_html, :image_popup, :alt_title, :acts_as_tag_id, :gallery_id,\n :facebook_share, :linkedin_share, :xing_share, :twitter_share, :email_share, :instagram_share, :show_in_documents_tag, :image_caption,\n :tag_line, :raw_html, :show_image_titles, :doc_delete, :img_delete, :alt_img_delete, :header_html,\n :enable_comments, :comment_strategy, :layout_select, :link_to_tag, :style, :event_id, :squeeze_id, :job_posting_id)\n end",
"def hash\n [author_handle, author_name, created_at, description, id, is_read_only, layout_type, modified_at, notify_list, reflow_type, restricted_roles, tags, template_variable_presets, template_variables, title, url, widgets].hash\n end",
"def hash\n [status, rating, title, url, publisher_date, business_id, comments, content, date, author_name, author_email, location_id, last_yext_update_time, publisher_id, id].hash\n end",
"def descMetadata_display_fields\n [:identifier, :title, :alternative, :creator, :contributor, :description, :abstract,\n :toc, :publisher, :source, :date, :date_created, :date_copyrighted,\n :date_submitted, :date_accepted, :date_issued, :date_available,\n :date_modified, :language, :type, :format, :extent, :medium, :persname,\n :corpname, :geogname, :subject, :genre, :provenance, :rights,\n :access_rights, :rights_holder, :license, :replaces, :isReplacedBy,\n :hasFormat, :isFormatOf, :hasPart, :isPartOf, :accrualPolicy, :audience,\n :references, :spatial, :bibliographic_citation, :temporal, :funder,\n :resolution, :bitdepth, :colorspace, :filesize]\n end",
"def content_id; end",
"def schema_table_posts_content\n <<-MYSQL\nCREATE TABLE posts_content\n (\n id INTEGER,\n # Ajouté pour la version 2.0 :\n created_at INTEGER(10),\n updated_at INTEGER(10),\n content TEXT NOT NULL,\n\n PRIMARY KEY (id)\n )\n MYSQL\nend",
"def create\n @feed = Feed.new(feed_params)\n\n\n\n @rss = RSS::Parser.parse(open(feed_params[:url]).read, false)\n\n @feed.title = @rss.channel.title\n @feed.link = @rss.channel.link\n @feed.pub_date = @rss.channel.pubDate\n @feed.description = @rss.channel.description\n @feed.author = @rss.channel.itunes_author\n @feed.language = @rss.channel.language\n\n \n if @rss.channel.itunes_image != nil\n @feed.image = @rss.channel.itunes_image.href\n else @rss.channel.image != nil\n @feed.image = @rss.channel.image.url\n end \n # @feed.keywords = @rss.channel.keywords\n unless @rss.channel.itunes_owner.blank?\n @feed.owner_name = @rss.channel.itunes_owner.itunes_name\n @feed.owner_email = @rss.channel.itunes_owner.itunes_email\n end\n unless @rss.channel.itunes_category.blank?\n @feed.category = @rss.channel.itunes_category.text\n end\n @feed.user_id = current_user.id\n\n\n respond_to do |format|\n if @feed.save\n format.html { redirect_to @feed, notice: 'Feed was successfully created.' }\n format.json { render :show, status: :created, location: @feed }\n else\n format.html { render :new }\n format.json { render json: @feed.errors, status: :unprocessable_entity }\n end\n end\n end",
"def blog_article_params\n params.require(:blog_article).permit(:title, \n :body, \n :pinned_value, \n entry_attributes: [:id, \n :title,\n :summary,\n :pinned_value, \n :publish_at, \n :seo_title,\n :seo_description,\n :tag_list,\n :skill_list,\n :interest_list,\n :image, \n ])\n end",
"def create\n @db.create_table?(:authors) do\n primary_key :id\n String :username, unique: true\n String :password, fixed: true, size: 60\n String :email, unique: true\n String :display_name, null: true\n String :bio, text: true\n String :role\n TrueClass :active, default: false\n DateTime :created_at\n end\n\n @db.create_table?(:posts) do\n primary_key :id\n String :title\n String :content, text: true\n String :slug, unique: true\n String :status\n foreign_key :author_id, :authors\n DateTime :published_on\n DateTime :last_updated\n end\n\n @db.create_table? :categories do\n primary_key :id\n String :name, unique: true\n end\n\n @db.create_join_table(post_id: :posts, category_id: :categories)\n\n @db.create_table?(:pages) do\n primary_key :id\n String :title\n String :content, text: true\n String :slug, unique: true\n end\n\n # @db.create_table?(:subscribers) do\n # primary_key :id\n # String :status\n # # TODO: Finish this one\n # end\n\n # @db.create_table?(:subscriptions) do\n # primary_key :id\n # TrueClass :active, default: false\n # String :host, unique: true\n # String :label\n # end\n end",
"def save_items(rss_id)\n feed_publication_date = Feed.where(\"rss_link_id = ?\", rss_id).maximum(:publication_date)\n @data[:items].each do |item|\n puts \"^\" * 50\n puts item[:publication_date]\n puts Time.parse(item[:publication_date])\n # if feed_publication_date.present? ? (Time.parse(item[:publication_date]) > feed_publication_date) : true\n params = {\n :title => item[:title],\n :description => ActionController::Base.helpers.strip_tags(item[:description]),\n :link => item[:link],\n :author => item[:author],\n :publication_date => item[:publication_date],\n :media_contents => item[:media_contents],\n :media_description => item[:media_description],\n :media_credit => item[:media_credit],\n :keywords => item[:keywords].join(\",\"),\n :rss_link_id => rss_id\n }\n f = Feed.new(params)\n if f.save\n activity = Activity.new({:action => \"Create\", :parent_id => rss_id, :parent_type => \"RssLink\", :data => params}) \n activity.save\n puts \"*\" * 50\n #puts \"Title: \" + item[:title]\n #puts \"Description: \" + item[:description]\n #puts \"Link: \" + item[:link]\n puts \"dc:creator: \" + item[:author] if item[:author]\n #puts \"pubDate: \" + item[:publication_date]\n puts \"media:content : \" + item[:media_contents].inspect if item[:media_contents] \n puts \"media:description : \" + item[:media_description] if item[:media_description]\n puts \"media:credit : \" + item[:media_credit] if item[:media_credit]\n puts \"keywords : \" + item[:keywords].inspect if item[:keywords]\n end\n # end\n end\n end",
"def entryMaker(url)\n\n # set up for image links\n img_base = \"http://www.comicstriplibrary.org\"\n\n curPage = Nokogiri::HTML(open(url))\n\n curEntry = {}\n curTable = curPage.css(\"table#metadata\") \n\n # regexes strip id and stores it.\n foundID = url.match(/\\/(\\d+)/).to_s\n foundID.gsub!(/\\//,'')\n curEntry['comic_id'] = foundID\n puts \"I.D. added! it is #{foundID}\"\n \n curTable.css(\"tr\").each do |row|\n case row.css('th').text\n\n when \"Title\"\n curEntry['title'] = row.css('td').text.strip\n\n when \"Author\"\n curEntry['author'] = row.css('td').text.strip\n\n when \"Date Published\"\n cleaned_row = row.css('td').text.strip\n rawDate = cleaned_row.gsub(/^(\\d{4})-(\\d{2})-(\\d{2})\\s-\\s([a-zA-Z]+)/,'\\4, \\2-\\3-\\1')\n simpleDate = cleaned_row.gsub(/^(\\d{4})-(\\d{2})-(\\d{2})\\s-\\s([a-zA-Z]+\\s)/,'\\2-\\3-\\1')\n\n # for a friendlier date string\n curEntry['date_display'] = rawDate\n\n # standardized dates, to be sorted against\n begin\n parsedDate = Date.parse(simpleDate)\n curEntry['date_published'] = parsedDate\n rescue StandardError => e\n yearOnly = rawDate.match(/\\d{4}$|\\d{4}\\s$/)\n curEntry['date_published'] = yearOnly\n next\n end\n\n # curEntry['date_published'] = parsedDate\n\n when \"Summary\"\n curEntry['summary'] = row.css('td').text.strip\n\n when \"Characters\"\n cleaned_row = row.css('td').text.strip\n cleaned_row.gsub!(/\\n\\s+|\\n/, \"\")\n curEntry['characters'] = cleaned_row.split(',').collect(&:strip) \n\n when \"Contents\"\n cleaned_row = row.css('td').text.strip\n cleaned_row.gsub!(/\\n\\s+|\\n|\\_\\(\\d+\\)/, \"\")\n cleaned_row.gsub!(/\\_/,\" \")\n curEntry['contents'] = cleaned_row.split(',').collect(&:strip) \n\n when \"Notes\"\n curEntry['notes'] = row.css('td').text.strip\n\n when \"Transcript\"\n if row.text.match(/transcribe/)\n curEntry['transcript'] = false\n else\n curEntry['transcript'] = true\n curEntry['transcript_text'] = row.css('td').text.strip\n end\n\n end\n\n end\n\n\n this_img = curPage.css(\"#display-wrapper img\").map { |link| link[\"src\"] }[0]\n img_url = img_base + this_img\n\n # add standard img link\n curEntry['img'] = img_url\n\n # add smaller/thumb img link\n thumb = img_url.gsub(/-s/,\"-tn\")\n curEntry['img_thumb'] = thumb\n\n # add hi-res img link\n hiRes = img_url.gsub(/-s/,\"-l\")\n curEntry['img_link'] = hiRes\n\n return curEntry\n end",
"def entry_params\n params.require(:entry).permit(:posting_id, :published, :link, :title, :content, :author_id)\n end",
"def publication_info\n\n {:type => :content, :id => id}\n\n end",
"def post_params\n params.require(:post).permit(:title, :display_headline, :facebook_headline, :facebook_description, :twitter_headline, :inject_html, :featured_photo_id, :freeform_post_header, :lead_photo_id, :slug, :content, :byline_freeform, :deck, :rubric, :email_content, :post_format, :published_at, :revised_at, :status, :produced_by, :custom_scss, :stream_promo, :in_stream, :authors => [])\n end",
"def fetch!\n parsed_feed = FeedNormalizer::FeedNormalizer.parse open(self.feed_url)\n \n self.update_attributes( :title => parsed_feed.title,\n :url => parsed_feed.url\n #:etag => parsed_feed.etag\n #:last_modified => parsed_feed.last_modified\n )\n \n parsed_feed.entries.each do |entry|\n self.entries.create(:url => entry.url,\n :title => entry.title,\n :author => entry.author,\n #:summary => entry.summary,\n :content => entry.content\n #:published => entry.published\n #:categories => entry.categories\n ) if !Entry.find_by_url(entry.url)\n end\n end",
"def entry_params\n params.require(:entry).permit(:title, :url, :content, :image, :feed_id)\n end",
"def update_submission(feed)\n if Submission.where(:post_id => feed.identifier).length > 0\n submission = Submission.where(:post_id => feed.identifier).first\n else\n submission = Submission.create(:post_id => feed.identifier)\n end\n \n user = User.find_or_create_by_fbid(feed.from.identifier, feed.from.name)\n submission.user = user\n submission[:link] = feed.link\n submission[:link_title] = feed.name\n submission[:created] = feed.created_time\n\n \n submission[:message] = feed.message\n likes = []\n feed.likes.each do |liker|\n liker_user = User.find_or_create_by_fbid(liker.identifier, liker.name)\n likes.push liker_user[:fbid]\n end\n \n \n \n comments = []\n feed.comments.each do |comment|\n commenter = User.find_or_create_by_fbid(comment.from.identifier, comment.from.name)\n comments.push commenter[:fbid]\n end\n \n submission[:likes] = likes.compact\n submission[:comments] = comments.compact\n submission[:likes_count] = feed.as_json['cached_collections'][:likes].nil? ? 0 : feed.as_json['cached_collections'][:likes]['count']\n submission[:comments_count] = feed.as_json['cached_collections'][:comments].nil? ? 0 : feed.as_json['cached_collections'][:comments]['count']\n submission.save!\n end",
"def import_blog\n raw = Feedzirra::Feed.fetch_and_parse(self.feed)\n if (raw && raw.entries)\n raw.entries[0..4].each do |i|\n slug = slug_process(i.url.split('/').last.gsub(/\\...*/, '') + \"_\" + self.author.name)\n post = Post.where(:slug => slug, :author_id => self.author_id).first\n post = entry2post(i, slug) if not post\n end\n end\n end",
"def recent_content(tag_id = nil)\n query = [@user.following_shared_contents.to_sql, @user.following_contents.to_sql, @user.contents.to_sql].map{|v| \" (#{v}) \" }.join(' UNION ')\n res = Content.from(\"(#{query}) as contents\")\n .order('contents.created_at DESC')\n .newsfeed_for(@user.id)\n res = res.joins(:contents_hash_tags).where('contents_hash_tags.hash_tag_id = ?', tag_id) if tag_id\n res = res.page(@page).per(@per_page).includes(:user)\n # res.instance_variable_set(:@total_count, Rails.cache.fetch(\"cache-total-recent-content-#{@user.id}\", expires_in: 1.hours){ res.except(:select, :limit, :offset, :order).count }) #TODO verify hash error\n res\n end",
"def news_post\n unless @user\n page = ::Hiki::Page.new(@cgi, @conf)\n page.contents = {}\n page.process(self)\n page.out('status' => \"403 Forbidden\")\n return\n end\n\n params = @cgi.params\n name = params['name'][0].size == 0 ? news_anonymous_label : params['name'][0].strip\n subject = (params['subject'][0].size == 0 ? news_notitle_label : params['subject'][0]).strip\n msg = params['msg'][0].strip\n\n return '' if msg.strip.size == 0\n\n #\n # Detail\n #\n num = 0\n lines = true\n date = Time.now.gmtime\n while(lines)\n num += 1\n detailpage = date.strftime(\"News_%Y%m%d_#{num}\")\n lines = @db.load(detailpage)\n end\n title = news_title(date, num)\n\n md5hex = @db.md5hex(detailpage)\n\n if save(detailpage, news_content(subject, name, date, msg), md5hex, true)\n @db.set_attribute(detailpage, [[:title, title]])\n redirect(@cgi, @conf.base_url + hiki_url(detailpage))\n else\n page = ::Hiki::Page.new(@cgi, @conf)\n page.contents = {}\n page.process(self)\n page.out('status' => \"403 Forbidden\")\n end\nend",
"def hash\n [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, popularity, tags, title, type, url].hash\n end",
"def feed_entry_params\n params.require(:feed_entry).permit(:feed_id, :title, :url, :published_at, :image_url, :summary, :original_id)\n end",
"def entry_params\n params.require(:entry).permit(:image, :link, :title, :author, :description, :date, :time, :isarticle, :ismedia, :isevent, :isresource)\n end",
"def find_keywords(feedEntryUrl, tags)\n\tputs \"extracting keywords\"\n\tdoc = Nokogiri::HTML(open(feedEntryUrl))\n\t# LOAD THE DICTIONARY OF KEYWORDS\n\t@keywords = Keyword.all # change to select only new ones in the controller\n\tdoc.xpath('//@style').remove\n\tdoc.css(\"p\").each do |para| # PRETTY SURE THIS IS CRAZY INEFFECIENT!\n\t#paraString = para.to_s\t\n\tparaString = para.text\n\n\t@keywords.each do |keyword| \n\n\t\t# use regex to find the keywrods and end of sentences - probably could be more effecient!\t\n\t\t# CHANGE TO DYNAMIC KEYWORD! \n\t\t# AND FIX PLURALS! - put them all in with an 'or'?\n\n\t\tpositions = paraString.enum_for(:scan, /\\b#{Regexp.escape(keyword.word)}\\b/).map { Regexp.last_match.begin(0) }\n\t\tdots = paraString.enum_for(:scan, /[\\.\\?\\!]/).map { Regexp.last_match.begin(0) }\n\n\t\t# find the end of a sentence immediatly before a keyword\n\n\t\tif dots.length >=1 # maybe check that it's not a title by having a few fullstops in a P\n\n\t\t\tpositions.each do |position|\n\n\t\t\t\tdotBefore = dots.find_all {|i| i< position}.max\n\t\t\tdotBefore=-2 if dotBefore.nil? # start of string if no punctuation before\n\t\t\t# if it's the last sentence we might actually want to go back one\n\n\t\t\tresult = paraString[dotBefore+2, position+CharacterFollow]+\"...\"\n\n\t\t\tputs paraString\n\t\t\tPost.create!(:title => \"bam\",:content => paraString,:contentSummary => result,:score => 1, :image => \"radio.jpg\",:link => feedEntryUrl, :tags => tags, :datefound => DateTime.now, :keyword => keyword.word) \n\n\tend # each keyword\n\n\tend #each\n\n\tend #if a few sentences\n\n\nend\n\nLink.update_all(:updated_at => Time.now)\n\nend",
"def index\n # Load the latest full blog feed for Frank's blog as per \n @latest_blog_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default?alt=rss')\n \n # Load the latest posts for the Marketing label feed. Labels are case sensitive - Marketing != marketing\n # Please note that the example of the Google website has an error on its label example. The alt=rss comes after\n # the label in the feed URL\n @latest_marketing_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/Marketing?alt=rss')\n \n # Load the latest posts for the SQL Converter label feed (space in the tag)\n @latest_sql_converter_posts = load_blog_feed_for_url('http://blog.rietta.com/feeds/posts/default/-/SQL%20Converter?alt=rss')\n end",
"def initialize\n self.title = nil\n self.url = nil\n self.description = nil\n self.updated_at = nil\n self.entries = []\n end",
"def feed_params\n params.require(:feed).permit(:url, :image, :title, :link, :pub_date, :description, :author, :language, :keywords, :owner_name, :owner_email, :category, :user_id, :slug)\n end",
"def hash\n [attachments, created_by_id, created_by_name, created_on, id, modified_by_id, modified_by_name, modified_on, name, owners, status_id, status_name, address_business_city, address_business_country, address_business_is_primary, address_business_line1, address_business_state, address_business_zip_code, address_home_city, address_home_country, address_home_is_primary, address_home_line1, address_home_state, address_home_zip_code, address_other_city, address_other_country, address_other_is_primary, address_other_line1, address_other_state, address_other_zip_code, current_position_company_id, current_position_company_name, current_position_title, current_position_when_end, current_position_when_start, description, education_accreditation_id, education_accreditation_name, education_honors, education_institution_id, education_institution_name, education_when_end, education_when_start, email_address_other, email_address_other_is_primary, email_address_personal, email_address_personal_is_primary, email_address_work, email_address_work_is_primary, ethnicity_id, ethnicity_name, external_primary_key, first_name, gender_id, gender_name, key_date_anniversary, key_date_birthday, key_date_other, last_name, middle_name, nick_name, phone_number_fax, phone_number_fax_extension, phone_number_fax_is_primary, phone_number_home, phone_number_home_extension, phone_number_home_is_primary, phone_number_mobile, phone_number_mobile_extension, phone_number_mobile_is_primary, phone_number_other, phone_number_other_extension, phone_number_other_is_primary, phone_number_skype, phone_number_skype_extension, phone_number_skype_is_primary, phone_number_work_direct, phone_number_work_direct_extension, phone_number_work_direct_is_primary, phone_number_work_main, phone_number_work_main_extension, phone_number_work_main_is_primary, preferred_contact_method_type_id, preferred_contact_method_type_name, record_type, related_contact_assistant_first_name, related_contact_assistant_id, related_contact_assistant_is_primary, related_contact_assistant_last_name, related_contact_client_first_name, related_contact_client_id, related_contact_client_is_primary, related_contact_client_last_name, related_contact_other_first_name, related_contact_other_id, related_contact_other_is_primary, related_contact_other_last_name, related_contact_referred_by_first_name, related_contact_referred_by_id, related_contact_referred_by_is_primary, related_contact_referred_by_last_name, related_contact_spouse_first_name, related_contact_spouse_id, related_contact_spouse_is_primary, related_contact_spouse_last_name, salary, salary_details, salutation_id, salutation_name, social_aim, social_aim_is_primary, social_facebook_chat, social_facebook_chat_is_primary, social_face_time, social_face_time_is_primary, social_google_talk, social_google_talk_is_primary, social_icq, social_icq_is_primary, social_other, social_other_is_primary, social_skype, social_skype_is_primary, social_twitter, social_twitter_is_primary, social_yahoo_msg, social_yahoo_msg_is_primary, source_id, source_name, suffix_id, suffix_name, tags, website_blog, website_blog_is_primary, website_business, website_business_is_primary, website_facebook, website_facebook_is_primary, website_linked_in, website_linked_in_is_primary, website_other, website_other_is_primary, website_personal, website_personal_is_primary].hash\n end",
"def map_first_post(row, mapped)\n mapped[:category] = @lookup.category_id_from_imported_category_id(row[:forum_id])\n mapped[:title] = CGI.unescapeHTML(row[:topic_title]).strip[0...255]\n mapped[:pinned_at] = mapped[:created_at] unless row[:topic_type] == Constants::POST_NORMAL\n mapped[:pinned_globally] = row[:topic_type] == Constants::POST_GLOBAL\n mapped[:post_create_action] = proc do |post|\n @permalink_importer.create_for_topic(post.topic, row[:topic_id])\n end\n\n mapped\n end",
"def post_params\n params.require(:post).permit(:post_author, :post_date_gmt, :post_content, :post_title, :post_status, :post_excerpt, :comment_status, :ping_status, :post_name, :post_modified, :post_modified_gmt, :post_content_filtered, :post_parent, :wp_id, :menu_order, :guid, :post_type, :post_mime_type, :comment_count, :filter, :post_meta, :post_thumbnail)\n end",
"def initialize\n self.title = nil\n self.url = nil\n self.comments_url = nil\n self.created_at = nil\n self.author = nil\n self.categories = []\n self.content = nil\n self.medias = []\n end",
"def posts limit = 50\n query = {\n posts: \"SELECT post_id, actor_id, message, description, attachment.name, attachment.href, attachment.caption, attachment.description, type,\n attachment.icon, attachment.media, created_time, updated_time FROM stream WHERE source_id = #{@id} ORDER BY created_time DESC LIMIT #{limit}\",\n comments: \"SELECT id, fromid, time, text, object_id, parent_id FROM comment WHERE post_id IN(SELECT post_id FROM #posts) ORDER BY time DESC LIMIT 10\",\n users: \"SELECT uid, name FROM user WHERE uid IN(SELECT actor_id FROM #posts) OR uid IN(SELECT fromid FROM #comments)\",\n pages: \"SELECT page_id, name FROM page WHERE page_id IN(SELECT actor_id FROM #posts) OR page_id IN(SELECT fromid FROM #comments)\"\n }\n\n proxy_exceptions do\n query = FbGraph::Query.new(query).fetch(access_token: @access_token)\n\n # Ignore posts that are created automatically following a video or photo, as we already alert about it anyway.\n query[:posts].delete_if do |post|\n post[:type].in? [POST_TYPE_VIDEO_POSTED, POST_TYPE_PHOTOS_POSTED]\n end\n\n query[:posts].map do |post_data|\n Services::Facebook::Post.new do |post|\n post.id = post_data[:post_id]\n post.message = post_data[:message]\n\n if post_attachment_data = post_data[:attachment]\n post.name = post_attachment_data[:name]\n post.caption = post_attachment_data[:caption]\n post.description = post_attachment_data[:description]\n post.icon = post_attachment_data[:icon]\n\n if post_attachment_data[:media] && post_attachment_data[:media].any?\n post.picture = post_attachment_data[:media][0][:src]\n end\n end\n\n post.created_at = Time.at post_data[:created_time]\n post.updated_at = Time.at post_data[:updated_time]\n\n # The author of a post can be either a User or a Page.\n user_or_page_data = query[:users].find { |user_data| user_data[:uid] == post_data[:actor_id] } ||\n query[:pages].find { |page_data| page_data[:page_id] == post_data[:actor_id] }\n\n # There may occasionally be no data for the author of a comment, despite the 'fromid' of the comment being\n # set to a valid Facebook ID. There's no documentation as to the circumstances under which this occurs, but it\n # is generally assumed that it is because the user that queries it doesn't have access to view it (for example,\n # the user could fall outside of geographical limitations set by the page that authored the comment).\n if user_or_page_data\n post.author = new_user user_or_page_data\n end\n\n # To find the post a comment belongs to, we must compare its 'object_id' attribute and to part of the post's id.\n comments_data = query[:comments].select { |comment_data| comment_data[:object_id] == post_data[:post_id].split(\"_\").last }\n\n post.comments = new_comments comments_data, users: query[:users], pages: query[:pages]\n end\n end.compact\n end\n end",
"def schema_table_citations\n <<-MYSQL\nCREATE TABLE citations\n (\n id INTEGER AUTO_INCREMENT,\n citation TEXT NOT NULL,\n auteur VARCHAR(255) NOT NULL,\n source VARCHAR(255),\n description TEXT,\n\n # BITLY\n # -------\n # Lien court (bit.ly) pour l'envoi par tweet. Cette URL\n # est automatiquement créée à la création de la citation\n bitly VARCHAR(50),\n\n # LAST_SENT\n # ---------\n # Timestamp du dernier envoi de la citation, pour savoir\n # quand on peut la réutiliser ou la réenvoyer sur tweeter\n last_sent INTEGER(10),\n\n created_at INTEGER(10) NOT NULL,\n updated_at INTEGER(10),\n\n PRIMARY KEY (id)\n );\n MYSQL\nend",
"def livefyre_conversation_metadata(id, title, link, tags)\n tags = tags.join(\",\") if tags.is_a? Array\n\n metadata = {\n :title => title,\n :url => link,\n :tags => tags\n }\n metadata[:checksum] = Digest::MD5.hexdigest(metadata.to_json)\n metadata[:articleId] = id\n post_meta = JWT.encode(metadata, Livefyre.config[:site_key])\n\n {\n :el => \"livefyre_comments\",\n :checksum => metadata[:checksum],\n :collectionMeta => post_meta,\n :siteId => Livefyre.config[:site_id],\n :articleId => id.to_s\n }\n end",
"def add_news_to_entries\n doc = Nokogiri::HTML(open(@config[\"url\"]))\n # the bloody dynamic loading only gives me the first 10\n canonical = doc.xpath('//head/link[@rel=\"canonical\"]').first['href']\n @canonical = canonical\n\n doc.css('.block-content').take(@config[\"consume_top\"]).each do |item|\n link = item.css('h3.block-title>a').first\n next if @entries.any? {|e| e[:rel_href] == link['href']} # skip duplicate entries\n @entries << {\n title: link.content,\n reading_time: item.css('.readingTime').first.content,\n rel_href: link['href']\n }\n end\n end",
"def post_params\n params.require(:post).permit(:title, :description, :date, :timeToRead, :mainImage, :score, :content, :type_id)\n end",
"def author_hash; end",
"def post_params\n params.require(:post).permit(:ID, :UserID, :Type, :Caption, :Content, :Counter)\n end",
"def parse_feed(options={})\n document = read_from_file(filename)\n document.extend Hashie::Extensions::DeepFetch\n recommendations = document.deep_fetch('ObjectList', 'Article') { nil }\n\n Array(recommendations).each do |item|\n doi = item['Doi']\n # sometimes doi metadata are missing\n break unless doi\n\n # turn classifications into array with lowercase letters\n classifications = item['Classifications'] ? item['Classifications'].downcase.split(\", \") : []\n\n year = Time.zone.now.year\n month = Time.zone.now.month\n\n recommendation = { 'year' => year,\n 'month' => month,\n 'doi' => doi,\n 'f1000_id' => item['Id'],\n 'url' => item['Url'],\n 'score' => item['TotalScore'].to_i,\n 'classifications' => classifications,\n 'updated_at' => Time.now.utc.iso8601 }\n\n # try to get the existing information about the given article\n data = get_result(db_url + CGI.escape(doi))\n\n if data['recommendations'].nil?\n data = { 'recommendations' => [recommendation] }\n else\n # update existing entry\n data['recommendations'].delete_if { |recommendation| recommendation['month'] == month && recommendation['year'] == year }\n data['recommendations'] << recommendation\n end\n\n # store updated information in CouchDB\n put_alm_data(db_url + CGI.escape(doi), data: data)\n end\n end",
"def index\n begin\n keyword_id = params[:keyword_id]\n @type = params[:type]\n if !keyword_id.blank?\n @keyword = Keyword.find(keyword_id)\n @media = @keyword.media.paginate(:per_page => Medium::COLS * Medium::ROWS, :page => params[:page]) # :total_entries => @keyword.media.size\n @title = \"#{Medium.model_name.human(:count => :many).titleize} Associated with Keyword \\\"#{@keyword.title}\\\"\".s\n else\n if !@type.blank?\n @media = Medium.where(:type => @type).order('created_on DESC')\n @media = @media.send(session[:filter]) if !session[:filter].blank?\n @media = @media.paginate(:per_page => Medium::FULL_COLS * Medium::FULL_ROWS, :page => params[:page]) # :total_entries => Medium.where(:type => @type).count\n @title = @type.constantize.model_name.human.titleize.pluralize\n else\n #@pictures = Picture.all.limit(Medium::COLS * Medium::PREVIEW_ROWS).order('RAND()')\n # TODO: railsify the sql query below\n @pictures = Picture.find_by_sql [\"SELECT * FROM media m JOIN (SELECT MAX(ID) AS ID FROM media) AS m2 ON m.ID >= FLOOR(m2.ID*RAND()) where m.type = 'Picture' LIMIT ?\", Medium::COLS * Medium::PREVIEW_ROWS]\n @videos = Video.order('RAND()').limit(Medium::COLS)\n @documents = Document.order('RAND()').limit(Medium::COLS)\n @online_resources = OnlineResource.order('RAND()').limit(Medium::COLS)\n @titles = { :picture => ts(:daily, :what => Picture.model_name.human(:count => :many).titleize), :video => ts(:daily, :what => Video.model_name.human(:count => :many).titleize), :document => ts(:daily, :what => Document.model_name.human(:count => :many).titleize), :online_resource => ts(:daily, :what => OnlineResource.model_name.human(:count => :many).titleize) }\n @more = { :type => '' }\n end\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to media_path\n else\n respond_to do |format|\n format.html do\n @media_search = MediaSearch.new({:title => '', :type => 'simple'})\n @current_tab_id = :home\n @current_tab_id = @type.underscore.to_sym unless @type.blank?\n if defined? @media.offset\n if @type == 'Document'\n render 'documents/paged_index_full'\n elsif @type == 'OnlineResource'\n render 'online_resources/paged_index_full'\n else\n if @type.blank?\n calculate_keyword_font_sizes\n render 'paged_index'\n else\n render 'paged_index_full'\n end\n end\n else\n calculate_keyword_font_sizes\n # render index.rhtml\n end\n end\n format.js # index.js.erb\n format.xml do\n @media = Medium.all.order('id')\n render :xml => @media\n end\n format.json do\n @media = Medium.all.order('id')\n render :json => @media #Hash.from_xml(render_to_string(:action => 'index.xml.builder'))\n end\n end\n end\n end",
"def transact_load_column_articles(data)\n resp = {:msg => \"\", :articles => []}\n \n count = (data[\"count\"] || 15).to_i\n load_old_data = (data[\"load_old_data\"] || 0).to_i\n time = (data[\"time\"] || 0).to_i\n column_id = (data[\"column_id\"] || 0) .to_i\n load_rolling_news = (data[\"load_rolling_news\"] || 0).to_i \n raise InvalidInputParamsError if load_rolling_news == 0 and column_id == 0\n \n articles = []\n if load_rolling_news == 1\n if column_id == 0\n articles = Article.rolling\n else\n column = Column.where(:id => column_id).first\n raise InvalidInputParamsError if column.blank?\n articles = column.articles.rolling\n end\n else\n column = Column.where(:id => column_id).first\n raise InvalidInputParamsError if column.blank?\n articles = column.articles\n end\n if load_old_data == 1\n articles = articles.where([\"articles.created_at < ?\", Time.at(time)])\n end\n articles = articles.order(\"articles.id DESC\").includes({:pages => :image}).page(0).per(count)\n \n articles.each do|article|\n content = \"\"\n \n article_hash = {:id => article.id.to_s, :title => article.title, :url => article_url(article), :digest => article.show_digest, :content => content,\n :column_id => column_id.to_s, :is_rolling_news => article.is_rolling_news, :images => [], :created_at => article.created_at.to_i.to_s, :updated_at => article.updated_at.to_i.to_s}\n article.pages.each do|p|\n content += \"<p>\" + p.content + \"</p>\"\n \n if p.p_index == 1 and p.image.present?\n if column_id == 2 # head news\n article_hash[:images] << p.image.article_url(:x_large)\n else # thumbnails\n article_hash[:images] << p.image.article_url(:middle) \n end\n end\n end\n \n article_hash[:content] = resp_article_content(article, content)\n \n resp[:articles] << article_hash\nend\n\nresp\nend",
"def _process(tab_id, feed, how_many)\n show_this_many_summaries = how_many # show a summary for every article\n\n processed_feed = []\n if feed.nil?\n return processed_feed \n end\n how_many = how_many - 1\n feed.entries[0 .. how_many ].each {|e|\n\n e_sum = e.summary\n es_len = 0\n unless e_sum.nil?\n es_len = e.summary.length\n end\n\n e_con = e.content\n ec_len = 0\n unless e_con.nil?\n ec_len = e.content.length\n end\n\n if (ec_len == 0) and (es_len == 0)\n e_summary = ''\n else\n if ec_len >= es_len\n e_summary = e_con\n else\n e_summary = e_sum\n end\n end\n\n summary = processed_feed.count < show_this_many_summaries ? (e_summary.nil? ? \"\" : e_summary) : \"\"\n summary = Sanitize.clean(summary, { :attributes => { 'a' => ['href'] }}).strip\n\n if e.title.empty?\n e.title = \"untitled\"\n end\n\n f = { \n 'id' => Digest::MD5.hexdigest(e.url),\n 'feed_title' => feed.title.strip,\n 'title' => Sanitize.clean(e.title).strip,\n 'url' => e.url,\n 'pubdate' => e.published,\n 'summary' => summary\n }\n\n processed_feed << f \n\n # Kick off additional processing with mysql\n _process_mysql(f)\n }\n\n processed_feed\n end",
"def update!(**args)\n @content_expiry_time = args[:content_expiry_time] if args.key?(:content_expiry_time)\n @display_url = args[:display_url] if args.key?(:display_url)\n @doc_id = args[:doc_id] if args.key?(:doc_id)\n @external_feed_metadata = args[:external_feed_metadata] if args.key?(:external_feed_metadata)\n @external_http_metadata = args[:external_http_metadata] if args.key?(:external_http_metadata)\n @filter_for_safe_search = args[:filter_for_safe_search] if args.key?(:filter_for_safe_search)\n @ip_addr = args[:ip_addr] if args.key?(:ip_addr)\n @no_archive_reason = args[:no_archive_reason] if args.key?(:no_archive_reason)\n @no_follow_reason = args[:no_follow_reason] if args.key?(:no_follow_reason)\n @no_image_index_reason = args[:no_image_index_reason] if args.key?(:no_image_index_reason)\n @no_imageframe_overlay_reason = args[:no_imageframe_overlay_reason] if args.key?(:no_imageframe_overlay_reason)\n @no_index_reason = args[:no_index_reason] if args.key?(:no_index_reason)\n @no_preview_reason = args[:no_preview_reason] if args.key?(:no_preview_reason)\n @no_snippet_reason = args[:no_snippet_reason] if args.key?(:no_snippet_reason)\n @no_translate_reason = args[:no_translate_reason] if args.key?(:no_translate_reason)\n @pagerank = args[:pagerank] if args.key?(:pagerank)\n @pagerank_ns = args[:pagerank_ns] if args.key?(:pagerank_ns)\n @repid = args[:repid] if args.key?(:repid)\n @science_metadata = args[:science_metadata] if args.key?(:science_metadata)\n @url = args[:url] if args.key?(:url)\n @url_after_redirects = args[:url_after_redirects] if args.key?(:url_after_redirects)\n @url_encoding = args[:url_encoding] if args.key?(:url_encoding)\n @content = args[:content] if args.key?(:content)\n @directory = args[:directory] if args.key?(:directory)\n @ecn_fp = args[:ecn_fp] if args.key?(:ecn_fp)\n @id = args[:id] if args.key?(:id)\n @localsearch_doc_info = args[:localsearch_doc_info] if args.key?(:localsearch_doc_info)\n @ocean_doc_info = args[:ocean_doc_info] if args.key?(:ocean_doc_info)\n @originalcontent = args[:originalcontent] if args.key?(:originalcontent)\n @user_agent_name = args[:user_agent_name] if args.key?(:user_agent_name)\n end",
"def fetch_data\n rss_provider = RssProvider.find(params[:format])\n unless rss_provider.rss_url.include?(\"indiatvnews\" ) || rss_provider.rss_url.include?(\"hindu\" ) || rss_provider.rss_url.include?(\"zee\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n feeds = xml[\"rss\"][\"channel\"][\"item\"]\n feeds.each do |feed|\n if rss_provider.rss_url.include?(\"indiatoday\" )\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n\n\n index_of_summary = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][index_of_summary..].delete_prefix(\"</a> \")\n index_of_image = feed[\"description\"].index(\"src\")\n image_url = feed[\"description\"][(index_of_image+5)..(index_of_summary-4)]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url,\n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n\n \n elsif rss_provider.rss_url.include?(\"news18\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n index_of_image = feed[\"description\"].index(\"https\")\n summary_index = feed[\"description\"].index(\" />\")\n last_index_of_image = feed[\"description\"].index(\"jpg\")\n image_url = feed[\"description\"][(index_of_image)..(last_index_of_image)] + \"pg\"\n summary = feed[\"description\"][(summary_index+3)..]\n News.create(title: feed[\"title\"], summary: summary,published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"bbc\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n elsif rss_provider.rss_url.include?(\"ndtv\")\n title = News.find_by(title: feed[\"title\"])\n unless title.present?\n News.create!(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"updatedAt\"], url: feed[\"link\"], media_url: feed[\"fullimage\"], \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id,provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n\n \n elsif rss_provider.rss_url.include?(\"timesofindia\")\n title = News.find_by(title: feed[\"title\"])\n\n unless title.present?\n\n if rss_provider.category.category_name == \"Top Story\" \n News.create(title: feed[\"title\"], summary: feed[\"description\"], \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: \"\", \n rss_provider_id: rss_provider.id,category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime) \n else\n unless feed[\"description\"] == nil \n index_of_image = feed[\"description\"].index(\"src\")\n last_index_of_image = feed[\"description\"][index_of_image..].index(\"/>\")+index_of_image\n image_url = feed[\"description\"][(index_of_image+5)..(last_index_of_image-3)]\n summary_index = feed[\"description\"].index(\"</a>\")\n summary = feed[\"description\"][(summary_index+4)..]\n News.create(title: feed[\"title\"], summary: summary, \n published_on: feed[\"pubDate\"], url: feed[\"link\"], media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n end\n end\n \n\n end\n\n end\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") \n\n\n if rss_provider.rss_url.include?(\"indiatvnews\" )\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n index_of_summary = feed.summary.index(\"</a>\")\n summary = feed.summary[index_of_summary+4..]\n index_of_image = feed.summary.index(\"src\")\n image_url = feed.summary[(index_of_image+5)..(index_of_summary-5)]\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: summary, \n published_on: feed.published, url: feed.url, media_url: image_url, \n rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"thehindu\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n elsif rss_provider.rss_url.include?(\"zee\")\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n end\n\n end\n\n unless rss_provider.rss_url.include?(\"timesofindia\" ) || rss_provider.rss_url.include?(\"ndtv\" ) || rss_provider.rss_url.include?(\"bbc\" ) ||\n rss_provider.rss_url.include?(\"news18\") || rss_provider.rss_url.include?(\"indiatoday\") ||\n rss_provider.rss_url.include?(\"indiatvnews\") || rss_provider.rss_url.include?(\"thehindu\") ||\n rss_provider.rss_url.include?(\"zee\")\n\n xml = HTTParty.get(rss_provider.rss_url)\n ProviderContent.create(xml: xml, rss_provider_id: rss_provider.id)\n xml = xml.body\n feeds = Feedjira.parse(xml)\n feeds.entries.each do |feed|\n title = News.find_by(title: feed.title)\n unless title.present?\n News.create(title: feed.title, summary: feed.summary.strip, \n published_on: feed.published, url: feed.url,rss_provider_id: rss_provider.id, category_id: rss_provider.category.id, \n provider_id: rss_provider.provider.id, media_credit: rss_provider.provider.provider_name)\n end\n\n end\n rss_provider.update(news_updated_at: Time.now.localtime)\n\n end\n redirect_to admin_rss_providers_path, alert: \"Fetched Successfully \"\n\n end",
"def blog_params\n params.require(:blog).permit(:title, :readtime, :category_id, :user_id, :content)\n end",
"def all_post\n end",
"def content_id\n id\n end",
"def full_parse\n self.href\n\n self.cache_object\n \n self.http_headers\n self.encoding\n self.feed_data_utf_8\n self.xml_document\n self.root_node\n self.channel_node\n \n self.base_uri\n self.feed_type\n self.feed_version\n\n self.entries\n\n self.id\n self.title\n self.subtitle\n self.links\n self.link\n self.icon\n self.favicon\n self.author\n self.publisher\n self.time\n self.updated\n self.published\n self.categories\n self.images\n self.rights\n self.time_to_live\n self.generator\n self.language\n\n self.docs\n self.text_input\n self.cloud\n\n self.itunes_summary\n self.itunes_subtitle\n self.itunes_author\n\n self.media_text\n\n self.explicit?\n \n self.entries.each do |entry|\n entry.full_parse()\n end\n\n nil\n end",
"def update!(**args)\n @byline_date_secs = args[:byline_date_secs] if args.key?(:byline_date_secs)\n @crawl_ts_usec = args[:crawl_ts_usec] if args.key?(:crawl_ts_usec)\n @extended_news_previews_domain = args[:extended_news_previews_domain] if args.key?(:extended_news_previews_domain)\n @favicon_display = args[:favicon_display] if args.key?(:favicon_display)\n @firstseen_date_secs = args[:firstseen_date_secs] if args.key?(:firstseen_date_secs)\n @is_amp = args[:is_amp] if args.key?(:is_amp)\n @is_eucd_domain = args[:is_eucd_domain] if args.key?(:is_eucd_domain)\n @max_snippet_length = args[:max_snippet_length] if args.key?(:max_snippet_length)\n @max_snippet_length_from_publisher = args[:max_snippet_length_from_publisher] if args.key?(:max_snippet_length_from_publisher)\n @max_snippet_length_publisher_default = args[:max_snippet_length_publisher_default] if args.key?(:max_snippet_length_publisher_default)\n @max_thumbnail_size = args[:max_thumbnail_size] if args.key?(:max_thumbnail_size)\n @max_thumbnail_size_from_publisher = args[:max_thumbnail_size_from_publisher] if args.key?(:max_thumbnail_size_from_publisher)\n @max_thumbnail_size_publisher_default = args[:max_thumbnail_size_publisher_default] if args.key?(:max_thumbnail_size_publisher_default)\n @max_video_preview_secs = args[:max_video_preview_secs] if args.key?(:max_video_preview_secs)\n @max_video_preview_secs_from_publisher = args[:max_video_preview_secs_from_publisher] if args.key?(:max_video_preview_secs_from_publisher)\n @max_video_preview_secs_publisher_default = args[:max_video_preview_secs_publisher_default] if args.key?(:max_video_preview_secs_publisher_default)\n end",
"def newPost(appkey, blogid, username, password, content, publish)\n begin\n re = %r{^<title>(.+?)</title>(?:<category>(.+?)</category>)?(.+)$}mi\n title, categories, body = content.match(re).captures rescue nil\n\n body ||= content.to_s\n title ||= body.to_s.split.split(0..5).join(' ')\n categories = categories.to_s.split(',')\n\n doc = Document.new.tap do |doc|\n doc.content = body\n doc.title = title\n doc.published = publish\n doc.author = @account\n doc.page = this_page\n doc.categories = this_page.categories.many_matching(categories)\n end\n \n doc.save!\n doc.external_id\n rescue Exception => e\n logger.error(e.message)\n \n # Return failure.\n 0\n end\n end",
"def map (post)\n {\n stats: {\n score: post.score,\n comments: post.num_comments,\n category: post.link_flair_text,\n category_css: post.link_flair_css_class,\n gilded: post.gilded,\n },\n info: {\n title: post.title.andand.gsub(/\\W+/, ' '),\n fullname: post.fullname,\n url: post.url,\n created: post.created,\n editd: post.edited,\n author_flair: {\n text: post.author_flair_text.andand.gsub(/\\W+/, ' '),\n #css: post.author_flair_css_class\n },\n link_flair: {\n text: post.link_flair_text,\n css: post.link_flair_css_class\n }\n }\n }\nend",
"def hash\n [type, id, timestamp, local_timestamp, local_timezone, caller_id, service_url, channel_id, from, conversation, recipient, text_format, attachment_layout, members_added, members_removed, reactions_added, reactions_removed, topic_name, history_disclosed, locale, text, speak, input_hint, summary, suggested_actions, attachments, entities, channel_data, action, reply_to_id, label, value_type, value, name, relates_to, code, expiration, importance, delivery_mode, listen_for, text_highlights, semantic_action].hash\n end",
"def index\n\n res_posts = Post.select(\"id, title, author_id, left(content,#{MAX_CONTENT_LENGTH}) as content, created_at, published\").order( created_at: :desc )\n\n a_parms = get_params()\n\n @author_id = nil\n\n if( a_parms[:author_id] ) #filter posts by author\n parm_author_id = a_parms[:author_id].to_i\n\n raise ApplicationController::NotAuthorized, 'Access denied' if !user_signed_in?\n raise ApplicationController::NotAuthorized, \"Access denied to resources from another author\" if( current_author_id != parm_author_id )\n @author_id = parm_author_id \n res_posts = res_posts.where(author_id: @author_id)\n else\n res_posts = res_posts.published\n end\n\n\n @posts = res_posts.paginate(page: params[:page], per_page: POSTS_PER_PAGE)\n end",
"def parse_feed(options={})\n document = read_from_file(filename)\n document.extend Hashie::Extensions::DeepFetch\n recommendations = document.deep_fetch('ObjectList', 'Article') { nil }\n\n Array(recommendations).each do |item|\n doi = item['Doi']\n # sometimes doi metadata are missing\n break unless doi\n\n # turn classifications into array with lowercase letters\n classifications = item['Classifications'] ? item['Classifications'].downcase.split(\", \") : []\n\n year = Time.zone.now.year\n month = Time.zone.now.month\n\n recommendation = { 'year' => year,\n 'month' => month,\n 'doi' => doi,\n 'f1000_id' => item['Id'],\n 'url' => item['Url'],\n 'score' => item['TotalScore'].to_i,\n 'classifications' => classifications,\n 'updated_at' => Time.now.utc.iso8601 }\n\n # try to get the existing information about the given work\n data = get_result(db_url + CGI.escape(doi))\n\n if data['recommendations'].nil?\n data = { 'recommendations' => [recommendation] }\n else\n # update existing entry\n data['recommendations'].delete_if { |recommendation| recommendation['month'] == month && recommendation['year'] == year }\n data['recommendations'] << recommendation\n end\n\n # store updated information in CouchDB\n put_lagotto_data(db_url + CGI.escape(doi), data: data)\n end\n end",
"def id_columns\n {\n :activities=>[:id, :dossier_id, :actor_id, :subject_id],\n :answers=>[:id, :protocol_id, :measurement_id, :completed_by, :subject_id, :questionnaire_id, :owner_id, :team_id, :fill_out_task_id, :remote_id, :non_response_id, :requester_id], # added completed_by, leave out export_id (which is archived id)\n :answers_fill_out_requests=>[:answer_id, :fill_out_request_id],\n :answers_fill_out_sessions=>[:id, :answer_id, :fill_out_session_id],\n :answers_reports=>[:id, :answer_id, :report_id],\n :api_tokens=>[:id, :organization_id],\n :auth_nonces=>[:id, :consumer_id],\n :auth_tokens=>[:id, :organization_id],\n :delayed_jobs=>[:id],\n :dossier_epd_id_changes=>[:id, :organization_id, :requester_id],\n :email_bounces=>[:id, :dossier_id],\n :export_versions=>[:id, :organization_id],\n :fill_out_requests=>[:id, :dossier_id, :protocol_subscription_id, :measurement_sequence_id],\n :fill_out_sessions=>[:id, :measurement_id, :current_answer_id, :completer_id, :patient_id, :team_id],\n :fill_out_sessions_questionnaires=>[:id, :fill_out_session_id, :questionnaire_id],\n :fill_out_tasks=>[:id, :patient_id],\n :highcharts_json_caches=>[:id],\n :invitation_templates=>[:id, :organization_id, :protocol_id, :team_id],\n :invitations=>[:id, :user_id, :protocol_id, :team_id, :parent_id, :professional_id, :organization_id],\n :invitations_questionnaires=>[:invitation_id, :questionnaire_id],\n :measurement_sequences=>[:id, :dossier_id],\n :measurements=>[:id, :parent_id, :protocol_id],\n :measurements_questionnaires=>[:measurement_id, :questionnaire_id, :id],\n :non_responses=>[:id],\n :organizations=>[:id, :current_export_version_id],\n :patients=>[:id, :organization_id, :patty_patient_id],\n :patty_patients=>[:id],\n :professionals=>[:id, :organization_id],\n :professionals_patients=>[:patient_id, :professional_id],\n :protocol_subscriptions=>[:id, :patient_id, :protocol_id, :started_by_id, :invitation_template_id, :measurement_sequence_id, :text_message_template_id],\n :protocols=>[:id, :organization_id],\n :quby_answers=>[:id], # removed: :questionnaire_id (pointed to id in Quby when it was a seperate Rails app and questionnaire dsls were stored in the db)\n :questionnaires=>[:id, :bulk_id, :original_id],\n :report_templates=>[:id, :protocol_id, :organization_id],\n :reported_questionnaires=>[:id, :report_template_id, :questionnaire_id],\n :reports=>[:id, :report_template_id, :patient_id],\n # removed: sessions table\n # removed: schema migrations table\n :teams=>[:id, :owner_id, :organization_id],\n :text_message_templates=>[:id, :organization_id, :protocol_id],\n :text_messages=>[:id, :text_message_template_id, :dossier_id],\n :tokens=>[:id, :patient_id]\n }\n end",
"def load_content_from_hash hash, row_id = nil\n row_id ||= (@row_id += 1)\n\n log_puts do \n ct = hash[:content_type]\n if @ct != ct\n @ct = ct\n \"\\n#{ct}:\"\n else\n nil\n end\n end\n log_write do\n (row_id % 100 == 0) ? row_id : nil\n end\n\n hash = hash.dup\n\n # Do not bother with these fields.\n hash.delete(:updater)\n hash.delete(:creator)\n hash.delete(:content_status)\n\n # Handle encoding.\n if Contenter::Api::Parse.decode_hash! hash\n @stats[:data_decoding] += 1\n end\n\n hash_normalized = false\n \n obj = nil\n \n # Try to locate by uuid first.\n PRIMARY_KEYS.each do | key |\n obj = (x = hash[key]) && (! x.empty?) && Content.find(:first, :conditions => { key => x })\n break if obj\n end\n\n # Try to locate by all other params.\n unless obj \n # hash = Content.normalize_hash(hash) unless hash_normalized\n # hash_normalized = true\n # hash[:content_type] ||= hash[:content_key].content_type\n content_type = ContentType[hash[:content_type]]\n if content_type\n content_key = content_type.content_keys.by_code(hash[:content_key])\n if content_key\n conditions = { :content_key_id => content_key.id }\n conditions[:language_id] = Language[hash[:language] || :_]\n conditions[:country_id] = Country[hash[:country] || :_]\n conditions[:brand_id] = Brand[hash[:brand] || :_]\n conditions[:application_id] = Application[hash[:application] || :_]\n conditions[:mime_type_id] = MimeType[hash[:mime_type] || :_]\n obj = Content.find(:all, :conditions => conditions, :limit => 2)\n if obj.size > 1 \n raise Contenter::Error::Ambiguous, \"Search by #{params.inspect} is ambiguous, found matching object with ids #{obj.map{|x| x.id}.inspect}\"\n end\n obj = obj.first\n end\n end\n end\n\n action = nil\n\n if obj \n hash = Content.normalize_hash(hash) unless hash_normalized\n hash_normalized = true\n\n # Do not compare by uuid or id.\n cmp_hash = hash.dup\n cmp_hash.delete(:uuid) if cmp_hash[:uuid].blank?\n cmp_hash.delete(:id)\n \n # $stderr.puts \" UPDATE: load_from_hash(#{hash.inspect})\"\n if obj.is_equal_to_hash? cmp_hash\n @stats[:ignored] += 1\n log_write :'.'\n else\n # Check for version conflict.\n if ! hash[:version].blank? && \n hash[:version].to_s != obj.version.to_s\n @stats[:version_conflicts] += 1\n log_write :'V'\n raise Contenter::Error::VersionConflict, \"Content uuid #{obj.uuid}: edit of version #{hash[:version]} of which is now version #{obj.version}\"\n end\n\n # If given md5sum is different the md5sum of data,\n # assume that the file was edited by a human.\n if hash[:md5sum] && hash[:md5sum] != Digest::MD5.new.hexdigest(hash[:data])\n @stats[:md5sum_mismatches] += 1\n log_write :'#'\n end\n\n if opts[:error_on_update]\n log_puts { \"\\n row=#{row_id} id=#{obj.id} uuid=#{obj.uuid} #{obj.to_hash.inspect}\" }\n log_puts { \"\\n hash = #{hash.inspect}\" }\n log_puts { \"\\n diff = #{obj.diff_to_hash(hash).inspect}\" }\n raise \"STOP\"\n end\n\n # Set attributes.\n hash.keys.to_a.each do | k |\n hash.delete(k) if Content::CHANGE_COLUMNS.include?(k)\n end\n obj.attributes = hash\n\n # Check if object is altered.\n if obj.content_changed?\n log_write :'*'\n obj.save!\n @stats[:updated] += 1\n action = :save\n else\n @stats[:ignored] += 1\n log_write :'-'\n end\n end\n else\n # $stderr.puts \" CREATE: hash = #{hash.inspect}\"\n hash = Content.normalize_hash(hash) unless hash_normalized\n hash_normalized = true\n # $stderr.puts \" CREATE: load_from_hash(#{hash.inspect})\"\n log_write :'+'\n obj = Content.create!(hash)\n @stats[:created] += 1\n action = :create\n end\n\n obj\n \n rescue Exception => err\n log_write :E\n log_error hash, err\n raise err unless @allow_multiple_errors\n end",
"def attributes\n hash = {\n \"author\" => @author,\n \"title\" => @title,\n \"summary\" => @summary,\n \"images\" => @images,\n \"source\" => @source,\n \"date\" => @date\n }\n end",
"def hash_for_post(post)\n document = {\n :id => next_id,\n :title => post.data['title'],\n :text => text_for_post(post),\n :date => post.data['created_at'] || post.date.strftime('%Y-%m-%d %H:%MZ'),\n :url => post.url,\n :type => 'post',\n :description => post.data['description'] || \"\"\n }\n\n document['tags'] = post.tags if post.tags\n document['category'] = post.data['category'] if post.data.has_key?('category')\n\n document\n end",
"def index\n @posts = Post.where(\"status = ? AND (dibbed_until IS NULL OR (dibbed_until IS NOT NULL AND dibbed_until <= NOW()))\", 'new').page(params[:page]).per(6)\n\n @posts.each do |post|\n if ((post.image != nil) && (post.image_url == nil))\n post.image_url = post.image.url(:medium)\n post.save\n end\n end\n\n if (current_user)\n @post = Post.new(:on_the_curb => 1, :phone_number => current_user.phone_number)\n @message = Message.new()\n else\n @user = User.new\n\n #cookies.delete :first_time\n if cookies.permanent[:first_time] == nil\n cookies.permanent[:first_time] = 1\n else\n cookies.permanent[:first_time] = 0\n end\n end\n end",
"def post_params\n params.require(:post).permit(:title, :image, :description, :format_post, :hide_post, :ads, :excerpt, :category_id, :user_id, :meta_title, :meta_description, :viewer)\n end",
"def post_params\n params.require(:post).permit(:title, :author, :content, :user_id, :dungeons_and_dragons, :dadcharacter_name, :dadcharacter_player, :dadcharacter_class, :dadcharacter_level, :dadcharacter_race, :dadcharacter_alignment, :dadcharacter_deity, :dadcharacter_size, :dadcharacter_age, :dadcharacter_gender, :dadcharacter_height, :dadcharacter_weight, :dadcharacter_eyes, :dadcharacter_hair, :dadcharacter_skin, :dadcharacter_attr_str_base, :dadcharacter_attr_str_mod, :dadcharacter_attr_str_tempbase, :dadcharacter_attr_str_tempmod, :dadcharacter_attr_dex_base, :dadcharacter_attr_dex_mod, :dadcharacter_attr_dex_tempbase, :dadcharacter_attr_dex_tempmod, :dadcharacter_attr_con_base, :dadcharacter_attr_con_mod, :dadcharacter_attr_con_tempbase, :dadcharacter_attr_con_tempmod, :dadcharacter_attr_int_base, :dadcharacter_attr_int_mod, :dadcharacter_attr_int_tempbase, :dadcharacter_attr_int_tempmod, :dadcharacter_attr_wis_base, :dadcharacter_attr_wis_mod, :dadcharacter_attr_wis_tempbase, :dadcharacter_attr_wis_tempmod, :dadcharacter_attr_cha_base, :dadcharacter_attr_cha_mod, :dadcharacter_attr_cha_tempbase, :dadcharacter_attr_cha_tempmod, :dadcharacter_hp_max, :dadcharacter_hp_current, :dadcharacter_hp_nonlethaldamage, :dadcharacter_speed, :dadcharacter_ac_total, :dadcharacter_ac_armorbonus, :dadcharacter_ac_shieldbonus, :dadcharacter_ac_dexmod, :dadcharacter_ac_natarmor, :dadcharacter_ac_deflectmod, :dadcharacter_ac_miscmod, :dadcharacter_damagereduction, :dadcharacter_touch, :dadcharacter_flatfooted, :dadcharacter_initiative_total, :dadcharacter_initiative_dexmod, :dadcharacter_initiative_miscmod, :dadcharacter_fortitude_total, :dadcharacter_fortitude_base, :dadcharacter_fortitude_abilitymod, :dadcharacter_fortitude_magicmod, :dadcharacter_fortitude_miscmod, :dadcharacter_fortitude_tempmod, :dadcharacter_reflex_total, :dadcharacter_reflex_base, :dadcharacter_reflex_abilitymod, :dadcharacter_reflex_magicmod, :dadcharacter_reflex_miscmod, :dadcharacter_reflex_tempmod, :dadcharacter_will_total, :dadcharacter_will_base, :dadcharacter_will_abilitymod, :dadcharacter_will_magicmod, :dadcharacter_will_miscmod, :dadcharacter_will_tempmod, :dadcharacter_conditionalmod, :dadcharacter_bab, :dadcharacter_spellresistance, :dadcharacter_grapple_total, :dadcharacter_grapple_bab, :dadcharacter_grapple_strmod, :dadcharacter_grapple_sizemod, :dadcharacter_grapple_miscmod, :dadcharacter_attackone_name, :dadcharacter_attackone_bonus, :dadcharacter_attackone_damage, :dadcharacter_attackone_critical, :dadcharacter_attackone_range, :dadcharacter_attackone_type, :dadcharacter_attackone_note, :dadcharacter_attackone_ammoname, :dadcharacter_attackone_ammocounter, :dadcharacter_attacktwo_name, :dadcharacter_attacktwo_bonus, :dadcharacter_attacktwo_damage, :dadcharacter_attacktwo_critical, :dadcharacter_attacktwo_range, :dadcharacter_attacktwo_type, :dadcharacter_attacktwo_note, :dadcharacter_attacktwo_ammoname, :dadcharacter_attacktwo_ammocounter, :dadcharacter_attackthree_name, :dadcharacter_attackthree_bonus, :dadcharacter_attackthree_damage, :dadcharacter_attackthree_critical, :dadcharacter_attackthree_range, :dadcharacter_attackthree_type, :dadcharacter_attackthree_note, :dadcharacter_attackthree_ammoname, :dadcharacter_attackthree_ammocounter, :dadcharacter_attackfour_name, :dadcharacter_attackfour_bonus, :dadcharacter_attackfour_damage, :dadcharacter_attackfour_critical, :dadcharacter_attackfour_range, :dadcharacter_attackfour_type, :dadcharacter_attackfour_note, :dadcharacter_attackfour_ammoname, :dadcharacter_attackfour_ammocounter, :dadcharacter_attackfive_name, :dadcharacter_attackfive_bonus, :dadcharacter_attackfive_damage, :dadcharacter_attackfive_critical, :dadcharacter_attackfive_range, :dadcharacter_attackfive_type, :dadcharacter_attackfive_note, :dadcharacter_attackfive_ammoname, :dadcharacter_attackfive_ammocounter, :dadcharacter_skill_maxclassranks, :dadcharacter_skill_maxcrossclassranks, :dadcharacter_skill_appraise_usable, :dadcharacter_skill_appraise_skillmod, :dadcharacter_skill_appraise_abilitymod, :dadcharacter_skill_appraise_rank, :dadcharacter_skill_appraise_miscmod, :dadcharacter_skill_balance_usable, :dadcharacter_skill_balance_skillmod, :dadcharacter_skill_balance_abilitymod, :dadcharacter_skill_balance_rank, :dadcharacter_skill_balance_miscmod, :dadcharacter_skill_bluff_usable, :dadcharacter_skill_bluff_skillmod, :dadcharacter_skill_bluff_abilitymod, :dadcharacter_skill_bluff_rank, :dadcharacter_skill_bluff_miscmod, :dadcharacter_skill_climb_usable, :dadcharacter_skill_climb_skillmod, :dadcharacter_skill_climb_abilitymod, :dadcharacter_skill_climb_rank, :dadcharacter_skill_climb_miscmod, :dadcharacter_skill_concentration_usable, :dadcharacter_skill_concentration_skillmod, :dadcharacter_skill_concentration_abilitymod, :dadcharacter_skill_concentration_rank, :dadcharacter_skill_concentration_miscmod, :dadcharacter_skill_craftone_usable, :dadcharacter_skill_craftone_name, :dadcharacter_skill_craftone_skillmod, :dadcharacter_skill_craftone_abilitymod, :dadcharacter_skill_craftone_rank, :dadcharacter_skill_craftone_miscmod, :dadcharacter_skill_crafttwo_usable, :dadcharacter_skill_crafttwo_name, :dadcharacter_skill_crafttwo_skillmod, :dadcharacter_skill_crafttwo_abilitymod, :dadcharacter_skill_crafttwo_rank, :dadcharacter_skill_crafttwo_miscmod, :dadcharacter_skill_craftthree_usable, :dadcharacter_skill_craftthree_name, :dadcharacter_skill_craftthree_skillmod, :dadcharacter_skill_craftthree_abilitymod, :dadcharacter_skill_craftthree_rank, :dadcharacter_skill_craftthree_miscmod, :dadcharacter_skill_decipherscript_usable, :dadcharacter_skill_decipherscript_skillmod, :dadcharacter_skill_decipherscript_abilitymod, :dadcharacter_skill_decipherscript_rank, :dadcharacter_skill_decipherscript_miscmod, :dadcharacter_skill_diplomacy_usable, :dadcharacter_skill_diplomacy_skillmod, :dadcharacter_skill_diplomacy_abilitymod, :dadcharacter_skill_diplomacy_rank, :dadcharacter_skill_diplomacy_miscmod, :dadcharacter_skill_disabledevice_usable, :dadcharacter_skill_disabledevice_skillmod, :dadcharacter_skill_disabledevice_abilitymod, :dadcharacter_skill_disabledevice_rank, :dadcharacter_skill_disabledevice_miscmod, :dadcharacter_skill_disguise_usable, :dadcharacter_skill_disguise_skillmod, :dadcharacter_skill_disguise_abilitymod, :dadcharacter_skill_disguise_rank, :dadcharacter_skill_disguise_miscmod, :dadcharacter_skill_escapeartist_usable, :dadcharacter_skill_escapeartist_skillmod, :dadcharacter_skill_escapeartist_abilitymod, :dadcharacter_skill_escapeartist_rank, :dadcharacter_skill_escapeartist_miscmod, :dadcharacter_skill_forgery_usable, :dadcharacter_skill_forgery_skillmod, :dadcharacter_skill_forgery_abilitymod, :dadcharacter_skill_forgery_rank, :dadcharacter_skill_forgery_miscmod, :dadcharacter_skill_gatherinfo_usable, :dadcharacter_skill_gatherinfo_skillmod, :dadcharacter_skill_gatherinfo_abilitymod, :dadcharacter_skill_gatherinfo_rank, :dadcharacter_skill_gatherinfo_miscmod, :dadcharacter_skill_handleanimal_usable, :dadcharacter_skill_handleanimal_skillmod, :dadcharacter_skill_handleanimal_abilitymod, :dadcharacter_skill_handleanimal_rank, :dadcharacter_skill_handleanimal_miscmod, :dadcharacter_skill_heal_usable, :dadcharacter_skill_heal_skillmod, :dadcharacter_skill_heal_abilitymod, :dadcharacter_skill_heal_rank, :dadcharacter_skill_heal_miscmod, :dadcharacter_skill_hide_usable, :dadcharacter_skill_hide_skillmod, :dadcharacter_skill_hide_abilitymod, :dadcharacter_skill_hide_rank, :dadcharacter_skill_hide_miscmod, :dadcharacter_skill_intimidate_usable, :dadcharacter_skill_intimidate_skillmod, :dadcharacter_skill_intimidate_abilitymod, :dadcharacter_skill_intimidate_rank, :dadcharacter_skill_intimidate_miscmod, :dadcharacter_skill_jump_usable, :dadcharacter_skill_jump_skillmod, :dadcharacter_skill_jump_abilitymod, :dadcharacter_skill_jump_rank, :dadcharacter_skill_jump_miscmod, :dadcharacter_skill_knowledgeone_usable, :dadcharacter_skill_knowledgeone_name, :dadcharacter_skill_knowledgeone_skillmod, :dadcharacter_skill_knowledgeone_abilitymod, :dadcharacter_skill_knowledgeone_rank, :dadcharacter_skill_knowledgeone_miscmod, :dadcharacter_skill_knowledgetwo_usable, :dadcharacter_skill_knowledgetwo_name, :dadcharacter_skill_knowledgetwo_skillmod, :dadcharacter_skill_knowledgetwo_abilitymod, :dadcharacter_skill_knowledgetwo_rank, :dadcharacter_skill_knowledgetwo_miscmod, :dadcharacter_skill_knowledgethree_usable, :dadcharacter_skill_knowledgethree_name, :dadcharacter_skill_knowledgethree_skillmod, :dadcharacter_skill_knowledgethree_abilitymod, :dadcharacter_skill_knowledgethree_rank, :dadcharacter_skill_knowledgethree_miscmod, :dadcharacter_skill_knowledgefour_usable, :dadcharacter_skill_knowledgefour_name, :dadcharacter_skill_knowledgefour_skillmod, :dadcharacter_skill_knowledgefour_abilitymod, :dadcharacter_skill_knowledgefour_rank, :dadcharacter_skill_knowledgefour_miscmod, :dadcharacter_skill_knowledgefive_usable, :dadcharacter_skill_knowledgefive_name, :dadcharacter_skill_knowledgefive_skillmod, :dadcharacter_skill_knowledgefive_abilitymod, :dadcharacter_skill_knowledgefive_rank, :dadcharacter_skill_knowledgefive_miscmod, :dadcharacter_skill_listen_usable, :dadcharacter_skill_listen_skillmod, :dadcharacter_skill_listen_abilitymod, :dadcharacter_skill_listen_rank, :dadcharacter_skill_listen_miscmod, :dadcharacter_skill_movesilent_usable, :dadcharacter_skill_movesilent_skillmod, :dadcharacter_skill_movesilent_abilitymod, :dadcharacter_skill_movesilent_rank, :dadcharacter_skill_movesilent_miscmod, :dadcharacter_skill_openlock_usable, :dadcharacter_skill_openlock_skillmod, :dadcharacter_skill_openlock_abilitymod, :dadcharacter_skill_openlock_rank, :dadcharacter_skill_openlock_miscmod, :dadcharacter_skill_performone_usable, :dadcharacter_skill_performone_name, :dadcharacter_skill_performone_skillmod, :dadcharacter_skill_performone_abilitymod, :dadcharacter_skill_performone_rank, :dadcharacter_skill_performone_miscmod, :dadcharacter_skill_performtwo_usable, :dadcharacter_skill_performtwo_name, :dadcharacter_skill_performtwo_skillmod, :dadcharacter_skill_performtwo_abilitymod, :dadcharacter_skill_performtwo_rank, :dadcharacter_skill_performtwo_miscmod, :dadcharacter_skill_performthree_usable, :dadcharacter_skill_performthree_name, :dadcharacter_skill_performthree_skillmod, :dadcharacter_skill_performthree_abilitymod, :dadcharacter_skill_performthree_rank, :dadcharacter_skill_performthree_miscmod, :dadcharacter_skill_professionone_usable, :dadcharacter_skill_professionone_name, :dadcharacter_skill_professionone_skillmod, :dadcharacter_skill_professionone_abilitymod, :dadcharacter_skill_professionone_rank, :dadcharacter_skill_professionone_miscmod, :dadcharacter_skill_professiontwo_usable, :dadcharacter_skill_professiontwo_name, :dadcharacter_skill_professiontwo_skillmod, :dadcharacter_skill_professiontwo_abilitymod, :dadcharacter_skill_professiontwo_rank, :dadcharacter_skill_professiontwo_miscmod, :dadcharacter_skill_ride_usable, :dadcharacter_skill_ride_skillmod, :dadcharacter_skill_ride_abilitymod, :dadcharacter_skill_ride_rank, :dadcharacter_skill_ride_miscmod, :dadcharacter_skill_search_usable, :dadcharacter_skill_search_skillmod, :dadcharacter_skill_search_abilitymod, :dadcharacter_skill_search_rank, :dadcharacter_skill_search_miscmod, :dadcharacter_skill_sensemotive_usable, :dadcharacter_skill_sensemotive_skillmod, :dadcharacter_skill_sensemotive_abilitymod, :dadcharacter_skill_sensemotive_rank, :dadcharacter_skill_sensemotive_miscmod, :dadcharacter_skill_sleightofhand_usable, :dadcharacter_skill_sleightofhand_skillmod, :dadcharacter_skill_sleightofhand_abilitymod, :dadcharacter_skill_sleightofhand_rank, :dadcharacter_skill_sleightofhand_miscmod, :dadcharacter_skill_spellcraft_usable, :dadcharacter_skill_spellcraft_skillmod, :dadcharacter_skill_spellcraft_abilitymod, :dadcharacter_skill_spellcraft_rank, :dadcharacter_skill_spellcraft_miscmod, :dadcharacter_skill_spot_usable, :dadcharacter_skill_spot_skillmod, :dadcharacter_skill_spot_abilitymod, :dadcharacter_skill_spot_rank, :dadcharacter_skill_spot_miscmod, :dadcharacter_skill_survival_usable, :dadcharacter_skill_survival_skillmod, :dadcharacter_skill_survival_abilitymod, :dadcharacter_skill_survival_rank, :dadcharacter_skill_survival_miscmod, :dadcharacter_skill_swim_usable, :dadcharacter_skill_swim_skillmod, :dadcharacter_skill_swim_abilitymod, :dadcharacter_skill_swim_rank, :dadcharacter_skill_swim_miscmod, :dadcharacter_skill_tumble_usable, :dadcharacter_skill_tumble_skillmod, :dadcharacter_skill_tumble_abilitymod, :dadcharacter_skill_tumble_rank, :dadcharacter_skill_tumble_miscmod, :dadcharacter_skill_usemagicdevice_usable, :dadcharacter_skill_usemagicdevice_skillmod, :dadcharacter_skill_usemagicdevice_abilitymod, :dadcharacter_skill_usemagicdevice_rank, :dadcharacter_skill_usemagicdevice_miscmod, :dadcharacter_skill_userope_usable, :dadcharacter_skill_userope_skillmod, :dadcharacter_skill_userope_abilitymod, :dadcharacter_skill_userope_rank, :dadcharacter_skill_userope_miscmod, :dadcharacter_skill_extraskillone_usable, :dadcharacter_skill_extraskillone_name, :dadcharacter_skill_extraskillone_keyability, :dadcharacter_skill_extraskillone_skillmod, :dadcharacter_skill_extraskillone_abilitymod, :dadcharacter_skill_extraskillone_rank, :dadcharacter_skill_extraskillone_miscmod, :dadcharacter_skill_extraskilltwo_usable, :dadcharacter_skill_extraskilltwo_name, :dadcharacter_skill_extraskilltwo_keyability, :dadcharacter_skill_extraskilltwo_skillmod, :dadcharacter_skill_extraskilltwo_abilitymod, :dadcharacter_skill_extraskilltwo_rank, :dadcharacter_skill_extraskilltwo_miscmod, :dadcharacter_skill_extraskillthree_usable, :dadcharacter_skill_extraskillthree_name, :dadcharacter_skill_extraskillthree_keyability, :dadcharacter_skill_extraskillthree_skillmod, :dadcharacter_skill_extraskillthree_abilitymod, :dadcharacter_skill_extraskillthree_rank, :dadcharacter_skill_extraskillthree_miscmod, :dadcharacteracsizemod)\n end",
"def setup_news_table\n ActiveRecord::Schema.define do\n # drop_table :news if table_exists? :news\n create_table :news do |table|\n table.column :title, :string\n table.column :category, :string\n table.column :pub_date, :string\n table.column :from_site, :string\n table.column :image, :text\n table.column :video, :string\n table.column :text, :text\n end\n end\n end",
"def entry_params\n if user_signed_in? and current_user.admin?\n if @entry.blank? or @entry.new_record?\n params.require(:entry).permit(:title, :content, {:legislator_ids => []}, {:keyword_ids => []},\n :user_id, :date, :source_name, :source_url, :published)\n else\n params.require(:entry).permit(:title, :content, {:legislator_ids => []}, {:keyword_ids => []},\n :date, :source_name, :source_url, :published)\n end\n else\n params.require(:entry).permit(:title, :content, {:legislator_ids => []}, {:keyword_ids => []},\n :user_id, :date, :source_name, :source_url)\n end\n end",
"def fetch_articles(url)\n req = open(url)\n response_body = req.read\n articles_json = JSON.parse(response_body)\n articles_array = articles_json[\"articles\"]\n last_articles = []\n articles_array.each do |a|\n article = Article.find_by(title:a[\"title\"])\n unless article #check if article is already in the database\n author = a[\"author\"].blank? ? a[\"source\"][\"name\"] : a[\"author\"]\n article = Article.new(title:a[\"title\"],author: author,source:a[\"source\"][\"name\"],url:a[\"url\"],date:a[\"publishedAt\"],content:a[\"content\"] || \"no content available\",image:a[\"urlToImage\"],description:a[\"description\"])\n article.publication_list.add(a[\"source\"][\"id\"])\n # extractor = Phrasie::Extractor.new\n # tagging = extractor.phrases(a[\"content\"],occur:1)\n # tags = tagging.each{|p|p[0]}\n # article.theme_list.add(tags)\n article.save!\n end\n end\nend",
"def article_params\n params.require(:article).permit(:category, :title, :content, :content_html, :summary_html, :vidurl, :remote_thumburl_url, :publish_at, :approved, :article_collection_ids => [])\n end",
"def hash\n [id, url, external_id, first_name, last_name, middle_name, birth_date, gender, language, phone, allow_phone_contact, email, allow_email_contact, notes, date_created, date_modified, ext_date_created, ext_date_modified, doc_type, doc_issuer_info, doc_series, doc_number, department_code, department_name, doc_issue_date, doc_expiration_date, is_closed, merged_to, building_no, city, country_code, country_name, district, flat_no, house_no, region, room_no, settlement_type, street, raw_address, cards, view_url, preferences].hash\n end",
"def hash\n [active, additional_properties, author, authored, banned, category, comments, contributors, created_date, embed, extension, height, id, length, location, long_description, mime_type, name, priority, privacy, published, short_description, size, tags, template, thumbnail, updated_date, uploader, views, width].hash\n end",
"def hash\n [id, field_type, mode, label, no_wrap, bold, required, appears_by_default, find_enabled, allow_new_choices, sort_as_given, carry_choices, foreign_key, unique, does_data_copy, field_help, audited, num_lines, max_length, append_only, allow_html, has_extension, units, decimal_places, comma_start, number_format, does_average, does_total, blank_is_zero, currency_symbol, currency_format, display_time, display_relative, display_month, default_today, display_day_of_week, display_timezone, work_week, start_field, duration_field, format, hours24, display_user, default_kind, default_value_luid, choices_luid, choices, composite_fields, target_table_id, target_field_id, source_field_id, use_new_window, link_text, exact, display_images, default_domain, display_email, appears_as, abbreviate, auto_save, target_table_name, display_as_link, sort_alpha, version_mode, max_versions, see_versions, width, xml_tag, formula, default_value, comments, master_choice_table_id, master_choice_field_id, snap_field_id, parent_field_id, lookup_target_field_id, lookup_reference_field_id, summary_reference_field_id, summary_target_field_id, summary_function, master_table_tag, permissions].hash\n end",
"def news_to_html(news)\n return H.article(:class => \"deleted\") {\n \"[deleted news]\"\n } if news.del\n domain = news.domain\n news = {}.merge(news.to_h) # Copy the object so we can modify it as we wish.\n news[\"url\"] = \"/news/#{news[\"id\"]}\" if !domain\n upclass = \"uparrow\"\n downclass = \"downarrow\"\n if news[\"voted\"] == :up\n upclass << \" voted\"\n downclass << \" disabled\"\n elsif news[\"voted\"] == :down\n downclass << \" voted\"\n upclass << \" disabled\"\n end\n H.article(\"data-news-id\" => news[\"id\"], \"data-type\" => news['type']) {\n H.a(:href => \"#up\", :class => upclass) {\n \"▲\"\n }+\" \"+\n H.h2 {\n H.a(:href=>news[\"url\"], :rel => \"nofollow\") {\n H.entities news[\"title\"]\n }\n }+\" \"+\n H.address {\n if domain\n \"at \"+H.entities(domain)\n else \"\" end +\n if news['category_id'] && (category = Category.find(news['category_id']))\n category_code = category.code\n H.a(href: \"/f/#{category_code}\") { category_code }\n else \"\" end +\n if ($user and $user.id.to_i == news['user_id'].to_i and\n news['ctime'].to_i > (Time.now.to_i - NewsEditTime))\n \" \" + H.a(:href => \"/editnews/#{news[\"id\"]}\") {\n \"[edit]\"\n }\n else \"\" end\n }+\n H.a(:href => \"#down\", :class => downclass) {\n \"▼\"\n }+\n H.p {\n H.span(:class => :upvotes) { news[\"up\"] } + \" up and \" +\n H.span(:class => :downvotes) { news[\"down\"] } + \" down, posted by \" +\n H.username {\n H.a(:href=>\"/user/\"+URI.encode(news[\"user_email\"])) {\n H.entities news[\"user_email\"]\n }\n }+\" \"+str_elapsed(news[\"ctime\"].to_i)+\" \"+\n H.a(:href => \"/news/#{news[\"id\"]}\") {\n comments_number = news[\"comments\"].to_i\n if comments_number != 0\n \"#{news[\"comments\"] + ' comment'}\" + \"#{'s' if comments_number>1}\"\n else\n \"discuss\"\n end\n }+\n if $user and user_is_admin?($user)\n \" - \"+H.a(:href => \"/editnews/#{news[\"id\"]}\") { \"edit\" }+\" - \"+H.a(:href => \"http://twitter.com/intent/tweet?url=#{SiteUrl}/news/#{news[\"id\"]}&text=\"+URI.encode(news[\"title\"])+\" - \") { \"tweet\" }\n else \"\" end\n }+\n if params and params[:debug] and $user and user_is_admin?($user)\n \"id: \"+news[\"id\"].to_s+\" \"+\n \"score: \"+news[\"score\"].to_s+\" \"+\n \"rank: \"+compute_news_rank(news).to_s+\" \"+\n \"zset_rank: \"+$r.zscore(\"news.top\",news[\"id\"]).to_s\n else \"\" end\n }+\"\\n\"\nend",
"def index_by_date\n @enable_blog_edit = true\n authorize! :read, Roxiware::Blog::Post\n @page = (params[:page] || 1).to_i\n @blog_class = params[:blog_class] || \"blog\"\n conditions = {:blog_class=>@blog_class}\n if params[:format] == \"rss\"\n @num_posts = [(params[:max] || @blog_posts_per_feed).to_i, @max_blog_posts_per_feed].min\n else\n @num_posts = [(params[:max] || (@posts_per_page || @blog_posts_per_page)).to_i, @max_blog_posts_per_page].min\n end\n\n if params.has_key?(:year)\n start_date = DateTime.new(params[:year].to_i,\n (params[:month] || 1).to_i,\n (params[:day] || 1).to_i,\n 0, 0, 0)\n end_date = DateTime.new(params[:year].to_i,\n (params[:month] || -1).to_i,\n (params[:day] || -1).to_i,\n -1, -1, -1)\n conditions[:post_date] =start_date..end_date\n end\n\n if params.has_key?(:category)\n conditions[:terms] = {:term_taxonomy_id=>Roxiware::Terms::TermTaxonomy.taxonomy_id(Roxiware::Terms::TermTaxonomy::CATEGORY_NAME), :seo_index=>params[:category]}\n end\n if params.has_key?(:tag)\n conditions[:terms] = {:term_taxonomy_id=>Roxiware::Terms::TermTaxonomy.taxonomy_id(Roxiware::Terms::TermTaxonomy::TAG_NAME), :seo_index=>params[:tag]}\n end\n\n if conditions.has_key?(:terms)\n @posts = Roxiware::Blog::Post.joins(:terms).visible(current_user).includes(:term_relationships, :terms).where(conditions).order(\"post_date DESC\")\n else\n @posts = Roxiware::Blog::Post.visible(current_user).includes(:term_relationships, :terms).where(conditions).order(\"post_date DESC\")\n end\n\n @num_posts_total = @posts.count\n @posts = @posts.limit(@num_posts+1).offset(@num_posts*(@page-1))\n @num_pages = (@num_posts_total.to_f/@num_posts.to_f).ceil.to_i\n @link_params = {}\n @link_params[:max] = params[:max] if params[:max].present?\n @page_images = [@posts.first.post_image] if @posts.first.present?\n @og_url = @posts.first.post_link if @posts.first.present?\n @og_video_url = @posts.first.post_video if @posts.first.present? && @posts.first.post_video.present?\n if (@posts.length == @num_posts+1)\n @posts.pop\n @next_page_link = url_for({:page=>@page+1}.merge @link_params)\n end\n if(@page > 1)\n @prev_page_link = url_for({:page=>@page-1}.merge @link_params)\n end\n\n respond_to do |format|\n format.html do\n @page_title = @title\n @posts.each do |post|\n @meta_keywords = @meta_keywords + \", \" + post.post_title\n end\n render :action=>\"index\"\n end\n format.json do\n clean_posts = []\n @posts.each do |post|\n clean_posts << post.ajax_attrs(@role)\n end\n render :json => clean_posts\n end\n format.rss { render :layout => false, :action=>\"index\", :content_type=>\"application/rss+xml\" }\n end\n end",
"def post_params\n params.require(:post).permit(:title, \n :body, \n :slug, \n :category, \n :user_id, \n :meta_description, \n :meta_title, \n :published,\n :user_id\n )\n end",
"def index\n # Normal query to get the post details\n # @posts = Post.order(created_at: :desc) \n # Post Load (0.6ms) SELECT \"posts\".* FROM \"posts\" ORDER BY \"posts\".\"created_at\" DESC\n # Author Load (0.5ms) SELECT \"authors\".* FROM \"authors\" WHERE \"authors\".\"id\" = ? LIMIT 1 [[\"id\", 3]]\n # Author Load (0.1ms) SELECT \"authors\".* FROM \"authors\" WHERE \"authors\".\"id\" = ? LIMIT 1 [[\"id\", 2]]\n # Author Load (0.1ms) SELECT \"authors\".* FROM \"authors\" WHERE \"authors\".\"id\" = ? LIMIT 1 [[\"id\", 1]]\n \n # Preload\n # @posts = Post.order(created_at: :desc).preload(:author)\n # SELECT \"posts\".* FROM \"posts\" ORDER BY \"posts\".\"created_at\" DESC\n # SELECT \"authors\".* FROM \"authors\" WHERE \"authors\".\"id\" IN (3, 2, 1)\n\n\n #egaer Load\n # @posts = Post.order(created_at: :desc).eager_load(:author)\n # SELECT \"posts\".\"id\" AS t0_r0, \"posts\".\"title\" AS t0_r1, \"posts\".\"body\" AS t0_r2, \"posts\".\"author_id\" AS t0_r3, \"posts\".\"created_at\" AS t0_r4, \"posts\".\"updated_at\" AS t0_r5, \"authors\".\"id\" AS t1_r0, \"authors\".\"name\" AS t1_r1, \"authors\".\"created_at\" AS t1_r2, \"authors\".\"updated_at\" AS t1_r3 \n # FROM \"posts\"\n # LEFT OUTER JOIN \"authors\" ON \"authors\".\"id\" = \"posts\".\"author_id\"\n # ORDER BY authors.name\n\n #includes\n @posts = Post.order(created_at: :desc).includes(:author)\n # if we compare the results with the eager_load() method, the first two cases have similar results, but in the last case it smartly decided to shift to the preload() method for better performance\n\n end",
"def hash\n [affiliate_rate, campaign_id, category, client_review, create_date, currency_code, description, document_id, fee_amount, fee_type, financial_rate, financial_rate_term, financial_rate_term_unit, financial_rate_type, id, image, institution_name, is_active, metadata, minimum_contribution, minimum_contribution_term, minimum_contribution_term_unit, name, node_map, offer_link, offer_term, offer_term_unit, prerequisite, prerequisite_type, rating, secondary_id, subcategory, update_date].hash\n end",
"def interpret(d)\n article = Article.new\n article.title = !d['webTitle'].nil? ? d['webTitle'] : 'n/a'\n article.source = @source\n article.pub_date = !d['webPublicationDate'].nil? ? (DateTime.parse d['webPublicationDate']) : nil\n article.author = !d['fields']['byline'].nil? ? d['fields']['byline'] : 'n/a'\n article.link = !d['webUrl'].nil? ? d['webUrl'] : 'n/a'\n\n re = /<(\"[^\"]*\"|'[^']*'|[^'\">])*>/\n summary = !d['fields']['body'].nil? ? d['fields']['body'] : 'n/a'\n summary.gsub!(re, '')\n article.summary = summary[0...126] + '...'\n\n article.image = !d['fields']['thumbnail'].nil? ? d['fields']['thumbnail'] : 'n/a'\n article\n end",
"def article_params\n params.require(:article).permit(:title, :description, :link, :date, :feed_id)\n end",
"def meta_author\n \"Ahmed Nadar\"\n end",
"def search_index_attribute_lookup\n attributes = super\n return if !attributes\n\n # collect article data\n # add tags\n tags = tag_list\n if tags.present?\n attributes[:tags] = tags\n end\n\n # list ignored file extensions\n attachments_ignore = Setting.get('es_attachment_ignore') || [ '.png', '.jpg', '.jpeg', '.mpeg', '.mpg', '.mov', '.bin', '.exe' ]\n\n # max attachment size\n attachment_max_size_in_mb = Setting.get('es_attachment_max_size_in_mb') || 10\n attachment_total_max_size_in_kb = 314_572\n attachment_total_max_size_in_kb_current = 0\n\n # collect article data\n articles = Ticket::Article.where(ticket_id: id).limit(1000)\n attributes['article'] = []\n articles.each do |article|\n\n # lookup attributes of ref. objects (normally name and note)\n article_attributes = article.search_index_attribute_lookup\n\n # remove note needed attributes\n ignore = %w[message_id_md5 ticket]\n ignore.each do |attribute|\n article_attributes.delete(attribute)\n end\n\n # index raw text body\n if article_attributes['content_type'] && article_attributes['content_type'] == 'text/html' && article_attributes['body']\n article_attributes['body'] = article_attributes['body'].html2text\n end\n\n # lookup attachments\n article_attributes['attachment'] = []\n if attachment_total_max_size_in_kb_current < attachment_total_max_size_in_kb\n article.attachments.each do |attachment|\n\n # check file size\n next if !attachment.content\n next if attachment.content.size / 1024 > attachment_max_size_in_mb * 1024\n\n # check ignored files\n next if !attachment.filename\n\n filename_extention = attachment.filename.downcase\n filename_extention.gsub!(/^.*(\\..+?)$/, '\\\\1')\n\n next if attachments_ignore.include?(filename_extention.downcase)\n\n attachment_total_max_size_in_kb_current += (attachment.content.size / 1024).to_i\n next if attachment_total_max_size_in_kb_current > attachment_total_max_size_in_kb\n\n data = {\n '_name' => attachment.filename,\n '_content' => Base64.encode64(attachment.content).delete(\"\\n\")\n }\n article_attributes['attachment'].push data\n end\n end\n attributes['article'].push article_attributes\n end\n\n attributes\n end",
"def build_post_from_entry(entry)\n text = entry.text.gsub(/\\\\u([0-9a-zA-Z]{4})/) { |s| [$1.to_i(16)].pack(\"U\") }\n self.posts.build(\n :service_action => Service::SERVICE_ACTION_POST,\n :identifier => entry.id.to_s,\n :title => text,\n :markup => Post::HTML_MARKUP,\n :summary => text,\n :url => \"#{self.profile_url}/status/#{entry.id}\",\n :published_at => entry.created_at.to_time,\n :extra_content => {\n :original_tags => self.search_for_hashtags(text) # array de tags\n }\n )\n end",
"def build_extra_attributes(object, object_builder)\n # Merge in existing author_id if user exists\n # Otherwise it will just use Leslie's ID\n if existing_user = AdminUser.where(username: self.dc).first\n object_builder[:author_id] = Bio.where(user_id: existing_user.id).first.id\n end\n\n # -------------------\n # Merge in Tags and Categories\n associations = [\n { name: :tags, class_name: \"WP::Tag\", \n records: self.categories.select { |c| c[:domain] == \"post_tag\" } },\n { name: :blog_categories, class_name: \"WP::Category\", \n records: self.categories.select { |c| c[:domain] == \"category\" } }\n ]\n\n associations.each do |assoc|\n assoc[:records].each do |stored_object|\n # Stored object is what gets stored with the post\n # It's a hash and just gives us the title and the slug\n \n # Tags and categories should all be in the cache\n # at this point.\n # xml_object should return a real object from cache.\n # eg., WP::Tag or WP::Category\n xml_object = assoc[:class_name].constantize.find.find do |real_obj| \n real_obj.send(assoc[:class_name].constantize.raw_real_map.first[1]) == \n stored_object[assoc[:class_name].constantize.raw_real_map.first[0]]\n end\n\n # If ar_record is present, use it. If not, import the tag.\n if xml_object.ar_record.present?\n assoc_obj = xml_object.ar_record\n else\n assoc_obj = xml_object.import\n end\n \n # Add the association object to the builder\n object.send(assoc[:name]).push assoc_obj\n end\n end\n \n \n # -------------------\n # Merge in Disqus thread ID (or nil)\n if dsq_meta = self.postmeta.find { |p| p[:meta_key] == \"dsq_thread_id\" }\n object.dsq_thread_id = dsq_meta[:meta_value]\n end\n \n object_builder[:content] = self.style_rules!\n \n return [object, object_builder]\n end",
"def initialize\n @blog_number=0\n @my_blogposts={}\n @time=Time.now\n end",
"def article_params\n\t params.require(:article).permit(:id, :title, :cover_img, :publisher, :description, :group, :language, :draft, :series, :file, :allow_comments, :publication_date, :featured, :author_ids, :publisher_ids, authors_attributes: [ :id, :name, :first_name, :last_name, :brief_biography ], publishers_attributes: [ :name, :id ])\n\t end",
"def entry_params\n params.require(:entry).permit(:title, :sub_title, :text, :pictures, :videos, :blog_id)\n end",
"def facebook_card\n tags = {\"og:type\" => \"article\",\n \"og:title\" => model.pretty_title,\n \"og:description\" => model.description,\n \"og:url\" => Rails.application.routes.url_helpers.blog_post_url(model),\n \"fb:app_id\" => SimpleBlog.fb_app_id}\n set_hash_meta_tags(tags, \"property\") + set_image_meta_tags(model.images, \"og:image\", \"property\")\n end",
"def feed\n # This is preliminary. See \"Following users\" for the full implementation.\n #The question mark ensures that id is properly escaped before being included in the underlying SQL query, \n #thereby avoiding a serious security hole called SQL injection. The id attribute here is just an integer, \n #so there is no danger in this case, but always escaping variables injected into SQL statements is a good habit to cultivate. \n Micropost.where(\"user_id = ?\", id)\n end",
"def show\n @sci = Post.limit(4).order('created_at ASC')\n @latest = Post.limit(6).order('created_at DESC')\n @popular2 = Post.limit(6).order(\"RANDOM()\")\n @footer = Post.limit(3).order('created_at DESC')\n @footer2 = Post.limit(3).order(\"RANDOM()\")\n @also = Post.limit(4).order(\"RANDOM()\")\n\n prepare_meta_tags(site: 'The Shedonist',\n title: @post.title,\n description: @post.body,\n image: @post.image,\n twitter: {card: \"summary_large_image\"})\n\n end",
"def columns\n Proc.new do\n <<-SQL\n id integer primary key autoincrement,\n sample_id integer, --foreign key to reference the original revision\n \n --these are all true contemporaneous of the edit, post or pre-edit may be different\n account_creation timestamp(20), --this should be the entry in the logevents call, but if we exceed the max number of requests, we won't get it\n account_lifetime integer, --this is the lifetime of the account in seconds\n edits_last_second integer, --want a figure to show recent activity do buckets instead\n edits_last_minute integer,\n edits_last_hour integer,\n edits_last_day integer,\n edits_last_week integer,\n edits_last_month integer,\n edits_last_year integer,\n total_edits integer,\n --rights_grant_count \n --rights_removal_count\n --groups string,\n FOREIGN KEY(sample_id) REFERENCES irc_wikimedia_org_en_wikipedia(id) --these foreign keys probably won't be enforced b/c sqlite doesn't include it by default--TODO this foreign table name probably shouldn't be hard coded\nSQL\n end\n end",
"def blog_params\n params.require(:blog).permit(\n :title,\n :teaser,\n :body,\n :user_id,\n :tag_list,\n :link_text,\n :link_filename,\n :optin,\n :optin_tags,\n :published,\n :published_at,\n :pillars_id,\n :image,\n :resource_id,\n pins: []\n )\n end",
"def entry_params\n params.require(:entry).permit(:feed_id, :atom_id, :title, :url, :content)\n end",
"def feed_comments\n # Following users\n following_user_ids = \"SELECT followed_id FROM relationships\n WHERE follower_id = :user_id\"\n # Following Tags\n following_tag_ids = \"SELECT tag_id FROM tag_follows\n WHERE user_id = :user_id\"\n # Following tag's items\n following_tag_item_ids = \"SELECT taggable_id FROM taggings WHERE taggable_type = 'Item' AND tag_id IN (#{following_tag_ids})\"\n # Create or Update items\n create_update_item_ids = \"SELECT id FROM items WHERE create_user_id = :user_id OR update_user_id = :user_id\"\n # Stocking items\n stocking_item_ids = \"SELECT item_id FROM item_stocks WHERE user_id = :user_id\"\n # Liking comments\n liking_comment_ids = \"SELECT comment_id FROM comment_likes WHERE user_id = :user_id\"\n # Liking comment's items\n liking_comment_item_ids = \"SELECT item_id FROM comments WHERE id IN (#{liking_comment_ids})\"\n # Commenting items\n comment_item_ids = \"SELECT item_id FROM comments WHERE user_id = :user_id\"\n\n Comment.includes([:user, :item]).where(\"user_id IN (#{following_user_ids})\n OR user_id = :user_id\n OR item_id IN (#{create_update_item_ids})\n OR item_id IN (#{stocking_item_ids})\n OR item_id IN (#{following_tag_item_ids})\n OR item_id IN (#{liking_comment_item_ids})\n OR item_id IN (#{comment_item_ids})\", user_id: id).limit(13)\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 fetch\n puts \"Fetching feed: #{self.feed_url}\"\n Feedzirra::Feed.add_common_feed_entry_element('georss:point', :as => :point)\n Feedzirra::Feed.add_common_feed_entry_element('geo:lat', :as => :geo_lat)\n Feedzirra::Feed.add_common_feed_entry_element('geo:long', :as => :geo_long)\n Feedzirra::Feed.add_common_feed_element('generator', :as => :generator)\n\n feed = Feedzirra::Feed.fetch_and_parse(self.feed_url)\n\n self.update_attributes(\n :title => feed.title,\n :url => feed.url,\n :description => feed.description,\n :generator => feed.generator,\n :last_fetched => DateTime.now\n )\n\n feed.entries.each do |e|\n \n if e.geo_lat && e.geo_long\n latlon = [e.geo_lat, e.geo_long]\n elsif e.point\n latlon = e.point.split(' ')\n else\n next\n end\n \n attrs = {\n :title => e.title,\n :url => e.url,\n :author => e.author,\n :summary => e.summary,\n :content => e.content,\n :published => e.published,\n :guid => e.id,\n :lon => latlon[1].to_f,\n :lat => latlon[0].to_f\n }\n \n # Create a new post or update an existing one\n post = Post.find_or_initialize_by_url(e.url)\n post.feed = self\n post.assign_attributes(attrs)\n post.save\n end\n end",
"def index\n #search query, check params for search then search by appropriate fields\n @q = Entry.all\n @author_id = params[:search][:author_id] if params[:search]\n @text = params[:search][:text] if params[:search]\n @q = Entry.search(@q, @text) if !@text.blank?\n @q = @q.where(author_id: params[:search][:author_id]) if !@author_id.blank?\n\n #final result and column toggle sort\n @entries = @q.paginate(:page => params[:page], :per_page => 30).includes(:author).order(sort_column + \" \" + sort_direction)\n end",
"def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend",
"def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend",
"def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend",
"def get_all_infos page, category\n list_items = page.search('.post')\n\n link = page.uri.to_s\n list_items.each_with_index{|item,index|\n # get all items in page -------------------\n content = item.at('.entry-content a').text\n author = item.at('.entry-author a').text\n record = {\n :category => category,\n :author => author,\n :conent => content\n }\n ScraperWiki.save_sqlite([], record)\n }\nend",
"def blog_params\n params.require(:blog).permit(:title, :content, :summary, :user_id, :title_image_url, :commentable)\n end",
"def insert_news(title,url,text,user, category=nil)\n # If we don't have an url but a comment, we turn the url into\n # text://....first comment..., so it is just a special case of\n # title+url anyway.\n textpost = url.length == 0\n if url.length == 0\n url = \"text://\"+text[0...CommentMaxLength]\n end\n # Check for already posted news with the same URL.\n unless textpost\n news_id = News.find_id_by_url url\n return news_id if news_id\n end\n news = News.create title, url, user, category\n return news.id\nend",
"def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source.content : 'n/a'\n article.author = (name[0..2] == 'By ') ? name.slice(3..name.size) : name\n\n article.link = !i.link.nil? ? i.link : 'n/a'\n article.summary = !i.description.nil? ? i.description : 'n/a'\n article.image = (!i.enclosure.nil? && i.enclosure.type == 'image/jpeg') ? i.enclosure.url : 'n/a' \n article\n end",
"def update!(**args)\n @additional_safesearch_stats = args[:additional_safesearch_stats] if args.key?(:additional_safesearch_stats)\n @auth_method = args[:auth_method] if args.key?(:auth_method)\n @bad_metadescription = args[:bad_metadescription] if args.key?(:bad_metadescription)\n @body_size = args[:body_size] if args.key?(:body_size)\n @body_title_languages = args[:body_title_languages] if args.key?(:body_title_languages)\n @boilerplate_metadescription = args[:boilerplate_metadescription] if args.key?(:boilerplate_metadescription)\n @color_detection_result = args[:color_detection_result] if args.key?(:color_detection_result)\n @content_type = args[:content_type] if args.key?(:content_type)\n @coupled_url = args[:coupled_url] if args.key?(:coupled_url)\n @coupled_url_encoding = args[:coupled_url_encoding] if args.key?(:coupled_url_encoding)\n @crawl_time = args[:crawl_time] if args.key?(:crawl_time)\n @crop_data = args[:crop_data] if args.key?(:crop_data)\n @data_version = args[:data_version] if args.key?(:data_version)\n @doc_version_id = args[:doc_version_id] if args.key?(:doc_version_id)\n @encoding = args[:encoding] if args.key?(:encoding)\n @fails_safe_search = args[:fails_safe_search] if args.key?(:fails_safe_search)\n @file_type_id = args[:file_type_id] if args.key?(:file_type_id)\n @foreign_metadescription = args[:foreign_metadescription] if args.key?(:foreign_metadescription)\n @fuzzy_metadescription = args[:fuzzy_metadescription] if args.key?(:fuzzy_metadescription)\n @google_label_data = args[:google_label_data] if args.key?(:google_label_data)\n @has_bad_ssl_certificate = args[:has_bad_ssl_certificate] if args.key?(:has_bad_ssl_certificate)\n @image_height = args[:image_height] if args.key?(:image_height)\n @image_license_info = args[:image_license_info] if args.key?(:image_license_info)\n @image_publisher = args[:image_publisher] if args.key?(:image_publisher)\n @image_size = args[:image_size] if args.key?(:image_size)\n @image_width = args[:image_width] if args.key?(:image_width)\n @indexing_ts = args[:indexing_ts] if args.key?(:indexing_ts)\n @ip = args[:ip] if args.key?(:ip)\n @ipaddr = args[:ipaddr] if args.key?(:ipaddr)\n @is_animated = args[:is_animated] if args.key?(:is_animated)\n @is_hosted_image = args[:is_hosted_image] if args.key?(:is_hosted_image)\n @is_porn = args[:is_porn] if args.key?(:is_porn)\n @is_roboted = args[:is_roboted] if args.key?(:is_roboted)\n @is_site_porn = args[:is_site_porn] if args.key?(:is_site_porn)\n @is_softporn = args[:is_softporn] if args.key?(:is_softporn)\n @language = args[:language] if args.key?(:language)\n @language_tag = args[:language_tag] if args.key?(:language_tag)\n @last_mod_time = args[:last_mod_time] if args.key?(:last_mod_time)\n @licensed_web_images_opt_in_state = args[:licensed_web_images_opt_in_state] if args.key?(:licensed_web_images_opt_in_state)\n @low_quality_metadescription = args[:low_quality_metadescription] if args.key?(:low_quality_metadescription)\n @meta_description_languages = args[:meta_description_languages] if args.key?(:meta_description_languages)\n @nearby_text = args[:nearby_text] if args.key?(:nearby_text)\n @noimageframeoverlayreason = args[:noimageframeoverlayreason] if args.key?(:noimageframeoverlayreason)\n @nsr_sitechunk = args[:nsr_sitechunk] if args.key?(:nsr_sitechunk)\n @partial_boilerplate_metadescription = args[:partial_boilerplate_metadescription] if args.key?(:partial_boilerplate_metadescription)\n @porn_stats = args[:porn_stats] if args.key?(:porn_stats)\n @quality_without_adjustment = args[:quality_without_adjustment] if args.key?(:quality_without_adjustment)\n @referrer_url = args[:referrer_url] if args.key?(:referrer_url)\n @relatedimages = args[:relatedimages] if args.key?(:relatedimages)\n @rootpage_duplicate_metadescription = args[:rootpage_duplicate_metadescription] if args.key?(:rootpage_duplicate_metadescription)\n @seen_noarchive = args[:seen_noarchive] if args.key?(:seen_noarchive)\n @seen_noindex = args[:seen_noindex] if args.key?(:seen_noindex)\n @seen_noodp = args[:seen_noodp] if args.key?(:seen_noodp)\n @seen_nopreview = args[:seen_nopreview] if args.key?(:seen_nopreview)\n @seen_nosnippet = args[:seen_nosnippet] if args.key?(:seen_nosnippet)\n @seen_notranslate = args[:seen_notranslate] if args.key?(:seen_notranslate)\n @shopping_attachment = args[:shopping_attachment] if args.key?(:shopping_attachment)\n @shopping_offers = args[:shopping_offers] if args.key?(:shopping_offers)\n @subindex = args[:subindex] if args.key?(:subindex)\n @thumb_height = args[:thumb_height] if args.key?(:thumb_height)\n @thumb_width = args[:thumb_width] if args.key?(:thumb_width)\n @thumbnail = args[:thumbnail] if args.key?(:thumbnail)\n @title = args[:title] if args.key?(:title)\n @union_build_time = args[:union_build_time] if args.key?(:union_build_time)\n @url = args[:url] if args.key?(:url)\n @url_after_redirects = args[:url_after_redirects] if args.key?(:url_after_redirects)\n @url_encoding = args[:url_encoding] if args.key?(:url_encoding)\n @visible_image = args[:visible_image] if args.key?(:visible_image)\n @visual_type = args[:visual_type] if args.key?(:visual_type)\n end"
] |
[
"0.5454667",
"0.5323727",
"0.5314784",
"0.52584106",
"0.5225491",
"0.5182719",
"0.51600033",
"0.5008293",
"0.50070024",
"0.49621317",
"0.49561638",
"0.495413",
"0.4951283",
"0.49498266",
"0.49483675",
"0.49440122",
"0.49397886",
"0.49390456",
"0.49389663",
"0.49353516",
"0.49301964",
"0.4927692",
"0.49205768",
"0.4918907",
"0.4913234",
"0.49073014",
"0.49066007",
"0.49036306",
"0.49023432",
"0.48948163",
"0.48854303",
"0.4883897",
"0.48697817",
"0.4846297",
"0.4839956",
"0.4828686",
"0.48260343",
"0.4820412",
"0.48143902",
"0.4806311",
"0.48026985",
"0.48019248",
"0.47817013",
"0.47711354",
"0.47567773",
"0.47468102",
"0.4744194",
"0.47430778",
"0.47415993",
"0.47387177",
"0.4734172",
"0.4733516",
"0.47290447",
"0.47281718",
"0.47280777",
"0.4721898",
"0.4719315",
"0.47190386",
"0.4716136",
"0.47158274",
"0.47154844",
"0.47133175",
"0.47124296",
"0.47044748",
"0.4693844",
"0.4688263",
"0.46805653",
"0.4679639",
"0.46739545",
"0.46618858",
"0.46597627",
"0.4655182",
"0.4654756",
"0.4654349",
"0.46475044",
"0.4640389",
"0.4633251",
"0.46332508",
"0.462766",
"0.46251497",
"0.46223006",
"0.46214402",
"0.4619009",
"0.46182558",
"0.46176386",
"0.46175182",
"0.46143952",
"0.46082214",
"0.4607952",
"0.46055454",
"0.46050763",
"0.4604885",
"0.46044406",
"0.46026498",
"0.46026498",
"0.46026498",
"0.46026498",
"0.46025166",
"0.46021852",
"0.45962754",
"0.45959607"
] |
0.0
|
-1
|
Challenge 2 Calculator Create a simple calculator that first asks the user what method they would like to use (addition, subtraction, multiplication, division) and then asks the user for two numbers, returning the result of the method with the two numbers. Here is a sample prompt: What calculation would you like to do? (add, sub, mult, div) add What is number 1? 3 What is number 2? 6 Your result is 9
|
def calculator
#ask user method
puts "What calculation would you like to do? (add, sub, mult, div)"
calc_type = gets.chomp
#ask for first number
puts "What is number 1? where result = num_1 operator num_2"
num_1 = gets.chomp
num_1 = num_1.to_f
#ask for second number
puts "What is number 2?"
num_2 = gets.chomp
num_2 = num_2.to_f
# do calculation using num_1, num_2, calc_type
if calc_type == "add"
result = num_1 + num_2
elsif calc_type == "sub"
result = num_1 - num_2
elsif calc_type == "mult"
result = num_1 * num_2
else
result = num_1.to_f / num_2.to_f
end
#return result
puts "#{result}"
return result
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def calculator()\n\n\tputs \"What kind of operation would you like to do - addition, substraction, multiplication, division\"\n\tchoice = gets.chomp\n\n\tputs \"What is number 1\"\n\tnum_1 = gets.chomp.to_f\n\n\tputs \"What is number 2\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase choice\n\t\twhen \"addition\"\n\t\t\ttotal = num_1 + num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\twhen \"substraction\"\n\t\t \ttotal = num_1 - num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\twhen \"multiplication\"\n\t\t \ttotal = num_1 * num_2\n\t\t\tputs \"Your result is #{total}\"\n\t\telse\n\t\t \ttotal = num_1 / num_2\n\t\t\tputs \"Your result is #{total}\"\n\tend\nend",
"def calculator \n valid_operations = [\"add\",\"+\",\"subtract\",\"-\",\"multiply\",\"*\",\"divide\",\"/\"]\n \n # ask user for math operations \n # check if operation is valid and if not ask for a new input \n puts \"What is the math operation?\"\n operation = gets.chomp.strip.downcase \n until valid_operations.include?(operation)\n puts \"Please enter a valid operation\"\n operation = gets.chomp\n end \n \n \n # ask user for numbers and input validation \n puts \"What is the first number for the math operation?\"\n number_one = gets.chomp.strip\n number_one = check_number(number_one)\n puts \"What is the seccond number for the math operation?\"\n number_two = gets.chomp.strip\n number_two = check_number(number_two)\n \n # use user input to do math operations \n if operation == \"add\" || operation == \"+\"\n result = number_one + number_two \n operation = \"+\"\n elsif operation == \"subtract\" || operation == \"subtract\"\n result = number_one - number_two \n operation = \"-\"\n elsif operation == \"multiply\" || operation == \"*\"\n result = number_one * number_two \n operation = \"*\"\n elsif operation == \"divide\" || operation == \"/\"\n result = number_one / number_two \n operation = \"/\"\n \n end \n \n \n # display result of calculation to user \n puts \" #{number_one} #{operation} #{number_two} = #{result}\"\nend",
"def arithmetic_ops\n puts \"Enter first number:\"\n num1 = gets.to_i\n puts \"Enter the second number:\"\n num2 = gets.to_i\n\n puts \"#{num1} + #{num2} = #{num1 + num2}\" \n puts \"#{num1} - #{num2} = #{num1 - num2}\" \n puts \"#{num1} * #{num2} = #{num1 * num2}\" \n puts \"#{num1} / #{num2} = #{num1 / num2}\" \n puts \"#{num1} % #{num2} = #{num1 % num2}\" \n puts \"#{num1} ** #{num2} = #{num1 ** num2}\"\n \nend",
"def basic_calculator\n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation.\"\n\tputs \"(a) is for addition\"\n\tputs \"(s) is for subtraction\"\n\tputs \"(d) is for division\"\n\tputs \"(m) is for multiplicaiton\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend",
"def basic_calculator \n\tputs \"Welcome to the basic calculator.\"\n\tputs \"Please select your operation:\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - subtraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum_1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum_2 = gets.chomp.to_f\n\n\tcase operation\n\twhen 'a'\n\t\tadd num_1, num_2\n\twhen 's'\n\t\tsubtract num_1, num_2\n\twhen 'd'\n\t\tdivide num_1, num_2\n\twhen 'm'\n\t\tmultiply num_1, num_2\n\tend\nend",
"def calculator()\n puts \"What would you like to do?\"\n res = gets.chomp\n puts \"First number\"\n first = gets.chomp.to_f\n puts \"Second number\"\n second = gets.chomp.to_f\n if res == \"add\"\n first += second\n elsif res == \"sub\"\n first -= second\n elsif res == \"mult\"\n first *= second\n elsif res == \"div\"\n first /= second\n else \"Please provide correct\"\n end\n puts \"Your result is %s\" % first\nend",
"def basic_calculator\n\tputs \"Welcome to the basic calculator\"\n\tputs \"Please select your operation\"\n\tputs \"(a) - addition\"\n\tputs \"(s) - substraction\"\n\tputs \"(d) - division\"\n\tputs \"(m) - multiplication\"\n\n\toperation = gets.chomp\n\tputs \"Enter your first number\"\n\tnum1 = gets.chomp.to_f\n\tputs \"Enter your second number\"\n\tnum2 = gets.chomp.to_f\n\n\tcase operation \n\twhen 'a'\n\t\tadd num1, num2\n\twhen 's'\n\t\tsubstract num1, num2\n\twhen 'd'\n\t\tdivide num1, num2\n\twhen 'm'\n\t\tmultiply num1, num2\n\tend\nend",
"def basic_calculator\n print \"Do you wish to add, subtract, multiply or divide?: \"\n operation = gets.chomp.downcase\n\n if operation == \"add\"\n formula\n puts (@first_num + @second_num)\n elsif operation == \"subtract\"\n formula\n puts (@first_num - @second_num)\n elsif operation == \"multiply\"\n formula\n puts (@first_num * @second_num)\n elsif operation == \"divide\"\n formula\n puts (@first_num / @second_num)\n else\n puts \"Invalid selection.\"\n end\n end",
"def calculator\n\tputs \"Would you like to use this calculator to 'add', 'subtract', 'multiply' or 'divide'?\"\n\n\tchoice = gets.chomp\n\n\tcase choice\n\t\twhen \"add\"\n\t\t\tputs \"What's your first number to add?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to add?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 + num2\n\t\t\tputs \"#{num1} + #{num2} = #{num3}\"\n\t\twhen \"subtract\"\n\t\t\tputs \"What's your first number to subtract?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to subtract?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 - num2\n\t\t\tputs \"#{num1} - #{num2} = #{num3}\"\n\t\twhen \"multiply\"\n\t\t\tputs \"What's your first number to multiply?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to multiply?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 * num2\n\t\t\tputs \"#{num1} * #{num2} = #{num3}\"\n\t\twhen \"divide\"\n\t\t\tputs \"What's your first number to divide?\"\n\t\t\tnum1 = gets.chomp.to_f\n\t\t\tputs \"What's your second number to divide?\"\n\t\t\tnum2 = gets.chomp.to_f\n\t\t\tnum3 = num1 / num2\n\t\t\tputs \"#{num1} / #{num2} = #{num3}\"\n\t\telse\n\t\t\tputs \"check yo spelling foo ... I said enter 'add', 'subtract', 'multiply' or 'delete':\"\n\t\t\tcalculator\n\tend\nend",
"def calculator\n\tputs \"Hello and welcome to the calculator. If you do not want to use this application, type exit and click the return key\"\n\tputs \"Would you like to add, subtract, multiply, divide, or use exponents?\"\n\tanswer = gets.chomp\n\tif answer == \"multiply\"\n\t\tmultiplication\n\telsif answer == \"add\"\n\t\taddition\n\telsif answer == \"divide\"\n\t\tdivision\n\telsif answer == \"subtract\"\n\t\tsubtraction\n\telsif answer == \"exponents\"\n\t\texponents\n\telse\n\t\tputs \"I am sorry, that is not a computation. Try re-wording what you said and try again.\"\n\tend\nend",
"def calculator(num1, num2)\n\treturn num1 + num2, num1 - num2, num1 * num2, num1 / num2\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n option_2 = gets.chomp.downcase\n\n if option_2 == \"a\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to add: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} + #{number_2} = #{number_1 + number_2}\"\n elsif option_2 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to subtract: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} - #{number_2} = #{number_1 - number_2}\"\n elsif option_2 == \"m\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to multiply: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} x #{number_2} = #{number_1 * number_2}\"\n elsif option_2 == \"d\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter a second number to divide: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ÷ #{number_2} = #{number_1 / number_2}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend",
"def calculator\n end_op = \"addition\"\n end_product = 0\n puts \"What is your first number?\"\n numb1 = gets.chomp.to_f\n puts \"What is your operation?\"\n op = gets.chomp\n puts \"What is your second number?\"\n numb2 = gets.chomp.to_f\n puts \"Would you like to add an operation?\"\n add_second = gets.chomp.capitalize\n if add_second.upcase == \"YES\"\n puts \"What is your operation?\"\n op2 = gets.chomp\n puts \"What is your third number?\"\n numb3 = gets.chomp.to_f\n# calculator\n else\n end\n\n # This is normalizing the input, so that the operation is only the lowercase word of the op\n if op == \"+\" || op == \"addition\"\n end_op = \"addition\"\n elsif op == \"-\" || op == \"subtraction\"\n end_op = \"subtraction\"\n elsif op == \"*\" || op == \"multiplication\"\n end_op = \"multiplication\"\n elsif op == \"/\" || op == \"division\"\n end_op = \"division\"\n end\n\n # This does the same as the above section, for the 2nd op\n if op2 == \"+\" || op == \"addition\" || op == \"ADDITION\"\n end_op2 = \"addition\"\n elsif op2 == \"-\" || op == \"subtraction\" || op == \"SUBTRACTION\"\n end_op2 = \"subtraction\"\n elsif op2 == \"*\" || op == \"multiplication\" || op == \"MULTIPLICATION\"\n end_op2 = \"multiplication\"\n elsif op2 == \"/\" || op == \"division\" || op == \"DIVISION\"\n end_op2 = \"division\"\n end\n\n # This operates the first 2 numbers\nif end_op == \"addition\"\n end_product = numb1 + numb2\n elsif end_op == \"subtraction\"\n end_product = numb1 - numb2\n elsif end_op == \"multiplication\"\n end_product = numb1 * numb2\n elsif end_op == \"division\"\n end_product = numb1 / numb2\nend\n\n # This calculates for the 2nd operation and 3rd number\n if add_second.upcase == \"YES\"\n if end_op2 == \"addition\"\n end_product = end_product + numb3\n elsif end_op2 == \"subtraction\"\n end_product = end_product - numb3\n elsif end_op2 == \"multiplication\"\n end_product = end_product * numb3\n elsif end_op2 == \"division\"\n end_product = end_product / numb3\n else\nend\nend\n puts \"Your final answer is #{end_product}.\"\nend",
"def basic_calc\n puts Rainbow(\"(a)dd, (s)ubtract, (m)ultiply, (d)ivide\").yellow.inverse\n arithmetic_type = gets.chomp.downcase\n\n case arithmetic_type\n \n when 'a' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 + response_2\n puts \"#{response_1}+#{response_2} = #{result}\"\n\n when 's' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 - response_2\n puts \"#{response_1}-#{response_2} = #{result}\"\n when 'm' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 * response_2\n puts \"#{response_1}*#{response_2} = #{result}\"\n when 'd' \n puts \"whats your first number?\"\n response_1 = gets.strip.to_f \n puts \"whats your second number?\"\n response_2 = gets.strip.to_f\n result = response_1 / response_2\n puts \"#{response_1}/#{response_2} = #{result}\"\n\nend\nend",
"def calculator_1(operator, num1, num2)\n # See exercise 36\nend",
"def basic_calculator\n puts \"Welcome to the basic calculator\"\n puts \"Please select your operation\"\n puts \"(a) - addition\"\n puts \"(s) - subtraction\"\n puts \"(d) - division\"\n puts \"(m) - multiplication\"\n\n operation = gets.chomp\n puts \"Enter your first number\"\n num1 = gets.chomp.to_f\n puts \"Enter your second number\"\n num2 = gets.chomp.to_f\n\n case operation\n when 'a'\n add num1, num2\n when 's'\n subtract num1, num2\n when 'd'\n divide num1, num2\n when 'm'\n multiply num1, num2\n end\nend",
"def basic_calc\n puts \"Give me two numbers\"\n print \"> first:\"\n first = gets.chomp.to_i\n print \"> second:\"\n second = gets.chomp.to_i\n\n #print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide:\"\n case $selection\n when \"add\"\n puts \"\\nanswer: #{first + second}\"\n when \"subtract\"\n puts \"\\nanswer: #{first - second}\"\n when \"multiply\"\n puts \"\\nanswer: #{first * second}\"\n when \"divide\"\n puts \"\\nanswer: #{first.to_f / second.to_f} \"\n else\n puts \"\\nOh crap...how'd that happen...\"\n puts \"I guess you never told me what maths to do...EMBARASSING\\n\\n\"\n end\n\nend",
"def basic_calc\n print Rainbow(\"\\n(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \\n\").yellow\n basic_choice = gets.chomp.downcase\n\n print \"\\nEnter your first number: \" \n first_number = gets.to_f\n print \"\\nEnter your second number: \"\n second_number = gets.to_f\n\n\n case basic_choice[0]\n when \"a\"\n print \"\\n\\t#{first_number} + #{second_number} = \", first_number + second_number, \"\\n\"\n when \"s\"\n print \"\\n\\t#{first_number} - #{second_number} = \", first_number - second_number, \"\\n\"\n when \"m\"\n print \"\\n\\t#{first_number} * #{second_number} = \", first_number * second_number, \"\\n\"\n when \"d\"\n print \"\\n\\t#{first_number} / #{second_number} = \", first_number / second_number, \"\\n\"\n else Rainbow(\"\\nYou're doing it wrong!\".upcase).red\n end\n gets\nend",
"def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \ngets\nend",
"def calculations (operator, num1, num2)\n case operator\n when \"addition\", \"add\", \"+\"\n results = num1 + num2\n puts \"Your answer is: \" + results.to_s\n when \"subtraction\", \"subtract\", \"-\"\n results = num1 - num2\n puts \"Your answer is: \" + results.to_s\n when \"multiplication\", \"multiply\", \"*\"\n results = num1 * num2\n puts \"Your answer is: \" + results.to_s\n when \"division\", \"divide\", \"/\"\n #check to see if user is trying to divide by 0\n if num2 == 0\n #if num2 is 0, then tell user, not possible. That's rude and exit program. \n puts \"Looks like you're trying to divide by 0. You know that's mean. BYE BYE FELICIA!\"\n exit \n #else calculate \n results = num1 / num2\n puts \"Your answer is: \" + results.to_s\n end \n end \nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n function = gets.chomp.downcase\n return 'q' if function == 'q'\n\n print \"Enter first number: \"\n num_1 = gets.chomp.to_i\n\n answer = 0\n\n \n case function \n when \"a\"\n puts \"Enter the second number\"\n add_num = gets.chomp.to_i\n answer = num_1 + add_num\n when \"s\"\n puts \"Enter the second number\"\n sub_num = gets.chomp.to_i\n answer = num_1 - sub_num\n when \"m\"\n puts \"Enter the second number\"\n multi_num = gets.chomp.to_i\n answer = num_1 * multi_num\n when \"d\"\n puts \"Enter the second number \"\n divide_num = gets.chomp.to_i\n answer = num_1 / divide_num\n else\n puts \"Wrong!\"\n end\n\n print \"The answer equals: #{answer}\"\n\nend",
"def calc\n# print \"Please select (a)dd, (s)ubtract, (m)ultiply, (d)ivide, (p)ower, or (s)quare root: \"\n# operation = gets.chomp.downcase\n case response\n when \"a\"\n \tputs \"You have selected addition. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 + num2\n \tputs \"#{num1} plus #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected subtraction. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 - num2\n \tputs \"#{num1} minus #{num2} equals #{ans}.\"\n when \"m\"\n \tputs \"You have selected multiplication. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 * num2\n \tputs \"#{num1} multiplied by #{num2} equals #{ans}.\"\n when \"d\"\n \tputs \"You have selected division. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the second number: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1 / num2\n \tputs \"#{num1} divided by #{num2} equals #{ans}.\"\n when \"p\"\n \tputs \"You have selected power. Please enter the first number: \"\n \tnum1 = gets.chomp.to_f\n \tputs \"Please enter the power which you would like that to be raised: \"\n \tnum2 = gets.chomp.to_f\n \tans = num1**num2\n \tputs \"#{num1} to the power of #{num2} equals #{ans}.\"\n when \"s\"\n \tputs \"You have selected square root. Please enter the number you would like to know the square root of: \"\n \tnum1 = gets.chomp.to_f\n \tans = Math.sqrt(num1)\n \tputs \"The square root of #{num1} equals #{ans}.\"\n else\n \tputs \"Please try again.\"\n \tcalc\n end\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n case command\n when \"a\"\n puts \"Adding, please provide numbers\"\n first_num = inputs\n answer = inputs + first_num\n when \"s\"\n puts \"Subtracting\"\n first_num = inputs\n answer = first - inputs\n when \"m\"\n puts \"Multiplication\"\n first_num = inputs\n answer = first_num * inputs\n when \"d\"\n puts \"Division\"\n first_num = inputs\n answer = first_num/inputs\n else\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n command = gets.chomp.downcase\n end\n return answer\nend",
"def basic_calc\n\n\n print Rainbow(\"(a)\").green + \"dd, \" + Rainbow(\"(s)\").yellow + \"ubtract, \" + Rainbow(\"(m)\").red + \"ultiply, \" + Rainbow(\"(d)\").cyan + \"ivide: \"\n basic_function = gets.chomp.downcase\n print \"Enter first number: \"\n first_number = gets.chomp.to_f\n print \"Enter second number: \"\n second_number = gets.chomp.to_f\n case basic_function\n when \"a\"\n answer = first_number + second_number\n puts \"Your answer is #{answer}\"\n when \"s\"\n answer = first_number - second_number\n puts \"Your answer is #{answer}\"\n when \"m\"\n answer = first_number * second_number\n puts \"Your answer is #{answer}\"\n when \"d\"\n answer = first_number / second_number\n puts \"Your answer is #{answer}\"\n \n else\n puts \"incorrect\"\n end \n gets\n menu\nend",
"def calculator\n puts \"Welcome to the DPL Ruby Calculator!\"\n puts \"Type 'clear' to clear the calculator at anytime\"\n puts \"Type 'exit' to exit the calculator at anytime\"\n first_number\n get_modifier\n second_number\n put_result \nend",
"def calculator_method(number_one, operator, number_two)\n if operator == \"+\"\n return result = number_one + number_two\n elsif operator == \"-\"\n return result = number_one - number_two\n elsif operator == \"*\"\n return result = number_one * number_two\n else operator == \"/\"\n return result = number_one / number_two\n end\nend",
"def question\nputs 'Would you like to [concatenate] or [randomize], [multiply] or [divide]?'\n\noperator = gets.chomp\n\nif operator == 'add' \n answer = firstNumber + secondNumber\n puts answer \n \nelsif operator == 'subtract'\n \n\n answer = firstNumber - secondNumber\n puts answer\n\nelsif operator == 'multiply'\n\nanswer = firstNumber * secondNumber\nputs answer\n\nelsif operator == 'divide'\n\nanswer = firstNumber / secondNumber\nputs answer\n\nend\nend",
"def basic_calc\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n basic = gets.chomp.downcase\n\n get_two_numbers\n\n case basic\n when \"a\"\n \tputs addition($num1, $num2)\n when \"s\"\n \tputs subtraction($num1, $num2)\n when \"m\"\n \tputs multiplication($num1, $num2)\n when \"d\"\n \tputs division($num1, $num2)\n end\n\nend",
"def calc(num1, mathop, num2)\n if mathop == \"+\"\n return num1 + num2\n elsif mathop == \"-\"\n return num1 - num2\n elsif mathop == \"*\"\n return num1 * num2\n elsif mathop == \"/\"\n return num1 / num2\n else\n return \"I did not recognize your input, please try again.\"\n end\nend",
"def doMath(num1, num2, operator)\n # puts \"#{num1} #{operator} #{num2} \"\n case operator\n when \"+\"\n answer = num1 + num2\n when \"-\"\n answer = num1 - num2\n when \"*\"\n answer = num1 * num2\n when \"/\"\n answer = num1 / num2\n else\n answer = nil\n end\n # puts answer\n return answer\nend",
"def calculation(choice, num1, num2)\n\n if choice == \"add\"\n return num1 + num2\n\n elsif choice == \"subtract\"\n return num1 - num2\n\n elsif choice == \"multiply\"\n return num1 * num2\n\n elsif choice == \"divide\"\n return num1 / num2\n\n elsif choice == \"exponent\"\n return num1 ** num2\n\n elsif choice == \"square\"\n return Math.sqrt(num1)\n end\nend",
"def mathy\n print \"what is the first number?\"\n first = gets.chomp.to_i\n\n print \"what is the second number\"\n second = gets.chomp.to_i\n\n puts \"\\n #{first} + #{second} = #{first + second}\\n\n #{first} - #{second} = #{first - second} \\n\n #{first} * #{second} = #{first * second} \\n\n #{first} / #{second} = #{first / second}\"\nend",
"def calculator(op, num1, num2)\n if op == \"add\" || op == \"+\" || op == \"addition\"\n return num1 + \" + \" + num2 + \" = #{add(num1.to_i, num2.to_i)}\"\n elsif op == \"subtract\" || op == \"-\" || op == \"subtraction\"\n return num1 + \" - \" + num2 + \" = #{sub(num1.to_i, num2.to_i)}\"\n elsif op == \"multiply\" || op == \"*\" || op == \"multiplication\"\n return num1 + \" * \" + num2 + \" = #{mult(num1.to_i, num2.to_i)}\"\n elsif op == \"divide\" || op == \"/\" || op == \"division\"\n return num1 + \" / \" + num2 + \" = #{div(num1.to_i, num2.to_i)}\"\n elsif op == \"modulo\" || op == \"remainder\" || op == \"%\"\n return num1 + \" % \" + num2 + \" = #{mod(num1.to_i, num2.to_i)}\"\n else op == \"exponent\" || op == \"^\"\n return num1 + \"^\" + num2 + \" = #{exponent(num1.to_i, num2.to_i)}\"\n end\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n operation = gets.chomp.downcase\n print \"first number: \"\n a = gets.to_f\n print \"second number: \"\n b = gets.to_f\n \n case operation\n when 'a'\n puts \"#{a + b}\"\n when 's'\n puts \"#{a - b}\"\n when 'm'\n puts \"#{a * b}\"\n when 'd'\n puts \"#{a / b}\"\n else\n puts \"WRONG!!!!!\"\n basic_calc\n end\n\n gets\nend",
"def advanced_calc\n puts \"You chose advanced calculator, which operator would you like to use? type 'P' for power or 'S' for square-root? \"\n operator = gets.chomp()\n\n case operator\n when \"P\"\n puts \"Choose your base number? \"\n num1 = gets.chomp()\n puts \"Choose your exponential number? \"\n num2 = gets.chomp()\n sum = (num1.to_f) ** num2.to_f\n puts \"Your answer is #{sum}\"\n display_calculator\n\n when \"S\"\n puts \"Choose your number? \"\n x = gets.chomp().to_f\n if (x < 0)\n puts \"Error, you cannot divide by a negative number\"\n display_calculator\n elsif (x >= 0)\n sum = Math.sqrt(x)\n puts \"Your answer is #{sum}\"\n display_calculator\n end\n end\nend",
"def calculator(number1, number2, operation)\n case operation\n when \"A\"\n number1 + number2\n when \"S\"\n number1 - number2\n when \"M\"\n number1 * number2\n when \"D\"\n divide_integers(number1, number2)\n else\n \"Unknown operation. Giving up.\"\n end\nend",
"def calculate(operator, num1, num2)\n # Use case when to invoke each method\n case operator\n when \"add\", \"+\"\n puts \"#{num1} + #{num2} = #{add(num1, num2)}\"\n # Do I need a return here\n when \"subtract\", \"-\"\n puts \"#{num1} - #{num2} = #{subtract(num1, num2)}\"\n when \"multiply\", \"*\"\n puts \"#{num1} * #{num2} = #{multiply(num1, num2)}\"\n when \"divide\", \"/\"\n puts \"#{num1} / #{num2} = #{divide(num1, num2)}\"\n when \"modulo\", \"%\"\n puts \"#{num1} % #{num2} = #{mod(num1, num2)}\"\n when \"exponify\", \"**\"\n puts \"#{num1}^#{num2} = #{exponify(num1, num2)}\"\n end\nend",
"def calculator_method(operator, number_1, number_2)\n case operator\n when \"add\"\n total = number_1 + number_2\n when \"+\"\n total = number_1 + number_2\n when \"subtract\"\n total = number_1 - number_2\n when \"-\"\n total = number_1 - number_2\n when \"multiply\"\n total = number_1 * number_2\n when \"x\"\n total = number_1 * number_2\n when \"*\"\n total = number_1 * number_2\n when \"divide\"\n total = number_1.to_f / number_2.to_f\n when \"/\"\n total = number_1.to_f / number_2.to_f\n end\n return total\nend",
"def basic_calc\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n basic_functions = gets.chomp\n while basic_functions != \"quit\"\n if basic_functions == \"a\"\n puts \"Enter first number\"\n add1_int = gets.chomp\n puts \"Enter second number\"\n add2_int = gets.chomp\n puts \"Equals\"\n puts add1_int + add2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n end\n if basic_functions == \"s\"\n puts \"Enter first integer\"\n sub1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n sub2_int = gets.chomp.to_i\n puts \"Equals\"\n puts sub1_int - sub2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n end\n if basic_functions == \"m\"\n puts \"Enter first integer\"\n mult1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n mult2_int = gets.chomp.to_i\n puts \"Equals\"\n puts mult1_int * mult2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n\n end\n if basic_functions == \"d\"\n puts \"Enter first integer\"\n div1_int = gets.chomp.to_i\n puts \"Enter second integer\"\n div2_int = gets.chomp.to_i\n puts \"Equals\"\n puts div1_int / div2_int\n puts \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: enter a, s, m, or d; quit to quit\"\n puts basic_functions = gets.chomp\n\n end\n end\nend",
"def calculator num1, operator, num2\n # Our 'if' statement checks to see if we have found the string of plus or minus and uses the according operator.\n if operator == \"plus\"\n return num1 + num2\n else\n return num1 - num2\n end\n end",
"def print_choices\n # A user should be able to enter numbers to perform the operation on\n puts \"========================\"\n puts \"Input number 1 please:\"\n @number_one = gets.chomp.to_i\n puts \"Input number 2 please:\"\n @number_two = gets.chomp.to_i\n puts \"\"\n puts \"What do you want to do with the numbers?\"\n # Calculator should be able to do basic arithmetic (+,-, *, /)\n puts \"1 - addition\"\n puts \"2 - subtraction\"\n puts \"3 - division\"\n puts \"4 - multiplication\"\n puts \"5 - quit\"\n gets.chomp.to_i\nend",
"def calculator(a,b)\n puts \"The sub of #{a} and #{b} is #{a + b}\"\n puts \"The difference of #{a} and #{b} is #{a - b}\"\n puts \"The multiplication of #{a} and #{b} is #{a * b}\"\n end",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n basic_menu_choice = gets.chomp.downcase\n\n if basic_menu_choice == 'a'\n \tputs \"Enter the first number you want to add:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to add:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} + #{y} = #{x + y}\"\n\n elsif basic_menu_choice== 's'\n \tputs \"Enter the first number you want to subtract:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to subtract:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} - #{y} = #{x - y}\"\n\n elsif basic_menu_choice == 'm'\n \tputs \"Enter the first number you want to multiply:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to multiply:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} x #{y} = #{x * y}\"\n\n elsif basic_menu_choice == 'd'5\n \tputs \"Enter the first number you want to divide:\"\n \tx = gets.chomp.to_i\n \tputs \"Enter the second number you want to divide by:\"\n \ty = gets.chomp.to_i\n \tputs \"#{x} / #{y} = #{x / y}\"\n\n else\n \tputs \"Invalid selection\"\n end\nend",
"def basic_calc ()\n print \"Please choose from the following options:\n(a)dd, (s)ubtract, (m)ultiply, (d)ivide, (r)eturnt to main menu : \"\n basic_menu_request = gets.chomp.downcase\n case basic_menu_request\n when \"a\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first + second\n puts \"The answer is #{answer}\"\n when \"s\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first - second\n puts \"The answer is #{answer}\"\n when \"m\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first * second\n puts \"The answer is #{answer}\"\n when \"d\"\n print \"What is the first number? \"\n first = gets.chomp.to_f\n print \"What is the second number? \"\n second = gets.chomp.to_f\n answer = first / second\n puts \"The answer is #{answer}\"\n when \"r\"\n puts menu\n else\n print \"That is not a valid command. \"\n puts basic_calc\n end\n\nend",
"def calculator(operator_active, num1, num2)\n case operator_active\n when \"+\"\n return num1 + num2\n when \"-\"\n return num1 - num2\n when \"*\"\n return num1 * num2\n when \"/\"\n return num1 / num2\n end\nend",
"def calculate_answer(operator, a, b)\r\n\r\n if operator == \"add\"\r\n return result= a + b\r\n elsif operator == \"subtract\"\r\n return result = a - b\r\n elsif operator == \"multiply\"\r\n return result = a * b\r\n elsif operator == \"divide\"\r\n return result = a / b\r\n\r\n end\r\n\r\nend",
"def calculator(operation, num1, num2)\n \n if [\"+\", \"-\", \"*\" , \"/\"].include?(operation)\n num1.method(operation).(num2)\n else\n puts \"Invalid operation!\"\n nil\n end\nend",
"def addition\nprint \"What is your first number? \"\nfirst_num = gets().to_i\n\nprint \"What is the second number? \"\nsecond_num = gets().to_i\n\nresult = first_num + second_num\nputs \"#{first_num} + #{second_num} = #{result}\"\nend",
"def basic_calc\n\tprint \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide:\" \n\tuser_input = gets.chomp\nif user_input == \"a\"\n\tadd\nelsif user_input == \"s\"\n\tsubtract\nelsif user_input == \"m\"\n\tmultiply\nelsif user_input == \"d\"\n\tdivide\n\tend\nend",
"def do_math(num1, num2)\n prompt_string = PROMPT + \" 1)add 2)subtract 3)multiply 4)divide\"\n puts prompt_string\n action = gets.chomp\n \n # boolean flag to determine if we need to continue\n # in the loop or drop out. false continues\n done = false\n \n # loop until the user performs a valid action or enters 'q' to quit\n # provides Infinity or -Infinity as appropriate for division by zero\n begin\n case action\n when '1'\n puts PROMPT + \"#{num1} added to #{num2} = \" + (num1 + num2).to_s\n done = true\n when '2'\n puts PROMPT + \"#{num1} minus #{num2} = \" + (num1 - num2).to_s\n done = true\n when '3'\n puts PROMPT + \"#{num1} times #{num2} = \" + (num1 * num2).to_s\n done = true \n when '4' #watch out for divide by zero\n if( (num2 == 0 || num2 == 0.0) && num1 >= 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = Infinity\"\n elsif( (num2 == 0 || num2 == 0.0) && num1 < 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = -Infinity\"\n elsif( (num1%num2) != 0 )\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2.to_f).to_s\n else\n puts PROMPT + \"#{num1} divided by #{num2} = \" + (num1/num2).to_s\n end\n done = true\n when 'q'\n puts PROMPT + \" Bye.\"\n exit\n else\n puts PROMPT + \"Invalid operation selected. Please try again or [q] to quit\"\n puts prompt_string\n action = gets.chomp\n end\n end while done == false\nend",
"def basic_calc\n print Rainbow(\"\\n(a)\").white+Rainbow(\"dd \").green+Rainbow(\"(s)\").white+Rainbow(\"ubtract \").green+Rainbow(\"(m)\").white+Rainbow(\"ultiply \").green+Rainbow(\"(d)\").white+Rainbow(\"ivide \").green\n choice = gets.chomp.to_s\n print Rainbow(\"\\nfirst number: \").blue\n first = gets.chomp.to_f\n print Rainbow(\"second number: \").blue\n second = gets.chomp.to_f\n case choice[0].downcase\n when \"a\"\n print Rainbow(\"\\n#{first} + #{second} = \").blue + Rainbow(\"#{first + second}\\n\\n\").white\n when \"s\"\n print Rainbow(\"\\n#{first} - #{second} = \").blue + Rainbow(\"#{first - second}\\n\\n\").white\n when \"m\"\n print Rainbow(\"\\n#{first} 8 #{second} = \").blue + Rainbow(\"#{first * second}\\n\\n\").white\n when \"d\"\n print Rainbow(\"\\n#{first} / #{second} = \").blue + Rainbow(\"#{(first / second).rounf(5)}\\n\\n\").white\n when \"q\"\n menu\n else \n print Rainbow(\"\\nYou are doing it \").green + Rainbow(\"WRONG\\n\").red\n basic_calc\n end\nend",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n choice = gets.chomp\n case\n when choice == \"a\"\n puts \"What would you like to add?\"\n print \"First number: \"\n num1 = gets.chomp.to_f\n print \"Ok, now the second number: \"\n num2 = gets.chomp.to_f\n puts \"Your maths equal #{num1 + num2}\"\n menu\n when choice == \"s\"\n puts \"What would you like to subtract?\"\n print \"First number: \"\n num1 = gets.chomp.to_f\n print \"Ok, now the second number: \"\n num2 = gets.chomp.to_f\n puts \"Your maths equal #{num1 - num2}\"\n menu\n when choice == \"m\"\n puts \"What would you like to multiply?\"\n print \"First number: \"\n num1 = gets.chomp.to_f\n print \"Ok, now the second number: \"\n num2 = gets.chomp.to_f\n puts \"Your maths equal #{num1 * num2}\"\n menu\n when choice == \"d\"\n puts \"What would you like to divide?\"\n print \"First number: \"\n num1 = gets.chomp.to_f\n print \"Ok, now the second number: \"\n num2 = gets.chomp.to_f\n puts \"Your maths equal #{num1 / num2}\"\n menu\n end\nend",
"def add\n # ask for some inputs, after some text.\n # turn those inputs into a float, and saves it in some variable.\n print \"What is your first number?\"\n first_number = gets.to_f\n\n print \"What is your second number?\"\n second_number = gets.to_f\n\n # add the two inputs given together and save the result.\n result = first_number + second_number\n\n # Print these things out ot the screen\n puts \"The result is #{result}\"\nend",
"def calculate_answer(operator, a, b)\n if operator == \"add\"\n a + b \n elsif operator == \"subtract\"\n a - b\n elsif operator == \"multiply\"\n a * b\n elsif operator == \"divide\"\n a / b\n elsif operator == \"exponent\"\n a ** b\n elsif operator == \"modulus\"\n a % b\n end\nend",
"def calculate_answer(operator, a, b)\n\n if operator == \"add\"\n return result= a + b\n elsif operator == \"subtract\"\n return result = a - b\n elsif operator == \"multiply\"\n return result = a * b\n elsif operator == \"divide\"\n return result = a / b\n\nend",
"def add\n #ask for some inputs , after some text\n #turn those inputs into a float, and save it in some variable\n print \"what is your first number? \"\n first_number = gets.to_f\n print \"what is your second number? \"\n second_number = gets.to_f\n # Add the two inputs given togrther and save the result\n result = first_number + second_number\n #print\n puts \"The result is #{result}\"\nend",
"def add\n# ask for some input , after the text\n#turn those input into a float . and saves it in some variable\n print 'what is your first number?'\n first_number = gets.to_f\n print 'what is your second number?'\n second_number = gets.to_f\n\n # add the two inputs given together and save result\n result = first_number + second_number\n\n# pritn these things out\n puts \"The result is #{result}\"\nend",
"def add()\n puts \"{what numbers do yu want to add?\"\n num1 = gets.chomp\n num2 = gets.chomp\n result =@num1 + @num2\n puts \"your answer is {result = @num1 + @num2}\"\n end",
"def calculator\n\n keep_looping = true\n result = nil\n first_number = nil\n second_number = nil\n \n while keep_looping\n begin\n if result\n puts \"Result: #{result}\"\n first_number = result\n else\n \n puts \"First Number:\"\n first_number = gets.strip.to_f\n end\n puts \"Modifier ( + - * / ) or clear:\"\n modifier = gets.strip\n if modifier == 'clear'\n result = nil\n redo\n end\n \n puts \"Second Number:\"\n second_number = gets.strip.to_f\n end until result = get_result(first_number, modifier, second_number)\n end\n end",
"def addition(input_number1, input_number2)\n\tsum = input_number1 + input_number2\n\tputs \"The sum of #{input_number1} and #{input_number2} is #{sum}\"\n\tputs \"Thank you for using the calculator. Goodbye!\"\nend",
"def prompt\n unless @type == 2\n puts \"What is #{@num_1} #{@operator} #{@num_2}?\"\n else\n puts \"What is #{@num_1 * (@num_2 + 1)} divided by #{@num_2 + 1}?\"\n end\n end",
"def calc()\n\tputs \"Calculator:\"\n\tcalculate = true\n\twhile calculate == true\n\t\tfirst_num = input_num()\n\t\tputs \"> #{first_num}\"\n\t\toperator = input_operator()\n\t\tputs \"> #{first_num} #{operator}\"\n\t\tsecond_num = input_num()\n\t\tputs \"> #{first_num} #{operator} #{second_num}\"\n\t\t\n\t\tif operator == \"+\"\n\t\t\tadd(first_num, second_num)\n\t\telsif operator == \"-\"\n\t\t\tsubtract(first_num, second_num)\n\t\telsif operator == \"*\"\n\t\t\tmultiply(first_num, second_num)\n\t\telsif operator == \"/\" && second_num == 0\n\t\t\tputs \"Division by zero is undefined\"\n\t\telsif operator == \"/\"\n\t\t\tdivide(first_num, second_num)\n\t\telse\n\t\t\tputs \"Error\"\n\t\tend\n\t\tcalculate = leave?()\n\tend\nend",
"def addition\n print \"What is your first number? \"\n first_num = gets().to_i\n\n print \"What is your second number? \"\n second_num = gets().to_i\n\n result = first_num + second_num\n puts \"#{first_num} + #{second_num} = #{result}\"\nend",
"def add\n print \"What is the first number? \"\n first_number = gets.to_f\n\n print \"What is the second number? \"\n second_number = gets.to_f\n\n result = first_number + second_number\n\n puts \"The results is #{result}.\"\nend",
"def add\n# nums()\n puts \"\"\n puts \"What is your first number?\"\n first_num = gets.chomp.to_f\n\n puts \"What is your second number?\"\n second_num = gets.chomp.to_f\n\n result = first_num + second_num\n puts \"#{first_num} + #{second_num} = #{result}\"\nend",
"def single_input_calc\n puts \"What would you like to calculate? - enter first number then operator then second number.\"\n to_calc = gets.strip\n arr = to_calc.split\n first_num = arr[0].to_i\n op = arr[1].to_s\n second_num = arr[2].to_i\n string_result = first_num.public_send(op, second_num)\n puts \"The result is: #{string_result}\"\n @arr_results << {first_number: first_num, modifier: op, second_number: second_num, result: string_result}\n end",
"def menu\n puts \"______Calculator_______\"\n puts \"\\t1) Enter first number\"\n puts \"\\t2) Enter modifier\"\n puts \"\\t3) Enter second number\"\n puts \"\\t4) The result is:\"\n return gets.strip.to_i\nend",
"def do_math_1\r\n puts \"Let's do some simple arithmetic! How much is 1 + 1?\"\r\n answer = gets.chomp.to_i\r\n\r\n if answer == 2\r\n puts \"Great job!\"\r\n\r\n else\r\n puts \"Buzz! Let's try that again.\"\r\n do_math_1\r\n end\r\n\r\nend",
"def menu\n puts \"Please type the menu number for the calculation you'd like to perfrom: \"\n puts \" Put 1 for Basic calculator and 2 for Advanced calculator\"\n calculator = gets.chomp.to_i\n\n\n if calculator == 1\n basic_calc\n else calculator == 2\n advanced_calc\n end\nend",
"def calculator(a = 1,b = 1, operation = \"add\")\n if operation == \"add\"\n \"The result of operation #{a} + #{b} is: #{add(a, b)}\"\n elsif operation == \"substract\"\n \"The result of operation #{a} - #{b} is: #{substract(a, b)}\"\n elsif operation == \"multiply\"\n \"The result of operation #{a} * #{b} is: #{multiply(a, b)}\"\n else\n \"That's not a real math operation\"\n end\nend",
"def calculate_answer(operator, a, b)\n\tif operator == \"add\"\n \ta + b\n\telsif operator == \"subtract\"\n \t\ta - b\n\telsif operator == \"multiply\"\n \ta * b\n\telsif operator == \"divide\"\n \ta / b\n\telsif operator == \"square\"\n \t\ta ** b\n\telsif operator == \"bmi\"\n \t\ta / (b ** 2)\n\tend\nend",
"def advanced_calc\n print \"(p)ower, (s)qrt: \"\n option_3 = gets.chomp.downcase\n\n if option_3 == \"p\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n print \"Please enter an exponent: \"\n number_2 = gets.chomp.to_i\n puts \"Result: #{number_1} ** #{number_2} = #{number_1 ** number_2}\"\n elsif option_3 == \"s\"\n print \"Please enter a number: \"\n number_1 = gets.chomp.to_i\n puts \"The square root of #{number_1} is #{Math.sqrt(number_1)}\"\n else\n puts \"That is not a valid option. Please try again.\"\n end\n\nend",
"def calculations \n case @operator \n when \"+\"\n puts \"#{@first_number} + #{@second_number} = #{@first_number + @second_number}\"\n @user_result = (@first_number + @second_number)\n @user_results_array << @user_result\n when \"-\"\n puts \"#{@first_number} - #{@second_number} = #{@first_number - @second_number}\"\n @user_result = (@first_number - @second_number)\n @user_results_array << @user_result\n when \"/\"\n puts \"#{@first_number} / #{@second_number} = #{@first_number / @second_number}\"\n @user_result = (@first_number / @second_number)\n @user_results_array << @user_result\n when \"*\"\n puts \"#{@first_number} * #{@second_number} = #{@first_number * @second_number}\"\n @user_result = (@first_number * @second_number)\n @user_results_array << @user_result\n end \n puts \"Would you like to continue calculating? Y or N?\"\n answer = gets.chomp \n if answer == \"Y\" || answer ==\"y\"\n continued_calculations\n else \n puts \"Have a good day!\"\n exit \n end \nend",
"def display_result(num1, num2, operator)\n # say \"num1: #{num1}, num2: #{num2}, operator #{operator}\"\n case operator\n when '1'\n result = num1.to_i + num2.to_i\n say \"#{num1} + #{num2} = #{result}\"\n when '2'\n result = num1.to_i - num2.to_i\n say \"#{num1} - #{num2} = #{result}\"\n when '3'\n begin\n result = num1.to_f / num2.to_f\n say \"#{num1} / #{num2} = #{result}\"\n rescue\n say(\"Div by 0\")\n end\n else\n result = num1.to_i * num2.to_i\n say \"#{num1} * #{num2} = #{result}\"\n end\n result.to_s\nend",
"def advanced_calc\n puts \"Do you want to raise your first number to a [power] or find it's [sqrt] \"\n print \">\"\n $advanced = gets.chomp\n\n puts \"Alright, now give me some numbers!\"\n print \"> first: \"\n first = gets.chomp.to_i\n\n case $advanced\n when \"power\"\n print \"> second:\"\n second = gets.chomp.to_i\n puts \"\\nanswer: #{first} to the #{second} power is #{first**second}\"\n when \"sqrt\"\n puts \"\\nanswer: The square root is #{Math.sqrt(first)}\"\n else\n puts \"\\nOh crap...how'd that happen...\"\n puts \"I guess you never told me what maths to do...EMBARRASSING\\n\\n\"\n end\nend",
"def input\n\tputs 'What sorta math do ya wanna do?'\n\tputs '1 for addition'\n\tputs '2 for subtraction'\n\tputs '3 for multiplication'\n\tputs '4 for division'\n\tputs '5 for exponent'\n\tputs '6 for squaring'\n\tputs '7 for cubing'\n\tputs '8 for square rooting'\n\tgets.chomp.to_i\nend",
"def basic_calculator_type\n print \"What would you like to do? Type 1 to add, 2 to subtract, 3 to multiply or 4 to divide: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"add\"\n elsif selection == 2\n \"subtract\"\n elsif selection == 3\n \"multiply\"\n elsif selection == 4\n \"divide\"\n else\n \"error\"\n end\nend",
"def menu\nputs \"Select calculation option:\\n\"\nputs \"Option 1 - add, Option 2 - subtract, Option 3 - multiply, Option 4 - divide, Option 5 - exponent, Option 6 - square root\"\n\n option = gets.to_i\n\n if option == 1\n return \"add\"\n elsif option == 2\n return \"subtract\"\n elsif option == 3\n return \"multiply\"\n elsif option == 4\n return \"divide\"\n elsif option == 5\n return \"exponent\"\n\n elsif option == 6\n puts \"For square root calculation, enter one number\"\n return \"square\"\n \n end\nend",
"def advanced_calculator_type\n print \"What would you like to do? Type 1 to find exponents or 2 to find the square root of a number: \"\n selection = gets.to_i\n # puts \"You chose #{selection}\"\n if selection == 1\n \"exponents\"\n elsif selection == 2\n \"square root\"\n else\n \"error\"\n end\nend",
"def main\n # determine whether to use verbose outpuut\n verbose = false\n if ARGV[0] != nil and ARGV[0].downcase == \"-v\"\n verbose = true\n end\n\n # get input\n puts \"Instructions: enter a mathematical expression using +, -, *, /, **, or (q)uit\"\n puts \"Calculator follows order of operations\"\n puts \"All elements must be separated by spaces\"\n puts \"e.g. ( 4 + 5 ) * 6\"\n print \"Enter an expression: \"\n expr = STDIN.gets.strip\n\n # continue calculating expressions until user quits\n until expr.downcase.start_with?(\"q\")\n # send to calc() and print result\n result = calc(expr, verbose)\n\n if result == nil\n puts \"Please enter a valid expression\"\n puts \"Common error: all elements should be separated by spaces\"\n elsif result % 1 == 0 # print int if result is integer\n puts result.to_i\n else\n puts result\n end\n\n print \"enter another expression, or (q)uit: \"\n expr = STDIN.gets.strip\n end\nend",
"def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2}\"\n elsif operation == \"divide\" || operation == \"/\"\n if n2 == 0\n return \"undefined\"\n else\n return \"#{n1} / #{n2} = #{n1/n2}\"\n end\n elsif operation == \"exponent\" || operation == \"^\"\n return \"#{n1} ^ #{n2} = #{n1**n2}\"\n elsif operation == \"modulo\" || operation == \"%\"\n return \"#{n1} % #{n2} = #{n1%n2}\"\n end\nend",
"def calculator(a , b, operation = \"add\")\n if operation == \"add\"\n add(a, b)\n elsif operation == \"subtract\"\n subtract(a, b)\n elsif operation == \"multiply\"\n multiply(a, b)\n else\n \"That's not a math operation, genius!\"\n end\nend",
"def calculate\n \t@num1 = params[:num1].to_i\n \t@num2 = params[:num2].to_i\n\n \tif params[:addition] then\n @result = @num1 + @num2\n elsif params[:subtraction] then\n @result = @num1 - @num2\n elsif params[:multiplication] then\n @result = @num1 * @num2\n elsif params[:division] then\n @result = @num1/@num2\n else\n \trender \"errorhandling\"\n \tflash[:error] = \"Couldn't calculate!\"\n end\n \t\n end",
"def basic_calc\n print \"(a)dd, (s)ubtract, (m)ultiply, (d)ivide: \"\n user_input = gets.chomp.downcase\n # \"return user_input\" is implied (Ruby methods ALWAYS returns the last expression)\nend",
"def add_it\n puts \"Ok, we're adding. What is the first number?\"\n first = gets.chomp\n first = verify(first)\n puts \"What number do you want to add to #{look_pretty(first)}?\"\n second = gets.chomp\n second = verify(second)\n puts \"The sum of #{look_pretty(first)} and #{look_pretty(second)} is #{look_pretty(addition(first,second))}\"\nend",
"def display_advanced_operators\n puts \"Please select an Advanced operation type: \\n (E)xponent \\n (S)quare root\"\n print \"> \"\n advanced_operation = gets.chomp.downcase\n case advanced_operation\n when 'e'\n puts \"Exponent selected\"\n print \"Please enter the base value that needs to be multiplied: \"\n base = gets.chomp.to_i\n if base > 0\n print \"Please enter the exponent value that needs to be applied to the base: \"\n power = gets.chomp.to_i\n puts \"Total #{base**power}\"\n else\n \"Please enter a value greater than zero for the calculation.\"\n end\n when 's'\n puts \"Square root selected\"\n print \"Please enter a value to determine the square root: \"\n sq_value = gets.chomp.to_f\n puts \"Total #{Math.sqrt(sq_value)}\"\n else\n puts \"I didn't recognise your selection. Please only pick an Advanced operation type: \\n (E)xponent \\n (S)quare root \\n > \"\n end\nend",
"def add\n puts \"\"\n puts \"what is you forst number\"\n first_num = gets.chomp.to_f\n puts \"what is you forst number\"\n second_num = gets.chomp.to_f\n\n puts \"#{first_num} + #{second_num} = #{first_num+second_num}\"\nend",
"def calc(user_choice)\n if(user_choice == \"m\")\n puts \"Do you require a (b)asic calculator, or an (a)dvanced calculator?\"\n math_calc = gets.chomp\n if(math_calc == \"b\")\n puts \"Which of the following functions would you like to access? (a)ddition, (s)ubtraction, (m)ultiplication or (d)ivision?\"\n basic_choice = gets.chomp\n if(basic_choice == \"a\")\n addition\n elsif(basic_choice == \"s\")\n subtraction\n elsif(basic_choice == \"m\")\n multiplication\n elsif(basic_choice == \"d\")\n division\n end\n elsif(math_calc == \"a\")\n puts \"Which of the following functions would you like to access? (p)ower of, or (s)quare root?\"\n advanced_choice = gets.chomp\n if(advanced_choice == \"p\")\n power\n elsif(advanced_choice == \"s\")\n square_root\n end\n end\n elsif(user_choice == \"b\")\n puts \"Is the calculation being made in the (i)mperial or the (m)etric system?\"\n system_choice = gets.chomp\n if(system_choice == \"i\")\n imperial_bmi\n elsif(system_choice == \"m\")\n metric_bmi\n end\n elsif(user_choice == \"j\")\n journey\n end\nend",
"def number_choice_one\n puts \"Now I need two numbers to use with that operator.\"\n puts \"Type your first number: \"\n gets.chomp.to_i\nend",
"def request_operations_numbers(user_input, valid_operators)\n puts \"What operation would you like to perform?\"\n operation = gets.chomp\n if valid_operators.values.flatten.include?(operation)\n user_input[:operation] = operation\n else\n puts \"Whoa nelly! You don't make sense. You can add, subtract, multiply, or divide.\"\n exit\n end\n puts \"What's the first number you would like to use?\"\n num_1 = gets.chomp\n user_input[:num_1] = num_1\n\n puts \"What's the second number you would like to use?\"\n num_2 = gets.chomp\n user_input[:num_2] = num_2\nend",
"def numbers\n puts \"What is your first number.\"\n num1=gets.chomp.to_i\n puts \"What is your second number.\"\n num2=gets.chomp.to_i\n puts \"What function would you like to run?\"\n puts \"1. Addition\"\n puts \"2. Subtraction\"\n puts \"3. Multiplication\"\n puts \"4. Division\"\n puts \"5. Square\"\n selection =gets.chomp\n case selection\n when \"1\"\n system \"clear\"\n puts num1+num2\n when \"2\"\n system \"clear\"\n puts num1-num2\n when \"3\"\n system \"clear\"\n puts num1*num2\n when \"4\"\n system \"clear\"\n puts num1/num2\n when \"5\"\n system \"clear\"\n puts num1 ** 2\n puts num2 ** 2\n end\nend",
"def valid_operation(user_input)\n user_input.downcase!\n \n case user_input\n when \"add\", \"+\"\n puts \"\\n*** ADDING ***\"\n add(*get_numbers)\n when \"subtract\", \"-\"\n puts \"\\n*** SUBTRACTING ***\"\n subtract(*get_numbers)\n when \"multiply\", \"*\"\n puts \"\\n*** MULTIPLYING ***\"\n multiply(*get_numbers)\n when \"divide\", \"/\"\n puts \"\\n*** DIVIDING ***\"\n divide(*get_numbers)\n else\n puts \"\\nERROR, please enter one operator(name or symbol)\"\n print \"=> \"\n valid_operation(gets.chomp)\n end\n \nend",
"def operation_select\n puts \"Which operator would you like to use?\"\n puts \"1. add(+)\"\n puts \"2. subtract(-)\"\n puts \"3. multiply(*)\"\n puts \"4. divide(/)\"\n puts \"5. power(^)\"\n puts \"6. modulo(%)\"\n puts \"Please choose one operator (type name or symbol):\"\n operation = gets.chomp\n numeric_input(operation)\nend",
"def user_picks_an_operation\n puts \"Here's what I can do for you: \\n Add(+) \\n Subtract(-) \\n Multiply(*) \\n Divide(/) \\n Exponentiate(^) \\n Remainder(%) \\nWhich one would you like to do?\"\noperation = gets.chomp\ncase operation.downcase\n when \"add\", \"+\"\n add_it\n when \"subtract\", \"-\"\n subtract_it\n when \"multiply\", \"*\"\n multiply_it\n when \"divide\", \"/\"\n divide_it\n when \"exponentiate\", \"^\"\n exponentiate_it\n when \"remainder\", \"%\"\n modulo_it\n else\n puts \"That's not an available operation! Please try again.\"\n user_picks_an_operation\n end\nend",
"def menu\n puts 'Welcome to the ruby calculator!'\n puts 'Press 1 to calculate or 2 to quit'\n case\n answer = gets.strip\n when '1'\n calculate\n when '2'\n exit\nend\nend",
"def menu #here the method is defined. it doesnt require any parameters because it asks the user for information\n puts \"\" #This is just an empty line\n puts \"(a) is addition\"\n puts \"(b) is subtraction\"\n puts \"(c) is multiplication\"\n puts \"(d) is division\"\n puts \"(e) is for exponents\"\n puts \"(q) is for quit\"\n print \"Enter your choice: \"\n gets.chomp() #Whateever we type is saved as this gets.chomp() statements. Note: this is the same as saying return.gets.chomp but we don't need it because the final line in a method is automatically returned\nend",
"def get_user_choice\n #show the available operations\n puts \"(+) - Addition\"\n puts \"(-) - Substraction\"\n puts \"(/) - Division\"\n puts \"(*) - Multiple\"\n puts \"(**) - Exponents\"\n puts \"(sr) - Square Root\"\n puts \"(q) - Quit\"\n\n print \"Enter your selection: \"\n gets.downcase.chomp\nend",
"def determine_operators\n #prompt the user for a selection\n print \"Please select (B)asic or (A)dvanced calculator operations:\"\n #store the selection\n calc_operations = gets.chomp.downcase\n #determine which operators to display and call their associated methods\n if calc_operations == 'b'\n display_basic_operators\n elsif calc_operations == 'a'\n display_advanced_operators\n else\n puts \"Please only select (B)asic or (A)dvanced calculator operations:\"\n end\nend",
"def multiplication\n\tputs \"which numbers would you like to multiply\"\n\tmult_number_1 = gets.chomp\n\tmult_number_2 = gets.chomp\n\tputs mult_number_1.to_f * mult_number_2.to_f\nend",
"def prompt\n puts \" \"\n puts \"Welcome to the Simple Calculator!\"\n puts \"=================================\"\n puts \"Okay, let's calculate two numbers:\"\nend"
] |
[
"0.8001223",
"0.7889607",
"0.78600824",
"0.781014",
"0.7805129",
"0.7786566",
"0.7779403",
"0.7767423",
"0.7731978",
"0.7592265",
"0.7579605",
"0.7567149",
"0.7562794",
"0.7539188",
"0.7488816",
"0.74720186",
"0.73925084",
"0.7382979",
"0.7375263",
"0.73715585",
"0.7370982",
"0.73599726",
"0.7350197",
"0.7310416",
"0.73077095",
"0.73017526",
"0.7297023",
"0.7291715",
"0.72891337",
"0.72226393",
"0.7211144",
"0.7207511",
"0.7180482",
"0.7167644",
"0.7163113",
"0.71606874",
"0.7156319",
"0.71431834",
"0.71264803",
"0.7099274",
"0.70868015",
"0.7081143",
"0.70718795",
"0.70647836",
"0.7045553",
"0.7003308",
"0.6997153",
"0.699694",
"0.6992632",
"0.69869673",
"0.69674337",
"0.696278",
"0.6958828",
"0.6957429",
"0.69563586",
"0.69503766",
"0.694601",
"0.693179",
"0.6912693",
"0.68663883",
"0.6857638",
"0.6852509",
"0.6823049",
"0.6811415",
"0.68056554",
"0.6802911",
"0.67938733",
"0.67931736",
"0.6787263",
"0.6752007",
"0.67421675",
"0.6740453",
"0.67371273",
"0.67321944",
"0.6726326",
"0.6712655",
"0.67072344",
"0.6701013",
"0.66800404",
"0.667302",
"0.6659413",
"0.6658523",
"0.6657279",
"0.6657037",
"0.66467315",
"0.66306084",
"0.6623732",
"0.66232276",
"0.66200054",
"0.66167384",
"0.6614717",
"0.6598109",
"0.65614986",
"0.6552989",
"0.65465695",
"0.65445364",
"0.6544369",
"0.6530216",
"0.6529381",
"0.6529244"
] |
0.797191
|
1
|
GET /subjects/1 GET /subjects/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def show\n \n id = params[:id].to_i\n \n if id == 0\n @subject = Subject.find_by_subject(params[:id])\n else \n @subject = Subject.find(params[:id])\n end\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @manual_subjects = Manual::Subject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @manual_subjects }\n end\n end",
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def get_subject_by_curricular_line\n @subjects = Subject.get_by_career(params[:career_id],params[:cl_id])\n render :json => @subjects\n end",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def show\n @subject = @client.subjects.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subject }\n end\n end",
"def index\n @subjects = Subject.all\n #respond_to do |format|\n # format.json { render json: @subjects, status: :ok }\n #end\n #render json: @subjects, status: :ok\n respond_with @subjects\n end",
"def index\n @subjects = @client.subjects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subjects }\n end\n end",
"def show\n\t\t@param_subjects = ParamSubject.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {render json: @param_subjects}\n\t\tend\n\tend",
"def show\n @subject = Subject.find(params[:id])\n @chapters = @subject.chapters.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @subjects = Subject.all\n end",
"def index\n @subjects = Subject.all\n end",
"def show\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @curriculums_subject }\n end\n end",
"def index\n # @subjects = Subject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@subjects, mode: :compat) }\n end\n end",
"def subject(subject_id, project_id: nil)\n query = {}\n query[:project_id] = project_id if project_id\n\n response = panoptes.get(\"/subjects/#{subject_id}\", query)\n if response.fetch('subjects', []).count > 1\n raise StandardError, 'Unexpectedly many subjects returned'\n end\n\n response.fetch('subjects', []).fetch(0, nil)\n end",
"def index\n @subjects = Subject.all\n \n end",
"def index\n @thesubjects = Thesubject.all\n end",
"def show\n if params[:subject_id]\n @subject = Subject.find(params[:subject_id])\n #category = Category.find(params[:category_id])\n @tutorials = Tutorial.where(:subject_id => @subject)\n else\n @tutorials = Tutorial.all\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @subject = Subject.find(params[:subject_id])\n \n end",
"def show\n @subject = Subject.find(params[:id])\n end",
"def show\n @subjects = @teacher.subjects\n respond_with @teacher\n end",
"def index\n @mysubjects = Mysubject.all\n end",
"def show\n\n @subject = Subject.find(params[:id])\n\n end",
"def index\n @title = \"Subjects\"\n @subjects = Subject.paginate :page=>params[:page], :per_page => 100, :order => 'subject'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subjects }\n end\n end",
"def index\n @subjects = subject_scope\n end",
"def index\n \t@subjects = Subject.sorted\n # byebug\n respond_to do |format|\n format.html # index.html.erb\n # TODO: format.json { render json: @subjects }\n end\n end",
"def list_subjects(study_id)\n act = SubjectListAction.new(self)\n act.get(study_id)\n end",
"def index\n @q = Subject.search(params[:q])\n @subjects = @q.result(distinct: true).page(params[:page])\n end",
"def get_authorization_subjects_me_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthorizationApi.get_authorization_subjects_me ...\"\n end\n \n # resource path\n local_var_path = \"/api/v2/authorization/subjects/me\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n auth_names = ['PureCloud OAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'AuthzSubject')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthorizationApi#get_authorization_subjects_me\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def show\n @subject_source = SubjectSource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @subject_source }\n end\n end",
"def new\n @title = \"New Subject\"\n @subject = Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @user_subjects = UserSubject.all\n end",
"def index\n @program_subjects = ProgramSubject.all\n end",
"def show\n @resource = Resource.find(params[:id])\n @terms = Term.all_iit_subjects\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @resource }\n end\n end",
"def index\n @student_subjects = StudentSubject.all\n end",
"def index\n @course_subjects = CourseSubject.all\n end",
"def subject_versions(subject)\n get \"/subjects/#{subject}/versions\"\n end",
"def list_subjects_from_metaportal(url)\n act = MetaportalSubjectListAction.new(self)\n act.get(url)\n end",
"def new\n @manual_subject = Manual::Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manual_subject }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @work_has_subject }\n end\n end",
"def get_subject\n @subject = Subject.find_by_id(params[:id])\n return if check_nil_object(@subject)\n end",
"def show\n @user_subject = UserSubject.find(params[:id])\n end",
"def index\n @subjectms = Subjectm.all\n end",
"def index\n @subjects_users = SubjectsUser.all\n end",
"def index\n @subjects = Subject.all\n page_title(\"Subjects\")\n \n respond_to do |format|\n format.html { render :layout => 'application' }\n end\n end",
"def subjects_person\n get_item_data_by_name('SubjectPerson')\n end",
"def index\n @tutor_subjects = TutorSubject.all\n end",
"def show\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subject }\n end\n end",
"def show\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subject }\n end\n end",
"def show\n\n begin\n @subject = Subject.find(params[:id])\n @subjects = load_subjects(@subject)\n\n rescue StandardError => error\n flash[:error] = error.message ||= 'Person with id number ' + params[:id].to_s + ' was not found or your people set was invalid. Reload the people page.'\n @error = true\n end\n\n respond_to do |format|\n unless @error\n format.html\n format.xml { render :xml => @item }\n else\n format.html { redirect_to(admin_subjects_url, :error => flash[:error]) }\n end\n end\n end",
"def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end",
"def subject\n @subject ||= connection.get(path_prefix){|req| req.params.merge!params }.body\n end",
"def index\n get_work; get_subject\n if @work\n @work_has_subjects = @work.work_has_subjects.page(params[:page])\n elsif @subject\n @work_has_subjects = @subject.work_has_subjects.page(params[:page])\n else\n @work_has_subjects = WorkHasSubject.page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @work_has_subjects }\n end\n end",
"def list_subjects\r\n #TODO only list subjects from my own schools \r\n #because then people can still it \r\n school = School.find(params[:nid]) rescue render_return\r\n render_return if !logged_in_user.see_course?(school)\r\n render_p 'course_display/course_selection',{'caller'=>params[:caller],'school'=>school}\r\n end",
"def show\r\n authorize! :read, Subject\r\n @subject = Subject.where(id: params[:id]).first\r\n @books = BookTitle.where(subject_id: @subject).all.order(:title)\r\n end",
"def index\n @university_subjects = UniversitySubject.all\n end",
"def index\n # @subjects = Subject.page(params[:page])\n @subjects = case current_user.role.name\n when 'Edutor Admin'\n Subject.page(params[:page])\n when 'Institute Admin'\n #Subject.by_boards_and_published_by(current_user.institution.board_ids,current_user.institution.publisher_ids).page(params[:page])\n Subject.where(:board_id=>current_user.institution.board_ids).page(params[:page])\n when 'Center Representative'\n #Subject.by_boards_and_published_by(current_user.center.board_ids,current_user.institution.publisher_ids).page(params[:page])\n Subject.where(:board_id=>current_user.center.board_ids).page(params[:page])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @subjects.map{|u| Hash[id: u.id, name: u.name]} }\n end\n end",
"def index\n\t @search = Subject.search do\n\t\t\tfulltext params[:search]\n\t\t end\n\t\t@subjects = @search.results\n\t\t#@subjects = Subject.all\n\tend",
"def index\n @projects = Project.all\n @subjects = Subject.all\n if params[:subject].present?\n @selected_subject = Subject.find(params[:subject]);\n end\n end",
"def new\n @subject = Subject.find_by_name(params[:subject_name])\n @convo = Convo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @convo }\n end\n end",
"def index\n admin_only\n @subjects = Subject.all\n end",
"def index\n @subject_items = SubjectItem.all\n end",
"def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\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 set_subject\n begin\n @subject = Subject.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid subject #{params[:id]}\"\n @subject_not_found = true\n render json: {message: \"Illegal subject access request\"}, status: :unauthorized\n return\n else\n @subject_not_found = false\n end\n end",
"def show\n #render json: @subject\n respond_with @subject\n end",
"def index\n @subjects = Subject.all.sort_by { |m| m.name.downcase }\n @user = current_user\n end",
"def index\n \n @subjects = Subject.sorted\n \n end",
"def find\n\t\trender json: Subject.where(\"name LIKE ?\",\"%#{params[:term].titlecase}%\")\n\tend",
"def new\n @curriculums_subject = CurriculumsSubject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @curriculums_subject }\n end\n end",
"def index\n #assemlbe a list of all the subjects\n # @subjects = Subject.all or\n @subjects = Subject.sorted #defined in lambda\n end",
"def get_subjects(nums)\n subj_arr = []\n url_array = [\"http://www.swapi.co/api/people\", \"http://www.swapi.co/api/films\",\n \"http://www.swapi.co/api/planets\", \"http://www.swapi.co/api/starships\",\n \"http://www.swapi.co/api/species\"]\n api_array = [\"name\", \"title\", \"name\", \"name\", \"name\"]\n counter = 0\n counter2 = 0\n 10.times do\n if counter == 5\n counter = 0\n end\n url = url_array[counter] + \"/#{nums[counter2]}\"\n api_text = JSON.parse(RestClient.get(url.to_s))\n x = api_text[\"#{api_array[counter]}\"]\n subj_arr << x\n counter = counter + 1\n counter2 = counter2 + 1\n end # end of times loop\n subj_arr\n\nend",
"def get_subject2\n @subject = Subject.find_by_id(params[:subject_id])\n return if check_nil_object(@subject)\n end",
"def subject_version(subject, version = 'latest')\n get \"/subjects/#{subject}/versions/#{version}\"\n end",
"def index\n @exam_subjects = ExamSubject.all\n end",
"def index\n @career_subjects = CareerSubject.all\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to :subjects, :notice => 'Subject was successfully created.' }\n format.json { render :json => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @faqs = Faq.sorted\n if @subject\n @faqs = @faqs.where(:subject_id => @subject.id)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @faqs, include: 'subject' }\n end\n end",
"def subject(instructor, school)\n school[:instructors].each do |i|\n return i[:subject] if i[:name] == instructor\n end\nend",
"def index\n @subject_types = SubjectType.all\n end",
"def show\n @subject = Subject.find_by_hashed_id(params[:id])\n page_title([\"Subject\", @subject.name])\n respond_to do |format|\n format.html { render :layout => 'application' }\n end\n end",
"def show\n @manual_subject = Manual::Subject.find(params[:id])\n\n redirect_to manual_subject_laboratories_path(@manual_subject)\n end",
"def new\n @subject_source = SubjectSource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject_source }\n end\n end",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :ok }\n end\n end",
"def get_subject\n @pcp_subject = PcpSubject.find( params[ :pcp_subject_id ])\n end",
"def show\n @subject = get_subject\n end",
"def index\n logged_in\n if @current_user.teacher?\n @subjects = Subject.where(teacher_id: @current_user.id)\n elsif @current_user.student?\n @subjects = Subject.where(id: Relation.select(:subject_id).where(student_id: @current_user.id))\n else\n @subjects = Subject.all\n end\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def subjects\n bib_subjects || get_item_data_by_name('Subject')\n end",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :no_content }\n end\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n if ind2 == '7'\n sfs << ['2', subject['source']]\n end\n\n # add authority ID as subject 6xx $0\n authority_id = subject['authority_id']\n subfield_0 = authority_id ? [0, authority_id] : nil\n sfs.push(subfield_0) unless subfield_0.nil?\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def subjects\n links = frm.table(:class=>\"listHier\").links.find_all { |link| link.title=~/View announcement/ }\n subjects = []\n links.each { |link| subjects << link.text }\n return subjects\n end",
"def set_subject\n @subject = Subject.friendly.find(params[:id])\n end",
"def all_subjects\n Subject.current.where(site_id: all_editable_sites.select(:id))\n end",
"def show\n @subject_permission = SubjectPermission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @subject_permission }\n end\n end",
"def create\n @subject = current_user.subjects.new(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: \"已成功创建学生账户:#{@subject.title}. \"}\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @school_cycle_has_subjects = SchoolCycleHasSubject.all\n end",
"def index\n @topics = Topic.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @topics }\n end\n end"
] |
[
"0.7462031",
"0.73371226",
"0.73158705",
"0.7303327",
"0.7293112",
"0.7209648",
"0.7203975",
"0.7081049",
"0.70791173",
"0.70585805",
"0.70382094",
"0.7033256",
"0.7022359",
"0.7022359",
"0.70181674",
"0.6998612",
"0.69974196",
"0.68754363",
"0.685901",
"0.6858203",
"0.68432844",
"0.6826684",
"0.68188626",
"0.68070763",
"0.6760869",
"0.67083406",
"0.66972345",
"0.66756475",
"0.66699374",
"0.6655111",
"0.65912604",
"0.6569182",
"0.65640265",
"0.6536779",
"0.64970154",
"0.6468676",
"0.64674073",
"0.6415129",
"0.63816565",
"0.63545966",
"0.6349807",
"0.63274324",
"0.63230073",
"0.6321472",
"0.63178796",
"0.62783426",
"0.62731695",
"0.6247122",
"0.6242184",
"0.62292004",
"0.62292004",
"0.6203143",
"0.61875725",
"0.6187012",
"0.61841047",
"0.61695457",
"0.6150732",
"0.6143329",
"0.61197126",
"0.61177677",
"0.61136544",
"0.61090785",
"0.6096388",
"0.60860723",
"0.60801435",
"0.6074355",
"0.6073921",
"0.6072864",
"0.606439",
"0.60508394",
"0.603323",
"0.6029351",
"0.6027852",
"0.6010205",
"0.6008396",
"0.6001888",
"0.59879893",
"0.59715605",
"0.59640414",
"0.5947411",
"0.5947135",
"0.59444726",
"0.59302443",
"0.592806",
"0.592206",
"0.58997875",
"0.5896555",
"0.5885349",
"0.588474",
"0.587094",
"0.587094",
"0.5869207",
"0.5865889",
"0.5862596",
"0.58478624",
"0.5819267",
"0.5817416",
"0.5814456",
"0.5814124",
"0.5813279",
"0.58073103"
] |
0.0
|
-1
|
POST /subjects POST /subjects.json
|
def create
subject_params[:name].each do |subject_name|
if (subject_name != "")
subject = Subject.find_or_create_by(name: subject_name)
Mark.find_or_create_by(notenplan_id: session[:notenplan_id], subject: subject)
end
end
notenplan = Notenplan.find_by(id: session[:notenplan_id])
redirect_to notenplan, notice: 'Das Fach wurde erfolgreich erstellt.'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to :subjects, :notice => 'Subject was successfully created.' }\n format.json { render :json => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = current_user.subjects.new(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: \"已成功创建学生账户:#{@subject.title}. \"}\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(subject_params)\n @subject.user = current_user\n respond_to do |format|\n if @subject.save\n format.html { redirect_to new_subject_topic_path(@subject), notice: 'Subject was successfully created, create new topics?' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @client.subjects << @subject\n flash[:notice] = 'Subject was successfully created.'\n format.html { redirect_to client_subject_url(@client, @subject) }\n format.xml { render :xml => @subject, :status => :created, :location => [@client, @subject] }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @title = \"Create New Subject\"\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render json: @subject, status: :created, location: @subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n base_params = subject_params.select {|k,v| k != \"discipline\"}\n @subject = Subject.new(base_params)\n @subject.discipline= Discipline.find(subject_params[:discipline][:id])\n \n if @subject.save\n #respond_with @subject\n render json: @subject\n #format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @subject }\n else\n respond_with @subject.errors, status: :unprocessable_entity\n #format.html { render action: 'new' }\n #format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @subjects_user = SubjectsUser.new(subjects_user_params)\n\n respond_to do |format|\n if @subjects_user.save\n format.html { redirect_to subjects_path(@subject), notice: 'Subjects user was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subjects_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @student_subject = StudentSubject.new(student_subject_params)\n\n respond_to do |format|\n if @student_subject.save\n format.html { redirect_to @student_subject, notice: 'Student subject was successfully created.' }\n format.json { render :show, status: :created, location: @student_subject }\n else\n format.html { render :new }\n format.json { render json: @student_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @manual_subject = Manual::Subject.new(params[:manual_subject])\n\n respond_to do |format|\n if @manual_subject.save\n format.html { redirect_to @manual_subject, notice: 'Subject was successfully created.' }\n format.json { render json: @manual_subject, status: :created, location: @manual_subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @manual_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:name, :grade, :tutor_id)\n end",
"def mysubject_params\n params.require(:mysubject).permit(:my_subjects)\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 create\n @user_subject = UserSubject.new(user_subject_params)\n if @user_subject.save\n render :show, status: :created, location: @user_subject\n else\n render json: @user_subject.errors, status: :unprocessable_entity\n end\n end",
"def create\n @subject = Subject.new(subject_params)\n if @subject.save\n redirect_to(subjects_path)\n else\n render('new')\n end\n end",
"def create\n @subject_item = SubjectItem.new(tutor_id: @tutor.id, subject_id: subject_item_params[:subject_id])\n\n respond_to do |format|\n if @subject_item.save\n format.html { redirect_to @tutor, notice: 'Subject was successfully added.' }\n format.json { render :show, status: :created, location: @subject_item }\n else\n format.html { render :new }\n format.json { render json: @subject_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(subject_params)\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: t('controller.successfully_created', model: t('activerecord.models.subject')) }\n format.json { render json: @subject, status: :created, location: @subject }\n else\n prepare_options\n format.html { render action: \"new\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @thesubject = Thesubject.new(thesubject_params)\n\n respond_to do |format|\n if @thesubject.save\n format.html { redirect_to @thesubject, notice: 'Thesubject was successfully created.' }\n format.json { render :show, status: :created, location: @thesubject }\n else\n format.html { render :new }\n format.json { render json: @thesubject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n admin_only\n @subject = Subject.new(subject_params)\n\n new_tutor_ids = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teaching_attributes].each do |attribute|\n id = attribute[1][:incoming_tutor_id]\n new_tutor_ids << id unless attribute[1][:_destroy] == \"1\"\n end\n end\n\n respond_to do |format|\n if @subject.save\n\n unless new_tutor_ids == []\n new_tutor_ids.each do |id|\n e = ProvidingEnrollment.new\n e.user_id = id\n e.subject_id = @subject.id\n e.save!\n end\n end\n\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(subject_params)\n @user = current_user\n @subject.user = @user\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = current_user.subjects.where(project_id: @project.id).new(subject_params)\n if @subject.save\n redirect_to [@project, @subject], notice: \"Subject was successfully created.\"\n else\n render :new\n end\n end",
"def subject_params\n params.require(:subject).permit(:name)\n end",
"def subject_params\n params.require(:subject).permit(:name)\n end",
"def subject_params\n params.require(:subject).permit(:name)\n end",
"def create\n session[:setting] = \"\"\n @subject = @student.subject.create(subject_params)\n respond_to do |format|\n if @subject.save\n format.html { redirect_to student_path(@student), notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t\t@subject = Subject.new(subject_params)\n\n\t\trespond_to do |format|\n\t\t\tif @subject.save\n\t\t\t\tcreate_audit __method__, 'subject', @subject.id\n\t\t\t\tformat.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @subject }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @subject.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def create\r\n @subject = Subject.new(subject_params)\r\n\r\n respond_to do |format|\r\n if @subject.save\r\n format.html { redirect_to subjects_url, notice: 'Subject was successfully created.' }\r\n format.json { render :show, status: :created, location: @subject }\r\n format.js\r\n else\r\n format.html { render :new }\r\n format.json { render json: @subject.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @tutor_subject = TutorSubject.new(tutor_subject_params)\n\n respond_to do |format|\n if @tutor_subject.save\n format.html { redirect_to @tutor_subject, notice: 'Tutor subject was successfully created.' }\n format.json { render :show, status: :created, location: @tutor_subject }\n else\n format.html { render :new }\n format.json { render json: @tutor_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = subject_scope.new(subject_params)\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to report_cards_form_subjects_path(@form), notice: 'Subject was successfully created.' }\n format.json { render :show, status: :created, location: report_cards_form_subjects_path(@form) }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(subject_params)\n respond_to do |format|\n if @subject.save\n @sub_subject= SubSubject.new\n @sub_subject.subject_id=@subject.id\n @sub_subject.name=@subject.name\n @sub_subject.is_none=true\n @sub_subject.save\n\n format.html { redirect_to subjects_path, notice: @subject.name + ' was successfully created.' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @mysubject = Mysubject.new(mysubject_params)\n\n respond_to do |format|\n if @mysubject.save\n format.html { redirect_to @mysubject, notice: 'Mysubject was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mysubject }\n else\n format.html { render action: 'new' }\n format.json { render json: @mysubject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:name, :course_id)\n end",
"def subject_params\n params[:subject].permit(:name, :user_id, :user)\n end",
"def create\n @university_subject = UniversitySubject.new(university_subject_params)\n\n respond_to do |format|\n if @university_subject.save\n format.html { redirect_to @university_subject, notice: 'University subject was successfully created.' }\n format.json { render action: 'show', status: :created, location: @university_subject }\n else\n format.html { render action: 'new' }\n format.json { render json: @university_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:title, :content)\n end",
"def create\n @curriculums_subject = CurriculumsSubject.new(params[:curriculums_subject])\n\n respond_to do |format|\n if @curriculums_subject.save\n format.html { redirect_to @curriculums_subject, notice: 'Curriculums subject was successfully created.' }\n format.json { render json: @curriculums_subject, status: :created, location: @curriculums_subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @curriculums_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subjectm = Subjectm.new(subjectm_params)\n\n respond_to do |format|\n if @subjectm.save\n format.html { redirect_to @subjectm, notice: 'Subjectm was successfully created.' }\n format.json { render :show, status: :created, location: @subjectm }\n else\n format.html { render :new }\n format.json { render json: @subjectm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def cellect_subjects(workflow_id)\n cellect.get '/subjects', workflow_id: workflow_id\n end",
"def subject_params\n params.fetch(:subject, {}).permit(:name)\n end",
"def create\n @course_subject = CourseSubject.new(course_subject_params)\n\n respond_to do |format|\n if @course_subject.save\n format.html { redirect_to @course_subject, notice: 'Course subject was successfully created.' }\n format.json { render :show, status: :created, location: @course_subject }\n else\n format.html { render :new }\n format.json { render json: @course_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def subject_params\n params.require(:subject).permit(:id, :name, :description, :discipline => [:id, :name, :description])\n end",
"def create\n teacher_exclusive\n @subject = Subject.create title: params[:title], start_date: params[:start_date], end_date: params[:end_date], teacher_id: @current_user.id\n\t\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'La matière a été insérée' }\n format.json { render :show, status: :created, location: @subject }\n else\n format.html { render :new }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject_teacher = SubjectTeacher.new(subject_teacher_params)\n\n respond_to do |format|\n if @subject_teacher.save\n format.html { redirect_to @subject_teacher, notice: 'Subject teacher was successfully created.' }\n format.json { render :show, status: :created, location: @subject_teacher }\n else\n format.html { render :new }\n format.json { render json: @subject_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:index, :new, :create, :show, :update, :delete)\n end",
"def subject_params\n params.require(:subject).permit(:name, :board, :standard, :slug)\n end",
"def create\n @subject = Subject.new(params[:subject])\n @subject_types = SubjectType.select_list\n respond_to do |format|\n if @subject.save\n format.html { redirect_to(admin_subject_path(@subject), :notice => 'Subject was successfully created.') }\n format.xml { render :xml => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @subject_type = SubjectType.new(subject_type_params)\n\n respond_to do |format|\n if @subject_type.save\n format.html { redirect_to @subject_type, notice: 'Subject type was successfully created.' }\n format.json { render :show, status: :created, location: @subject_type }\n else\n format.html { render :new }\n format.json { render json: @subject_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @title = \"New Subject\"\n @subject = Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subject }\n end\n end",
"def index\n @manual_subjects = Manual::Subject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @manual_subjects }\n end\n end",
"def subject_params\r\n params.require(:subject).permit(:code, :name, :description)\r\n end",
"def update_subjects_via_api(subject_name_array)\n return if subject_name_array.blank?\n\n # record the list of current teacher set <--> subject associations,\n # so we can prune the subjects later.\n old_subjects = Array.new\n\n self.subjects.each do |subject|\n old_subjects.push(subject.id)\n end\n\n # delete the current teacher set <--> subject associations,\n # so we can remake them fresh from the bib info.\n self.subjects.clear\n\n # Create all the subjects and teacher_set <--> subject associations specified in the bib\n # record we're processing, ignoring duplicate associations.\n subject_name_array.each do |subject_name|\n subject_name = clean_subject_string(subject_name)\n\n subject = Subject.find_or_create_by(title: subject_name)\n subject_teacher_set = SubjectTeacherSet.find_or_create_by(teacher_set_id: self.id, subject_id: subject.id)\n end\n\n prune_subjects(old_subjects)\n end",
"def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def index\n @subjects = Subject.all\n #respond_to do |format|\n # format.json { render json: @subjects, status: :ok }\n #end\n #render json: @subjects, status: :ok\n respond_with @subjects\n end",
"def subject_params\n params.require(:subject).permit(:name, :level)\n end",
"def create\n @subject_type = SubjectType.new(subject_type_params)\n\n respond_to do |format|\n if @subject_type.save\n format.html { redirect_to @subject_type, notice: t('controller.successfully_created', model: t('activerecord.models.subject_type')) }\n format.json { render json: @subject_type, status: :created, location: @subject_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subject_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @manual_subject = Manual::Subject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @manual_subject }\n end\n end",
"def create_subjects\n Subject.create!([{\n name: \"History\",\n teacher_id:1 \n },\n {\n name: \"Math\",\n teacher_id: 2\n },\n {\n name: \"Economics\",\n teacher_id: 3\n }])\nend",
"def get_subjects\n if params[:s].present?\n s_id = params[:s].to_i\n subjects_by_student = Subject.joins(\"INNER JOIN school_cycle_has_subjects ON subjects.id = school_cycle_has_subjects.subject_id INNER JOIN student_has_subjects ON school_cycle_has_subjects.id = student_has_subjects.school_cycle_has_subject_id\").where(\"student_id = ?\", s_id)\n msg = { \"success\": \"true\", \"subjects\": subjects_by_student }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end",
"def create\n\t\t@param_subject = ParamSubject.new(params[:param_subject])\n\n\t\tif @param_subject.save\n\t\t\trender json: @param_subject, status: :created, location: @param_subject\n\t\telse\n\t\t\trender json: @param_subject.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def subject_params\n params.require(:subject).permit(:description, :text, :document_type_id, :deleted_at)\n end",
"def student_subject_params\n params.require(:student_subject).permit(:subject_id, :student_id)\n end",
"def subject_params\n params.require(:subject).permit(:name, :birthday)\n end",
"def create\n error_message = ''\n if request.get?\n respond_to do |format|\n format.html{\n redirect_to(:controller => 'subjects', :action => 'index')\n }\n format.yaml{ render :text => _('posted data have no questions.') }\n end\n return\n end\n body = YAML.load(params[:batch][:body])\n login = body.delete(\"login\")\n password = body.delete(\"password\")\n raise PermissionError unless batch_logged_in?(login, password)\n @user = batch_current_user(current_user, login, password)\n @subject = nil\n @questions = []\n @choices = []\n ActiveRecord::Base.transaction do\n @subject = Subject.create!(:user_id => @user.id,\n :name => body.delete(\"title\"),\n :start_date => body.delete(\"start\"),\n :end_date => body.delete(\"end\"),\n :max_respondents => body.delete(\"max\"))\n questions = body.delete(\"questions\")\n raise EmptyDataError if questions.nil? or questions.empty?\n questions.each_with_index do |question, index|\n question_type = QuestionType.where(:name => question[\"question_type\"]).first\n @questions <<\n Question.create!(:subject_id => @subject.id,\n :position => index + 1,\n :body => question[\"body\"],\n :question_type_id => question_type.id)\n if 'select' == @questions.last.question_type.name\n choices = question[\"choices\"]\n raise EmptyDataError if choices.nil? || choices.empty?\n choices.each_with_index do |choice, index|\n @choices << Choice.create!(:question_id => @questions.last.id,\n :position => index + 1,\n :body => choice)\n end\n end\n end\n end\n respond_to do |format|\n format.html{\n message = _('data was successfully created.')\n flash[:notice] = message\n redirect_to(:controller => 'subjects',\n :action => 'show',\n :id => @subject.id)\n }\n format.yaml{ render :text => message }\n end\n rescue PermissionError => ex\n error_message = _('permission denied.')\n logger.debug(error_message)\n rescue EmptyDataError => ex\n error_message = _('posted data have no questions or choices.')\n logger.debug(error_message)\n rescue ActiveRecord::RecordInvalid => ex\n error_message = _('invalid data.')\n logger.debug(error_message)\n logger.debug(ex.message)\n logger.debug(ex.backtrace)\n rescue StandardError => ex\n error_message = _('something wrong.')\n logger.debug(error_message)\n logger.debug(ex.message)\n logger.debug(ex.backtrace)\n ensure\n unless error_message.blank?\n flash[:error] = error_message\n respond_to do |format|\n format.html{\n redirect_to(:controller => 'subjects', :action => 'index')\n }\n format.yaml{ render :text => error_message }\n end\n end\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @subject.save\n flash[:notice] = 'Subject was successfully created.'\n format.html { redirect_to(@subject) }\n format.xml { render :xml => @subject, :status => :created, :location => @subject }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors }\n end\n end\n end",
"def index\n @subjects = Subject.all\n end",
"def index\n @subjects = Subject.all\n end",
"def create\n @work_has_subject = WorkHasSubject.new(params[:work_has_subject])\n\n respond_to do |format|\n if @work_has_subject.save\n format.html { redirect_to @work_has_subject, :notice => t('controller.successfully_created', :model => t('activerecord.models.work_has_subject')) }\n format.json { render :json => @work_has_subject, :status => :created, :location => @work_has_subject }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @work_has_subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @subjects = subject_scope\n end",
"def create\n @book = Book.new(book_params)\n if @book.save\n redirect_to :action => 'list'\n else\n @subjects = Subject.all\n render :action => 'new'\n end\n end",
"def index\n @subjects = Subject.all\n \n end",
"def tutor_subject_params\n params.require(:tutor_subject).permit(:tutor_id, :subject_id)\n end",
"def create\n @program_subject = ProgramSubject.new(program_subject_params)\n\n respond_to do |format|\n if @program_subject.save\n format.html { redirect_to @program_subject}\n format.json { render :show, status: :created, location: @program_subject }\n else\n format.html { render :new }\n format.json { render json: @program_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def handle_subjects(subjects)\n subjects.each do |link|\n subject = link['_resolved']\n term, *terms = subject['terms']\n code, ind2 = case term['term_type']\n when 'uniform_title'\n ['630', source_to_code(subject['source'])]\n when 'temporal'\n ['648', source_to_code(subject['source'])]\n when 'topical'\n ['650', source_to_code(subject['source'])]\n when 'geographic', 'cultural_context'\n ['651', source_to_code(subject['source'])]\n when 'genre_form', 'style_period'\n ['655', source_to_code(subject['source'])]\n when 'occupation'\n ['656', '7']\n when 'function'\n ['656', '7']\n else\n ['650', source_to_code(subject['source'])]\n end\n sfs = [['a', term['term']]]\n\n terms.each do |t|\n tag = case t['term_type']\n when 'uniform_title'; 't'\n when 'genre_form', 'style_period'; 'v'\n when 'topical', 'cultural_context'; 'x'\n when 'temporal'; 'y'\n when 'geographic'; 'z'\n end\n sfs << [tag, t['term']]\n end\n\n if ind2 == '7'\n sfs << ['2', subject['source']]\n end\n\n # add authority ID as subject 6xx $0\n authority_id = subject['authority_id']\n subfield_0 = authority_id ? [0, authority_id] : nil\n sfs.push(subfield_0) unless subfield_0.nil?\n\n ind1 = code == '630' ? \"0\" : \" \"\n df!(code, ind1, ind2).with_sfs(*sfs)\n end\n end",
"def index\n # @subjects = Subject.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: Oj.dump(@subjects, mode: :compat) }\n end\n end",
"def create\n @post = current_user.posts.build(post_params)\n\n respond_to do |format|\n if @post.save\n # format.html { redirect_to controller 'subjects', action 'new', post_id: params[:@post.id], notice: \"Post was successfully created.\" }\n format.html { redirect_to \"/posts/#{@post.id}/subjects/new\", notice: \"Post was successfully created.\" }\n format.json { render :show, status: :created, location: @post }\n \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 \n end",
"def subjects_user_params\n params.permit(:subject_id, :user_id) \n end",
"def subject_params\n params.require(:subject).permit(:name, :title, :content, :cover, :position, :status, :remove_cover)\n end",
"def subject_params\n params.require(:subject).permit(:subject) #requires model subject and column subject\n end",
"def create\n @career_subject = CareerSubject.new(career_subject_params)\n\n respond_to do |format|\n if @career_subject.save\n format.html { redirect_to @career_subject, notice: 'Career subject was successfully created.' }\n format.json { render :show, status: :created, location: @career_subject }\n else\n format.html { render :new }\n format.json { render json: @career_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject_session = SubjectSession.new(subject_session_params)\n\n respond_to do |format|\n if @subject_session.save\n format.html { redirect_to @subject_session, notice: 'Subject session was successfully created.' }\n format.json { render :show, status: :created, location: @subject_session }\n else\n format.html { render :new }\n format.json { render json: @subject_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t# Instantiate a new object using form parameters\n \t@subject = Subject.new(subject_params)\n\n respond_to do |format|\n # Save the object\n if @subject.save\n #if Save succeeds, redirect to the index action\n \n format.html { \n flash[:notice] = 'Your subject has been successfully created.'\n redirect_to action: :index, notice: 'Your subject has been successfully created.' }\n # OLD: redirect_to action: :index, notice: 'Your subject has been successfully created.'\n # TODO: format.json { render action: :show, status: created, location: @product }\n else\n # If save fails, redisplay the form so user can fix problems\n format.html { \n @subject_count = Subject.count\n render :new }\n # TODO: format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t@subject = Subject.new(subject_params)\n\n\trespond_to do |format|\n\t if @subject.valid? and !params[:content].empty?\n\t\t@subject.save\n\t\tfirst_message = Message.create(content: params[:content], user_id: current_user.id, subject_id: @subject.id)\t\n\n\t\tformat.html { redirect_to @subject, notice: 'Subject was successfully created.' }\n\t\tformat.json { render :show, status: :created, location: @subject }\n\t else\n\t\tsetup_new_subject_params\n\t\tif params[:content].empty?\n\t\t\t@missing_content = true\n\t\tend\n\t\tformat.html { render :new }\n\t\tformat.json { render json: @subject.errors, status: :unprocessable_entity }\n\t end\n\t end\n end",
"def create\n hasError = 0\n @subject = Subject.new(params[:subject])\n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\"\n hasError = 1\n else\n if @subject.save\n params[:teachers_id].each{|t|\n teacher_aux =Teacher.find(t)\n @subject.teachers << teacher_aux\n }\n CustomLogger.debug(\"Subject created\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject= Subject.new\n end\n end\n restore_lists\n end",
"def new\n @subject = current_user.subjects.where(project_id: @project.id).new(subject_params)\n end",
"def subject_params\n params.require(:subject).permit(:number,:name => [])\n end",
"def create\n respond_to do |format|\n if ExamSubject.create(exam_subject_params[:exam_subject])\n format.html { redirect_to exams_path, notice: 'Exam marks saved.' }\n else\n format.html { render :new }\n end\n end\n end",
"def university_subject_params\n params.require(:university_subject).permit(:university_id, :subject_id)\n end",
"def create\n @resource = Resource.new(params[:resource])\n @terms = Term.all_iit_subjects\n\n respond_to do |format|\n if @resource.save\n format.html { redirect_to @resource, notice: 'Resource was successfully created.' }\n format.json { render json: @resource, status: :created, location: @resource }\n else\n format.html { render action: \"new\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @subject = Subject.new(params[:subject])\n if (user_signed_in? && !(@subject.users.exists?(current_user)))\n flash[:alert]=\"Môžeš pridávať len kurzy v ktorých učíš!\"\n render :action=> \"new\"\n else\n respond_to do |format|\n if @subject.save\n format.html { redirect_to @subject, notice: 'Nový kurz bol vytvorený.' }\n format.json { render json: @subject, status: :created, location: @subject }\n else\n format.html { render action: \"new\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:subjectName, :startWeek, :semester_id, :field_id, :year)\n end",
"def new\n @subject = Subject.find_by_name(params[:subject_name])\n @convo = Convo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @convo }\n end\n end",
"def index\n @curriculum_subjects = Subject.all.where(is_core: false, is_pivats: false, is_lunch: false, is_tutorial: false, is_ppa: false)\n @core_subjects = Subject.all.where(is_core: true, is_pivats: false)\n authorize @curriculum_subjects\n\n @subject = Subject.new\n @subject.sub_subjects.build\n # authorize @curriculum_subjects\n\n end",
"def index\n @subjects = @client.subjects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @subjects }\n end\n end",
"def index\n @thesubjects = Thesubject.all\n end",
"def index\n @mysubjects = Mysubject.all\n end",
"def create\n @subject = Subject.new(params[:subject])\n\n respond_to do |format|\n if @subject.save\n format.html { redirect_to(@subject) }\n format.xml { render :xml => @subject, :status => :created, :location => @subject }\n format.json { render :text => '{status: \"success\", message: \"成功添加报到项!\"}'}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n format.json { render :text => \"{status: 'failed', error:#{@tip.errors.full_messages.to_json}}\"}\n end\n end\n end",
"def list_subjects(study_id)\n act = SubjectListAction.new(self)\n act.get(study_id)\n end",
"def subject_params\n #params.require(:subject).permit(:name, :category_id, :user_id, messages_attributes: [:id, :created_at, :update_at, :subject_id, :content, :user_id, :category_id])\n\tparams.require(:subject).permit(:name, :category_id, :user_id)\n end",
"def create\n @chunker_subject = ChunkerSubject.new(chunker_subject_params)\n\n respond_to do |format|\n if @chunker_subject.save\n format.html { redirect_to chunker_subjects_path, notice: 'Chunker subject was successfully created.' }\n format.json { render :show, status: :created, location: @chunker_subject }\n else\n format.html { render :new }\n format.json { render json: @chunker_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:name, :position, :visible, :created_at)\n end",
"def create\n @resource = Resource.new(resource_params)\n subject = Subject.find(params[:resource][:subject])\n @resource.subject = subject\n @resource.user_id = current_user.id\n if @resource.save\n flash[:success] = \"Successfully created resource\"\n subject.resource_count = subject.resource_count + 1\n subject.save\n redirect_to subject_url(subject)\n else\n flash[:danger] = \"Failed to create resource\"\n redirect_to new_resource_url\n end\n end"
] |
[
"0.7093269",
"0.70017576",
"0.6920761",
"0.6879977",
"0.68733424",
"0.68470126",
"0.68272763",
"0.6759715",
"0.67476565",
"0.6704417",
"0.6680183",
"0.6653926",
"0.66498274",
"0.6640361",
"0.65838623",
"0.6575236",
"0.6574849",
"0.65735793",
"0.6570703",
"0.65252584",
"0.6524692",
"0.6524692",
"0.6524692",
"0.65064394",
"0.6503311",
"0.64891195",
"0.64812124",
"0.6472525",
"0.64478403",
"0.6440304",
"0.6436964",
"0.6428746",
"0.6426045",
"0.64162767",
"0.63997316",
"0.6395347",
"0.6390824",
"0.63782424",
"0.63663006",
"0.6338505",
"0.63384867",
"0.63304234",
"0.6268391",
"0.6263334",
"0.62564135",
"0.62544996",
"0.62359333",
"0.62304574",
"0.6206921",
"0.61945796",
"0.6153123",
"0.6150331",
"0.6143251",
"0.6135877",
"0.61316556",
"0.6127227",
"0.61243796",
"0.61146086",
"0.61076826",
"0.60857224",
"0.6084597",
"0.606628",
"0.60628164",
"0.6048927",
"0.6011559",
"0.6011559",
"0.60061723",
"0.59918475",
"0.5976705",
"0.59493524",
"0.5947693",
"0.59289116",
"0.59250855",
"0.5917769",
"0.5889582",
"0.5879827",
"0.58747184",
"0.58712256",
"0.5868874",
"0.58678806",
"0.5867186",
"0.58609486",
"0.5853946",
"0.5849409",
"0.58489585",
"0.58319974",
"0.58135736",
"0.5807423",
"0.5806638",
"0.57957643",
"0.5790302",
"0.57875454",
"0.5779803",
"0.5778284",
"0.57746685",
"0.5771768",
"0.5769996",
"0.57677877",
"0.5766857",
"0.5759273",
"0.57580054"
] |
0.0
|
-1
|
PATCH/PUT /subjects/1 PATCH/PUT /subjects/1.json
|
def update
respond_to do |format|
if @subject.update(subject_params)
format.html { redirect_to @subject, notice: 'Das Fach wurde erfolgreich geändert.' }
format.json { render :show, status: :ok, location: @subject }
else
format.html { render :edit }
format.json { render json: @subject.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n\n format.html { redirect_to subjects_url, :notice => 'Subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @title = \"Edit Subject\"\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject = @client.subjects.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n flash[:notice] = 'Subject was successfully updated.'\n format.html { redirect_to client_subject_url(@client, @subject) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @manual_subject = Manual::Subject.find(params[:id])\n\n respond_to do |format|\n if @manual_subject.update_attributes(params[:manual_subject])\n format.html { redirect_to @manual_subject, notice: 'Subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @manual_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n\tsetup_edit_subject_params\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\trespond_to do |format|\n\t\t\tif @subject.update(subject_params)\n\t\t\t\tcreate_audit __method__, 'subject', @subject.id\n\t\t\t\tformat.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n\t\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: @subject.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n respond_to do |format|\n if @mysubject.update(mysubject_params)\n format.html { redirect_to @mysubject, notice: 'Mysubject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mysubject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to report_cards_form_subjects_path(@form), notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: report_cards_form_subjects_path(@form) }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @student_subject.update(student_subject_params)\n format.html { redirect_to @student_subject, notice: 'Student subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_subject }\n else\n format.html { render :edit }\n format.json { render json: @student_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to @subject, notice: t('controller.successfully_updated', model: t('activerecord.models.subject')) }\n format.json { head :no_content }\n else\n prepare_options\n format.html { render action: \"edit\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject = Subject.find_by_hashed_id(params[:id])\n \n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n flash[:notice] = 'Subject was successfully updated.'\n format.html { redirect_to(@subject) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @thesubject.update(thesubject_params)\n format.html { redirect_to @thesubject, notice: 'Thesubject was successfully updated.' }\n format.json { render :show, status: :ok, location: @thesubject }\n else\n format.html { render :edit }\n format.json { render json: @thesubject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subjects_user.update(subjects_user_params)\n format.html { redirect_to @subjects_user, notice: 'Subjects user was successfully updated.' }\n format.json { render :show, status: :ok, location: @subjects_user }\n else\n format.html { render :edit }\n format.json { render json: @subjects_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n flash[:notice] = 'Subject was successfully updated.'\n format.html { redirect_to(@subject) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject.errors }\n end\n end\n end",
"def update\n base_params = subject_params.select {|k,v| k != \"discipline\"}\n base_params.each_pair do |property,value|\n @subject.send(property+'=',value)if @subject.respond_to?(property+'=')\n end\n @subject.discipline= Discipline.find(subject_params[:discipline][:id])\n if @subject.save\n set_subject\n #respond_with @subject\n render json: @subject, status: :ok\n else\n ##render json: @subject.errors, status: :unprocessable_entity\n respond_with @subject.errors, status: :unprocessable_entity\n end\n end",
"def update\n session[:setting] = \"\"\n @subject = @student.subject.find(params[:id])\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to student_path(@student), notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @exam_subject.update(exam_subject_params)\n format.html { redirect_to @exam_subject, notice: 'Exam subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_subject }\n else\n format.html { render :edit }\n format.json { render json: @exam_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @course_subject.update(course_subject_params)\n format.html { redirect_to @course_subject, notice: 'Course subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @course_subject }\n else\n format.html { render :edit }\n format.json { render json: @course_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @subject.update(subject_params)\r\n format.html { redirect_to subjects_url, notice: 'Subject was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @subject }\r\n format.js\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @subject.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n\n respond_to do |format|\n if @curriculums_subject.update_attributes(params[:curriculums_subject])\n format.html { redirect_to @curriculums_subject, notice: 'Curriculums subject was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @curriculums_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tutor_subject.update(tutor_subject_params)\n format.html { redirect_to @tutor_subject, notice: 'Tutor subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @tutor_subject }\n else\n format.html { render :edit }\n format.json { render json: @tutor_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @university_subject.update(university_subject_params)\n format.html { redirect_to @university_subject, notice: 'University subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @university_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # byebug\n @subject = get_subject\n respond_to do |format|\n # Save the object\n # if @subject.update_attributes(subject_params)\n if @subject.update(subject_params)\n #if update succeeds, redirect to the index action\n \n format.html { \n flash[:notice] = 'Your subject has been successfully updated.'\n redirect_to action: :index, notice: 'Your subject has been successfully updated.' }\n # TODO: format.json { head :no_content }\n else\n # If updates fails, redisplay the form so user can fix problems\n format.html {\n @subject_count = Subject.count \n render :edit }\n # TODO: format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject = Subject.find(params[:id])\n @subject_types = SubjectType.select_list\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to(admin_subject_path(@subject), :notice => 'Subject was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@param_subject = ParamSubject.find(params[:id])\n\n\t\tif @param_subject.update_attributes(params[:param_subject])\n\t\t\thead :no_content\n\t\telse\n\t\t\trender json: @param_subject.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def update\n if @user_subject.update(user_subject_params)\n render :show, status: :ok, location: @user_subject\n else\n render json: @user_subject.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @subjectm.update(subjectm_params)\n format.html { redirect_to @subjectm, notice: 'Subjectm was successfully updated.' }\n format.json { render :show, status: :ok, location: @subjectm }\n else\n format.html { render :edit }\n format.json { render json: @subjectm.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_subjects_via_api(subject_name_array)\n return if subject_name_array.blank?\n\n # record the list of current teacher set <--> subject associations,\n # so we can prune the subjects later.\n old_subjects = Array.new\n\n self.subjects.each do |subject|\n old_subjects.push(subject.id)\n end\n\n # delete the current teacher set <--> subject associations,\n # so we can remake them fresh from the bib info.\n self.subjects.clear\n\n # Create all the subjects and teacher_set <--> subject associations specified in the bib\n # record we're processing, ignoring duplicate associations.\n subject_name_array.each do |subject_name|\n subject_name = clean_subject_string(subject_name)\n\n subject = Subject.find_or_create_by(title: subject_name)\n subject_teacher_set = SubjectTeacherSet.find_or_create_by(teacher_set_id: self.id, subject_id: subject.id)\n end\n\n prune_subjects(old_subjects)\n end",
"def update\n @subject = Subject.find(params[:id])\n\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to(@subject) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\", message: \"成功更新报到项!\"}'}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject.errors, :status => :unprocessable_entity }\n format.json { render :text => \"{status: 'failed', error:#{@tip.errors.full_messages.to_json}}\"}\n end\n end\n end",
"def update\n respond_to do |format|\n if @career_subject.update(career_subject_params)\n format.html { redirect_to @career_subject, notice: 'Career subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @career_subject }\n else\n format.html { render :edit }\n format.json { render json: @career_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_of_speech.update(subject_of_speech_params)\n format.html { redirect_to @subject_of_speech, notice: 'Subject of speech was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_of_speech }\n else\n format.html { render :edit }\n format.json { render json: @subject_of_speech.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @subject = args[:subject] if args.key?(:subject)\n end",
"def update\n respond_to do |format|\n if @subject_type.update(subject_type_params)\n format.html { redirect_to @subject_type, notice: 'Subject type was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_type }\n else\n format.html { render :edit }\n format.json { render json: @subject_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @experiment = @subject.experiment\n respond_to do |format|\n if @subject.update(subject_params)\n set_subjects\n @show_modal = 'hide'\n format.js\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { head :no_content }\n else\n set_subjects\n @show_modal = 'show'\n format.js\n format.html { render action: 'edit' }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if Subject.find_by(:id=>params[:id]).is_core\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to subjects_path+\"#tab_tab2\", notice: @subject.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n else\n\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to subjects_path, notice: @subject.name + ' was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n unless @edit_or_delete_right\n redirect_to subjects_url,notice:\"您没有修改别人编写的试卷的权限\"\n end\n respond_to do |format|\n if @subject.update(subject_params)\n format.html { redirect_to subjects_url, notice: \"已经成功更新试卷:#{@subject.title}.\" }\n format.json { render :show, status: :ok, location: subjects_url }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_teacher.update(subject_teacher_params)\n format.html { redirect_to @subject_teacher, notice: 'Subject teacher was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_teacher }\n else\n format.html { render :edit }\n format.json { render json: @subject_teacher.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faq = Faq.find(params[:id])\n\n respond_to do |format|\n if @faq.update_attributes(params[:faq])\n format.html { redirect_to @faq, notice: 'FAQ atualizada com sucesso.' }\n format.json { head :no_content }\n else\n @subjects = Subject.all\n format.html { render action: \"edit\" }\n format.json { render json: @faq.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_class.update(subject_class_params)\n format.html { redirect_to @subject_class, notice: 'Subject class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subject_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @program_subject.update(program_subject_params)\n format.html { redirect_to @program_subject}\n format.json { render :show, status: :ok, location: @program_subject }\n else\n format.html { render :edit }\n format.json { render json: @program_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_file.update(subject_file_params)\n format.html { redirect_to @subject_file, notice: 'Subject file was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_file }\n else\n format.html { render :edit }\n format.json { render json: @subject_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @preferredsubject.update(preferredsubject_params)\n format.html { redirect_to @preferredsubject, notice: 'Preferredsubject was successfully updated.' }\n format.json { render :show, status: :ok, location: @preferredsubject }\n else\n format.html { render :edit }\n format.json { render json: @preferredsubject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject.update title: params[:title], start_date: params[:start_date], end_date: params[:end_date], teacher_id: @current_user.id\n format.html { redirect_to @subject, notice: 'La matière a été modifiée' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_item.update(subject_item_params)\n format.html { redirect_to @subject_item, notice: 'Subject item was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_item }\n else\n format.html { render :edit }\n format.json { render json: @subject_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject_source = SubjectSource.find(params[:id])\n\n respond_to do |format|\n if @subject_source.update_attributes(params[:subject_source])\n format.html { redirect_to @subject_source, notice: 'Subject source was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject_permission = SubjectPermission.find(params[:id])\n\n respond_to do |format|\n if @subject_permission.update_attributes(params[:subject_permission])\n format.html { redirect_to(@subject_permission, :notice => 'SubjectPermission was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject_permission.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n admin_only\n\n new_tutor_ids_plus_deletion = []\n unless params[:subject][:people_teaching_attributes].blank?\n params[:subject][:people_teaching_attributes].each do |attribute|\n if attribute[1][:incoming_tutor_id].nil?\n id = attribute[1][:id]\n else\n id = attribute[1][:incoming_tutor_id]\n end\n destroy = attribute[1][:_destroy]\n new_tutor_ids_plus_deletion << [id, destroy]\n end\n end\n\n respond_to do |format|\n if @subject.update(subject_params)\n\n unless new_tutor_ids_plus_deletion == []\n new_tutor_ids_plus_deletion.each do |pair|\n if pair[1] == \"1\" #that means we should delete this one...\n e = ProvidingEnrollment.find_by_user_id_and_subject_id(pair[0], @subject.id)\n begin\n e.destroy!\n rescue\n puts 'Looks like that user was added and removed in one go...'\n end\n else #that means we should make a new one if it doesn't already exist...\n if ProvidingEnrollment.find_by_user_id_and_subject_id(pair[0], @subject.id).nil?\n e = ProvidingEnrollment.new\n e.user_id = pair[0]\n e.subject_id = @subject.id\n e.save!\n end\n end\n end\n end\n\n format.html { redirect_to @subject, notice: 'Subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject }\n else\n format.html { render :edit }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @recommend_recommend_subject = Recommend::RecommendSubject.find(params[:id])\n\n respond_to do |format|\n if @recommend_recommend_subject.update_attributes(params[:recommend_recommend_subject])\n format.html { redirect_to @recommend_recommend_subject, notice: 'Recommend subject was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recommend_recommend_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_subject(school, name, subject)\n\tschool[:instructors].each { |instructor| instructor[:subject] = subject if instructor[:name] == name}\nend",
"def update\n @semester_subject = SemesterSubject.find(params[:id])\n\n respond_to do |format|\n if @semester_subject.update_attributes(params[:semester_subject])\n flash[:notice] = 'SemesterSubject was successfully updated.'\n format.html { redirect_to(@semester_subject) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @semester_subject.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def edit\n @book = Book.find(params[:id])\n @subjects = Subject.all\n end",
"def edit\n @book = Book.find(params[:id])\n @subjects = Subject.all\n end",
"def update\n @book = Book.find(params[:id])\n if @book.update_attributes(book_param)\n redirect_to :action => 'show', :id => @book\n else\n @subjects = Subject.all\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @chunker_subject.update(chunker_subject_params)\n format.html { redirect_to @chunker_subject, notice: 'Chunker subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @chunker_subject }\n else\n format.html { render :edit }\n format.json { render json: @chunker_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n params[:subject][:title].strip! if !params[:subject][:title].nil?\n params[:subject][:content].strip! if !params[:subject][:content].nil?\n @subject.title = params[:subject][:title]\n @subject.content = params[:subject][:content]\n @subject.for_correctors = params[:subject][:for_correctors] if !params[:subject][:for_correctors].nil?\n @subject.important = params[:subject][:important] if !params[:subject][:important].nil?\n @subject.for_wepion = params[:subject][:for_wepion] if !params[:subject][:for_wepion].nil?\n \n @subject.for_wepion = false if @subject.for_correctors # We don't allow Wépion if for correctors\n \n if @subject.valid?\n\n @subject.title = @subject.title.slice(0,1).capitalize + @subject.title.slice(1..-1)\n\n # Set associated object (category, section, chapter, exercise, problem)\n err = set_associated_object\n error_update([err]) and return if !err.empty?\n\n # Attached files\n @error_message = \"\"\n update_files(@subject)\n error_update([@error_message]) and return if !@error_message.empty?\n \n @subject.save\n flash[:success] = \"Votre sujet a bien été modifié.\"\n session[\"successSubject\"] = \"ok\"\n redirect_to subject_path(@subject, :q => @q)\n else\n error_update(@subject.errors.full_messages) and return\n end\n end",
"def update!(**args)\n @subject = args[:subject] if args.key?(:subject)\n @type = args[:type] if args.key?(:type)\n end",
"def update\n @subject = Subject.find(params[:id])\n if (user_signed_in? && !(@subject.users.include?(current_user)))\n flash[:alert]=\"Nemôžeš sa vymazať z kurzu!\"\n render :action=> \"new\"\n else\n params[:subject][:user_ids] ||= []\n respond_to do |format|\n if @subject.update_attributes(params[:subject])\n format.html { redirect_to @subject, notice: 'Kurz bol upravený.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subject.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def update\n @book = Book.find(params[:id])\n\n if @book.update_attributes(book_param)\n redirect_to :action => 'show', :id => @book\n else\n @subjects = Subject.all\n render :action => 'edit'\n end\n end",
"def update\n respond_to do |format|\n if @school_cycle_has_subject.update(school_cycle_has_subject_params)\n format.html { redirect_to [\"asig\",@school_cycle_has_subject], notice: 'School cycle has subject was successfully updated.' }\n format.json { render :show, status: :ok, location: @school_cycle_has_subject }\n else\n format.html { render :edit }\n format.json { render json: @school_cycle_has_subject.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subject_courses_relation.update(subject_courses_relation_params)\n format.html { redirect_to @subject_courses_relation, notice: 'Subject courses relation was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_courses_relation }\n else\n format.html { render :edit }\n format.json { render json: @subject_courses_relation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update(params_topic)\n render json: topic, status: 200\n else\n render json: topic.errors, status: 422\n end\n\n end",
"def update\n respond_to do |format|\n if @subject_session.update(subject_session_params)\n format.html { redirect_to @subject_session, notice: 'Subject session was successfully updated.' }\n format.json { render :show, status: :ok, location: @subject_session }\n else\n format.html { render :edit }\n format.json { render json: @subject_session.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n topic = Topic.find(params[:id])\n if topic.update_attributes(topic_params)\n render :json => {:ok => true}, :head => :no_content\n else\n render :json => {:ok => false, :message => topic.errors}, :status => :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @all_subject_role.update(all_subject_role_params)\n format.html { redirect_to @all_subject_role, notice: 'All subject role was successfully updated.' }\n format.json { render :show, status: :ok, location: @all_subject_role }\n else\n format.html { render :edit }\n format.json { render json: @all_subject_role.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_update\n\tputs\"in subject update method 888888888888885555555555555555555555\"\n \t\t @curriculum = MgSyllabus.find(params[:id])\n\t\t \n \t\t if @curriculum.update(curr_params)\n \t\t redirect_to :controller => \"curriculum\" , :action => \"class_show\"\n \t\t else\n \t\t render 'subject_edit'\n \t\t end\nend",
"def set_subject\n begin\n @subject = Subject.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n logger.error \"Attempt to access invalid subject #{params[:id]}\"\n @subject_not_found = true\n render json: {message: \"Illegal subject access request\"}, status: :unauthorized\n return\n else\n @subject_not_found = false\n end\n end",
"def update(instructor, subject, school)\n school[:instructors].each do |i|\n i[:subject] = subject if i[:name] == instructor\n end\nend",
"def subject_params\n params.require(:subject).permit(:name, :grade, :tutor_id)\n end",
"def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @topic.update_attributes!(topic_params)\n json_response(@topic)\n end",
"def subject=(subject)\n self.subjects = [subject]\n end",
"def update\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @student = @user.student\n @subject_competency_array = params[:student][:subjects_of_interest]\n #remove subjects in dB before update\n @student[:subjects_of_interest].delete_if do |s|\n s != nil\n end\n @student.save\n @subject_competency_array.each do |s|\n @student.subjects_of_interest.push({\n \"subject\" => s[:subject],\n \"competency\" => s[:competency]\n })\n end\n @student.save\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to user_profile_url, notice: 'Profile was successfully updated.' }\n else\n render :action => 'new'\n end\n end\n end",
"def update\n params[:topic].delete :messages_attributes\n @topic = Topic.find(params[:id])\n\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to topic_url(@topic), notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subtopic = Subtopic.find(params[:id])\n\n respond_to do |format|\n if @subtopic.update_attributes(params[:subtopic])\n format.html { redirect_to @subtopic, notice: 'Subtopic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subtopic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n @title = \"Edit Book\"\n\n process_publisher\n\n process_authors\n\n process_subjects\n \n bookParams = params[:book]\n\n params.each {|key, value| \n if key.match(/remove_authorship_/) \n if value == \"on\"\n authorship_id = key.split('_')[2]\n authorship = Authorship.find(authorship_id) \n authorship.destroy if authorship\n end\n elsif key.match(/remove_subject_/)\n subject_id = key.split('_')[2]\n subject = Subject.find(subject_id)\n @book.subjects.delete(subject) if subject\n end\n }\n respond_to do |format|\n if @book.update_attributes(bookParams)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @topic.update_attributes(params[:topic])\n format.html { redirect_to @topic, notice: 'Topic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @topic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_subject(instructor_name, new_subject)\n\t\tSCHOOL[:instructors].each do |hash|\n\t\t\thash[:subject]=new_subject if hash[:name]==instructor_name\n\t\tend\n\tend",
"def subject_params\n params.fetch(:subject, {}).permit(:name)\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def update_subject(school, instructor_name, new_subject)\n school[:instructors].collect do |instructor|\n if instructor[:name] == instructor_name\n instructor[:subject] = new_subject\n end\n end\nend",
"def update\n hasError = 0 \n @subject = Subject.find(params[:id]) \n if params[:teachers_id] == nil\n session[:error] =\"You have to select one or more teachers.\" \n hasError = 1\n else\n if @subject.update_attributes(params[:subject]) \n @subject.teachers.delete_all\n adding_teachers \n CustomLogger.debug(\"Subject updated\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject = Subject.new\n end \n end \n restore_lists\n end",
"def set_subject\r\n @subject = Subject.find(params[:id])\r\n end",
"def UpdateTopic id,params = {}\n \n APICall(path: \"topics/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end",
"def update\n teacher_exclusive\n respond_to do |format|\n if @note.update note: params[:note], teacher_id: @current_user.id, student_id: params[:student_id], subject_id: params[:subject_id], test_id: params[:test_id]\n format.html { redirect_to test_grade_path(params[:test_id]), notice: 'La note a été actualisée' }\n format.json { render :show, status: :ok, location: @note }\n else\n format.html { test_grade_path(params[:test_id]) }\n format.json { render json: @note.errors, status: :unprocessable_entity }\n end\n end\n end",
"def subject_params\n params.require(:subject).permit(:name, :course_id)\n end",
"def update\n @criterion = Criterion.find(params[:id])\n @subject = @criterion.subject\n \n\n respond_to do |format|\n if @criterion.update_attributes(params[:criterion])\n flash[:notice] = 'Criterion was successfully updated.'\n format.html { redirect_to(subject_path(@subject, :anchor=>dom_id(@subject))) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @criterion.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @concept = Concept.find(params[:id])\n\n respond_to do |format|\n if @concept.update_attributes(params[:concept])\n format.html { redirect_to @concept, notice: 'Concept was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concept.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_subject\n @subject = Subject.find params[:subject_id]\n end",
"def update\n @subsidy = Subsidy.find(params[:id])\n\n respond_to do |format|\n if @subsidy.update_attributes(params[:subsidy])\n format.html { redirect_to @subsidy, notice: 'Заявка на материальную выплату успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @subsidy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @subtopics_question.update(subtopics_question_params)\n format.html { redirect_to @subtopics_question, notice: 'Subtopics question was successfully updated.' }\n format.json { render :show, status: :ok, location: @subtopics_question }\n else\n format.html { render :edit }\n format.json { render json: @subtopics_question.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @subject_area = SubjectArea.find(params[:id])\n\n respond_to do |format|\n if @subject_area.update_attributes(params[:subject_area])\n format.html { redirect_to(@subject_area, :notice => 'Subject area was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @subject_area.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n if @student_major.update_attributes(student_major_params)\n format.html { redirect_to @student_major, notice: 'Student major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end",
"def set_subject\n @subject = Subject.find(params[:id])\n end"
] |
[
"0.7399212",
"0.7341869",
"0.72854865",
"0.712811",
"0.7044038",
"0.70004374",
"0.70004374",
"0.6995105",
"0.6978002",
"0.68667805",
"0.68179256",
"0.6792362",
"0.67713135",
"0.675009",
"0.6706549",
"0.66950065",
"0.6676277",
"0.66413474",
"0.66335547",
"0.6615197",
"0.6586615",
"0.6577629",
"0.6576807",
"0.65587753",
"0.65492016",
"0.65484345",
"0.6526201",
"0.650695",
"0.6443315",
"0.6440967",
"0.64172894",
"0.6403855",
"0.6378675",
"0.6361203",
"0.6343814",
"0.6340319",
"0.6310024",
"0.6275169",
"0.627241",
"0.6269612",
"0.62593174",
"0.62492007",
"0.6247172",
"0.6207522",
"0.62051135",
"0.62034607",
"0.61801285",
"0.61588806",
"0.6155949",
"0.6126359",
"0.6104844",
"0.60745656",
"0.60625184",
"0.6030227",
"0.6030227",
"0.600485",
"0.5991073",
"0.5978476",
"0.59593135",
"0.59591943",
"0.5955182",
"0.59212977",
"0.59134924",
"0.5902155",
"0.5888599",
"0.58709675",
"0.58571917",
"0.58499634",
"0.58432513",
"0.5837573",
"0.5815357",
"0.5814815",
"0.5807",
"0.5801897",
"0.57855463",
"0.5785364",
"0.5784841",
"0.5778857",
"0.57777566",
"0.5766282",
"0.5744293",
"0.57374847",
"0.57359654",
"0.57359654",
"0.57302004",
"0.5727606",
"0.57254535",
"0.57230717",
"0.5722725",
"0.56923735",
"0.56842244",
"0.56837624",
"0.56837624",
"0.5682963",
"0.56801337",
"0.56678677",
"0.56616837",
"0.56557167",
"0.5650907",
"0.5650907"
] |
0.6620601
|
19
|
DELETE /subjects/1 DELETE /subjects/1.json
|
def destroy
@subject.destroy
respond_to do |format|
format.html { redirect_to subjects_url, notice: 'Das Fach wurde erfolgreich gelöscht.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @title = \"Destroy Subject\"\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @mysubject.destroy\n respond_to do |format|\n format.html { redirect_to mysubjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject = @client.subjects.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n flash[:notice] = 'Subject was successfully removed.' \n format.html { redirect_to(client_subjects_url(@client)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @manual_subject = Manual::Subject.find(params[:id])\n @manual_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to manual_subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject.delete\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: 'La matière a été supprimée' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to(subjects_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"def destroy\n @subject = Subject.find_by_hashed_id(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to(subjects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to form_subjects_url(@form), notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.subject')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\tcreate_audit __method__, 'subject', @subject.id\n\t\t@subject.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to subjects_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.html { redirect_to(subjects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n admin_only\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n @subject = Subject.find(params[:id])\n end",
"def delete_sub_subject\n @sub_subject=SubSubject.find_by(:id=>params[:id])\n @sub_subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: @sub_subject.show_name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @thesubject.destroy\n respond_to do |format|\n format.html { redirect_to thesubjects_url, notice: 'Thesubject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @curriculums_subject = CurriculumsSubject.find(params[:id])\n @curriculums_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to curriculums_subjects_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @university_subject.destroy\n respond_to do |format|\n format.html { redirect_to university_subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_subject.destroy\n respond_to do |format|\n format.html { redirect_to student_subjects_url, notice: 'Student subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_subject.destroy\n respond_to do |format|\n format.html { redirect_to exam_subjects_url, notice: 'Exam subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subjects_user.destroy\n respond_to do |format|\n format.html { redirect_to subjects_path(@subject), notice: 'Subjects user was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subjectm.destroy\n respond_to do |format|\n format.html { redirect_to subjectms_url, notice: 'Subjectm was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tutor_subject.destroy\n respond_to do |format|\n format.html { redirect_to tutor_subjects_url, notice: 'Tutor subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n begin\n @subject = Subject.find(params[:id])\n @subject.destroy\n rescue => error\n @failure_message = error.message\n ensure\n respond_to do |format|\n if @failure_message.blank?\n flash[:notice] = 'Subject successfully deleted'\n else\n flash[:error] = @failure_message\n end\n format.html { redirect_to(session[:admin_subjects_index_url] ||= admin_subjects_path) }\n format.xml { head :ok }\n end\n end\n end",
"def destroy\n @subject = Subject.find(params[:id])\n @subject.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to subjects_url ,:notice=>'Subject has been deleted.'}\n format.json { head :ok }\n end\n end",
"def destroy\n @subject_file.destroy\n respond_to do |format|\n format.html { redirect_to subject_files_path(:subject => \"all\"), notice: 'Subject file was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n subject = get_subject\n subject.destroy\n respond_to do |format|\n format.html { \n flash[:notice] = \"Subject '#{subject.name}' has been successfully destryed.\"\n redirect_to action: :index, notice: \"Subject '#{subject.name}' has been successfully destryed.\" }\n # TODO: format.json { head :no_content }\n end\n \n end",
"def destroy\n @course_subject.destroy\n respond_to do |format|\n format.html { redirect_to course_subjects_url, notice: 'Course subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n if @subject.destroy\r\n respond_to do |format|\r\n format.html { redirect_to subjects_url, notice: 'Subject was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n else\r\n flash[:alert] = \"cannot delete subject while books exist\"\r\n redirect_to subjects_url\r\n end\r\n end",
"def destroy\n @program_subject.destroy\n respond_to do |format|\n format.html { redirect_to program_subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n session[:setting] = \"\"\n @subject = @student.subject.find(params[:id])\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to project_subjects_path(@project) }\n format.js\n end\n end",
"def destroy\n if Subject.destroy_all(id: params[:id])\n flash[:success] = \"Subject deleted.\"\n else\n flash[:danger] = \"Failed to delete subject.\"\n end\n\n # Return to index\n redirect_to subjects_path\n end",
"def destroy\n @subject_type.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.subject_type')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_type.destroy\n respond_to do |format|\n format.html { redirect_to subject_types_url, notice: 'Subject type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_of_speech.destroy\n respond_to do |format|\n format.html { redirect_to subject_of_speeches_url, notice: 'Subject of speech was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @career_subject.destroy\n respond_to do |format|\n format.html { redirect_to career_subjects_url, notice: 'Career subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recommend_recommend_subject = Recommend::RecommendSubject.find(params[:id])\n @recommend_recommend_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to recommend_recommend_subjects_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @experiment = @subject.experiment\n @subject.destroy\n set_subjects\n respond_to do |format|\n format.html { redirect_to experiment_subjects_path(@experiment) }\n format.json { head :no_content }\n format.js\n end\n end",
"def destroy\n\tcategory = @subject.category\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to category_path(category), notice: 'Subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject = Subject.find(params[:subject_id])\n # Need to delete pageable too?\n @pageable = @page.pageable\n @pageable.destroy\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_subject_pages_path(@subject) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @semester_subject = SemesterSubject.find(params[:id])\n @semester_subject.destroy\n\n respond_to do |format|\n format.html { redirect_to(semester_subjects_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subject_permission = SubjectPermission.find(params[:id])\n @subject_permission.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_permissions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subject_source = SubjectSource.find(params[:id])\n @subject_source.destroy\n\n respond_to do |format|\n format.html { redirect_to subject_sources_url }\n format.json { head :no_content }\n end\n end",
"def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end",
"def destroy\n @school_cycle_has_subject.destroy\n respond_to do |format|\n format.html { redirect_to asig_school_cycle_has_subjects_path, notice: 'School cycle has subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_teacher.destroy\n respond_to do |format|\n format.html { redirect_to subject_teachers_url, notice: 'Subject teacher was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_courses_relation.destroy\n respond_to do |format|\n format.html { redirect_to subject_courses_relations_url, notice: 'Subject courses relation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if Subject.find_by(:id=>params[:id]).is_core\n\n @subject.destroy\n #*TODO* need to delete sub sujects too?\n respond_to do |format|\n format.html { redirect_to subjects_path+\"#tab_core\", notice: @subject.name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n else\n @subject.destroy\n #*TODO* need to delete sub subjects too?\n respond_to do |format|\n format.html { redirect_to subjects_path, notice: @subject.name + ' was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end",
"def destroy\n @uni_subject = UniSubject.find(params[:id])\n flash.keep(:edit_subject)\n \n if(@uni_subject != nil)\n @uni_subject.destroy\n end\n\n respond_to do |format|\n if(flash[:edit_subject])\n format.html { redirect_to edit_index_uni_uni_subjects_path(params[:uni_id]) }\n format.json { head :no_content }\n else\n format.html { redirect_to new_index_uni_uni_subjects_path(params[:uni_id]) }\n end\n end\n end",
"def destroy\n @subject = Subject.find(params[:id])\n CustomLogger.debug(\"Subject destroyed\")\n CustomLogger.debug(\"--------------\") \n to_log(@subject) \n @subject.destroy\n @subject = Subject.new\n restore_lists\n end",
"def destroy\n @subject_class.destroy\n respond_to do |format|\n format.html { redirect_to subject_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_item.destroy\n\ttutor = Tutor.find(session[:user_id])\n respond_to do |format|\n format.html { redirect_to tutor, notice: 'Subject item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subject_session.destroy\n respond_to do |format|\n format.html { redirect_to subject_sessions_url, notice: 'Subject session was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n unless @edit_or_delete_right\n redirect_to subjects_url,notice:\"您没有删除别人编写的试卷的权限\"\n end\n @subject.destroy\n respond_to do |format|\n format.html { redirect_to subjects_url, notice: '已成功删除试卷.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Topic.find(params[:id]).destroy\n render :json => {:ok => true}, :head => :no_content\n end",
"def destroy\n @chunker_subject.destroy\n respond_to do |format|\n format.html { redirect_to chunker_subjects_url, notice: 'Chunker subject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @preferredsubject.destroy\n respond_to do |format|\n format.html { redirect_to preferredsubjects_url, notice: 'Preferredsubject was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t@param_subject = ParamSubject.find(params[:id])\n\t\t@param_subject.destroy\n\n\t\thead :no_content\n\tend",
"def delete(params)\n _params = params.clone\n id = _params.delete(:id)\n return unless id\n send_request({method: :delete, subject: subject, id: id}.merge(_params))\n end",
"def delete(params)\n _params = params.clone\n id = _params.delete(:id)\n return unless id\n send_request({method: :delete, subject: subject, id: id}.merge(_params))\n end",
"def destroy\n @discipline.topics.delete_all\n @discipline.destroy\n\n respond_to do |format|\n format.html { redirect_to disciplines_url, notice: 'Discipline was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\t\n\tsubject = @message.subject\n\t@message.destroy\n\trespond_to do |format|\n\t#format.html { redirect_to messages_url, notice: 'Message was successfully destroyed.' }\n\tformat.html { redirect_to subject_path(subject), notice: 'Message was successfully destroyed.' }\n\tformat.json { head :no_content }\n\tend\n end",
"def destroy\n @criterion = Criterion.find(params[:id])\n @criterion.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_url(@criterion.subject)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @all_subject_role.destroy\n respond_to do |format|\n format.html { redirect_to all_subject_roles_url, notice: 'All subject role was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @subtopic = Subtopic.find(params[:id])\n @subtopic.destroy\n\n respond_to do |format|\n format.html { redirect_to subtopics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student_sub_course = StudentSubCourse.find(params[:id])\n @student_sub_course.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sub_courses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @subject_area = SubjectArea.find(params[:id])\n @subject_area.destroy\n\n respond_to do |format|\n format.html { redirect_to(subject_areas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @subsidy = Subsidy.find(params[:id])\n @subsidy.destroy\n\n respond_to do |format|\n format.html { redirect_to subsidies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_subject.destroy\n end",
"def destroy\n @subtopic.destroy\n respond_to do |format|\n format.html { redirect_to subtopics_url, notice: 'Subtopic was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clinical_course = ClinicalCourse.find(params[:id])\n @clinical_course.destroy\n\n respond_to do |format|\n format.html { redirect_to clinical_courses_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 subject_posts_url(@subject.id), subject_id: @subject.id , notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n Student.delete(params[:id])\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coursub.destroy\n respond_to do |format|\n format.html { redirect_to coursubs_url, notice: 'Coursub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end",
"def destroy\n get_work; get_subject\n @work_has_subject.destroy\n\n respond_to do |format|\n format.html {\n case\n when @work\n redirect_to work_work_has_subjects_url(@work)\n when @subject\n redirect_to subject_work_has_subjects_url(@subject)\n else\n redirect_to work_has_subjects_url\n end\n }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exam_student.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Odjavili ste ispit.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @student_major = StudentMajor.find(params[:id])\n @student_major.destroy\n\n respond_to do |format|\n format.html { redirect_to student_majors_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.79004234",
"0.79000086",
"0.7851459",
"0.7812474",
"0.7791248",
"0.77289444",
"0.76450217",
"0.7632434",
"0.75925595",
"0.75750107",
"0.756666",
"0.7557011",
"0.75504565",
"0.7544504",
"0.75402933",
"0.75402933",
"0.75240225",
"0.7490376",
"0.7464556",
"0.7410753",
"0.7399346",
"0.7382354",
"0.7345029",
"0.7281264",
"0.7267264",
"0.7182039",
"0.71799135",
"0.71780694",
"0.7167956",
"0.716461",
"0.7148685",
"0.7138653",
"0.71294767",
"0.7088951",
"0.7074766",
"0.7028508",
"0.70156276",
"0.7012751",
"0.6997114",
"0.6995691",
"0.6994416",
"0.6958236",
"0.6956885",
"0.69432366",
"0.69367874",
"0.6881405",
"0.6861696",
"0.6857954",
"0.68516654",
"0.6850319",
"0.6835799",
"0.68298775",
"0.6801093",
"0.67933536",
"0.67788404",
"0.6776339",
"0.67691",
"0.6763282",
"0.67629814",
"0.67001563",
"0.66559696",
"0.66407144",
"0.66267145",
"0.6618787",
"0.6618787",
"0.6583451",
"0.65627015",
"0.6544768",
"0.6538713",
"0.6531729",
"0.65301675",
"0.6464458",
"0.64613837",
"0.6459208",
"0.64494914",
"0.64113355",
"0.6410887",
"0.6408668",
"0.6400413",
"0.6399506",
"0.6392393",
"0.6392393",
"0.6392393",
"0.6392393",
"0.6387167",
"0.63762057",
"0.6371976",
"0.63693094",
"0.6366427",
"0.63605833",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6359514",
"0.6352106",
"0.63454455"
] |
0.75413173
|
14
|
Use callbacks to share common setup or constraints between actions.
|
def set_subject
@subject = Subject.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 subject_params
params.require(:subject).permit(:number,:name => [])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
Override this method so that Rails uses :ssn in routes instead of :id
|
def to_param
ssn
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ssn\n legacy_ssn\n end",
"def ssn\n # converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-' + @ssn.split(\"-\").last\nend",
"def ssn\n # converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-' + @ssn.split('-').last\nend",
"def ssn\n #converts '123-45-6789' to 'xxx-xx-6789'\n 'xxx-xx-x' + @ssn.split('-').last\nend",
"def reformat_ssn\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset self.ssn to new string\n end",
"def sanitize_ssn\n begin\n ssn = \"%09d\" % self.to_numeric.to_i\n raise \"Too Long\" if ssn.length > 9\n area, group, serial = ssn[0..2], ssn[3..4], ssn[5..8]\n raise \"Area Range Invalid\" unless (\"001\" .. \"665\").cover?(area) or (\"667\" .. \"899\").cover?(area)\n raise \"Group Range Invalid\" unless (\"01\" .. \"99\").cover?(group)\n raise \"Serial Range Invalid\" unless (\"0001\" .. \"9999\").cover?(serial)\n rescue\n return nil\n end\n ssn\n end",
"def reformat_phone_ssn\n phone = self.phone.to_s # change to string in case input as all numbers \n phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.phone = phone # reset self.phone to new string\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset ssn.phone to new string\n end",
"def obfuscate_ssn(ssn)\n ssn_obf = \"XXX-XX-#{ssn[-4..-1]}\"\n end",
"def ssn\n safe_attr('va_eauth_pnid')&.delete('-') if safe_attr('va_eauth_pnidtype') == 'SSN'\n end",
"def to_param\n slug = identifier.find { |id| id.start_with? 'slug:' }\n return super unless slug.present?\n\n Spot::Identifier.from_string(slug).value\n end",
"def format_ssn(ssn_string)\n if ssn_string =~ SSN_REGEX\n ssn_string\n elsif ssn_string =~ SSN_REGEX_WITHOUT_DASHES\n match = Regexp.last_match\n \"#{match[:area]}-#{match[:group]}-#{match[:serial]}\"\n else\n fail MalformedSSNError\n end\n end",
"def routing_number; end",
"def ssn=(new_ssn)\n if new_ssn.blank?\n unset_sparse(\"encrypted_ssn\")\n else\n write_attribute(:encrypted_ssn, self.class.encrypt_ssn(new_ssn))\n end\n end",
"def ssn=(new_ssn)\n if !new_ssn.blank?\n write_attribute(:encrypted_ssn, self.class.encrypt_ssn(new_ssn))\n else\n unset_sparse(\"encrypted_ssn\")\n end\n end",
"def to_param\n if username\n \"#{id}-#{username}\"\n else\n super\n end\n end",
"def verified_ssn?(ssn)\n ssn.start_with?('900', '666') ||\n IdentityConfig.store.test_ssn_allowed_list.include?(ssn.delete('-'))\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end",
"def to_param_from_slug\n slug? ? slug.to_friendly_id : id.to_s\n end",
"def to_param\n \"#{id} #{full_number}\".parameterize\n end",
"def secure_id\n @secure_id_without_dashes ||= super&.gsub(\"-\", \"\")\n end",
"def to_param\n slug ? slug.to_friendly_id : id.to_s\n 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 \"#{id}-#{slug}\"\n end",
"def to_param # overridden\n slug\n end",
"def reformat_phone_and_ssn\n phone = self.phone.to_s # change to string in case input as all numbers \n phone.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.phone = phone # reset self.phone to new string\n\n ssn = self.ssn.to_s # change to string in case input as all numbers \n ssn.gsub!(/[^0-9]/,\"\") # strip all non-digits\n self.ssn = ssn # reset self.phone to new string\n end",
"def find_srid(srname_or_srid)\n Factory::SridProvider.build.find(srname_or_srid)\n end",
"def to_param\n self._slug.blank? ? id.to_s : \"#{id}-#{self._slug}\"\n end",
"def identifier\n sid_value || super\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 routing_number_with_format; end",
"def to_param\n \"#{id}-#{slug}\"\n end",
"def to_param\n \"#{id}-#{slug}\"\n end",
"def grab_ssn(string)\n string.scan(/\\d{3}-\\d{2}-\\d{4}/).join.slice!(0..10)\nend",
"def validate_ssn(value, the_length=SSN_LENGTH)\n false if value.to_s.length == 0\n # Validate the SSN\n # we eliminate any potential dashes in ssn\n value = value.to_s.gsub(\"-\", \"\").strip\n # validates if its an integer\n if(validate_str_is_integer(value) and value.length == the_length)\n return true\n else\n return false\n end\n end",
"def to_param\n \"#{id}-#{slug}-\"\n end",
"def [](key)\n key = 'spdx_id' if key == 'spdx-id'\n super(key)\n end",
"def generate_sid(secure = @sid_secure)\n sid = super(secure)\n sid = \"#{generate_hmac(sid, @config.secret_key)}--\" + sid\n end",
"def capture_ssn_params\n \t \tparams.require(:prescreen_household_member).permit(:first_name, :last_name,:date_of_birth,:middle_name,:suffix,:ssn,:gender,:marital_status,:identification_type,:primary_language,:personal_responsibility_agreement,:pra_accept)\n \t end",
"def show\n if !params[:id].to_s.match(/^\\d+$/)\n @sponsor = Sponsor.find_by_seo_name(params[:id])\n else\n @sponsor = Sponsor.find(params[:id])\n end\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sponsor }\n end\n end",
"def grab_ssn(string)\n regexp_key = /(\\d{3}-\\d{2}-\\d{4})/\n\n if regexp_key.match(string)\n regexp_key.match(string)[0]\n else\n \"\"\n end\nend",
"def name\n\t\treturn sname || sid\n\tend",
"def name\n\t\treturn sname || sid\n\tend",
"def get_ssn(lines)\n criteria = [\n '\\A\\d{9}\\z', # from beginning to end of string match 9 digits\n ].map do |needle|\n lines.select do |line|\n /#{needle}/.match(line)\n end\n end.flatten.map do |item|\n item\n end.flatten.each do |item|\n item\n end[0]\n end",
"def to_param\n \"#{self.id}-#{self.friendly_id}\"\n end",
"def slug\n ActiveModel::Naming.route_key(self.class.model)\n end",
"def to_param\n slug # or \"#{id}-#{name}\".parameterize\n end",
"def to_param\n slug || id\n end",
"def student_id\r\n\t\t\treturn 51875531\r\n\t\tend",
"def to_param\n permalink = self.first_name + \"-\" + self.last_name\n \"#{id}-#{permalink}\"\n end",
"def to_param\n \"#{id}-#{self.name.parameterize}\"\n end",
"def to_param\n id.to_s + \"-\" + slug\n end",
"def to_param\n id.to_s + \"-\" + slug\n end",
"def user_id_parameter\n \"#{user_parameter}_id\".to_sym\n end",
"def format_ssns(string)\n\tssn = /(\\d{3})[^\\d]?(\\d{2})[^\\d]?(\\d{4})/\n\treturn string.gsub(ssn, '\\1-\\2-\\3') \nend",
"def normalize_friendly_id(string)\n\t super[0..20]\n\tend",
"def set_student_number\n @student_number = StudentNumber.find(params[:id])\n end",
"def to_param\n \"#{self.id}-#{self.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 is_ssn_composition_correct?\n return true unless ssn.present?\n\n regex = /#{EnrollRegistry[:validate_ssn].item}/\n errors.add(:ssn, l10n(\"invalid_ssn\")) unless ssn.match?(regex)\n end",
"def show\n #getting an id of a student\n @URI = request.original_url\n @URI = @URI.split('/').last \n \n end",
"def friendly_id_config; end",
"def generate_sid\n loop do \n sid = super\n break sid unless sessions.find_one( { :_id => sid } )\n end\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.slug\n end",
"def to_param\n self.slug\n end",
"def set_snail\n @snail = Snail.find(params[:id])\n end",
"def set_snail\n @snail = Snail.find(params[:id])\n end",
"def to_param\n \"#{id}-#{name.to_safe_uri}\"\n end",
"def ssids\r\n SsidsController.instance\r\n end",
"def to_param\n \"#{id}-#{name.try(:parameterize)}\" if id\n end",
"def to_param\n \"#{id} #{nickname}\".parameterize\n end",
"def to_param \n \"#{id}-#{name.rstrip.gsub(/[^a-z0-9]+/i, '-')}\"\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 normalize_friendly_id(string)\n super[0..59]\n end",
"def to_param\n\t\tslug\n\tend",
"def to_param\n\t\tslug\n\tend",
"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 \"#{self.id}-#{self.name.parameterize.to_s}\"\n end",
"def to_param\n \"#{self.id}#{'-' + self.name.parameterize if self.name.present? }\"\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 using_issn_class\n validate_preamble = false\n unless identifier.nil?\n issn = identifier.upcase\n\n # 'ISSN 1234-567X'\n /^(?<preamble>ISSN ){0,1}(?<part_1>\\d{4})-(?<part_2>\\d{3})(?<last>.)$/ =~ issn\n\n if part_1.nil? or part_2.nil? or last.nil? or (preamble.nil? and validate_preamble)\n errors.add(:identifier, \"'#{identifier}' is an improperly formed ISSN.\")\n return\n end\n\n data = part_1 + part_2\n if last == 'X'\n sum = 10\n else\n sum = last.to_i\n end\n index = 8\n\n data.each_char { |c|\n sum += c.to_i * index\n index -= 1\n }\n sum = (sum % 11)\n\n if sum != 0\n errors.add(:identifier, \"'#{identifier}' has bad check digit.\")\n return\n end\n end\n end",
"def invalid_south_african_id_number; end",
"def sns\n return '' unless @parts\n return '' unless @parts[:street_number] && @parts[:street_name] && @parts[:state]\n\n \"#{@parts[:street_number]}#{@parts[:street_name]}#{@parts[:state]}\".standardize\n end",
"def validate_ssn(value, the_length=SSN_LENGTH)\n value = value.to_s\n # validates if its an integer\n if(validate_str_is_integer(value) and value.length == the_length)\n return true\n else\n return false\n end\n end",
"def to_param\n \"#{id}-#{display_name.parameterize}\"\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end",
"def to_param\n slug\n end"
] |
[
"0.70171565",
"0.6557037",
"0.65499616",
"0.64264876",
"0.60873747",
"0.58631855",
"0.5850509",
"0.5815213",
"0.5753406",
"0.57305574",
"0.564014",
"0.55743694",
"0.55556226",
"0.555367",
"0.553803",
"0.55286986",
"0.5518139",
"0.5518139",
"0.5518139",
"0.5512503",
"0.55113",
"0.54905486",
"0.5411013",
"0.5408915",
"0.5408695",
"0.5394476",
"0.5394155",
"0.5390932",
"0.5390633",
"0.53826994",
"0.53826994",
"0.53826994",
"0.53783685",
"0.53690445",
"0.53690445",
"0.5355399",
"0.5345743",
"0.53200537",
"0.53157616",
"0.52975005",
"0.5288231",
"0.5271126",
"0.5268351",
"0.5259396",
"0.5259396",
"0.5259313",
"0.5253118",
"0.52517074",
"0.5249719",
"0.5247218",
"0.52391636",
"0.52289355",
"0.52224755",
"0.5217655",
"0.5217655",
"0.521539",
"0.521239",
"0.521092",
"0.52029014",
"0.5199591",
"0.5199008",
"0.519552",
"0.5192328",
"0.5187205",
"0.5185961",
"0.51832783",
"0.51832783",
"0.5182668",
"0.5182668",
"0.51742566",
"0.51742566",
"0.517276",
"0.5171144",
"0.51675797",
"0.515874",
"0.51531845",
"0.5146501",
"0.51449937",
"0.5144933",
"0.5144933",
"0.5143626",
"0.5143626",
"0.5136702",
"0.51295346",
"0.5126109",
"0.5113809",
"0.5101473",
"0.5097727",
"0.50882065",
"0.50808513",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868",
"0.5078868"
] |
0.67526466
|
1
|
Returns proper gender string
|
def gender_displayname
gender == MALE[:value] ? MALE[:display_name] : FEMALE[:display_name]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def format_gender\n return gender == 'f' ? \"female\" : \"male\"\n end",
"def gender_name\n case gender\n when 'm'\n 'male'\n when 'f'\n 'female'\n else\n ''\n end\n end",
"def fullgender\n\t\tcase gender\n\t\t\twhen 'F': 'female'\n\t\t\twhen 'M': 'male'\n\t\t\telse 'unknown'\n\t\tend\n\tend",
"def gender\n sex.to_s\n end",
"def gender_string\n case object.gender\n when Settings.gender.male.id\n Settings.gender.male.name\n when Settings.gender.female.id\n Settings.gender.female.name\n end\n end",
"def gender\n ( self[ :gender ] || ( t.form_input.default_gender | 'n' ) ).to_s\n end",
"def gender_from_name\n if name[/women|athena|girl/i]\n \"F\"\n else\n \"M\"\n end\n end",
"def gender(gender)\n case gender\n when 'F', 'female'\n t('patients.female')\n when 'M', 'male'\n t('patients.male')\n when 'O', 'other'\n t('patients.other')\n else\n t('patients.unknown')\n end\n end",
"def gender\n #TODO add check if char is 'm' or 'f' and if necessary\n # throw an exception\n @avatar_string[0].downcase\n end",
"def gender_txt\n [\"Not Telling\", \"Male\", \"Female\"][self.gender - 1]\n end",
"def gender\r\n infoxml = get_info \r\n return infoxml['gender']\r\n end",
"def gender_color(sex)\n sex.to_i == 0 ? 'female' : 'male'\n end",
"def gender\n case\n when male && female then :unisex\n when male then :male\n when female then :female\n end\n end",
"def gender=(v)\n @gender = alma_string v\n end",
"def gender_name=(value)\n case value\n when 'male'\n gender = 'm'\n when 'female'\n gender = 'f'\n end\n end",
"def gender_abbreviation\n case gender_id\n when 1\n 'M'\n when 2\n 'F'\n when 3\n ''\n end\n end",
"def gender_description\n case gender_id\n when 1\n 'Male'\n when 2\n 'Female'\n when 3\n 'It''s complicated'\n end\n end",
"def get_gender_type_code\n gender_type ? gender_type.i18n_alternate : '?'\n end",
"def female_name\n case rand(0..8)\n when 0, 5 then \"#{first_name(:female)} #{middle_name(:female)}\"\n else first_name(:female)\n end\n end",
"def gender\n attributes = attributes_before_type_cast\n if attributes[\"gender\"]\n read_attribute(:gender).to_sym\n else\n nil\n end\n end",
"def gender_for(val, optional: false)\n return nil if val.nil? && optional\n\n val.to_s.split('.').last\n end",
"def default_female_name\n ext_text(9000, 3)\n end",
"def gender\n GENDERS[gender_id]\n end",
"def gender\n self.female ? \"Female\" : \"Male\"\n end",
"def gender_group\n gender_group = ''\n gender_group << 'M' if for_male?\n gender_group << 'F' if for_female?\n gender_group = 'MF' if gender_group.blank?\n gender_group\n end",
"def full_name(gender = :any)\n case gender\n when :any then rand(0..1).zero? ? male_full_name : female_full_name\n when :male then male_full_name\n when :female then female_full_name\n else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'\n end\n end",
"def human_gender(value = nil)\n gender = value || self.gender\n Person.human_gender(gender)\n end",
"def gender; end",
"def gender\n self[:gender] || \"\"\n end",
"def male_name\n case rand(0..8)\n when 0, 5 then \"#{first_name(:male)} #{middle_name(:male)}\"\n else first_name(:male)\n end\n end",
"def age_gender_to_s\n birth_year_q = self.question_objects_with_respondent_data.detect{|q| q[:signature] == 'dem_01_birth_year'}\n gender_q = self.question_objects_with_respondent_data.detect{|q| q[:signature] == 'dem_02_gender'}\n age = birth_year_q.nil? ? nil : 2010 - (1900 + birth_year_q[:responses].to_i)\n \"#{age.nil? ? \"(no age)\" : age} / #{gender_q.nil? ? \"(no gender)\" : gender_q[:responses]}\"\n end",
"def show_gender\n Gender[gender.to_i]\n end",
"def gender_neutral_first_name; end",
"def name(gender = :random)\n name_for_gender(:full_name, gender)\n end",
"def gender\n get_attribute(Yoti::Attribute::GENDER)\n end",
"def gender_mapping(gender)\n return 'male' if gender == 'Boy'\n 'female'\n end",
"def to_gender_label(val)\n gender_list.each do |g|\n return g[0] if g[1] == val\n end\n end",
"def default_male_name\n ext_text(9000, 2)\n end",
"def sex\n self[:gender]\n end",
"def to_s\n return \"#{name.capitalize} (#{age}-year-old #{format_gender})\"\n end",
"def gender_indirect\n case gender\n when 'm'\n when 'male'\n I18n.t('gender_indirect_m')\n\n when 'f'\n when 'female'\n I18n.t('gender_indirect_f')\n\n when 'd'\n when 'diverse'\n I18n.t('gender_indirect_diverse')\n\n when 'n'\n when 'noinfo'\n I18n.t('gender_indirect_noinfo')\n else\n \"\"\n end\n\n end",
"def get_gender(page)\n # Get the line that contains the player's race\n gender = page.grep(/chara_profile_title/)\n\n # Get the last word (which contains the gender)\n gender1 = gender[0].split[-1]\n\n if gender1[0] == \"♂\"\n gender = \"male\"\n elsif gender1[0] == \"♀\"\n gender = \"female\"\n else\n gender = nil\n end\n return gender\n end",
"def get_gender(page)\n # Get the line that contains the player's race\n gender = page.grep(/chara_profile_title/)\n\n # Get the last word (which contains the gender)\n gender1 = gender[0].split[-1]\n\n if gender1[0] == \"♂\"\n gender = \"male\"\n elsif gender1[0] == \"♀\"\n gender = \"female\"\n else\n gender = nil\n end\n return gender\n end",
"def get_gender\n\t\tputs \"Is this person (m)ale or (f)emale?\"\n\t\tinput = gets.chomp.downcase\n\t\tif input == \"m\" || input == \"male\"\n\t\t\t@gender = \"male\"\n\t\telse\n\t\t\t@gender = \"female\"\n\t\tend\n\tend",
"def gender\n\n if self.providers.size == 0\n return self.gender_custom\n end\n\n if self.gender_custom != \"none\"\n return self.gender_custom\n end\n\n return nil if self.providers.size == 0\n genders = self.providers.map(&:gender).compact\n return genders.first if !genders.empty?\n nil \n end",
"def sex(options = {})\n options = {\n format: :default\n }.merge(options)\n\n male = number[8, 1].to_i.even?\n\n case options[:format]\n when :default\n male ? :male : :female\n when :number\n male ? 1 : 2\n when :char\n male ? 'm' : 'f'\n end\n end",
"def gender=(gender)\n @gender = gender.to_s.strip[0,1].upcase\n @gender = nil if @gender == ''\n @gender = 'F' if @gender == 'W'\n raise \"invalid gender (#{gender})\" unless @gender.nil? || @gender.match(/^[MF]$/)\n end",
"def gender\n $browser.element(@selector).span(css: 'span').text.split(', ')[0]\n end",
"def age_gender_location\n if gender_id > 2\n \"#{age}, #{address.city} #{address.region}\"\n else\n \"#{age}, #{gender_description}, #{address.city} #{address.region}\"\n end\n end",
"def generatePlayerName(gender)\n\t\tif gender == \"male\"\n\t\t\t\"#{@playerFirstName.sample}#{@playerSecondNameMale.sample}\"\n\t\telse\n\t\t\t\"#{@playerFirstName.sample}#{@playerSecondNameFemale.sample}\"\n\t\tend\n\tend",
"def gender\n @gender\n end",
"def get_gender\n return @gender\n end",
"def gender\n self.dig_for_string(\"agentSummary\", \"gender\")\n end",
"def fb_parse_gender(fb_sex)\n GENDER_MAP[self.locale.to_sym][fb_sex.to_s.downcase] rescue nil\n end",
"def gender_of_object object\n return nil if object.nil?\n return nil if object.gender.nil?\n return :male if MALE_VALUES.include? object.gender.downcase\n return :female if FEMALE_VALUES.include? object.gender.downcase\n end",
"def normalize(gender_str)\n\t\t\tMale.include?(gender_str.downcase) ? (:male) : (:female)\n\t\tend",
"def name_female\n case rand(10)\n when 7 then \"#{prefix_female} #{first_name_female} #{last_name}\"\n when 5 then \"#{prefix_female} #{first_name_female} #{last_name}\"\n when 3 then \"#{first_name_female} #{last_name}\"\n when 0 then \"#{first_name_female} #{last_name}\"\n else \"#{first_name_female} #{last_name}\"\n end\n end",
"def gender=(gender)\n if primary_data.female_rate == -1\n @gender = 0\n elsif primary_data.female_rate == 0\n @gender = 1\n elsif primary_data.female_rate == 100\n @gender = 2\n else\n gender = %w[i m f].index(gender.downcase).to_i if gender.is_a?(String)\n @gender = gender.clamp(0, 2)\n end\n end",
"def set_gender_from_name\n if name[/women/i]\n self.gender = \"F\"\n else\n self.gender = \"M\"\n end\n end",
"def genderToObjectivePronoun(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'him'\n else\n return 'her'\n end\n #TODO: Raise exception if unknown detected\n end",
"def full_name_no_prefix(gender = :any)\n case gender\n when :any\n case rand(0..8)\n when 0, 3, 6, 8 then \"#{female_name} #{paternal_last_names}\"\n else \"#{male_name} #{paternal_last_names}\"\n end\n when :male then \"#{male_name} #{paternal_last_names}\"\n when :female then \"#{female_name} #{paternal_last_names}\"\n else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'\n end\n end",
"def to_gender\n self\n end",
"def returnGenderValue genderValue\n gender = \"Female\"\n if \"M\" == genderValue\n gender = \"Male\"\n end \n return gender\nend",
"def get_category_and_gender_short\n \"#{get_category_type_name} #{gender_type.i18n_short}\"\n end",
"def mr_name\n _mr_ = gender == 'female' ? 'Miss' : 'Mr.'\n _name_ = last_name\n if /\\p{Han}+/.match(last_name)\n _name_ = Pinyin.t(last_name).capitalize rescue last_name\n end\n \"#{_mr_} #{_name_}\"\n end",
"def to_s\n \"#{name} is a #{gender} of #{age} years.\"\n end",
"def name_male\n case rand(10)\n when 7 then \"#{prefix_male} #{first_name_male} #{last_name}\"\n when 5 then \"#{prefix_male} #{first_name_male} #{last_name}\"\n when 3 then \"#{first_name_male} #{last_name}\"\n when 0 then \"#{first_name_male} #{last_name}\"\n else \"#{first_name_male} #{last_name}\"\n end\n end",
"def current_user_gender_meta_tag\n current_user_gender = logged_in? && self.current_user.gender.present? ? \n self.current_user.gender :\n 'unknown'\n \"<meta name='current_user_gender' content='#{current_user_gender}'/>\"\n end",
"def sex\n fetch('demographic.sex')\n end",
"def gender_detect\n base_url = \"https://www.rapleaf.com/developers/try_name_to_gender?query=\"\n query_url = base_url + URI.escape(self.first_name)\n object = open(query_url) do |v|\n input = v.read\n JSON.parse(input)\n end\n object\n end",
"def gender\n return @poco_data[:gender] unless @poco_data == nil\n pick_first_node(@poco.xpath('./poco:gender'))\n end",
"def genders\n ['male','female','A being beyong comprehension']\n end",
"def female?\n @sex == 'f'\n end",
"def hisher\n hisher = human_gender == 'Male' ? 'his' : 'her'\n end",
"def translate_gender(wanted)\n return -1 if wanted == 0\n\n return wanted\n end",
"def people_gender\r\n\t\t[[\"Unknown\", \"Unknown\"],[\"Male\", \"Male\"], [\"Female\", \"Female\"]]\r\n\tend",
"def genderToPossessiveAdjective(gender)\n if gender == nil\n return '(unknown gender)'\n end #TODO: Raise exception if unknown detected\n\n if gender == :male || gender.downcase == 'male'\n return 'his'\n else\n return 'her'\n end\n end",
"def last_name(gender = :random)\n name_for_gender(:last_name, gender)\n end",
"def name(gender = :any)\n case gender\n when :any then rand(0..1).zero? ? name(:male) : name(:female)\n when :male then fetch_sample(MALE_FIRST_NAMES)\n when :female then fetch_sample(FEMALE_FIRST_NAMES)\n else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'\n end\n end",
"def is_female?\n gender && gender.first == 'f'\n end",
"def gender=(gender)\n if !gender.nil? && gender.to_s.length > 6\n fail ArgumentError, 'invalid value for \"gender\", the character length must be smaller than or equal to 6.'\n end\n\n @gender = gender\n end",
"def the_sex_prefix\n sex == 0 ? 'his' : 'her'\n end",
"def female?\n self.gender == 'f'\n end",
"def ssex\n case sex_before_type_cast\n when gclass.sex_male_value\n :male\n when gclass.sex_female_value\n :female\n else\n raise SexError, \"Sex value not valid for #{self}\"\n end\n end",
"def male_first_name; end",
"def inflection\n ( self[ :inflect ] || \"#{pluralize}#{gender}\" ).to_s\n end",
"def MapOracleToOSSCR_PersonGender(gender)\n gender.gsub!(\"FEMALE\",\"F\") if (gender==\"FEMALE\")\n gender.gsub!(\"MALE\",\"M\") if (gender==\"MALE\")\n return gender \nend",
"def formalname\n sprintf(\"%s's %s %s\", gender.camelize,\n varsity? ? \"Varsity\" : \"JV\", sport.name)\n end",
"def is_male?\n gender && gender.first == 'm'\n end",
"def full_name_prefix(gender = :any)\n case gender\n when :any\n case rand(0..8)\n when 0, 3, 6, 8 then \"#{female_prefix} #{female_name} #{paternal_last_names}\"\n else \"#{male_prefix} #{male_name} #{paternal_last_names}\"\n end\n when :male then \"#{male_prefix} #{male_name} #{paternal_last_names}\"\n when :female then \"#{female_prefix} #{female_name} #{paternal_last_names}\"\n else raise ArgumentError, 'Invalid gender, must be one of :any, :male, :female'\n end\n end",
"def male?\n gender == 1\n end",
"def gender=(new_gender)\n\t\t@gender = new_gender\n\tend",
"def gender=(new_gender)\n\t\t@gender = new_gender\n\tend",
"def name(for_sex = :random)\n with_same_sex(for_sex) do\n case rand(0..1)\n when 0 then \"#{last_name} #{first_name} #{patronymic}\"\n else \"#{first_name} #{last_name}\"\n end\n end\n end",
"def male?\n @sex == 'm'\n end",
"def female?\n gender == 2\n end",
"def genderless?\n gender == 0\n end",
"def display_event_gender\n x = self.event_id\n y = Event.find_by_id(x)\n return y.gender\n end",
"def generate_hero_gender(hero)\n buffer\n line\n puts \"Is your hero male, female, or any other?\"\n line\n choice = gi_string\n hero.gender = choice\n line\n puts \"Your hero's gender is #{hero.gender}. If this is correct, press 1. Press 2 if not. Press 3 to go back.\"\n line\n choice = gi_integer\n if choice == 1\n generate_hero_race(hero)\n elsif choice == 2\n generate_hero_gender(hero)\n elsif choice == 3\n generate_hero_hp(hero)\n else line\n puts \"Your input was not recognized. Please begin this step again.\"\n line\n generate_hero_gender(hero)\n end\n end",
"def first_name(gender = :random)\n name_for_gender(:first_name, gender)\n end"
] |
[
"0.8700179",
"0.8634686",
"0.8435832",
"0.8335108",
"0.81167954",
"0.80847424",
"0.8011789",
"0.7778357",
"0.7750152",
"0.77337664",
"0.76417285",
"0.76374507",
"0.75962657",
"0.75949854",
"0.75492257",
"0.7541535",
"0.75397366",
"0.7528571",
"0.7513674",
"0.7512521",
"0.74857813",
"0.746399",
"0.7463288",
"0.74567175",
"0.74529225",
"0.7433656",
"0.7400738",
"0.73881125",
"0.73637414",
"0.7360315",
"0.7353592",
"0.73316765",
"0.7330328",
"0.7330285",
"0.73089534",
"0.72865033",
"0.7285616",
"0.71989834",
"0.71985984",
"0.7196117",
"0.71880543",
"0.7153233",
"0.7153233",
"0.7144409",
"0.71275264",
"0.71081555",
"0.7082454",
"0.7058219",
"0.7040157",
"0.7034735",
"0.7030707",
"0.7015905",
"0.7002834",
"0.6962253",
"0.695519",
"0.6904537",
"0.69017386",
"0.684281",
"0.68162584",
"0.6811774",
"0.6795535",
"0.6779571",
"0.67489177",
"0.67313075",
"0.67035496",
"0.6694647",
"0.6691286",
"0.668898",
"0.66794324",
"0.6662858",
"0.66472757",
"0.6645447",
"0.6642595",
"0.66146415",
"0.66133267",
"0.6592598",
"0.65860236",
"0.6584205",
"0.65793854",
"0.65777725",
"0.6576664",
"0.65764105",
"0.65664953",
"0.65644187",
"0.6531463",
"0.65274984",
"0.6516805",
"0.651639",
"0.65116966",
"0.64993393",
"0.6480171",
"0.6458733",
"0.6458733",
"0.64480793",
"0.64471334",
"0.63804597",
"0.6377811",
"0.633043",
"0.63225484",
"0.6321971"
] |
0.7952188
|
7
|
GET /rounds GET /rounds.json
|
def index
@rounds = Round.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def show\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @game_rounds = current_user.game_rounds\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def index\n championship = Championship.find_by_desc($current_championship)\n unless championship == nil?\n @rounds = Round.get_all_rounds_by_championship_id(championship.id, params[:page])\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rounds }\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round\") )\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n @player_rounds = PlayerRound.select(\"id, amount, betValue, player_id, round_id\").where(:round_id => params[:id])\n end",
"def index\n @pmrounds = Pmround.all\n end",
"def show\n @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def index\n @shooting_rounds = ShootingRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_rounds }\n end\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def all_rounds\n generate(User.all)\n render :template => 'chart/index'\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def get_rounds\n puts \"How many rounds?\"\n @rounds = gets.chomp.to_i\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def each_round\n completed_rounds.each do |r|\n yield [r, @results[r]]\n end\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end",
"def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end",
"def index\n unless @level.present?\n redirect_to @user.highest_repetition_level_unlocked.path\n return\n end\n @formatted_round_times = current_user&.round_times_for_level_id(@level.id) || []\n if current_user&.completed_repetition_level?(@level)\n @high_scores = @level.high_scores\n else\n @high_scores = []\n end\n render \"game_modes/repetition\"\n end",
"def recent_rounds\n rounds = []; #return value\n rounds = Round.order(created_at: :desc).limit(30).to_a;\n\n #better make sure this thing is public...\n rounds.reject { |r| r[:status] != GlobalConstants::ROUND_STATUS[:round_started] }\n rounds.shuffle!;\n return rounds[0..2];\n end",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @rockhounds = Rockhound.all\n end",
"def round\n generate(Round.get(params[\"id\"]).participants)\n render :template => 'chart/index'\n end",
"def rounds(n)\n\t\tm1 = self.s1.next(nil)\n\t\tn.times do\n\t\t\tm1 = game(m1)\n\t\tend\n\t\tnumbers = self.scores << self.rp\n\t\tnames = self.hash.keys << :Rounds\n\t\treturn Hash[names.zip(numbers)] \n\tend",
"def index\n @page = params['page'] || 1\n #.with_state(:pending)\n @game_rounds = GameRound.where([\"(state=? OR state=? OR (state=? AND bid_count>0))\",:pending,:started,:success]).includes(:bids).order(\"start_at desc\").paginate(:page => @page)\n\n end",
"def get_rounds_cards\n # get all the cards from this round's deck\n @cards = self.deck.cards\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def index\n @moves = @game.moves.all\n render json: @moves, status: 200\n end",
"def current_round\r\n self.rounds.last\r\n end",
"def show\n @user = current_user\n @round = Round.find(params[:id])\n @fighter = Fighter.find(@round.fighter_id)\n @score = Score.find_by_user_id(@user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def round( num )\n h = get_matches\n matches = h[ 'rounds' ][ num-1 ] ## note: rounds hash starts with zero (not 1)\n matches\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def show\n #@game.round = @game.rounds.sort_by{|e| e[:place]}\n #@player_stats = @player_stats.sort_by{|e| -e[:wins]}\n end",
"def round_matches(round)\n\t\t@@logger.info { \"Retrieving matches for a given round.\" } if have_logger?\n\t\tMatch.dataset.filter(:tournament_id => self.id).filter(:round => round).all\n\tend",
"def show\n @rounds = set_rounds\n @matches = @competition.matches.select { |match| match.season == @competition.curr_season }\n @matches = @matches.sort_by{ |m| m.round }\n end",
"def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def get_rounds\n sparql = SPARQL.parse(\"SELECT DISTINCT ?uri ?label ?time\n WHERE {\n {\n ?uri <#{RDF.type}> <http://www.bbc.co.uk/ontologies/sport/KnockoutCompetition> .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?uri <http://www.bbc.co.uk/ontologies/sport/hasMatch> ?match_uri .\n ?match_uri <http://purl.org/NET/c4dm/event.owl#time> ?time .\n }\n UNION\n {\n ?uri <http://www.bbc.co.uk/ontologies/sport/hasMatch> ?match_uri .\n ?uri <#{RDF::RDFS.label}> ?label .\n ?match_uri <http://purl.org/NET/c4dm/event.owl#time> ?time .\n }\n }\n ORDER BY ASC(?time)\n \")\n results = QUERYABLE.query(sparql)\n end",
"def index\n waiver_picks_decorator = WaiverPicksDecorator.new(\n @fpl_team.waiver_picks.where(round_id: (params[:round_id] || Round.current_round.id))\n )\n\n render json: { waiver_picks: waiver_picks_decorator.all_data }\n end",
"def show\n @game = Game.find(params[:id])\n winner = @game.who_won\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {money: current_user.money.to_i, lost: @game.winner && @game.winner != current_user, won: winner == current_user, my_round: @game.last_player != current_user, blocks:@game.blocks.map{|b| {id: b.id, owner: b.owner ? b.owner.login : nil , left: b.left, right: b.right, up: b.up, down: b.down}} }}\n end\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n if params[:outcrop_id]\n @rocks = Rock.where(outcrop_id: params[:outcrop_id])\n .paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rocks\n else\n @rocks = Rock.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rocks\n end\n end",
"def get_games_json bracket_json\n return_data = Array.new\n\n bracket_json[\"game_and_pick_list\"][\"regions\"].each do |region|\n region[\"rounds\"].each do |round|\n round[\"games\"].each { |game| return_data << game }\n end\n end\n\n return_data\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @shooting_round = ShootingRound.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shooting_round }\n end\n end",
"def index\n @turns = Turn.all\n\t\trespond_with @turns\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def scrape\n\t\n\t\t\n\t\tplayer = params[:player]\n\t\turl = params[:url]\n\t\tendDate = params[:EndDate]\n\t\tfiller = '&GameType=all&PlayedFor=0&PlayedVs=0&Park=0&PlayerID='\n\t\t\t\n\t\tid = Player.find_by_name(player).number.to_s\n\t\tfullUrl = url + '&EndDate=' + endDate + filler + id\n\t\t\n\t\tpage = Nokogiri::HTML(open(fullUrl))\n\t\t\n\t\ttotalsArray = getTotals(page)\n\t\t\n\t\trender :text => totalsArray.to_json()\n\tend",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def total_rounds\n matches_per_round = users.count / 2\n total_matches = (users.count - 1) * matches_per_round\n total_rounds = total_matches / matches_per_round\n\n total_rounds\n end",
"def print_round_results\n @view.print_score_results(@player.hand_value, @dealer.hand_value)\n @view.print_blackjack if @player.blackjack? && player_wins_round?\n if player_wins_round?\n @view.print_player_win\n elsif tie?\n @view.print_tie\n else\n @view.print_player_loss\n end\n end",
"def index\n @winning_numbers = WinningNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winning_numbers }\n end\n end",
"def total_rounds\n self.count_wins + self.count_losses\n end",
"def show\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_round_loan }\n end\n end",
"def my_rounds\n my_rounds = FundingRound.all.select{|rounds| rounds.startup == self}\n end",
"def build_rounds\n round_builder.build\n end",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end",
"def create_rounds(game_ids)\n rounds = [[game_ids[game_ids.length - 4],\n game_ids[game_ids.length - 3],\n game_ids[game_ids.length - 2],\n game_ids[game_ids.length - 1]]]\n\n current_game_index = 0\n num_games_in_round = Bracket::NUM_TEAMS / 2\n final_game_index = current_game_index + (num_games_in_round - 1)\n while num_games_in_round >= 1\n rounds.push([])\n current_game_index.upto(final_game_index) do |game_index|\n rounds.last.push(game_ids[game_index])\n end\n num_games_in_round /= 2\n current_game_index = final_game_index + 1\n final_game_index = current_game_index + (num_games_in_round - 1)\n end\n\n rounds\n end",
"def show\n @round = @season.rounds.find(params[:id])\n\n if @round.published || signed_in_as_admin?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n else\n redirect_to season_path(@round.season)\n end\n end",
"def get_win_rates(load_file)\n data = JSON.parse(File.open(\"#{load_file}\", \"r\").read) # Parse the json into an array\n deck_1_number_wins = 0\n deck_2_number_wins = 0 \n deck_1_win_rate = 0.0\n deck_2_win_rate = 0.0\n \n # Get the total number of times each player won\n data.each do |item|\n if item['random_winner'] == 'Deck_1' \n deck_1_number_wins = deck_1_number_wins +1\n else\n deck_2_number_wins = deck_2_number_wins +1\n end\n end\n \n # Calculate win % and conver that number to a float\n deck_1_win_rate = deck_1_number_wins/data.size.to_f * 100\n deck_2_win_rate = deck_2_number_wins/data.size.to_f * 100\n \n puts \"Deck 1 wins #{deck_1_number_wins}/#{data.size} which is #{deck_1_win_rate}%\"\n puts \"Deck 2 wins #{deck_2_number_wins}/#{data.size} which is #{deck_2_win_rate}%\"\n end",
"def index\n game = Game.all\n\n render json: game, include: :teams\n end",
"def round_params\n params.require(:round).permit(:deck_id, :username, :score)\n end",
"def round_params\n params.require(:round).permit(:game_id)\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_all_match_rounds(mid)\n all_rounds.select { |round| round.match_id == mid }\n end",
"def get_pay_runs(options = {})\n request_params = {}\n response_xml = http_get(client, \"#{@payroll_url}/PayRuns\", request_params)\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/pay_runs'})\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def get_round_id\n round_id = @@curr_round[public_user.difficulty_level_id]\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n if @game_round.save\n format.html { redirect_to @game_round, notice: 'Game round was successfully created.' }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.8179578",
"0.7138636",
"0.7110566",
"0.69381267",
"0.69308823",
"0.69218105",
"0.6695108",
"0.6681436",
"0.66559047",
"0.6504946",
"0.6480924",
"0.6423685",
"0.64184344",
"0.6388241",
"0.6317415",
"0.6298387",
"0.6298288",
"0.62912875",
"0.6209922",
"0.61707854",
"0.6115698",
"0.60917765",
"0.608883",
"0.5994273",
"0.5924034",
"0.5881729",
"0.5878015",
"0.5876849",
"0.5827835",
"0.58205605",
"0.5805892",
"0.5797715",
"0.5781318",
"0.573659",
"0.5732515",
"0.5723126",
"0.5718076",
"0.57086855",
"0.5702155",
"0.56958777",
"0.56939316",
"0.5681326",
"0.5681326",
"0.5673255",
"0.5670374",
"0.56654733",
"0.566543",
"0.56432205",
"0.56114084",
"0.55697954",
"0.55581874",
"0.5531314",
"0.55301744",
"0.55298436",
"0.5528842",
"0.5518684",
"0.5510198",
"0.5492169",
"0.5483669",
"0.5469109",
"0.5455639",
"0.5449699",
"0.54407424",
"0.5439311",
"0.54320997",
"0.5426482",
"0.5426482",
"0.5425288",
"0.54095846",
"0.539556",
"0.539532",
"0.53910214",
"0.53910214",
"0.53910214",
"0.53813106",
"0.5381104",
"0.53800154",
"0.5375821",
"0.53692216",
"0.536682",
"0.5365423",
"0.53605855",
"0.53584445",
"0.5358002",
"0.5357774",
"0.5357721",
"0.5354322",
"0.53426",
"0.53389025",
"0.53372645",
"0.5333023",
"0.53303933",
"0.5324906",
"0.5320933"
] |
0.7259982
|
5
|
GET /rounds/1 GET /rounds/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def show\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def current_round\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round\") )\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @round }\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def index\n championship = Championship.find_by_desc($current_championship)\n unless championship == nil?\n @rounds = Round.get_all_rounds_by_championship_id(championship.id, params[:page])\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @rounds }\n end\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def show\n @grant_round = GrantRound.find(params[:id])\n\n render json: @grant_round\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def index\n @military_battle_rounds = Military::BattleRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @military_battle_rounds }\n end\n end",
"def index\n @game_rounds = current_user.game_rounds\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def show\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @military_battle_round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n @player_rounds = PlayerRound.select(\"id, amount, betValue, player_id, round_id\").where(:round_id => params[:id])\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def index\n @shooting_rounds = ShootingRound.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @shooting_rounds }\n end\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def index\n @pmrounds = Pmround.all\n end",
"def current_round\r\n self.rounds.last\r\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_rounds\n puts \"How many rounds?\"\n @rounds = gets.chomp.to_i\n end",
"def show\n @user = current_user\n @round = Round.find(params[:id])\n @fighter = Fighter.find(@round.fighter_id)\n @score = Score.find_by_user_id(@user.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @games = Game.find(:all, :order => 'datetime ASC', :conditions => 'round_number > 1')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @games }\n end\n end",
"def show\n @boxscore = @game.boxscores.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @boxscore }\n end\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def get_league_standings_by_league(league_id)\n response = parse_api_request(\"#{BASE_URL}standings/#{league_id}\")[\"standings\"]\nend",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def index\n @boxscores = @game.boxscores\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boxscores }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def show\n @round = Round.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n end",
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def index\n page_number = params[:page] ? params[:page][:number] : 1\n per_page = params[:per_page] ? params[:per_page] : 10\n\n @standings = Standing.paginate(page: page_number, per_page: per_page)\n\n render json: @standings\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def show\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_round_loan }\n end\n end",
"def all_rounds\n generate(User.all)\n render :template => 'chart/index'\n end",
"def show\n @shooting_round = ShootingRound.find(params[:id])\n \n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shooting_round }\n end\n end",
"def round\n generate(Round.get(params[\"id\"]).participants)\n render :template => 'chart/index'\n end",
"def round( num )\n h = get_matches\n matches = h[ 'rounds' ][ num-1 ] ## note: rounds hash starts with zero (not 1)\n matches\n end",
"def show\n @runway_season = Runway::Season.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @runway_season }\n end\n end",
"def index\n @runs = Run.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @runs }\n end\n end",
"def get_round_id\n round_id = @@curr_round[public_user.difficulty_level_id]\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @winner = Winner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winner }\n end\n end",
"def show\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rock }\n end\n end",
"def index\n @moves = @game.moves.all\n render json: @moves, status: 200\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n unless @level.present?\n redirect_to @user.highest_repetition_level_unlocked.path\n return\n end\n @formatted_round_times = current_user&.round_times_for_level_id(@level.id) || []\n if current_user&.completed_repetition_level?(@level)\n @high_scores = @level.high_scores\n else\n @high_scores = []\n end\n render \"game_modes/repetition\"\n end",
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def show\n @game = Game.find(params[:id])\n winner = @game.who_won\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {money: current_user.money.to_i, lost: @game.winner && @game.winner != current_user, won: winner == current_user, my_round: @game.last_player != current_user, blocks:@game.blocks.map{|b| {id: b.id, owner: b.owner ? b.owner.login : nil , left: b.left, right: b.right, up: b.up, down: b.down}} }}\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def index\n streaks = Streak.active.all\n render_jsonapi(streaks)\n end",
"def show\n @turnover = Turnover.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @turnover }\n end\n end",
"def show\n @rink_league = RinkLeague.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rink_league }\n end\n end",
"def show\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rum }\n end\n end",
"def rounds(n)\n\t\tm1 = self.s1.next(nil)\n\t\tn.times do\n\t\t\tm1 = game(m1)\n\t\tend\n\t\tnumbers = self.scores << self.rp\n\t\tnames = self.hash.keys << :Rounds\n\t\treturn Hash[names.zip(numbers)] \n\tend",
"def show\n render json: Game.find(params[:id])\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @run = Run.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @run }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @holdgame = Holdgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holdgame }\n end\n end",
"def show\n @bestgame = Bestgame.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bestgame }\n end\n end",
"def show\n @round = @season.rounds.find(params[:id])\n\n if @round.published || signed_in_as_admin?\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @round }\n end\n else\n redirect_to season_path(@round.season)\n end\n end",
"def show\n @game_instance = GameInstance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @game_instance.to_json(:include => { :squares => { :include => :lines }} ) }\n end\n end",
"def show\n @player_box_score = PlayerBoxScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_box_score }\n end\n end",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\n end\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def new\n @championships = Championship.all\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @round }\n end\n end",
"def index\n\t\t@runs = @current_user.runs\n\n\t\trender json: @runs\n\tend",
"def fetch_json(game)\n RestClient.post(\"#{ENV['BASE_URI']}\" + \"#{ENV['ENDPOINT']}\", game.to_json, content_type: :json)\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def create\n @tournament = Tournament.find(params[:tournament_id])\n @round = Round.new(round_params)\n @round.tournament_id = @tournament.id\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to tournament_path(@tournament), notice: \"Round was successfully created.\" }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @game = Game.find(params[:id])\n @moves = @game.moves\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end",
"def index\n @rockhounds = Rockhound.all\n end",
"def show\n @game_score = GameScore.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game_score }\n end\n end",
"def show\n @winning_number = WinningNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winning_number }\n end\n end",
"def each_round\n completed_rounds.each do |r|\n yield [r, @results[r]]\n end\n end",
"def set_round\r\n @round = Round.find(params[:id])\r\n end",
"def get_match_data(match_id)\n # Given a matchId, make an API request for the match data.\n url = \"https://#{REGION}.api.riotgames.com/lol/match/v4/matches/#{match_id}?api_key=#{API_KEY}\"\n response_string = RestClient.get(url)\n sleep(1)\n match_data = JSON.parse(response_string)\nend",
"def show\n @game = Game.find(params[:id])\n @matches = @game.player_matchups\n @scores = @game.scores\n @match_points = @matches.collect { |mp| @game.match_scores(mp.first, mp.last) }\n @net_points = @game.net_points\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @game }\n end\n end"
] |
[
"0.7735423",
"0.7122611",
"0.6970371",
"0.6970371",
"0.6970371",
"0.6970371",
"0.6970371",
"0.6970371",
"0.6970371",
"0.69027627",
"0.689435",
"0.6834668",
"0.68254834",
"0.6753524",
"0.6745448",
"0.66504645",
"0.6631633",
"0.65709615",
"0.65156215",
"0.64609367",
"0.6414302",
"0.6409868",
"0.6278943",
"0.6220845",
"0.62104464",
"0.60380936",
"0.6033475",
"0.60294545",
"0.59871775",
"0.59706146",
"0.59377223",
"0.5924093",
"0.5849652",
"0.5846527",
"0.5799783",
"0.57952845",
"0.5794658",
"0.5785174",
"0.5778753",
"0.57764155",
"0.577372",
"0.57664615",
"0.57664615",
"0.5764058",
"0.57606107",
"0.57587785",
"0.57384026",
"0.5735801",
"0.5731081",
"0.5716188",
"0.5712226",
"0.5683307",
"0.56830317",
"0.5680391",
"0.5673849",
"0.56709313",
"0.5664374",
"0.5657989",
"0.5640955",
"0.5632398",
"0.56301206",
"0.5626054",
"0.5626054",
"0.5607625",
"0.559174",
"0.5590589",
"0.55623895",
"0.5557844",
"0.5557844",
"0.5557844",
"0.55552155",
"0.554022",
"0.5536404",
"0.55272835",
"0.55221814",
"0.55196834",
"0.5518626",
"0.55077404",
"0.55030376",
"0.55030376",
"0.549563",
"0.5493236",
"0.5493129",
"0.5492067",
"0.54816085",
"0.54795545",
"0.54795545",
"0.54795545",
"0.54762954",
"0.5473678",
"0.5465189",
"0.5464441",
"0.5460235",
"0.5456104",
"0.5454783",
"0.54525965",
"0.54500055",
"0.5445861",
"0.54434186",
"0.54194224",
"0.54194176"
] |
0.0
|
-1
|
POST /rounds POST /rounds.json
|
def create
@round = Round.new(round_params['round'])
respond_to do |format|
if @round.save
@round.create_matches
update_parents(@round)
format.html { redirect_to @round, notice: 'Round was successfully created.' }
format.json { render :show, status: :created, location: @round }
else
format.html { render :new }
format.json { render json: @round.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create_rounds\n Round.create_rounds(id)\n\n\n end",
"def create\n @round = @tournament.rounds.build(round_params)\n\n respond_to do |format|\n if @round.save\n format.html do redirect_to @round, notice: 'Round was successfully created.' end\n format.json { render :show, status: :created, location: @round }\n else\n @form_for = [@tournament, @round]\n format.html do render :new end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_rounds\n\t\t@rounds = []\n\t\tcase @participant.league.type\n\t\twhen \"Fantasy\"\n\t\t\t@rounds = [\"fantasy\"]\n\t\twhen \"Elimination\"\n\t\t\t@rounds = [\"elimination\"]\n\t\tend\n\t\trender json: @rounds\n\tend",
"def create\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.build(params[:round])\n\n @round.determine_scores\n @game.rounds << @round unless @round.invalid?\n\n @game.determine_winner @round\n\n respond_to do |format|\n if @game.save\n\n url = if @game.completed?\n finish_game_url(@game)\n else\n game_rounds_url(@game)\n end\n\n\n format.html { redirect_to url, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n #if the round failed to create, we want to render the index with the failed round\n @rounds = @game.rounds\n format.html { render action: \"index\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tournament = Tournament.find(params[:tournament_id])\n @round = Round.new(round_params)\n @round.tournament_id = @tournament.id\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to tournament_path(@tournament), notice: \"Round was successfully created.\" }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to game_round_path(@game, @round), notice: 'Round was successfully started!' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params)\n \n respond_to do |format|\n if @round.save\n format.html { redirect_to @round }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tournament = Tournament.new(tournament_params)\n\n @tournament.current_round = 0\n @tournament.state = false\n\n respond_to do |format|\n if @tournament.save\n format.html { redirect_to @tournament, notice: 'Tournament was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tournament }\n\n # Create all rounds when tournament is created\n @tournament.round_no.times do |x|\n @round = Round.new\n @round.round_no = x + 1\n @round.tournament_id = @tournament.id\n @round.name = @tournament.name + \" round \" + (x + 1).to_s \n @round.turn_duration = 7\n @round.save\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @tournament.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new()\n \n\n @dateTime = Time.new\n @conservative = isConservative\n @result = resultRulleteBet\n\n @round.dateTime = @dateTime\n @round.conservative = @conservative\n @round.result = @result\n\n \n if @round.save \n addPlayerRound(@round.id)\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n if @game_round.save\n format.html { redirect_to @game_round, notice: 'Game round was successfully created.' }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round.debate }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @grant_round = GrantRound.new(grant_round_params(params[:grant_round]))\n\n if @grant_round.save\n render json: @grant_round, status: :created, location: @grant_round\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end",
"def create\n @round = Round.new(round_params)\n @round.started = false\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render action: 'show', status: :created, location: @round }\n else\n format.html { render action: 'new' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show_rounds\n\t\t@rounds = @participant.rounds\n\t\trender json: @rounds\n\tend",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to(@round, :notice => 'Round was successfully created.') }\n format.xml { render :xml => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @aggregation_round = AggregationRound.new(aggregation_round_params)\n\n respond_to do |format|\n if @aggregation_round.save\n format.html { redirect_to @aggregation_round, notice: 'Aggregation round was successfully created.' }\n format.json { render :show, status: :created, location: @aggregation_round }\n else\n format.html { render :new }\n format.json { render json: @aggregation_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_round(round, post_content)\n response = HTTParty.post(\"#{BASE_URL}/contest/#{@api_key}/round/#{round}\", :body => {\"data\" => post_content} )\n end",
"def simulate_rounds\n League.current_seasons.each(&:simulate_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.simulate_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def round_params\n params.require(:round).permit(:deck_id, :username, :score)\n end",
"def create\n temp_game = Game.new()\n temp_game.date = game_params[:date].to_date\n temp_game.numplay = game_params[:numplay]\n temp_game.backwards = game_params[:backwards]\n temp_game.notrump = game_params[:notrump]\n temp_game.description = game_params[:description]\n\n puts game_params[:rounds_attributes]\n\n game_params[:rounds_attributes].each do |r|\n puts \"0: \" + r[0]\n puts \"1: \" + r[1][:score]\n # score = r[1][:score]\n # place = r[1][:place]\n # correct = r[1][:correct]\n # asterisk = r[1][:asterisk]\n # player_id = r[1][:player_id]\n myround = Round.new(r[1])\n temp_game.rounds << myround\n end\n\n puts temp_game\n\n message = \"\"\n temp_rounds = temp_game.rounds.sort_by{|e| -e[:score]}\n place = 0\n @game = temp_game\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n @game.rounds << round\n message = message + \" \" + round.player.nickname + \" place set to \" + place.to_s\n end\n\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: message }\n format.json { render action: 'show', status: :created, location: @game }\n else\n format.html { render action: 'new' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:date, :number, :tournament_id)\n end",
"def round_params\n params.require(:round).permit(:debate_id, :round_number, :start_time, :end_time, :status)\n end",
"def round_params\n params.require(:round).permit(:game_id, :score1, :score2, :score3, :score4, :roundtype)\n end",
"def create\n @round = Round.new(round_params)\n @round.save!\n notify_clients\n head :ok\n rescue\n render layout: false, status: :bad_request\n end",
"def build_rounds\n round_builder.build\n end",
"def round_params\n params.require(:round).permit(:game_id)\n end",
"def round_params\n params.permit(:id, round:\n [:roundtype_id, :round_number, :matches, :match_number]\n )\n end",
"def new\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n # @new_round = @game.rounds.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def create\r\n @round = Round.new(round_params)\r\n\r\n respond_to do |format|\r\n if @round.save\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.created', model: Round.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :new }\r\n format.js { render :new }\r\n end\r\n end\r\n end",
"def round_params\n params.require(:round).permit(:round_no, :name, :about, :turn_duration, :start_date, :vote_date, :calc_date)\n end",
"def round_params\n params.require(:round).permit(:judge_id, :status)\n end",
"def create\n @round = Round.new(params[:round])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n if params[:championship][:championship_id] == \"\"\n respond_to do |format|\n flash[:error] = \"Voce deve selecionar o campeonato\"\n format.html { render :action => \"new\" }\n end\n else\n @championship = Championship.find(params[:championship][:championship_id])\n @last_round4_championship = Round.find_by_championship_id(@championship.id)\n @round.championship = @championship\n num_round = (@last_round4_championship == nil)? 1 : Round.maximum(:num_round) +1\n @round.num_round = num_round\n\n\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, :notice => 'Round was successfully created.' }\n format.json { render :json => @round, :status => :created, :location => @round }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def index\n @rounds = Round.all\n end",
"def start_rounds\n League.current_seasons.each(&:start_round_actual!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.start_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def create\n @round = Round.new(round_params)\n @game = Game.find(@round.game_id)\n if @game.rounds.where(round_count: @round.round_count).not(player_id: current_user.id).take.exists?\n o_round = @game.rounds.where(round_count: @round.round_count).not(player_id: current_user.id).take\n @round.character = o_round.character\n else\n @round.character = CHARS[rand(26)]\n end\n respond_to do |format|\n if @round.save\n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:judge_id)\n end",
"def end_round_and_save\n args = request_params\n end_timing_for_round(args[:map_id], args[:round])\n save_and_remove_all(args[:map_id], args[:round])\n head :ok\n end",
"def create\n @round = Round.new(params[:round])\n\n respond_to do |format|\n if @round.save\n # create matches for input\n if !params[:names].blank?\n # split input by line break\n names = params[:names].rstrip.split(/\\r?\\n/).map{|line| line.chomp}\n # insert dummy players\n if names.length % 4 == 3\n names.insert(names.length,\"★ダミーP\")\n elsif names.length % 4 == 2\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n elsif names.length % 4 == 1\n names.insert(names.length,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n names.insert(names.length-4,\"★ダミーP\")\n end\n # sort if required\n if params[:sort] == \"1\"\n names = names.sort_by{rand}\n end\n courts = params[:courts].to_i\n court_select = [\"A\", \"B\", \"C\", \"D\", \"E\", \"F\"]\n # for each 4 names create match\n (names.length / 4).times do |x|\n match = Match.new\n match.round_id = @round.id\n match.court = court_select[x % courts]\n match.player1_name = names[x * 4]\n match.player2_name = names[x * 4 + 1]\n match.player3_name = names[x * 4 + 2]\n match.player4_name = names[x * 4 + 3]\n match.save\n end\n end\n \n format.html { redirect_to @round, notice: 'Round was successfully created.' }\n format.json { render json: @round, status: :created, location: @round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rounds\n @title = \"My Rounds\"\n\n puts '====================== rounds'\n\n @user = User.find(params[:id])\n #@rounds = @user.rounds.where(complete: 'Y').paginate(page: params[:page], :per_page => 50)\n #@rounds = @user.rounds.paginate(page: params[:page], :per_page => 50)\n @rounds = @user.rounds\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json=> { \n :rounds=>@rounds.as_json(\n :include => { \n :holes => { },\n :scorecard => { },\n :event => { \n :include => { \n :course => {\n :include => {\n :facility => { :only => [:id, :facility_code, :facility_name, :address, :city, :state, :longitude, :latitude], \n :include => { \n :courses => { :only => [:id, :course_code, :facility_code, :course_name, :hol, :par] }\n }\n }\n } \n } \n }\n }\n }\n )\n } }\n end\n end",
"def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end",
"def game_params\n params.require(:game).permit(:rounds_count)\n end",
"def round_params\n params.require(:round).permit(:character, :points, :round_count, :city, :country, :river)\n end",
"def create\n @military_battle_round = Military::BattleRound.new(params[:military_battle_round])\n\n respond_to do |format|\n if @military_battle_round.save\n format.html { redirect_to @military_battle_round, notice: 'Battle round was successfully created.' }\n format.json { render json: @military_battle_round, status: :created, location: @military_battle_round }\n else\n format.html { render action: \"new\" }\n format.json { render json: @military_battle_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def seed_rounds(round_no, circuit_id, qly_datetime, race_datetime, qly_results_id, race_results_id)\n Round.create(round_number: round_no,\n circuit_id: circuit_id,\n qly_datetime: qly_datetime,\n race_datetime: race_datetime )\n end",
"def round_params\n params.require(:round).permit(:number, :start_time, :tournament_id,\n :notification_message)\n end",
"def create\n @round = Round.new(params[:round])\n @counter=params[:round_create_counter].to_i\n respond_to do |format|\n if @round.save\n @round.save\n format.html { redirect_to(:action => 'new', :case_study_id=>@round.case_study_id, :round_create_counter=>@counter) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def next_rounds\n League.current_seasons.each(&:next_round!)\n\n respond_to do |format|\n flash[:notice] = t('defaults.next_rounds_success')\n format.html{ redirect_to leagues_path}\n end\n end",
"def round_params\n params.require(:round).permit(:number)\n end",
"def advance_round\n @prevrnd = Round.find(params[:id])\n \n if params[:advance_round]\n @poets = []\n @slam = @prevrnd.slam\n @newrnd = @slam.rounds.create(round_number: @prevrnd.round_number.to_i + 1)\n @newrnd.assign_poets(params[:round][:poet])\n \n @newrnd.performances.each do |p|\n @poets << p.poet\n end\n redirect_to score_path(@newrnd.id)\n elsif params[:end_slam]\n @slam = @prevrnd.slam\n @slam.update_attributes(slam_complete: true)\n redirect_to slam_final_path(@prevrnd.slam_id)\n end\n end",
"def index\n @tournament = Tournament.find(params[:tournament_id])\n @rounds = @tournament.rounds\n end",
"def create\n @player_round_loans = params[:player_round_loans].values.collect { |player_round_loan| PlayerRoundLoan.new(player_round_loan) }\n\n @player_round_loans.each do |player_round_loan|\n player_round_loan.save!\n end\n\n# @player_round_loan = PlayerRoundLoan.new(params[:player_round_loan])\n\n respond_to do |format|\n if @player_round_loans.all?(&:valid?)\n @round=Round.find(@player_round_loans[0].round_id)\n @round.played=true\n @round.save!\n # format.html { redirect_to new_player_round_investment_path(:player_id=>@player_round_loans[0].player_id, :round_id=>@player_round_loans[0].round_id, :brand_id=>@player_round_loans[0].brand_id) }\n format.html {redirect_to root_path}\n #format.html { redirect_to @player_round_loan, notice: 'Player round loan was successfully created.' }\n format.json { render json: @player_round_loan, status: :created, location: @player_round_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_round_loan.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\r\n params.require(:round).permit(\r\n :title,\r\n :started_at,\r\n :ended_at,\r\n :plan_id,\r\n :scenario_id,\r\n :project_id,\r\n :issue_id\r\n )\r\n end",
"def new\n @round = Round.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @round }\n end\n end",
"def update\n\n atts = game_params[:rounds_attributes]\n\n temp_rounds = []\n temp_rounds_ordered = []\n\n #go through the rounds, add them to an array\n atts.each do |round|\n around = Round.new(round[1])\n temp_rounds << around\n puts around.to_s\n puts around.id.to_s\n puts round[1].class\n end\n\n #sort the new round order\n temp_rounds = temp_rounds.sort_by{|e| -e[:score]}\n place = 0\n \n\n #set the correct place in the temp array\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n temp_rounds_ordered << round\n end\n\n @game = Game.find(params[:id])\n\n @game.rounds.each do |round| \n temp_rounds_ordered.each do |tr| \n if tr.id == round.id \n round.place = tr.place\n round.player_id = tr.player_id\n round.score = tr.score\n round.asterisk = tr.asterisk\n round.correct = tr.correct\n end\n end\n end\n\n @game.description = game_params[:description]\n @game.date = game_params[:date].to_date\n\n puts @game.rounds.size\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: \"Game updated successfully!\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @round_expense = RoundExpense.new(params[:round_expense])\n @round=Round.new(params[:round])\n respond_to do |format|\n if @round_expense.save\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully created.') }\n format.xml { render :xml => @round_expense, :status => :created, :location => @round_expense }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n @round.save\n end",
"def create\n @game_round = GameRound.new(game_round_params)\n\n respond_to do |format|\n @game_round.campaign = @campaign\n @game_round.creator = current_user\n if @game_round.save\n format.html {\n redirect_to( {action: :index}, notice: 'Game instance was successfully created.')\n }\n format.json { render :show, status: :created, location: @game_round }\n else\n format.html { render :new }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @slam = Slam.new(params[:slam])\n\n respond_to do |format|\n if @slam.save\n @slam.update_attributes(master_id: current_user.id)\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n \n format.html { redirect_to edit_round_path(@round1), notice: 'Get to it!' }\n format.json { render json: @slam, status: :created, location: @slam }\n else\n format.html { render action: \"new\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pmround = Pmround.new(pmround_params)\n\n respond_to do |format|\n if @pmround.save\n format.html { redirect_to @pmround, notice: 'Pmround was successfully created.' }\n format.json { render :show, status: :created, location: @pmround }\n else\n format.html { render :new }\n format.json { render json: @pmround.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end",
"def round(round_number)\n response = JSON.parse( self.class.get(\"#{BASE_URL}/contest/#{@api_key}/round/#{round_number}\") )\n end",
"def new_round \n\t\tself.remaining_players.each do |player|\n\t\t\tplayer.hands.create\n\t\tend\n\t\tself.update_attributes(:flowing_right => !self.flowing_right, :round => self.round + 1)\n\tend",
"def next_round\n unless current_round == num_rounds\n update_attributes(current_round: current_round + 1)\n round.start_response_timer\n else\n max_points = game_players_by_points.first.points\n if max_points == 0\n game_players.each{|game_player| game_player.set_lose}\n else\n has_winner = game_players.select{|game_player| game_player.points == max_points}.count == 1\n if has_winner\n game_players_by_points.first.set_win\n else\n game_players.select{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_tie}\n end\n game_players.reject{|game_player| game_player.points == max_points}.each{|game_player| game_player.set_lose}\n end\n update_attributes(current_state: 3)\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 create\n @round = Round.new(round_params)\n\n respond_to do |format|\n if @round.save\n\n @formTemplate = FormTemplate.new(round_id: @round.id)\n @formTemplate.save\n delphiEstimation = DelphiEstimation.find_by_id(@round.delphiEstimation_id)\n project = Project.find_by_id(delphiEstimation.p_id)\n wbs = WorkBreakdownStructure.find_by p_id: project.id\n tasks = Task.where(wbs_id: wbs.id)\n tasks.each do |task|\n subtasks = Subtask.where(task_id: task.id)\n subtasks.each do |subtask|\n workpackages = Workpackage.where(subtask_id: subtask.id)\n workpackages.each do |workpackage|\n EstimationTemplate.new(form_template_id: @formTemplate.id, workpackage_id: workpackage.id, comment: '').save\n end\n end\n end\n\n format.html { redirect_to @formTemplate, notice: 'Runde wurde erfolgreich angelegt.' }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { render :new }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @round.update(round_params)\n render :show, status: :ok\n else\n render json: @round.errors, status: :unprocessable_entity\n end\n end",
"def create_rounds(game_ids)\n rounds = [[game_ids[game_ids.length - 4],\n game_ids[game_ids.length - 3],\n game_ids[game_ids.length - 2],\n game_ids[game_ids.length - 1]]]\n\n current_game_index = 0\n num_games_in_round = Bracket::NUM_TEAMS / 2\n final_game_index = current_game_index + (num_games_in_round - 1)\n while num_games_in_round >= 1\n rounds.push([])\n current_game_index.upto(final_game_index) do |game_index|\n rounds.last.push(game_ids[game_index])\n end\n num_games_in_round /= 2\n current_game_index = final_game_index + 1\n final_game_index = current_game_index + (num_games_in_round - 1)\n end\n\n rounds\n end",
"def round_params\n params.require(:round).permit(:delphiEstimation_id, :count, :closed)\n end",
"def assignment_round\n AssignmentQueue.assignment_round\n\n respond_to do |format|\n format.html do\n flash[:notice] = 'New assignment round generated'\n redirect_to action: :index\n end\n format.json { redirect_to action: :index, status: :ok }\n end\n end",
"def round_result\n @round = Round.find(params[:id])\n end",
"def game_params\n params.require(:game).permit(\n :stories,\n :draw_urls,\n :num_rounds)\n end",
"def play(rounds)\n puts \"\\nThere are #{@players.size} players and \" +\n \"#{TreasureTrove::TREASURES.size} treasures in #{@title}\"\n 1.upto(rounds) do |round|\n puts \"\\nRound #{round}\"\n @players.each do |p|\n GameTurn.take_turn(p)\n end\n end\n end",
"def index\n if params[:event_id]\n @event = Event.find(params[:event_id])\n @rounds = Round.where(\"event_id = ?\", params[:event_id])\n else\n @rounds = Round.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rounds }\n end\n end",
"def create\n @rock = Rock.new(rock_params)\n\n if @rock.save\n render json: @rock, status: :created\n else\n render json: @rock.errors, status: :unprocessable_entity\n end\n end",
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def request_round\n return auth_err unless auth?\n log \"#{@color} requested a round\"\n return wait_err unless wait_round\n get_map_render\n return game_terminated_msg if game_terminated?\n return {plain: \"continue.\\n\" + @map_render} if plain?\n return {json: {message: \"It's your turn\", map: @map_render, points: @map.took_hash}}\n end",
"def pmround_params\n params.require(:pmround).permit(:round)\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: \"Round was successfully updated.\" }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:commit, :title, :number_of_questions, questions_attributes: [:id, :question, :answer])\n end",
"def create\n @winner = Winner.new(params[:winner])\n\n respond_to do |format|\n if @winner.save\n format.html { redirect_to @winner, notice: 'Winner was successfully created.' }\n format.json { render json: @winner, status: :created, location: @winner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_first_round\n for i in 1..4\t\n Round.create(:slam_id => self.id, :roundNumber => i)\n end\n end",
"def index\n @aggregation_rounds = AggregationRound.all\n end",
"def complete_lap\n if user_signed_in?\n current_user.completed_repetition_rounds.create!(\n repetition_round_params.merge(repetition_level_id: @level.id)\n )\n end\n render json: {}\n end",
"def show\n @slam = Slam.find(params[:id])\n @round1 = Round.create(round_number: 1, slam_id: @slam.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @slam }\n end\n end",
"def start_next_round\n strong_params = params.permit(:id)\n game = Game.find(strong_params[:id])\n StartNextRound.new(game).call\n\n redirect_to game\n end",
"def create\n @shooting_round = ShootingRound.new(params[:shooting_round])\n @shooting_round.s_session = @shooting_session\n\n respond_to do |format|\n if @shooting_round.save\n format.html { redirect_to(shooting_back() , :notice => 'Shooting round was successfully created.') }\n format.xml { render :xml => @shooting_round, :status => :created, :location => @shooting_round }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shooting_round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @league = League.new(league_params)\n\n respond_to do |format|\n if @league.save\n\n (0..(@league.size-1)).each_with_index do |i|\n fantasy_team = @league.fantasy_teams.create(owner: \"Team #{i+1}\", pick_number: i+1)\n picks = []\n\n (1..@league.roster_size).each do |round|\n offset = round % 2 == 1 ? i + 1: @league.size - i\n pick = (round-1)*@league.size + offset\n @league.draft_picks.create(number: pick, fantasy_team: fantasy_team)\n end\n\n puts \"Team #{i} gets picks #{fantasy_team.draft_picks.map(&:number)}\\n\"\n end\n\n format.html { redirect_to @league, notice: 'League was successfully created.' }\n format.json { render :show, status: :created, location: @league }\n else\n format.html { render :new }\n format.json { render json: @league.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params) && @round.debate.rounds.count >= 3\n format.html { redirect_to @round.debate, notice: 'Your debate is now over. Share with friends and check back later for results.' }\n format.json { render :show, status: :ok, location: @round }\n elsif @round.update(round_params) && @round.debate.rounds.count < 3\n format.html { redirect_to @round.debate, notice: 'The previous round is now complete.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { redirect_to @round.debate, notice: @round.errors.full_messages.first[7..100]}\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def game_params\n params.require(:game).permit(:players_num, :rounds_num, :currently_scored, :joined_players, :creator_id, :round_number)\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end",
"def set_round\n @round = Round.find(params[:id])\n end"
] |
[
"0.7104489",
"0.7104489",
"0.70039594",
"0.6991256",
"0.6908583",
"0.6889093",
"0.68323505",
"0.6823776",
"0.6803231",
"0.6674662",
"0.66656566",
"0.65715724",
"0.6561143",
"0.65382886",
"0.64882076",
"0.6380548",
"0.63772136",
"0.63772136",
"0.63759726",
"0.6367244",
"0.6356194",
"0.63559806",
"0.6336218",
"0.6292752",
"0.62434053",
"0.6225809",
"0.6191883",
"0.6179848",
"0.61756253",
"0.61515844",
"0.6141703",
"0.6112448",
"0.60982",
"0.60879934",
"0.60048217",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.5994932",
"0.59764457",
"0.59636265",
"0.5874804",
"0.5861651",
"0.5856571",
"0.58480513",
"0.58462894",
"0.5845883",
"0.58174515",
"0.5813511",
"0.57975465",
"0.5758682",
"0.57563895",
"0.5727398",
"0.5683696",
"0.5682579",
"0.5665613",
"0.5661273",
"0.565852",
"0.5648734",
"0.56421065",
"0.5625231",
"0.5614057",
"0.55815285",
"0.55747545",
"0.5561388",
"0.5554313",
"0.554952",
"0.55021006",
"0.5497865",
"0.54623365",
"0.54488623",
"0.5439508",
"0.5438504",
"0.54351336",
"0.54341793",
"0.54146004",
"0.54122525",
"0.54052985",
"0.536652",
"0.53569883",
"0.53546196",
"0.53511786",
"0.53398573",
"0.5337838",
"0.5334656",
"0.5325103",
"0.5324663",
"0.53226995",
"0.5317065",
"0.53163755",
"0.53114617",
"0.5297571",
"0.5269979",
"0.5266715",
"0.5266003",
"0.5266003",
"0.5266003"
] |
0.68040234
|
8
|
PATCH/PUT /rounds/1 PATCH/PUT /rounds/1.json
|
def update
respond_to do |format|
if @round.update_from_json(round_params['round'])
update_parents(@round)
format.html { redirect_to @round, notice: 'Round was successfully updated.' }
format.json { render json: @round.errors, status: :unprocessable_entity }
else
format.html { render :edit }
format.json { render json: @round.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to :back, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: 'Round was successfully updated.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to @round, notice: \"Round was successfully updated.\" }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html { redirect_to :root }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { render :edit }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to(@round, :notice => 'Round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round = @season.rounds.find(params[:id])\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n flash[:notice] = 'Round was successfully updated.'\n format.html { redirect_to season_round_path(@round.season, @round) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @round.update(round_params)\n format.html do redirect_to @round, notice: 'Round was successfully updated.' end\n format.json { render :show, status: :ok, location: @round }\n else\n @form_for = @round\n format.html do render :edit end\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @grant_round = GrantRound.find(params[:id])\n\n if @grant_round.update(grant_round_params (params[:grant_round]))\n head :no_content\n else\n render json: @grant_round.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @round.update(round_params)\n render :show, status: :ok\n else\n render json: @round.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n format.html { redirect_to case_game_rounds_path , notice: 'Game instance was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round }\n else\n format.html { render :edit }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shooting_round = ShootingRound.find(params[:id])\n\n respond_to do |format|\n if @shooting_round.update_attributes(params[:shooting_round])\n format.html { redirect_to(shooting_back() , :notice => 'Shooting round was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shooting_round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @game_round.update(game_round_params)\n\n if @game_round.started? && @game_round.previous_changes.key?( 'custom_highlow')\n RedisService.custom_game_ground_winlose @game_round\n end\n\n format.html { redirect_to action: :index, notice: 'Game round was successfully updated.' }\n format.json { render :show, status: :ok, location: @game_round }\n else\n format.html { render :edit }\n format.json { render json: @game_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @military_battle_round = Military::BattleRound.find(params[:id])\n\n respond_to do |format|\n if @military_battle_round.update_attributes(params[:military_battle_round])\n format.html { redirect_to @military_battle_round, notice: 'Battle round was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @military_battle_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n @fight = Fight.find(@round.fight_id)\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @fight, notice: 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @round.update(round_params)\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.updated', model: Round.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :edit }\r\n format.js { render :edit }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @round.update(round_params) && @round.debate.rounds.count >= 3\n format.html { redirect_to @round.debate, notice: 'Your debate is now over. Share with friends and check back later for results.' }\n format.json { render :show, status: :ok, location: @round }\n elsif @round.update(round_params) && @round.debate.rounds.count < 3\n format.html { redirect_to @round.debate, notice: 'The previous round is now complete.' }\n format.json { render :show, status: :ok, location: @round }\n else\n format.html { redirect_to @round.debate, notice: @round.errors.full_messages.first[7..100]}\n format.json { render json: @round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @boxscore = @game.boxscores.find(params[:id])\n \n\n respond_to do |format|\n if @boxscore.update_attributes(params[:boxscore])\n format.html { redirect_to game_boxscores_url(@game), notice: 'Boxscore was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @boxscore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @round = Round.find(params[:id])\n params[:round][:start_date] = Date.strptime(params[:round][:start_date], '%d/%m/%Y').strftime.to_s\n params[:round][:end_date] = Date.strptime(params[:round][:end_date], '%d/%m/%Y').strftime.to_s\n\n respond_to do |format|\n if @round.update_attributes(params[:round])\n format.html { redirect_to @round, :notice => 'Round was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @round.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n streak, success = jsonapi_update.to_a\n\n if success\n render_jsonapi(streak, scope: false)\n else\n render_errors_for(streak)\n end\n end",
"def update\n @replay = Replay.find(params[:id])\n @replay.level_id = params[:replay][:level_id]\n @replay.score = params[:replay][:score]\n @replay.player = params[:replay][:player]\n @replay.data = params[:replay][:data].read\n\n respond_to do |format|\n\n format.html { redirect_to replays_path, :notice => 'Replay was successfully updated.' }\n format.json { head :no_content }\n\n end\n end",
"def update\n @test_run = TestRun.find(params[:id])\n\n respond_to do |format|\n if @test_run.update_attributes(params[:test_run])\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @box_score = BoxScore.find(params[:id])\n\n respond_to do |format|\n if @box_score.update_attributes(params[:box_score])\n format.html { redirect_to @box_score, notice: 'Box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @rock = Rock.find(params[:id])\n\n respond_to do |format|\n if @rock.update_attributes(params[:rock])\n format.html { redirect_to @rock, notice: 'Rock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n atts = game_params[:rounds_attributes]\n\n temp_rounds = []\n temp_rounds_ordered = []\n\n #go through the rounds, add them to an array\n atts.each do |round|\n around = Round.new(round[1])\n temp_rounds << around\n puts around.to_s\n puts around.id.to_s\n puts round[1].class\n end\n\n #sort the new round order\n temp_rounds = temp_rounds.sort_by{|e| -e[:score]}\n place = 0\n \n\n #set the correct place in the temp array\n temp_rounds.each do |round|\n place = place + 1\n round.place = place\n temp_rounds_ordered << round\n end\n\n @game = Game.find(params[:id])\n\n @game.rounds.each do |round| \n temp_rounds_ordered.each do |tr| \n if tr.id == round.id \n round.place = tr.place\n round.player_id = tr.player_id\n round.score = tr.score\n round.asterisk = tr.asterisk\n round.correct = tr.correct\n end\n end\n end\n\n @game.description = game_params[:description]\n @game.date = game_params[:date].to_date\n\n puts @game.rounds.size\n\n respond_to do |format|\n if @game.save\n format.html { redirect_to @game, notice: \"Game updated successfully!\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_box_score = PlayerBoxScore.find(params[:id])\n\n respond_to do |format|\n if @player_box_score.update_attributes(params[:player_box_score])\n format.html { redirect_to @player_box_score, notice: 'Player box score was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_box_score.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @aggregation_round.update(aggregation_round_params)\n format.html { redirect_to @aggregation_round, notice: 'Aggregation round was successfully updated.' }\n format.json { render :show, status: :ok, location: @aggregation_round }\n else\n format.html { render :edit }\n format.json { render json: @aggregation_round.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, :notice => 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @playground.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @round.update!(round_params)\n notify_clients\n redirect_to game_path(@round.game) # with turbolinks\n rescue\n render layout: false, status: :bad_request\n end",
"def update\n @rum = Rum.find(params[:id])\n\n respond_to do |format|\n if @rum.update_attributes(params[:rum])\n format.html { redirect_to @rum, notice: 'Rum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @playground = Playground.find(params[:id])\n\n respond_to do |format|\n if @playground.update_attributes(params[:playground])\n format.html { redirect_to @playground, notice: 'Playground was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @playground.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @livestock = Livestock.find(params[:id])\n\n respond_to do |format|\n if @livestock.update_attributes(params[:livestock])\n format.html { redirect_to @livestock, notice: 'Livestock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @livestock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mystock.update(mystock_params)\n format.html { redirect_to @mystock, notice: 'mystock was successfully updated.' }\n format.json { render :show, status: :ok, location: @mystock }\n else\n format.html { render :edit }\n format.json { render json: @mystock.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @routine = Routine.find(params[:id])\n\n respond_to do |format|\n if @routine.update_attributes(params[:routine])\n format.html { redirect_to @routine, notice: 'Routine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @routine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @swap.update(swap_params)\n format.html { redirect_to round_swaps_path(@round), notice: 'Swap was successfully updated.' }\n format.json { render :show, status: :ok, location: @swap }\n else\n format.html { render :edit }\n format.json { render json: @swap.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][:winner]\n @game.overall_score = ActiveSupport::JSON.decode(params[:game][:overall_score])\n @game.game_state = ActiveSupport::JSON.decode(params[:game][:game_state])\n\n respond_to do |format|\n if @game.save\n format.json { head :no_content }\n else\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test10 = Test10.find(params[:id])\n\n respond_to do |format|\n if @test10.update_attributes(params[:test10])\n format.html { redirect_to @test10, notice: 'Test10 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test10.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @box = Box.find(params[:id])\n\n respond_to do |format|\n if @box.update_attributes(params[:box])\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n\n respond_to do |format|\n if @player_round_loan.update_attributes(params[:player_round_loan])\n format.html { redirect_to @player_round_loan, notice: 'Player round loan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @player_round_loan.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 @box_score_entry = BoxScoreEntry.find(params[:id])\n\n respond_to do |format|\n if @box_score_entry.update_attributes(params[:box_score_entry])\n format.html { redirect_to @box_score_entry, :notice => 'Box score entry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @box_score_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint.update!(sprint_params)\n json_response(@sprint)\n end",
"def update\n @contract = Contract.find(params[:id])\n @units = Unit.unsold(params[:tower_id])\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n format.html { redirect_to tower_contract_path(@contract.unit.tower, @contract), notice: 'Contract was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box_score_entry.update(box_score_entry_params)\n format.html { redirect_to @box_score_entry, notice: 'Box score entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @box_score_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_score\n @round = Round.find(params[:id])\n @round.update_attributes(params[:round])\n redirect_to round_result_path(@round.id)\n end",
"def update\n respond_to do |format|\n if @round.make_guess(params[\"round\"][\"guessed_letter\"])\n update_current_player\n format.html { redirect_to game_round_path(@game, @round) }\n format.json { render :show, status: :created, location: @round }\n else\n format.html { redirect_to game_round_path(@game, @round), notice: 'Invalid guess' }\n format.json { render :show, status: :created, location: @round }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n update_standings\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @trip.update(trip_params)\n last_clip(@trip, trip_params[:clips_attributes].present?)\n format.html { redirect_to @trip.parent || @trip, notice: 'Trip was successfully updated.', change: \"list\" }\n format.json { head :no_content }\n else\n format.html { redirect_to @trip.parent || @trip }\n format.json { render json: @trip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shuttle_run.update(shuttle_run_params)\n format.html { redirect_to @shuttle_run, notice: 'Shuttle run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shuttle_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @trick = Trick.find(params[:id])\n\n respond_to do |format|\n if @trick.update_attributes(params[:trick])\n format.html { redirect_to @trick, notice: 'Trick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, :notice => 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @run.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @winner = Winner.find(params[:id])\n\n respond_to do |format|\n if @winner.update_attributes(params[:winner])\n format.html { redirect_to @winner, notice: 'Winner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bracketcontest.update(bracketcontest_params)\n\tsave_contestants()\n\tflash[:notice] = 'Bracketcontest was successfully updated.' \n format.html { redirect_to [@bracketgrouping, @bracketcontest]}\n format.json { render :show, status: :ok, location: @bracketcontest }\n else\n format.html { render :edit }\n format.json { render json: @bracketcontest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n @round_robin_promo = RoundRobinPromo.find(params[:id])\n\n respond_to do |format|\n if @round_robin_promo.update_attributes(params[:round_robin_promo])\n format.html { redirect_to @round_robin_promo, notice: 'Round robin promo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @round_robin_promo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @run = Run.find(params[:id])\n\n respond_to do |format|\n if @run.update_attributes(params[:run])\n format.html { redirect_to @run, notice: 'Run was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chest_triceps1.update(chest_triceps1_params)\n format.html { redirect_to \"/chest_triceps1s\" } \n format.json { render :show, status: :ok, location: @chest_triceps1 }\n else\n format.html { render :edit }\n format.json { render json: @chest_triceps1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pmround.update(pmround_params)\n format.html { redirect_to @pmround, notice: 'Pmround was successfully updated.' }\n format.json { render :show, status: :ok, location: @pmround }\n else\n format.html { render :edit }\n format.json { render json: @pmround.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 respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @stuck.update(stuck_params)\n format.html { redirect_to @stuck, notice: 'Stuck was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @stuck.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @runner = Runner.find(params[:id])\n\n respond_to do |format|\n if @runner.update_attributes(params[:runner])\n format.html { redirect_to @runner, notice: 'Runner was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @runner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @team = Team.find(params[:team_id])\n @sprint = @team.sprints.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [@sprint.team, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch!\n request! :patch\n end",
"def update\n @round_expense = RoundExpense.find(params[:id])\n\n respond_to do |format|\n if @round_expense.update_attributes(params[:round_expense])\n format.html { redirect_to(@round_expense, :notice => 'Round expense was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @round_expense.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @test_run.update(test_run_params)\n format.html { redirect_to @test_run, notice: 'Test run was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_run }\n else\n format.html { render :edit }\n format.json { render json: @test_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end",
"def update\n \n @fixture = Fixture.find(params[:id])\n\n\t@fixture.winningteam.points = @fixture.winningteam.points + 3\n\t@fixture.winningteam.save\n respond_to do |format|\n if @fixture.update_attributes(params[:fixture])\n format.html { redirect_to @fixture, notice: 'Fixture was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fixture.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint = Sprint.find(params[:id])\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to @sprint, notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_livestock = UserLivestock.find(params[:id])\n\n respond_to do |format|\n if @user_livestock.update_attributes(params[:user_livestock])\n format.html { redirect_to @user_livestock, notice: 'User livestock was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_livestock.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 @pick.update_attributes(picks_params)\n format.html { redirect_to games_path, notice: 'Pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n if @game.final? then\n recalculate_points\n end\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chicken_run.update(chicken_run_params)\n format.html { redirect_to @chicken_run, notice: 'Chicken run was successfully updated.' }\n format.json { render :show, status: :ok, location: @chicken_run }\n else\n format.html { render :edit }\n format.json { render json: @chicken_run.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n contract = Contract.find_by_id(params[:id])\n (head :unauthorized unless contract) and return\n \n # try to update the attributes\n if contract.update_attributes(edit_contract_params)\n render json: contract\n else\n render json: { errors: contract.error.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @bench.update(bench_params)\n format.html { redirect_to @bench, notice: 'Bench was successfully updated.' }\n format.json { render :show, status: :ok, location: @bench }\n else\n format.html { render :edit }\n format.json { render json: @bench.errors, status: :unprocessable_entity }\n end\n end\n end",
"def round_params\n params.require(:round).permit(:judge_id, :status)\n end",
"def update\n respond_to do |format|\n if @turn.update(turn_params)\n format.html { redirect_to @turn, notice: 'Turn was successfully updated.' }\n format.json { render :show, status: :ok, location: @turn }\n else\n format.html { render :edit }\n format.json { render json: @turn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tester = Tester.find(params[:id])\n\n respond_to do |format|\n if @tester.update_attributes(params[:tester])\n format.html { redirect_to @tester, notice: 'Tester was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tester.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n (kick and return) if not is_god?\n if (params[:team].has_key? :pass_hash) and (params.has_key? :do_hash)\n clear_pass = params[:team][:pass_hash]\n hash = Digest::SHA1.base64digest clear_pass\n params[:team][:pass_hash] = hash\n end\n @team = Team.find(params[:id])\n points_adjust = params[:points_adjust].to_i\n @team.points = @team.points + points_adjust\n\n pref = 'has_solved_'\n puzzles_to_set_solved = params.keys.select do |k| \n k.start_with? pref\n end.map do |k|\n k.sub(pref, '').to_i\n end\n actual_solved_ids = @team.puzzles.map{|p| p.id}\n # puts actual_solved_ids.inspect\n # puts puzzles_to_set_solved.inspect\n\n puzzles_to_set_solved.each do |pid|\n if not actual_solved_ids.include? pid\n s = Solve.new(:puzzle_id => pid, :team_id => @team.id, :time_solved => Time.now)\n s.save\n end\n end\n actual_solved_ids.each do |pid|\n if not puzzles_to_set_solved.include? pid\n Solve.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n Callin.where(:puzzle_id => pid, :team_id => @team.id).destroy_all\n end\n end\n\n respond_to do |format|\n if @team.update_attributes(params[:team])\n format.html { redirect_to @team, notice: 'Team was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @team.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @run_type.update(run_type_params)\n @run_type.update_default_shoe(params[:run_type][:default].to_i)\n\n format.html { redirect_to admin_run_types_path, notice: update_notice(@run_type.name) }\n format.json { render :index, status: :ok, location: @run_type }\n else\n format.html { render :edit }\n format.json { render json: @run_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n @shot = Shot.find(params[:id])\n\n respond_to do |format|\n if @shot.update_attributes(params[:shot])\n format.html { redirect_to @shot, notice: 'Shot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n tp = test_params.merge!(plate_id: params[:plate_id])\n respond_to do |format|\n if @test.update(tp)\n format.html { redirect_to [@plate, @test], notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @test }\n else\n format.html { render :edit }\n format.json { render json: @test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @playground.update(playground_params)\n format.html { redirect_to @playground, notice: 'Playground was successfully updated.' }\n format.json { render :show, status: :ok, location: @playground }\n else\n format.html { render :edit }\n format.json { render json: @playground.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @box.update(box_params)\n format.html { redirect_to @box, notice: 'Box was successfully updated.' }\n format.json { render :show, status: :ok, location: @box }\n else\n format.html { render :edit }\n format.json { render json: @box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sprint = Sprint.find(params[:id])\n\n respond_to do |format|\n if @sprint.update_attributes(params[:sprint])\n format.html { redirect_to [:admin, @sprint], notice: 'Sprint was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sprint.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operations_check = OperationsCheck.find(params[:id])\n\n respond_to do |format|\n if @operations_check.update_attributes(operations_check_params)\n format.html { redirect_to @operations_check, \n notice: 'Operations check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operations_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shoe.update(shoe_params)\n format.html { redirect_to runner_shoes_path, notice: 'Zapatilla actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shoe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rice3.update(rice3_params)\n format.html { redirect_to @rice3, notice: 'Rice3 was successfully updated.' }\n format.json { render :show, status: :ok, location: @rice3 }\n else\n format.html { render :edit }\n format.json { render json: @rice3.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game = Game.find(params[:id])\n params[:game][:points].each do |k, v|\n score = Score.find_by_id(k)\n score.update_attributes(points: v)\n d = params[:direction][k]\n #direc = Score::DIRECTIONS.invert\n score.update_attributes(direction: d) # direc[d])\n end\n\n respond_to do |format|\n if @game.update_attributes(table: params[:game][:table],\n number: params[:game][:number],\n status: params[:game][:status])\n format.html { redirect_to @game, notice: 'Game was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @game.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n block_non_user\n @contest = Contest.find(params[:id])\n\n respond_to do |format|\n if @contest.update_attributes(params[:contest])\n format.html { redirect_to @contest, notice: 'Contest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @round = Round.find(params[:id])\n @poets = Poet.all\n end",
"def update\n @trainer = Trainer.find(params[:id])\n\n if @trainer.update(trainer_params)\n head :no_content\n else\n render json: @trainer.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @runtest.update(runtest_params)\n format.html { redirect_to @runtest, notice: 'Runtest was successfully updated.' }\n format.json { render :show, status: :ok, location: @runtest }\n else\n format.html { render :edit }\n format.json { render json: @runtest.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7072058",
"0.703137",
"0.68509346",
"0.6767903",
"0.6767903",
"0.6712788",
"0.6678458",
"0.66683185",
"0.6655102",
"0.6655102",
"0.6627183",
"0.66132647",
"0.65992844",
"0.6535786",
"0.63719124",
"0.6328629",
"0.6312666",
"0.61335635",
"0.61317116",
"0.61029226",
"0.6057517",
"0.605726",
"0.60566247",
"0.59122527",
"0.5910795",
"0.584069",
"0.5837628",
"0.5830443",
"0.58285785",
"0.5826549",
"0.57993215",
"0.57972467",
"0.57851875",
"0.5781376",
"0.57764035",
"0.57761115",
"0.57749075",
"0.5754879",
"0.57482487",
"0.57326305",
"0.57277447",
"0.5722225",
"0.5719372",
"0.5714272",
"0.57109445",
"0.5706843",
"0.5705736",
"0.5700458",
"0.56939304",
"0.5690985",
"0.5687194",
"0.5686431",
"0.5686009",
"0.5673438",
"0.5669226",
"0.56654596",
"0.56621057",
"0.56509644",
"0.56497175",
"0.5649105",
"0.5641143",
"0.5638315",
"0.56377363",
"0.5637165",
"0.56335",
"0.5633445",
"0.5625835",
"0.56123656",
"0.56121045",
"0.56086606",
"0.5607232",
"0.5604784",
"0.56014884",
"0.5601232",
"0.55915505",
"0.5591242",
"0.5588591",
"0.5582892",
"0.55788285",
"0.55772763",
"0.5576719",
"0.55749",
"0.55714035",
"0.55714035",
"0.5562248",
"0.55573046",
"0.5555273",
"0.55506593",
"0.554947",
"0.55463284",
"0.55445",
"0.5543411",
"0.5542969",
"0.55384463",
"0.5537617",
"0.5536367",
"0.5532928",
"0.55292976",
"0.5523394",
"0.5510267"
] |
0.68880683
|
2
|
DELETE /rounds/1 DELETE /rounds/1.json
|
def destroy
@round.destroy
respond_to do |format|
format.html { redirect_to rounds_url, notice: 'round was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to rounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @round = Round.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to(rounds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @game = Game.where(user_id: current_user.id).find(params[:game_id])\n @round = @game.rounds.find(params[:id])\n @round.destroy\n\n respond_to do |format|\n format.html { redirect_to game_rounds_url(@game), notice: 'Round was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to rounds_url, notice: \"Round was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shooting_round = ShootingRound.find(params[:id])\n @shooting_round.destroy\n\n respond_to do |format|\n format.html { redirect_to(shooting_back() ) }\n format.xml { head :ok }\n end\n end",
"def destroy\n # @game.rounds.destroy_all\n # raise @game.inspect\n @game.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Game was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n tournament = @round.tournament\n @round.destroy\n respond_to do |format|\n format.html do\n redirect_to tournament_path(tournament), notice: 'Round was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end",
"def destroy\n @military_battle_round = Military::BattleRound.find(params[:id])\n @military_battle_round.destroy\n\n respond_to do |format|\n format.html { redirect_to military_battle_rounds_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @grant_round = GrantRound.find(params[:id])\n @grant_round.destroy\n\n head :no_content\n end",
"def destroy\n @round.destroy\n respond_to do |format|\n format.html { redirect_to DelphiEstimation.find_by_id(@round.delphiEstimation_id), notice: 'Round wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_round.destroy\n respond_to do |format|\n format.html { redirect_to game_rounds_url, notice: 'Game round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @aggregation_round.destroy\n respond_to do |format|\n format.html { redirect_to aggregation_rounds_url, notice: 'Aggregation round was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n game = @round.game\n @round.destroy\n redirect_to edit_game_path(game), notice: 'Round was successfully destroyed.'\n end",
"def destroy\n @test_run = TestRun.find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shuttle_run.destroy\n respond_to do |format|\n format.html { redirect_to shuttle_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @replay = Replay.find(params[:id])\n @replay.destroy\n\n respond_to do |format|\n format.html { redirect_to replays_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run.destroy\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rum = Rum.find(params[:id])\n @rum.destroy\n\n respond_to do |format|\n format.html { redirect_to rums_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @boxscore = @game.boxscores.find(params[:id])\n @boxscore.destroy\n\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { head :no_content }\n end\n end",
"def destroy\n @round_expense = RoundExpense.find(params[:id])\n @round_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(round_expenses_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @livestock = Livestock.find(params[:id])\n @livestock.destroy\n\n respond_to do |format|\n format.html { redirect_to livestocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test10 = Test10.find(params[:id])\n @test10.destroy\n\n respond_to do |format|\n format.html { redirect_to test10s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pmround.destroy\n respond_to do |format|\n format.html { redirect_to pmrounds_url, notice: 'Pmround was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock = Rock.find(params[:id])\n @rock.destroy\n\n respond_to do |format|\n format.html { redirect_to rocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nudge.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @trial.destroy\n respond_to do |format|\n format.html { redirect_to trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shoot = Shoot.find(params[:id])\n @shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to shoots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = LoadTest.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @player_round_loan = PlayerRoundLoan.find(params[:id])\n @player_round_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to player_round_loans_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @turn.destroy\n respond_to do |format|\n format.html { redirect_to turns_url, notice: 'Turn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rockhound.destroy\n respond_to do |format|\n format.html { redirect_to rockhounds_url, notice: 'Rockhound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_run = TestRun.accessible_by(current_ability).find(params[:id])\n @test_run.destroy\n\n respond_to do |format|\n format.html { redirect_to test_runs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test = Test.find(params[:id])\n @test.destroy\n\n respond_to do |format|\n format.html { redirect_to tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bracket_golfer.destroy\n respond_to do |format|\n format.html { redirect_to bracket_golfers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nursing_time = NursingTime.find(params[:id])\n @nursing_time.destroy\n\n respond_to do |format|\n format.html { redirect_to nursing_times_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @reloud_check = ReloudCheck.find(params[:id])\n @reloud_check.destroy\n\n respond_to do |format|\n format.html { redirect_to reloud_checks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quest = Quest.find(params[:id])\n @quest.destroy\n\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @take = Take.find(params[:id])\n @take.destroy\n\n respond_to do |format|\n format.html { redirect_to takes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @contest.destroy\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @round.destroy\r\n\r\n respond_to do |format|\r\n set_rounds_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.destroyed', model: Round.model_name.human) }\r\n format.js\r\n end\r\n end",
"def destroy\n @nightclub.destroy\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @turno = Turno.find(params[:id])\n @turno.destroy\n\n respond_to do |format|\n format.html { redirect_to turno_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @playground = Playground.find(params[:id])\n @playground.destroy\n\n respond_to do |format|\n format.html { redirect_to playgrounds_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @test_stall.destroy\n respond_to do |format|\n format.html { redirect_to test_stalls_url, notice: 'Test stall was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game_stat = GameStat.find(params[:id])\n @game_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run.destroy\n respond_to do |format|\n format.html { redirect_to runs_url, notice: 'Run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def deleteExecution(execution_id)\n uri = URI(RUNDECKSERVER + ':' + RUNDECKPORT + '/api/12/execution/' + execution_id)\n http = Net::HTTP.new(uri.host, uri.port)\n headers = {'Content-Type'=> 'application/jsonr','X-RunDeck-Auth-Token'=> API_KEY }\n r = http.delete(uri.path, headers) \n return r\nend",
"def destroy\n @box_score_entry.destroy\n respond_to do |format|\n format.html { redirect_to box_score_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @intake.destroy\n respond_to do |format|\n format.html { redirect_to intakes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @turnover = Turnover.find(params[:id])\n @turnover.destroy\n\n respond_to do |format|\n format.html { redirect_to turnovers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @mosttinytrial = Mosttinytrial.find(params[:id])\n @mosttinytrial.destroy\n\n respond_to do |format|\n format.html { redirect_to mosttinytrials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @open_shoot = OpenShoot.find(params[:id])\n @open_shoot.destroy\n\n respond_to do |format|\n format.html { redirect_to open_shoots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mystock.destroy\n respond_to do |format|\n format.html { redirect_to mystocks_path, notice: 'mystock was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holdgame = Holdgame.find(params[:id])\n @holdgame.destroy\n\n respond_to do |format|\n format.html { redirect_to gamesmaps_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @holdgame = Holdgame.find(params[:id])\n @holdgame.destroy\n\n respond_to do |format|\n format.html { redirect_to gamesmaps_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @box_score = BoxScore.find(params[:id])\n @box_score.destroy\n\n respond_to do |format|\n format.html { redirect_to box_scores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @runtest.destroy\n respond_to do |format|\n format.html { redirect_to runtests_url, notice: 'Runtest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @winner = Winner.find(params[:id])\n @winner.destroy\n\n respond_to do |format|\n format.html { redirect_to winners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def delete_retry_test id\n uri = URI(HOST + \"/retry_test/#{id}\")\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Delete.new(uri.path)\n http.request(req)\n end",
"def destroy\n @my_time_trial = MyTimeTrial.find(params[:id])\n @my_time_trial.destroy\n\n respond_to do |format|\n format.html { redirect_to my_time_trials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nightclub = Nightclub.find(params[:id])\n @nightclub.destroy\n\n respond_to do |format|\n format.html { redirect_to nightclubs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shot = Shot.find(params[:id])\n @shot.destroy\n\n respond_to do |format|\n format.html { redirect_to shots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @repeating_transfer.destroy\n respond_to do |format|\n format.html { redirect_to repeating_transfers_url, notice: 'Repeating transfer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @six.destroy\n respond_to do |format|\n format.html { redirect_to sixes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ai_contest = AiContest.find(params[:id])\n @ai_contest.destroy\n\n respond_to do |format|\n format.html { redirect_to ai_contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n block_non_user\n @contest = Contest.find(params[:id])\n @contest.destroy\n\n respond_to do |format|\n format.html { redirect_to contests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tktest = Tktest.find(params[:id])\n @tktest.destroy\n\n respond_to do |format|\n format.html { redirect_to tktests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @chicken_run.destroy\n respond_to do |format|\n format.html { redirect_to chicken_runs_url, notice: 'Chicken run was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ruby = Ruby.find(params[:id])\n @ruby.destroy\n\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mostsmallroad = Mostsmallroad.find(params[:id])\n @mostsmallroad.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallroads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @assert = Assert.find(params[:id])\n @assert.destroy\n\n respond_to do |format|\n format.html { redirect_to asserts_url }\n format.json { head :ok }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end"
] |
[
"0.76205236",
"0.76205236",
"0.76205236",
"0.7431568",
"0.7431568",
"0.7430822",
"0.7422256",
"0.72982204",
"0.72982204",
"0.72982204",
"0.72982204",
"0.7291912",
"0.72139317",
"0.7098678",
"0.69999164",
"0.6967715",
"0.6926577",
"0.69074655",
"0.68914616",
"0.68591595",
"0.68037254",
"0.66976833",
"0.6649538",
"0.66202444",
"0.6617758",
"0.6575273",
"0.65558344",
"0.65235394",
"0.6500196",
"0.646447",
"0.6453011",
"0.64219296",
"0.6400944",
"0.6379957",
"0.6370882",
"0.6366649",
"0.6366191",
"0.63649166",
"0.63628465",
"0.6361509",
"0.6354436",
"0.6349867",
"0.633197",
"0.632582",
"0.6325337",
"0.63251644",
"0.6324765",
"0.6314804",
"0.63141435",
"0.63062835",
"0.63031584",
"0.6299514",
"0.62986565",
"0.62970036",
"0.62961084",
"0.6294331",
"0.6294331",
"0.62925714",
"0.62908775",
"0.6290618",
"0.6289011",
"0.6289011",
"0.6289011",
"0.6289011",
"0.6287082",
"0.6285907",
"0.628314",
"0.6282379",
"0.62819207",
"0.6281098",
"0.6280628",
"0.6268911",
"0.62675995",
"0.6266904",
"0.6261091",
"0.6261091",
"0.62563384",
"0.62492377",
"0.6248947",
"0.62472695",
"0.62472695",
"0.62472695",
"0.62472695",
"0.62440145",
"0.6242373",
"0.62411714",
"0.62351745",
"0.6234144",
"0.6233593",
"0.62334174",
"0.62319213",
"0.6228615",
"0.62280166",
"0.6223242",
"0.6219196",
"0.62189275",
"0.62185526",
"0.62179315",
"0.6215333",
"0.62135196"
] |
0.72501194
|
12
|
Use callbacks to share common setup or constraints between actions.
|
def set_round
@round = Round.find(params[:id])
rescue ActiveRecord::RecordNotFound
render(:file => File.join(Rails.root, 'public/404.html'), :status => 404, :layout => false)
# handle not found error
rescue ActiveRecord::ActiveRecordError
render(:file => File.join(Rails.root, 'public/404.html'), :status => 404, :layout => false)
# handle other ActiveRecord errors
rescue StandardError
render(:file => File.join(Rails.root, 'public/404.html'), :status => 404, :layout => false)
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 round_params
params.permit(:id, round:
[:roundtype_id, :round_number, :matches, :match_number]
)
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
|
Link to kata: Description: Fix the code to make the items multiply. Answer:
|
def multiply(a, b)
a * b
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def multiplies (*args)\n multi=1\n args.each do |item|\n multi *=item\n end\n multi\nend",
"def update_quality(items)\n items.each do |item|\n if is_special_item?(item)\n special_item(item)\n else\n item.sell_in > 0 ? decrement_normal_item(item, 1) : decrement_normal_item(item, 2)\n end\n\n item.sell_in -= 1\n end\nend",
"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 multiply(num)\n product = 1\n num.each do |x|\n product *= x\n end\n product\nend",
"def double(item)\n return item * 2\nend",
"def multiplicationby3(a)\n return a*3\nend",
"def change_in_entropy_of_surroundings(reactants:[], products:[], moles_of_reactant: nil)\n reactants.map{|each| each.quantity }\n change standard_enthalpies_of_products.sum - standard_enthalpies_of_reactants.sum\nend",
"def multiply(nums)\r\n nums.reduce(:*)\r\nend",
"def run(cart)\n # Each line_item has a quantity, which usually makes the total...\n # ...quantity of items higher than the length of cart.line_items\n total_item_count = 0\n applicable_line_items = cart.line_items.select do |line_item|\n is_shirt = line_item.variant.product.tags.include? 'shirts'\n is_bundle = line_item.variant.product.tags.include? 'bundle'\n if is_shirt and is_bundle\n total_item_count += line_item.quantity\n line_item\n end\n end\n\n # The remaining amount of items that can be discounted in each category\n items_in_bundles_of_3 = (total_item_count / 3).floor * 3\n items_in_bundles_of_2 = ((total_item_count % 3) / 2).floor * 2\n \n # Change the price of applicable items\n applicable_line_items.each do |line_item|\n unexamined_item_count = line_item.quantity\n if items_in_bundles_of_3 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_3 -= unexamined_item_count\n next\n end\n if items_in_bundles_of_3 > 0 and items_in_bundles_of_3 < unexamined_item_count\n discount = items_in_bundles_of_3 * @discount_per_item_in_bundle_of_three\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n unexamined_item_count -= items_in_bundles_of_3\n items_in_bundles_of_3 = 0\n end\n if items_in_bundles_of_2 >= unexamined_item_count\n discount = unexamined_item_count * @discount_per_item_in_bundle_of_two\n line_item.change_line_price(line_item.line_price - discount, message: \"\")\n items_in_bundles_of_2 -= unexamined_item_count\n end\n end\n end",
"def multiply_els(list)\n list.my_inject(1) { |product, i| product * i }\nend",
"def multiply\n yield 10\n yield 75\n yield 879\nend",
"def multiply_els\n\t\tself.my_inject(:*, self[0])\n\tend",
"def custom_multiply(array,number)\n new_array = []\n number.times {new_array+=array}\n return new_array\nend",
"def multiply_each (array, product=1)\n array.each do |x|\n product *= x\n end\n return product\nend",
"def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| result << element}}\n result\nend",
"def multiply_me(array, int)\r\n\r\n arr = [] # empty array created\r\n\r\n i = 0 # iteration starts to multiply each item\r\n while i < array.length\r\n arr << array[i] * int # products collected\r\n i += 1\r\n end\r\n\r\n arr # result\r\nend",
"def apply_coupons(cart, coupons)\n copy_item = nil\n original_item_count=0\n text= ' W/COUPON'\n coupon_tot = 0\n\n cart.each do |item|\n coupons.each do |coupon|\n if(item[:item] == coupon[:item] && item[:count] / coupon[:num] >=1)\n original_item_count = item[:count]\n coupuon_tot = (item[:count] / coupon[:num]).floor\n item[:count] = item[:count] - (((item[:count] / coupon[:num]).floor) * coupon[:num])\n copy_item = item.clone\n copy_item[:count] = original_item_count - item[:count]\n copy_item[:item] = copy_item[:item] + text\n copy_item[:price] = coupon[:cost] / coupon[:num]\n cart.push(copy_item)\n end\n end \n end \n cart\nend",
"def multiply(nb1,nb2)\n\treturn nb1*nb2\nend",
"def multiply\n inject(1) { |p,x| p * x }\n end",
"def buy_fruit2(array)\n array.map {|fruit, quantity| [fruit] * quantity}.flatten\nend",
"def multiplication(tab)\n mini = 1\n maxi = 1\n for i in 0..tab.length-1\n if tab[i].is_a?(IntVar)\n mini*=tab[i].domain.first\n maxi*=tab[i].domain.last\n elsif tab[i].is_a?(Integer)\n mini*= tab[i]\n maxi*= tab[i]\n tab[i] = IntVarStat.new(\"DuMmyINT\"+tab[i].to_s,[tab[i]],self)\n end\n end\n var_returned = civ(\"MultDuMmy\"+@dummyNameNb.to_s,mini,maxi)\n var_returned.depend=true\n @dummyNameNb+=1\n var_in_const = civ(\"MultDuMmy\"+@dummyNameNb.to_s,mini,maxi)\n @dummyNameNb+=1\n post(eq(var_returned,var_in_const))\n \n post(ContrainteMul.new([var_in_const]+tab))\n \n return var_returned\n \n end",
"def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend",
"def multiply(input_number)\n $number *= input_number\n return $number\nend",
"def multiplica2(array1, array2)\n if array1.length == array2.length\n array1.each_index do |i|\n array1[i] = (array1[i] * array2[i])\n end\n puts array1\n end\nend",
"def multiply(a, b)\nend",
"def custom_multiply(array, number)\n # Return a new array with the array that's passed in\n # as an argument multiplied by the number argument\n result = []\n number.times { array.each { |elem| result << elem } }\n result\nend",
"def buy_fruit(list)\n list.map { |fruit, quantity| [fruit] * quantity }.flatten\nend",
"def buy_fruit(list)\n list.map { |fruit, quantity| [fruit] * quantity }.flatten\nend",
"def buy_fruit(list)\n list.map { |fruit, quantity| [fruit] * quantity }.flatten\nend",
"def multiply(array)\n array.inject(:*)\nend",
"def multiplication(num, xtimes)\n\tnew_num = 0\n\txtimes.times do\n\t\tnew_num += num\n\tend\n\tnew_num\nend",
"def multiply!(m)\n super().flip!\n end",
"def multiply(*input)\n\t\tinput.flatten.inject(:*)\n\tend",
"def multiply_num(arr) # The round brakets gives the starting value\n arr.inject(1) do |quot, num| #quot survive, num gets multiplied on\n quot * num\n end\nend",
"def multiply_els(array)\n\tarray.inject(1) { |num, item| num * item }\n\nend",
"def multiply(a, b)\n\ta * b\nend",
"def multiply!(numbers, multiplier)\n counter = 0\n\n loop do\n break if counter == numbers.size\n \n numbers[counter] *= multiplier\n\n counter += 1\n end\n\n numbers\nend",
"def multiply_list(array_1, array_2)\n result = []\n array_1.size.times do |index|\n result << array_1[index] * array_2[index]\n end\n result\nend",
"def multiply (a b)\r\n a * b\r\nend",
"def buy_fruit(list)\n quantities = []\n list.each { |item| item[1].times { quantities << item[0] } }\n quantities\nend",
"def multiply_els(array)\n array.my_inject { |item, next_item| item * next_item }\nend",
"def multiplyArray (a)\n if (a.size == 0)\n return 1\n end\n\n total = 1\n\n return a.reject(&:zero?).inject(:*) # rejecting zero prevents the product from becoming zero\nend",
"def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end",
"def buy_fruit2(arr)\n arr.map { |fruit, quantity| [fruit] * quantity }.flatten\nend",
"def product_machine(array_input)\nindex = 0\nproduct = 1\nnumber_of_loops = array_input.length\n\nnumber_of_loops.times do\n product = product * array_input[index]\n index = index + 1\nend\noutput = product\nreturn output\nend",
"def same_free(_, product_price, &how_many_same)\n pairs = how_many_same.call(quantity * 2)\n pairs * product_price\n end",
"def output(prefix_products, suffix_products, nums)\n result = []\n\n nums.count.times do |index|\n result << if index == 0\n suffix_products[index + 1]\n elsif index == nums.count - 1\n prefix_products[index - 1]\n else\n (prefix_products[index - 1] * suffix_products[index + 1])\n end\n end\n\n result\nend",
"def test_multiply\n @eval.load_stacks([5, 5, '*'])\n assert_equal 25, @eval.quick_maffs_a('*')\n end",
"def multiply(array, num_two)\n array * num_two\nend",
"def item_effect_element_correction(recover_hp, recover_sp, item)\r\n # Element correction\r\n recover_hp *= elements_correct(item.element_set)\r\n recover_hp /= 100\r\n recover_sp *= elements_correct(item.element_set)\r\n recover_sp /= 100\r\n return recover_hp, recover_sp\r\n end",
"def multiply_sum_by_3rd_argument\n\n end",
"def multiply(a, b)\r\n a * b\r\nend",
"def multiply(a, b)\r\n a * b\r\nend",
"def multiply(a, b)\r\n a * b\r\n end",
"def Multiply(x)\n (x * 3)\nend",
"def multiply_list(arr1, arr2)\n new_arr = []\n arr1.size.times do |ind|\n new_arr << arr1[ind] * arr2[ind]\n end\n new_arr\nend",
"def multiply_list(arr1, arr2)\r\nresult = []\r\ncounter = 0\r\n\r\narr1.length.times do |num|\r\n result << arr1[counter] * arr2[counter]\r\n counter += 1\r\nend\r\np result\r\nend",
"def multiply(a,b)\n\treturn a * b\nend",
"def multiplier(grid,r,c,dir)\n '''\n grid = array of arrays >> 20 arrays, 20 elements each, 400 element grid\n r, c = integers representing row and column indecies 0 <= r,c < 20\n dir = string for direction on the grid to travel to gather terms for product\n '''\n first_term = grid[r][c]\n\n case dir\n\n when \"U\"\n return (first_term * grid[r-1][c] * grid[r-2][c] * grid[r-3][c])\n when \"UR\"\n return (first_term * grid[r-1][c+1] * grid[r-2][c+2] * grid[r-3][c+3])\n when \"R\"\n return (first_term * grid[r][c+1] * grid[r][c+2] * grid[r][c+3])\n when \"DR\"\n return (first_term * grid[r+1][c+1] * grid[r+2][c+2] * grid[r+3][c+3])\n when \"D\"\n return (first_term * grid[r+1][c] * grid[r+2][c] * grid[r+3][c])\n when \"DL\"\n return (first_term * grid[r+1][c-1] * grid[r+2][c-2] * grid[r+3][c-3])\n when \"L\"\n return (first_term * grid[r][c-1] * grid[r][c-2] * grid[r][c-3])\n when \"UL\"\n return (first_term * grid[r-1][c-1] * grid[r-2][c-1] * grid[r-3][c-1])\n\n end\n\nend",
"def multiply_els(elements)\n elements.my_inject(:*)\nend",
"def multiply_list(array1, array2)\n results = []\n n = 0\n\n array1.size.times do |num|\n results << array1[n]*array2[n]\n n += 1\n end\n\n results\nend",
"def multiply(one, two)\n\t\"#{one} multiplied by #{two} equals #{one * two}\" \nend",
"def multiply_machine(number_1, number_2, number_3)\n output = number_1 * number_2 * number_3\n return output\nend",
"def multiply (one, two) \n \"#{one} multiplied by #{two} equals #{one * two}\" \nend",
"def multiply (one, two) \n \"#{one} multiplied by #{two} equals #{one * two}\" \nend",
"def multiply_list(array1, array2)\n product_array = []\n i = 0\n loop do\n break unless array1[i]\n productarray << array1[i] * array2[i]\n i += 1\n end\n product_array\nend",
"def product(numbers)\n result = 1\n numbers.each do |number|\n result *= number\n end\n result\nend",
"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 mul(a, b)\n res = []\n res << a[0]*b[0] + a[1]*b[2]\n res << a[0]*b[1] + a[1]*b[3]\n res << a[2]*b[0] + a[3]*b[2]\n res << a[2]*b[1] + a[3]*b[3]\n res\nend",
"def serving_size_calc(item_to_make, order_quantity)#two arguments , item to make order quantity \n library = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}# creating a hash called library, \n #the item to make it's the key and the qty the problem\n error_counter = 3#define a variable cable and set it equal to three.\n\n library.each do |food| #iterating over the hash library \n\n if library[food] != library[item_to_make] #printing error counter - 1\n#we are checking if the library is not equal to the value .\n preturn error_counter += -1 #printing error counter - 1\n end\n end\n\n if error_counter > 0#if error counter is greater than 0 we raise the argument\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n\n \n \n\n serving_size = library.values_at(item_to_make)[0]#set a variable called serving size\n #equal to library.values at to get the values , and get item and index\n serving_size_mod = order_quantity % serving_size#it sets a variable and set it equal to order quantity remainder of serving size.\n\n# case serving_size_mod\n# when 0\n if serving_size_mod == 0#if serving size is equal to 0 then return the calculations complete\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}\"\n else\n return \"Calculations complete: Make #{order_quantity/serving_size} of #{item_to_make}, you have #{serving_size_mod} leftover ingredients. Suggested baking items: #TODO: MAKE THIS FEATURE\"\n end\nend",
"def multiply_list(array1, array2)\n new_array = []\n array1.count.times do \n new_array << (array1.pop) * (array2.pop)\n end\n new_array.reverse\nend",
"def multiply(number_one, number_two)\nnumber_one * number_two\nend",
"def buy_fruit(groceries)\n things_to_buy = []\n groceries.each do |items|\n items[1].times { things_to_buy << items[0] }\n end\n things_to_buy \nend",
"def update_quantity_of_item(list,item,quantity)\r\n add_item_to_list(list,item,quantity)\r\n list\r\nend",
"def multiply(one, two)\n \"#{one} mulpilied by #{two} equals #{one * two}\"\nend",
"def multiply(first, second)\n first * second\nend",
"def multiply (a,b)\n return a*b\nend",
"def multiply (a,b)\n a * b\nend",
"def multiply(*nums)\n return nums.reduce(:*)\nend",
"def buy_fruit(list)\n list.map { |sub_arr| [sub_arr[0]] * sub_arr[1] }.flatten\nend",
"def multiply(m)\n t = super(m)\n t.flip!\n end",
"def multiply(arr)\n\tans=1\n\tarr.each{|i|ans=ans*i}\n\treturn ans\nend",
"def update_quantity(grocery,item_name,new_quantity)\n # input:list, item name, and new_quantity\n # steps: change old value of item_name with the new_quantity\n grocery[item_name] = new_quantity\n # output: display the latest list\n display_list(grocery)\nend",
"def my_function4(arr)\n products_arr = []\n products_so_far = 1\n i = 0\n while i < arr.length\n products_arr[i] = products_so_far\n products_so_far *= arr[i]\n i += 1\n end\n\n products_so_far = 1\n i = arr.length - 1\n while i >= 0\n products_arr[i] *= products_so_far\n products_so_far *= arr[i]\n i -= 1\n end\n\n return \"Products: #{products_arr}\"\nend",
"def build_prefix_products(nums)\n prefix_products = []\n\n nums.each do |num|\n prefix_products << if prefix_products.count > 0\n prefix_products.last * num\n else\n num\n end\n end\n\n prefix_products\nend",
"def multiply(a, b)\n\t\treturn a*b\n\tend",
"def product(numbers)\n product = 1;\n numbers.each do |x|\n product = product * x;\n end\n product\nend",
"def mult(*args)\n\tprod = 1\n\targs.each do |arg|\n\t\tprod *= arg\n\tend\n\tprod\nend",
"def multiply(a b)\n a * b\nend",
"def buy_fruit(list)\n expanded_list = []\n list = list.flatten\n i = 0\n while i < list.size\n expanded_list << [list[i]] * list[i + 1]\n i += 2\n end\n expanded_list.flatten\nend",
"def update_quan(older_list, item, quantity)\r\n older_list[item] = quantity\r\n return older_list \r\nend",
"def fix_machine(debris, product)\n ### WRITE YOUR CODE HERE ###\n #new variable is old variable asking for something in this case size\n counter1 = product.size\n\n# then use the new variable asking something about the original input variable\n for i in (0...counter1)\n letter_checker = product[i]\n if !debris.index(letter_checker)\n return \"Give me something that's not useless next time.\"\n end\n end\n return product\nend",
"def buy_fruit(ary)\n ary.map { |fruit, quantity| [fruit] * quantity }.flatten\nend",
"def multiply(number_1, number_2)\n number_1 * number_2\nend",
"def multiply(number_1, number_2)\n number_1 * number_2\nend",
"def *(multiplier)\n return map {|currency, money| money * multiplier}\n end",
"def serving_size_calc(item_to_make, order_quantity)\n #Defining a list of items we can bake\n menu = {\"cookie\" => 1, \"cake\" => 5, \"pie\" => 7}\n #Checks to see if the item to make is in our library\n=begin\n error_counter = 3\n\n library.each do |food|\n if library[food] != library[item_to_make]\n p error_counter += -1 \n end\n end\n\n if error_counter > 0\n raise ArgumentError.new(\"#{item_to_make} is not a valid input\")\n end\n=end\n unless menu.has_key?(item_to_make)\n raise ArgumentError.new (\"#{item_to_make} is not available\")\n end\n #Check to see if there are leftovers\n=begin\n serving_size = library.values_at(item_to_make)[0]\n serving_size_mod = order_quantity % serving_size\n=end\n serving_size = menu[item_to_make]\n leftovers = order_quantity % serving_size\n \n #Determines what else could be baked to so that there is no waste\n=begin\n if leftovers >= 5\n if leftovers % 5 == 0\n suggested_baking_item = \"A cake.\"\n else suggested_baking_item = \"A cake and #{leftovers - 5} cookies.\"\n end\n else suggested_baking_item = \"#{leftovers} cookies.\"\n end\n=end\n if leftovers < 5\n suggested_baking_item = \"#{leftovers} cookies\"\n elsif leftovers == 5 \n suggested_baking_item = \"A cake.\"\n else suggested_baking_item = \"A cake and a cookie.\"\n end\n #Determines how much to make of an item and whether there are leftovers\n if leftovers == 0\n \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}\"\n else\n \"Calculations complete: Make #{order_quantity/serving_size} #{item_to_make}, you have #{leftovers} leftover portion(s). Suggested alternative item(s): #{suggested_baking_item}\"\n end\nend",
"def multiply (a,b)\n a * b\nend",
"def multiply(a,b)\n a * b\nend",
"def multiply(a,b)\n a * b\nend",
"def new_quantity(list, item, qty)\n list[item] += qty\n p list\nend"
] |
[
"0.65178484",
"0.6494396",
"0.62481374",
"0.6236508",
"0.62247133",
"0.6130931",
"0.61269057",
"0.60916394",
"0.60824734",
"0.6077863",
"0.60608226",
"0.60437316",
"0.6039011",
"0.60229564",
"0.6014245",
"0.5979744",
"0.5973772",
"0.5969177",
"0.5951408",
"0.5922475",
"0.5903757",
"0.59032416",
"0.5889378",
"0.5888464",
"0.5884627",
"0.5882596",
"0.58588064",
"0.58588064",
"0.58588064",
"0.5854444",
"0.5843134",
"0.58396685",
"0.5834615",
"0.5832588",
"0.58302057",
"0.582476",
"0.5811752",
"0.5800051",
"0.57960826",
"0.5794025",
"0.5793796",
"0.57918113",
"0.5791067",
"0.5790915",
"0.5777599",
"0.577589",
"0.57749873",
"0.57741535",
"0.57720214",
"0.5766909",
"0.5764843",
"0.57538265",
"0.57538265",
"0.5752178",
"0.5748033",
"0.57474416",
"0.5744558",
"0.5741207",
"0.57373655",
"0.57371444",
"0.57363296",
"0.57343495",
"0.5730043",
"0.5728783",
"0.5728783",
"0.5722797",
"0.57207745",
"0.5719328",
"0.57139033",
"0.5711581",
"0.57108706",
"0.57088506",
"0.57016665",
"0.5701359",
"0.57003075",
"0.5698113",
"0.56947947",
"0.56946564",
"0.5692538",
"0.569043",
"0.56891125",
"0.5682331",
"0.56796354",
"0.5678973",
"0.5677403",
"0.56769884",
"0.5667479",
"0.56672144",
"0.5665734",
"0.5662393",
"0.56622493",
"0.5657994",
"0.56557596",
"0.56552017",
"0.56552017",
"0.56540614",
"0.56528133",
"0.5651457",
"0.5651432",
"0.5651432",
"0.56496346"
] |
0.0
|
-1
|
GENERATE A UNIQUE URL FOR GIVEN WEB ADDRESS BEFORE SAVING INTO DATABASE
|
def generate_short_url
url = ([*('a'..'z'),*('0'..'9')]).sample(UNIQUE_ID_LENGTH).join
old_url = ShortenedUrl.where(short_url: url).last
if old_url.present?
self.generate_short_url
else
self.short_url = url
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_url_name\n self.url_name ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end",
"def generate_url_name\n self.url_name ||=\n Base32.encode(SecureRandom.random_bytes(16)).downcase.sub(/=*$/, '')\n end",
"def generate_unique_key\n\n # @TODO:need to update the algo. Right now it's very simple algo\n length = self.url.length\n rand(36**length).to_s(36)\n end",
"def generate_short_url\n short_url = SecureRandom.urlsafe_base64[0..6]\n short_url\n end",
"def generate_short_url\n return if self.short_url.present?\n self.short_url = SecureRandom.hex(2)\n end",
"def get_new_url\n self.update_attributes(url: \"#{(0...50).map{ ('a'..'z').to_a[rand(26)] }.join}\")\n end",
"def url_hash\n SecureRandom.hex[0..7]\n end",
"def generate_8_character_unique_url\n loop do\n random_short_path = SecureRandom.base64(12).gsub('+', '').gsub('/', '').gsub('=', '')[0..7]\n return random_short_path if (random_short_path.length == 8) && Url.where(short_path: random_short_path).count.zero?\n end\n end",
"def generate_domain\n \"random#{Time.now.hash % 1000000}.com\"\nend",
"def fake_url\n protocol = rand(10) > 8 ? \"http\" : \"https\"\n domain = (rand(3)+2).times.map{ rand(2 ** 12).to_s(32) }.join(\".\")\n path = words(rand(5)).join(\"/\")\n \n \"#{protocol}://#{domain}/#{path}\"\nend",
"def encode_url\n return (id.to_s + (1+rand(8)).to_s).reverse.to_i.base62_encode\n end",
"def shorten_url\n\t\t# generate 7 random numbers from 0-9 and a-z\n\t\tself.short_url = rand(36**7).to_s(36) # [0,6] # use this to ensure 7 characters\n\n\t\t# to include A-Z\n\t\t# require 'base62'\n\t\t# self.short_url = rand(36**7).base62_encode\n\n\t\t# self.short_url = SecureRandom.hex(10)\n\tend",
"def create_short_url\n rand_url = ('a'..'z').to_a.shuffle[0..5].join\n self.short_url = \"#{rand_url}\"\n end",
"def shorten\n\t\t# range_alpha = [*\"A\"..\"Z\",*\"a\"..\"z\"]\n\t\t# range_int = [*\"0\"..\"9\"]\n\t\t# short_url = (0...3).map{ range_alpha.sample }.join('') \n\t\t# short_url2 = (0...4).map{range_int.sample}.join('')\n\n\t\t# return short_url + short_url2\n\t\treturn SecureRandom.hex(3)\n\tend",
"def generate_short_url(base_url)\n build_shorten_url.update( uniq_id: shorten, expired_at: Time.now.utc + 1.year ) unless shorten_url\n shorten_url.link(base_url)\n end",
"def generated_url; end",
"def generate_short_url\n self.update_attribute :short_url, self.class.convert_to_base62(self.id)\n end",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.url = self.title.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\tend\t\n\tend",
"def generate_short_url\n new_short = \"/\" + Faker::Lorem.characters(7)\n until short_url_unique?(new_short)\n new_short = \"/\" + Faker::Lorem.characters(7)\n end\n self.short_url = new_short\n end",
"def set_random_url\n random_string = \"alkjsdhfglaquwhtjsnvaudshfg\"\n self.url = random_string.split(\"\").shuffle.join\n self.save\n end",
"def generate_short_url\n short_url = unique_url\n\n # check if this is a duplicate\n if ShortenUrl.where(short_url: short_url).exists?\n # try again\n generate_short_url\n else\n self.short_url = short_url\n end\n end",
"def generate_short_url\n # encode base 10 id as base 62 string as seen here https://gist.github.com/zumbojo/1073996\n i = id\n return Constants::ALPHABET[0] if i.zero?\n s = ''\n base = Constants::ALPHABET.length\n while i > 0\n s << Constants::ALPHABET[i.modulo(base)]\n i /= base\n end\n update_attributes(short_url: s.reverse)\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def shorten\n self.url_short = SecureRandom.hex(5)\n end",
"def generate_url\n\t\tself.url ||= name.parameterize\n\tend",
"def short_url_algorithm()\n \n unique_id_length = 3\n base64 = Base64.encode64(self.original_url)\n join_url = (base64.split('')).sample(unique_id_length).join()\n safe_url = join_url.gsub(\"+\", \"-\").gsub(\"/\",\"_\")\n \n loop do \n self.short_url = @@URL + safe_url\n \n if Url.find_by_short_url(self.short_url).nil?\n break\n else\n unique_id_length = unique_id_length + 1\n end\n \n end\n \n end",
"def generate_short_url(long_url)\n\t @shortcode = random_string 5\n\t \n\t su = ShortURL.first_or_create(\n\t { :url => long_url }, \n\t {\n\t :short_url => @shortcode,\n\t :created_at => Time.now,\n\t :updated_at => Time.now\n\t })\n\t \n\t @shortenedURL = get_site_url(su.short_url)\n\tend",
"def build_url(website)\n begin\n decoded_url = URI::decode(website)\n if decoded_url[/^https?/]\n url = decoded_url\n else\n url = \"http://#{decoded_url}\"\n end\n url\n rescue StandardError => e\n nil\n end\nend",
"def shorten\n\t\t self.short_url = SecureRandom.hex(3)\n\tend",
"def generate_short_url\r\n url = rand(36**8).to_s(36)\r\n\r\n # If generated token already exists, execute again\r\n if Shortcut.where(short_url: url).count > 0\r\n generate_short_url\r\n return\r\n end\r\n\r\n # Generated short url\r\n self.short_url = url\r\n end",
"def shorten\n\tself.short_url = SecureRandom.hex(3)\n\tend",
"def ensure_unique_url_for!(instance)\n instance.send :ensure_unique_url\n instance.save\n end",
"def gravatar_url\n \tstripped_email = email.strip\n \tdowncased_email = stripped_email.downcase\n \thash = Digest::MD5.hexdigest(downcased_email)\n\n \t\"http://www.gravatar.com/#{hash}\" \n end",
"def static_url(url); \"url('#{url}')\"; end",
"def new_random_url_code\n codes = MassEmail.all.map{|m|m.url_code}.map{|u|u.to_i}\n new_code = Random.rand(9999999)\n while codes.include?(new_code)\n new_code = Random.rand(9999999)\n end\n new_code.to_s.rjust(7, '0')\nend",
"def new_random_url_code\n codes = MassEmail.all.map{|m|m.url_code}.map{|u|u.to_i}\n new_code = Random.rand(9999999)\n while codes.include?(new_code)\n new_code = Random.rand(9999999)\n end\n new_code.to_s.rjust(7, '0')\nend",
"def create_url (type,permalink,page)\n\t\tbase_url = \"http://api.crunchbase.com/v/2/\"\n\t\tuser_key = \"2f9f86ebf459116f9b1a6e86f24ba34b\" # This's Isabel's key\n\t\tuser_key2 = \"411490520ad9db1b432e77f1a25735a8\" # This's David's Key\n\t\tif permalink == \"\" then\n\t\t\tif @random_key == 1\n\t\t\t\turl = \"#{base_url}#{type}?page=#{page}&user_key=#{user_key}\"\n\t\t\t\t@random_key = 2\n\t\t\telsif @random_key == 2\n\t\t\t\turl = \"#{base_url}#{type}?page=#{page}&user_key=#{user_key2}\"\n\t\t\t\t@random_key = 1\n\t\t\tend\n\t\telse\n\t\t\tif @random_key == 1\n\t\t\t\turl = \"#{base_url}#{type}/#{permalink}?page=#{page}&user_key=#{user_key}\"\n\t\t\t\t@random_key = 2\n\t\t\telsif @random_key == 2\n\t\t\t\turl = \"#{base_url}#{type}/#{permalink}?page=#{page}&user_key=#{user_key2}\"\n\t\t\t\t@random_key = 1\n\t\t\tend\n\t\tend \n\t\treturn url \n\tend",
"def url\n Faker::Internet.url\n end",
"def url\n Faker::Internet.url\n end",
"def convert\n\t\treturn rand(36**Rails.application.config.shorten_url_length).to_s(36)\n\tend",
"def generate_web_id\n proposed_id = nil\n while true\n proposed_id = (36 ** (WEB_ID_LENGTH - 1) +\n rand(36 ** WEB_ID_LENGTH - 36 ** (WEB_ID_LENGTH - 1))).to_s(36)\n break unless Datafile.find_by_web_id(proposed_id)\n end\n proposed_id\n end",
"def converted_url\n #Rails.application.routes.url_helpers.root_url\n \"http://localhost:3000/#{hash_code}\"\n end",
"def create_shortened_url\n key = self.id - 1\n\n if key == 0\n shortened = ALPHABET[0]\n else\n shortened = ''\n baseLength = ALPHABET.length\n\n until key < 1\n place = key % baseLength\n shortened += ALPHABET[place]\n\n key /= baseLength\n end\n end\n self.shortened = shortened\n self.save\n end",
"def generate_short_url\n url = Process.clock_gettime(Process::CLOCK_REALTIME, :nanosecond).to_s(36)\n old_url = Link.where(short_url: url).last\n if old_url.present? \n self.generate_short_url\n else\n self.short_url = url\n end\n end",
"def generate_short_url\n random_chars = ['0'..'9','A'..'Z','a'..'z'].map{|range| range.to_a}.flatten\n self.assign_attributes(short_url: 6.times.map{ random_chars.sample }.join.prepend(\"http://\")) until self.short_url.present? && Link.find_by_short_url(short_url).nil?\n end",
"def generate_host\n uri = Addressable::URI.parse(self.url)\n self.site = uri.site\n self.domain_tld = [uri.domain,uri.tld].join('.')\n end",
"def generate_web_id\n proposed_id = nil\n while true\n proposed_id = (36 ** (WEB_ID_LENGTH - 1) +\n rand(36 ** WEB_ID_LENGTH - 36 ** (WEB_ID_LENGTH - 1))).to_s(36)\n break unless Datafile.find_by_web_id(proposed_id) || Recordfile.find_by_web_id(proposed_id)\n end\n proposed_id\n end",
"def generate_short_url(url_id)\n # Base62 alphabet to be used\n alphabet_array = [*'a'..'z', *'A'..'Z', *'0'..'9']\n shorturl = []\n while url_id.to_i.positive?\n shorturl.push(alphabet_array[url_id % 62])\n url_id /= 62\n end\n new_url = shorturl.reverse.join\n\n # Check short_url doesn't exist in the database. If short_url exists, we generate a new url\n url_exist = UrlShortener.find_by_short_url(new_url)\n return new_url if url_exist.blank?\n\n generate_short_url(url_id)\n end",
"def build_url(path, extension, length=20)\n url = (path == nil) ? '/'+rand(36**length).to_s(36) : path\n url += (extension == nil) ? '' : '.'+extension\n url\n end",
"def url_id\n Digest::MD5.hexdigest(url)\n end",
"def generate_web_id\n proposed_id = nil\n loop do\n proposed_id = (36**(WEB_ID_LENGTH - 1) +\n rand(36**WEB_ID_LENGTH - 36**(WEB_ID_LENGTH - 1))).to_s(36)\n break unless Datafile.find_by(web_id: proposed_id)\n end\n proposed_id\n end",
"def generate_url(template); end",
"def create_url\n #we trim away all periods and break apart the name by spaces to use to acquire the url of the poet in the Poetry Foundation website\n name_no_periods = @name.tr(\".\", \"\")\n name_no_periods = name_no_periods.split(\" \")\n\n #we use name_no_periods to generate the url for the poet (example url: \"https://www.poetryfoundation.org/poets/ben-jonson\")\n url = \"https://www.poetryfoundation.org/poets/\"\n name_no_periods.each { |part| url = \"#{url}#{part}-\"}\n\n #this leaves an extra hyphen at the end, but we can just cut that off in the return.\n url = url.chop\n end",
"def create_short_url(url_params) \n url = Url.new(url_params)\n url.suffix= url.create_suffix(url_params[:longurl],0)\n while url.unique(url.suffix) == false\n url.suffix = url.create_suffix(url_params[:longurl],1)\n end\n domain = Domainatrix.parse(url_params[:longurl]).domain + '.' + Domainatrix.parse(url_params[:longurl]).public_suffix\n short_domain = ShortDomain.where(domain: domain).first[:prefix]\n url.shorturl = \"http://\" + short_domain +'/'+ url.suffix\n if url.save\n return url\n else\n return nil\n end\n end",
"def url_set\n @randomstring = SecureRandom.hex(5)\n if User.where('unique_url = ?', @randomstring).blank?\n params[:user][:unique_url] = @randomstring\n else\n url_set\n end\n end",
"def generate_slug\n count = 0\n begin\n o = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n string = (0...6).map { o[rand(o.length)] }.join\n self.slug = string\n self._slug = self.slug\n self._slug = self._slug.gsub('0', 'O')\n self._slug = self._slug.gsub('o', 'O')\n self._slug = self._slug.gsub('1', 'I')\n self._slug = self._slug.gsub('i', 'I')\n self._slug = self._slug.gsub('l', 'I')\n self._slug = self._slug.chars.sort.join\n self.save\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid => err\n if (count += 1) < 50\n retry\n else\n raise\n end\n end\n end",
"def shorter_url\n\t\tself.short_url = SecureRandom.base64(10)\n\tend",
"def generate_web_id\n proposed_id = nil\n while true\n proposed_id = (36 ** (WEB_ID_LENGTH - 1) +\n rand(36 ** WEB_ID_LENGTH - 36 ** (WEB_ID_LENGTH - 1))).to_s(36)\n break unless ::Item.find_by_web_id(proposed_id)\n end\n proposed_id\n end",
"def hash_url(url)\n Digest::SHA1.hexdigest \"#{@profile_id}-#{url}\"\n end",
"def generate_unique_key\n # not doing uppercase as url is case insensitive\n charset = ::Shortener.key_chars\n (0...::Shortener.unique_key_length).map{ charset[rand(charset.size)] }.join\n end",
"def generate_url_token\n begin\n self.url_token = SecureRandom.urlsafe_base64(8)\n end while Presentation.exists?(:url_token => self.url_token) \n end",
"def gen_url url, text\n scheme, url, = parse_url url\n\n \"[#{text.sub(%r{^#{scheme}:/*}i, '')}](#{url})\"\n end",
"def create_unique_key\n begin\n self.unique_key = UrlShort.generate_key\n rescue ActiveRecord::RecordNotUnique\n if (count +=1) < 5\n retry\n else\n raise\n end\n end\n end",
"def url_create(state_code, city_name)\n 'http://en.m.wikipedia.org/wiki/' + self.url_suffix_create(state_code, city_name)\n end",
"def create_legacy_url\n legacy_urls.find_or_create_by(urlname: urlname_before_last_save)\n end",
"def make_url(string)\n puts \"not implemented\"\nend",
"def create_gravatar_url\n\t\t\"http://www.gravatar.com/avatar/#{md5_hash_email(self.email)}?r=g&s=200&d=retro\"\n\tend",
"def url_shortener(full_uri)\n mapper = UrlMapper.find_by_original_url(full_uri)\n \n if mapper\n string = mapper.short_url\n else\n string = \"/\"\n 5.times { string << (i = Kernel.rand(62); i += ((i < 10) ? 48 : ((i < 36) ? 55 : 61 ))).chr }\n begin\n UrlMapper.create!({:short_url => string, :original_url => full_uri})\n rescue\n end\n end\n \"#{APP_CONFIG['url_shortener']}#{string}\"\n end",
"def create(clean_url)\n key = generate_unique_key\n @@urls[key] = clean_url\n key\n end",
"def create_url\n\t\tif self.url.blank?\n\t\t\tself.dev_stage.blank? ? dev_stage_string = \"\" : dev_stage_string = \"-\" + self.dev_stage + \"-\"\n\t\t\tcomponent_string = self.component.downcase.gsub(/[^a-zA-Z0-9]+/, \"-\").chomp(\"-\")\n\t\t\tversion_string = self.maj_version.to_s + \"-\" + self.min_version.to_s\n\t\t\tself.url = component_string + dev_stage_string + version_string\n\t\tend\n\tend",
"def shorturl\n return nil if self.new_record?\n return self.surl unless self.surl.nil?\n\n self.surl = encode_url\n\n self.save\n return surl\n end",
"def shorten_url\n if @url.save\n headers 'Location' => url(@url.path)\n halt 201, \"Created #{url(@url.path)}\"\n else\n halt 406, \"#{@url.errors.full_messages.join(\".\\n\")}\"\n end\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end",
"def elastics_id\n Digest::MD5.hexdigest url\n end",
"def formatted_website_url\n first_url = self.webaddr.is_a?(Array) ? self.webaddr.first : self.webaddr\n Addressable::URI.heuristic_parse(first_url).to_s\n end",
"def website_url; website end",
"def add_http_to_url\n if !self.website_url.blank?\n unless self.website_url[/\\Ahttp:\\/\\//] || self.website_url[/\\Ahttps:\\/\\//]\n self.website_url = \"http://#{self.website_url}\"\n end\n end\n end",
"def generate_and_add_slug\n if self.slug.nil? || self.slug.empty?\n self.slug = SecureRandom.hex 16\n end\n self\n end",
"def shorten\n\t\n\t\tself.short_url = SecureRandom.urlsafe_base64(4)\n\tend",
"def _url\n URI.join(domain, path_gen.for_uri)\n end",
"def facebook_url; \"https://facebook.com/#{facebook}\" end",
"def create\n @url = Url.new(url_params)\n\n Url.transaction do\n @url.save\n #write base 62 method\n @url.short_url = generate_base62_short_url(@url.id)\n if @url.save\n render json: @url, status: :created, root: :url\n else\n render json: @url.errors, status: :unprocessable_entity\n end\n end\n end",
"def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend",
"def generate_short_url(clash_count=0)\n raise \"Too many short URL clashes. Please increase the short url length\" if clash_count == 10\n url = self.sanitize_url\n shortened_url = Digest::MD5.hexdigest(url)[(0+clash_count)..(SHORT_URL_LENGTH+clash_count)]\n url_present = Url.find_by_short_url(shortened_url)\n if(url_present)\n generate_short_url(clash_count+1)\n else\n self.short_url = shortened_url\n end\n end",
"def build_url(host)\n host.protocol + host.url\n end",
"def twitter_url; \"https://twitter.com/#{twitter}\" end",
"def easy\n url = params[:url]\n\n # Well, this would be super slow for mainstream processors, but\n # might be good enough for Mom's & Dad's shop\n link = Link.find_by_url(url)\n\n # Oops, we don't have this Url in tables yet\n if link.nil?\n link = Link.new\n link.url = url\n link.save\n end\n\n render :text => SHORT_URL + \"/\" + Base32::Crockford.encode(link.id)\n end",
"def shorten_link\n # http://stackoverflow.com/questions/88311/how-best-to-generate-a-random-string-in-ruby\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n string = (0...6).map { o[rand(o.length)] }.join\n self.short_url = \"http://www.sho.rt/#{string}\"\n end",
"def build_url(url_suffix)\n return @base_url+url_suffix\nend",
"def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end",
"def generate_slug\n\t# Count the optimal slug length to start\n\tlinks_count = Link.count \n\tlength = 1\n\tcombinations = (1..49).inject(:*)/(1..49-length).inject(:*)\n\twhile combinations < links_count\n\t\tlength +=1\n\t\tcombinations = (1..49).inject(:*)/(1..49-length).inject(:*)\n\tend\n\n\t# Pick a random_id for slug \n\t# If slug is not unique: try 5 times to find another combination, after that - try a bigger length\n\tself.slug = random_id(length)\n\tuntil self.valid?\n\t\t5.times do \n\t\t\tself.slug = random_id(length)\n\t\t\tbreak if self.valid?\n\t\tend\n\t\tlength += 1 \n\tend\n\n\t#self.slug = \"D\"\n\tsave!\nend",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/[0-9]{6,12}/).last\n end",
"def to_url\n return if nil?\n\n s = downcase.tr(\"\\\"'\", \"\")\n s = s.gsub(/\\P{Word}/, \" \")\n s.strip.tr_s(\" \", \"-\").tr(\" \", \"-\").sub(/^$/, \"-\")\n end",
"def generate_url(url, params = {})\n uri = URI(url)\n\n res = \"#{uri.scheme}://#{uri.host}\"\n res += \":#{uri.port}\" if (uri.port and uri.port != 80 and uri.port != 443)\n res += \"#{uri.path}\" if uri.path\n res += \"#{uri.fragment}\" if uri.fragment\n res += \"?#{params.to_query}\"\n\n return res\n end",
"def generate_tracking_url\n self.tracking_url ||=\n courier.generate_tracking_url(\n consignment: consignment_number,\n postcode: postcode,\n order_number: order_number\n )\n end",
"def build_as_url\n URI(build_as_string)\n rescue Urb::InvalidUrl => e\n URI('/')\n end",
"def guid_from_url\n # get the last large number from the url, if there is one\n url.to_s.scan(/https:\\/\\/firstlook.org\\/theintercept\\/[0-9]{4}\\/[0-9]{2}\\/[0-9]{2}\\/[a-z0-9-]+/).last\n end",
"def website_url\n Organization.clean_url(read_attribute(:website_url))\n end",
"def generate_link\n 'autologin/'+code\n end",
"def cacheable_url\n ret = self[:url]\n ret = [ret, self.timestamp].join('?') if target.config[:timestamp_urls]\n ret = SC.attach_prefix(ret)\n if target.config[:hyper_domaining]\n ret = [self.hyperdomain_prefix(ret), ret].join('')\n end\n return ret\n end"
] |
[
"0.74512017",
"0.74512017",
"0.706487",
"0.70526636",
"0.6978883",
"0.6952801",
"0.6898779",
"0.6846092",
"0.683331",
"0.68292123",
"0.67476964",
"0.6738983",
"0.6736827",
"0.6705547",
"0.66989446",
"0.66934663",
"0.6665449",
"0.66541463",
"0.66531956",
"0.6548055",
"0.65266293",
"0.6526056",
"0.6525512",
"0.6525512",
"0.6519971",
"0.6509341",
"0.6502157",
"0.64949435",
"0.6471141",
"0.64689595",
"0.6467886",
"0.645824",
"0.64531684",
"0.6437578",
"0.6418228",
"0.64176744",
"0.6415774",
"0.63993967",
"0.63993967",
"0.6396947",
"0.63805103",
"0.6356933",
"0.63417333",
"0.63326305",
"0.63277644",
"0.6327253",
"0.6326323",
"0.6325321",
"0.63220704",
"0.63219416",
"0.6287062",
"0.6268739",
"0.626453",
"0.6243919",
"0.62323886",
"0.62203896",
"0.6200544",
"0.6200402",
"0.6199224",
"0.6197815",
"0.6190628",
"0.618818",
"0.6176748",
"0.6162248",
"0.61611986",
"0.6156995",
"0.6154355",
"0.61540395",
"0.6137266",
"0.6135682",
"0.61318046",
"0.6131555",
"0.61247027",
"0.6120457",
"0.6119163",
"0.61152756",
"0.61069506",
"0.6105029",
"0.60744804",
"0.6070647",
"0.6065173",
"0.60637236",
"0.603458",
"0.60308516",
"0.60254663",
"0.6020712",
"0.60204935",
"0.6016499",
"0.60096353",
"0.6006629",
"0.60039675",
"0.5994946",
"0.598431",
"0.5983758",
"0.5963371",
"0.59423375",
"0.5929857",
"0.5929613",
"0.59167635",
"0.5914788"
] |
0.6829834
|
9
|
CHECK IF ANY URL URL EXIST BEFORE SAVING INTO DATABASE
|
def find_duplicate
ShortenedUrl.find_by_sanitize_url(self.sanitize_url)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def exists?(url)\n return @store.has_key?(sanitise(url))\n end",
"def url_exists?(url)\n doc = @db[LINKS_COLLECTION_NAME].find_one('_id' => hash_url(url))\n doc.nil? == false\n end",
"def is_unknown_url? url\n @urls.count_documents(url:url) == 0\n end",
"def url?(url_hash)\n @@db.client[:urls].find(url_hash).any?\n end",
"def url_exist?\n\t\tbegin\n\t\t\turi = URI.parse(valid_url?)\n\t\t\tresponse = Net::HTTP.get_response(uri)\n\t\trescue \n\t\t\terrors.add(:long_url,\"is invalid url\")\n\t\t\t# in AR, error is a class by itself already \n\t\t\t# go to static.rb to check the errors\n\t\tend\n\tend",
"def site_exists?\n if Site.exists?(url: url)\n update_attribute(:site_id,\n Site.find_by(url: url).id)\n else\n new_site = Site.create(url: url,\n feed_url: parse_feed_url)\n FetchSiteInformationJob.perform_now(new_site.id)\n FetchNewArticlesJob.perform_later(new_site.id)\n update_attribute(:site_id, new_site.id)\n end\n end",
"def invalid_url?(url)\n url.include? 'hurl.it'\n end",
"def has_website?\n !url.blank?\n end",
"def url_must_be_valid\n url.blank? ||\n (url_is_remote? and url_has_suffix? and url_matches?) ||\n errors.add(:url, :invalid)\n end",
"def validates_presence_of_urls\n if provider_media_id.blank?\n !( source_url.blank? || thumbnail_url.blank? || content_url.blank? )\n else\n true\n end\n end",
"def invalid?(save_name)\n save_name.include?(\"http\")\n end",
"def valid_url?\n !Sailpoint.config.url.blank?\n end",
"def i_have_seen_this_url_before?(url) \n @known_urls.include?(url.remove_fragment)\n end",
"def check_url_validation\n errors.add(:url, I18n.t('url_not_proper')) unless UrlShort.is_valid? (url)\n end",
"def check_submissions(url)\n url = url.downcase\n if url.include?(\"http://www.\")\n valid_url?(url) ? url : false\n elsif url.include?(\"www.\")\n valid_url?(url.insert(0,\"http://\")) ? url : false\n else\n valid_url?(url.insert(0,\"http://www.\")) ? url : false\n end\nend",
"def valid_feed_url?\n true if find_feed_locally(@url) || fetch_feed\n rescue StandardError\n false\n end",
"def url?(url)\n assert_type(url, String) # This includes Wgit::Url's.\n query = { url: url }\n retrieve(URLS_COLLECTION, query, limit: 1).any?\n end",
"def url_is_valid\n errors.add(:url, \"url is not valid\") unless is_http_url? || is_spotify_url?\n end",
"def url_filled?\n !url.blank?\n end",
"def add_url(url, shortcode)\n @db.execute \"INSERT INTO pairings VALUES('#{url}', '#{shortcode}')\"\n return true\n rescue SQLite3::Exception => e\n puts 'Unable to add url:'\n puts e\n return false\n end",
"def url_valid?\n ALLOWED_URLS.each do |host, url_allowed|\n if url.include? url_allowed\n @host = host\n return true\n end\n end\n false\n end",
"def add_valid_url(url, refs)\n @results[url] = 1\n end",
"def add_valid_url(url, refs)\n @results[url] = 1\n end",
"def url?\n !url.nil?\n end",
"def initialize_urls\n find(:all, :conditions => {self.url_attribute => nil}).each do |instance|\n instance.send :ensure_unique_url\n instance.save\n end\n end",
"def good_resource?(url)\n if rx_url\n !(url.to_s !~ rx_url)\n else\n true\n end\n end",
"def valid_url?\n # Not sure if we should make a change in the user initial data, we could just return as invalid.\n my_target_url = target_url.match(/http/) ? target_url : target_url.prepend(\"http://\")\n\n response = HTTParty.get(my_target_url) rescue nil\n\n return if response&.code == 200\n\n errors.add(:short_url)\n end",
"def initialize_urls\n find_each(:conditions => {acts_as_url_configuration.url_attribute => nil}) do |instance|\n instance.send :ensure_unique_url\n instance.save\n end\n end",
"def validate_uniqueness_of_new_image_url\n self.errors[:\"image.url\"] = 'Image url has already been added to this collection' if self.dup_image?\n end",
"def unique(suffix) \n check = Url.where(suffix: suffix).first\n if check == nil\n return true\n else\n return false\n end\n end",
"def check_if_link_is_valid\n uri = URI.parse(self.url.split(\" \")[0])\n self.url = uri\n if !%w( http https ).include?(uri.scheme)\n self.url = nil\n end\n end",
"def check_for_url(url)\n array = read_articles\n\n if array.any? {|article| article[\"url\"] == url}\n false\n else\n true\n end\nend",
"def create_shadow_if_needed\n if self.link_url.present?\n self.shadow = Shadow.special_find_or_create_by_web_url( self.link_url )\n if( self.shadow.errors.empty? )\n write_attribute(:shadow_id, self.shadow.id)\n return true\n else\n errors.add_to_base( self.shadow.errors.full_messages.to_sentence )\n return false\n end\n else\n errors.add(:link_url, \"can't be blank\" )\n return false \n end\n end",
"def link_is_existent?(url)\n \tbegin\n\t uri = URI.parse(url)\n \t http_conn = Net::HTTP.new(uri.host, uri.port)\n \t resp, data = http_conn.head(\"/\" , nil)\n \t puts \"=== RESPONSE CODE #{resp.code}\"\n \t resp.code != \"404\"\n \trescue URI::InvalidURIError, Errno::ECONNREFUSED, SocketError\n \t\tfalse\n \tend\n end",
"def validate_url\n self.url = ExternalWork.format_url(self.url)\n errors.add_to_base(t('invalid_url', :default => \"Not a valid URL\")) unless self.url_active?\n end",
"def all_valid?\n valid_url?\n end",
"def write_urls_to_db(urls)\n count = 0\n\n return count unless urls.respond_to?(:each)\n\n urls.each do |url|\n if url.invalid?\n Wgit.logger.info(\"Ignoring invalid external url: #{url}\")\n next\n end\n\n @db.insert(url)\n count += 1\n Wgit.logger.info(\"Inserted external url: #{url}\")\n rescue Mongo::Error::OperationFailure\n Wgit.logger.info(\"External url already exists: #{url}\")\n end\n\n count\n end",
"def write_urls_to_db(urls)\n count = 0\n\n return count unless urls.respond_to?(:each)\n\n urls.each do |url|\n if url.invalid?\n Wgit.logger.info(\"Ignoring invalid external url: #{url}\")\n next\n end\n\n @db.insert(url)\n count += 1\n\n Wgit.logger.info(\"Inserted external url: #{url}\")\n rescue Mongo::Error::OperationFailure\n Wgit.logger.info(\"External url already exists: #{url}\")\n end\n\n count\n end",
"def url?(url)\n assert_type(url, String) # This includes Wgit::Url's.\n hash = { 'url' => url }\n @client[:urls].find(hash).any?\n end",
"def include?(url)\n @urls.empty? || !!@urls.detect{ |u| u =~ url }\n end",
"def check_key_exist url_key\n @url_generators = UrlGenerator.all\n @url_generators.each do |url_generator|\n if url_generator.key == url_key\n return true\n end\n end\n return false\n end",
"def check_file(url, refs)\n if get_internal_file(url)\n add_valid_url(url, refs)\n elsif check_head(url) == false\n add_invalid_url(url, refs)\n else\n add_valid_url(url, refs)\n end\n end",
"def check_file(url, refs)\n if get_internal_file(url)\n add_valid_url(url, refs)\n elsif check_head(url) == false\n add_invalid_url(url, refs)\n else\n add_valid_url(url, refs)\n end\n end",
"def create\n @url = ShortenedUrl.new\n @url.original_url = params[:original_url]\n @url_actualy = @url.original_url\n @url_may_exist = ShortenedUrl.find_by_original_url(params[:original_url])\n if @url_may_exist.nil?\n if @url.save\n redirect_to shortened_path(@url.short_url)\n flash[:notice] = \"URL is added to list\"\n else\n flash[:error] = \"URL is not added to list\"\n render 'index'\n end\n else\n flash[:notice] = \"The link is exist already\"\n redirect_to shortened_path(@url_may_exist.short_url)\n end\n end",
"def valid_url\n unless UrlValidator.valid_entry_url? self.url\n errors.add :url, \"URL #{self.url} is not a valid http, https or protocol-relative URL\"\n end\n end",
"def acceptable_url? new_url\n if new_url.blank? || !(new_url = valid_url new_url, url)\n yield 'is not a valid url' if block_given?\n return false\n end\n\n standardized_url = PageRef.standardized_url new_url\n return false if standardized_url == url # Not an error, but redundant\n\n return true if alias_for?(new_url)\n\n if PageRef.where(url: standardized_url).exists? || Alias.find_by_url(new_url)\n # There's an existing alias--not one of ours--which constitutes a conflict: no good\n yield \"'#{standardized_url}' is already in use elsewhere.\" if block_given?\n false\n else\n true\n end\n end",
"def validate\n needs :http_url unless http_url\n end",
"def valid_link?(url)\n # GET or HEAD? Head is more friendly to the server, but some pages\n # May behave differently depending on HEAD or GET.\n HTTParty.head(url,\n verify: false, # don't verify ssl certs\n ).code == 200\n end",
"def facebook_url_exists?\n return false if facebook == \"\" || twitter == nil\n return true\n end",
"def existsCheck(permalink)\n temp = db.execute( \"SELECT 1 where exists(\n SELECT permalink\n FROM memes\n WHERE permalink = ?\n ) \", [permalink] ).any?\n\n exit if existsCheck(permalink) != 0\n\n end",
"def a_domain_we_care_about?(url)\n begin\n !@domains.select { |domain| URI.parse(url).host == domain.host }.empty?\n rescue\n !@domains.select { |domain| url.gsub(/https*:\\/\\//,'').starts_with?(domain.host) }.empty?\n end\n end",
"def check(url)\n if @allocations.has_key?(url)\n count = @allocations[url]['count']\n if count == -1\n return true\n end\n if count > 0 \n if (count - 1) == 0\n unbind(url)\n else\n @allocations[url]['count'] = count - 1\n end\n return true\n end\n end\n false\n end",
"def create_link_for(u)\r\n l = links.build(:url => u)\r\n if l.save\r\n @link_url = nil\r\n return true\r\n end\r\n \r\n errors.add(:link_url, \"#{u} is not a valid URL, or is not responding\") and return false\r\n end",
"def valid_feed?(item)\n !item['url'].to_s.strip.empty?\n end",
"def valid?\n (uri.host =~ LINK_REGEX || uri.host =~ LINK_IP_REGEX) ? true : false\n end",
"def domain_is_allowed?(url)\n true\n end",
"def domain_is_allowed?(url)\n true\n end",
"def validate_url_attribute(attribute)\n value = self.read_attribute(attribute)\n return true if value.blank?\n begin\n url = self.normalize_url!(value)\n self.write_attribute(attribute, url)\n return true\n rescue URI::InvalidURIError => e\n self.errors.add(attribute, 'is invalid')\n return false\n end\n end",
"def is_pic_url_dup?\n self.class.where(\"pic = ? and id != ?\", pic, id).count > 0\n end",
"def examine_url_name\n if self.id.nil?\n if RESERVED_PATH.include? self.url_name\n self.errors.add(:url_name,\"#{url_name} 是個保留字,請使用別的字\")\n end\n if self.type.constantize.pluck(\"url_name\").include? self.url_name\n self.errors.add(:url_name,\"#{url_name} 已經被其他頁面使用過了\")\n end\n else\n possible_dup_page = self.type.constantize.find_by_url_name(self.url_name)\n unless possible_dup_page.nil?\n unless self.type.constantize.find_by_url_name(self.url_name).id == self.id\n self.errors.add(:url_name,\"#{url_name} 已經被其他頁面使用過了\")\n end\n end\n end\n end",
"def valid_url?(url)\n begin\n Net::HTTP.get_response(URI(url)).code == \"200\" ? true : false\n rescue SocketError\n false\n end\nend",
"def check_site_index(url)\n site_match = Site.where(\"url like ?\", \"%#{url[/(http)s?:\\/\\/(?<uri>[\\w\\d\\.]+)/, \"uri\"]}%\")\n if site_match.size == 0\n @new_sites << url\n return nil\n end\n return site_match[0]\n end",
"def valid?\n Wgit::Url.valid?(self)\n end",
"def ensure_unique_url_for!(instance)\n instance.send :ensure_unique_url\n instance.save\n end",
"def file_exist?\n return FileTest.exist?(@fileurl)\n end",
"def index_url(url, insert_externals: false)\n document = @crawler.crawl_url(url) do |doc|\n result = block_given? ? yield(doc) : true\n write_doc_to_db(doc) if result && !doc.empty?\n end\n\n @db.upsert(url)\n\n ext_urls = document&.external_links\n if insert_externals && ext_urls\n num_inserted_urls = write_urls_to_db(ext_urls)\n Wgit.logger.info(\"Found and saved #{num_inserted_urls} external url(s)\")\n end\n\n nil\n end",
"def test_urls_clean\n\t\tres = DB.exec(\"UPDATE urls SET url='twitter.com/wonka' WHERE id=5 RETURNING url\")\n\t\tassert_equal 'http://twitter.com/wonka', res[0]['url']\n\t\tres = DB.exec(\"INSERT INTO urls(person_id, url) VALUES (5, '\thttps:// mybank.com\\r\\n') RETURNING url\")\n\t\tassert_equal 'https://mybank.com', res[0]['url']\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec(\"INSERT INTO urls(person_id, url) VALUES (5, '')\")\n\t\tend\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec(\"INSERT INTO urls(person_id, url) VALUES (5, 'x')\")\n\t\tend\n\t\terr = assert_raises PG::RaiseException do\n\t\t\tDB.exec(\"INSERT INTO urls(person_id, url) VALUES (5, 'me@aol.com')\")\n\t\tend\n\tend",
"def url_exist?(url_string)\n encoded_url = URI.encode(url_string)\n url = URI.parse(encoded_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = (url.scheme == 'https')\n path = url.path if url.path\n\n # these if statements are dodgy to me, needs better test and writing utilities for URIs\n if path[0] == nil\n path.prepend(\"/\")\n end\n\n if path == nil || req == nil\n return false\n end\n\n # the script breaks here if the resquest fails, hence the resuce\n begin\n res = req.request_head(path)\n rescue\n return false\n\n end\n\n if res.kind_of?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families\n end\n rescue Errno::ENOENT\n false #false if can't find the server\n end",
"def determine_new_links(all_urls)\n all_urls.select {|url| url_exists?(url) == false }\n end",
"def valid_download?\n @download_url != \"\"\n end",
"def uri_exists(url)\n\n u = URI(url)\n\n Net::HTTP.start(u.host, u.port) do |http|\n http.open_timeout = 1\n http.read_timeout = 1\n res = http.head(u.path)\n\n if res.code == \"200\"\n return true\n end\n return false\n end\n end",
"def test_readings_url_must_start_with_http_09\n r = Reading.create(url: \"http://www.boomboomroom.com\")\n assert r.url.include?(\"http\")\n s = Reading.new(url: \"zombo.com\")\n refute s.save\n end",
"def valid_url?(url)\n resp = Curl.get url\n\n if resp.body_str.include? @invalid_text\n return false\n else\n return true\n end\nend",
"def check_unique_shortcut?\n if (not new_record? and Node.where('nodes.shortcut = ? AND nodes.id != ?', shortcut, id).exists?) or (new_record? and Node.exists?(:shortcut => shortcut))\n puts \"Problem Node: (Title: #{title}, ID: #{id} URL: #{shortcut}), new_record: #{new_record?}\"\n addition = Node.where('shortcut LIKE ?', shortcut).count\n suggested = self.shortcut + \"_\" + addition.to_s\n errors.add(:shortcut, \"URL shortcut already exists in this site. Suggested Shortcut: '#{suggested}'\")\n end\n end",
"def off_site?(url)\n url !~ /^\\// # urls not starting with a /\n end",
"def persisted?\n href.present?\n end",
"def asset_exists?(url)\n page.execute_script <<~JS\n xhr = new XMLHttpRequest();\n xhr.open('GET', '#{url}', true);\n xhr.send();\n JS\n\n return false unless wait(interval: 0.5, max: 60, reload: false) do\n page.evaluate_script('xhr.readyState == XMLHttpRequest.DONE')\n end\n\n page.evaluate_script('xhr.status') == 200\n end",
"def accept_url url\n accept_attribute :url, self.class.standardized_url(url) if url.present? && acceptable_url?(url)\n # self.write_attribute :url, url\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def url_exists?(github_url)\n url = URI.parse(github_url)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n res = req.request_head(url.path)\n if res.is_a?(Net::HTTPRedirection)\n url_exist?(res['location']) # Go after any redirect and make sure you can access the redirected URL\n else\n res.code[0] != '4' # false if http code starts with 4 - error on your side.\n end\nrescue Errno::ENOENT\n false # false if can't find the server\nend",
"def url?\n !urn?\n end",
"def proper_url? \n\t\tif !(self.long_url.start_with?('http://') || self.long_url.start_with?('https://'))\n\t\t\terrors.add(:long_url, \"is in invalid format.\")\n\t\tend \n\tend",
"def remote_file_exists?(url)\n url = URI.parse(url)\n Net::HTTP.start(url.host, url.port) do |http|\n return http.head(url.request_uri).code == \"200\"\n end\n end",
"def already_stored?\n !file_uniqueness\n end",
"def validate_uri(url)\n !!URI.parse(url)\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def exist?\n # shouldn't force network connections just to check if content exists\n # only check that the path is not empty\n !path.to_s.empty?\n end",
"def valid_url?\n\t\t# http:// or not http://\n\t\tx = self.long_url.start_with?(\"http://\", \"https://\")\n\t\tif x == false\n\t\t\treturn \"http://\" + self.long_url\n\t\telse\n\t\t\treturn self.long_url\n\t\tend\n\tend",
"def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveofourown.org/users\")\n self.errors.add(:url, \"cannot be ao3 user\")\n return false\n elsif normalized.match(\"(.*)/collections/(.*)/works/(.*)\")\n normalized = $1 + \"/works/\" + $3\n elsif normalized.match(\"archiveofourown.org/collections\")\n self.errors.add(:url, \"cannot be an ao3 collection\")\n return false\n end\n self.url = normalized\n end",
"def migrate_linked_file?(uri)\n host = uri.host.to_s\n path = uri.path.to_s\n if(host == 'www.ctcc.uio.no')\n if(path != '/' and path != '')\n return true\n else\n return false\n end\n elsif(host != '')\n return false\n end\n return super(uri)\n end",
"def scraped?\n !url.blank?\n end",
"def valid_image_url(url)\n !url.images.first.src.to_s.starts_with?('/')\nend",
"def file_url?(url)\n name = File.basename(url)\n name.include?('.zip') || name.include?('.tar.gz')\n end",
"def validate_external_uri( uri, dir, doc )\n return unless @validate_externals\n\n if @invalid_uris.include? uri.to_s\n @log.error \"could not open URI '#{uri.to_s}'\"\n return\n end\n\n begin\n uri.open {|_| nil}\n @valid_uris << uri.to_s\n rescue Exception\n @log.error \"could not open URI '#{uri.to_s}'\"\n @invalid_uris << uri.to_s\n end \n end",
"def external_asset_url?\n !same_source_host? && url_from_asset_tag?\n end",
"def url_exists?(url_string)\n url = URI.parse(url_string)\n req = Net::HTTP.new(url.host, url.port)\n req.use_ssl = true\n path = url.path unless url.path.empty?\n res = req.request_head(path || '/')\n if res.kind_of?(Net::HTTPRedirection)\n return false\n else\n ! %W(4 5).include?(res.code[0]) # Not from 4xx or 5xx families\n end\nrescue Errno::ENOENT\n false #false if can't find the server\nend",
"def no_valid_url?(arr)\n #debugger\n options = [\".com\", \".net\", \".io\", \".org\"]\n arr.none? do |url|\n options.any?{|suffix| url.end_with?(suffix)} \n end\nend",
"def contains_invalid_urls(markdown)\n urls = markdown.scan(/]\\((?<matching>http[^\\)\"]+)/).flatten # matches [text](url) or [text](url \"title\")\n urls += markdown.scan(/<(?<matching>http[^>]+)/).flatten # matches <url>\n urls += markdown.scan(/: (?<matching>http[^\"\\n]+)/).flatten # matches [id]: url or [id]: url \"title\"\n urls.each do |url|\n begin\n check_url(url.strip) # strip url because matches on [text](url \"title\") end with a space\n rescue => e\n declare_url_error('content', url, \"got an error : '#{e}'\")\n end\n end\n end",
"def is_url_valid\n\t\tunless self.long_url.starts_with?(\"http://\", \"https://\")\n\t\t\terrors.add(:long_url, \"invalid format\")\n\t\tend\n\tend",
"def validate_url_format\n valid_url = false\n begin\n uri = URI.parse(url)\n valid_url = uri.scheme.present? || uri.host.present?\n rescue URI::InvalidURIError\n valid_url = false\n end\n errors.add(:url, 'format is invalid') unless valid_url\n end",
"def ensure_ontology_url_format\n if self.ontology_urls.blank?\n errors.add(:ontology_urls, \"cannot be empty if SearchFacet is ontology-based\")\n else\n self.ontology_urls.each do |ontology_url|\n # check that entry is a Hash with :name and :url field\n unless ontology_url.is_a?(Hash) && ontology_url.with_indifferent_access.keys.sort == %w(name url)\n errors.add(:ontology_urls, \"contains a misformed entry: #{ontology_url}. Must be a Hash with a :name and :url field\")\n end\n santized_url = ontology_url.with_indifferent_access\n unless url_valid?(santized_url[:url])\n errors.add(:ontology_urls, \"contains an invalid URL: #{santized_url[:url]}\")\n end\n end\n end\n end"
] |
[
"0.694109",
"0.68834794",
"0.6843072",
"0.68170565",
"0.6689737",
"0.66301644",
"0.6571512",
"0.65411186",
"0.6455866",
"0.6453648",
"0.6438132",
"0.6419349",
"0.6418165",
"0.6392155",
"0.638497",
"0.637657",
"0.635905",
"0.6345422",
"0.63445497",
"0.6301218",
"0.62794805",
"0.62624615",
"0.62624615",
"0.62532884",
"0.6252564",
"0.6217079",
"0.6212474",
"0.6185066",
"0.61833006",
"0.6171425",
"0.61668515",
"0.6166169",
"0.61628777",
"0.6155283",
"0.6154231",
"0.6149186",
"0.61193025",
"0.611867",
"0.6116976",
"0.6109585",
"0.61084175",
"0.61068493",
"0.61068493",
"0.60967046",
"0.6065782",
"0.60491973",
"0.60484457",
"0.60374624",
"0.6002156",
"0.5997611",
"0.5987706",
"0.5987537",
"0.5985731",
"0.5980625",
"0.59583515",
"0.5945896",
"0.5945896",
"0.59429806",
"0.5942361",
"0.5937758",
"0.59233934",
"0.591981",
"0.58907765",
"0.5888881",
"0.58784145",
"0.58730906",
"0.586934",
"0.58690137",
"0.58646274",
"0.5841011",
"0.5839177",
"0.58390003",
"0.5831858",
"0.58267516",
"0.5822968",
"0.5822503",
"0.5802214",
"0.58014315",
"0.5792419",
"0.5787289",
"0.578234",
"0.5781935",
"0.57745796",
"0.5772098",
"0.57672817",
"0.57637554",
"0.57637554",
"0.57610595",
"0.5759402",
"0.57474107",
"0.5746286",
"0.57450086",
"0.57339126",
"0.5733027",
"0.57295144",
"0.5728482",
"0.5722001",
"0.57202274",
"0.5715639",
"0.56993103",
"0.5693247"
] |
0.0
|
-1
|
SANITIZE THE USER GIVEN URL
|
def sanitize
self.original_url.strip!
self.sanitize_url = self.original_url.downcase.gsub(/(https?:\/\/)|(www\.)/, "")
self.sanitize_url = "http://#{self.sanitize_url}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sanitize_url(str); end",
"def sanitize_url(url)\n url.gsub(%r{^https?://}, '').split('/').map {|u| CGI.escape(u) }.join('/')\n end",
"def sanitise(url)\n if url and m = url.match(/(\\w+)(:\\/*)([\\w\\.\\-].*)(\\/?.*)?/)\n clean_url = m.captures[0].downcase + m.captures[1] + m.captures[2].downcase\n if m.captures[3]\n clean_url << m.captures[3]\n end\n else\n return nil\n end\n end",
"def sanitize(url)\n\t\t\tURI.encode url.strip.gsub('[', '%5B').gsub(']', '%5D')\n\t\tend",
"def normalize_url(url); end",
"def sanitize_url(url)\n return url if url.include?(\"https://\") || url.include?(\"http://\")\n url.prepend(\"http://\")\n end",
"def cleanse_url(url)\n cleansed_url = URI.parse(url)\n cleansed_url.password = nil\n cleansed_url.user = nil\n cleansed_url.to_s\n rescue URI::Error\n url\n end",
"def nice_url\n\t\t# i want to take thr url and remove http:// and www.\n\t\t# gsub is global subsitution\n\t\turl.gsub(\"http://\", \"\").gsub(\"www.\", \"\")\n\tend",
"def clean_url url\n return url if url.nil?\n url.gsub('%2F', '/').gsub(/^\\/+/, '').gsub('//', '/')\n end",
"def clean(url)\n url\n end",
"def sanitize_url(url)\n # URL matches 'www'\n if url =~ /w{3}/\n sterilize url.split(/\\./)[1]\n # URL does not match 'www'\n else\n first_parts = url.split(/\\./)[0..1]\n scheme_eliminated = first_parts.map {|part| part.gsub(/[a-zA-Z]+\\W+/, '')}.join(' ')\n sterilize(scheme_eliminated) \n end\n end",
"def pretty_url\n Iconv.iconv(\"ASCII//IGNORE//TRANSLIT\", \"UTF-8\", self).join.sanitize\n rescue\n self.sanitize\n end",
"def clean_url\n url = self.original_url\n url = url.gsub(' ', '')\n url = url.strip\n if url !~ REGEX_PROTOCOL\n url = \"http://#{url}\"\n end\n begin\n self.original_url = URI.parse(url).normalize.to_s\n rescue URI::InvalidURIError\n # handle urls that cannot be parsed\n self.original_url = url\n end\n end",
"def urlify(url)\n p url.tr(' ', '%20')\n url.gsub!(/ /, '')\nend",
"def sanitize_url(value)\n value = sanitize_string(value)\n value = value.sub('./', '') if value.start_with?('./')\n value\n end",
"def sanitize\n \tself.original_url.strip!\n \tself.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n \tself.sanitize_url = \"http://#{self.sanitize_url}\"\n\n \n start = 8\n final = self.sanitize_url.length\n\n while start <= final do\n sanitize_url[start] == ' ' ? sanitize_url[start] = '-' : sanitize_url[start] = sanitize_url[start] #change spaces for '-'\n break if sanitize_url[start] == '/' #break if '/' is found\n start +=1\n end\n\n self.sanitize_url = sanitize_url[0..start] #cut the string for creating the shortened_url\n self.short_url = sanitize_url + short_url #save the final shortened_url on the short_url's field\n end",
"def clean_url\n return # Not yet implemented\n end",
"def polish!(url)\n url.replace \"http://#{url}\"\n end",
"def url_safe\n URI.parse(url).to_s\n rescue URI::InvalidURIError\n URI.escape url\n end",
"def sanitize_url(text, allowd_scheme = DefaultAllowedScheme)\n # return nil if text has characters not allowd for URL\n\n return nil if text =~ UrlInvalidChar\n\n # return '' if text has an unknown scheme\n # --- http://www.ietf.org/rfc/rfc2396.txt ---\n # scheme = alpha *( alpha | digit | \"+\" | \"-\" | \".\" )\n\n if text =~ %r|^([A-Za-z][A-Za-z0-9+\\-.]*):| \n return nil unless allowd_scheme[$1]\n end\n \n # escape HTML\n # special = \"&\" | \"<\" | \">\" | '\"' | \"'\"\n # But I checked \"<\" | \">\" | '\"' before.\n s = text.dup\n #s.gsub!(\"&\", '&')\n s.gsub!(\"'\", ''')\n\n s\n end",
"def clean_url(url)\n uri = URI.parse(url)\n uri.query = CGI.parse(uri.query || '').reject { |k| k == 'api_key' }.to_query\n uri.to_s\n end",
"def sanatize_url(url)\n uri = URI.parse(url);\n cleaned_url = \"https://\" + uri.host + uri.path\n end",
"def clean_url(href)\n # TODO: A better way would be to split by / then take the last section, strip off the anchor then cgi escape\n URI.unescape(href.strip).gsub(\" \", \"%20\")\n end",
"def normalize_url(url)\n Addressable::URI.parse(url).normalize.to_s\n end",
"def clean_url\n str = self\n str = str.remove_enters\n str = str.remove_tabs\n str\n end",
"def facebook_path_scrub(url)\n return url.gsub('facebook/', '').gsub('/facebook', '')\n end",
"def clean_url(url)\n begin\n url = Addressable::URI.escape(url)\n url = \"http://#{url}\" if Addressable::URI.parse(url).scheme.nil?\n uri = URI(url)\n host = uri.host.downcase\n\n if host.start_with?('www.')\n host = host[4..-1]\n end\n\n host + uri.path.downcase\n rescue\n logger.debug \"Bad URL encountered in clean_url\"\n url\n end\n end",
"def check_and_escape(url)\n check url\n CGI.escape url\n end",
"def sanitize( message )\n urls = URI.extract(message)\n\n # Return early no URLs are foudnd.\n return message if urls.length.zero?\n\n urls.each do |url|\n next if URI.parse(url).class != URI::HTTP # Ignore URI::General etc\n\n host = URI.parse(url).host\n host = host.start_with?('www.') ? host[4..-1] : host\n message = message.gsub(url, host)\n end\n\n message\n end",
"def normalize_url url\n unless url.match(/https?:\\/\\//)\n url = \"http://#{url}\"\n end\n\n url\n end",
"def scrub(link, host=nil)\n unless link.nil? then\n return nil if DO_NOT_CRAWL_TYPES.include? link[(link.size-4)..link.size] or link.include? '?' or link.include? '/cgi-bin/' or link.include? '&' or link[0..8] == 'javascript' or link[0..5] == 'mailto'\n link = link.index('#') == 0 ? '' : link[0..link.index('#')-1] if link.include? '#'\n if link[0..3] == 'http'\n url = URI.join(URI.escape(link)) \n else\n url = URI.join(host, URI.escape(link))\n end\n return url.normalize.to_s\n end\n end",
"def URLify(string)\n string.strip.gsub(\" \", \"%20\")\nend",
"def urlify(input)\n input.gsub(' ', '%20')\nend",
"def clean_url\n self.url = self.title.clone if self.url.blank?\n \n self.url.downcase!\n self.url = self.url.gsub(/[^[:alnum:]]/,'-').gsub(/-{2,}/,'-')\n self.url = self.url.gsub(/^[-]/,'').gsub(/[-]$/,'')\n self.url.strip!\n\n return true\n \tend",
"def clean_url!\n remove_urchin\n case uri.host\n when 'www.youtube.com'\n self.url = \"#{uri.scheme}://#{uri.host}/watch?v=#{self.params['v'][0]}\"\n when 'boingboing.net'\n self.url = \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end\n end",
"def site_sanitized\n if site.nil?\n return nil\n else\n if site.starts_with?('http://') || site.starts_with?('https://')\n return site\n else\n return 'http://' + site\n end\n end\n \n end",
"def cleanup_urls\n self.url = self.url.to_s.downcase\n end",
"def sanitize_path\n gsub(/[\\/: ]/,'_')\n end",
"def converturl url\n return nil unless url\n newurl = url.sub('/wiki/','').downcase().sub('_(film)','').sub(/([12][8901].._film)/,'')\n newurl = URI.decode(newurl)\n # accept only alphanum and %\n newurl.gsub!(/[^0-9a-z%]/i,'')\n return newurl\nend",
"def urlify(string)\n string.strip.gsub(/ /, '%20')\n end",
"def sanitize_path(path); end",
"def strip_url(url)\n url.sub!(/https\\:\\/\\//, '') if url.include? \"https://\"\n url.sub!(/http\\:\\/\\//, '') if url.include? \"http://\"\n return url\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def fix_url\n self.url = UrlNormalizer.normalize_entry_url self.url, self\n end",
"def format_url(url)\n url.gsub(%r{^(https?:\\/\\/)}, '')\n end",
"def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveofourown.org/users\")\n self.errors.add(:url, \"cannot be ao3 user\")\n return false\n elsif normalized.match(\"(.*)/collections/(.*)/works/(.*)\")\n normalized = $1 + \"/works/\" + $3\n elsif normalized.match(\"archiveofourown.org/collections\")\n self.errors.add(:url, \"cannot be an ao3 collection\")\n return false\n end\n self.url = normalized\n end",
"def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end",
"def normalize_query url\n url = PostRank::URI.normalize(url) rescue nil\n return if url.blank?\n return if url.host.blank? || (! HOST_WHITELIST.include?(url.host))\n return unless (url.scheme == 'http')\n url\n end",
"def clean\n @url = @url.gsub(/\\s/, '+')\n @url = @url.gsub(/\\+{2,}/, '+')\n end",
"def urlify(str)\n return str if str.split(' ').length == 1\n str.strip.gsub(/\\s/, '%20')\nend",
"def escape_redirect(url)\n uri = URI.parse(url)\n \"\".html_safe + uri.path + '?' + uri.query.html_safe\n end",
"def escape_url(url)\n url.blank? ? nil : url.gsub(/\\./, '-dot-').gsub(/\\//, '-slash-')\n end",
"def to_url\n val = self.strip_tags!\n val = val.gsub(/[ —_\\/]/, '-')#TODO: длинный пробел не работает\n val = val.gsub(/[+.,!?@#$%^&*()\\[\\]{}:;\\/\\\\|<>\"']/, '') #TODO: больше символов!\n val.downcase\n end",
"def sanitize!; end",
"def u(str)\n str.to_url\nend",
"def normalize_url(url)\n\t\tbegin\n\t\t\turl.strip!\n\t\t\t# Converting the scheme and host to lower case in the process, i.e. 'HTTP://www.Example.com/' => 'http://www.example.com/' \n\t\t\t# Normalize the base\n\t\t\tbase=url_2_site(url) \n\t\t\t# Case#1, remove the trailing dot after the hostname, i.e, 'http://www.yahoo.com./' => 'http://www.yahoo.com/'\n\t\t\tbase=base.sub(/\\.\\/$/,'/')\n\t\t\t# Normalize the relative path, case#1\n\t\t\t# retrieve the file path and remove the first '/' or '.', \n\t\t\t# i.e. 'http://www.example.com/mypath' or 'http://www.example.com/./mypath' => 'mypath'\n\t\t\tpath=url_2_path(url).sub(/^(\\/|\\.)*/,'')\n\t\t\t# Normalize the relative path, case#2\n\t\t\t# Replace dot-segments. \"/../\" and \"/./\" with \"/\", i.e. 'http://www.example.com/../a/b/../c/./d.html\" => 'http://www.example.com/a/c/d.html'\n\t\t\tpath=path.gsub(/\\/\\.{1,2}\\//,'/')\n\t\t\tif path.nil?\n\t\t\t\treturn base\n\t\t\telse\n\t\t\t\treturn base+path\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__} for #{url}: #{ee}\" if @verbose\n\t\t\treturn url\n\t\tend\n\tend",
"def short_url\n return nil if url.nil?\n url.gsub(\"http://\",\"\").gsub(\"www.\", \"\")\n end",
"def safe_escape(uri); end",
"def link_sanitizer; end",
"def link_sanitizer; end",
"def link_sanitizer; end",
"def filtered_url\n @@ported_url.sub(/:[^:@@]+@@/, ':FILTERED@@')\n end",
"def urlify(string)\n\tif string.include?(' ') == true\n\t\tstring.gsub!(' ', '%20')\n\telse\n\t\tstring\n\tend\nend",
"def sanitize_data\n sanitize_permalink\n sanitize_name\n end",
"def strip_http(url = '')\n return url.gsub('http://', '')\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def unrelativize_url(url)\n url =~ /^\\/\\// ? \"#{scheme}://#{url[2..-1]}\" : url\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def urlFilter(url)\n nameRegex = /^#{Page::NAME_FORMAT}$/\n\n # check if link matches name spec already\n return url if nameRegex.match url\n\n if url.start_with? \"/\"\n # this is an url that leads to somewhere on samfundet.no\n begin\n uri = URI.join(request.protocol + request.host, url)\n rescue\n return url\n end\n else\n begin\n uri = URI(url)\n rescue\n return url\n end\n end\n\n # We only handle http, https. We also let uris not specifying protocol go trough, since they probably are http.\n unless uri.scheme.nil? || uri.scheme == \"http\" || uri.scheme == \"https\"\n # This is an url, but we a different protocol than http.\n # drop this url\n return nil\n end\n\n if uri.host == request.host\n # this is a link that leads to samfundet.no\n begin\n # recognize_path throws 404 if it doesn't find a valid distination\n destination = Rails.application.routes.recognize_path uri.to_s\n if destination[:controller] == \"pages\" && destination[:action] == \"show\"\n # this is some link that resolves to an info page\n return destination[:id]\n else\n # this is a link that leads to something else than an info page\n return uri.path\n end\n rescue\n # recognizing path failed\n # this link probably doesn't lead anywhere on the page\n return uri.path\n end\n else\n return url\n end\n end",
"def strip_http(url)\n \n # remove scheme\n if url.start_with?('http://')\n dest_url = url[7..-1]\n elsif url.start_with?('https://')\n dest_url = url[8..-1]\n else \n dest_url = url\n end\n\n # remove trailing \"meaningless\" characters\n if dest_url.end_with?('/')\n dest_url = dest_url[0..-2]\n end\n\n if dest_url.end_with?('#')\n dest_url = dest_url[0..-2]\n end\n\n return dest_url\n end",
"def urlify\n return self.strip.gsub(/\\s+/, \"%20\")\n end",
"def fn_convt(url)\n\tCGI.escape(url.gsub(/\\//,'_').gsub(/:|\\./,'_').scan(/http(.*)/)[0][0])\nend",
"def tinyfyurl\n self.tinyurl = Tools.tinyfy(url)\n end",
"def sanitize_path(path)\n # joining (e.g. `foo + \"/\" + bar`)\n path = path.gsub(%r{^/+}, \"/\")\n\n # remove leading and trailing slash\n path.sub(%r{^/}, \"\").sub(%r{/$}, \"\")\n end",
"def URLify(string, len)\n string.strip!.gsub!(/\\s\\s+/, \"%20\")\nend",
"def normalize_url(value)\n svalue = value.to_s\n pref = @req.api_prefix\n suffix = @req.api_suffix\n svalue.match(pref) ? svalue : \"#{pref}/#{svalue}#{suffix}\"\n end",
"def format_url\n self.url.chomp\n if self.url.match(\"https://\") || self.url.match(\"http://\")\n else self.url = \"http://\" + url\n end\n self.url\n end",
"def clean_url\n #use try instead for nil?\n unless self.url.nil?\n parsed_url = URI.parse(self.url).host.sub(/\\Awww\\./, '')\n else\n nil\n end\n end",
"def sanitize_path(path)\n if path.nil? || path.empty?\n \"\"\n else\n path.gsub(SANITIZATION_REGEX, \"\")\n end\n end",
"def url_arg url\r\n if url.instance_of?(String) then url else exactize(@view.url_for(url).gsub('amp;', '')) end\n end",
"def decode_as_raw_url\n self.url = URI.decode_www_form_component(url)\n end",
"def urlify(string, opts = {})\n opts = {:whitespace_replacement => '-', :default_replacement => \"\"}.merge(opts)\n string = string.gsub(WHITESPACES, opts[:whitespace_replacement])\n string.strip!\n string.gsub!(/[^\\x00-\\x7f]/u) { |char| TRANSLITERATIONS[char] || opts[:default_replacement] }\n string.gsub!(/[^a-z0-9\\-+_]/, opts[:default_replacement])\n string\n end",
"def sanitize(str)\n str.gsub(%r{[\\\\/*?\"<>|\\s,#]:}, '').downcase\n end",
"def urlify(str)\n if str.include?(\" \") == true\n # gsub! is a mutating regular expression method matching the first pattern and replacing it with the second\n str.gsub!(\" \", \"%20\") # return the mutated string\n else\n return str # if there are no spaces, return the string right away\n end\nend",
"def ensure_url(str)\n if str.respond_to?(:scheme)\n str\n else\n str = str.to_s\n str.gsub! /\\s/, ''\n str.gsub! /(\\#|\\?).*/, ''\n Addressable::URI.parse str\n end\n end",
"def convert_to_valid(url)\n return nil if url =~ /.jpg$/i\n url.insert(0, @main_url.first(5)) if url.start_with? '//'\n link = URI(url)\n main_page = URI(@main_url)\n if link && link.scheme && link.scheme.empty?\n link.scheme = main_page.scheme\n elsif link.nil?\n return nil\n end\n if link.scheme =~ /^http/\n request = link.to_s\n else\n request = nil\n end\n request\n rescue\n link\n end",
"def normalize_url(url)\n return nil if url.nil?\n begin\n uri = Addressable::URI.heuristic_parse(url)\n uri.host.present? && /^http(s)?$/.match(uri.scheme) ? uri.to_s : nil\n rescue\n nil\n end\n end",
"def clean_path(x)\n ip = url_unescape(x)\n ip.gsub!(/^#{Regexp.escape(root_uri_path)}/, '') if root_uri_path\n ip\n end",
"def URLify(string)\n string.chomp.split(' ').join('%20')\nend",
"def urlify(txt=\"Patricia is cool\")\n txt.split.join('%20')\nend",
"def fix_url\n\t if self.url and not self.url.match(/^(http|https):\\/\\/.*/)\n\t self.url = 'http://' + self.url\n end\n\tend",
"def fix_urls\n return unless self.url\n self.url.gsub!(/^(.*)/, 'http://\\1') unless self.url =~ %r{^http://} or self.url.empty?\n end",
"def to_url\n return if nil?\n\n s = downcase.tr(\"\\\"'\", \"\")\n s = s.gsub(/\\P{Word}/, \" \")\n s.strip.tr_s(\" \", \"-\").tr(\" \", \"-\").sub(/^$/, \"-\")\n end",
"def normalize!\n u = normalize\n @url = URI.parse(u)\n self\n end",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def sanitize(action); end",
"def shorten_url(url)\n pattern = /<a.*>(\\S*)<\\/a>/um\n url =~ pattern\n (url = url.sub(/>.*#{$1}.*</um, \">les mer<\")) unless $1 == nil\n\n # Some line-broken or complex urls don't work. For now we just null them to \"\" and\n # hope people check the NAF calendar.\n if(url =~ /les mer/)\n return url\n else\n return \"\"\n end\n end",
"def encoded_url\n CGI.escape(url)\n end"
] |
[
"0.83593374",
"0.79133815",
"0.77530813",
"0.76079863",
"0.7502041",
"0.739769",
"0.736596",
"0.7350331",
"0.7328615",
"0.72960794",
"0.72693604",
"0.72406995",
"0.7229166",
"0.71716213",
"0.7146208",
"0.71046895",
"0.70758563",
"0.7051779",
"0.7004767",
"0.69788677",
"0.6972499",
"0.6957744",
"0.69414556",
"0.6884706",
"0.6879308",
"0.68684787",
"0.680566",
"0.6796029",
"0.6793059",
"0.6792321",
"0.67679256",
"0.67193794",
"0.6670554",
"0.6670011",
"0.66646826",
"0.6629523",
"0.660693",
"0.653469",
"0.65301496",
"0.65044266",
"0.6499387",
"0.64735264",
"0.64715815",
"0.64715815",
"0.64601797",
"0.6457502",
"0.6433833",
"0.6430384",
"0.6430384",
"0.6428764",
"0.6421433",
"0.6396829",
"0.63953364",
"0.6392206",
"0.63919127",
"0.6364396",
"0.634265",
"0.63262224",
"0.62911034",
"0.6273388",
"0.6273388",
"0.6273388",
"0.624995",
"0.62456864",
"0.62375",
"0.6237114",
"0.6234092",
"0.62266046",
"0.62266046",
"0.6223174",
"0.62220824",
"0.62039125",
"0.61944276",
"0.61879987",
"0.6184908",
"0.61843055",
"0.61835855",
"0.61821973",
"0.6152875",
"0.6147976",
"0.61391723",
"0.6137686",
"0.61368656",
"0.61217105",
"0.6118083",
"0.61170053",
"0.6113368",
"0.6106496",
"0.60981166",
"0.6073637",
"0.6058083",
"0.6055393",
"0.604554",
"0.6039596",
"0.60361564",
"0.6021567",
"0.60168153",
"0.6012205",
"0.6007215",
"0.60043913"
] |
0.76592577
|
3
|
Returns triplets of (user, role name, observation)
|
def triples
requesters, approvers, observers = self.partitioned_roles
requesters = requesters.map { |r| [r.user, "Requester", nil] }
approvers = approvers.map { |r| [r.user, "Approver", nil] }
observers = observers.map { |r| [r.user, nil, self.observation_for(r.user)] }
requesters + approvers + observers
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def triples\n requesters, approvers, observers = partitioned_roles\n requesters = requesters.map { |role| [role.user, \"Requester\", nil] }\n approvers = approvers.map { |role| [role.user, \"Approver\", nil] }\n observers = observers.map { |role| [role.user, nil, observation_for(role.user)] }\n\n requesters + approvers + observers\n end",
"def show_roles_and_users\n chorus_object_roles.map(&:role).uniq.map do |r|\n [r.name, users_for_role(r).map(&:username)]\n end\n end",
"def user_role(user)\n res = []\n res << \"observer\" if observers_people.where(:id=>user.id).exists?\n res << \"admin\" if administrator == user\n res << \"observed\" if observed.where(:id=>user.id).exists? or head_of_department == user\n res\n end",
"def name_and_role\n instructors.map do |instructors_hash|\n {instructors_hash[:name] => instructors_hash[:role]}\n end\nend",
"def index\n @user_to_roles = UserToRole.all\n @users = Hash.new { |h, k| h[k] = Array.new}\n UserToRole.joins(:user, :role).map do |row|\n @users[row.user] << row.role.name\n end\n end",
"def to_array\n [@id, @username, @password, @role]\n end",
"def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end",
"def user_columns\n case current_user.role\n # Admin\n when 0\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"mee_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"semester\", \"true\"]]\n # Academic\n when 2\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"level\", \"true\"],[\"mee_lead\", \"true\"],[\"uni_module\", \"true\"],[\"module_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"programmes\", \"true\"],[\"semester\", \"true\"]]\n # Technician\n when 1\n return [[\"activity_id\", \"true\"],[\"experiment_name\", \"true\"],[\"last_risk_assessment\", \"true\"],[\"mee_lead\", \"true\"],[\"preferred_room\", \"true\"],[\"semester\", \"true\"],[\"technician\", \"true\"]]\n end\n end",
"def roles\n users.map { |item| item['roles'] }.flatten.uniq\n end",
"def my_assigned_roles(user)\n roles = []\n self.my_roles(user).each do |role|\n design_review_result = self.design_review_results.detect { |drr| drr.role == role }\n roles << role if design_review_result.reviewer == user\n end\n roles\n end",
"def users_by_role\n members.includes(:user, :roles).where(\"name != 'Observateur'\").all.inject({}) do |h, m|\n m.roles.each do |r|\n h[r] ||= []\n h[r] << m.user\n end\n h\n end\n end",
"def movies(user)\n\t\treturn @user_info[user].keys\t\n\tend",
"def my_roles(user)\n user.roles & self.design_review_results.collect { |drr| drr.role }\n end",
"def users\n recipe_rc = RecipeCard.all.select {|rc| rc.recipe == self}\n # recipe_rc.map {|rc| rc.user}\n end",
"def the_roles\n roles.each.map{|_r| User::ROLES[_r.to_sym] }\n end",
"def role_symbols\n [:user]\n end",
"def users\n recipes.map {|recipe| recipe.user}\n end",
"def users\n # TODO use SQL\n results = self.approvers + self.observers + [self.requester]\n results.compact\n end",
"def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end",
"def roles\n # we can't use abilities as those are not defined when creating a new operator that is not yet saved\n #result = abilities.collect(&:name)\n authorizations.collect{|auth| auth.ability.try(:name)}\n end",
"def users\n return [member_1, member_2];\n end",
"def user_roles\n roles.collect(&:name).join(', ').split(', ').map(&:capitalize).join(', ')#.capitalize\n end",
"def get_user_roles\n @roles = @user.roles.pluck(:name)\n render json: @roles\n end",
"def roles\n @users = User.order(\"user_name\").all\n end",
"def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orcid')\n if orcid.present?\n text += format(' - <strong>ORCID:</strong> <a href=\"%{orcid_url}\" target=\"_blank\">%{orcid}</a>',\n orcid_url: orcid.value, orcid: orcid.value_without_scheme_prefix)\n end\n text\n end",
"def students\n course_enrollments.where(course_role: CourseRole.student).map(&:user)\n end",
"def users\n recipe_cards.map do |r|\n r.user\n end\n end",
"def roles\n roles_from_users\n end",
"def usernames\n @attributes[:usernames]\n end",
"def usernames\n @attributes[:usernames]\n end",
"def instructors\n course_enrollments.where(course_role: CourseRole.instructor).map(&:user)\n end",
"def roles\r\n @roles ||= user_roles.map(&:name)\r\n end",
"def get_user_data(users, username)\n user_array = []\n users.each do |user|\n if user['username'] == username\n user_array << user['name']\n user_array << user['username']\n user_array << user['password']\n user_array << user['admin']\n end\n end\n return user_array\nend",
"def reviewer_roles\n\n members = []\n Role.get_open_reviewer_roles.each do |role|\n entry_user = self.board_design_entry_users.detect{ |eu| eu.role_id == role.id }\n members << { :role => role,\n :member_list => role.active_users,\n :member_id => entry_user ? entry_user.user_id : 0,\n :required => !entry_user || (entry_user && entry_user.required?) }\n end\n members\n end",
"def role_symbols\n (roles || []).map {|r| r.title.to_sym}\n end",
"def users\n self.triples.map(&:first)\n end",
"def users\n result_hash['usr']\n end",
"def gym_user_instances\n user_names = []\n self.exercise_instances.each do |user|\n user_names << User.all.find {|user_instance| user_instance.id == user.user_id}\n end\n user_names\n \n end",
"def user\n t = []\n ville = nom_ville\n\t\tville.each do |i|\n\t\t\tCLIENT.search(i).take(1).collect do |tweet|\n\t\t\t\tt.push(\"#{tweet.user.screen_name}\") \n\n\t\t\tend\n\t\t end\n\treturn t\nend",
"def getMEELeadActivities\n users = User.all.pluck(:id)\n activities = []\n users.each do |id|\n username = User.find(id).display_name\n #create list of [[user, [their activities...]]...]\n activities.push([username, Activity.where(user_id: id)]) \n end\n return activities \n end",
"def role_assignments\n return @role_assignments\n end",
"def roles\n # rocking this in memory because eager-loading\n roles = object.paper_roles.select { |role|\n role.user_id == scoped_user.id\n }.map(&:description)\n roles << \"My Paper\" if object.user_id == scoped_user.id\n roles\n end",
"def movies(u)\n return @users[u].collect{|itm| itm[1]}\n end",
"def associates_list()\n\t\tassocs = Contract.associates_for(current_user()).all.inject([]) \\\n\t\t\t{ |ret, assoc| ret << ([assoc.username, assoc.id] unless assoc.id == 2) }.compact\n\tend",
"def assigned_roles(object)\n assignments.select { |pair|\n pair.first == object\n }.map(&:last)\n end",
"def find_user (map)\n user = []\n for i in 0..map.length-1\n for j in 0..map.length-1\n if map[i][j] == \" U \"\n user = [i,j]\n end\n end\n end\n user\n end",
"def user_ids\n UsersRole\n .joins(:role)\n .where(Role.arel_table[:resource_identifier].in(identifiers))\n .pluck(:user_id)\n .uniq\n end",
"def profile_info_items(user)\n occupation = [\"Occupation\", user.occupation]\n company = [\"Company\", user.company]\n location = [\"Location\", user.location]\n birthday = [\"Birthday\", user.birthday? ? user.birthday.strftime(\"%m/%d/%Y\") : nil]\n [ occupation, company, location, birthday ]\n end",
"def index\n @iams = $iam.groups.map{ |x| Iam.new(name: x.name) } \n @users = $iam.users\n @roles = $iam.client.list_roles \n end",
"def role_symbols\r\n (roles || []).map {|r| r.title.to_sym}\r\n end",
"def users\n Role.users id\n end",
"def to_a\n return @role_array.dup\n end",
"def movies u\n @usr_rating[u].keys\n end",
"def current_user_role_names\n container.current_user_role_names\n end",
"def user_list\n @user_ratings.map(&:user_id).sort\n end",
"def winner_usernames\n return winners.map {|p| p.username}\n end",
"def observations_by_user\n return unless (\n user = find_or_goto_index(User, params[:user])\n )\n\n query = create_query(:Observation, :by_user, user: user)\n show_selected_observations(query)\n end",
"def user_to_row(user)\n [user.key,\n user.class,\n nil,\n nil] + user.load_curve.to_a\n end",
"def list_roles\n Character.where(actor:self).map{|c|\"#{c.name} - #{c.show.name}\"}\n end",
"def profiles\n acl_entries.map(&:subject)\n end",
"def users\n my_recipe_cards.map do |recipecard|\n recipecard.user\n end\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def list_roles\n self.characters.map do |character|\n \"#{character.name} - #{character.show.name}\"\n end\n end",
"def additional_users_for_show\n [@role.user]\n end",
"def roles\n self.dig_for_array(\"roles\")\n end",
"def users\n raise \"No users are defined\" unless user_role.users.count.positive?\n user_role.users\n end",
"def role_symbols\n (roles || []).map { |r| r.title.to_sym }\n end",
"def role_symbols\n (roles || []).map { |r| r.title.to_sym }\n end",
"def accessible_roles\n index = ROLES.index(self.role)\n roles = User::ROLES[0..index].map{|x| [x.humanize, x]} if index\n return roles\n end",
"def get_instructor_names(instructors)\n instructors.map do |instructor|\n instructor[:name]\n end.uniq\nend",
"def victims_no_action_line_items\n @victims = Array.new\n\n [[\"UID\", \"Email\", \"Sent\", \"Clicked\", \"Opened\", \"Password\", \"Time\"]] +\n @victims_no_action.map do |victim|\n [victim.uid, \n victim.email_address, \n victim.sent.to_s, \n victim.clicked?.to_s, \n victim.opened?.to_s, \n victim.password?.to_s, \n victim.updated_at.to_s ]\n end\n end",
"def taste_array(user)\n tastes = user.user_taste_profile\n return [tastes.bitter, tastes.earthy, tastes.grassy, tastes.licorice, tastes.nutty, tastes.peppery, tastes.sour, tastes.spicy, tastes.sweet, tastes.woody]\n end",
"def movies(u)\n\t\tuser_list = []\n\t\ttraining_set.each do |row|\n\t\t\tif row[\"user_id\"] == u\n\t\t\t\tuser_list.push({\"movie_id\"=>row[\"movie_id\"], \"rating\"=>row[\"rating\"], \"genres\"=>genre_set[row[\"movie_id\"]-1][\"genres\"]})\n\t\t\t\t \t\t\t\t\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn user_list\n\tend",
"def tas\n Ta.find(ta_memberships.map(&:user_id))\n end",
"def names\n @users.values.map(&:name)\n end",
"def role_user_ids(role_name)\n return unless editable_and_viewable?\n\n UsersRole\n .joins(:role)\n .where(Role.arel_table[:resource_identifier].eq(roles_anchor_resource_identifier))\n .where(Role.arel_table[:name].in(role_name))\n .pluck(:user_id)\n .uniq\n end",
"def roles_for_user login\n cu = config['user']\n role_alias = cu[login] || cu[nil]\n role_alias = [ role_alias ] unless Array === role_alias\n roles = [ ]\n role_alias.each do | ra |\n roles.concat config['roles'][ra] || [ ra ]\n end\n roles.uniq!\n roles\n end",
"def get_users_for_role(name)\n model.model['g']['g'].rm.get_users(name)\n end",
"def role_names\n roles.split(',')\n end",
"def attending_teachers\n sessions.flat_map(&:attendances).flat_map(&:teacher).uniq\n end",
"def mood_names(user_id)\r\n moods(user_id).collect do |mood|\r\n mood['moodName']\r\n end\r\n end",
"def user_attribute_assignments\n return @user_attribute_assignments\n end",
"def movies u\n \tuser_ratings = @userdata[u.to_s.to_sym]\n \tsize = user_ratings.size\n \tmovies = []\n \tuser_ratings.each do |id, rating|\n \t\tmovies.push(id)\n \tend\n\n \t#puts size\n \t#puts movies.size\n \treturn movies\n end",
"def likers\n likes.map do |like|\n like.user\n end\n end",
"def roles_as_symbols\n roles.pluck(:symbol).map(&:to_sym)\n end",
"def handle_getting_names_for(users, user_role=\"contact\")\n @data.users = users\n @data.index = users.next_to_fill_in\n @data.user_role = user_role\n\n if @data.index\n user = @data.users[@data.index]\n collect_for(user)\n else\n @session.pop\n end\n end",
"def getRestaurantTuples()\n\t@cheesies = IDTuple.new('@CheesiesChicago', 'cheesies-pub-and-grub-chicago')\n\t@niusushi = IDTuple.new('@SushiNiu','niu-japanese-fusion-lounge-chicago')\n\t@bob = IDTuple.new('@thebaronbuena','bar-on-buena-chicago')\n\t#@michaels = IDTuple.new('','michaels-pizzeria-and-tavern-chicago-2') #Now here's a business thats not on twitter yet. Womp womp.\n\t@polkstreet = IDTuple.new('@PolkPub', 'polk-street-pub-chicago')\n\t@fatcat = IDTuple.new('@FatCatChicago', 'fat-cat-chicago')\n\treturn [@cheesies, @niusushi, @bob, @polkstreet, @fatcat]\nend",
"def roles\n @roles = Role.order(\"name\")\n\t@rights = Right.order(\"name\").map {|r| [r.name, r.id] }\n end",
"def user_movie_index ()\n\t\t@user_rating_index= Hash.new{|hash, key| hash[key] = Hash.new(0)}\n\t\t@user_movie_index = Hash.new{|hash,key| hash[key] = Array.new}\n\t\t@movie_user_index = Hash.new{|hash,key| hash[key] = Array.new}\n\t\t@movieStore.each do |line|\n\t\t\tuser_name = line[0]\n\t\t\tmovie_name = line[1]\n\t\t\tmovie_rating = line[2] \n\t\t\tmovie_rating_pairs = @user_rating_index[user_name]\n\t\t\tmovie_rating_pairs[movie_name] = movie_rating\n\t\t\t@user_movie_index[user_name] << movie_name\n\t\t\t@movie_user_index[movie_name] << user_name\n\t\tend\n\tend",
"def roles_list(role = nil)\n self.role_symbols\n end",
"def to_a\n [roll, yaw, pitch]\n end",
"def role_symbols\n roles.map do |role|\n role.title.underscore.to_sym\n end\n end",
"def roles_for_user(user)\n role_ids = self.chorus_object_roles.where(:user_id => user.id).map(&:role_id)\n Role.find(role_ids)\n end",
"def claims\n get_all_roles\n end",
"def claims\n get_all_roles\n end",
"def user_permission_fields(form)\n ubiquo_user_roles = form.object.ubiquo_user_roles.map(&:role)\n check_boxes = @roles.map do |role|\n content_tag(\"div\", :class => \"form-item\") do\n label_tag(\"role\"+role.id.to_s, role.name) + ' ' +\n check_box_tag(\"ubiquo_user[role_ids][]\", role.id, ubiquo_user_roles.include?(role), {:class => \"checkbox\", :id => \"role\"+role.id.to_s})\n end\n end\n content_tag(\"fieldset\") do\n content_tag(\"legend\", t(\"ubiquo.auth.roles\")) + check_boxes.join(\"\\n\").html_safe\n end + hidden_field_tag(\"ubiquo_user[role_ids][]\", '')\n end",
"def movies(user)\n\t\tmovie_array = Array.new\n\t\t#user_movie_pairs is an array of the concatenated strings that represent all user/movie pairs \n\t\t#in the original data\n\t\tuser_movie_pairs = @usermovie_rating.keys\n\t\tuser_movie_pairs.each do |user_in_data|\n\t\t\t#the concatenated strings are split up and saved as user_movie_array, an array with two string values, \n\t\t\t#the first being a user and the second being the corresponding movie.\n\t\t\tuser_movie_array = user_in_data.split(' ')\n\t\t\t#Any users in user_movie_pairs that match the parameter user have their corresponding movie added to movie_array\n\t\t\tif user_movie_array[0] == user\n\t\t\t\tmovie_array.push(user_movie_array[1])\n\t\t\tend\n\t\tend\n\t\t#movie_array now contains all the movies that user has watched\n\t\treturn movie_array\n\tend",
"def role_names\n roles.map { |role| role.name.capitalize }\n end",
"def users\n RecipeCard.all.select { |c| c.recipe == self }.map { |c| c.user }\n end",
"def role_symbols\n (roles || []).map {|r| r.name.to_sym} + [self.is_author? ? :author : []].flatten\n end"
] |
[
"0.676199",
"0.6488485",
"0.6043295",
"0.5974286",
"0.57820415",
"0.57253885",
"0.57227284",
"0.5720751",
"0.56910586",
"0.5626455",
"0.55749327",
"0.5476261",
"0.5463122",
"0.54611444",
"0.5459242",
"0.54471815",
"0.5431228",
"0.54303086",
"0.5409218",
"0.5409218",
"0.5399779",
"0.5388641",
"0.5372329",
"0.53707254",
"0.5366112",
"0.53464645",
"0.53299344",
"0.5327344",
"0.5315142",
"0.5315142",
"0.5304522",
"0.52995425",
"0.5292474",
"0.52857",
"0.52611893",
"0.52555424",
"0.5253276",
"0.5246748",
"0.52453125",
"0.52038544",
"0.51894486",
"0.5189153",
"0.51841414",
"0.5180364",
"0.51754713",
"0.51577616",
"0.51512307",
"0.513952",
"0.513721",
"0.51268595",
"0.5124891",
"0.5114301",
"0.5112001",
"0.5102995",
"0.51005787",
"0.5089508",
"0.5084807",
"0.50721407",
"0.50688064",
"0.5063034",
"0.5060088",
"0.50589573",
"0.50589573",
"0.5055781",
"0.50548166",
"0.50517195",
"0.50442237",
"0.50442237",
"0.503682",
"0.5032251",
"0.50283474",
"0.5012977",
"0.50126004",
"0.5010404",
"0.50073653",
"0.5007138",
"0.50061065",
"0.49998343",
"0.49955127",
"0.4993621",
"0.4989432",
"0.49820417",
"0.49795362",
"0.4970754",
"0.49651763",
"0.49648556",
"0.49628338",
"0.49553683",
"0.4953469",
"0.4952865",
"0.49513635",
"0.4950738",
"0.49482498",
"0.49448526",
"0.49448526",
"0.49429595",
"0.49428457",
"0.49412715",
"0.49397692",
"0.49389017"
] |
0.64294827
|
2
|
sorted by how they should be displayed
|
def users
self.triples.map(&:first)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def sort_entries; end",
"def sorted_results\n results.sort\n end",
"def order; end",
"def order; end",
"def sorted_labels; end",
"def sort_grosstotal\n BoxOffice::Movie.all.map( &:to_s ).sort {|a,b| b.grosstotal <=> a.grosstotal}.each.with_index(1) do |movie, index|\n puts \"#{movie.title}\"\n end\n end",
"def display_stories stories\n #Double the score for each title with \"cat\" or \"dog\" in the title.\n cat_dog(stories)\n\n stories.sort_by! { |story| story[:score] }\n\n stories.reverse!\n\n stories.each do |story|\n # \"Title: title, Category: category, Upvotes: score\"\n puts \"Title: #{story[:title]}, Category: #{story[:category]}, Upvotes: (#{story[:score]})\"\n end\nend",
"def sort_name\n sort_constituent\n end",
"def sort_display_data\n if @total_data.has_key?(\"\") or @total_data.has_key?(nil) and @total_data.length > 1\n @total_data = @total_data.sort do|a,b|\n a[0].to_s <=> b[0].to_s\n end\n deleted = @total_data.delete_at(0)\n @total_data.push(deleted)\n else\n @total_data = @total_data.sort\n end\n @total_data\n end",
"def sort\n @pokers.sort.reverse\n end",
"def tie_breaking_sort\n { \"content_id\" => { order: \"asc\" } }\n end",
"def alphabetailc_order\n @sorting_order = @data[\"prizes\"].sort_by{|a| a[\"year\"]}.group_by{|a| puts a[\"laureates\"].sort_by{|k| k[\"firstname\"]}}\n #@sorting_order = @data[\"prizes\"].sort_by { |a | [a[\"year\"],a[\"category\"]] }.sort_by{|a|}\n render :json => @sorting_order\n end",
"def sorted_sage_elements\n sage_elements.sort_by { |h| h[:title] }\n end",
"def merge_print_sort\n @merge.print_sort\n end",
"def display_by_views\n count_unique_views\n count_total_views\n\n sort_views(@unique_views_hash, 'unique views')\n sort_views(@total_views_hash, 'total views')\n end",
"def sort!\n @tabs.sort! { |x,y| x.text <=> y.text }\n end",
"def proefssorted\n \tproefs.order(:position)\n end",
"def sorted_contents\r\n @contents.keys.sort\r\n end",
"def sorted_sage_all_elements\n sage_all_elements.sort_by { |h| h[:title] }\n end",
"def sort_order\n 0\n end",
"def displayable_items(items)\n items.select do |item|\n display_item? item\n end.sort { |i1, i2| priority_for(i1) <=> priority_for(i2) }\n end",
"def sort\n @hits = all.sort {|x,y| y.score <=> x.score }\n end",
"def sort_ranking\n @sorted_hash = @hash_ranking.sort_by { |_name, points| -points }\n @sorted_hash = @sorted_hash.first(10)\n @sorted_hash.map { |k, v| \"#{k}\\t#{v}\" }.join(\"\\n\")\n end",
"def sort_abschnitte_and_umschlaege_by_ort\n ort_to_detail = {}\n self.umschlaege.each do |umschlag|\n ort = umschlag.ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << umschlag\n end \n self.transportabschnitte.each do |abschnitt|\n ort = abschnitt.start_ort\n ort_id = ort.nil? ? 0 : ort.id\n ort_to_detail[ort_id] ||= []\n ort_to_detail[ort_id] << abschnitt\n end \n ort_to_detail\n end",
"def sort_and_print(hash, type=\"visits\")\n new_hash = hash.sort_by { |page, visits| -visits}.to_h\n # Print into console to check\n new_hash.each do |page, number_of_visits|\n print page + \" \" + number_of_visits.to_s + \" \" + type + \" \"\n end\n # Return sorted hash\n return new_hash\nend",
"def is_sorted\r\n false\r\n end",
"def sort_by_sex_then_ln!\n @entries.sort! { |a,b| [a.sex, a.ln] <=> [b.sex, b.ln] }\n end",
"def enzymes\n @data.keys.sort\n end",
"def get_planet_names_sorted_by_size_decreasing()\n planets_sorted_by_size = @planets.sort_by { |planet| planet.diameter }\n planets_sorted_by_size_decreasing = planets_sorted_by_size.reverse\n planets_sorted_by_size_decreasing.map { |planet| planet.name }\n\nend",
"def sort_list(x, y)\n [protease_name(x), protease_conc(y)]\n end",
"def ordered_values; end",
"def sort_results(results)\n case @metadata[:sort]\n when \"new\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, -c.release_date_i, c.default_sort_index]\n end\n when \"old\"\n results.sort_by do |c|\n [c.set.regular? ? 0 : 1, c.release_date_i, c.default_sort_index]\n end\n when \"newall\"\n results.sort_by do |c|\n [-c.release_date_i, c.default_sort_index]\n end\n when \"oldall\"\n results.sort_by do |c|\n [c.release_date_i, c.default_sort_index]\n end\n when \"cmc\"\n results.sort_by do |c|\n [c.cmc ? 0 : 1, -c.cmc.to_i, c.default_sort_index]\n end\n when \"pow\"\n results.sort_by do |c|\n [c.power ? 0 : 1, -c.power.to_i, c.default_sort_index]\n end\n when \"tou\"\n results.sort_by do |c|\n [c.toughness ? 0 : 1, -c.toughness.to_i, c.default_sort_index]\n end\n when \"rand\"\n results.sort_by do |c|\n [Digest::MD5.hexdigest(@query_string + c.name), c.default_sort_index]\n end\n when \"number\"\n results.sort_by do |c|\n [c.set.name, c.number.to_i, c.number, c.default_sort_index]\n end\n when \"color\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.colors), c.default_sort_index]\n end\n when \"ci\"\n results.sort_by do |c|\n [COLOR_ORDER.fetch(c.color_identity), c.default_sort_index]\n end\n when \"rarity\"\n results.sort_by do |c|\n [-c.rarity_code, c.default_sort_index]\n end\n else # \"name\" or unknown key\n results.sort_by(&:default_sort_index)\n end\n end",
"def sort_by_tag_count\n end",
"def sort_params; end",
"def sort_params; end",
"def all_sorted\n @data[:pages].sort_by{|k, v| -v}\n end",
"def donations_sorted_for_display\n storg_id = Organization.find_savetogether_org.id\n donations.sort {|this, that|\n if this.to_user_id == storg_id\n 1\n elsif that.to_user_id == storg_id\n -1\n elsif this.id && that.id\n this.id <=> that.id\n else\n 0\n end\n }\n end",
"def sort\r\n @roster.each do |key, value|\r\n value.sort!\r\n end\r\n end",
"def sort_entries=(_arg0); end",
"def sort!\r\n @tabs.sort! { |x,y| x.name <=> y.name }\r\n end",
"def sort\n@roster.each do |key,value|\n value.sort!\nend \nend",
"def sort_by_ln!\n @entries.sort! { |a,b| a.ln <=> b.ln }\n @entries.reverse!\n end",
"def sort\n @books.sort.each {|item| puts \"#{item[0]} (#{item[1]})\" }\n end",
"def sorts_with_links\n [\n [search_merge(sort: 'best_match', order: 'desc', page: '1'), 'Relevancy'],\n\n [search_merge(sort: 'date', order: 'asc', page: '1'), 'Published Earliest'],\n [search_merge(sort: 'date', order: 'desc', page: '1'), 'Published Latest'],\n\n [search_merge(sort: 'title', order: 'asc', page: '1'), 'Title A-Z'],\n [search_merge(sort: 'title', order: 'desc', page: '1'), 'Title Z-A']\n ]\n end",
"def ordered_by_qualifications (collection)\n collection.sort_by {|x| [x[:years_of_experience], x[:github_points]]}.reverse!\nend",
"def rate_order\n infos = []\n self.matches.each do |match|\n infos += match.score_infos\n end\n infos = infos.sort_by{|x| x[3]}.reverse\n return infos.map{|x| \"#{x[0]}(#{\"%3.2f\" % x[3].to_f} @ #{x[2]}位)\"}\n end",
"def sorted_by_age(people)\nend",
"def top_10_sorted\n\t\t\t\t\traw = notable_order_by_cvss_raw\n\t\t\t\t\tdata = Array.new\n\n\t\t\t\t\traw.each do |vuln|\n\t\t\t\t\t\trow = Array.new\n\t\t\t\t\t\tplugin_id = vuln[0]\n\t\t\t\t\t\tcount = vuln[1]\n\n\t\t\t\t\t\tname = scrub_plugin_name(Plugin.find_by_id(plugin_id).plugin_name)\n\n\t\t\t\t\t\trow.push(name)\n\t\t\t\t\t\trow.push(count)\n\t\t\t\t\t\tdata.push(row)\n\t\t\t\t\tend\n\n\t\t\t\t\tdata = data.sort do |a, b|\n\t\t\t\t\t\tb[1] <=> a[1]\n\t\t\t\t\tend\n\n\t\t\t\t\treturn data\n\t\t\t\tend",
"def process_sort_by(values)\n map_values(values) do |value|\n split_value(value, \" \").join(\" \")\n end \n end",
"def sort_genes\n \t@genes.sort!{|x,y| x.start <=> y.start}\n end",
"def sort_times\n @links.each_value { |l| l.sort_times }\n end",
"def sort\n return @sort\n end",
"def sorted_for_field(field)\n for_field(field).sort\n end",
"def sorted_credits\n formatted = credits.map do |c|\n [\"#{c['credit']}_#{c['year']}\", c]\n end\n\n formatted.sort{ |x,y| x[0] <=> y[0] }.reverse\n end",
"def sort_order\n super\n end",
"def ordered_by_qualifications(candidates)\n sortedCandidates = candidates.sort_by! { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return sortedCandidates.reverse! \nend",
"def sort\n @cards.sort\n end",
"def articles_asc\n articles.sort_by(&:published)\n end",
"def stories_sorted_by_growth_rate\n stories = @stories.values.sort_by do |story|\n story.growth_rate\n end\n stories.reverse\n end",
"def bubble_print_sort\n @bubble.print_sort\n end",
"def sorted_by_frequency\n @categories.sort { |a, b| b[1] <=> a[1] }\n end",
"def sort\n @roster.each do |grade, studen_name|\n studen_name.sort!\n end\n end",
"def ordered_by_qualifications(candidates)\n ordered_candidates = candidates.sort_by { |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n return (ordered_candidates).reverse\n\n # @ordered_by_qualifications = []\n\n # candidates.each do |candidate|\n # years_exp s=candidate[:years_of_experience]\n # @ordered_by_qualifications << years_exp\n # if years_exp == years_exp += 1\n # candidate[:github_points] > candidate[github_points] += 1\n # end \n \n # end\n # return @ordered_by_qualifications.sort!.reverse\n #This line returns the values 12..1 \n # return @ordered_by_qualifications.sort!.reverse\nend",
"def sortByLetter\r\n @counts.sort_by { |v| v }\r\n end",
"def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end",
"def sort_panes results, display_type, max_scores\n\n #remove wcl before it tries to sort it and fails\n @wcl = results.delete('worldcat')\n #Rails.logger.debug(\"#{__FILE__}:#{__LINE__} results= #{@results.inspect}\")\n #Rails.logger.debug(\"#{__FILE__}:#{__LINE__} requesthost= #{request.host.inspect}\")\n # @catalog_host = get_catalog_host(request.host)\n # Rails.logger.debug(\"#{__FILE__}:#{__LINE__} @catalog_host= #{@catalog_host.inspect}\")\n top1 = top4 = secondary = []\n\n # Sort formats alphabetically for more results\n more = results.sort_by { |key, result| BentoSearch.get_engine(key).configuration.title }\n\n # Remove articles and digital collections from top 4 logic\n @summonArticles = results.delete('summonArticles')\n @digitalCollections = results.delete('digitalCollections')\n @institutionalRepositories = results.delete('institutionalRepositories')\n @libguides = results.delete('libguides')\n # Top 2 are books and articles, regardless of display_type\n #jgr25 top1 << ['summon_bento', results.delete('summon_bento')]\n top1 << ['ebsco_eds', results.delete('ebsco_eds')]\n top4 = top1\n\n if display_type == 'fixed'\n # Pre-populate top4 with our chosen formats and remove them from the results\n top4 << ['Journal', results.delete('Journal')]\n top4 << ['Database', results.delete('Database')]\n end\n\n # Sort the remaining format results by total number of hits\n #results = results.sort_by { |key, result| result.total_items.to_i }\n\n # Sort the remaining format results by max relevancy score\n results = results.sort_by { |key, result| max_scores[key] }\n results = results.reverse\n\n\n if display_type == 'dynamic'\n # Take top2 plus the next 2 formats with the highest result counts\n results.to(2).each do |result|\n top4 << result\n end\n secondary = results.from(3)\n else\n # We already took the top four before sorting\n secondary = results\n end\n\n return top4, secondary, more, @websites, @wcl\n end",
"def ordered_by_qualifications(candidates)\n candidates.sort_by{ |candidate| [candidate[:years_of_experience], candidate[:github_points]] }\n .reverse\n\nend",
"def sort_methods\n [\n 'score desc',\n 'authors_sort asc',\n 'authors_sort desc',\n 'title_sort asc',\n 'title_sort desc',\n 'journal_sort asc',\n 'journal_sort desc',\n 'year_sort asc',\n 'year_sort desc'\n ]\n end",
"def sort_and_print_by_2(o, hash, tag)\n hash.each do |hsh|\n sum = 0\n if tag == \"age\"; hsh[1] = consolidate_age(hsh[1]) end\n hsh[1].each{|k, v| sum += v}\n o.write(\"\\n#{hsh[0]}\\n\")\n get_and_print_percentage(hsh[1], sum, o)\n end\nend",
"def ordered_by_qualifications(candidates)\n\n candidates.sort_by{ |candidate| [-candidate[:years_of_experience], -candidate[:github_points]] }\n\nend",
"def arrange\n\t\t\n\tend",
"def ordered_by_qualifications(candidates)\n if [:years_of_experience] == [:years_of_experience]\n @candidates.sort_by { |experience| experience[:years_of_experience] }.reverse\n else\n @candidates.sort_by { |github| github[:github_points]}.reverse\n end\nend",
"def sort_findings\n # findings are sorted by severity status order and then by number of items found descending\n status_order = [:danger, :warning, :info, :success]\n @findings = @findings.flatten.sort_by {|f| [status_order.index(f[:status]), -f[:items].to_a.size]}.each do |i|\n @summary[i[:status]] += 1 unless i[:items].blank?\n @summary['success'] += 1 if i[:status] == :success\n end\n end",
"def sorted_by_time(times)\n times.to_a.sort_by{|x| x.last}.reverse.reject{|x| x.last < SHOW_ABOVE}\n end",
"def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end",
"def sorted\n all.order(%[ #{quoted_table_name}.\"recorded_at\", #{quoted_table_name}.\"hid\" ])\n end",
"def sort_abschnitte_and_umschlaege\n abschnitt_umschlag_list = []\n # Hilfsmethode, baut einen nach Orten sortierten Hash auf.\n ort_to_detail = sort_abschnitte_and_umschlaege_by_ort\n File.open(\"log/transport.log\",\"w\"){|f| f.puts \"Ort to detail #{ort_to_detail}\" }\n unless self.start_anlage.nil?\n if self.start_anlage.ort\n ort_aktuell = self.start_anlage.ort\n if ort_aktuell.nil? || ort_to_detail[ort_aktuell.id].nil?\n ort_aktuell = abschnitt_only_start_ort(ort_to_detail.keys) \n end \n counter = 0\n while not (ort_aktuell.nil? || ort_to_detail.empty? || counter > 100)\n counter += 1\n next_ort = nil\n ort_aktuell_id = ort_aktuell.nil? ? 0 : ort_aktuell.id \n unless ort_to_detail[ort_aktuell_id].nil?\n ort_to_detail[ort_aktuell_id].each do |abschnitt_umschlag|\n File.open(\"log/transport.log\",\"a\"){|f| f.puts abschnitt_umschlag.attributes }\n abschnitt_umschlag_list << abschnitt_umschlag\n next_ort = abschnitt_umschlag.end_ort if abschnitt_umschlag.kind_of? Transportabschnitt \n end\n ort_to_detail.delete(ort_aktuell_id) \n ort_aktuell = next_ort\n end\n end \n # Rest nach Datum sortieren\n unless ort_to_detail.empty?\n File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Rest nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end\n else \n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Alles nach Datum\" }\n abschnitt_umschlag_list = abschnitt_umschlag_list.concat(sort_abschnitte_and_umschlaege_by_date(ort_to_detail.values.flatten))\n end \n end\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Transport #{id}: #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end",
"def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end",
"def sort\n\t@events = @events.sort_by { | e | e.time_from_start }\n\trecalc_delta_from_times()\n end",
"def sort_by_display_name(object_array)\n object_array.sort { |x,y| \n xdn = x[\"display_name_display\"]\n ydn = y[\"display_name_display\"]\n if (xdn && ydn)\n if (xdn.is_a?(Array))\n xdn = xdn.first\n end\n if (ydn.is_a?(Array))\n ydn = ydn.first\n end\n xdn <=> ydn\n elsif xdn\n -1\n elsif ydn\n 1\n else # both nil\n 0\n end\n }\n end",
"def sort()\n\t\t@events = @events.sort do |a,b| a[0] <=> b[0] end\n\tend",
"def sort_abschnitte_and_umschlaege_by_date start_liste\n abschnitt_umschlag_list = []\n mit_end_datum = start_liste.select{|element| element.end_datum }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Mit Ende #{mit_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(mit_end_datum.sort_by{|element| element.end_datum} )\n ohne_end_datum = start_liste.select{|element| element.end_datum.nil? }\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Ohne Ende: #{ohne_end_datum.to_s}\" }\n abschnitt_umschlag_list.concat(ohne_end_datum)\n #File.open(\"log/transport.log\",\"a\"){|f| f.puts \"Liste bei Date #{abschnitt_umschlag_list.to_s}\" }\n abschnitt_umschlag_list\n end",
"def sorted_scores\n self.object.teams.map {|team| team.score}.sort.reverse\n end",
"def sort_option\n ['Best match', 'Level', 'Provider(s)']\n end",
"def sorted_races\n races.sort\n end",
"def results_list\n res = competitors.active.to_a\n res.sort!{|a, b| a.sorting_overall_place <=> b.sorting_overall_place}\n end",
"def sort\n super { |x, y| x.file_name <=> y.file_name }\n end",
"def sort_trophies_by_priority(trophies)\n #number of trophies per row\n per_row_small = 16\n per_row_medium = 4\n per_row_large = 1\n\n\n rows = []\n per_row = per_row_small + per_row_medium + per_row_large\n num_rows = (trophies.size / per_row.to_f).ceil\n (1..num_rows).each {rows << {:far_left => [],:left => [],:center => [],:right => [],:far_right => []}}\n i = 0\n trophies.each do |trophy|\n #fill center first\n if i < num_rows*per_row_large\n rows[i/per_row_large][:center] << trophy\n #fill left and right rows next\n elsif i < (num_rows*per_row_medium+num_rows*per_row_large)\n j = i - num_rows\n if j.even?\n rows[j/per_row_medium][:left] << trophy\n else\n rows[j/per_row_medium][:right] << trophy\n end\n #fill far left and far right rows next\n elsif i < (num_rows* per_row_small + num_rows*per_row_medium+num_rows)\n j = i - num_rows*per_row_medium - num_rows\n if j.even?\n rows[j/per_row_small][:far_left] << trophy\n else\n rows[j/per_row_small][:far_right] << trophy\n end\n end\n i = i + 1\n end\n rows\n end",
"def entries\n @entries.sort!{|a, b| a.range.low <=> b.range.low }\n end",
"def sorted_by_time(times)\n times.to_a.sort_by{|x| x.last}.reverse.reject{|x| x.last < SHOW_ABOVE}\n end",
"def bigSorting(unsorted)\n\nend",
"def display\n \t@items= Item.sorted\n end",
"def sort\n @sent_messages = Message.where(:sent_flag => true) #archive\n @unsent_messages = Message.where(:sent_flag => nil) #outbox\n\n #now sort according to what type of message they are\n #received messages - from earliest to oldest\n #unsent messages from oldest to earliest\n @unsent_messages = @unsent_messages.sort_by( &:send_date )\n #sent messages from earliest to oldest\n @sent_messages = @sent_messages.sort_by( &:sent_time ).reverse\n\n #get all the signatures too\n @signatures = Signature\n\n end",
"def sorted_tags\n get_tags.sort_by {|k,v| v}.reverse.unshift [\"All items\", self.items.count]\n end",
"def places_awarded\n @places.values.sort\n end",
"def __sort_pair__\n { first => Mongoid::Criteria::Translator.to_direction(last) }\n end",
"def s_typesort; det.link(:text, 'Type'); end",
"def ordered_by_qualifications(candidates)\n myArray = candidates\n #first sort by github points\n myArray.sort! { |a, b| a[:github_points] <=> b[:github_points] }\n #sort by experience\n myArray.sort! { |a, b| a[:years_of_experience] <=> b[:years_of_experience] }\n\n return myArray\nend",
"def sort\n @cards.sort_by {|card| card.poker_value}\n end",
"def sort_my_list\n @tracks.clear\n @artists.clear\n @genres.clear\n @user_list.each do |item|\n @tracks << item['id'] if item['type'] == 'track'\n @artists << item['id'] if item['type'] == 'artist'\n @genres << item['name'].downcase if item['type'] == 'genre'\n end\n end",
"def insertion_print_sort\n @insertion.print_sort\n end"
] |
[
"0.7500476",
"0.67306125",
"0.6548514",
"0.6548514",
"0.6542732",
"0.6497985",
"0.64924777",
"0.6478237",
"0.647098",
"0.6447001",
"0.6389402",
"0.63578457",
"0.635687",
"0.63364875",
"0.6334968",
"0.63329184",
"0.63181424",
"0.6294718",
"0.6284526",
"0.6275978",
"0.627442",
"0.6271415",
"0.62604445",
"0.6259953",
"0.62558824",
"0.62518674",
"0.624543",
"0.624214",
"0.62294203",
"0.6220318",
"0.62056327",
"0.620183",
"0.61958325",
"0.6185605",
"0.6185605",
"0.6182607",
"0.617731",
"0.6156441",
"0.6152352",
"0.61439294",
"0.6137977",
"0.6137246",
"0.6137135",
"0.6135872",
"0.6131105",
"0.6123773",
"0.6120245",
"0.6116868",
"0.6113135",
"0.61114854",
"0.61113256",
"0.61094797",
"0.610926",
"0.610745",
"0.6103489",
"0.6099009",
"0.6097584",
"0.609245",
"0.6090834",
"0.6088412",
"0.6079226",
"0.6071809",
"0.60710704",
"0.60521847",
"0.60431933",
"0.6037696",
"0.6031417",
"0.603047",
"0.6022404",
"0.6019652",
"0.6018104",
"0.60158324",
"0.6014157",
"0.6013627",
"0.6005102",
"0.6004258",
"0.6003591",
"0.6002082",
"0.5997507",
"0.59880537",
"0.5976703",
"0.5972337",
"0.5972131",
"0.59714115",
"0.59707594",
"0.5968644",
"0.59533125",
"0.59519124",
"0.59496766",
"0.5943848",
"0.5940313",
"0.5938451",
"0.59350353",
"0.5931682",
"0.59312165",
"0.59260875",
"0.5919104",
"0.5915349",
"0.5915347",
"0.5915243",
"0.5913298"
] |
0.0
|
-1
|
Generate url that will redirect user to OAuth Dialogue. The canvas url should start by https:// and end with a slash. If you're building an facebook app, the canvas_url should be something like
|
def dialogue_url
return "https://www.facebook.com/dialog/oauth?client_id="+@app_id+"&redirect_uri="+@canvas_url+"&scope="+@permission
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def oauth_url\n url = <<-URL\n https://www.facebook.com/dialog/oauth/\n ?client_id=#{Network::Facebook.app_id}\n &redirect_uri=#{URI.escape(\"#{root_url}auth/facebook/?r=#{redirect_for(request.referer)}\")}\n &scope=#{Network::Facebook.scope}\n URL\n url.gsub(/\\s+/, '')\n end",
"def app_canvas_url\n \"#{request.ssl? ? \"https://\" : \"http://\"}apps.facebook.com/#{app_namespace}\"\n end",
"def oauth_callback_url\n end",
"def oauth_redirect_uri\n uri = URI.parse(request.url)\n uri.path = '/sk_auth/callback'\n uri.query = nil\n uri.to_s\n end",
"def create_oauth_url(cb_url, encoded_auth_state)\n oauth_url = \"https://www.facebook.com/dialog/oauth/?client_id=\" +\n \"#{APP_ID}&redirect_uri=#{cb_url}&state=#{encoded_auth_state}\"\n end",
"def oauth_uri(provider=\"FACEBOOK\")\n dest= session[\"return_to\"] || request.env[\"REQUEST_URI\"] || \"/\"\n \"#{oauth_uri_left_part}/account/oauth_start?provider=#{CGI.escape(provider)}&dest_left=#{CGI.escape(request_uri_left_part)}&dest_path=#{CGI.escape(dest)}\"\n end",
"def canvas(suffix)\n \"http://apps.facebook.com/\" + ENV['FACEBOOKER_RELATIVE_URL_ROOT'] + suffix\n end",
"def canvas_page_url(protocol)\n \"#{ protocol }apps.facebook.com/#{ namespace }\"\n end",
"def auth_url\n MiniFB.oauth_url(@app_id, @redirect_to,\n :scope => 'user_about_me') # See MiniFB.scopes\n end",
"def generate_authorize_url(request_token)\n request = consumer.create_signed_request(:get,\n consumer.authorize_path, request_token,\n {:oauth_callback => 'oob'})\n\n params = request['Authorization'].sub(/^OAuth\\s+/, '').split(/,\\s+/).map do |param|\n key, value = param.split('=')\n value =~ /\"(.*?)\"/\n \"#{key}=#{CGI::escape($1)}\"\n end.join('&')\n\n \"#{base_url}#{request.path}?#{params}\"\n end",
"def oauth_url_authorize\n return \"#{$SETTINGS[:oauth_server_url_authorize]}?response_type=code&client_id=#{$SETTINGS[:oauth_client_id]}&scope=ALL&redirect_uri=#{oauth_redirect_uri}\" \n end",
"def oauth_callback_url\n url_for :action => \"list\"\n end",
"def oauth_url\n 'https://geoloqi.com/oauth/authorize'\n end",
"def oauth_url(response_type = 'code')\n # The Redirect URI must be the same as registered with Put.io\n PUTIO_BASE_URL + \"/oauth2/authenticate?client_id=%i&response_type=%s&redirect_uri=%s\" % [@client_id, response_type, @redirect_uri]\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def url\n File.join(DigitalRiver.config.oauth_url)\n end",
"def authorize_url\n client = OAuth2::Client.new(client_id, client_secret, :site => oauth_url)\n client.auth_code.authorize_url(:redirect_uri => redirect_uri)\n end",
"def facebook_authenticate_url\n facebook_client.web_server.authorize_url(:redirect_uri => Settings.authentication.facebook.callback_url,\n :scope => Settings.authentication.facebook.scope)\n end",
"def get_authorization_url(request_token, callback_url)\n \"#{request_token.authorize_url}&oauth_callback=#{CGI::escape(callback_url)}\"\n end",
"def oauth_authorize_url(client_id, redirect_uri, options={})\n self.format_url('/oauth/authorize', {\n :client_id => client_id,\n :redirect_uri => redirect_uri\n }.merge(options))\n end",
"def authorize_url(callback_url)\n request_token.authorize_url+'&oauth_callback='+CGI.escape(callback_url)\n end",
"def oauth\n redirect_to \"#{root_path}auth/#{Setting['omniauth']['provider']}\"\n end",
"def get_authorize_url(callback=nil)\n get_request_token()\n\n url = \"/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}\"\n if callback\n url += \"&oauth_callback=#{URI.escape(callback)}\"\n end\n if @locale\n url += \"&locale=#{URI.escape(@locale)}\"\n end\n\n \"https://#{Dropbox::WEB_SERVER}#{url}\"\n end",
"def authorization_url\n uri = URI(OAUTH_URL)\n uri.query = {\n client_id: client_id,\n redirect_uri: redirect_uri,\n scope: scope_url,\n response_type: 'code',\n access_type: 'offline'\n }.to_param\n\n uri.to_s\n end",
"def canvas_url\n session[:canvas_url]\n end",
"def authorize_url\n client.web_server.authorize_url( :redirect_uri => callback_url )\n end",
"def person_omniauth_authorize_path_or_url(provider)\n SecureUrlHelper.https? ? person_omniauth_authorize_url(provider, :protocol => 'https') : person_omniauth_authorize_path(provider)\n end",
"def authorize_url(scope = nil)\n url = \"#{GRAPH_ROOT}/oauth/authorize?client_id=#{@app_id}&redirect_uri=#{URI.encode @redirect_uri}\"\n if scope.is_a?(Array)\n url += \"&#{scope.join(',')}\"\n end\n url\n end",
"def oauth_url\n @oauth_url || File.join(host, \"oauth20/token\")\n end",
"def authorize_url(params=nil)\n connection.build_url(options[:authorize_url], params).to_s\n end",
"def authorize_url(options = {})\n options[:response_type] ||= \"code\"\n options[:redirect_uri] ||= redirect_uri\n params = authorization_params.merge(options)\n uri = URI(\"#{base_url}/api/oauth2/auth/\")\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def facebook_auth_uri\n return '' unless E9::Config.instance.facebook_auth_ready?\n\n facebook_client.auth_code.authorize_url({\n :redirect_uri => facebook_redirect_uri,\n :scope => 'publish_stream,manage_pages,offline_access'\n })\n end",
"def url_for_canvas(url_opts={})\n controller.send(:url_for_canvas, url_opts)\n end",
"def sso_callback_url_for(user)\n\n sso_token = encrypt_sso_token_for_user(user)\n\n url = sso_callback_url.dup\n if sso_callback_url =~ /\\?/\n url << '&'\n else\n url << '?'\n end\n url << \"sso_token=#{sso_token}\"\n\n url\n\n end",
"def callback_url\n if @authorization_code_from_signed_request_in_cookie\n ''\n else\n # Fixes regression in omniauth-oauth2 v1.4.0 by https://github.com/intridea/omniauth-oauth2/commit/85fdbe117c2a4400d001a6368cc359d88f40abc7\n options[:callback_url] || (full_host + script_name + callback_path)\n end\n end",
"def authorize_endpoint_url\n uri = URI(openid_config['authorization_endpoint'])\n uri.query = URI.encode_www_form(client_id: client_id,\n redirect_uri: callback_url,\n response_mode: response_mode,\n response_type: response_type,\n nonce: new_nonce)\n uri.to_s\n end",
"def callback_url\n options.authorize_params.callback_url or super\n end",
"def authorize_url(callback_url, options = {})\n url = \"#{BASE_URL}/oauth/authorize?client_id=#{app_id}&redirect_uri=#{callback_url}\"\n scope = options.delete(:scope)\n url += \"&scope=#{scope.join(',')}\" unless scope.blank?\n url += \"&#{options.to_query}\" unless options.blank? # Add other options. FIXME: to_query method requires Rails?!\n return url\n end",
"def get_oauth_url\n params = {}\n url = @url\n\n if url.include?(\"?\")\n parsed_url = URI::parse(url)\n CGI::parse(parsed_url.query).each do |key, value|\n params[key] = value[0]\n end\n params = Hash[params.sort]\n\n url = parsed_url.to_s.gsub(/\\?.*/, \"\")\n end\n\n nonce_lifetime = 15 * 60 # Woocommerce keeps nonces for 15 minutes\n\n params[\"oauth_consumer_key\"] = @consumer_key\n params[\"oauth_nonce\"] = Digest::SHA1.hexdigest((Time.new.to_f % nonce_lifetime + (Process.pid * nonce_lifetime)).to_s)\n params[\"oauth_signature_method\"] = @signature_method\n params[\"oauth_timestamp\"] = Time.new.to_i\n params[\"oauth_signature\"] = CGI::escape(generate_oauth_signature(params, url))\n\n query_string = URI.encode_www_form(params)\n\n \"#{url}?#{query_string}\"\n end",
"def callback_url\n auth_endpoint_callback_url(org: @organization.id)\n end",
"def redirect_uri\n @redirect_uri ||= root_url[0..-2] + oauth_callback_path\n end",
"def rc_facebook_authorize_redirect\n unless rc_facebook_in_canvas?\n redirect_to @rc_facebook_authorize_url\n else\n rc_facebook_js_redirect(@rc_facebook_authorize_url,\n rc_facebook_authorize_body)\n end\n end",
"def redirect_url(callback_url)\n signin_url(callback_url)\n end",
"def authorization_url\n url = \"#{host}/OAuth2AccessRequest.action?response_type=code&client_id=#{@client_id}\"\n url += \"&redirect_uri=#{Addressable::URI.escape(@redirect_uri)}\" if @redirect_uri\n url += \"&state=#{@state}\" if @state\n url\n end",
"def authorize_url\n @oauth_client.auth_code.authorize_url(:redirect_uri => @redirect_uri, :scope => site_url)\n end",
"def redirect_to_url(callback_url)\n client_details = \"client_id=#{self.client_id}\"\n return callback_url + \"?#{client_details}\"\n end",
"def get_auth_url(service)\n config = get_service_config(service)\n request_id = get_request_token(service)\n\n url = String.new\n url << config[:authorize_url]\n url << \"?response_type=code\"\n url << \"&client_id=\"\n url << config[:client_id]\n url << \"&redirect_uri=\"\n url << config[:redirect_uri]\n url << \"&scope=\"\n url << config[:scope]\n url << \"&state=\"\n url << request_id\n\n url\n end",
"def wepay_authorization_url(redirect_uri)\n WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\nend",
"def wepay_authorization_url(redirect_uri)\n\t WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def get_access_url\n @request_token = @client.request_token\n token = @request_token.token\n secret = @request_token.secret\n\n \"http://www.fitbit.com/oauth/authorize?oauth_token=#{token}\"\n end",
"def generateConsentFlowUrl(endpoint=\"/oauth/authorize\")\n \"#{@fqdn}#{endpoint}?client_id=#{@client_id}&scope=#{@scope}&redirect_uri=#{@redirect_uri}\"\n end",
"def generateConsentFlowUrl(opts={})\n scope = Array(opts[:scope] || @scope).join(\",\")\n suburl = (opts[:suburl] || @auth_url)\n redirect = (opts[:redirect] || @redirect)\n \"#{@fqdn}#{suburl}?client_id=#{CGI.escape(@client_id)}&scope=#{CGI.escape(scope)}&redirect_uri=#{CGI.escape(redirect)}\"\n end",
"def url_to_social_login( provider_key, on_success = nil )\n provider = Aerogel::Auth.providers[provider_key] || {}\n origin = on_success || params['on_success']\n query_string = origin ? \"?origin=#{origin}\" : ''\n \"/auth/#{provider_key}#{query_string}\"\nend",
"def redirect_url\n\t\tcallback_url\n\tend",
"def generate_url(require: nil)\n @state = Digest::MD5.hexdigest(\"#{@app}::#{@uuid.generate}\")\n params = {\n app: @app,\n state: @state,\n redirectUri: @redirect_uri\n }\n params = params.merge(require: 'profile') if require == :profile\n params = params.to_query\n \"#{self.class.base_uri}/auth/providers/#{@provider}/login?#{params}\"\n end",
"def authorize_url(client_id, redirect_uri, options={})\n \"https://#{API_URL}/oauth/authorize?#{build_query(options.merge(:client_id => client_id, :redirect_uri => redirect_uri))}\"\n end",
"def oauth_authorize\n redirect_to facebook_client.authorize(oauth_callback_url)\n end",
"def oauth\n connector = StripeOauth.new(current_customer)\n\n logger.debug(connector)\n\n # logger.debug(\"===> #{stripe_confirm_url}\")\n\n url, error = connector.oauth_url(redirect_uri: stripe_confirm_url)\n\n if url.nil?\n flash[:alert] = error\n redirect_to customer_path(current_customer)\n else\n redirect_to url\n end\n end",
"def wepay_authorization_url(redirect_uri)\n\t #Wefarm::Application::WEPAY.oauth2_authorize_url(OAUTH_REDIRECT_URI + self.id.to_s, self.email, self.name)\n\t Wefarm::Application::WEPAY.oauth2_authorize_url(redirect_uri, self.email, self.name)\n\tend",
"def sso_integration_callback_url\n # Usually http://example.com/auth/:system_name/callback\n url = callback_url(query: {})\n\n case kind\n when 'auth0'\n # e.g. http://example.com/auth/invitations/auth0/auth0_123abc/callback\n invitation_signup = client.callback_url(\"#{base_url}/invitations\")\n\n [url, invitation_signup].join(', ')\n else\n url\n end\n end",
"def get_user_auth_url\n @oauth_token = request_oauth_token\n return @authorize_url + \"?oauth_token=\" + @oauth_token[\"oauth_token\"]\n rescue\n puts $! if @@verbose\n return nil\n end",
"def get_authurl\n\t\tlogger.debug \"D, #{__method__.to_s}\"\n\t\tparams = {\n \"client_id\" => @client_id,\n \"response_type\" => \"code\",\n \"redirect_uri\" => @redirect_uri,\n \"prompt\" => \"consent\"\n }\n auth_uri = URI::Generic.new(\"https\", nil, @auth_url, nil, nil, \"authorize\", \n \t\t\t\t\t\t\t nil, nil, nil)\n auth_uri.query = URI.encode_www_form(params)\n logger.debug \"D, #{__method__.to_s}, #{auth_uri.to_s}\"\n return auth_uri.to_s\n\tend",
"def openid_callback_url\n \"#{request.protocol}://#{request.host}#{Merb::Router.url(:openid)}\"\n end",
"def new\n next_url = AppConfig.facebook_app_url + \"facebook/callback\"\n #next_url += (\"?request_ids=\" + params[:request_ids]) unless params[:request_ids].nil?\n @auth_url = Authentication.auth.client.web_server.authorize_url(\n :redirect_uri => next_url, :scope => AppConfig.facebook_perms\n )\n end",
"def get_auth_url(use_callback_flow=true)\n if use_callback_flow\n service_name = service_name_for_user(DATASOURCE_NAME, @user)\n @client.authorization.state = CALLBACK_STATE_DATA_PLACEHOLDER.sub('user', @user.username)\n .sub('service', service_name)\n else\n @client.authorization.redirect_uri = REDIRECT_URI\n end\n @client.authorization.authorization_uri.to_s\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def callback_url\n options[:redirect_uri] || (full_host + script_name + callback_path)\n end",
"def exe_canvas_page_url(protocol = nil)\n exeshnik.canvas_page_url(protocol || request.protocol)\n end",
"def authorize_url(client_id=nil, redirect_uri=@@config.redirect_uri, opts={})\n raise \"client_id required to authorize url. Pass with Geoloqi.config\" unless client_id\n url = \"#{oauth_url}?response_type=code&client_id=#{Rack::Utils.escape client_id}&redirect_uri=#{Rack::Utils.escape redirect_uri}\"\n url += \"&#{Rack::Utils.build_query opts}\" unless opts.empty?\n url\n end",
"def token_url\n \"#{sk_url}/oauth/token\"\n end",
"def signed_open_id_connect_initiation_url(login_hint:)\n URI(open_id_connect_initiation_url).tap do |uri|\n uri.query = {\n iss: Rails.application.secrets.issuer,\n login_hint: login_hint,\n target_link_uri: target_link_uri\n # lti_message_hint: 'xxx'\n }.to_query\n end\n end",
"def oauth\n session[:return_to_url] = params[:redirect_after_login] if params[:redirect_after_login]\n login_at(auth_params[:provider])\n end",
"def token_url(params = nil)\n connection.build_url(oauth_token_path, params).to_s\n end",
"def authorize_url\n request_token.authorize_url\n end",
"def auth_code_url(options={})\n options = default_auth_code_url_options(options)\n\n if self.options[:raise_errors]\n check_redirect_uri!(options)\n end\n\n @redirect_uri = options[:redirect_uri]\n\n self.auth_code.authorize_url(options)\n end",
"def get_authorization_url\n $LOG.i \"requesting authorization URL\"\n \n @oauth2_client.auth_code.authorize_url(:redirect_uri => @config.redirect_uri)\n end",
"def exe_callback_url(protocol = nil)\n exeshnik.callback_url(protocol || request.protocol)\n end",
"def auth_url\n client.authorization.authorization_uri(state: '', approval_prompt: :force, access_type: :offline, user_id: client_email).to_s\n end",
"def facebook\n oauth_info = OauthToken.get_oauth_info('facebook')\n session[:redirect_after_oauth] = params[:redirect_to] ? params[:redirect_to] : nil\n redirect_to \"https://graph.facebook.com/oauth/authorize?client_id=#{oauth_info['consumer_key']}\"+\n \"&redirect_uri=#{oauth_info['callback']}\"+\n \"&scope=read_stream,publish_stream,publish_actions,offline_access,user_likes,user_status,\"+\n \"user_birthday,user_relationships,user_relationship_details,\"+\n \"email,user_checkins,sms,user_online_presence\"+\n \"&display=touch\"\n end",
"def build_authorization_link\n @oauth.auth_code.authorize_url(\n redirect_uri: @redirect_uri,\n scope: 'read_write',\n initial_view: 'signup'\n )\n end",
"def get_authorize_url\n return get_request_token.authorize_url\n end",
"def authorize_url\n polymorphic_url([ @workspace, :twitter_account ], :action => 'authorize')\n end",
"def get_callback_url(course, assessment, submission, dave)\n begin\n if Rails.env.development?\n hostname = request.base_url\n else\n hostname = \"https://\" + request.host\n end\n rescue\n hostname = `hostname`\n hostname = \"https://\" + hostname.strip\n end\n\n callback_url = (RESTFUL_USE_POLLING) ? \"\" :\n \"#{hostname}/courses/#{course.name}/assessments/#{assessment.name}/autograde_done?dave=#{dave}&submission_id=#{submission.id}\"\n COURSE_LOGGER.log(\"Callback: #{callback_url}\")\n\n callback_url\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n client.auth_code.authorize_url(:redirect_uri => REDIRECT_URI,\n :scope => SCOPES.join(' '))\n end",
"def authentication_url(params={})\n @request_token.authorize_url params\n end",
"def app_scheme_url(key_id)\n return_uri = \"https://#{request.host}\"\n params = \"id=#{key_id}&r=#{return_uri}&n=#{$partner_id}\"\n s = OpenSSL::HMAC.hexdigest('SHA256', $hmac_secret, params)\n return \"#{$app_scheme}use-key?#{params}&s=#{s}\"\nend",
"def build_url(redirect_uri,type)\n path = redirect_uri.split('#',2).first if redirect_uri.include? \"#\"\n path = redirect_uri.split('?',2).first if redirect_uri.include? \"?\"\n case type\n when \"token\"\n return path + \"?access_token=#{self.access_token}\"\n when \"code\"\n return path + \"?request_token=#{self.code}\"\n end\n end",
"def screen_uri(params = {}, sn = screen_name)\n uri = URI(\"https://\" + app.captureui_addr)\n uri.path = \"/oauth/#{sn}\"\n uri.query = URI.encode_www_form(params)\n uri.to_s\n end",
"def get_login_url\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n login_url = client.auth_code.authorize_url(:redirect_uri => authorize_url)\n end",
"def authorize_url(params={})\n # response_type param included by default by using the OAuth 2.0\n # auth_code strategy\n # client_id param included automatically by the OAuth 2.0 gem\n params[:state] ||= state\n params[:redirect_uri] ||= \"http://localhost\"\n oauth2_client.auth_code.authorize_url(params)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end",
"def get_connect_url(guid, display=nil, signup=\"facebook\", logged_uri=nil)\n return false if guid.nil?\n url = \"http://www.beintoo.com/connect.html?guid=#{guid}&apikey=#{self.apikey}&redirect_uri=#{self.redirect_uri}\"\n unless display.nil?\n url += \"&display=#{display}\"\n end\n url += \"&signup=#{signup}\"\n unless logged_uri.nil?\n url += \"&logged_uri=#{logged_uri}\"\n end\n url\n end",
"def authorize_url(ticket = nil)\n ticket = self.ticket unless ticket\n \"#{ api.base_url }/auth/#{ ticket }\"\n end",
"def oauth_login_path name = nil\n oauth_instance(name).login_path\n end",
"def getLoginUrl(context=nil)\n url = baseurl + \"wlogin.srf?appid=#{appid}\"\n url += \"&alg=#{securityalgorithm}\"\n url += \"&appctx=#{CGI.escape(context)}\" if context\n url\n end",
"def authorize_url\n @connection.authorize_url\n end",
"def openid_redirect_uri; end",
"def auth_url\n \"#{@url}/auth/realms/#{@realm}/protocol/openid-connect/auth\"\n end",
"def get_request_auth_code_url\n URI.encode(\"https://#{@subdomain}.zendesk.com/oauth/authorizations/new?response_type=code&redirect_uri=#{@redirect_uri}/&client_id=#{@unique}&scope=read%20write\")\n end",
"def omniauth_login_url(provider)\n \"#{Rails.configuration.relative_url_root}/auth/#{provider}\"\n end",
"def build_code_url(params={})\n url = URI::HTTPS.build(:host => host,\n :path => authorize_path,\n :query => encoded_body(params))\n url.to_s\n end"
] |
[
"0.77673143",
"0.7463259",
"0.73362935",
"0.727917",
"0.72202975",
"0.72021705",
"0.7188308",
"0.71678716",
"0.7117492",
"0.7117399",
"0.6944495",
"0.68771803",
"0.68126243",
"0.6753707",
"0.67356294",
"0.67098683",
"0.667351",
"0.6668717",
"0.6666714",
"0.66426975",
"0.66381484",
"0.66373336",
"0.66238374",
"0.6619207",
"0.66043335",
"0.6568138",
"0.6547759",
"0.65451366",
"0.654504",
"0.6523723",
"0.6509611",
"0.65016246",
"0.6498263",
"0.649529",
"0.64868665",
"0.6479283",
"0.6470504",
"0.6464015",
"0.6449323",
"0.6431934",
"0.64249545",
"0.6422363",
"0.6420442",
"0.63671863",
"0.635622",
"0.634901",
"0.63482094",
"0.6342612",
"0.63425756",
"0.6312968",
"0.6295871",
"0.62917596",
"0.62828594",
"0.6282393",
"0.62803346",
"0.62802285",
"0.62720317",
"0.62687194",
"0.62653327",
"0.62635183",
"0.6263441",
"0.6250467",
"0.622063",
"0.6217762",
"0.6190488",
"0.6175609",
"0.6175609",
"0.61728656",
"0.6170982",
"0.61601144",
"0.6152673",
"0.61373585",
"0.6124293",
"0.6100094",
"0.6080978",
"0.6075573",
"0.6069826",
"0.6059737",
"0.6055294",
"0.60536927",
"0.6030741",
"0.6027716",
"0.60197973",
"0.6019562",
"0.6011169",
"0.60100543",
"0.5999677",
"0.5992346",
"0.5988214",
"0.59854215",
"0.5984428",
"0.59740967",
"0.59685624",
"0.59673846",
"0.59538794",
"0.5935281",
"0.59333485",
"0.5921471",
"0.59190834",
"0.5914922"
] |
0.77077496
|
1
|
This will fetch the access_token given the code from the call_back of dialog_url
|
def access_token(code)
token_url = "https://graph.facebook.com/oauth/access_token?client_id="+@app_id+"&redirect_uri="+canvas_url+"&client_secret="+app_secret+"&code="+code
uri = URI.parse(URI.encode(token_url))
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
access_token = response.body
if access_token.index('{')==0
return nil
else
return access_token[13...access_token.length]
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_access_token(code)\n @code = code\n @access_token ||= client.web_server.get_access_token( @code, :redirect_uri => callback_url)\n end",
"def get_token(code)\n option = {\n url: \"#{self.bot_origin}/oauth/token\",\n header: {\n \"Content-Type\": \"application/x-www-form-urlencoded\",\n },\n param: {\n grant_type: \"authorization_code\",\n client_id: self.client_id,\n client_secret: self.client_secret,\n redirect_uri: self.redirect_uri,\n code: code\n }\n }\n response = post(option)\n json = JSON.parse(response.body)\n json[\"access_token\"]\n end",
"def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end",
"def fetch_access_token(code)\n access_token = @oauth.auth_code.get_token(\n code,\n redirect_uri: @redirect_uri\n )\n { gocardless_access_token: access_token.token,\n gocardless_organisation_id: access_token['organisation_id'] }\n end",
"def get_access_token_from_API()\n # eventbrite embeds access code in the link it \"returns\"\n \taccess_code = extract_access_code_from_link()\n\n # once user allows access, exchange for access token\n access_token_JSON = exchange_code_for_token( access_code ) \n access_token = parse_for_access_token( access_token_JSON )\n return access_token\n end",
"def get_access_token_from_code(code,redirect_url)\n @access_token ||= client.auth_code.get_token(code, :redirect_uri => redirect_url, :parse => :query)\n end",
"def get_access_token_from_code(code)\n client = HTTPClient.new\n begin\n url = \"#{GRAPH_ROOT}/oauth/access_token\"\n params = { client_id: @app_id, redirect_uri: @redirect_uri, client_secret: @app_secret, code: code }\n result = client.get_content url, params\n pairs = result.split '&'\n pairs.each do |pair|\n key, value = pair.split '='\n if key == 'access_token'\n return @access_token = value\n end\n end\n rescue HTTPClient::BadResponseError => e\n raise e\n rescue => e\n end\n end",
"def fetch_token(code, redirect_uri)\n @access_token_obj = @auth_client.auth_code.get_token(code, {\n :redirect_uri => redirect_uri,\n :token_method => :post\n })\n end",
"def authorize(callback_url, code)\n data = open(\"#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}\").read\n \n # The expiration date is not necessarily set, as the app might have\n # requested offline_access to the data\n match_data = data.match(/expires=([^&]+)/)\n @expires = match_data && match_data[1] || nil\n \n # Extract the access token\n @access_token = data.match(/access_token=([^&]+)/)[1]\n end",
"def authorize(callback_url, code)\n data = open(\"#{BASE_URL}/oauth/access_token?client_id=#{app_id}&redirect_uri=#{CGI.escape callback_url}&client_secret=#{app_secret}&code=#{CGI.escape code}\").read\n \n # The expiration date is not necessarily set, as the app might have\n # requested offline_access to the data\n match_data = data.match(/expires=([^&]+)/)\n @expires = match_data && match_data[1] || nil\n \n # Extract the access token\n @access_token = data.match(/access_token=([^&]+)/)[1]\n end",
"def get_access_token(code:, redirect_uri: nil)\n query = {\n code: code,\n client_id: @client_id,\n client_secret: @client_secret,\n redirect_uri: redirect_uri\n }.compact\n response = HTTParty.get(\"https://slack.com/api/oauth.v2.access\", query: query)\n JSON.parse(response.body, symbolize_names: true)\n end",
"def get_access_token(code, options={})\n response = @client.request(@client.options[:access_token_method], @client.access_token_url, access_token_params(code, options))\n parse_token_response(response)\n end",
"def process_callback(params,session)\n args = {}\n args.merge!({:code => params[:code]}) if params[:code]\n options = {\n :access_token_path => @token_url,\n :access_token_method => :post\n }\n @access_token = self.get_access_token(args, options)\n end",
"def get_token\n oauth = LinkedIn::OAuth2.new\n url = oauth.auth_code_url\n visit url\n\n form = find('form', class: 'grant-access')\n within form do\n fill_in('session_key-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_email)\n fill_in('session_password-oauth2SAuthorizeForm', with: Rails.configuration.linkedin_password)\n end\n\n find(\"input[type=submit]\").hover\n find(\"input[type=submit]\").trigger(:click)\n\n print \"fetching code\"\n count = 0\n while !page.current_url.include?('code=')\n count += 1\n print \".\" if count & 50 == 0\n end\n\n puts\n url = page.current_url\n code = CGI.parse(URI.parse(url).query)['code'].first\n\n acess_token = oauth.get_access_token(code)\n puts acess_token\n end",
"def get_access_token(code, _options = {})\n conn = Faraday.new(url: base_url) do |faraday|\n faraday.request :url_encoded\n faraday.adapter Faraday.default_adapter\n end\n params = access_token_params(code)\n conn.post do |req|\n req.url \"/api/oauth2/token\"\n req.body = params\n req.headers[\"Accept\"] = \"application/json\"\n end\n end",
"def request_token(code)\n params = {\n code: code,\n client_id: client_id,\n client_secret: client_secret,\n redirect_uri: redirect_uri,\n grant_type: 'authorization_code'\n }.to_param\n\n header = { 'Content-Type' => 'application/x-www-form-urlencoded' }\n uri = URI(TOKEN_URL)\n net_http = Net::HTTP.new(uri.host, uri.port)\n net_http.use_ssl = true\n request = Net::HTTP::Post.new(uri.request_uri, header)\n request.body = params\n response = net_http.request(request)\n if response.code == '200'\n data = JSON.load(response.body)\n @access_token = data['access_token']\n @refresh_token = data['refresh_token']\n @expires_in = data['expires_in']\n else\n raise StandardError.new(response.body)\n end\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n # :authorize_url => \"/auth/office365/callback\")\n \n token = client.auth_code.get_token(auth_code,\n :redirect_uri => office365_callback_url,\n :scope => SCOPES.join(' '))\n end",
"def get_token(code)\n uri = URI.parse(\"https://api.dropboxapi.com/oauth2/token\")\n\n payload = URI.encode_www_form(\n client_id: DROPBOX_APP_KEY,\n client_secret: DROPBOX_APP_SECRET,\n code: code,\n grant_type: \"authorization_code\",\n redirect_uri: SHOTTY_CALLBACK_URL,\n )\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = uri.scheme == \"https\"\n\n response = http.post(uri.path, payload, {})\n\n body = JSON.parse(response.body)\n\n body[\"access_token\"]\nend",
"def oauth2_callback\n # Swap Auth token for an access token\n token = oauth2_client.auth_code.get_token(params[:code])\n\n # Remember the access token\n session[:access_token] = token.token\n redirect_to repo_index_path\n end",
"def process_callback(params,session)\n args = {}\n args.merge!({:code => params[:code]}) if params[:code]\n options = {\n :token_url => @token_path,\n :token_method => :post\n }\n @access_token = self.get_access_token(args, options)\n end",
"def find_oauth_access_token\n end",
"def get_access_token_from_auth_code(auth_code, client_id, client_secret, redirect_uri, environment = nil)\n environment ||= \"mypurecloud.com\"\n\n tokenFormData = {\n \"grant_type\" => \"authorization_code\",\n \"code\" => auth_code,\n \"redirect_uri\" => redirect_uri\n }\n\n tokenResponse =JSON.parse RestClient.post \"https://#{client_id}:#{client_secret}@login.#{environment}/token\", tokenFormData\n\n return tokenResponse['access_token'];\n end",
"def get_access_tokens(authorization_grant_code)\n # headers = { 'Content-Type': 'application/x-www-form-urlencoded' } # turns out didn't need this\n params = {\n 'grant_type': 'authorization_code',\n 'access_type': 'offline',\n 'code': authorization_grant_code,\n 'client_id': client_id,\n 'redirect_uri': redirect_uri\n }\n response = HTTParty.post(\n 'https://api.tdameritrade.com/v1/oauth2/token',\n body: params\n )\n\n if response.status == 200\n @access_token = response[\"access_token\"]\n @refresh_token = response[\"refresh_token\"]\n end\n\n response\n end",
"def get_access_token(authz_code = nil)\n if @config.grant_type == 'client_credentials'\n $LOG.i \"getting access token\"\n\t @access_token = @oauth2_client.client_credentials.get_token\n $LOG.i \"got access token\", @access_token\n else\n $LOG.i \"getting access and refresh token pair\"\n\t @access_token = @oauth2_client.auth_code.get_token(authz_code, :redirect_uri => @config.redirect_uri)\n $LOG.i \"got access and refresh token pair\", @access_token\n end\n\n\trefresh_config_from_access_token\n\n\t@access_token\n end",
"def get_access_token(auth_code)\n @access_token = @oauth_client.auth_code.get_token(auth_code, :redirect_uri => @redirect_uri)\n @token = @access_token.token\n @refresh_token = @access_token.refresh_token\n @token_expires_at = @access_token.expires_at\n end",
"def request_tokens(auth_code)\n @token = @oauth_client.auth_code.get_token auth_code, redirect_uri: @url\n tokens\n end",
"def step2\n initialize_vars\n url = \"#{@oauth_vars[:token_url]}?code=#{params[:code]}&grant_type=authorization_code&client_id=#{@oauth_vars[:client_id]}&client_secret=#{@oauth_vars[:client_secret]}&response_type=code&redirect_uri=#{@redirect_uri}\"\n rep = JSON.parse(get_json_from_https(url))\n session[:access_token] = rep[\"access_token\"]\n\n do_API_call\n end",
"def oauth_complete(code)\n # Let's compile the API URL we're calling.\n url = PUTIO_BASE_URL + \"/oauth2/access_token?client_id=%i&client_secret=%s&grant_type=authorization_code&redirect_uri=%s&code=%s\" % [@client_id, @application_secret, @redirect_uri, code]\n \n # And call it.\n response = Curl::Easy.perform(url) do |req|\n req.headers['Accept'] = 'application/json'\n end\n\n # Use Crack to parse the JSON\n response = JSON.parse(response.body_str)\n\n # And use Hashie to present it.\n response = Hashie::Mash.new(response)\n\n # Save it locally.\n @access_token = response.access_token\n\n # Return it\n response\n end",
"def get_access_token(code)\n # upstream methods will throw errors if needed\n if info = get_access_token_info(code)\n string = info['access_token']\n end\n end",
"def get_oauth_access_token(session_code)\n result = Octokit.exchange_code_for_token(session_code, CLIENT_ID, CLIENT_SECRET)\n result[:access_token]\n end",
"def get_access_token(code)\n response = self.class.get('/oauth/access_token', query(code))\n # Something went wrong either wrong configuration or connection\n unless response.success?\n Rails.logger.error 'Omniauth::Facebook.get_access_token Failed'\n fail Omniauth::ResponseError, 'errors.auth.facebook.access_token'\n end\n response.parsed_response['access_token']\n end",
"def get_new_access_token\n client, auth = google_api_client_auth\n print(\"1. Open this page:\\n%s\\n\\n\" % auth.authorization_uri)\n print(\"2. Enter the authorization code shown in the page: \")\n system( 'open \"'+auth.authorization_uri+'\"' )\n auth.code = $stdin.gets.chomp\n auth.fetch_access_token!\n auth.access_token\n end",
"def oauth_data(code:)\n res = uphold_conn.post do |req|\n req.url UPHOLD_AUTHENTICATION_PATH\n req.headers['Authorization'] = ActionController::HttpAuthentication::Basic.encode_credentials(client_id, client_secret)\n req.respond_to? :json, content_type: /\\b(?i:json)$/\n req.headers['Content-Type'] = 'application/x-www-form-urlencoded'\n req.body = URI.encode_www_form({code: code, grant_type: 'authorization_code'})\n end\n JSON.parse(res.body, symbolize_names: true).tap do |body|\n @access_token = body[:access_token]\n end\n end",
"def callback\n # Authentication redirects here\n code = params[:code]\n\n # Used in the template\n @name = auth_hash.info.name\n @email = auth_hash.info.email\n\n # Request an access token\n result = acquire_access_token(code, ENV['REPLY_URL'])\n\n # Associate token/user values to the session\n session[:access_token] = result.access_token\n session[:name] = @name\n session[:email] = @email\n\n # Debug logging\n logger.info \"Code: #{code}\"\n logger.info \"Name: #{@name}\"\n logger.info \"Email: #{@email}\"\n logger.info \"[callback] - Access token: #{session[:access_token]}\"\n end",
"def fetch_access_token\n uri = URI.parse Sendible::API::URL + \"/v1/auth?app_id=#{CGI.escape(Sendible.application_id)}&access_key=#{CGI.escape(access_key)}\"\n get = Net::HTTP::Get.new(uri.request_uri)\n response = Net::HTTP.start(uri.host, uri.port) do |http|\n http.request(get)\n end\n response.body\n end",
"def get_token(code)\n url = \"#{sk_url}/oauth/token?code=#{code}&client_id=#{@@conf['id']}&client_secret=#{@@conf['secret']}&redirect_uri=#{oauth_redirect_uri}\"\n c = Curl::Easy.perform(url)\n # grab token from response body, containing json string\n ActiveSupport::JSON.decode(c.body_str)\n end",
"def exchange_code(authorization_code)\n client = Google::APIClient.new\n client.authorization = client_secrets\n client.authorization.code = authorization_code\n\n begin\n client.authorization.fetch_access_token!\n return client.authorization\n rescue Signet::AuthorizationError\n raise CodeExchangeError.new(nil)\n end\nend",
"def oauth2_access_token(code, options={})\n query = {\n :client_id => Config.client_id,\n :client_secret => Config.client_secret,\n :grant_type => 'authorization_code',\n :redirect_uri => Config.redirect_uri,\n :code => code\n }\n return send_request(:POST, PATH[:oauth2_access_token], query, false, options)\n end",
"def acquire_access_token(auth_code, reply_url)\n AUTH_CTX.acquire_token_with_authorization_code(\n auth_code,\n reply_url,\n CLIENT_CRED,\n GRAPH_RESOURCE)\n end",
"def data_acc_token(code, client_id, client_secret, grant_type=\"authorization_code\", redirect_uri=REDIRECT_URL)\n \"client_id=#{client_id}&client_secret=#{client_secret}&grant_type=#{grant_type}&code=#{code}&redirect_uri=#{redirect_uri}\"\n end",
"def process_callback(params,session)\n args = {}\n args.merge!({:oauth_verifier => params[:oauth_verifier], :request_token => session[:request_token], :request_token_secret => session[:request_token_secret]})\n args.merge!({:code => params[:code]}) if params[:code]\n @access_token = self.get_access_token(args)\n end",
"def request_access_token(code, params={})\n params[:redirect_uri] ||= \"http://localhost\"\n opts = {}\n opts[:mode] = :query\n opts[:param_name] = \"oauth2_access_token\"\n @access_token = oauth2_client.auth_code.get_token(code, params, opts)\n rescue OAuth2::Error => e\n raise LinkedIn::Errors::UnauthorizedError.new(e.code), e.description\n end",
"def request_access_token\n # An `OAuth::Consumer` object can make requests to the service on\n # behalf of the client application.\n\n # Ask service for a URL to send the user to so that they may authorize\n # us.\n request_token = CONSUMER.get_request_token\n authorize_url = request_token.authorize_url\n\n # Launchy is a gem that opens a browser tab for us\n Launchy.open(authorize_url)\n\n # Because we don't use a redirect URL; user will receive a short PIN\n # (called a **verifier**) that they can input into the client\n # application. The client asks the service to give them a permanent\n # access token to use.\n puts \"Login, and type your verification code in\"\n oauth_verifier = gets.chomp\n access_token = request_token.get_access_token(\n :oauth_verifier => oauth_verifier\n )\nend",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => \"https://login.microsoftonline.com\",\n :authorize_url => \"/common/oauth2/authorize\",\n :token_url => \"/common/oauth2/token\")\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :resource => 'https://outlook.office365.com')\n\n access_token = token\n end",
"def fetch_access_token(request_token, verification_code)\n access_token_req = PaypalService::DataTypes::Permissions.create_get_access_token(\n {\n request_token: params[:request_token],\n verification_code: params[:verification_code]\n }\n )\n access_token_res = paypal_permissions.do_request(access_token_req)\n end",
"def process_callback(params, session)\n args = {}.tap do |a|\n a[:code] = params[:code] if params[:code]\n end\n\n get_access_token(args, token_url: @token_path, client_id: @client_id)\n end",
"def oauth_check_authorization\n code = params[:code]\n session[:access_token] = facebook_client.check_authorization code,\n :redirect_uri => oauth_callback_url\n end",
"def handle_callback(code)\n resp = Douban.get_access_token(code, :redirect_uri => DOUBAN_CALLBACK)\n save_config(resp)\n end",
"def get_access\n path = '/v3/oauth/authorize'\n data = \"consumer_key=#{Consumer_key}&code=#{Token}\"\n return pocket_api(path,data)\nend",
"def create\n client.authorization_code = params[:code]\n access_token = client.access_token!\n puts access_token\n end",
"def exchange_code_for_token(api, client, auth_code)\n client.auth_code.get_token(auth_code, redirect_uri: api.oauth_redirect)\n rescue OAuth2::Error => e\n fail_with_oauth_error(\n \"Failed to exchange auth_code for token (code=#{e.response.status})\",\n e.response\n )\n end",
"def get_access_token\n\n\t\t\thost = get_host 'gateway'\n\t\t\tusername = get_credential 'username'\n\t\t\tpassword = get_credential 'password'\n\t\t\t\n\t\t\turl = host + 'partner/authorize'\n\t\t\t#return url\n\t\t\tdata = {username: username, password: password}\n\t\t\tresponse = RestClient.post url,data\n\t\t\tif response.code != 201\n\t\t\t\treturn {success: false, error: JSON[response.body]}\n\t\t\tend\n\t\t\tJSON[response.body][\"access_token\"]\n\t\tend",
"def fetch_access_token! options = {}\n token_hash = fetch_access_token options\n if token_hash\n # No-op for grant types other than `authorization_code`.\n # An authorization code is a one-time use token and is immediately\n # revoked after usage.\n self.code = nil\n self.issued_at = Time.now\n update_token! token_hash\n end\n token_hash\n end",
"def exchange_code(authorization_code)\n\t\tclient_secrets = Google::APIClient::ClientSecrets.load(CLIENT_SECRET_PATH)\n client = client_secrets.to_authorization \n client.update!(redirect_uri: 'postmessage')\n client.code = authorization_code\n \n\t begin\n\t # client.authorization.fetch_access_token!\n\t client.fetch_access_token!\n\t return client\n\t rescue Signet::AuthorizationError\n\t raise CodeExchangeError.new(nil)\n\t end\n\tend",
"def oauth_url_token(code)\n # return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&grant_type=authorization_code&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}&redirect_uri=#{oauth_redirect_uri}\" \n return \"#{$SETTINGS[:oauth_server_url_token]}?code=#{code}&client_id=#{$SETTINGS[:oauth_client_id]}&client_secret=#{$SETTINGS[:oauth_client_secret]}\" \n end",
"def get_access_token(code, options={})\n options[:grant_type] ||= \"authorization_code\"\n params = access_token_params.merge(options)\n response = post(\"https://www.douban.com/service/auth2/token\",\n params.merge(:code => code),\n raw=false)\n end",
"def get_token_from_code(auth_code)\n OUTLOOK_CLIENT.auth_code.get_token(auth_code,\n :redirect_uri => OUTLOOK_REDIRECT_URI,\n :scope => OUTLOOK_SCOPES.join(' '))\n end",
"def callback\n\n client = Signet::OAuth2::Client.new(client_options)\n client.code = params[:code]\n\n response = client.fetch_access_token!\n\n session[:authorization] = response\n redirect_to '/leagues/calendar/events/federicobucci504@gmail.com'\n end",
"def get_token_from_code(auth_code)\n client = OAuth2::Client.new(CLIENT_ID,\n CLIENT_SECRET,\n :site => 'https://login.microsoftonline.com',\n :authorize_url => '/common/oauth2/v2.0/authorize',\n :token_url => '/common/oauth2/v2.0/token')\n\n token = client.auth_code.get_token(auth_code,\n :redirect_uri => authorize_url,\n :scope => SCOPES.join(' '))\n end",
"def get_access_token\n uri = URI.parse(@token_url)\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.request_uri)\n auth = Base64.encode64(@login + ':' + @password).gsub(\"\\n\", \"\")\n req['Authorization'] = \"Basic #{auth}\"\n send = 'grant_type=client_credentials'\n req.body = send\n res = http.request(req)\n if res.code == \"200\"\n data = res.body\n result = JSON.parse(data)\n @access_token = result['access_token']\n else\n puts \"Invalid getting access token\"\n exit\n end\n end",
"def exchange_code_with_access_token(code)\n response = @client.post(\"#{@base_url}/oauth/access_token\", access_token_params(code))\n data = JSON.parse(response.body)\n access_token = data[\"access_token\"]\n # binding.pry\n if(access_token)\n set_user_instagram_profile(data, access_token)\n \"success\" \n else\n \"failure\"\n end\n end",
"def build_access_token\n verifier = request.params[\"code\"]\n client.auth_code.get_token(verifier, token_params.to_hash(:symbolize_keys => true), deep_symbolize(options.auth_token_params))\n end",
"def authorize_code(authorization_code)\n client.authorization.code = authorization_code\n client.authorization.fetch_access_token!\n client.authorization.refresh_token ||= oauth_data[:refresh_token]\n oauth_data[:refresh_token] = client.authorization.refresh_token\n end",
"def callback\r\n\t\t#get the access token from facebook with your code\r\n\t\tsession['access_token'] = session['oauth'].get_access_token(params[:code])\r\n\t\tredirect_to '/mfacebook/menu'\r\n\tend",
"def process_callback(params, _session)\n args = {}.tap do |a|\n a[:code] = params[:code] if params[:code]\n end\n\n get_access_token(args, token_url: token_url, mode: mode,\n param_name: param_name, parse: parse)\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args[:code] = params[:code] if params[:code]\n get_access_token(args)\n end",
"def callback\n\t\t#get the access token from facebook with your code\n\t\tsession['access_token'] = session['oauth'].get_access_token(params[:code])\n\t\tredirect_to '/facebooks/menu'\n\tend",
"def codeExchange(code)\n # Upgrade the code into a token object.\n $authorization.code = code\n $authorization.fetch_access_token!\n $client.authorization = $authorization\n\n # TODO: move into verify_token function\n id_token = $client.authorization.id_token\n encoded_json_body = id_token.split('.')[1]\n\n # Base64 must be a multiple of 4 characters long, trailing with '='\n encoded_json_body += (['='] * (encoded_json_body.length % 4)).join('')\n json_body = Base64.decode64(encoded_json_body)\n body = JSON.parse(json_body)\n\n # You can read the Google user ID in the ID token.\n # \"sub\" represents the ID token subscriber which in our case\n # is the user ID. This sample does not use the user ID.\n gplus_id = body['sub']\n puts \"User ID: \"\n puts gplus_id.inspect\n\n # Serialize and store the token in the user's session.\n token_pair = TokenPair.new\n token_pair.update_token!($client.authorization)\n\n puts token_pair.inspect\nend",
"def access_token\n @access_token ||= begin\n if oauth_options[:oauth_verifier]\n request_token.get_access_token(:oauth_verifier => oauth_options[:oauth_verifier])\n else\n request_token.get_access_token\n end\n end\n end",
"def retrieve_access_token(authorization_code: nil)\n path = path_for(:access_token)\n\n grant_type = get_grant_type(authorization_code.present?)\n body = request_body(\n grant_type: grant_type,\n authorization_code: authorization_code\n )\n\n self.class.post(path, body: body.to_json)\n end",
"def access_token\n end",
"def process_callback(params, session)\n args = {}.tap do |a|\n a[:code] = params[:code] if params[:code]\n end\n\n get_access_token(args, token_url: @request_token_path, token_method: :post)\n end",
"def authenticate!(client_id, client_secret, code)\n response = Faraday.post \"https://github.com/login/oauth/access_token\", {client_id: client_id, client_secret: client_secret, code: code}, {'Accept' => 'application/json'}\n\n @access_token = JSON.parse(response.body)[\"access_token\"]\n\n end",
"def get_access_token(app_id, app_secret, code)\n url = ACCESS_TOKEN_URL\n\n # set body\n query = {\n \"app_id\" => app_id,\n \"app_secret\" => app_secret,\n \"code\" => code\n }\n\n # hash it\n payload = URI.encode(query.map{|k,v| \"#{k}=#{v}\"}.join(\"&\"))\n\n # send post request\n response = send_post_request(url, payload, 'application/x-www-form-urlencoded')\n\n return JSON.parse(response)\n end",
"def get_credentials_from_code options = {}\n user_id = options[:user_id]\n code = options[:code]\n scope = options[:scope] || @scope\n base_url = options[:base_url]\n credentials = UserRefreshCredentials.new(\n client_id: @client_id.id,\n client_secret: @client_id.secret,\n redirect_uri: redirect_uri_for(base_url),\n scope: scope\n )\n credentials.code = code\n credentials.fetch_access_token!({})\n monitor_credentials user_id, credentials\n end",
"def token!(code)\n Vermonster::Client.connection.basic_auth(@client[:id], @client[:secret])\n\n options = { :grant_type => \"autorization_code\", :code => code }\n response = Vermonster::Client.connection.post \"/oauth/token\", options\n\n if response.body[\"access_token\"]\n @client = @client.merge(:token => response.body[\"access_token\"])\n\n self.connect!(@client[:token])\n\n\n if @client[:token]\n @client[:token]\n else\n false\n end\n else\n false\n end\n end",
"def remote_oauth_token\n token = client_application.client_credentials.get_token(:scope => SCOPE_FOR_A_SERVICE_TO_TALK_TO_AUTHORIZATOR_SERVICE)\n raise Response::Error::AccessToken.new(data:(token && token.params)) if (!token or token.token.empty?)\n token\n end",
"def get_fitbit_token(code)\n @fitbit_oauth_client.site = \"https://api.fitbit.com\" \n @fitbit_token = @fitbit_oauth_client.auth_code.get_token(code,:redirect_uri => ENV['FITBIT_REDIRECT_URL'] ,:headers =>{'Authorization' => \"Basic #{@base64_id_secret}\",'Body' => \"client_id=#{@fitbit_oauth_client.id}\"})\n end",
"def process_callback(params, _session)\n args = {}.tap do |a|\n a[:code] = params[:code] if params[:code]\n end\n\n get_access_token(args, token_url: token_url, token_method: :post)\n end",
"def process_callback(params, _session)\n args = {}.tap do |a|\n a[:code] = params[:code] if params[:code]\n end\n\n get_access_token(args, access_token_path: token_path, access_token_method: :post)\n end",
"def get_access_token()\n url = URI.parse(TOKEN_ENDPOINT)\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(url.path)\n req.basic_auth(@clientId, @clientSecret)\n req.set_form_data({'grant_type' => 'client_credentials'})\n res = http.request(req)\n JSON.parse(res.body)['access_token']\n end",
"def process_callback(params, session)\n args = {\n oauth_verifier: params[:oauth_verifier],\n request_token: session[:request_token],\n request_token_secret: session[:request_token_secret]\n }\n\n args.merge!({ code: params[:code] }) if params[:code]\n get_access_token(args)\n end",
"def github_access_token(code)\n uri = URI('https://github.com/login/oauth/access_token')\n req = Net::HTTP::Post.new(uri)\n # Set Accept type to app/json to receive response in JSON format\n req['Accept'] = 'application/json'\n req.set_form_data('client_id' => Rails.application.config.github_client_id, 'client_secret' => Rails.application.config.github_secret, 'code' => code)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n # Parse JSON response\n tokenResponse = ActiveSupport::JSON.decode res.body\n if tokenResponse['access_token']\n response = { 'success' => true, 'token' => tokenResponse['access_token']}\n else\n response = { 'success' => false, 'message' => tokenResponse['error_description']}\n end\n else\n response = { 'success' => false, 'message' => 'Error receiving access_token: ' + res.value}\n end\n\n return response\n end",
"def get_access(params: nil, host:)\n result = TokenAdapter.new.(client_id: ENV['CLIENT_ID'],\n secret: ENV['CLIENT_SECRET'],\n code: params[:code],\n code_verifier: extract_verifier(params),\n redirect_uri: redirect_callbacks_url(host: host))\n {id_token: validate_id_token(result[\"id_token\"]), result: result}\n end",
"def get_access_token(auth_code, redirect_uri)\n json = post('/oauth2/token', nil, {'client_id' => client_id, 'client_secret' => client_secret, 'redirect_uri' => redirect_uri, 'code' => auth_code })\n raise WepayClient::Exceptions::AccessTokenError.new(\"A problem occurred trying to get the access token: #{json.inspect}\", json[:error_code]) unless json.has_key?(:access_token)\n json\n end",
"def fetch_access_token options = {}\n raise ArgumentError, \"Missing token endpoint URI.\" if token_credential_uri.nil?\n\n options = deep_hash_normalize options\n\n client = options[:connection] ||= Faraday.default_connection\n url = Addressable::URI.parse(token_credential_uri).normalize.to_s\n parameters = generate_access_token_request options\n if client.is_a? Faraday::Connection\n response = client.post url,\n Addressable::URI.form_encode(parameters),\n \"Content-Type\" => \"application/x-www-form-urlencoded\"\n status = response.status.to_i\n body = response.body\n content_type = response.headers[\"Content-type\"]\n else\n # Hurley\n response = client.post url, parameters\n status = response.status_code.to_i\n body = response.body\n content_type = response.header[:content_type]\n end\n\n return ::Signet::OAuth2.parse_credentials body, content_type if status == 200\n\n message = \" Server message:\\n#{response.body.to_s.strip}\" unless body.to_s.strip.empty?\n if [400, 401, 403].include? status\n message = \"Authorization failed.\" + message\n raise ::Signet::AuthorizationError.new(\n message, response: response\n )\n elsif status.to_s[0] == \"5\"\n message = \"Remote server error.\" + message\n raise ::Signet::RemoteServerError, message\n else\n message = \"Unexpected status code: #{response.status}.\" + message\n raise ::Signet::UnexpectedStatusError, message\n end\n end",
"def fetch_access_token\n client.unauthenticated_request(:POST, '/v1/security/oauth2/token',\n grant_type: 'client_credentials',\n client_id: client.client_id,\n client_secret: client.client_secret)\n end",
"def access_token\n creds = JSON.parse(File.read(FILE_CREDS))\n authorization = Google::Auth::UserRefreshCredentials.new(\n client_id: creds['installed']['client_id'],\n client_secret: creds['installed']['client_secret'],\n scope: SCOPE,\n refresh_token: refresh_token,\n expires_at: (Time.now+100).utc,\n grant_type: 'authorization_code')\n authorization.fetch_access_token!\n authorization.access_token\nend",
"def fetch_access_token options = {}\n c = options[:connection] || Faraday.default_connection\n retry_with_error do\n uri = target_audience ? COMPUTE_ID_TOKEN_URI : COMPUTE_AUTH_TOKEN_URI\n query = target_audience ? { \"audience\" => target_audience, \"format\" => \"full\" } : nil\n headers = { \"Metadata-Flavor\" => \"Google\" }\n resp = c.get uri, query, headers\n case resp.status\n when 200\n content_type = resp.headers[\"content-type\"]\n if content_type == \"text/html\"\n { (target_audience ? \"id_token\" : \"access_token\") => resp.body }\n else\n Signet::OAuth2.parse_credentials resp.body, content_type\n end\n when 404\n raise Signet::AuthorizationError, NO_METADATA_SERVER_ERROR\n else\n msg = \"Unexpected error code #{resp.status}\" \\\n \"#{UNEXPECTED_ERROR_SUFFIX}\"\n raise Signet::AuthorizationError, msg\n end\n end\n end",
"def get_access_token\n\t\treturn @credentials.get_access_token\n\tend",
"def access_token\n OAuth::AccessToken.new(consumer, oauth_token, oauth_token_secret)\n end",
"def new_access_code\n client.redirect_uri = 'http://giffare.com/callback'\n uri = client.authorization_uri(:scope => [:create_note, :manage_pages])\n puts \"Visit: #{uri}\"\n `open \"#{uri}\"`\n puts \"Get code param and call #from_code with it\"\n end",
"def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end",
"def get_access_token\n token_hash = Hash.new\n token_obj = get_access_token_json\n if token_obj.response.code.to_i == 200\n response_json = JSON.parse token_obj.response.body\n token_hash[\"access_token\"]= response_json[\"access_token\"]\n token_hash[\"token_type\"]= response_json[\"token_type\"]\n end\n return token_hash\n end",
"def callback\n access_token = client.web_server.get_access_token(params[:code], :redirect_uri => oauth_callback_url)\n \n current_user.update_attribute(:oauth2_token, access_token.token)\n flash[:notice] = \"Authorized successfully!\"\n \n redirect_to root_url\n end",
"def get_access_token(options={})\n response=consumer.token_request(consumer.http_method,(consumer.access_token_url? ? consumer.access_token_url : consumer.access_token_path),self,options)\n OAuth::AccessToken.new(consumer,response[:oauth_token],response[:oauth_token_secret])\n end",
"def get_access_token(code=nil, options={})\n check_for_code!(code)\n options = default_access_code_options(options)\n\n if self.options[:raise_errors]\n check_access_code_url!(options)\n end\n\n tok = self.auth_code.get_token(code, options.map { |key, value| [key.to_s, value] }.to_h)\n self.access_token = LinkedIn::AccessToken.new(tok.token,\n tok.expires_in,\n tok.expires_at)\n return self.access_token\n rescue ::OAuth2::Error => e\n raise OAuthError.new(e.response)\n end",
"def get_token_response(url)\n JSON.parse(access_token.get(\"/#{api_version}#{url}\").body)\n end",
"def obtain_access_token(authorization_code_or_refresh_token, scope = nil)\n # Authorization codes always start with \"O\" and refresh tokens always start with \"R\".\n if authorization_code_or_refresh_token[0] == \"O\"\n data = { \"grant_type\" => \"authorization_code\", \"code\" => authorization_code_or_refresh_token }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n elsif authorization_code_or_refresh_token[0] == \"R\"\n data = { \"grant_type\" => \"refresh_token\", \"refresh_token\" => authorization_code_or_refresh_token }\n data[\"scope\"] = scope unless scope.nil?\n end\n return query_api(\"/auth/token\", data)\n end",
"def obtain_access_token(authorization_code_or_refresh_token, scope = nil)\n # Authorization codes always start with \"O\" and refresh tokens always start with \"R\".\n if authorization_code_or_refresh_token[0] == \"O\"\n data = { \"grant_type\" => \"authorization_code\", \"code\" => authorization_code_or_refresh_token }\n data[\"redirect_uri\"] = @redirect_uri unless @redirect_uri.nil?\n elsif authorization_code_or_refresh_token[0] == \"R\"\n data = { \"grant_type\" => \"refresh_token\", \"refresh_token\" => authorization_code_or_refresh_token }\n data[\"scope\"] = scope unless scope.nil?\n end\n return query_api(\"/auth/token\", data)\n end"
] |
[
"0.73680073",
"0.7310669",
"0.7187481",
"0.7172382",
"0.70974505",
"0.7043064",
"0.70424473",
"0.7003236",
"0.69842917",
"0.69842917",
"0.6973421",
"0.69657344",
"0.6884683",
"0.6882332",
"0.686407",
"0.6857548",
"0.68495405",
"0.68486476",
"0.6839015",
"0.6832812",
"0.67903143",
"0.67861867",
"0.67782974",
"0.6776819",
"0.67736584",
"0.6759806",
"0.67532426",
"0.6749273",
"0.6734947",
"0.6722797",
"0.6716384",
"0.6709554",
"0.6702753",
"0.6702514",
"0.66977066",
"0.6694226",
"0.66872466",
"0.6684309",
"0.6682431",
"0.66732514",
"0.6673004",
"0.6670076",
"0.66583866",
"0.6651327",
"0.6648493",
"0.66360104",
"0.66306835",
"0.6620511",
"0.66200244",
"0.66178346",
"0.6603932",
"0.65706915",
"0.6568238",
"0.6554057",
"0.654224",
"0.6536878",
"0.6522807",
"0.6521903",
"0.6521003",
"0.6505071",
"0.64930046",
"0.6473359",
"0.6471216",
"0.64620143",
"0.6445767",
"0.6420603",
"0.6400941",
"0.63953274",
"0.639484",
"0.6390841",
"0.63884115",
"0.6382652",
"0.6381125",
"0.63801086",
"0.63700044",
"0.63637805",
"0.63505447",
"0.63468677",
"0.63410556",
"0.6322487",
"0.6278425",
"0.62756383",
"0.6271502",
"0.6271371",
"0.62567747",
"0.6254817",
"0.62513137",
"0.62093574",
"0.61933774",
"0.6179547",
"0.6176089",
"0.6172881",
"0.61661816",
"0.6166113",
"0.6151363",
"0.61448807",
"0.6134214",
"0.61315",
"0.6129097",
"0.6129097"
] |
0.7041028
|
7
|
This will return some basic information of user
|
def userinfo(access_token)
querystr = "https://graph.facebook.com/me?access_token="+access_token
uri = URI.parse(URI.encode(querystr))
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Get.new(uri.request_uri)
response = http.request(request)
result = JSON.parse(response.body)
myinfo = {}
if result['name']
myinfo['name']=result['name']
myinfo['fbid']=result['id']
end
return myinfo
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def user_info\n response = from_server \"api/user.json\"\n response.data\n end",
"def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end",
"def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend",
"def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end",
"def user_info\n @user_info ||= raw_info\n end",
"def userinfo\n if @user.nil?\n nil\n elsif @password.nil?\n @user\n else\n @user + ':' + @password\n end\n end",
"def user_info\n auth_hash['user_info']\n end",
"def info()\n get(:session, {:method => \"user.getInfo\"})\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info\n end",
"def info()\n _params = {}\n return @master.call 'users/info', _params\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info[\"person\"]\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end",
"def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end",
"def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end",
"def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end",
"def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end",
"def user_info\n @user_info ||= raw_info.nil? ? {} : raw_info['query']['results'][\"profile\"]\n end",
"def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend",
"def info\n {\n email: username\n }\n end",
"def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end",
"def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end",
"def raw_info\n @raw_info ||= access_token.get('/api/me', :headers => {'Accept' => \"application/json; version=1\" }).parsed['payload']['users'].first || {}\n end",
"def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end",
"def info\n\t@user = User.find(params[:id])\n end",
"def basicInfo (userid)\n\t\tname = nil\n\t\ticonid = nil\n\t\tnameError = nil\n\t\ticonidError = nil\n\t\t\n\t\tbegin\n\t\t\tname = db_select_user_name(userid)\n\t\trescue Exception => ex\n\t\t\tnameError = ex.message\n\t\tend\n\t\t\n\t\tbegin\n\t\t\ticonid = db_select_usersicons_iconid(userid)\n\t\trescue Exception => ex\n\t\t\ticonidError = ex.message\n\t\tend\n\t\t\n\t\treturn generateJSON_BasicInfo(name, nameError, iconid, iconidError)\n\tend",
"def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end",
"def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end",
"def user\n user = User.new\n user.read_creddentials\n user.login\n puts user.to_str\n end",
"def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end",
"def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end",
"def get_user_info user\n unless user.known_user.nil?\n known_user = user.known_user\n is_me = known_user.is_current_user || false\n return is_me ? \"people/me\" : known_user.person_name\n end\n get_one_of user\nend",
"def show\n {\n id: @current_user.id,\n first_name: @current_user.first_name,\n last_name: @current_user.last_name,\n email: @current_user.email,\n role_name: @current_user.super_admin ? 'Super Admin' : @current_user.role.try(:name),\n permissions: Permissions::Builder.user_permissions(@current_user)\n }\n end",
"def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end",
"def inspect\n \"<User username=#{@username} id=#{@id} discriminator=#{@discriminator}>\"\n end",
"def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend",
"def get_user_info\n id = params[\"id\"]\n error_list = []\n status = 1\n json_response = {}\n user = User.find_by(id: id)\n\n if user.nil?\n error_list.append(\"Error: The specified user doesn't exist.\")\n status = -1\n else\n json_response[\"user\"] = user.get_user_json_data\n end\n\n if status == -1\n json_response[\"errors\"] = error_list\n end\n\n json_response[\"status\"] = status\n\n # Format the json_response into proper JSON and respond with it\n json_response = json_response.to_json\n\n respond_to do |format|\n format.json { render json: json_response }\n end\n end",
"def user()\n return @data[\"access\"][\"user\"]\n end",
"def show\n @client = basic_connect\n @user_info = @client.user_info['user']\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_token }\n end\n end",
"def print_details\n puts '=================: User-details: ============'\n puts \"Email-address: #{email}\"\n puts \"Domain name: #{domain}\"\n puts \"Domain owner: #{username}\"\n @trueuser = `grep -w \\^#{username} /etc/trueuserowners|cut -d\\: -f2|uniq`.chomp\n puts 'True owner: ' + `grep -w #{@trueuser}$ /etc/trueuserdomains|uniq` if @trueuser != 'root'\n puts '============================================'\n end",
"def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend",
"def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.connect(Rcplugin::CITY_ADMIN_SECRET,Rcplugin::CITY_USER_TOKEN)\n\t\t@user = TheCityAdmin::User.load_by_id(id)\n\tend",
"def info\n oauth_response = access_token.get \"/api/v1/users/current.json\"\n JSON.parse(oauth_response.body)\n end",
"def get_user_details(account)\n # Get the user's profile information.\n response = access_token(account).get('http://gdata.youtube.com/feeds/api/users/default')\n xml = Nokogiri::XML(response.body)\n username = xml.xpath('//yt:username/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n first_name = xml.xpath('//yt:firstName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n last_name = xml.xpath('//yt:lastName/text()', {'yt' => 'http://gdata.youtube.com/schemas/2007'}).to_s\n\n # Return the user details.\n return {:username => username, :full_name => \"#{first_name} #{last_name}\", :url => \"http://www.youtube.com/user/#{username}\"}\n end",
"def user_data\n User.user_data login\n end",
"def user_info(user_oauth_token)\n api_post(@user_info_url, user_oauth_token)\n end",
"def user_details\n\t\t@user_data = Hash.new\n\t\t@user_data[\"first_name\"] = @first_name\n\t\t@user_data[\"username\"] = @username\n\t\t@user_data[\"password\"] = @password\n\t\t@user_data[\"balance\"] = @balance\n\tend",
"def user\n {\n id: object.user.id,\n email: object.user.email,\n birthday: object.user.birthday,\n first_name: object.user.first_name,\n middle_name: object.user.middle_name,\n last_name: object.user.last_name,\n phone: object.user.phone,\n gender: object.user.gender,\n neighborships: object.user.neighborships\n }\n end",
"def display_user(user)\n user.name\n end",
"def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end",
"def _user uid = 0\n\t\t@infos \t\t\t= {}\n\t\t@infos[:uid] \t= uid\n\t\t@infos[:name] \t= 'unknown'\n\t\t@infos[:level] \t= 0\n\t\t@infos[:sid] \t= ''\n\n\t\t# get uid\n\t\tif uid == 0\n\t\t\t# checks the uid whether exists in session\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\t# fetch info by uid\n\t\tif uid.to_i > 0\n\t\t\tds = Sdb[:_user].filter(:uid => uid)\n\t\t\t@infos[:uid]\t\t= uid\n\t\t\t@infos[:name] \t= ds.get(:name)\n\t\t\t@infos[:level] \t= ds.get(:level)\n\t\t\t@infos[:sid] \t= sid\n\t\tend\n\t\t@infos\n\tend",
"def user_full_name\n @user[\"name\"]\n end",
"def user\n {id: object.user.id, username: object.user.username, avatar: object.user.avatar}\n end",
"def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end",
"def check\n api.get_user\n end",
"def _user uid = 0\n\t\tinfos \t\t\t= {}\n\t\tinfos[:uid] \t= uid\n\t\tinfos[:name] \t= 'unknown'\n\t\tinfos[:level] \t= 0\n\t\tinfos[:sid] \t= ''\n\n\t\tif uid == 0\n\t\t\tif sid = request.cookies['sid']\n\t\t\t\tuid = _session_has sid\n\t\t\tend\n\t\tend\n\n\t\tif uid.to_i > 0\n\t\t\tds = DB[:_user].filter(:uid => uid)\n\t\t\tinfos[:uid]\t\t= uid\n\t\t\tinfos[:name] \t= ds.get(:name)\n\t\t\tinfos[:level] \t= ds.get(:level)\n\t\t\tinfos[:sid] \t= sid\n\t\tend\n\t\tinfos\n\tend",
"def current_user_info\n\t\trespond_to do |format|\n\t\t\tif !current_user\n\t\t\t\tformat.json { render json: { 'User' => 'not logged in' } }\n\t\t\telse\n\t\t\t\tformat.json { render json: { 'Name' => current_user.name, 'Image' => getFacebookPicURL(current_user) } }\n\t\t\tend\n\t\tend\n\tend",
"def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end",
"def normalized_userinfo\n normalized_user + (password ? \":#{normalized_password}\" : \"\") if userinfo\n end",
"def show\n\tuser_completed = @user.as_json(:only => [:id, :username, :login, :email, :guild_id, :otp_secret, :otp_required_for_login])\n\t\t\t\t\t\t.merge(guild: @user.guild, achievments: @user.achievments)\n\tif self.user_owner?\n \trender json: user_completed, status: :ok\n\telse\n \trender json: user_completed.except(:email, :otp_required_for_login), status: :ok\n\tend\n end",
"def info(query=nil, options={})\n # options[:number] ||= options.delete(:phone) if options.has_key? :phone\n # options[:endpoint] ||= Mogreet.endpoint(\"user.info\")\n # options[:method] ||= \"user.info\" unless options.has_key? :endpoint\n method = \"user.info\"\n Mogreet::Response::Base.new Mogreet.get_response(method, query, options)\n end",
"def user\n hash = {\n provider: 'josh_id',\n id: current_user.id.to_s,\n info: {\n email: current_user.email,\n username: current_user.username,\n #first_name: current_user.first_name,\n }\n }\n\n render json: hash.to_json\n end",
"def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end",
"def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end",
"def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end",
"def mf_api_get_user_info\n\n # Get the user from the DB\n user = User.find(params[:user_id])\n\n # If no user, return error response\n unless user\n response = {\n success: false,\n message: 'User not found'\n }\n\n render json: response and return\n end\n\n # Create User Info Response\n response = {\n success: true,\n message: 'User Info successfully retrieved',\n user_id: user.id,\n user_infusionsoft_id: user.clientid,\n user_first_name: user.first_name,\n user_last_name: user.last_name,\n user_email: user.email,\n }\n\n # Return success response\n render json: response\n\n end",
"def account_info(command)\n pp @client.users.info('me')\n end",
"def basic_info\n\t\t#Grab some basic info using OID values which should be fairly generic in nature\n\t\ttarget = \"#{@manager.config[:host]}:#{@manager.config[:port]}\"\n\t\tcstring = @manager.config[:community]\n\t\t@snmp_version = @manager.config[:version] #We need this one later for some decisions so setting to class var\n\t\tsys_name = @manager.get_value(\"sysName.0\")\n\t\tsys_descr = @manager.get_value(\"sysDescr.0\")\n\n\t\t#Print out our basic info for user\n\t\tputs \"[*] \".light_green + \"Target\".light_yellow + \": #{target}\".white\n\t\tputs \"[*] \".light_green + \"Community String\".light_yellow + \": #{cstring}\".white\n\t\tif @snmp_version\n\t\t\tputs \"[*] \".light_green + \"SNMP Version\".light_yellow + \": #{@snmp_version}\".white\n\t\telse\n\t\t\tprint_caution(\"Unable to determine SNMP Version in use?\")\n\t\tend\n\t\tif sys_name\n\t\t\tputs \"[*] \".light_green + \"System Name\".light_yellow + \": #{sys_name}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to determine system name!\")\n\t\tend\n\t\tif sys_descr\n\t\t\tputs \"[*] \".light_green + \"System Description\".light_yellow + \": \\n#{sys_descr}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\t\tif @sys_time\n\t\t\tputs \"[*] \".light_green + \"System Uptime\".light_yellow + \": #{@sys_time}\".white\n\t\telse\n\t\t\tprint_error(\"Unable to find system description!\")\n\t\tend\n\tend",
"def show\n @user = User.find(params[:id]) \n @user_me = retrieve_authenticated_user\n end",
"def show\n json_response(@user)\n end",
"def user\n puts self.name\n end",
"def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end",
"def user\n parse!\n @user\n end",
"def user_data\n {\n user_id: @user.id,\n email: @user.email\n }\n end",
"def get_name(user_info)\n return user_info[\"name\"]\n end",
"def user_name\n \"someone\"\n end",
"def show\n @user = User.find(params[:id])\n @page_title = '用户基本信息'\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end",
"def userinfo\n @participant = Participant.find(session[:user])\n end",
"def build_user_details(xml, options)\n xml.User{\n xml.Name(@options[:user])\n xml.Password(@options[:password])\n xml.ClientId(@options[:clientId], :DataType => \"S32\")\n }\n end",
"def user_details(login, authenticated = false)\n result = nil\n if authenticated\n auth_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n else\n public_connection(HTTP_GET, \"/api/users/#{login}.xml\") do |xml|\n result = User.new xml\n end\n end\n result\n end",
"def info(refresh = false)\n return @info if @info and not refresh\n\n begin\n cache_info(nil) # reset existing info\n info = @api.get_account_info['user']\n cache_info(info)\n rescue Api::NotAuthorized, Api::InvalidInput\n nil\n end\n end",
"def userinfo\n unless defined?(@userinfo)\n @userinfo = solr_url.userinfo if solr_url\n user = user_configuration_from_key('solr', 'user')\n pass = user_configuration_from_key('solr', 'pass')\n @userinfo ||= [ user, pass ].compact.join(\":\") if user && pass\n @userinfo ||= default_userinfo\n end\n @userinfo\n end",
"def user\n \"User Results: \" + results_to_s(@profile.user_record)\n end",
"def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.icn\n }\n end",
"def user\n return Etc.getlogin\n end",
"def get_profile_information\n # body = {\n # cmd: \"get_profile_information\"\n # }\n\n end",
"def get_user(username)\n Chef::Log.info username\n user = @node[:users][username]\n Chef::Log.info user.inspect\n user\nend",
"def user_data\n {\n id: @user.id,\n email: @user.email,\n user_token_sale_state: @user_token_sale_state,\n bt_name: @user.bt_name.to_s\n }\n end",
"def get_user_info(*fields)\n str_fields = fields.map(&:to_s).join(',')\n url = GRAPH_URL + @user.id + '?fields=' + str_fields + '&access_token=' +\n ENV['ACCESS_TOKEN']\n begin\n return call_graph_api(url)\n rescue => e\n return false\n end\n end",
"def user_details\n if (params[:user_uid] != nil)\n user = User.select(:name, :blood_group, :age, :id, :user_picture).find_by(user_uid: params[:user_uid])\n path = user.user_picture.path.present? ? user.user_picture.path.gsub(\"/home/altius/Uma/project/BC4_api/public\", \"http://192.168.1.238:4020/\") :nil\n contacts = EmergencyDetail.where(user_id: user.id)\n health_detail = HealthDetail.find_by(user_id: user.id, name: \"health\")\n policy_details = HealthDetail.find_by(user_id: user.id, name: \"policy\")\n render json: { user: user, profile_picture: path, contacts: contacts, health_detail: health_detail, policy_details: policy_details }, status: :ok\n else\n render json: { \"error\": \"Give the user UID\" }, status: :unprocessable_entity\n end\n end",
"def show\n @user = User.find(params[:id])\n @title = @user.username\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user.to_xml(:except => [:password_digest, :remember_token])}\n end\n end",
"def show\n ldap = Net::LDAP.new\n @user = @server.users.all#(user_params)\n \n end",
"def get_user_profile_description\n get_profile_description(\"Users\")\n end",
"def collect_user_info(get_password=true, \n first_time=false,\n third_party=false,\n need_email=true)\n\n values = {\n \"form_target\" => url(:handle_collect_user_info, \n get_password, \n third_party,\n need_email),\n \"user_affiliate_opts\" => Affiliate.options,\n \"first_time\" => first_time,\n \"third_party\" => third_party\n }\n\n \n @data.user.add_to_hash(values)\n\n standard_page(\"Create New User\",\n values,\n Login::EDIT_USER)\n end",
"def getUser\n render json: @current_user, status: 200\n end",
"def show\n\t\t# Get user id from the params\n\t\tuser_id = params[:user_id]\n\t\t# Get information from couch and neo4j\n\t\tcouch_info = {:dummy => \"hello\"}\n\t\tgraph_info = {:basic_stats => \"sadasd\"} \n\n\t\t# Return structure\n\t\trender json: user_show_json(couch_info, graph_info)\n\tend",
"def read\n\t\tuser = User.find_by_username(params[:username])\n\t\tif user\n payload = {\n username: user.username,\n first_name: user.first_name,\n last_name: user.last_name,\n created_at: user.created_at.strftime(\"%-m/%-d/%Y\")\n }\n\t\t\tif @current_user and @current_user.id == user.id\n payload[:email_address] = user.email_address\n end\n render status: 200, json: payload\n\t\telse\n\t\t\trender status: 404, json: {error: true}\n\t\tend\n\tend",
"def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end",
"def get_user_profile(uid,fields)\n begin\n @user_details = graph.get_object(\"#{uid}\",\"fields\" => \"#{fields}\")\n rescue Exception => e\n error(\"get_user_profile :: #{e.message}\")\n end\n end",
"def get_user_data\n @user = User.find(params[:id])\n end",
"def show\n @user = get_user\n end"
] |
[
"0.8155738",
"0.8115469",
"0.810809",
"0.80705",
"0.79508626",
"0.7873232",
"0.7821335",
"0.77958405",
"0.77396715",
"0.77396715",
"0.7724438",
"0.76914585",
"0.7669007",
"0.7665276",
"0.76614237",
"0.765466",
"0.7627734",
"0.76034355",
"0.7579901",
"0.7551654",
"0.7543774",
"0.7533372",
"0.7503512",
"0.74824715",
"0.7427575",
"0.73922867",
"0.73236185",
"0.73062384",
"0.73060197",
"0.7305625",
"0.72801983",
"0.7272478",
"0.72678274",
"0.7110371",
"0.7098606",
"0.7089239",
"0.70816123",
"0.7078749",
"0.70780146",
"0.707201",
"0.70388097",
"0.69947785",
"0.6988203",
"0.6967614",
"0.69646126",
"0.6964575",
"0.6959182",
"0.6928736",
"0.6914945",
"0.69053316",
"0.6900408",
"0.6894034",
"0.68907046",
"0.6879946",
"0.6862833",
"0.6859247",
"0.6859159",
"0.68583876",
"0.68577975",
"0.68513715",
"0.6840134",
"0.68329555",
"0.68308663",
"0.6829017",
"0.6813282",
"0.67987555",
"0.6793472",
"0.67918307",
"0.6788595",
"0.67792326",
"0.67748904",
"0.67680466",
"0.67652947",
"0.67576134",
"0.6752875",
"0.6751227",
"0.67448175",
"0.6741059",
"0.672534",
"0.67171955",
"0.6714828",
"0.6709323",
"0.6704826",
"0.6699585",
"0.6688022",
"0.6685722",
"0.6670089",
"0.66680384",
"0.66556555",
"0.66491973",
"0.6640756",
"0.66364837",
"0.6635683",
"0.66350937",
"0.66302085",
"0.6620912",
"0.6607649",
"0.66057986",
"0.66056246",
"0.6600841",
"0.6592586"
] |
0.0
|
-1
|
Cookbook Name:: openvnet Provider:: security_group Copyright 2015, TIS.inc All rights reserved Do Not Redistribute
|
def whyrun_supported?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def role_dmtcpsnooze\n $myxp.get_deployed_nodes('capi5k-init')\nend",
"def dcv_package\n \"nice-dcv-#{node['cluster']['dcv']['version']}-#{node['cluster']['base_os']}-#{dcv_url_arch}\"\nend",
"def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"def define_group\n case new_resource.im_install_mode\n when 'admin'\n group = if new_resource.group.nil?\n 'root'\n else\n new_resource.group\n end\n group\n when 'nonAdmin', 'group'\n group = if new_resource.group.nil?\n Chef::Log.fatal \"Group not provided! Please provide the group that should be used to install your product\"\n raise \"Group not provided! Please provide the group that should be used to install your product\"\n else\n new_resource.group\n end\n group\n end\nend",
"def create_security_group_for_inception_vm\n \n return if settings[\"inception\"][\"security_group\"] \n\n ports = {\n ssh_access: 22,\n ping: { protocol: \"icmp\", ports: (-1..-1) } \n }\n security_group_name = \"#{settings.bosh_name}-inception-vm\"\n\n provider.create_security_group(security_group_name, \"inception-vm\", ports)\n\n settings[\"inception\"] ||= {}\n settings[\"inception\"][\"security_group\"] = security_group_name\n save_settings!\n end",
"def install_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package 'chefdk' do\n version new_resource.version unless new_resource.version == 'latest'\n end\n end",
"def company_cookbook(name, version = '>= 0.0.0', options = {})\n cookbook(name, version, { git: \"https://github.com/EagleGenomics-cookbooks/#{name}.git\" }.merge(options))\nend",
"def role_puppet_master\n $myxp.get_deployed_nodes('capi5k-init').first\nend",
"def install_tscm\n case node['platform']\n when 'redhat'\n # Create dir to mount\n directory '/opt/IBM/SCM' do\n recursive true\n action :create\n end\n\n #Create SCM logical volume \n node['tscm']['logvols'].each do |logvol|\n lvm_logical_volume logvol['volname'] do\n group node['tscm']['volumegroup']\n size logvol['size']\n filesystem logvol['fstype']\n mount_point logvol['mountpoint']\n end\n end \n # verifying the tscm installation if already exists\n if ::File.exist?(\"#{node['tscm']['installed_dir']}jacclient\")\n install_status = shell_out(\"#{node['tscm']['installed_dir']}jacclient status\").stdout.chop\n if install_status.include?('The Tivoli Security Compliance Manager client is currently running')\n Chef::Log.error('TSCM client already installed on ' + (node['tscm']['node_name']).to_s + '........Nothing to do')\n end\n else\n Chef::Log.info('Installing TSCM ....')\n\n # creating a temporary directory for installinsg TSCM\n tempfolder = '/opt/IBM/tscm_temp'\n\n directory tempfolder.to_s do\n action :create\n end\n\n # get TSCM media to our temp dir\n media = tempfolder + '/' + node['tscm']['base_package'].to_s\n\n remote_file media.to_s do\n source node['tscm']['url'].to_s\n owner 'root'\n group 'root'\n mode '0755'\n action :create_if_missing\n end\n\n # Unpacking TSCM media\n execute 'unpack-media' do\n command 'cd ' + tempfolder.to_s + ' ; ' + ' tar -xf ' + media.to_s\n action :run\n not_if { ::File.exist?(\"#{media}/#{node['tscm']['base_package']}\") }\n end\n\n # run the installation script\n bash 'install-tscm' do\n code <<-EOH\n cd #{tempfolder}\n chmod 744 install_x64.sh\n ./install_x64.sh\n EOH\n end\n\n # copy the ssh key for TSCM to /opt/IBM/\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n group 'root'\n mode '400'\n action :create_if_missing\n end\n\n # create temp directory to copy the auditing patching file\n directory node['tscm']['patch_dir'].to_s do\n recursive true\n owner 'root'\n group 'root'\n mode '0744'\n action :create\n end\n\n # copy the powershell script to node system\n cookbook_file node['tscm']['copy_script_path'].to_s do\n source 'copy_script.ps1'\n owner 'root'\n group 'root'\n mode '750'\n action :create\n end\n\n # copy the powershell script to TSCM Server\n bash 'copy-powershell-script-to-tscm-server' do\n code <<-EOH\n scp -C -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['copy_script_path']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/c:/users/scm_auto_usr/\n\t EOH\n live_stream true\n action :run\n end\n\n # run the powershell scripts\n execute 'run-powershell-script' do\n command \"ssh -n -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} powershell -File 'C:/Users/scm_auto_usr/copy_script.ps1'\"\n live_stream true\n action :run\n end\n\n # copy the audit patching file\n execute 'download-audi-patching-file' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/C:/Users/scm_auto_usr/lssec_secfixdb_all.tar.gz /opt/IBM/SCM/client/software/completed/\"\n live_stream true\n action :run\n not_if { ::File.exist?(node['tscm']['audit_file'].to_s) }\n end\n\n client_pref = shell_out(\"grep 'debug=true' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=true')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -i -e 's/debug=false/debug=true/' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n service node['tscm']['service_name'].to_s do\n action :stop\n end\n\n service node['tscm']['service_name'].to_s do\n action :start\n end\n end\n end\n\n # installing on aix\n when 'aix'\n Chef::Log.info('Installing TSCM on AIX platform...........')\n\n if ::File.exist?(\"#{node['tscm']['installed_dir']}jacclient\")\n install_status = shell_out(\"#{node['tscm']['installed_dir']}jacclient status\").stdout.chop\n if install_status.include?('HCVIN0033I The Tivoli Security Compliance Manager client is currently running')\n Chef::Log.error('TSCM client already installed on ' + (node['tscm']['node_name']).to_s + '........Nothing to do')\n end\n else\n Chef::Log.info('TSCM not installed ........Installing TSCM ')\n\n # creating temporary directory for copying tscm binaries\n tempfolder = '/opt/IBM/tscm_software'\n\n directory tempfolder.to_s do\n action :create\n not_if { ::File.exist?(tempfolder.to_s) }\n end\n\n media = tempfolder.to_s + '/' + (node['tscm']['base_package']).to_s\n node.default['tscm']['package_name'] = (node['tscm']['base_package']).to_s.chomp('.tar')\n\n # downloading binaries from the url\n remote_file media.to_s do\n source node['tscm']['url'].to_s\n owner 'root'\n mode '0755'\n action :create_if_missing\n end\n\n # creating prerequisite FS\n # create volume group ibmvg as mandatory requirement\n execute 'create-VG-ibmvg' do\n command 'mkvg -f -y ibmvg hdisk1'\n action :run\n returns [0, 1]\n not_if { shell_out('lsvg | grep ibmvg').stdout.chop != '' }\n end\n\n # required FS\n volumes = [\n { lvname: 'lv_scm', fstype: 'jfs2', vgname: 'ibmvg', size: 500, fsname: '/opt/IBM/SCM' },\n ]\n # Custom FS creation\n volumes.each do |data|\n ibm_tscm_makefs \"creation of #{data[:fsname]} file system\" do\n lvname data[:lvname]\n fsname data[:fsname]\n vgname data[:vgname]\n fstype data[:fstype]\n size data[:size]\n end\n end\n\n # Unpacking TSCM media\n execute 'unpack-media' do\n command 'cd ' + tempfolder.to_s + ' ; ' + ' tar -xf ' + media.to_s\n action :run\n not_if { ::File.exist?(media.to_s + node['tscm']['package_name'].to_s + 'install_aix6.sh') }\n end\n\n # run the installation script\n bash 'install-tscm' do\n code <<-EOH\n cd #{tempfolder}\n chmod +x install_aix6.sh\n ./install_aix6.sh \n EOH\n end\n\n # copy the ssh key for TSCM to /opt/IBM/ directory\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n mode '400'\n action :create_if_missing\n end\n\n # create temp directory to copy the auditing patching file\n directory node['tscm']['patch_dir'].to_s do\n recursive true\n owner 'root'\n mode '0744'\n action :create\n end\n\n # copy the audit patching file\n execute 'download-audi-patching-file' do\n command \"scp -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']}:/C:/PROGRA~1/IBM/SCM/client/software/completed/lssec_secfixdb_all.tar.gz /opt/IBM/SCM/client/software/completed/\"\n action :run\n not_if { ::File.exist?(node['tscm']['audit_file'].to_s) }\n end\n\n # changing log-level to debug mode\n client_pref = shell_out(\"grep 'debug=true' #{node['tscm']['client_pref']} \").stdout.chop\n\n if client_pref.include?('debug=true')\n Chef::Log.info('File Up to date..........Nothing to do')\n else\n # update the client.pref file to debug mode\n execute 'update-client.pref' do\n command \"sed -e 's/debug=false/debug=true/g' #{node['tscm']['client_pref']}\"\n action :run\n end\n\n # restarting TSCM agent service for changes to take effect\n execute 'restart-tscm-service' do\n command '/opt/IBM/SCM/client/jacclient restart'\n action :run\n end\n end\n end\n end\nend",
"def wlst_create_PIA_domain\r\n Puppet.alert(\" begin : wlst_create_PIA_domain\")\r\n lcl_bash_fle_location = get_value4key(\"bash_file_location\", resource[:web_scripts_location] )\r\n lcl_ps_location_arr = resource[:web_location_attrib]\r\n\r\n env_action_cmd = lcl_bash_fle_location + \"/dapps_wlst_create_PIA_domain.bsh \"\r\n\r\n env_action_cmd += \" '\" + get_value4key(\"pythonbinpath\", resource[:web_scripts_location]) + \"' \"\r\n env_action_cmd += \" '\" + get_value4key(\"python_file_location\", resource[:web_scripts_location]) + \"' \"\r\n\r\n env_action_cmd += \" '\" + get_value4key(\"ps_config_home\", resource[:web_location_attrib])+ \"' \"\r\n env_action_cmd += \" '\" + get_value4key(\"webdomainname\", resource[:webdomain_attrib])+ \"' \"\r\n ## we are sending all PIA name to create /clone all PIAxx \r\n env_action_cmd += \" '\" + get_value4key(\"all_pia_names\", resource[:webadmin_server_attrib])+ \"' \"\r\n\r\n env_action_cmd += \" '\" + get_value4key(\"webadminserverhost\", resource[:webadmin_server_attrib])+ \"' \"\r\n env_action_cmd += \" \" + get_value4key(\"webadminserverhttp\", resource[:webadmin_server_attrib])\r\n env_action_cmd += \" \" + get_value4key(\"webadminserverhttps\", resource[:webadmin_server_attrib])\r\n env_action_cmd += \" '\" + get_value4key(\"webadminloginid\", resource[:webadmin_server_attrib])+ \"' \"\r\n env_action_cmd += \" '\" + get_decrypt_str( get_value4key2(\"webadminloginpwd\", resource[:web_pwd_attrib])) + \"' \"\r\n\r\n Puppet.debug(\" env_action_cmd: #{env_action_cmd}\")\r\n\r\n command_output = execute_command(env_action_cmd, true)\r\n Puppet.alert(\" dapps_start_stop_PIA_domain : #{command_output}\")\r\n if command_output.include? \"ALREADY_EXISTS\"\r\n return true\r\n end \r\n if command_output.include? \"CREATED\"\r\n return true\r\n else\r\n return false\r\n end\r\n \r\n end",
"def getPackageDetails(cloud_name, cookbook_name, a_comp_mirrors, a_cloud_mirrors, src_mirror, node_platform, distributionurl)\n\n #Chef::Log.info(\"Getting mirror for app: #{cookbook_name} & cloud: #{cloud_name}\")\n base_url = ''\n base_url = distributionurl if (distributionurl != nil && !distributionurl.empty?)\n\n log \"getting_couchbase_pack\" do\n message \"Getting mirror for app: #{cookbook_name}, cloud: #{cloud_name} base url: #{base_url}\"\n level :info\n end\n\n # Search for component mirror\n comp_mirrors = JSON.parse(a_comp_mirrors) if base_url.empty?\n base_url = comp_mirrors[0] if (comp_mirrors != nil && comp_mirrors.size > 0)\n # Search for cloud mirror\n cloud_mirrors = JSON.parse(a_cloud_mirrors) if base_url.empty?\n base_url = cloud_mirrors[cookbook_name] if !cloud_mirrors.nil? && cloud_mirrors.has_key?(cookbook_name)\n # Search for cookbook default attribute mirror\n base_url = src_mirror if base_url.empty?\n\n case node_platform\n # Redhat based distros\n when 'redhat', 'centos', 'fedora'\n package_type = 'rpm'\n package_installer = 'rpm -i --nodeps'\n yum_package 'perl-Time-HiRes' do\n action :install\n end\n # Debian based ditros\n when 'ubuntu', 'debian'\n package_type = 'deb'\n package_installer = 'dpkg -i'\n else\n Chef::Application.fatal!(\"#{node_platform} platform is not supported for Couchbase.\")\n end\n #Chef::Log.info(\"Mirror base_url: #{base_url} & package_type: #{package_type}\")\n log \"result_couchbase_pack\" do\n message \"Mirror base_url: #{base_url} & package_type: #{package_type}\"\n level :info\n end\n return base_url, package_type, package_installer\nend",
"def server_software; end",
"def configure_ks_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n if client_arch.match(/i386/)\n client_os = \"RedHat\"\n else\n client_os = \"RedHat_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def ubuntu_box(config, version)\n config.vm.box = \"opscode-ubuntu-#{version}\" \n config.vm.box_url = \"http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-#{version}_chef-provisionerless.box\"\nend",
"def get_install_client\n purge\n s('cd /tmp')\n s('wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb')\n s('sudo apt-get update')\n s('sudo apt-get -y install puppet')\nend",
"def oar_system_keys()\n [\n 'deploy',\n 'besteffort'\n ]\nend",
"def upgrade_repo!\n package 'apt-transport-https'\n include_recipe \"apt-chef::#{new_resource.channel}\"\n package('chefdk') { action :upgrade }\n end",
"def load_cloudflare_cookbook_gems\n return if defined? @@cloudflare_cookbook_gems_loaded\n chef_gem 'cloudflare' do\n action :install\n version '2.0.1'\n end\n require 'resolv'\n require 'cloudflare'\n @@cloudflare_cookbook_gems_loaded = true\nend",
"def configure_vs_repo(options)\n if options['host-os-name'].to_s.match(/SunOS/)\n check_fs_exists(options,options['repodir'])\n options['netbootdir'] = options['tftpdir']+\"/\"+options['service']\n if not File.symlink?(options['repodir'])\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere net boot directory\")\n end\n check_dir_owner(options,options['netbootdir'],options['uid'])\n File.symlink(options['repodir'],options['netbootdir'])\n end\n end\n if options['host-os-name'].to_s.match(/Linux/)\n options['netbootdir'] = options['tftpdir']+\"/\"+options['service']\n check_fs_exists(options,options['netbootdir'])\n if !File.exist?(options['repodir'])\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere net boot directory\")\n end\n check_dir_owner(options,options['netbootdir'],options['uid'])\n File.symlink(options['netbootdir'],options['repodir'])\n end\n end\n check_dir = options['repodir']+\"/upgrade\"\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking directory #{check_dir} exists\")\n end\n if not File.directory?(check_dir)\n mount_iso(options)\n options['repodir'] = options['tftpdir']+\"/\"+options['service']\n copy_iso(options)\n umount_iso(options)\n end\n options['clientdir'] = options['clientdir']+\"/\"+options['service']\n ovf_file = options['clientdir']+\"/vmware-ovftools.tar.gz\"\n if not File.exist?(ovf_file)\n wget_file(options,options['ovftarurl'],ovf_file)\n if options['host-os-uname'].match(/RedHat/) and options['host-os-version'].match(/^7|^6\\.7/)\n message = \"Information:\\tFixing permission on \"+ovf_file\n command = \"chcon -R -t httpd_sys_rw_content_t #{ovf_file}\"\n execute_command(options,message,command)\n end\n end\n return\nend",
"def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend",
"def register_node\n case node['platform']\n when 'windows'\n # Create temp directory where we copy/create source files to install tscm agent\n directory \"#{node['tscm']['temp']}\" do\n action :create\n not_if { ::File.directory?('C:\\\\tscm_temp')}\n end\n # copy tscm proxy key of tscm server on Node\n cookbook_file \"#{node['tscm']['temp']}\\\\#{node['tscm']['native_proxykey']}\" do\n source \"#{node['tscm']['native_proxykey']}\"\n action :create\n end\n # fix permissions of client side files keys\n powershell_script 'fix_keyfile_permission' do\n code <<-EOH\n cd 'C:/Program Files/OpenSSH-Win64/'\n Import-Module ./OpenSSHUtils.psd1 -Force \n Repair-UserKeyPermission -FilePath 'C:\\\\tscm_temp\\\\SCM_id_rsa' -Confirm:$false\n EOH\n end\n \n execute 'register-tscm' do\n command \"C:\\\\PROGRA~1\\\\OpenSSH-Win64\\\\ssh.exe -vvv -n -o StrictHostKeyChecking=no -vvv -i #{node['tscm']['temp']}\\\\SCM_id_rsa #{node['tscm']['TSCMProxy_user']}@#{node['tscm']['TSCMProxy_server']}\" + \" powershell.exe -File #{node['tscm']['tscmWrapper_path']} reg #{node['tscm']['hostname']} w2k12 #{node['tscm']['ipaddress']} > #{node['tscm']['register_log']} 2>&1\"\n action :run\n timeout 3600\n end\n ruby_block 'sleep-after-register' do\n block do\n sleep(120)\n end\n action :run\n end\n end\nend",
"def configure_ai_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os=\"Solaris11_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def configure_ob_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Linux_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def install_tscm\n case node['platform']\n when 'windows'\n if ::File.directory?(node['tscm']['alreadyInstalledFile'].to_s)\n Chef::Log.info('tscm is already install, nothing to install for tscm agent')\n else\n # Create temp directory where we copy/create source files to install tscm agent\n directory \"#{node['tscm']['temp']}\" do\n action :create\n end\n # get tscm agent media to our temp dir\n remote_file \"#{node['tscm']['temp']}\\\\#{node['tscm']['TSCMfile']}\" do\n source \"#{node['tscm']['TSCMfile_Path']}\"\n action :create\n end\n\n media = \"#{node['tscm']['temp']}\\\\#{node['tscm']['TSCMfile']}\"\n Chef::Log.info(\"media: #{media}\")\n\n # Unpack media\n ruby_block 'unzip-install-file' do\n block do\n Chef::Log.info('unziping the tscm Installer file')\n command = powershell_out \"Add-Type -assembly \\\"system.io.compression.filesystem\\\"; [io.compression.zipfile]::ExtractToDirectory('#{media}', 'C:\\\\tscm_temp')\"\n Chef::Log.debug command\n action :create\n end\n end\n Chef::Log.info('Performing tscm agent installation...')\n ruby_block 'Install TSCM Agent' do\n block do\n install_cmd = powershell_out \"Start-Process '#{node['tscm']['temp']}\\\\setup-x64.exe' '/verysilent /suppressmsgboxes /log=C:/tscminstall.log'\"\n Chef::Log.debug install_cmd\n not_if { ::File.exist?(\"#{node['tsm']['alreadyInstalledFile']}\") }\n end\n action :create\n end\n # Create directory where we copy wsusscn2.cab file from TSCM Server\n directory node['tscm']['patchAuditingPath'].to_s do\n action :create\n recursive true\n end\n\n # copy tscm proxy key of tscm server on Node\n cookbook_file \"#{node['tscm']['temp']}\\\\#{node['tscm']['native_proxykey']}\" do\n source \"#{node['tscm']['native_proxykey']}\"\n action :create\n end\n # fix permissions of client side files keys\n powershell_script 'fix_keyfile_permission' do\n code <<-EOH\n cd 'C:/Program Files/OpenSSH-Win64/'\n Import-Module ./OpenSSHUtils.psd1 -Force \n Repair-UserKeyPermission -FilePath 'C:\\\\tscm_temp\\\\SCM_id_rsa' -Confirm:$false\n EOH\n end\n\n # Copy AuditPatching File to required location on the node\n Chef::Log.info('Copy audit patching file')\n execute 'Copy_auditPatching_file' do\n command 'C:/PROGRA~1/OpenSSH-Win64/scp.exe -o StrictHostKeyChecking=no -i C:/tscm_temp/SCM_id_rsa scm_auto_usr@10.0.146.37:/C:/PROGRA~1/IBM/SCM/client/software/completed/wsusscn2.cab C:/PROGRA~1/IBM/SCM/client/software/completed/'\n action :run\n end\n\n # Delete Program file which affect to start the SCM service\n file 'C:\\\\Program' do\n only_if { ::File.exist?('C:\\\\Program') }\n action :delete\n end\n \n # Copy the wrapper script on tscm temp directory\n cookbook_file \"#{node['tscm']['temp']}\\\\#{node['tscm']['native_ScriptFile']}\" do\n source \"#{node['tscm']['native_ScriptFile']}\"\n action :create\n end\n\n # Updating the debug value as true in client.pref file\n ruby_block 'update_debugValue' do\n block do\n Chef::Log.info('Sleeping for thirty second to wait to create the client.pref file')\n sleep(30)\n Chef::Log.info('Updating the debug value of client.pref file')\n file_name = \"#{node['tscm']['clientConfFile']}\"\n text = ::File.read(file_name)\n new_contents = text.gsub(/debug=false/, 'debug=true')\n # write changes to the file\n ::File.open(file_name, 'w') { |file| file.puts new_contents }\n end\n action :create\n end\n \n # Restart the SCM service for reflecting the changes\n service \"#{node['tscm']['serviceName']}\" do\n action :restart\n end\n end\n end\nend",
"def register_tscm\n case node['platform']\n when 'redhat'\n client_id = shell_out('cat /opt/IBM/SCM/client/client.id').stdout\n\n if client_id.to_i == -1\n # registering the tscm client with server\n Chef::Log.info('Registering TSCM client........')\n\n # check for key required for server authentication\n verify_key\n\n # registering client using ssh command\n execute 'register-node' do\n command \"ssh -n -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} powershell.exe -File 'C:/TSCM_Automation/TSCM_wrapper.ps1' #{node['tscm']['register_ot']} #{node['tscm']['node_name']} #{node['tscm']['OS_type']} #{node['tscm']['node_IP']}\"\n action :run\n timeout 1800\n end\n\n ruby_block 'sleep-after-register' do\n block do\n sleep(120)\n end\n action :run\n end\n \n else\n Chef::Log.error('TSCM Client: ' + (node['tscm']['node_name']).to_s + ' Already Registered with Object ID : ' + client_id.to_s + '.....................Nothing to do')\n node.default['tscm']['registration_status'] = 'success'\n end\n\n # registering on aix\n when 'aix'\n client_id = shell_out('cat /opt/IBM/SCM/client/client.id').stdout\n\n # check if the key is available; download in case it is not available\n verify_key\n \n Chef::Log.error(client_id.to_i)\n if client_id.to_i == -1\n Chef::Log.info('Registering the TSCM client.......')\n\n # registering the tscm client with server\n Chef::Log.info('Registering TSCM client........')\n\n execute 'register-tscm' do\n command \"ssh -n -o StrictHostKeyChecking=no -i #{node['tscm']['key']} #{node['tscm']['proxy_user']}@#{node['tscm']['proxy_server']} powershell.exe -File 'C:/TSCM_Automation/TSCM_wrapper.ps1' #{node['tscm']['register_ot']} #{node['tscm']['node_name']} #{node['tscm']['OS_type']} #{node['tscm']['node_IP']}\"\n action :run\n timeout 1800\n end\n\n ruby_block 'sleep-after-register' do\n block do\n sleep(120)\n end\n action :run\n end\n\n # checking log files for validating registration\n if ::File.exist?('/opt/IBM/SCM/client/client.log') && ::File.readlines('/opt/IBM/SCM/client/client.log').grep(/Storing obsfucated schedules/)\n Chef::Log.info('Registration Success...........')\n else\n Chef::Log.error('Registration Failed...........')\n end\n else\n Chef::Log.error('TSCM Client: ' + (node['tscm']['node_name']).to_s + ' Already Registered with Object ID : ' + client_id.to_s + '.....................Nothing to do')\n node.default['tscm']['registration_status'] = 'success'\n Chef::Log.error((node['tscm']['registration_status']).to_s)\n end\n end\nend",
"def vcap environment\n\nend",
"def verify_key\n Chef::Log.info('Check for RSA key and download key ')\n\n if ::File.exist?('/opt/IBM/SCM_id_rsa')\n Chef::Log.info('Key already exist..........')\n else\n Chef::Log.info('Downloading the key.........')\n # copy the ssh key for TSCM to /opt/IBM/\n cookbook_file node['tscm']['key'].to_s do\n source node['tscm']['key_name'].to_s\n owner 'root'\n mode '400'\n action :create_if_missing\n end\n Chef::Log.info('Finished downloading RSA key...............')\n end\nend",
"def swift_provider\n \"openstack\"\n end",
"def initialSSHTasks(ssh)\n win_env_fix = %q{echo 'export PATH=\"$PATH:/cygdrive/c/opscode/chef/embedded/bin\"' > \"$HOME/chef-client\"; echo 'prev_dir=\"`pwd`\"; for __dir in /proc/registry/HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Control/Session\\ Manager/Environment;do cd \"$__dir\"; for __var in `ls * | grep -v TEMP | grep -v TMP`;do __var=`echo $__var | tr \"[a-z]\" \"[A-Z]\"`; test -z \"${!__var}\" && export $__var=\"`cat $__var`\" >/dev/null 2>&1; done; done; cd \"$prev_dir\"; /cygdrive/c/opscode/chef/bin/chef-client.bat $@' >> \"$HOME/chef-client\"; chmod 700 \"$HOME/chef-client\"; ( grep \"^alias chef-client=\" \"$HOME/.bashrc\" || echo 'alias chef-client=\"$HOME/chef-client\"' >> \"$HOME/.bashrc\" ) ; ( grep \"^alias mu-groom=\" \"$HOME/.bashrc\" || echo 'alias mu-groom=\"powershell -File \\\"c:/Program Files/Amazon/Ec2ConfigService/Scripts/UserScript.ps1\\\"\"' >> \"$HOME/.bashrc\" )}\n win_installer_check = %q{ls /proc/registry/HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Installer/}\n lnx_installer_check = %q{ps auxww | awk '{print $11}' | egrep '(/usr/bin/yum|apt-get|dpkg)'}\n lnx_updates_check = %q{( test -f /.mu-installer-ran-updates || ! test -d /var/lib/cloud/instance ) || echo \"userdata still running\"}\n win_set_pw = nil\n\n if windows? and !@config['use_cloud_provider_windows_password']\n # This covers both the case where we have a windows password passed from a vault and where we need to use a a random Windows Admin password generated by MU::Cloud::Server.generateWindowsPassword\n pw = @groomer.getSecret(\n vault: @config['mu_name'],\n item: \"windows_credentials\",\n field: \"password\"\n )\n win_check_for_pw = %Q{powershell -Command '& {Add-Type -AssemblyName System.DirectoryServices.AccountManagement; $Creds = (New-Object System.Management.Automation.PSCredential(\"#{@config[\"windows_admin_username\"]}\", (ConvertTo-SecureString \"#{pw}\" -AsPlainText -Force)));$DS = New-Object System.DirectoryServices.AccountManagement.PrincipalContext([System.DirectoryServices.AccountManagement.ContextType]::Machine); $DS.ValidateCredentials($Creds.GetNetworkCredential().UserName, $Creds.GetNetworkCredential().password); echo $Result}'}\n win_set_pw = %Q{powershell -Command \"& {(([adsi]('WinNT://./#{@config[\"windows_admin_username\"]}, user')).psbase.invoke('SetPassword', '#{pw}'))}\"}\n end\n\n # There shouldn't be a use case where a domain joined computer goes through initialSSHTasks. Removing Active Directory specific computer rename.\n set_hostname = true\n hostname = nil\n if !@config['active_directory'].nil?\n if @config['active_directory']['node_type'] == \"domain_controller\" && @config['active_directory']['domain_controller_hostname']\n hostname = @config['active_directory']['domain_controller_hostname']\n @mu_windows_name = hostname\n set_hostname = true\n else\n # Do we have an AD specific hostname?\n hostname = @mu_windows_name\n set_hostname = true\n end\n else\n hostname = @mu_windows_name\n end\n win_check_for_hostname = %Q{powershell -Command '& {hostname}'}\n win_set_hostname = %Q{powershell -Command \"& {Rename-Computer -NewName '#{hostname}' -Force -PassThru -Restart; Restart-Computer -Force }\"}\n\n begin\n # Set our admin password first, if we need to\n if windows? and !win_set_pw.nil? and !win_check_for_pw.nil?\n output = ssh.exec!(win_check_for_pw)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/True/)\n MU.log \"Setting Windows password for user #{@config['windows_admin_username']}\", details: ssh.exec!(win_set_pw)\n end\n end\n if windows?\n output = ssh.exec!(win_env_fix)\n output = ssh.exec!(win_installer_check)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if output.match(/InProgress/)\n raise MU::Cloud::BootstrapTempFail, \"Windows Installer service is still doing something, need to wait\"\n end\n if set_hostname and !@hostname_set and @mu_windows_name\n output = ssh.exec!(win_check_for_hostname)\n raise MU::Cloud::BootstrapTempFail, \"Got nil output from ssh session, waiting and retrying\" if output.nil?\n if !output.match(/#{@mu_windows_name}/)\n MU.log \"Setting Windows hostname to #{@mu_windows_name}\", details: ssh.exec!(win_set_hostname)\n @hostname_set = true\n # Reboot from the API too, in case Windows is flailing\n if !@cloudobj.nil?\n @cloudobj.reboot\n else\n reboot\n end\n raise MU::Cloud::BootstrapTempFail, \"Set hostname in Windows, waiting for reboot\"\n end\n end\n else\n output = ssh.exec!(lnx_installer_check)\n if !output.nil? and !output.empty?\n raise MU::Cloud::BootstrapTempFail, \"Linux package manager is still doing something, need to wait (#{output})\"\n end\n if !@config['skipinitialupdates']\n output = ssh.exec!(lnx_updates_check)\n if !output.nil? and output.match(/userdata still running/)\n raise MU::Cloud::BootstrapTempFail, \"Waiting for initial userdata system updates to complete\"\n end\n end\n end\n rescue RuntimeError => e\n raise MU::Cloud::BootstrapTempFail, \"Got #{e.inspect} performing initial SSH connect tasks, will try again\"\n end\n\n end",
"def create\n Puppet.debug(\"Calling create method of security_policy_cloakingprovider: \")\nend",
"def define_provisioner\n { 'name' => 'chef-zero', 'require_chef_omnibus' => 'latest' }\n end",
"def is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n authorize :network => '70.91.172.41/29', :from_port => \"9160\", :to_port => \"9160\"\n authorize :network => '72.32.68.18/32', :from_port => \"9160\", :to_port => \"9160\"\n authorize :network => '72.32.70.9/32', :from_port => \"9160\", :to_port => \"9160\"\n end\nend",
"def customized_licenses\n @research_output.plan.template.licenses.map { |license| [\"#{license.identifier} (#{license.name})\", license.id] }\n end",
"def run_example\n #\n # Create the Resource Manager Client with an Application (service principal) token provider\n #\n subscription_id = ENV['AZURE_SUBSCRIPTION_ID'] || '11111111-1111-1111-1111-111111111111' # your Azure Subscription Id\n provider = MsRestAzure::ApplicationTokenProvider.new(\n ENV['AZURE_TENANT_ID'],\n ENV['AZURE_CLIENT_ID'],\n ENV['AZURE_CLIENT_SECRET'])\n credentials = MsRest::TokenCredentials.new(provider)\n rm = Azure::ARM::Resources::ResourceManagementClient.new(credentials)\n rm.subscription_id = subscription_id\n networking = Azure::ARM::Network::NetworkManagementClient.new(credentials)\n networking.subscription_id = subscription_id\n\n #\n # Managing resource groups\n #\n resource_group_params = Azure::ARM::Resources::Models::ResourceGroup.new.tap do |rg|\n rg.location = WEST_US\n end\n\n nsg_params = Azure::ARM::Network::Models::NetworkSecurityGroup.new.tap do |nsg|\n nsg.location = WEST_US\n end\n\n # Create Resource group\n puts \"\\nCreate Resource Group\"\n print_item rm.resource_groups.create_or_update(GROUP_NAME, resource_group_params)\n\n puts \"\\nCreating NSG named 'sample-ruby-nsg'\"\n print_item nsg = networking.network_security_groups.create_or_update(GROUP_NAME, 'sample-ruby-nsg', nsg_params)\n\n puts \"\\nCreating a virtual network\"\n vnet_create_params = Azure::ARM::Network::Models::VirtualNetwork.new.tap do |vnet|\n vnet.location = WEST_US\n vnet.address_space = Azure::ARM::Network::Models::AddressSpace.new.tap do |addr_space|\n addr_space.address_prefixes = ['10.0.0.0/16']\n end\n vnet.dhcp_options = Azure::ARM::Network::Models::DhcpOptions.new.tap do |dhcp|\n dhcp.dns_servers = ['8.8.8.8']\n end\n vnet.subnets = [\n Azure::ARM::Network::Models::Subnet.new.tap do |subnet|\n subnet.name = 'rubySampleSubnet'\n subnet.address_prefix = '10.0.0.0/24'\n subnet.network_security_group = nsg\n end\n ]\n end\n print_item vnet = networking.virtual_networks.create_or_update(GROUP_NAME, 'sample-ruby-vnet', vnet_create_params)\n\n puts \"\\nList security rules: \"\n puts networking.security_rules.list(GROUP_NAME, 'sample-ruby-nsg')\n\n rule1 = Azure::ARM::Network::Models::SecurityRule.new.tap do |rule|\n rule.description = 'Ruby sample rule'\n rule.protocol = Azure::ARM::Network::Models::Protocol::TCP\n rule.source_port_range = '8888'\n rule.destination_port_range = '8000'\n rule.priority = 1000\n rule.source_address_prefix = '*'\n rule.destination_address_prefix = '*'\n rule.access = Azure::ARM::Network::Models::SecurityRuleAccess::Allow\n rule.direction = Azure::ARM::Network::Models::Direction::Inbound\n end\n\n rule2 = Azure::ARM::Network::Models::SecurityRule.new.tap do |rule|\n rule.description = 'Ruby sample rule'\n rule.protocol = Azure::ARM::Network::Models::Protocol::UDP\n rule.source_port_range = '9000'\n rule.destination_port_range = '9000'\n rule.priority = 1001\n rule.source_address_prefix = '*'\n rule.destination_address_prefix = '*'\n rule.access = Azure::ARM::Network::Models::SecurityRuleAccess::Allow\n rule.direction = Azure::ARM::Network::Models::Direction::Inbound\n end\n\n puts \"\\nAdd securty group rule1: \"\n puts rule = networking.security_rules.create_or_update(GROUP_NAME, 'sample-ruby-nsg', 'sample-ruby-rule1', rule1)\n\n puts \"\\nAdd securty group rule2: \"\n puts rule = networking.security_rules.create_or_update(GROUP_NAME, 'sample-ruby-nsg', 'sample-ruby-rule2', rule2)\n\n puts \"\\nList security rules: \"\n rules = networking.security_rules.list(GROUP_NAME, 'sample-ruby-nsg')\n puts rules\n\n puts \"\\nShow Network Security Group: \"\n puts networking.network_security_groups.get(GROUP_NAME, 'sample-ruby-nsg')\n\n rule_id = rules[0].id\n puts \"\\nFetching id: #{rule_id} by creating a generic HTTP get request\"\n fetch_by_id = networking.make_request(:get,\n rule_id,\n query_params: { 'api-version': '2017-06-01' })\n puts fetch_by_id\n\n\n parsed_id = parse(rule_id)\n puts \"\\nFetching id: #{rule_id} after parsing into: #{parsed_id}\"\n fetched_rule = networking.security_rules.get(parsed_id[:group], parsed_id[:nsg], parsed_id[:name])\n puts fetched_rule\nend",
"def northern_irish_driving_licence; end",
"def configure_vs_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Linux_64\"\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def upload_licenses\n \n end",
"def generate_lvs_cluster(c)\n svc = c.services.map { |s|\n [s.name, \"#{s.ha_protocol}://\", s.ha_hostname, s.localport ].join(', ') \n }\n [dec2ip(c.fw_mark), c.description, svc.map { |s| \"(#{ s })\" }.join('; ') ]\nend",
"def description\n \"This task checks for security headers on a web application\"\nend",
"def security_server_client\n end",
"def security_contract\n IMS::LTI::Models::SecurityContract.new(\n tp_half_shared_secret: tp_half_shared_secret,\n tool_service: [\n IMS::LTI::Models::RestServiceProfile.new(\n type: 'RestServiceProfile',\n service: 'vnd.Canvas.submission',\n action: %w(GET)\n ),\n IMS::LTI::Models::RestServiceProfile.new(\n type: 'RestServiceProfile',\n service: 'vnd.Canvas.OriginalityReport',\n action: %w(GET POST PUT)\n )\n ]\n )\n end",
"def cloud_desc\n MU::Cloud::AWS.iam(credentials: @config['credentials']).get_group(\n group_name: @mu_name\n )\n end",
"def is_cassandra_node settings\n has_role settings, \"cassandra_node\"\n security_group 'cassandra_node' do\n authorize :group_name => 'cassandra_node'\n end\nend",
"def configure_ay_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"OpenSUSE\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def security\n app = detect_product(DALVIK) || detect_product(MOZILLA)\n\n Security[app.comment[1]] if app\n end",
"def configure_ps_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"Ubuntu\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def select_security_group\n compute.security_groups.each { |s| [s.name, s.id] }\n end",
"def configure(vm_config, number)\n vm_config.vm.network \"public_network\", ip: \"192.168.1.24#{number}\"\n vm_config.vm.host_name = \"level0#{number}.seoshop.net\"\n \n vm_config.vm.provision :puppet do |puppet|\n puppet.manifests_path = \"puppet\"\n puppet.module_path = \"puppet/modules\"\n puppet.manifest_file = \"site.pp\"\n end\nend",
"def pool\n @pool=@vserver_hash.properties.basic.pool\n end",
"def allowSecurityManagement()\n banner(\"Allow Security\")\n @run.society.each_enclave() do |enclave|\n securityAgents = getSecurityAgents(enclave)\n securityAgentsName = \"SecurityAgentsIn#{enclave}\"\n declareSet(securityAgentsName, securityAgents)\n permit(enclaveAgentsName(enclave), securityAgentsName,\n \"AllowSecurityManagement-#{enclave}-I\",\n [ enclave ])\n permit(securityAgentsName, enclaveAgentsName(enclave),\n \"AllowSecurityManagement-#{enclave}-II\",\n [ enclave ])\n end\n end",
"def install_in_redhat(os, version)\n install_repo_rpms(os, version)\n install_package 'collectd'\n install_package 'collectd-disk'\nend",
"def puppet_resource_cmd\n UtilityLib::PUPPET_BINPATH + 'resource cisco_X__RESOURCE_NAME__X'\nend",
"def set_vars\n #Set up vars with AEM package manager urls, etc.\n vars = {}\n vars[:recursive] = new_resource.recursive ? '\\\\&recursive=true' : \"\"\n vars[:file_name] = \"#{new_resource.name}-#{new_resource.version}\" +\n \"#{new_resource.file_extension}\"\n vars[:download_url] = new_resource.package_url\n vars[:file_path] = \"#{Chef::Config[:file_cache_path]}/#{vars[:file_name]}\"\n vars[:user] = new_resource.user\n vars[:password] = new_resource.password\n vars[:port] = new_resource.port\n vars[:group_id] = new_resource.group_id\n vars[:upload_cmd] = \"curl -s -S -u #{vars[:user]}:#{vars[:password]} -F\" +\n \" package=@#{vars[:file_path]} http://localhost:\" +\n \"#{vars[:port]}/crx/packmgr/service/.json?cmd=upload\"\n vars[:delete_cmd] = \"curl -s -S -u #{vars[:user]}:#{vars[:password]} -X\" +\n \" POST http://localhost:#{vars[:port]}/crx/packmgr/\" +\n \"service/.json/etc/packages/#{vars[:group_id]}/\" +\n \"#{vars[:file_name]}?cmd=delete\"\n vars[:install_cmd] = \"curl -s -S -u #{vars[:user]}:#{vars[:password]} -X\" +\n \" POST http://localhost:#{vars[:port]}/crx/packmgr/\" +\n \"service/.json/etc/packages/#{vars[:group_id]}/\" +\n \"#{vars[:file_name]}?cmd=install#{vars[:recursive]}\"\n vars[:activate_cmd] = \"curl -s -S -u #{vars[:user]}:#{vars[:password]} -X\" +\n \" POST http://localhost:#{vars[:port]}/crx/packmgr/\" +\n \"service/.json/etc/packages/#{vars[:group_id]}/\" +\n \"#{vars[:file_name]}?cmd=replicate\"\n vars[:uninstall_cmd] = \"curl -s -S -u #{vars[:user]}:#{vars[:password]} -X\" +\n \" POST http://localhost:#{vars[:port]}/crx/packmgr/\" +\n \"service/.json/etc/packages/#{vars[:group_id]}/\" +\n \"#{vars[:file_name]}?cmd=uninstall\"\n\n vars\nend",
"def os_group\n @os_group\n end",
"def load_current_resource\n # Chef 12 @current_resource = Chef::Resource::IbmCloudUtilsSelinux.new(@new_resource.name)\n @current_resource = Chef::Resource.resource_for_node(:ibm_cloud_utils_selinux, node).new(@new_resource.name)\n cmnd = shell_out('getenforce')\n @current_resource.status(cmnd.stdout.chomp.downcase)\nend",
"def ova_name\n \"puppet-#{pe_version}-learning-#{PTB_VERSION[:major]}.#{PTB_VERSION[:minor]}.ova\"\nend",
"def upgrade_direct!\n package \"Chef Development Kit v#{package_metadata[:version]}\" do\n source package_metadata[:url]\n checksum package_metadata[:sha256]\n end\n end",
"def content\n return <<-EOF\ndefault lucie\n\nlabel lucie\nkernel #{ INSTALLER_KERNEL }\nappend initrd=#{ initrd } ip=dhcp devfs=nomount root=/dev/nfs nfsroot=#{ @nfsroot } boot=live hostname=#{ @node.name } #{ $KERNEL_OPTIONS }\nEOF\n end",
"def web_copy_boot_prop_file\r\n Puppet.alert(\" begin : web_copy_boot_prop_file.bsh \")\r\n lcl_bash_fle_location = get_value4key(\"bash_file_location\", resource[:web_scripts_location] )\r\n lcl_ps_location_arr = resource[:web_location_attrib]\r\n env_action_cmd = lcl_bash_fle_location + \"/web_copy_boot_prop_file.bsh \"\r\n\r\n\r\n ##Even if SOURCE_HOST and TARGET_HOST are same then copy boot properties\r\n ##PS_CONFIG_HOME\r\n env_action_cmd += \" '\" + get_value4key(\"ps_config_home\", resource[:web_location_attrib])+ \"' \"\r\n\r\n ##SOURCE_HOST\r\n env_action_cmd += \" '\" + get_value4key(\"webadminserverhost\", resource[:webadmin_server_attrib])+ \"' \"\r\n\r\n ##SOURCE_DOMAIN\r\n ##env_action_cmd += \" '\" + (get_value4key(\"websitename\", resource[:webadmin_server_attrib])).upcase + \"1_1' \"\r\n env_action_cmd += \" '\" + get_value4key(\"webadmindomainname\", resource[:webadmin_server_attrib]) + \"' \"\r\n ##TARGET_DOMAIN\r\n env_action_cmd += \" '\" + get_value4key(\"webdomainname\", resource[:webdomain_attrib])+ \"' \"\r\n ##DOMAIN_ADMIN_USER\r\n env_action_cmd += \" '\" + get_value4key(\"webadminloginid\", resource[:webadmin_server_attrib]) + \"' \"\r\n ##DOMAIN_ADMIN_PWD\r\n env_action_cmd += \" '\" + get_decrypt_str( get_value4key2(\"webadminloginpwd\", resource[:web_pwd_attrib])) + \"' \"\r\n\r\n ##Puppet.debug(\" env_action_cmd: #{env_action_cmd}\")\r\n Puppet.alert(\" env_action_cmd: #{env_action_cmd}\")\r\n\r\n command_output = execute_command(env_action_cmd, true)\r\n Puppet.alert(\" dapps_start_stop_PIA_domain : #{command_output}\")\r\n if command_output.include? \"COPY\"\r\n return true\r\n else\r\n return false\r\n end\r\n return true \r\n end",
"def cookbook_copyright(*args, &block)\n ChefConfig::Config.cookbook_copyright(*args, &block) || \"YOUR_NAME\"\n end",
"def bootstrap\n @inventory.add(@server.config['name'], @server.windows? ? @server.canonicalIP : @server.mu_name)\n play = {\n \"hosts\" => @server.config['name']\n }\n\n if !@server.windows? and @server.config['ssh_user'] != \"root\"\n play[\"become\"] = \"yes\"\n end\n\n if @server.windows?\n play[\"roles\"] = [\"mu-windows\"]\n else\n play[\"roles\"] = [\"mu-base\"]\n end\n if @server.config['run_list']\n play[\"roles\"].concat(@server.config['run_list'])\n end\n\n if @server.config['ansible_vars']\n play[\"vars\"] = @server.config['ansible_vars']\n end\n\n if @server.windows?\n play[\"vars\"] ||= {}\n play[\"vars\"][\"ansible_connection\"] = \"winrm\"\n play[\"vars\"]['ansible_python_interpreter'] = \"c:/bin/python/python310/python.exe\"\n play[\"vars\"][\"ansible_winrm_scheme\"] = \"https\"\n play[\"vars\"][\"ansible_winrm_transport\"] = \"ntlm\"\n play[\"vars\"][\"ansible_winrm_server_cert_validation\"] = \"ignore\" # XXX this sucks; use Mu_CA.pem if we can get it to work\n# play[\"vars\"][\"ansible_winrm_ca_trust_path\"] = \"#{MU.mySSLDir}/Mu_CA.pem\"\n play[\"vars\"][\"ansible_user\"] = @server.config['windows_admin_username']\n win_pw = @server.getWindowsAdminPassword\n\n pwfile = MU::Groomer::Ansible.vaultPasswordFile\n cmd = %Q{#{MU::Groomer::Ansible.ansibleExecDir}/ansible-vault}\n output = %x{#{cmd} encrypt_string '#{win_pw.gsub(/'/, \"\\\\\\\\'\")}' --vault-password-file #{pwfile}}\n\n play[\"vars\"][\"ansible_password\"] = output\n end\n\n File.open(@ansible_path+\"/\"+@server.config['name']+\".yml\", File::CREAT|File::RDWR|File::TRUNC, 0600) { |f|\n f.flock(File::LOCK_EX)\n f.puts [play].to_yaml.sub(/ansible_password: \\|-?[\\n\\s]+/, 'ansible_password: ') # Ansible doesn't like this (legal) YAML\n f.flock(File::LOCK_UN)\n }\n end",
"def set_provider_config(vm_instance, ci_vm_definition)\n \n vm_instance.vm.provider :virtualbox do |vm|\n \n vm.linked_clone = ci_vm_definition[\"clone\"] || false\n \n vm.customize [\"modifyvm\", :id, \"--memory\", ci_vm_definition[\"memory\"] ]\n vm.customize [\"modifyvm\", :id, \"--cpus\", ci_vm_definition[\"cpu\"] ]\n\n vm.customize [\"modifyvm\", :id, \"--vram\", \"256\"]\n if ci_vm_definition[\"3d\"] == true then\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"on\"]\n else\n vm.customize [\"modifyvm\", :id, \"--accelerate3d\", \"off\"]\n end\n \n if ci_vm_definition[\"sound\"] == true then\n vm.customize [\"modifyvm\", :id, \"--audio\", \"null\", \"--audiocontroller\", \"hda\"]\n end\n \n vm.customize [\"modifyvm\", :id, \"--ioapic\", \"on\"]\n vm.customize [\"setextradata\", \"global\", \"GUI/SuppressMessages\", \"all\"]\n \n vm.gui = ci_vm_definition[\"gui\"] || true\n end\n \n vm_instance.vm.box = ci_vm_definition[\"box\"]\n \n end",
"def define_vm config, role, index, ip, memory = 512\n id = (index + 1).to_s.rjust(3, '0')\n config.vm.define \"#{role}_#{id}\" do |box|\n box.vm.customize [ \"modifyvm\", :id, \"--memory\", memory ]\n box.vm.box = \"centos_6_3\"\n box.vm.box_url = \"https://dl.dropbox.com/u/7225008/Vagrant/CentOS-6.3-x86_64-minimal.box\"\n box.vm.network :hostonly, \"192.168.34.#{ip}\", :netmask => \"255.255.255.0\"\n box.vm.host_name = \"#{role.downcase.gsub(/[^a-z0-9]+/, '-')}-#{id}.esi.dev\"\n #box.vm.provision :shell, :path => \"script/bootstrap-vm.sh\"\n box.vm.provision :puppet, :module_path => \"modules\" do |p|\n p.manifests_path = \"manifests\"\n p.manifest_file = \"site.pp\"\n end\n end\nend",
"def _sc_nkey\n\t\t\"#{Search_control_prefix}.agents\"\n\tend",
"def token_cassette\n return 'iam_token' if ENV['IBM_CLOUD_DISABLE_TOKEN'] == 'true'\n\n 'Test_vpc_API/vpc'\nend",
"def configure_nb_vbox_vm(client_name,client_mac,client_arch,client_os,client_rel)\n client_os = \"NetBSD\"\n if client_arch.match(/x86_64/)\n client_os = client_os+\"_64\"\n end\n configure_vbox_vm(client_name,client_mac,client_os)\n return\nend",
"def configure_ks_pxe_client(options)\n options['ip'] = single_install_ip(options)\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = options['tftpdir']+\"/\"+tftp_pxe_file\n tmp_file = \"/tmp/pxecfg\"\n if File.symlink?(test_file)\n message = \"Information:\\tRemoving old PXE boot file \"+test_file\n command = \"rm #{test_file}\"\n execute_command(options,message,command)\n end\n pxelinux_file = \"pxelinux.0\"\n message = \"Information:\\tCreating PXE boot file for \"+options['name']+\" with MAC address \"+options['mac']\n command = \"cd #{options['tftpdir']} ; ln -s #{pxelinux_file} #{tftp_pxe_file}\"\n execute_command(options,message,command)\n if options['service'].to_s.match(/live/)\n iso_dir = options['tftpdir']+\"/\"+options['service']\n message = \"Information:\\tDetermining install ISO location\"\n command = \"ls #{iso_dir}/*.iso\"\n iso_file = execute_command(options,message,command) \n iso_file = iso_file.chomp\n install_iso = File.basename(iso_file)\n end\n if options['biostype'].to_s.match(/efi/)\n shim_efi_file = \"/usr/lib/shim/shimx64.efi\"\n if !File.exist?(shim_efi_file)\n install_package(options,\"shim\")\n end\n shim_grub_file = options['tftpdir']+\"/shimx64.efi\"\n net_efi_file = \"/usr/lib/grub/x86_64-efi/monolithic/grubnetx64.efi\"\n if !File.exist?(net_efi_file)\n install_package(options,\"grub-efi-amd64-bin\")\n end\n net_grub_file = options['tftpdir']+\"/grubx64.efi\"\n check_dir_exists(options,options['tftpdir'])\n check_dir_owner(options,options['tftpdir'],options['uid'])\n if !File.exist?(shim_efi_file)\n install_package(options,\"shim-signed\")\n end\n if !File.exist?(net_efi_file)\n install_package(options,\"grub-efi-amd64-signed\")\n end\n if !File.exist?(shim_grub_file)\n message = \"Information:\\tCopying #{shim_efi_file} to #{shim_grub_file}\"\n command = \"cp #{shim_efi_file} #{shim_grub_file}\"\n execute_command(options,message,command)\n check_file_owner(options,shim_grub_file,options['uid'])\n end\n if !File.exist?(net_grub_file)\n message = \"Information:\\tCopying #{net_efi_file} to #{net_grub_file}\"\n command = \"cp #{net_efi_file} #{net_grub_file}\"\n execute_command(options,message,command)\n check_file_owner(options,net_grub_file,options['uid'])\n end\n tmp_cfg_octs = options['ip'].split(\".\")\n pxe_cfg_octs = [] \n tmp_cfg_octs.each do |octet|\n hextet = octet.convert_base(10, 16)\n if hextet.length < 2\n hextet = \"0\"+hextet\n end\n pxe_cfg_octs.push(hextet.upcase) \n end\n pxe_cfg_txt = pxe_cfg_octs.join\n pxe_cfg_file = \"grub.cfg-\"+pxe_cfg_txt\n pxe_cfg_dir = options['tftpdir']+\"/grub\"\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n else\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n pxe_cfg_file = options['mac'].gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n end\n if options['service'].to_s.match(/sles/)\n vmlinuz_file = \"/\"+options['service']+\"/boot/#{options['arch']}/loader/linux\"\n else\n if options['service'].to_s.match(/live/)\n vmlinuz_file = \"/\"+options['service']+\"/casper/vmlinuz\"\n else\n vmlinuz_file = \"/\"+options['service']+\"/images/pxeboot/vmlinuz\"\n end\n end\n if options['service'].to_s.match(/ubuntu/)\n if options['service'].to_s.match(/live/)\n initrd_file = \"/\"+options['service']+\"/casper/initrd\"\n else\n if options['service'].to_s.match(/x86_64/)\n initrd_file = \"/\"+options['service']+\"/images/pxeboot/netboot/ubuntu-installer/amd64/initrd.gz\"\n linux_file = \"/\"+options['service']+\"/images/pxeboot/netboot/ubuntu-installer/amd64/linux\"\n else\n initrd_file = \"/\"+options['service']+\"/images/pxeboot/netboot/ubuntu-installer/i386/initrd.gz\"\n end\n end\n ldlinux_link = options['tftpdir']+\"/ldlinux.c32\"\n if not File.exist?(ldlinux_link) and not File.symlink?(ldlinux_link)\n ldlinux_file = options['service']+\"/images/pxeboot/netboot/ldlinux.c32\"\n message = \"Information:\\tCreating symlink for ldlinux.c32\"\n command = \"ln -s #{ldlinux_file} #{ldlinux_link}\"\n execute_command(options,message,command)\n end\n else\n if options['service'].to_s.match(/sles/)\n initrd_file = \"/\"+options['service']+\"/boot/#{options['arch']}/loader/initrd\"\n else\n initrd_file = \"/\"+options['service']+\"/images/pxeboot/initrd.img\"\n end\n end\n if options['host-os-name'].to_s.match(/Darwin/)\n vmlinuz_file = vmlinuz_file.gsub(/^\\//,\"\")\n initrd_file = initrd_file.gsub(/^\\//,\"\")\n end\n if options['service'].to_s.match(/packer/)\n host_info = options['vmgateway']+\":\"+options['httpport']\n else\n host_info = options['hostip']\n end\n #ks_url = \"http://\"+host_info+\"/clients/\"+options['service']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n #autoyast_url = \"http://\"+host_info+\"/clients/\"+options['service']+\"/\"+options['name']+\"/\"+options['name']+\".xml\"\n base_url = \"http://\"+options['hostip']+\"/\"+options['name']\n if options['service'].to_s.match(/live/)\n iso_url = \"http://\"+options['hostip']+\"/\"+options['service']+\"/\"+install_iso\n end\n ks_url = \"http://\"+options['hostip']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n autoyast_url = \"http://\"+options['hostip']+\"/\"+options['name']+\"/\"+options['name']+\".xml\"\n install_url = \"http://\"+host_info+\"/\"+options['service']\n file = File.open(tmp_file,\"w\")\n if options['biostype'].to_s.match(/efi/)\n menuentry = \"menuentry \\\"\"+options['name']+\"\\\" {\\n\"\n file.write(menuentry)\n else\n if options['serial'] == true\n file.write(\"serial 0 115200\\n\")\n file.write(\"prompt 0\\n\")\n end\n file.write(\"DEFAULT LINUX\\n\")\n file.write(\"LABEL LINUX\\n\")\n file.write(\" KERNEL #{vmlinuz_file}\\n\")\n if options['service'].to_s.match(/live/)\n file.write(\" INITRD #{initrd_file}\\n\")\n end\n end\n if options['service'].to_s.match(/ubuntu/)\n options['ip'] = options['q_struct']['ip'].value\n install_domain = options['q_struct']['domain'].value\n install_nic = options['q_struct']['nic'].value\n options['vmgateway'] = options['q_struct']['gateway'].value\n options['netmask'] = options['q_struct']['netmask'].value\n options['vmnetwork'] = options['q_struct']['network_address'].value\n disable_dhcp = options['q_struct']['disable_dhcp'].value\n if disable_dhcp.match(/true/)\n if options['biostype'].to_s.match(/efi/)\n if options['service'].to_s.match(/live/)\n linux_file = \"/\"+options['service'].to_s+\"/casper/vmlinuz\"\n initrd_file = \"/\"+options['service'].to_s+\"/casper/initrd\"\n if options['biosdevnames'] == true\n append_string = \" linux #{linux_file} net.ifnames=0 biosdevname=0 root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url} autoinstall ds=nocloud-net;s=#{base_url}/\"\n else\n append_string = \" linux #{linux_file} root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url} autoinstall ds=nocloud-net;s=#{base_url}/\"\n end\n initrd_string = \" initrd #{initrd_file}\"\n else\n if options['biosdevnames'] == true\n append_string = \" linux #{linux_file} --- auto=true priority=critical preseed/url=#{ks_url} console-keymaps-at/keymap=us locale=en_US hostname=#{options['name']} domain=#{install_domain} interface=#{install_nic} grub-installer/bootdev=#{options['rootdisk']} netcfg/get_ipaddress=#{options['ip']} netcfg/get_netmask=#{options['netmask']} netcfg/get_gateway=#{options['vmgateway']} netcfg/get_nameservers=#{options['nameserver']} netcfg/disable_dhcp=true initrd=#{initrd_file} net.ifnames=0 biosdevname=0\"\n else\n append_string = \" linux #{linux_file} --- auto=true priority=critical preseed/url=#{ks_url} console-keymaps-at/keymap=us locale=en_US hostname=#{options['name']} domain=#{install_domain} interface=#{install_nic} grub-installer/bootdev=#{options['rootdisk']} netcfg/get_ipaddress=#{options['ip']} netcfg/get_netmask=#{options['netmask']} netcfg/get_gateway=#{options['vmgateway']} netcfg/get_nameservers=#{options['nameserver']} netcfg/disable_dhcp=true initrd=#{initrd_file}\"\n end\n initrd_string = \" initrd #{initrd_file}\"\n end\n else\n if options['service'].to_s.match(/live/)\n if options['biosdevnames'] == true\n append_string = \" APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url} autoinstall ds=nocloud-net;s=#{base_url}/ net.ifnames=0 biosdevname=0\"\n else\n append_string = \" APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url} autoinstall ds=nocloud-net;s=#{base_url}/\"\n end\n else\n if options['biosdevnames'] == true\n append_string = \" APPEND auto=true priority=critical preseed/url=#{ks_url} console-keymaps-at/keymap=us locale=en_US hostname=#{options['name']} domain=#{install_domain} interface=#{install_nic} grub-installer/bootdev=#{options['rootdisk']} netcfg/get_ipaddress=#{options['ip']} netcfg/get_netmask=#{options['netmask']} netcfg/get_gateway=#{options['vmgateway']} netcfg/get_nameservers=#{options['nameserver']} netcfg/disable_dhcp=true initrd=#{initrd_file} net.ifnames=0 biosdevname=0\"\n else\n append_string = \" APPEND auto=true priority=critical preseed/url=#{ks_url} console-keymaps-at/keymap=us locale=en_US hostname=#{options['name']} domain=#{install_domain} interface=#{install_nic} grub-installer/bootdev=#{options['rootdisk']} netcfg/get_ipaddress=#{options['ip']} netcfg/get_netmask=#{options['netmask']} netcfg/get_gateway=#{options['vmgateway']} netcfg/get_nameservers=#{options['nameserver']} netcfg/disable_dhcp=true initrd=#{initrd_file}\"\n end\n end\n end\n else\n append_string = \" APPEND \"\n end\n else\n if options['service'].to_s.match(/sles/)\n if options['biosdevnames'] == true\n append_string = \" APPEND initrd=#{initrd_file} install=#{install_url} autoyast=#{autoyast_url} language=#{options['language']} net.ifnames=0 biosdevname=0\"\n else\n append_string = \" APPEND initrd=#{initrd_file} install=#{install_url} autoyast=#{autoyast_url} language=#{options['language']}\"\n end\n else\n if options['service'].to_s.match(/fedora_2[0-3]/)\n if options['biosdevnames'] == true\n append_string = \" APPEND initrd=#{initrd_file} ks=#{ks_url} ip=#{options['ip']} netmask=#{options['netmask']} net.ifnames=0 biosdevname=0\"\n else\n append_string = \" APPEND initrd=#{initrd_file} ks=#{ks_url} ip=#{options['ip']} netmask=#{options['netmask']}\"\n end\n else\n if options['service'].to_s.match(/live/)\n if options['biosdevnames'] == true\n append_string = \" APPEND net.ifnames=0 biosdevname=0 root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url}\"\n else\n append_string = \" APPEND root=/dev/ram0 ramdisk_size=1500000 ip=dhcp url=#{iso_url}\"\n end\n else \n if options['biosdevnames'] == true\n append_string = \" APPEND initrd=#{initrd_file} ks=#{ks_url} ksdevice=bootif ip=#{options['ip']} netmask=#{options['netmask']} net.ifnames=0 biosdevname=0\"\n else\n append_string = \" APPEND initrd=#{initrd_file} ks=#{ks_url} ksdevice=bootif ip=#{options['ip']} netmask=#{options['netmask']}\"\n end\n end\n end\n end\n end\n if options['text'] == true\n if options['service'].to_s.match(/sles/)\n append_string = append_string+\" textmode=1\"\n else\n append_string = append_string+\" text\"\n end\n end\n if options['serial'] == true\n append_string = append_string+\" serial console=ttyS0\"\n end\n append_string = append_string+\"\\n\"\n file.write(append_string)\n if options['biostype'].to_s.match(/efi/)\n initrd_string = initrd_string+\"\\n\"\n file.write(initrd_string)\n file.write(\"}\\n\")\n end\n file.flush\n file.close\n if options['biostype'].to_s.match(/efi/)\n grub_file = pxe_cfg_dir+\"/grub.cfg\"\n if File.exist?(grub_file)\n File.delete(grub_file)\n end\n FileUtils.touch(grub_file)\n grub_file = File.open(grub_file, \"w\")\n file_list = Dir.entries(pxe_cfg_dir)\n file_list.each do |file_name|\n if file_name.match(/cfg\\-/) and !file_name.match(/#{options['name'].to_s}/)\n temp_file = pxe_cfg_dir+\"/\"+file_name\n temp_array = File.readlines(temp_file)\n temp_array.each do |temp_line|\n grub_file.write(temp_line)\n end\n end\n end\n menuentry = \"menuentry \\\"\"+options['name']+\"\\\" {\\n\"\n grub_file.write(menuentry)\n grub_file.write(append_string)\n grub_file.write(initrd_string)\n grub_file.write(\"}\\n\")\n grub_file.flush\n grub_file.close\n grub_file = pxe_cfg_dir+\"/grub.cfg\"\n FileUtils.touch(grub_file)\n print_contents_of_file(options,\"\",grub_file)\n end\n message = \"Information:\\tCreating PXE configuration file \"+pxe_cfg_file\n command = \"cp #{tmp_file} #{pxe_cfg_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n print_contents_of_file(options,\"\",pxe_cfg_file)\n return\nend",
"def package_resource_class\n Chef::Resource::WindowsPackage\n end",
"def define_centos_5\n { 'name' => 'centos-5.10',\n 'driver_config' => { 'template' => 'centos-5.10-x86_64-solus',\n 'plan' => 'VPS2',\n 'node' => 'chefsolushv',\n 'privileged' => 'true',\n 'type' => 'xen',\n 'platform' => 'centos',\n 'use_sudo' => 'false',\n 'username' => 'internal' } }\n end",
"def configure_vmware_vbox_vm(client_name)\n modify_vbox_vm(client_name,\"rtcuseutc\",\"on\")\n modify_vbox_vm(client_name,\"vtxvpid\",\"on\")\n modify_vbox_vm(client_name,\"vtxux\",\"on\")\n modify_vbox_vm(client_name,\"hwvirtex\",\"on\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVersion\",\"None\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardVendor\",\"Intel Corporation\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBoardProduct\",\"440BX Desktop Reference Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemVendor\",\"VMware, Inc.\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemProduct\",\"VMware Virtual Platform\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVendor\",\"Phoenix Technologies LTD\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiBIOSVersion\",\"6.0\")\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiChassisVendor\",\"No Enclosure\")\n vbox_vm_uuid = get_vbox_vm_uuid(client_name)\n vbox_vm_uuid = \"VMware-\"+vbox_vm_uuid\n setextradata_vbox_vm(client_name,\"VBoxInternal/Devices/pcbios/0/Config/DmiSystemSerial\",vbox_vm_uuid)\n return\nend",
"def no_remote_instructions(unlicensed)\n puts <<-INST\nThere is no license defined for #{counter(unlicensed)}. You are running with the `--disable-api`\noption. If you remove this option, gemterms will attempt to use RubyGems and \nother sources for license information.\nINST\n true\n end",
"def keimpx_wrapper\n\t\tprint_status(\"Simple Wrapper for the KEIMPX SMB Tool\")\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Targeting Method: \")\n\t\t\tprint_caution(\"1) Single IP/Range\")\n\t\t\tprint_caution(\"2) List with Targets\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer == '1'\n\t\t\t\tprint_caution(\"Please Provide Target IP: \")\n\t\t\t\tt=gets.chomp\n\t\t\t\tzIP=\"-t #{t}\"\n\t\t\t\tbreak\n\t\t\telsif answer == '2'\n\t\t\t\tprint_caution(\"Please Provide Target List: \")\n\t\t\t\tdfile=gets.chomp\n\t\t\t\tif File.exists?(dfile)\n\t\t\t\t\tzIP=\"-l #{dfile}\"\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tprint_error(\"Can't seem to find provided target list!\")\n\t\t\t\t\tprint_error(\"Check the permissions or the path and try again.....\")\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\twhile(true)\n\t\t\tprint_caution(\"Select Credentials Method: \")\n\t\t\tprint_caution(\"1) Known Username & Password Plaintext\")\n\t\t\tprint_caution(\"2) Known Username & Password Hash\")\n\t\t\tprint_caution(\"3) List File with Known Credentials (Hashdump)\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer == '1'\n\t\t\t\tprint_caution(\"Provide Username: \")\n\t\t\t\tzUSER=gets.chomp\n\n\t\t\t\tprint_caution(\"Provide Password: \")\n\t\t\t\tzPASS=gets.chomp\n\t\t\t\tzCREDS=\"-U #{zUSER} -P #{zPASS}\"\n\t\t\t\tbreak\n\t\t\telsif answer == '2'\n\t\t\t\tprint_caution(\"Provide Username: \")\n\t\t\t\tzUSER=gets.chomp\n\n\t\t\t\tprint_caution(\"Provide LM Hash: \")\n\t\t\t\tzLM=gets.chomp\n\n\t\t\t\tprint_caution(\"Provide NT Hash: \")\n\t\t\t\tzNT=gets.chomp\n\t\t\t\tzCREDS=\"-U #{zUSER} --lm=#{zLM} --nt=#{zNT}\"\n\t\t\t\tbreak\n\t\t\telsif answer == '3'\n\t\t\t\tprint_caution(\"Please Provide Credentials File: \")\n\t\t\t\tdfile=gets.chomp\n\t\t\t\tif File.exists?(dfile)\n\t\t\t\t\tzCREDS=\"-c #{dfile}\"\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tprint_caution(\"Include Domain info (Y/N)?\")\n\t\tanswer=gets.chomp\n\t\tif answer.upcase == 'Y' or answer.upcase == 'YES'\n\t\t\tprint_caution(\"1) Single Domain\")\n\t\t\tprint_caution(\"2) List of Domains\")\n\t\t\tanswer=gets.chomp\n\t\t\tif answer == '2'\n\t\t\t\tprint_caution(\"Provide Domain List File: \")\n\t\t\t\tdomfile=gets.chomp\n\t\t\t\tif File.exists?(domfile)\n\t\t\t\t\tzDomain=\" -d #{domfile}\"\n\t\t\t\telse\n\t\t\t\t\tprint_error(\"\")\n\t\t\t\t\tprint_error(\"Can't find the provided Domain list file!\")\n\t\t\t\t\tprint_error(\"Check the permissions or the path and try again, moving forward with out it....\")\n\t\t\t\t\tzDomain=''\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tprint_caution(\"Provide Domain: \")\n\t\t\t\tdom=gets.chomp\n\t\t\t\tzDomain=\" -D #{dom}\"\n\t\t\tend\n\t\telse\n\t\t\tzDomain=''\n\t\tend\n\t\tprint_caution(\"Select Port: \")\n\t\tprint_caution(\"1) 445 (Default)\")\n\t\tprint_caution(\"2) 139\")\n\t\tanswer=gets.chomp\n\t\tif answer == '2'\n\t\t\tzPORT=' -p 139'\n\t\telse\n\t\t\tzPORT=' '\n\t\tend\n\t\tprint_status(\"Launching KEIMPX in new window, hang tight.....\")\n\t\tk = \"#{KEIMPX}/keimpx.py #{zIP} #{zCREDS}#{zPORT}#{zDomain}\"\n\t\tkeimpx=\"xterm -title 'KEIMPX' -font -*-fixed-medium-r-*-*-18-*-*-*-*-*-iso8859-* -e \\\"bash -c '#{k}'\\\"\"\n\t\tfireNforget(keimpx)\n\t\tprint_line(\"\")\n\tend",
"def getclconfig\n #@creds = @current_user.clouds.all.sort_by(&:provider)\n @stack = Appman.find_by_uuid(params[:uuid])\n @creds = @stack.clouds.all.sort_by(&:provider)\n #@creds = Cloud.all.sort_by(&:provider)\n @azure = false\n @google = false\n @kubernetes = false\n @openstack = false\n @dockerregistry = false\n @aws = false\n @creds.each do |c|\n case c.provider\n when \"azure\"\n @azure = true\n when \"google\"\n @google = true\n when \"kubernetes\"\n @kubernetes = true\n when \"openstack\"\n @openstack = true\n when \"dockerregistry\"\n @dockerregistry = true\n when \"aws\"\n @aws = true\n end\n end\n @appmenid = params[:uuid]\n render \"clouds/getclconfig\", layout: false\n end",
"def define_driver\n { 'name' => 'solusvm',\n 'privileged' => 'true'\n }\n end",
"def installed_packages()\n\t\t\tend",
"def deregister_node\n case node['platform']\n when 'windows'\n # Create temp directory where we copy/create source files to install tscm agent\n directory \"#{node['tscm']['temp']}\" do\n action :create\n not_if { ::File.directory?(node['tscm']['temp']) }\n end\n # copy tscm proxy key of tscm server on Node\n cookbook_file \"#{node['tscm']['temp']}\\\\#{node['tscm']['native_proxykey']}\" do\n source \"#{node['tscm']['native_proxykey']}\"\n action :create\n not_if { ::File.exist?(\"#{node['tscm']['temp']}\\\\#{node['tscm']['native_proxykey']}\") }\n end\n # fix permissions of client side files keys\n powershell_script 'fix_keyfile_permission' do\n code <<-EOH\n cd 'C:/Program Files/OpenSSH-Win64/'\n Import-Module ./OpenSSHUtils.psd1 -Force \n Repair-UserKeyPermission -FilePath 'C:\\\\tscm_temp\\\\SCM_id_rsa' -Confirm:$false\n EOH\n only_if { ::File.exist?(\"#{node['tscm']['temp']}\\\\#{node['tscm']['native_proxykey']}\") }\n end\n\n # Deregister of the Node\n ruby_block 'deregister_node' do\n block do\n Chef::Log.info('Deregistering the node from TSCM server')\n powershell_out(\"C:/PROGRA~1/OpenSSH-Win64/ssh.exe -o StrictHostKeyChecking=no -i #{node['tscm']['temp']}/SCM_id_rsa #{node['tscm']['TSCMProxy_user']}@#{node['tscm']['TSCMProxy_server']} powershell #{node['tscm']['tscmWrapper_path']} del #{node['tscm']['hostname']} w2k12\")\n end\n action :create\n end\n \n # Deleting the Temp file\n directory node['tscm']['temp'].to_s do\n recursive true\n action :delete\n end\n end\nend",
"def configure_xb_pxe_client(client_name,client_ip,client_mac,client_arch,service_name,publisher_host)\n os_version = service_name.split(/_/)[1..2].join(\".\")\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tmp_file = \"/tmp/pxecfg\"\n if service_name.match(/openbsd/)\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxeboot\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n pxeboot_file = service_name+\"/\"+os_version+\"/\"+client_arch.gsub(/x86_64/,\"amd64\")+\"/pxeboot\"\n else\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n pxeboot_file = service_name+\"/isolinux/pxelinux.0\"\n end\n if File.symlink?(test_file)\n message = \"Removing:\\tOld PXE boot file \"+test_file\n command = \"rm #{test_file}\"\n execute_command(message,command)\n end\n message = \"Creating:\\tPXE boot file for \"+client_name+\" with MAC address \"+client_mac\n command = \"cd #{$tftp_dir} ; ln -s #{pxeboot_file} #{tftp_pxe_file}\"\n execute_command(message,command)\n if service_name.match(/coreos/)\n ldlinux_file = $tftp_dir+\"/\"+service_name+\"/isolinux/ldlinux.c32\"\n ldlinux_link = $tftp_dir+\"/ldlinux.c32\"\n if !File.exist?(ldlinux_link)\n message = \"Copying:\\tFile #{ldlinux_file} #{ldlinux_link}\"\n command = \"cp #{ldlinux_file} #{ldlinux_link}\"\n execute_command(message,command)\n end\n client_dir = $client_base_dir+\"/\"+service_name+\"/\"+client_name\n client_file = client_dir+\"/\"+client_name+\".yml\"\n client_url = \"http://\"+publisher_host+\"/clients/\"+service_name+\"/\"+client_name+\"/\"+client_name+\".yml\"\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n vmlinuz_file = \"/\"+service_name+\"/coreos/vmlinuz\"\n initrd_file = \"/\"+service_name+\"/coreos/cpio.gz\"\n file = File.open(tmp_file,\"w\")\n file.write(\"default coreos\\n\")\n file.write(\"prompt 1\\n\")\n file.write(\"timeout 3\\n\")\n file.write(\"label coreos\\n\")\n file.write(\" menu default\\n\")\n file.write(\" kernel #{vmlinuz_file}\\n\")\n file.write(\" append initrd=#{initrd_file} cloud-config-url=#{client_url}\\n\")\n file.close\n message = \"Creating:\\tPXE configuration file \"+pxe_cfg_file\n command = \"cp #{tmp_file} #{pxe_cfg_file} ; rm #{tmp_file}\"\n execute_command(message,command)\n print_contents_of_file(pxe_cfg_file)\n end\n return\nend",
"def create_security_group_iso(iso)\n @logger.info(\"Creating SecurityGroup #{iso.name}\")\n sg = SugarCRM::SecurityGroup.new(:name => iso.name) unless find_sugarcrm_object('security_group','name', iso.name)\n sg.save! if sg\n end",
"def add_features(features, group_overrides=[], init_git_url=nil, user_env_vars=nil)\n ssl_endpoint = Rails.application.config.openshift[:ssl_endpoint]\n cart_name_map = {}\n\n features.each do |feature_name|\n cart = CartridgeCache.find_cartridge(feature_name, self)\n\n # Make sure this is a valid cartridge\n if cart.nil?\n raise OpenShift::UserException.new(\"Invalid cartridge '#{feature_name}' specified.\", 109)\n end\n\n # ensure that the user isn't trying to add multiple versions of the same cartridge\n if cart_name_map.has_key?(cart.original_name)\n raise OpenShift::UserException.new(\"#{cart.name} cannot co-exist with #{cart_name_map[cart.original_name]} in the same application\", 109)\n else\n cart_name_map[cart.original_name] = cart.name\n end\n\n if cart.is_web_framework?\n component_instances.each do |ci|\n if ci.is_web_framework?\n raise OpenShift::UserException.new(\"You can only have one framework cartridge in your application '#{name}'.\", 109)\n end\n end\n end\n\n # check if the requested feature is provided by any existing/embedded application cartridge\n component_instances.each do |ci|\n ci_cart = ci.get_cartridge\n if ci_cart.original_name == cart.original_name\n raise OpenShift::UserException.new(\"#{feature_name} cannot co-exist with cartridge #{ci.cartridge_name} in your application\", 109)\n end\n end\n\n if cart.is_web_framework? and defined?(cart.endpoints) and cart.endpoints.respond_to?(:each)\n cart_req_ssl_endpoint = false\n cart.endpoints.each do |endpoint|\n if endpoint.options and endpoint.options[\"ssl_to_gear\"]\n cart_req_ssl_endpoint = true\n end\n end\n if (((ssl_endpoint == \"deny\") and cart_req_ssl_endpoint ) or\n ((ssl_endpoint == \"force\") and not cart_req_ssl_endpoint))\n raise OpenShift::UserException.new(\"Invalid cartridge '#{feature_name}' conflicts with platform SSL_ENDPOINT setting.\", 109, \"cartridge\")\n end\n end\n\n # Validate that the features support scalable if necessary\n if self.scalable && !(cart.is_plugin? || cart.is_service?)\n if cart.is_web_framework?\n raise OpenShift::UserException.new(\"Scalable app cannot be of type '#{feature_name}'.\", 109)\n else\n raise OpenShift::UserException.new(\"#{feature_name} cannot be embedded in scalable app '#{name}'.\", 109)\n end\n end\n\n # prevent a proxy from being added to a non-scalable (single-gear) application\n if cart.is_web_proxy? and !self.scalable\n raise OpenShift::UserException.new(\"#{feature_name} cannot be added to existing applications. It is automatically added when you create a scaling application.\", 137)\n end\n\n if self.scalable and cart.is_web_framework?\n prof = cart.profile_for_feature(feature_name)\n cart_scalable = false\n prof.components.each do |component|\n next if component.scaling.min==1 and component.scaling.max==1\n cart_scalable = true\n end\n if !cart_scalable\n raise OpenShift::UserException.new(\"Scalable app cannot be of type '#{feature_name}'.\", 109)\n end\n end\n\n # Validate that this feature either does not have the domain_scope category\n # or if it does, then no other application within the domain has this feature already\n if cart.is_domain_scoped?\n begin\n if Application.where(domain_id: self.domain._id, \"component_instances.cartridge_name\" => cart.name).count() > 0\n raise OpenShift::UserException.new(\"An application with #{feature_name} already exists within the domain. You can only have a single application with #{feature_name} within a domain.\")\n end\n rescue Mongoid::Errors::DocumentNotFound\n #ignore\n end\n end\n end\n\n result_io = ResultIO.new\n Application.run_in_application_lock(self) do\n self.pending_op_groups.push PendingAppOpGroup.new(op_type: :add_features, args: {\"features\" => features, \"group_overrides\" => group_overrides, \"init_git_url\" => init_git_url,\n \"user_env_vars\" => user_env_vars}, user_agent: self.user_agent)\n self.run_jobs(result_io)\n end\n\n # adding this feature may have caused pending_ops to be created on the domain\n # for adding env vars and ssh keys\n # execute run_jobs on the domain to take care of those\n domain.reload\n domain.run_jobs\n result_io\n end",
"def configure(c, ip: nil)\n c.vm.network 'private_network', ip: ip if ip\n\n c.vm.provider 'virtualbox' do |vb|\n vb.memory = 512\n end\n\n osreplace_path = '../osreplace' if File.directory?('../osreplace')\n c.vm.synced_folder osreplace_path, '/opt/osreplace' if osreplace_path\nend",
"def linux_identification\n \"#{fetch_linux_distributor}_#{fetch_linux_os_version}\"\nend",
"def provider\n 'Rackspace'\n end",
"def install\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n #if resource[:snmp]\n # snmp = resource[:snmp]\n #end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n end",
"def test_harness_dependencies(*)\n return unless platform[/n(5|6)k/]\n skip_if_nv_overlay_rejected(agent)\n\n # Vxlan has a hard requirement to disable feature fabricpath on n5/6k\n cmd = 'no feature-set fabricpath'\n command_config(agent, cmd, cmd)\nend",
"def openstack_provider\n # dream host doesn't support windows so bail early if we're on windows\n return \"openstack\" if RUBY_PLATFORM.match?(/mswin|mingw|windows/)\n\n if Etc::Passwd.entries.map(&:name).include?(\"dhc-user\")\n \"dreamhost\"\n else\n \"openstack\"\n end\n end",
"def virtualboxorafix(vb)\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/Leaf', '0x4']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/SubLeaf', '0x4']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/eax', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/ebx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/ecx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/edx', '0']\n vb.customize ['setextradata', :id, 'VBoxInternal/CPUM/HostCPUID/Cache/SubLeafMask', '0xffffffff']\nend",
"def licenses(top, output_file = nil, prv_release = nil, cur_release = nil)\n api_licenses = CLicenseModuleInfo.new(top, \"MESA\")\n\n license_options = Hash.new()\n license_options[:release_version_prv] = prv_release\n license_options[:release_version_cur] = cur_release\n\n license_options[:hdr_pre] = \"This file provides a summary of the licenses included in or used by the MESA\\n\"\n license_options[:hdr_pre] += \"sources, along with the raw licenses for each package.\\n\"\n license_options[:hdr_pre] += \"\\n\"\n license_options[:hdr_pre] += \"Notice: The MESA package includes pre-built binary firmware images. These\\n\"\n license_options[:hdr_pre] += \" images consist of the binary MESA artifacts appended to a BSP.\\n\"\n license_options[:hdr_pre] += \" The combined set of licenses for these images can be found in\\n\"\n license_options[:hdr_pre] += \" ./bin/<preset>/licenses.txt\\n\"\n license_options[:hdr_pre] += \"\\n\"\n\n license_options[:hdr_post] = \"\\n\"\n license_options[:hdr_post] += \"To obtain the source, please contact sales/marketing\\n\\n\"\n license_options[:hdr_post] += \"\\n\"\n\n licenses = CLicenseCollection.new(\"MESA\", license_options)\n licenses.concat(api_licenses)\n if output_file\n File.open(output_file, \"w\") do |lic|\n licenses.write(lic)\n end\n else\n licenses.write()\n end\nend",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def toolbox(type)\n end",
"def cloud_desc\n desc = {}\n if @config['bare_policies']\n desc[\"policies\"] = MU::Cloud::AWS.iam(credentials: @config['credentials']).list_policies(\n path_prefix: \"/\"+MU.deploy_id+\"/\"\n ).policies\n desc[\"policies\"].reject! { |p|\n !p.policy_name.match(/^#{Regexp.quote(@mu_name)}-/)\n }\n else\n desc[\"role\"] = MU::Cloud::AWS.iam(credentials: @config['credentials']).get_role(\n role_name: @mu_name\n ).role\n if @config['iam_policies']\n desc[\"policies\"] = []\n MU::Cloud::AWS.iam(credentials: @config['credentials']).list_attached_role_policies(\n role_name: @mu_name\n ).attached_policies.each { |p|\n desc[\"policies\"] << MU::Cloud::AWS.iam(credentials: @config['credentials']).get_policy(\n policy_arn: p.policy_arn\n ).policy\n }\n end\n\n end\n\n desc\n end",
"def ensure_security_group_prepared\n provider.create_security_group(system_config.security_group, required_public_ports)\n end",
"def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end",
"def usage\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" computetoken\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalogs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" catalog\".green + \" <catalog id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvms\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" orgvapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdcs\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" vapps\".green\n\tputs \"\\te.g. compute \".green + \"<API-URL-endpoint> <Org name>\".magenta + \" vdc\".green + \" <vdc id>\".magenta + \" networks\".green\n\tputs \"\\n\"\n\nend",
"def silk_license_tag\n render 'silk_icons/license'\n end",
"def add_file(filename)\n cookbook_file '/var/opt/dynatrace-managed/sources/' + filename do\n source '' + filename\n owner node['dynatrace-quickstart-gcp']['user']\n group node['dynatrace-quickstart-gcp']['user']\n mode '644'\n action :create\n end\nend",
"def config_lv_define_box2(vm, conf)\n vm.define conf['hostname_box2'] do |box2|\n box2.vm.hostname = conf['hostname_box2']\n box2.vm.box = conf['imagename_box2']\n box2.vm.network :private_network,\n :libvirt__network_name => \"mgmt\",\n :mac => conf['libvirt_mgmt_mac_box2'],\n :ip => conf['libvirt_mgmt_ip_box2'],\n :libvirt__netmask => conf['libvirt_mgmt_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :public_network,\n :network_name => \"ext\",\n :ip => conf['libvirt_ext_ip_box2'],\n :netmask => conf['libvirt_ext_netmask_box2'],\n :gateway => conf['libvirt_ext_gateway_box2'],\n :mac => conf['libvirt_ext_mac_box2'],\n :dev => conf['libvirt_dev'],\n :type => conf['libvirt_type'],\n :mode => conf['libvirt_mode']\n box2.vm.network :private_network,\n :libvirt__network_name => \"ceph\",\n :mac => conf['libvirt_ceph_mac_box2'],\n :ip => conf['libvirt_ceph_ip_box2'],\n :libvirt__netmask => conf['libvirt_ceph_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.network :private_network,\n :libvirt__network_name => \"vm_tunnel\",\n :mac => conf['libvirt_tunnel_mac_box2'],\n :ip => conf['libvirt_tunnel_ip_box2'],\n :libvirt__netmask => conf['libvirt_tunnel_netmask_box2'],\n :libvirt__dhcp_enabled => false,\n :libvirt__forward_mode => \"none\",\n :autostart => true\n box2.vm.provider :libvirt do |domain|\n domain.memory = conf['memory_box2']\n domain.cpus = conf['cpus_box2']\n domain.management_network_name = 'vagrantmgmt'\n domain.management_network_address = conf['libvirt_vagrantmgmt_ip_box2']\n domain.management_network_mode = conf['libvirt_mgmt_mode']\n end\n config_provision(box2.vm, conf)\n end\nend",
"def customize\n # If the PACKAGE_VERSION variable is passed from the command line, then set\n # @package_version equal to what was passed. Else, use the current version\n # of puppet\n if ENV['PACKAGE_VERSION']\n @package_version = ENV['PACKAGE_VERSION']\n else\n @package_version = '2.7.3'\n end\n \n # Puppet-specific Variables\n @title = \"Puppet_Install\"\n @reverse_domain = \"com.puppetlabs\"\n @package_major_version = @package_version.split('.')[0]\n @package_minor_version = @package_version.split('.')[1] + @package_version.split('.')[2]\n @puppet_file = \"puppet-#{@package_version}\"\n @puppet_url = \"http://downloads.puppetlabs.com/puppet/\"\n @puppet_tarfile = \"#{@puppet_file}.tar.gz\"\nend",
"def populate_cc_user_data(options)\n install_locale = options['q_struct']['locale'].value\n if install_locale.match(/\\./)\n install_locale = install_locale.split(\".\")[0]\n end\n if options['livecd'] == true\n install_target = \"/target\"\n else\n install_target = \"\"\n end\n install_nameserver = options['q_struct']['nameserver'].value\n install_base_url = \"http://\"+options['hostip']+\"/\"+options['name']\n install_layout = install_locale.split(\"_\")[0]\n install_variant = install_locale.split(\"_\")[1].downcase\n install_gateway = options['q_struct']['gateway'].value\n admin_shell = options['q_struct']['admin_shell'].value\n admin_sudo = options['q_struct']['admin_sudo'].value\n disable_dhcp = options['q_struct']['disable_dhcp'].value\n install_name = options['q_struct']['hostname'].value\n resolved_conf = \"/etc/systemd/resolved.conf\"\n admin_user = options['q_struct']['admin_username'].value\n admin_group = options['q_struct']['admin_username'].value\n admin_home = \"/home/\"+options['q_struct']['admin_username'].value\n admin_crypt = options['q_struct']['admin_crypt'].value\n install_nic = options['q_struct']['interface'].value\n if disable_dhcp.match(/true/)\n install_ip = options['q_struct']['ip'].value\n end\n install_cidr = options['q_struct']['cidr'].value\n install_disk = options['q_struct']['partition_disk'].value\n if install_disk.match(/\\//)\n install_disk = install_disk.split(/\\//)[-1]\n end\n #netplan_file = \"#{install_target}/etc/netplan/01-netcfg.yaml\"\n netplan_file = \"#{install_target}/etc/netplan/50-cloud-init.yaml\"\n locale_file = \"#{install_target}/etc/default/locales\"\n grub_file = \"#{install_target}/etc/default/grub\"\n ssh_dir = \"#{install_target}/home/#{admin_user}/.ssh\"\n auth_file = \"#{ssh_dir}/authorized_keys\"\n sudo_file = \"#{install_target}/etc/sudoers.d/#{admin_user}\"\n if options['vmnetwork'].to_s.match(/hostonly/)\n ks_ip = options['hostonlyip']\n else\n if disable_dhcp.match(/false/)\n ks_ip = options['hostonlyip']\n else\n ks_ip = options['hostip']\n end\n end\n if disable_dhcp.match(/false/)\n install_dhcp = \"yes\"\n else\n install_dhcp = \"no\"\n end\n if options['copykeys'] == true\n ssh_keyfile = options['sshkeyfile']\n if File.exist?(ssh_keyfile)\n ssh_key = %x[cat #{ssh_keyfile}].chomp\n ssh_dir = \"#{install_target}/home/\"+admin_user+\"/.ssh\"\n end\n end\n ks_port = options['httpport']\n user_data = []\n exec_data = []\n user_data.push(\"#cloud-config\")\n if !options['vm'].to_s.match(/mp|multipass/)\n in_target = \"curtin in-target --target=/target -- \"\n user_data.push(\"autoinstall:\")\n user_data.push(\" version: 1\")\n user_data.push(\" apt:\")\n user_data.push(\" geoip: true\")\n user_data.push(\" preserve_sources_list: false\")\n user_data.push(\" primary:\")\n if options['arch'].to_s.match(/arm/)\n user_data.push(\" - arches: [arm64, arm]\")\n else\n user_data.push(\" - arches: [amd64, i386]\")\n end\n user_data.push(\" uri: http://archive.ubuntu.com/ubuntu\")\n user_data.push(\" - arches: [default]\")\n user_data.push(\" uri: http://ports.ubuntu.com/ubuntu-ports\")\n user_data.push(\" identity:\")\n user_data.push(\" hostname: #{install_name}\")\n user_data.push(\" password: #{admin_crypt}\")\n user_data.push(\" realname: #{admin_user}\")\n user_data.push(\" username: #{admin_user}\")\n user_data.push(\" keyboard:\")\n user_data.push(\" layout: #{install_layout}\")\n user_data.push(\" variant: #{install_variant}\")\n user_data.push(\" locale: #{install_locale}.UTF-8\")\n user_data.push(\" network:\")\n user_data.push(\" network:\")\n user_data.push(\" version: 2\")\n user_data.push(\" ethernets:\")\n user_data.push(\" #{install_nic}:\")\n user_data.push(\" dhcp4: #{install_dhcp}\")\n user_data.push(\" ssh:\")\n user_data.push(\" install-server: true\")\n user_data.push(\" allow-pw: true\")\n user_data.push(\" storage:\")\n user_data.push(\" config:\")\n user_data.push(\" - grub_device: true\")\n user_data.push(\" id: disk-#{install_disk}\")\n user_data.push(\" path: /dev/#{install_disk}\")\n user_data.push(\" ptable: gpt\")\n user_data.push(\" type: disk\")\n user_data.push(\" wipe: superblock-recursive\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" flag: bios_grub\")\n user_data.push(\" id: partition-0\")\n user_data.push(\" number: 1\")\n user_data.push(\" size: 1048576\")\n user_data.push(\" type: partition\")\n user_data.push(\" - device: disk-#{install_disk}\")\n user_data.push(\" id: partition-1\")\n user_data.push(\" number: 2\")\n user_data.push(\" size: -1\")\n user_data.push(\" type: partition\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" - name: root_vg\")\n user_data.push(\" devices: [partition-1]\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_volgroup\")\n user_data.push(\" id: lvm_volgroup-0\")\n user_data.push(\" - name: root_lv\")\n user_data.push(\" volgroup: lvm_volgroup-0\")\n user_data.push(\" size: -1\")\n user_data.push(\" wipe: superblock\")\n user_data.push(\" preserve: false\")\n user_data.push(\" type: lvm_partition\")\n user_data.push(\" id: lvm_partition-0\")\n user_data.push(\" - fstype: ext4\")\n user_data.push(\" id: format-0\")\n user_data.push(\" type: format\")\n user_data.push(\" volume: lvm_partition-0\")\n user_data.push(\" - device: format-0\")\n user_data.push(\" id: mount-0\")\n user_data.push(\" path: /\")\n user_data.push(\" type: mount\")\n user_data.push(\" updates: security\")\n user_data.push(\" user-data:\")\n user_data.push(\" disable-root: false\")\n if disable_dhcp.match(/true/)\n exec_data.push(\"ip addr add #{install_ip}/#{install_cidr} dev #{install_nic}\")\n end\n exec_data.push(\"ip link set #{install_nic} up\")\n exec_data.push(\"ip route add default via #{install_gateway}\")\n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{resolved_conf}\")\n exec_data.push(\"systemctl restart systemd-resolved\")\n else\n in_target = \"\"\n if options['method'].to_s.match(/ci/)\n user_data.push(\"hostname: #{install_name}\")\n user_data.push(\"groups:\")\n user_data.push(\" - #{admin_user}: #{admin_group}\")\n user_data.push(\"users:\")\n user_data.push(\" - default\")\n user_data.push(\" - name: #{admin_user}\")\n user_data.push(\" gecos: #{admin_user}\")\n user_data.push(\" primary_group: #{admin_group}\")\n user_data.push(\" shell: #{admin_shell}\")\n user_data.push(\" passwd: #{admin_crypt}\")\n user_data.push(\" sudo: #{admin_sudo}\")\n user_data.push(\" lock_passwd: false\")\n end\n end\n if options['dnsmasq'] == true && options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"/usr/bin/systemctl disable systemd-resolved\")\n exec_data.push(\"/usr/bin/systemctl stop systemd-resolved\")\n exec_data.push(\"rm /etc/resolv.conf\")\n if options['q_struct']['nameserver'].value.to_s.match(/\\,/)\n nameservers = options['q_struct']['nameserver'].value.to_s.split(\"\\,\")\n nameservers.each do |nameserver|\n exec_data.push(\"echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else\n nameserver = options['q_struct']['nameserver'].value.to_s\n exec_data.push(\" - echo 'nameserver #{nameserver}' >> /etc/resolv.conf\")\n end\n else \n exec_data.push(\"echo 'DNS=#{install_nameserver}' >> #{install_target}#{resolved_conf}\")\n exec_data.push(\"#{in_target}/usr/sbin/locale-gen #{install_locale}.UTF-8\")\n end\n exec_data.push(\"echo 'LC_ALL=en_US.UTF-8' > #{locale_file}\")\n exec_data.push(\"echo 'LANG=en_US.UTF-8' >> #{locale_file}\")\n exec_data.push(\"echo '#{admin_user} ALL=(ALL) NOPASSWD:ALL' > #{sudo_file}\")\n if options['copykeys'] == true and File.exist?(ssh_keyfile) and !options['vm'].to_s.match(/mp|multipass/)\n exec_data.push(\"#{in_target}groupadd #{admin_user}\")\n exec_data.push(\"#{in_target}useradd -p '#{admin_crypt}' -g #{admin_user} -G #{admin_group} -d #{admin_home} -s /usr/bin/bash -m #{admin_user}\")\n exec_data.push(\"mkdir -p #{ssh_dir}\")\n exec_data.push(\"echo '#{ssh_key}' > #{auth_file}\")\n exec_data.push(\"chmod 600 #{auth_file}\")\n exec_data.push(\"chmod 700 #{ssh_dir}\")\n exec_data.push(\"#{in_target}chown -R #{admin_user}:#{admin_user} #{admin_home}\")\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['vm'].to_s.match(/kvm/)\n exec_data.push(\"systemctl enable serial-getty@ttyS0.service\")\n exec_data.push(\"systemctl start serial-getty@ttyS0.service\")\n else\n if options['serial'] == true\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0 console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n else\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"console=tty0 console=ttyS0\\\\\\\"' >> #{grub_file}\")\n end\n exec_data.push(\"echo 'GRUB_TERMINAL_INPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n exec_data.push(\"echo 'GRUB_TERMINAL_OUTPUT=\\\\\\\"console serial\\\\\\\"' >> #{grub_file}\")\n else\n if options['biosdevnames'] == true\n exec_data.push(\"echo 'GRUB_CMDLINE_LINUX=\\\\\\\"net.ifnames=0 biosdevname=0\\\\\\\"' >> #{grub_file}\")\n end\n end\n end\n if !options['vm'].to_s.match(/mp|multipass/)\n if options['dhcp'] == false || options['dnsmasq'] == true\n exec_data.push(\"echo '# This file describes the network interfaces available on your system' > #{netplan_file}\")\n exec_data.push(\"echo '# For more information, see netplan(5).' >> #{netplan_file}\")\n exec_data.push(\"echo 'network:' >> #{netplan_file}\")\n exec_data.push(\"echo ' version: 2' >> #{netplan_file}\")\n exec_data.push(\"echo ' renderer: networkd' >> #{netplan_file}\")\n exec_data.push(\"echo ' ethernets:' >> #{netplan_file}\")\n exec_data.push(\"echo ' #{install_nic}:' >> #{netplan_file}\")\n else\n if disable_dhcp.match(/true/)\n exec_data.push(\"echo ' addresses: [#{install_ip}/#{install_cidr}]' >> #{netplan_file}\")\n exec_data.push(\"echo ' gateway4: #{install_gateway}' >> #{netplan_file}\")\n else\n exec_data.push(\"echo ' dhcp4: true' >> #{netplan_file}\")\n end\n end\n if options['serial'] == true || options['biosdevnames'] == true\n exec_data.push(\"#{in_target}update-grub\")\n end\n if options['reboot'] == true\n exec_data.push(\"#{in_target}reboot\")\n end\n end\n end\n return user_data,exec_data\nend",
"def bc_install_layout_1_chef(bc, path, barclamp)\n\n log_path = File.join '/var', 'log', 'barclamps'\n FileUtils.mkdir log_path unless File.directory? log_path\n log = File.join log_path, \"#{bc}.log\"\n system \"date >> #{log}\"\n puts \"Capturing chef install logs to #{log}\" if DEBUG\n chef = File.join path, 'chef'\n cookbooks = File.join chef, 'cookbooks'\n databags = File.join chef, 'data_bags'\n roles = File.join chef, 'roles'\n\n #upload the cookbooks\n if File.directory? cookbooks\n FileUtils.cd cookbooks\n knife_cookbook = \"knife cookbook upload -o . -a -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_cookbook + \" >> #{log} 2>&1\"\n puts \"\\t#{path} #{knife_cookbook} upload failed. Examine #{log} for more into\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_cookbook}\" if DEBUG \n else\n puts \"\\tNOTE: could not find cookbooks #{cookbooks}\" if DEBUG\n end\n \n #upload the databags\n if File.exists? databags\n Dir.entries(databags).each do |bag|\n next if bag == \".\" or bag == \"..\"\n bag_path = File.join databags, bag \n FileUtils.chmod 0755, bag_path\n chmod_dir 0644, bag_path\n FileUtils.cd bag_path\n knife_bag = \"knife data bag create #{bag} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_bag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_bag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_bag}\" if DEBUG\n\n json = Dir.entries(bag_path).find_all { |r| r.end_with?(\".json\") }\n json.each do |bag_file|\n knife_databag = \"knife data bag from file #{bag} #{bag_file} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_databag + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_databag} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_databag}\" if DEBUG\n end\n end\n else\n puts \"\\tNOTE: could not find databags #{databags}\" if DEBUG\n end\n\n #upload the roles\n if File.directory? roles\n FileUtils.cd roles\n Dir.entries(roles).find_all { |r| r.end_with?(\".rb\") }.each do |role|\n knife_role = \"knife role from file #{role} -V -k /etc/chef/webui.pem -u chef-webui\"\n unless system knife_role + \" >> #{log} 2>&1\"\n puts \"\\t#{knife_role} failed. Examine #{log} for more information.\"\n exit 1\n end\n puts \"\\texecuted: #{path} #{knife_role}\" if DEBUG\n end\n else\n puts \"\\tNOTE: could not find roles #{roles}\" if DEBUG\n end\n\n puts \"Barclamp #{bc} (format v1) Chef Components Uploaded.\" \n\n end",
"def builtin_service_enable_variable_name\n @bsevn ||= begin\n result = nil\n if rcd_script_found?\n ::File.open(init_command) do |rcscript|\n if m = rcscript.read.match(/^# \\$OpenBSD: (\\w+)[(.rc),]?/)\n result = m[1] + \"_flags\"\n end\n end\n end\n # Fallback allows us to keep running in whyrun mode when\n # the script does not exist.\n result || new_resource.service_name\n end\n end"
] |
[
"0.59504247",
"0.5838618",
"0.5395198",
"0.5395198",
"0.5278193",
"0.52739584",
"0.52202475",
"0.52176625",
"0.52145195",
"0.52133954",
"0.5196774",
"0.5170964",
"0.5165706",
"0.51428854",
"0.51387364",
"0.5130683",
"0.512563",
"0.51101947",
"0.5109559",
"0.5105774",
"0.50844264",
"0.5078014",
"0.50382674",
"0.5034802",
"0.5027105",
"0.50248665",
"0.5023483",
"0.5018408",
"0.50150573",
"0.5008831",
"0.50072616",
"0.5001941",
"0.499645",
"0.4971297",
"0.49683133",
"0.4960697",
"0.49499065",
"0.49483845",
"0.49477193",
"0.49407807",
"0.4939067",
"0.49282283",
"0.4919084",
"0.4913322",
"0.49103272",
"0.4904268",
"0.489697",
"0.48959163",
"0.48898116",
"0.48877773",
"0.48852473",
"0.48822707",
"0.48746204",
"0.48737025",
"0.48682866",
"0.48636216",
"0.4847786",
"0.48435578",
"0.484122",
"0.48391393",
"0.48328376",
"0.4831832",
"0.48307863",
"0.48271888",
"0.4820542",
"0.48205167",
"0.48167694",
"0.47969148",
"0.47965705",
"0.47889796",
"0.47843692",
"0.47827572",
"0.4779275",
"0.47718757",
"0.47674245",
"0.4761908",
"0.4761225",
"0.47610736",
"0.47596595",
"0.47595078",
"0.47564697",
"0.47532576",
"0.47507244",
"0.4742111",
"0.47409698",
"0.47379532",
"0.47265926",
"0.47247648",
"0.47247648",
"0.47247648",
"0.4720863",
"0.47201097",
"0.4711288",
"0.47095114",
"0.4702803",
"0.46930373",
"0.4691888",
"0.4688529",
"0.4685788",
"0.46798715",
"0.46798682"
] |
0.0
|
-1
|
GET /donation_record/actual_funds GET /donation_record/actual_funds.json
|
def index
@donation_record_actual_funds = DonationRecord::ActualFund.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def show\n render json: @fund\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def update\n respond_to do |format|\n if @donation_record_actual_fund.update(donation_record_actual_fund_params)\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :ok, location: @donation_record_actual_fund }\n else\n format.html { render :edit }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # raise donation_record_actual_fund_params.inspect\n @donation_record_actual_fund = DonationRecord::ActualFund.new(donation_record_actual_fund_params)\n @donation_record_actual_fund.donation_record = @donation_record\n respond_to do |format|\n if @donation_record_actual_fund.save\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :created, location: @donation_record_actual_fund }\n else\n format.html { render :new }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end",
"def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def set_donation_record_actual_fund\n @donation_record_actual_fund = (id=params[:id]) ? DonationRecord::ActualFund.find(id) : DonationRecord::ActualFund.new\n end",
"def index\n @funds = Fund.all\n \t\n end",
"def show\n render json: @financial_statement\n end",
"def index\n @wallet_id = params[:wallet_id]\n @investment_funds = InvestmentFund.where(\"wallet_id = ?\", @wallet_id)\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end",
"def show\n\t @funds = Fund.all\n end",
"def show\n\n\t@project = Project.find(params[:id])\n\t@promises = Promise.all\n\t@actual = Fund.where(:project_id => @project.id).sum(:amount)\n end",
"def new\n @financial_donation = FinancialDonation.new\n @financial_donation.donated = Date.today\n \n if params[:donor]\n @financial_donation.donor = Donor.find(params[:donor])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial_donation }\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 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 index\n @record_financials = RecordFinancial.all\n end",
"def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def show\n render json: @person_expense_record\n end",
"def destroy\n @donation_record_actual_fund.destroy\n respond_to do |format|\n format.html { redirect_to @donation_record}\n format.json { head :no_content }\n end\n end",
"def taken_funds\n authenticated_post(\"taken_funds\").body\n end",
"def show\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def index\n @investment_funds = InvestmentFund.all\n end",
"def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end",
"def fetch_cdi_value\n token = get_financial_data_token\n if token\n\t\t\tactual_date = \"#{Date.current.year}-#{Date.current.month}-#{Date.current.day}\"\n\t\t\tif Cdi.all.count > 0\n\t\t\t\tlast_cdi_date = Cdi.last.date_tax + 1\n\t\t\telse\n\t\t\t\tlast_cdi_date = '2010-01-01'\n\t\t\tend\n uri = URI.parse(\"https://api.financialdata.io/v1/indices/CDI/serie?dataInicio=#{last_cdi_date}&dataFim=#{actual_date}\")\n header = {'Content-Type': 'application/json', 'Authorization': \"Bearer #{token}\"}\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri, header)\n response = http.request(request)\n return JSON.parse(response.read_body) \n end\n end",
"def index\r\n @mutual_funds = MutualFund.all\r\n end",
"def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end",
"def show\n @title = t('view.trust_funds.show_title')\n @trust_fund = TrustFund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trust_fund }\n end\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end",
"def show\n # @donation_purpose = DonationPurpose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation_purpose }\n end\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"def show\n @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\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 @financial_statement = FinancialStatement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_statement }\n end\n end",
"def expense_details\n if date_format_check\n filter_by_account, account_id = account_filter false\n\n if filter_by_account\n ft_joins = \"\" #[:finance_transaction_receipt_record]\n filter_conditions = \"AND finance_transaction_receipt_records.fee_account_id #{account_id == nil ? 'IS' : '='} ?\"\n filter_values = [account_id]\n else\n ft_joins = filter_values = []\n filter_conditions = \"\"\n end\n\n @expense_category = FinanceTransactionCategory.find(params[:id])\n\n if @expense_category.name == 'Refund'\n ft_joins = \"INNER JOIN fee_refunds fr ON fr.finance_transaction_id = finance_transactions.id\n INNER JOIN finance_fees ff ON ff.id = fr.finance_fee_id\n INNER JOIN finance_fee_collections ffc ON ffc.id = ff.fee_collection_id\n LEFT JOIN fee_accounts fa On fa.id = ffc.fee_account_id\"\n cond = \"(fa.id IS NULL OR fa.is_deleted = false) AND \"\n else\n cond = \"\"\n end\n\n @grand_total = @expense_category.finance_transactions.all(:select => \"finance_transactions.amount\",\n :joins => ft_joins, :conditions => [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\",\n @start_date, @end_date] + filter_values).map { |x| x.amount.to_f }.sum\n\n @expense = @expense_category.finance_transactions.all(:joins => ft_joins, :conditions =>\n [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\", @start_date, @end_date] + filter_values)\n end\n end",
"def get_financials\n render json: [current_user]\n end",
"def show\n @donation = Donation.find(params[:id])\n\n # return json object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation.to_json }\n end\n end",
"def index\n @donations = Donation.order('created_at DESC').limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @donations }\n end\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def show\n render json: @bank\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 funding_info(symbol = \"fUSD\")\n authenticated_post(\"auth/r/funding/#{symbol}\").body\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end",
"def donation_record_actual_fund_params\n params.require(:donation_record_actual_fund)\n .permit( :fund_type_id, :serialnum, fund_attributes: [:amount, :time, :comment], proof_attributes: [:file] )\n end",
"def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end",
"def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end",
"def donation_receipt\n @donation = FinanceDonation.find_by_id(params[:id], :include => {:transaction => :transaction_ledger},\n :joins => \"INNER JOIN finance_transactions ft ON ft.finance_type = 'FinanceDonation' AND ft.finance_id = finance_donations.id\n INNER JOIN finance_transaction_receipt_records ftrr ON ftrr.finance_transaction_id = ft.id\n LEFT JOIN fee_accounts fa ON fa.id = ftrr.fee_account_id\",\n :conditions => \"#{active_account_conditions(true, 'ftrr')}\")\n if @donation.present?\n @additional_details = @donation.donation_additional_details.find(:all,:include => [:donation_additional_field],\n :conditions => [\"donation_additional_fields.status = true\"],:order => \"donation_additional_fields.priority ASC\")\n @additional_fields_count = DonationAdditionalField.count(:conditions => \"status = true\")\n else\n flash[:notice] = t('flash_msg5')\n redirect_to :controller => \"user\", :action => \"dashboard\"\n end\n end",
"def index\n @funding_requirements = FundingRequirement.all\n end",
"def show\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @donation }\n end\n end",
"def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def fund_params\n params.require(:fund).permit(:person_id, :amount, :name, :description, :date, :external, :source)\n end",
"def payment_amount\n params['asking_price'] = params['asking_price'].to_f\n params['down_payment'] = params['down_payment'].to_f\n params['amortization_period'] = params['amortization_period'].to_f\n\n insurance_cost = calculate_insurance_amount(params)\n payment_amount = calculate_payment_amount(params, insurance_cost, @@interest_rate)\n json_response(amount: payment_amount)\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb (no data required)\n f = find_budgets\n format.ext_json { render :json => f.to_ext_json(:class => :budget, \n :count => f.length,\n :methods=>[:total_budget_costs,:total_budget_invoices,:total_budget_pricings],\n :include=>{:user=>{:only=>\"login\"}}) }\n \n end\n end",
"def show\n @debt_paper_price = DebtPaperPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt_paper_price }\n end\n end",
"def show\n @fin_report = FinReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fin_report }\n end\n end",
"def index\n @fund_company_investments = FundCompanyInvestment.all\n end",
"def index\n @userfunds = Userfund.all\n end",
"def show\n @hwm_fund_value = HwmFundValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_fund_value }\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def show\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_financial }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\n @monthly_finances = MonthlyFinance.all\n # respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @monthly_finances }\n # end\n end",
"def total_taken_funds\n authenticated_post(\"total_taken_funds\").body\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def new\n @unpaid_debt = UnpaidDebt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unpaid_debt }\n end\n end",
"def show\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @donation }\n end\n end",
"def show\n find_payment\n render json: @payment\n end",
"def show\n @reduced_fee = ReducedFee.find(params[:id])\n end",
"def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def show\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @cash_dispense }\n\n ret = \"\"\n val = 0\n @cash_dispense.calculate_break_down.each_with_index do |dom,index| \n if dom.size > 0 \n ret += \"#{dom.count} x #{CashDispense::DENOMINATIONS[index]}\\n\" \n val += (dom.count * CashDispense::DENOMINATIONS[index])\n end # if \n end # each \n\n ret += \"\\n#{val}\"\n\n format.json { render json: ret }\n\n end\n end",
"def expected\n @invoices = @account_invoices.joins(:payment_profiles)\n .where(payment_profiles: { expected_payment_date: @start_date...@end_date })\n respond_to do |format|\n format.json { render json: @invoices.to_json(include: :payment_profiles) }\n end\n end",
"def donations(page=1, per_page=50, auth = false)\n get(\"v1/fundraising/pages/#{@short_name}/donations?pageNum=#{page}&pagesize=#{per_page}\",\n :basic_auth => auth)\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def query_for_finances\n base = \"http://www.opensecrets.org/api\"\n header = {\n \"X-API-Key\" => open_secrets_key,\n \"Accept\" => \"application/json\",\n }\n CongressMember.all.each do |cm|\n if cm.crp_id\n options = {\n :apikey => open_secrets_key,\n :output => \"json\",\n :method => \"candIndustry\",\n :cid => cm.crp_id,\n }\n if cm.donations.size < 10\n response = JSON.parse(Faraday.get(base, options, header).body)\n response[\"response\"][\"industries\"][\"industry\"].each do |ind|\n industry_name = ind[\"@attributes\"][\"industry_name\"]\n total = ind[\"@attributes\"][\"total\"]\n industry = Industry.find_or_create_by(:name => industry_name)\n Donation.create(congress_member: cm, amount: total, industry: industry)\n end\n end\n end\n end\nend",
"def index\n @cb_funds = CbFund.all\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: UnpaidDebtsDatatable.new(view_context) }\n end\n end",
"def show\n #@debt = Debt.find(params[:id])\n\t\n\t@dollar = (Exchange.find(1).value * Debt.find(params[:id]).value).round(2)\n\t@yen = (Exchange.find(2).value * Debt.find(params[:id]).value).round(2)\n\t@pound = (Exchange.find(3).value * Debt.find(params[:id]).value).round(2)\n\t@rubbel = (Exchange.find(4).value * Debt.find(params[:id]).value).round(2)\n\t@bitcoin = (Exchange.find(5).value * @dollar).round(2)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"def show\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banking_detail }\n end\n end",
"def show\n @payments = Payment.for_fundraiser(@fundraiser.id).chronological.all\n end",
"def new\n @expense = TblReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\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 fund_params\n params.require(:fund).permit(:state, :user_id, :promise_id, :project_id, :amount)\n end",
"def new\n @monthly_finance = MonthlyFinance.new\n @customer = Customer.find(params[:id]) if params[:id]\n @partners = Partner.all\n @transaction = MonthlyFInvestment.find(:all, :conditions => \"invested_in = 'monthly_finance' and is_active = '1' \").map(&:investment_amount).inject{|sum,x| sum.to_i + x.to_i} \n\n @mfinance_name = MonthlyFinance.last\n if @mfinance_name.nil?\n @mfinance_name = \"MF-loan1\"\n else\n @mfinance_name = @mfinance_name.loan_name.next\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def show\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_lead }\n end\n end",
"def index\n get_budgets\n end",
"def getCashValueOfIndFundInvestment(ind, fund, date)\r\n\r\n\t\t\r\n\r\n\tend",
"def new\n # @donation_purpose = DonationPurpose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @donation_purpose }\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 show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end",
"def daily_update\n\t\t\tcurrent_user.investment_account.daily_update\n\t\t\trender json: current_user, status: 200\n\t\tend",
"def show\n @mydebt = Mydebt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mydebt }\n end\n end"
] |
[
"0.6596142",
"0.65945756",
"0.63615215",
"0.6305707",
"0.6161346",
"0.61455595",
"0.61093575",
"0.60901374",
"0.6036757",
"0.60334677",
"0.6016985",
"0.6011211",
"0.5970263",
"0.59364307",
"0.5925354",
"0.58733046",
"0.5871314",
"0.58607954",
"0.585958",
"0.5850797",
"0.5849561",
"0.58389384",
"0.5823378",
"0.581882",
"0.57809156",
"0.5765664",
"0.57603556",
"0.5739373",
"0.5737278",
"0.5712545",
"0.57073593",
"0.56954074",
"0.5683254",
"0.56738305",
"0.5667746",
"0.56617475",
"0.56603587",
"0.5658184",
"0.5635391",
"0.5619546",
"0.5616618",
"0.5613886",
"0.5594623",
"0.559394",
"0.5585288",
"0.55823445",
"0.55823445",
"0.55711144",
"0.5560471",
"0.5552753",
"0.5551408",
"0.55474585",
"0.5544302",
"0.554302",
"0.55412287",
"0.55399966",
"0.5529994",
"0.5525608",
"0.5522579",
"0.5513722",
"0.55099684",
"0.5508658",
"0.55010813",
"0.5492006",
"0.5484862",
"0.5468599",
"0.5465885",
"0.54657054",
"0.54647195",
"0.5461925",
"0.54542136",
"0.54518676",
"0.545076",
"0.54481953",
"0.544768",
"0.5442864",
"0.54426116",
"0.5440966",
"0.543927",
"0.5423783",
"0.54219896",
"0.54156935",
"0.54140806",
"0.5409392",
"0.5406083",
"0.54045004",
"0.5402863",
"0.5402646",
"0.5398255",
"0.5392857",
"0.5388353",
"0.5385599",
"0.53820735",
"0.53799456",
"0.5375019",
"0.53688335",
"0.53688145",
"0.5367321",
"0.53606296",
"0.53594536"
] |
0.7299994
|
0
|
GET /donation_record/actual_funds/1 GET /donation_record/actual_funds/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @donation_record_actual_funds = DonationRecord::ActualFund.all\n end",
"def show\n render json: @fund\n end",
"def show\n @fund = Fund.friendly.find(params[:id])\n\n render json: @fund\n end",
"def show\n @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def set_donation_record_actual_fund\n @donation_record_actual_fund = (id=params[:id]) ? DonationRecord::ActualFund.find(id) : DonationRecord::ActualFund.new\n end",
"def create\n # raise donation_record_actual_fund_params.inspect\n @donation_record_actual_fund = DonationRecord::ActualFund.new(donation_record_actual_fund_params)\n @donation_record_actual_fund.donation_record = @donation_record\n respond_to do |format|\n if @donation_record_actual_fund.save\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :created, location: @donation_record_actual_fund }\n else\n format.html { render :new }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def details\n @daily_deal = DailyDeal.find(params[:id])\n respond_to do |format|\n format.json do\n render with_api_version\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation_record_actual_fund.update(donation_record_actual_fund_params)\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :ok, location: @donation_record_actual_fund }\n else\n format.html { render :edit }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def new\n @financial_donation = FinancialDonation.new\n @financial_donation.donated = Date.today\n \n if params[:donor]\n @financial_donation.donor = Donor.find(params[:donor])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def show\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial }\n end\n end",
"def index\n @wallet_id = params[:wallet_id]\n @investment_funds = InvestmentFund.where(\"wallet_id = ?\", @wallet_id)\n end",
"def show\n @expense = TblReceipt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @expense }\n end\n end",
"def fetch_cdi_value\n token = get_financial_data_token\n if token\n\t\t\tactual_date = \"#{Date.current.year}-#{Date.current.month}-#{Date.current.day}\"\n\t\t\tif Cdi.all.count > 0\n\t\t\t\tlast_cdi_date = Cdi.last.date_tax + 1\n\t\t\telse\n\t\t\t\tlast_cdi_date = '2010-01-01'\n\t\t\tend\n uri = URI.parse(\"https://api.financialdata.io/v1/indices/CDI/serie?dataInicio=#{last_cdi_date}&dataFim=#{actual_date}\")\n header = {'Content-Type': 'application/json', 'Authorization': \"Bearer #{token}\"}\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Get.new(uri.request_uri, header)\n response = http.request(request)\n return JSON.parse(response.read_body) \n end\n end",
"def show\n @title = t('view.trust_funds.show_title')\n @trust_fund = TrustFund.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trust_fund }\n end\n end",
"def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def index\n @funds = Fund.all\n \t\n end",
"def show\n render json: @financial_statement\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 @budget = Budget.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @budget }\n end\n end",
"def destroy\n @donation_record_actual_fund.destroy\n respond_to do |format|\n format.html { redirect_to @donation_record}\n format.json { head :no_content }\n end\n end",
"def show\n add_breadcrumb I18n.t('helpers.breadcrumbs.budgets.show')\n @budget_details = BudgetDetail.all\n\n @budget = Budget.find(params[:id])\n respond_to do |format|\n format.html\n format.pdf do\n pdf = BudgetPdf.new(@budget, view_context)\n send_data pdf.render,\n filename: \"budget_#{@budget.id}.pdf\",\n type: 'application/pdf',\n disposition: 'inline'\n end\n format.json {render json: @budget, include: :budget_details}\n end\n end",
"def show\n render json: @person_expense_record\n end",
"def show\n\n\t@project = Project.find(params[:id])\n\t@promises = Promise.all\n\t@actual = Fund.where(:project_id => @project.id).sum(:amount)\n end",
"def show\n # @donation_purpose = DonationPurpose.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation_purpose }\n end\n end",
"def show\n\t @funds = Fund.all\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 index\n @record_financials = RecordFinancial.all\n end",
"def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end",
"def show\n @donation = Donation.find(params[:id])\n\n # return json object\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation.to_json }\n end\n end",
"def show\n @financial_statement = FinancialStatement.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_statement }\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 @fundamentals_history = @company.fundamentals_histories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamentals_history }\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 @donation = Donation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @donation }\n end\n end",
"def show\n @reduced_fee = ReducedFee.find(params[:id])\n end",
"def index\n @investment_funds = InvestmentFund.all\n end",
"def show\n donation = Donation.find_by(id: params[:id])\n render json: donation.as_json\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @debt }\n end\n end",
"def show\n @hwm_fund_value = HwmFundValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hwm_fund_value }\n end\n end",
"def show\n @debt = Debt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt }\n end\n end",
"def index\r\n @mutual_funds = MutualFund.all\r\n end",
"def show\n @fin_report = FinReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fin_report }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def new\n @monthly_finance = MonthlyFinance.new\n @customer = Customer.find(params[:id]) if params[:id]\n @partners = Partner.all\n @transaction = MonthlyFInvestment.find(:all, :conditions => \"invested_in = 'monthly_finance' and is_active = '1' \").map(&:investment_amount).inject{|sum,x| sum.to_i + x.to_i} \n\n @mfinance_name = MonthlyFinance.last\n if @mfinance_name.nil?\n @mfinance_name = \"MF-loan1\"\n else\n @mfinance_name = @mfinance_name.loan_name.next\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end",
"def show\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @donation }\n end\n end",
"def index\n @person_expense_records = PersonExpenseRecord.all\n\n render json: @person_expense_records\n end",
"def expense_details\n if date_format_check\n filter_by_account, account_id = account_filter false\n\n if filter_by_account\n ft_joins = \"\" #[:finance_transaction_receipt_record]\n filter_conditions = \"AND finance_transaction_receipt_records.fee_account_id #{account_id == nil ? 'IS' : '='} ?\"\n filter_values = [account_id]\n else\n ft_joins = filter_values = []\n filter_conditions = \"\"\n end\n\n @expense_category = FinanceTransactionCategory.find(params[:id])\n\n if @expense_category.name == 'Refund'\n ft_joins = \"INNER JOIN fee_refunds fr ON fr.finance_transaction_id = finance_transactions.id\n INNER JOIN finance_fees ff ON ff.id = fr.finance_fee_id\n INNER JOIN finance_fee_collections ffc ON ffc.id = ff.fee_collection_id\n LEFT JOIN fee_accounts fa On fa.id = ffc.fee_account_id\"\n cond = \"(fa.id IS NULL OR fa.is_deleted = false) AND \"\n else\n cond = \"\"\n end\n\n @grand_total = @expense_category.finance_transactions.all(:select => \"finance_transactions.amount\",\n :joins => ft_joins, :conditions => [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\",\n @start_date, @end_date] + filter_values).map { |x| x.amount.to_f }.sum\n\n @expense = @expense_category.finance_transactions.all(:joins => ft_joins, :conditions =>\n [\"#{cond} transaction_date BETWEEN ? AND ? #{filter_conditions}\", @start_date, @end_date] + filter_values)\n end\n end",
"def new\n @expense = TblReceipt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @expense }\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def show\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company_financial }\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end",
"def show\n @budget = Budget.find(params[:id])\n @other_budgets = current_user.budgets conditions: [\"id != ?\", @budget.id]\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def show\n @debt_paper_price = DebtPaperPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @debt_paper_price }\n end\n end",
"def donation_receipt\n @donation = FinanceDonation.find_by_id(params[:id], :include => {:transaction => :transaction_ledger},\n :joins => \"INNER JOIN finance_transactions ft ON ft.finance_type = 'FinanceDonation' AND ft.finance_id = finance_donations.id\n INNER JOIN finance_transaction_receipt_records ftrr ON ftrr.finance_transaction_id = ft.id\n LEFT JOIN fee_accounts fa ON fa.id = ftrr.fee_account_id\",\n :conditions => \"#{active_account_conditions(true, 'ftrr')}\")\n if @donation.present?\n @additional_details = @donation.donation_additional_details.find(:all,:include => [:donation_additional_field],\n :conditions => [\"donation_additional_fields.status = true\"],:order => \"donation_additional_fields.priority ASC\")\n @additional_fields_count = DonationAdditionalField.count(:conditions => \"status = true\")\n else\n flash[:notice] = t('flash_msg5')\n redirect_to :controller => \"user\", :action => \"dashboard\"\n end\n end",
"def new\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trust_fund }\n end\n end",
"def show\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @banking_detail }\n end\n end",
"def index\n @donations = Donation.order('created_at DESC').limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @donations }\n end\n end",
"def show\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def show\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance_lead }\n end\n end",
"def Fund(symbol)\n Fund.where(:symbol => symbol.to_s).first\n end",
"def new\n @unpaid_debt = UnpaidDebt.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unpaid_debt }\n end\n end",
"def index\n @funding_requirements = FundingRequirement.all\n end",
"def new\n @budget = Budget.new\n @budgetProducts = []\n @customer = Customer.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @budget }\n end\n end",
"def taken_funds\n authenticated_post(\"taken_funds\").body\n end",
"def funding_info(symbol = \"fUSD\")\n authenticated_post(\"auth/r/funding/#{symbol}\").body\n end",
"def new\n # @donation_purpose = DonationPurpose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @donation_purpose }\n end\n end",
"def show\n find_payment\n render json: @payment\n end",
"def new\n @fundraiser = Fundraiser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundraiser }\n end\n end",
"def new\n @budget = Budget.new\n\n respond_to do |format|\n format.html # new.html.erb\n # format.json { render json: @budget }\n end\n end",
"def getCashValueOfIndFundInvestment(ind, fund, date)\r\n\r\n\t\t\r\n\r\n\tend",
"def show\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financial_institution }\n end\n end",
"def show\n load_budget\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @budget }\n end\n end",
"def index\r\n @fixed_deposit_investments = FixedDepositInvestment.all\r\n end",
"def donation_record_actual_fund_params\n params.require(:donation_record_actual_fund)\n .permit( :fund_type_id, :serialnum, fund_attributes: [:amount, :time, :comment], proof_attributes: [:file] )\n end",
"def show\n render json: @bank\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 set_fund\n @fund = Fund.find(params[:id])\n end",
"def set_fund\n @fund = Fund.find(params[:id])\n end",
"def set_fund\n @fund = Fund.find(params[:id])\n end",
"def fund_params\n params.require(:fund).permit(:person_id, :amount, :name, :description, :date, :external, :source)\n end",
"def show\n @tax_rate = TaxRate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tax_rate }\n end\n end",
"def show\n @di_transaction = DiTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @di_transaction }\n end\n end",
"def show\n @redeemed_deal = RedeemedDeal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @redeemed_deal }\n end\n end",
"def show\n @year= @budget.budget_date.year\n @month= @budget.budget_date.month\n @budget.year= @year\n @budget.month = @month\n\n @ref = @budget.id\n @totalincome = Income.where(budget_id: @ref).sum(:amount)\n @totalexpense = Expense.where(budget_id: @ref).sum(:amount)\n\n @incomes = Income.where(budget_id: @ref)\n @expenses = Expense.where(budget_id: @ref)\n\n @balance = (@totalincome - @totalexpense)\n @budget.balance= @balance\n\n\n\n # Budget number\n @budget_number = (@budget.id + 10000 )\n @budget.budget_number = @budget_number\n\n @budget.save\n\n\n end",
"def show\n @fixed_deposit = FixedDeposit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end",
"def show\n @donation_line = DonationLine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @donation_line }\n end\n end",
"def index\n @fund_company_investments = FundCompanyInvestment.all\n end",
"def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end",
"def show\n @breadcrumb = 'read'\n @billing_frequency = BillingFrequency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_frequency }\n end\n end",
"def show\n @cash_dispense = CashDispense.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n # format.json { render json: @cash_dispense }\n\n ret = \"\"\n val = 0\n @cash_dispense.calculate_break_down.each_with_index do |dom,index| \n if dom.size > 0 \n ret += \"#{dom.count} x #{CashDispense::DENOMINATIONS[index]}\\n\" \n val += (dom.count * CashDispense::DENOMINATIONS[index])\n end # if \n end # each \n\n ret += \"\\n#{val}\"\n\n format.json { render json: ret }\n\n end\n end",
"def new\n #@klass_fee = KlassFee.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klass_fee }\n end\n end",
"def show\n @patient_risk_factor = PatientRiskFactor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @patient_risk_factor }\n end\n end",
"def new\n @currency_rate = CurrencyRate.new\n @last_rate = CurrencyRate.where(is_force: true).last\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def show\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finance }\n end\n end",
"def index\n @items = Item.all\n @budget = Budget.find params[:budget_id]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end",
"def add_fund\n invoice = Spree::PaymentMethod::BitPayment.first.create_invoice(add_fund_params)\n @invoice_url = \"#{invoice['url']}\"\n render json: @invoice_url.to_json\n end",
"def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @financials }\n end\n end"
] |
[
"0.7115516",
"0.6438892",
"0.64249253",
"0.64232653",
"0.6356215",
"0.62784916",
"0.6220401",
"0.62022436",
"0.613931",
"0.61367625",
"0.5972391",
"0.59632015",
"0.5940923",
"0.5934489",
"0.5919073",
"0.58974665",
"0.5890648",
"0.58894664",
"0.5885648",
"0.5877508",
"0.5872083",
"0.5863877",
"0.5847205",
"0.58343315",
"0.58279073",
"0.5788905",
"0.5764785",
"0.5756898",
"0.57285684",
"0.57169056",
"0.56930155",
"0.5687914",
"0.5683436",
"0.56445396",
"0.56445384",
"0.56445384",
"0.5638244",
"0.56360596",
"0.5621508",
"0.5611441",
"0.56023157",
"0.5595098",
"0.5592712",
"0.5591738",
"0.55826056",
"0.5581122",
"0.5561246",
"0.5546225",
"0.55410767",
"0.5539112",
"0.5538111",
"0.55264646",
"0.5515686",
"0.55135095",
"0.5507312",
"0.5505954",
"0.5502617",
"0.55014086",
"0.5500371",
"0.54944783",
"0.5487602",
"0.5486557",
"0.54847",
"0.54785",
"0.54735506",
"0.5472157",
"0.5471463",
"0.5468242",
"0.54666334",
"0.5464143",
"0.5463054",
"0.5459096",
"0.5457289",
"0.544617",
"0.54437166",
"0.5440232",
"0.54385036",
"0.54339844",
"0.5427135",
"0.54221183",
"0.5416716",
"0.5416716",
"0.5416716",
"0.5408826",
"0.5400245",
"0.53994095",
"0.5395061",
"0.5393058",
"0.5380778",
"0.53756684",
"0.5372115",
"0.5371615",
"0.53685224",
"0.5363645",
"0.5353943",
"0.53491336",
"0.5345179",
"0.5344026",
"0.5342167",
"0.5339849",
"0.53394973"
] |
0.0
|
-1
|
POST /donation_record/actual_funds POST /donation_record/actual_funds.json
|
def create
# raise donation_record_actual_fund_params.inspect
@donation_record_actual_fund = DonationRecord::ActualFund.new(donation_record_actual_fund_params)
@donation_record_actual_fund.donation_record = @donation_record
respond_to do |format|
if @donation_record_actual_fund.save
format.html { redirect_to @donation_record }
format.json { render :show, status: :created, location: @donation_record_actual_fund }
else
format.html { render :new }
format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created, location: @fund\n else\n render json: @fund.errors, status: :unprocessable_entity\n end\n end",
"def donation_record_actual_fund_params\n params.require(:donation_record_actual_fund)\n .permit( :fund_type_id, :serialnum, fund_attributes: [:amount, :time, :comment], proof_attributes: [:file] )\n end",
"def create\n @fund = Fund.new(fund_params)\n\n if @fund.save\n render json: @fund, status: :created,\n location: api_v1_fund_path(@fund)\n else\n render_validation_errors @fund.errors\n end\n end",
"def set_donation_record_actual_fund\n @donation_record_actual_fund = (id=params[:id]) ? DonationRecord::ActualFund.find(id) : DonationRecord::ActualFund.new\n end",
"def fund_params\n params.require(:fund).permit(:person_id, :amount, :name, :description, :date, :external, :source)\n end",
"def update\n respond_to do |format|\n if @donation_record_actual_fund.update(donation_record_actual_fund_params)\n format.html { redirect_to @donation_record }\n format.json { render :show, status: :ok, location: @donation_record_actual_fund }\n else\n format.html { render :edit }\n format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @donation_record_actual_funds = DonationRecord::ActualFund.all\n end",
"def fund_params\n params.require(:fund).permit(:needed, :collected)\n end",
"def fund_params\n params.require(:fund).permit(:state, :user_id, :promise_id, :project_id, :amount)\n end",
"def create\n @admin_fund = Fund.new(params[:admin_fund])\n\n respond_to do |format|\n if @admin_fund.save\n format.html { redirect_to @admin_fund, notice: 'Fund was successfully created.' }\n format.json { render json: @admin_fund, status: :created, location: @admin_fund }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_funding_and_estimates\n self.save_without_validating\n end",
"def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @investment_fund = InvestmentFund.new(investment_fund_params)\n\n respond_to do |format|\n if @investment_fund.save\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully created.' }\n format.json { render :show, status: :created, location: @investment_fund }\n else\n format.html { render :new }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def transfer_funds\n raise \"payment must be paid\" if !payment.paid?\n\n bank_account = PagarMe::BankAccount.new(bank_account_attributes.delete(:bank_account))\n bank_account.create\n raise \"unable to create an bank account\" unless bank_account.id.present?\n\n transfer = PagarMe::Transfer.new({\n bank_account_id: bank_account.id,\n amount: value_for_transaction\n })\n transfer.create\n raise \"unable to create a transfer\" unless transfer.id.present?\n\n #avoid sending notification\n payment.update(state: 'pending_refund')\n payment.payment_transfers.create!({\n user: payment.user,\n transfer_id: transfer.id,\n transfer_data: transfer.to_json\n })\n end",
"def investment_fund_params\n params.require(:investment_fund).permit(:category, :name, :redemption_period, :value)\n end",
"def create\n @record_financial = RecordFinancial.new(record_financial_params)\n\n respond_to do |format|\n if @record_financial.save\n format.html { redirect_to @record_financial, notice: 'Record financial was successfully created.' }\n format.json { render :show, status: :created, location: @record_financial }\n else\n format.html { render :new }\n format.json { render json: @record_financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fund_params\n params.require(:fund).permit(:title, :slug, :fund_owners, :description, :marketing_content,\n :marketing_content_expiration, :allocation_code,\n :suggested_amount, :featured_fund, :active, :campus, :keywords,\n :interest, :fund_type)\n end",
"def transfer_funds\n @organizer = Organizer.find(params[:id])\n @amount = raw_price(params[:amount])\n @current = raw_price(params[:current])\n\n if params[:amount].nil?\n @status = \"danger\"\n @message_status = \"Você não especificou um valor\"\n return\n end\n\n @bank_account_active_id = @organizer.marketplace.bank_account_active.own_id\n if @bank_account_active_id.nil?\n @status = \"danger\"\n @message_status = \"Você não tem nenhuma conta bancária ativa no momento\"\n else\n if @amount <= @current\n bank_transfer_data = {\n \"amount\" => @amount,\n \"transferInstrument\" => {\n \"method\" => \"BANK_ACCOUNT\",\n \"bankAccount\" => {\n \"id\" => @bank_account_active_id,\n }\n }\n }\n response_transfer = RestClient.post(\"#{Rails.application.secrets[:moip_domain]}/transfers\", bank_transfer_data.to_json, :content_type => :json, :accept => :json, :authorization => \"OAuth #{@organizer.marketplace.token}\"){|response, request, result, &block|\n case response.code\n when 401\n @status = \"danger\"\n @message_status = \"Você não está autorizado a realizar esta transação\"\n @response_transfer_json = JSON.load response\n when 400\n @status = \"danger\"\n @message_status = \"Não foi possíel realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 200\n @status = \"danger\"\n @message_status = \"Não foi possível realizar a transferência\"\n @response_transfer_json = JSON.load response\n when 201\n @status = \"success\"\n @message_status = \"Solicitação de transferência realizada com sucesso\"\n @response_transfer_json = JSON.load response\n MarketplaceMailer.transfer(@organizer, friendly_price(@response_transfer_json[\"amount\"]), l(@response_transfer_json[\"updatedAt\"].to_datetime, format: '%d de %B de %Y as %Hh%M')).deliver_now\n else\n @activation_message = \"Não conseguimos resposta do MOIP para a transferência soliticata, verifique os dados novamente.\"\n @activation_status = \"danger\"\n @response_transfer_json = JSON.load response\n end\n }\n else\n @status = \"danger\"\n @message_status = \"Você não tem fundos suficientes para realizar esta transferência\"\n end\n end\n\n end",
"def add_fund\n invoice = Spree::PaymentMethod::BitPayment.first.create_invoice(add_fund_params)\n @invoice_url = \"#{invoice['url']}\"\n render json: @invoice_url.to_json\n end",
"def taken_funds\n authenticated_post(\"taken_funds\").body\n end",
"def create\n @financial_donation = FinancialDonation.new(params[:financial_donation])\n\n respond_to do |format|\n if @financial_donation.save\n format.html { redirect_to @financial_donation, notice: 'Financial donation was successfully created.' }\n format.json { render json: @financial_donation, status: :created, location: @financial_donation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial_donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fees_submission_save\n @target_action='fees_submission_student'\n @target_controller='finance'\n @student = Student.find(params[:student])\n @date = @fee_collection = FinanceFeeCollection.find(params[:date])\n @financefee = @date.fee_transactions(@student.id)\n @due_date = @fee_collection.due_date\n @fee_category = FinanceFeeCategory.find(@fee_collection.fee_category_id, :conditions => [\"is_deleted IS NOT NULL\"])\n particular_and_discount_details\n total_fees = @financefee.balance.to_f+FedenaPrecision.set_and_modify_precision(params[:special_fine]).to_f\n unless params[:fine].nil?\n total_fees += FedenaPrecision.set_and_modify_precision(params[:fine]).to_f\n end\n @transaction_date= params[:transaction_date].present? ? Date.parse(params[:transaction_date]) : Date.today_with_timezone\n fine_waiver_value = params[:fine_waiver_val].present? ? params[:fine_waiver_val] : @financefee.is_fine_waiver? ? true :false\n financial_year_check\n if @financial_year_enabled\n if request.post?\n unless params[:fees][:fees_paid].to_f <= 0\n unless params[:fees][:payment_mode].blank?\n unless FedenaPrecision.set_and_modify_precision(params[:fees][:fees_paid]).to_f > FedenaPrecision.set_and_modify_precision(total_fees).to_f\n transaction = FinanceTransaction.new\n ActiveRecord::Base.transaction do\n # begin\n (@financefee.balance.to_f > params[:fees][:fees_paid].to_f) ? transaction.title = \"#{t('receipt_no')}. (#{t('partial')}) F#{@financefee.id}\" : transaction.title = \"#{t('receipt_no')}. F#{@financefee.id}\"\n transaction.category = FinanceTransactionCategory.find_by_name(\"Fee\")\n transaction.payee = @student\n transaction.finance = @financefee\n transaction.fine_included = true unless params[:fine].nil?\n transaction.amount = params[:fees][:fees_paid].to_f\n transaction.fine_amount = params[:fine].to_f\n transaction.transaction_type = 'SINGLE'\n if params[:special_fine] and total_fees==params[:fees][:fees_paid].to_f\n # transaction.fine_amount = params[:fine].to_f+params[:special_fine].to_f\n # transaction.fine_included = true\n @fine_amount=0\n end\n transaction.transaction_date = params[:transaction_date]\n transaction.payment_mode = params[:fees][:payment_mode]\n transaction.reference_no = params[:fees][:reference_no]\n transaction.cheque_date = params[:fees][:cheque_date] if params[:fees][:cheque_date].present?\n transaction.bank_name = params[:fees][:bank_name] if params[:fees][:bank_name].present?\n transaction.payment_note = params[:fees][:payment_note]\n transaction.fine_waiver = fine_waiver_value\n transaction.wallet_amount_applied = params[:fees][:wallet_amount_applied] if params[:fees][:wallet_amount_applied].present?\n transaction.wallet_amount = params[:fees][:wallet_amount] if params[:fees][:wallet_amount].present?\n transaction.safely_create\n # transaction.save\n if transaction.errors.present?\n flash[:notice] = \"#{t('fee_payment_failed')}\"\n transaction.errors.full_messages.each do |err_msg|\n @financefee.errors.add_to_base(err_msg)\n end\n raise ActiveRecord::Rollback\n else\n flash[:warning] = \"#{t('finance.flash14')}. <a href ='#' onclick='show_print_dialog(#{transaction.id})'>#{t('print_receipt')}</a>\"\n end\n # rescue Exception => e\n # puts e.inspect\n # raise ActiveRecord::Rollback\n # end\n end\n @financefee.reload\n # is_paid = @financefee.balance==0 ? true : false\n # @financefee.update_attributes(:is_paid => is_paid)\n # flash[:warning] = \"#{t('flash14')}. <a href ='http://#{request.host_with_port}/finance/generate_fee_receipt_pdf?transaction_id=#{transaction.id}' target='_blank'>#{t('print_receipt')}</a>\"\n\n flash[:notice]=nil\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('flash19')}\"\n end\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('select_one_payment_mode')}\"\n end\n else\n flash[:warning]=nil\n flash[:notice] = \"#{t('flash23')}\"\n end\n end\n end\n @paid_fees = @financefee.finance_transactions.all(:include => :transaction_ledger)\n bal=(@total_payable-@total_discount).to_f\n days=(@transaction_date - @date.due_date.to_date).to_i\n auto_fine=@date.fine\n if days > 0 and auto_fine and !@financefee.is_fine_waiver\n @fine_rule=auto_fine.fine_rules.find(:last, :conditions => [\"fine_days <= '#{days}' and created_at <= '#{@date.created_at}'\"], :order => 'fine_days ASC')\n if Configuration.is_fine_settings_enabled? && @financefee.balance <= 0 && @financefee.is_paid == false && @financefee.balance_fine.present?\n @fine_amount = @financefee.balance_fine\n else\n @fine_amount=@fine_rule.is_amount ? @fine_rule.fine_amount : (bal*@fine_rule.fine_amount)/100 if @fine_rule and @financefee.is_paid==false\n if @fine_rule and @financefee.balance==0\n @fine_amount=@fine_amount.to_f-@financefee.paid_auto_fine\n end\n end\n end\n\n @fine_amount=0 if @financefee.is_paid\n @transaction_date = Date.today_with_timezone if request.post?\n render :update do |page|\n page.replace_html \"fee_submission\", :partial => \"finance/fees_payment/fees_submission_form\"\n end\n end",
"def investment_fund_params\n params.require(:investment_fund).permit(:name, :buyDate, :admTax, :aditionalInfo, :exitTax, :fundBegin, :manager, :managerContact, :shareValue, :capital, :wallet_id)\n end",
"def create\r\n @mutual_fund = MutualFund.new(mutual_fund_params)\r\n\r\n respond_to do |format|\r\n if @mutual_fund.save\r\n format.html { redirect_to @mutual_fund, notice: 'Mutual fund was successfully created.' }\r\n format.json { render :show, status: :created, location: @mutual_fund }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @mutual_fund.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 capture_funds\n \n resp = StdClass.new \n it = InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n \n if self.financial_status == Invoice::FINANCIAL_STATUS_CAPTURED\n resp.error = \"Funds for this invoice have already been captured.\" \n elsif self.total > it.amount\n resp.error = \"The invoice total exceeds the authorized amount.\"\n elsif it.nil?\n resp.error = \"This invoice doesn't seem to be authorized.\"\n else\n \n sc = self.site.store_config \n case sc.pp_name\n \n #when 'authorize.net'\n # transaction = AuthorizeNet::AIM::Transaction.new(sc.authnet_api_login_id, sc.authnet_api_transaction_key)\n # response = transaction.prior_auth_capture(t.transaction_id, self.total)\n # \n # ot = Caboose::InvoiceTransaction.create(\n # :invoice_id => self.id,\n # :date_processed => DateTime.now.utc,\n # :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n # :payment_processor => sc.pp_name,\n # :amount => self.total, \n # :success => response.response_code && response.response_code == '1', \n # :transaction_id => response.transaction_id,\n # :auth_code => response.authorization_code,\n # :response_code => response.response_code\n # )\n # if ot.success\n # self.date_captured = DateTime.now.utc\n # self.save \n # end \n # self.update_attribute(:financial_status, Invoice::FINANCIAL_STATUS_CAPTURED)\n # resp.success = 'Captured funds successfully'\n \n when StoreConfig::PAYMENT_PROCESSOR_STRIPE\n \n it = Caboose::InvoiceTransaction.where(:invoice_id => self.id, :success => true).first\n if it.nil?\n resp.error = \"Error capturing funds for invoice #{self.id}. No previous successful authorization for this invoice exists.\"\n return false\n else \n Stripe.api_key = sc.stripe_secret_key.strip\n bt = nil\n begin\n c = Stripe::Charge.retrieve(it.transaction_id)\n c = c.capture\n bt = Stripe::BalanceTransaction.retrieve(c.balance_transaction)\n rescue Exception => ex\n resp.error = \"Error during capture process\\n#{ex.message}\" \n end\n \n if resp.error.nil?\n InvoiceTransaction.create(\n :invoice_id => self.id,\n :transaction_id => bt.id,\n :transaction_type => InvoiceTransaction::TYPE_CAPTURE,\n :payment_processor => sc.pp_name,\n :amount => bt.amount / 100, \n :date_processed => DateTime.strptime(bt.created.to_s, '%s'),\n :success => bt.status == 'succeeded' || bt.status == 'pending'\n )\n if bt.status == 'succeeded' || bt.status == 'pending'\n self.financial_status = Invoice::FINANCIAL_STATUS_CAPTURED\n self.save\n resp.success = true\n else\n resp.error = \"Error capturing funds.\"\n end\n end\n end\n \n end \n end \n return resp\n end",
"def create\r\n @fixed_deposit_investment = FixedDepositInvestment.new(fixed_deposit_investment_params)\r\n\r\n respond_to do |format|\r\n if @fixed_deposit_investment.save\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully created.' }\r\n format.json { render :show, status: :created, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @payment = Payment.new(payment_params)\n @user = User.find(params[:user_id])\n @payment.proofreader_id = current_user.id\n @payment.request = current_user.balance \n \n \n Stripe.api_key = ENV[\"STRIPE_API_KEY\"]\n token = params[:stripeToken]\n\n recipient = Stripe::Recipient.create(\n :name => @payment.legalname,\n :type => \"individual\",\n :bank_account => token\n )\n current_user.recipient = recipient.id\n current_user.save\n \n\n transfer = Stripe::Transfer.create(\n :amount => (@payment.request * 97).floor,\n :currency => \"usd\",\n :recipient => current_user.recipient\n )\n\n current_user.balance = 0\n current_user.save\n\n respond_to do |format|\n if @payment.save\n format.html { redirect_to dashboard_path, notice: 'Payment was successfully made. You should see your money in your account within 7 business days.' }\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 create\n @financial = Financial.new(params[:financial])\n\n respond_to do |format|\n if @financial.save\n format.html { redirect_to @financial, notice: 'Financial was successfully created.' }\n format.json { render json: @financial, status: :created, location: @financial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financial.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 create\n @fundraiser = Fundraiser.new(fundraiser_params)\n @fundraiser.owner_id = current_user.id\n @fundraiser.start_date = Date.current\n @fundraiser.raised = 0\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render :show, status: :created, location: @fundraiser }\n else\n format.html { render :new }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @title = t('view.trust_funds.new_title')\n @trust_fund = TrustFund.new(params[:trust_fund])\n\n respond_to do |format|\n if @trust_fund.save\n format.html { redirect_to @trust_fund, notice: t('view.trust_funds.correctly_created') }\n format.json { render json: @trust_fund, status: :created, location: @trust_fund }\n else\n format.html { render action: 'new' }\n format.json { render json: @trust_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fund = Fund.new(fund_params)\n authorize @fund\n\n respond_to do |format|\n if @fund.save\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, status: :unprocessable_entity }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget_for_order = BudgetForOrder.new(budget_for_order_params)\n @budget_for_order.total=0\n respond_to do |format|\n if @budget_for_order.save\n format.html { redirect_to budget_new_add_path(@budget_for_order.id), notice: 'Favor de agregar los detalles' }\n format.json { render :show, status: :created, location: @budget_for_order }\n else\n format.html { render :new }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def fund_crowdsale_using_post_with_http_info(crowdsale_fund_params, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenCrowdsaleApi.fund_crowdsale_using_post ...'\n end\n # verify the required parameter 'crowdsale_fund_params' is set\n if @api_client.config.client_side_validation && crowdsale_fund_params.nil?\n fail ArgumentError, \"Missing the required parameter 'crowdsale_fund_params' when calling TokenCrowdsaleApi.fund_crowdsale_using_post\"\n end\n # resource path\n local_var_path = '/crowdsale/fund'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(crowdsale_fund_params)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionSuccessResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokenCrowdsaleApi#fund_crowdsale_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def create\n @financial = Financial.new(financial_params)\n\n respond_to do |format|\n if @financial.save\n format.html { redirect_to @financial, notice: 'Financial was successfully created.' }\n format.json { render :show, status: :created, location: @financial }\n else\n format.html { render :new }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def dailybank_params\n params.require(:dailybank).permit(:user_id, :effective_date, :bacs, :till_cash, :till_float, :coupons_used, :card_payments, :card_1, :card_2, :expenses_total, :actual_cash_total, :till_takings_check, :till_takings, :wet_takings, :dry_takings, :merch_takings, :vouchers_sold, :vouchers_used, :deposit_sold, :deposit_used, :actual_till_takings, :reported_till_takings, :v_d_adjustments, :total_eft_taken, :total_expected_cash, :terminal_1, :terminal_2, :tablet_1, :tablet_2, :calculated_variance, :user_variance, :variance_comment, :status, :variance_gap, :gratuity_1, :gratuity_2, :gratuity_total, :banking, :cashfloats_attributes => [:id, :dailybank_id, :float_type, :period, :completed_by, :user_code, :fifties, :twenties, :tens, :fives, :two_pound_single, :pound_single, :fifty_single, :twenty_single, :ten_single, :five_single, :two_single, :one_single, :float_actual, :float_target, :float_gap, :float_comment, :completed, :cheat, :override], :expenses_attributes => [:id, :dailybank_id, :what, :where, :price, :ref, :_destroy] )\n end",
"def test_create_transaction\n params = {\n bank_transaction: {\n bank_account_id: 1,\n date: Time.local(2012, 4, 16),\n amount: 55\n }\n }\n\n post '/api/banks/1/transactions', params\n data = ActiveSupport::JSON.decode last_response.body\n\n assert last_response.successful?\n assert_match('application/json', last_response.content_type)\n assert BankTransaction.find(data['id'])\n end",
"def fund_crowdsale_using_post(crowdsale_fund_params, opts = {})\n data, _status_code, _headers = fund_crowdsale_using_post_with_http_info(crowdsale_fund_params, opts)\n data\n end",
"def transfer_funds\n if self.result != nil && self.result_transfer_id == nil\n if transfer = Transfer.create(\n group_id: self.group_id,\n from_account_id: self.transfer.to_account_id,\n to_account_id: self.transfer.from_account_id,\n amount: self.transfer.amount,\n description: \"Dispute of Transfer #{self.transfer.id} was #{self.result == Dispute::APPROVE ? \"approved\" : \"denied\"}. \\\"#{self.reason}\\\"\",\n user_id: self.current_user_id,\n occurred_on: DateTime.now\n )\n transfer.save!\n update_attribute(:result_transfer_id, transfer.id)\n end\n end\n end",
"def destroy\n @donation_record_actual_fund.destroy\n respond_to do |format|\n format.html { redirect_to @donation_record}\n format.json { head :no_content }\n end\n end",
"def financial_params\n params.require(:financial).permit(:regno, :fystart, :fyend, :income, :expend)\n end",
"def create\n p params\n donation = Donation.new(\n amount: params[:amount],\n frequency: params[:frequency])\n # save the information from user input to create a new donation.\n donation.save!\n if donation.save!\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end",
"def total_taken_funds\n authenticated_post(\"total_taken_funds\").body\n end",
"def new\n @fund = Fund.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_fund }\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, budget: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fund_company_investment = FundCompanyInvestment.new(fund_company_investment_params)\n\n respond_to do |format|\n if @fund_company_investment.save\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fund_company_investment }\n else\n format.html { render action: 'new' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @financial_donation = FinancialDonation.new\n @financial_donation.donated = Date.today\n \n if params[:donor]\n @financial_donation.donor = Donor.find(params[:donor])\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial_donation }\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to budgets_path }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def payment_amount\n params['asking_price'] = params['asking_price'].to_f\n params['down_payment'] = params['down_payment'].to_f\n params['amortization_period'] = params['amortization_period'].to_f\n\n insurance_cost = calculate_insurance_amount(params)\n payment_amount = calculate_payment_amount(params, insurance_cost, @@interest_rate)\n json_response(amount: payment_amount)\n end",
"def cb_fund_params\n params.require(:cb_fund).permit(:fund_id, :object_id, :name, :funded_at, :raised_amount, :raised_currency_code, :source_url, :source_description)\n end",
"def donation\n @donation = FinanceDonation.new(params[:donation])\n @donation_additional_details = DonationAdditionalDetail.find_all_by_finance_donation_id(@donation.id)\n @additional_fields = DonationAdditionalField.find(:all, :conditions => \"status = true\", :order => \"priority ASC\")\n if request.post? && @donation.valid?\n @error=false\n mandatory_fields = DonationAdditionalField.find(:all, :conditions => {:is_mandatory => true, :status => true})\n mandatory_fields.each do |m|\n unless params[:donation_additional_details][m.id.to_s.to_sym].present?\n @donation.errors.add_to_base(\"#{m.name} must contain atleast one selected option.\")\n @error=true\n else\n if params[:donation_additional_details][m.id.to_s.to_sym][:additional_info]==\"\"\n @donation.errors.add_to_base(\"#{m.name} cannot be blank.\")\n @error=true\n end\n end\n end\n unless @error==true\n @donation.save\n additional_field_ids_posted = []\n additional_field_ids = @additional_fields.map(&:id)\n if params[:donation_additional_details].present?\n params[:donation_additional_details].each_pair do |k, v|\n addl_info = v['additional_info']\n additional_field_ids_posted << k.to_i\n addl_field = DonationAdditionalField.find_by_id(k)\n if addl_field.input_type == \"has_many\"\n addl_info = addl_info.join(\", \")\n end\n prev_record = DonationAdditionalDetail.find_by_finance_donation_id_and_additional_field_id(params[:id], k)\n unless prev_record.nil?\n unless addl_info.present?\n prev_record.destroy\n else\n prev_record.update_attributes(:additional_info => addl_info)\n end\n else\n addl_detail = DonationAdditionalDetail.new(:finance_donation_id => @donation.id,\n :additional_field_id => k, :additional_info => addl_info)\n addl_detail.save if addl_detail.valid?\n end\n end\n end\n if additional_field_ids.present?\n DonationAdditionalDetail.find_all_by_finance_donation_id_and_additional_field_id(params[:id], (additional_field_ids - additional_field_ids_posted)).each do |additional_info|\n additional_info.destroy unless additional_info.donation_additional_field.is_mandatory == true\n end\n end\n flash[:notice] = \"#{t('flash1')}\"\n redirect_to :action => 'donation_receipt', :id => @donation.id\n end\n end\n end",
"def save_financials\n current_user.update(assets: params[:assets], average_annual_income: params[:average_annual_income], credit_score: params[:credit_score], total_debt: params[:total_debt])\n user_listings = current_user.listings\n render json: [current_user, user_listings]\n end",
"def create\n @bank_reconciliations = AccountingBankReconciliations.new(params[:bank_reconciliations])\n @detail_value = AccountingReconciliationDetailValues.new(params[:detail_value])\n #@bank_reconciliations.bank_balance = format_currency(accumulate_cash_balance)\n respond_to do |format|\n if @bank_reconciliations.save \n @detail_value.value = params[:vallue]\n @detail_value.save\n flash[:notice] = 'BankReconciliations was successfully created.'\n format.html { redirect_to(accounting_bank_reconciliation_path(@bank_reconciliations)) }\n format.xml { render :xml => @bank_reconciliations, :status => :created, :location => @bank_reconciliations }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bank_reconciliations.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(params[:budget])\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render json: @budget, status: :created, location: @budget }\n else\n format.html { render action: \"new\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def userfund_params\n params.require(:userfund).permit(:user_id, :fund_id)\n end",
"def create_deposit_using_post_with_http_info(daily_deposit_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_deposit_using_post ...'\n end\n # verify the required parameter 'daily_deposit_request' is set\n if @api_client.config.client_side_validation && daily_deposit_request.nil?\n fail ArgumentError, \"Missing the required parameter 'daily_deposit_request' when calling FundingApi.create_deposit_using_post\"\n end\n # resource path\n local_var_path = '/deposit'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(daily_deposit_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DailyDeposit')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_deposit_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def add_funds\n\n @ali = ActivityLineItem.find_by_object_key(params[:ali])\n @budget_amounts = @organization.budget_amounts.where('fy_year = ? AND amount > 0', @ali.capital_project.fy_year)\n\n render :partial => 'add_funds_modal_form'\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @budget = Budget.new(budget_params)\n\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'Budget was successfully created.' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def record_financial_params\n params.require(:record_financial).permit(:FINANCIAL_id, :RECORD_id)\n end",
"def create\n @userfund = Userfund.new(userfund_params)\n\n respond_to do |format|\n if @userfund.save\n format.html { redirect_to @userfund, notice: 'Userfund was successfully created.' }\n format.json { render :show, status: :created, location: @userfund }\n else\n format.html { render :new }\n format.json { render json: @userfund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @data = params[:investment]\n @investment= DraftInvestment.find(:all, :conditions => [\"company_id = ? AND funding_type = ?\",@data[:company_id], @data[:funding_type]])\n if @investment.to_s != \"\"\n @invest = DraftInvestment.find(@investment[0][:id])\n\t @invest.update_attributes({\"agency\" => @investment[0][\"agency\"] + \", \" + @data[:agency],\"funding_amount\" => (@data[\"funding_amount\"].to_i + @investment[0][\"funding_amount\"]).to_s})\n respond_to do |format|\n format.xml \n\t\tend \n\t \n else\n\n @investment = DraftInvestment.new(params[:investment])\n respond_to do |format|\n if @investment.save\n flash[:notice] = 'Investment was successfully created.'\n\n format.xml { render :xml => @investment, :status => :created, :location => @investment }\n else\n\n format.xml { render :xml => @investment.errors, :status => :unprocessable_entity }\n end\n end\n \n end\n\n end",
"def create\n @cb_fund = CbFund.new(cb_fund_params)\n\n respond_to do |format|\n if @cb_fund.save\n format.html { redirect_to @cb_fund, notice: 'Cb fund was successfully created.' }\n format.json { render :show, status: :created, location: @cb_fund }\n else\n format.html { render :new }\n format.json { render json: @cb_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params[:fee][:amount].gsub!(/[$,]/, '')\n params[:fee][:amount] = (params[:fee][:amount].to_f * 100).to_i\n\n @fee = Fee.new(fee_params)\n @fee.booth = Booth.find(params[:booth_id])\n\n respond_to do |format|\n if @fee.save\n format.html { redirect_to @fee.booth, notice: 'Fee was successfully created.' }\n format.json { render :show, status: :created, location: @fee }\n else\n format.html { render :new }\n format.json { render json: @fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mutual_fund_params\r\n params.require(:mutual_fund).permit(:institution_id, :name, :minimum_principal_pesewas, :debit_order_pesewas, :management_fee_rate, :min_days_before_withdrawal, :risk_rating, :links, :email, :phone_number, :description)\r\n end",
"def create\n #render :text => params.inspect;return\n @monthly_interest = MonthlyInterest.new(params[:monthly_interest])\n @customer_id = params[:monthly_interest][:customer_id]\n @customer = Customer.find_by_account_number(@customer_id)\n @monthly_interest.customer_id = @customer.id\n\n respond_to do |format|\n if @monthly_interest.save\n update_transaction(@monthly_interest)\n\n if @customer.loans_taken == nil\n @customer.update_attributes(:loans_taken => '1')\n else\n loans_taken = @customer.loans_taken + 1\n @customer.update_attributes(:loans_taken => loans_taken)\n end\n\n @monthly_interest.payment_days.times do \n @di_record = MonthlyInterestRecord.new \n @di_record.monthly_interest_id = @monthly_interest.id \n @di_record.amount = params[:monthly_interest][:interest_per_day]\n @di_record.save \n end\n UserMailer.welcome_monthly_interest(@customer).deliver\n flash[:notice] = 'Monthly interest was successfully created.'\n format.html { redirect_to :controller => \"customers\", :action => \"show\", :id => @customer.id} \n format.json { render json: @monthly_interest, status: :created, location: @monthly_interest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monthly_interest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_financial_transaction_refund_deposit\n if self.sum_deposit_available_for_refund > 0\n financial_transaction = {\n transaction_type: 'payin_refund',\n purpose: 'deposit',\n amount: self.sum_deposit_available_for_refund,\n fees: 0,\n src_type: :src_payin_vid,\n src_vid: self.financial_transactions.payin.finished.take.transaction_vid\n }\n t = self.financial_transactions.create( financial_transaction )\n\n # FIXME(RA): should be triggered from a job:\n t.process!\n else\n LOG.error \"Not possible to refund a negative value.\"\n end\n end",
"def create\n #render :text => params.inspect;return\n @monthly_finance = MonthlyFinance.new(params[:monthly_finance])\n @customer_id = params[:monthly_finance][:customer_id]\n @customer = Customer.find_by_account_number(@customer_id)\n @monthly_finance.customer_id = @customer.id unless @customer.blank?\n @transaction = Transaction.last\n @customer = Customer.find(params[:id]) if params[:id]\n @partners = Partner.all\n\n @mfinance_name = MonthlyFinance.last\n if @mfinance_name.nil?\n @mfinance_name = \"MF-loan1\"\n else\n @mfinance_name = @mfinance_name.loan_name.next\n end\n\n respond_to do |format|\n if @monthly_finance.save\n if @customer.loans_taken == nil\n @customer.update_attributes(:loans_taken => '1')\n else\n loans_taken = @customer.loans_taken + 1\n @customer.update_attributes(:loans_taken => loans_taken)\n end\n\n if @customer.loans_uncleared == nil\n @customer.update_attributes(:loans_uncleared => '1')\n else\n loans_uncleared = @customer.loans_uncleared + 1\n @customer.update_attributes(:loans_uncleared => loans_uncleared)\n end\n @amount = (params[:monthly_finance][:main_balance]).to_i / (params[:monthly_finance][:payment_months]).to_i\n month = Date.today.to_date + 1.month\n @monthly_finance.payment_months.times do\n @mfrecord = MonthlyFinanceRecord.new \n @mfrecord.monthly_finance_id = @monthly_finance.id \n @mfrecord.due_date = month\n @mfrecord.amount = @amount\n @mfrecord.save \n month = month + 1.month\n end\n \n #update transaction table here\n update_transaction(@monthly_finance)\n UserMailer.welcome_monthly_finance(@customer).deliver\n flash[:notice] = 'Monthly finance was successfully created.' \n format.html { redirect_to :controller => \"customers\", :action => \"show\", :id => @customer.id}\n format.json { render json: @monthly_finance, status: :created, location: @monthly_finance }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monthly_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@klass_fee = KlassFee.new(params[:klass_fee])\n ap params[:fee]\n begin\n params[:fee].each do |fee_type_id, amount|\n puts \"=======xx==========\"\n ap KlassFee.create({klass_id: @klass.id, fee_type_id: fee_type_id, amount: amount[:amount]})\n end\n \n redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully created.'\n #rescue Exception => e\n # render action: \"new\" \n end\n end",
"def create\n @fixed_deposit = FixedDeposit.new(params[:fixed_deposit])\n\n respond_to do |format|\n if @fixed_deposit.save\n flash[:notice] = 'FixedDeposit was successfully created.'\n format.html { redirect_to(@fixed_deposit) }\n format.xml { render :xml => @fixed_deposit, :status => :created, :location => @fixed_deposit }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @fixed_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @monthly_finance = MonthlyFinance.new\n @customer = Customer.find(params[:id]) if params[:id]\n @partners = Partner.all\n @transaction = MonthlyFInvestment.find(:all, :conditions => \"invested_in = 'monthly_finance' and is_active = '1' \").map(&:investment_amount).inject{|sum,x| sum.to_i + x.to_i} \n\n @mfinance_name = MonthlyFinance.last\n if @mfinance_name.nil?\n @mfinance_name = \"MF-loan1\"\n else\n @mfinance_name = @mfinance_name.loan_name.next\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monthly_finance }\n end\n end",
"def create\n @dailybank = Dailybank.new(dailybank_params)\n\n respond_to do |format|\n if @dailybank.save\n run_calc_rules(@dailybank)\n Cashfloat.count_cash(Cashfloat.where(:dailybank_id => @dailybank.id).first)\n format.html { redirect_to @dailybank }\n format.json { render :show, status: :created, location: @dailybank }\n else\n format.html { render :new }\n format.json { render json: @dailybank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_fee_receipt\n if params[:detailed].present? and params[:detailed] == \"true\"\n ledger = FinanceTransactionLedger.find(params[:transaction_id],\n :joins => \"LEFT JOIN finance_transactions ft ON ft.transaction_ledger_id = finance_transaction_ledgers.id\n INNER JOIN finance_transaction_receipt_records ftrr ON ftrr.finance_transaction_id = ft.id\n LEFT JOIN fee_accounts fa ON fa.id = ftrr.fee_account_id\",\n # :conditions => \"(ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n :conditions => \"#{active_account_conditions(true, 'ftrr')}\",\n :include => {:finance_transactions => :finance_transaction_receipt_record})\n finance_transactions = ledger.finance_transactions #.all(:include => :finance_transaction_receipt_record)\n else\n finance_transactions = FinanceTransaction.find_all_by_id(params[:transaction_id],\n :joins => \"INNER JOIN finance_transaction_receipt_records ftrr ON ftrr.finance_transaction_id = finance_transactions.id\n LEFT JOIN fee_accounts fa ON fa.id = ftrr.fee_account_id\",\n # :conditions => \"(ftrr.fee_account_id IS NULL OR (ftrr.fee_account_id IS NOT NULL AND fa.is_deleted = false))\",\n :conditions => \"#{active_account_conditions(true, 'ftrr')}\",\n :include => :finance_transaction_receipt_record)\n end\n template_ids = []\n @transactions = finance_transactions.map do |ft|\n receipt_data = ft.receipt_data\n template_ids << receipt_data.template_id = ft.fetch_template_id\n receipt_data.transaction_status = ft.transaction_ledger.status\n receipt_data\n end\n template_ids = template_ids.compact.uniq\n @data = {:templates => template_ids.present? ? FeeReceiptTemplate.find(template_ids).group_by(&:id) : {} }\n render :layout => \"print\"\n end",
"def submit_details(details)\n response = adyen_client.checkout.payments_api.payments_details(details)\n puts response.to_json\n response\n end",
"def fees_submission_student\n if params[:date].present?\n @date = @fee_collection = FinanceFeeCollection.find(params[:date])\n @transaction_date= params[:transaction_date].present? ? Date.parse(params[:transaction_date]) : Date.today_with_timezone.to_date\n @target_action='fees_submission_student'\n @target_controller='finance'\n @student = Student.find(params[:id])\n \n # calculating total collected advance fee amount\n @advance_fee_used = @fee_collection.finance_fees.all(:conditions => {:student_id => @student.id, :batch_id => @student.batch.id}).collect(&:finance_transactions).flatten.compact.sum(&:wallet_amount).to_f\n \n @fee = @student.finance_fee_by_date(@date)\n @fine_waiver_val = params[:fine].present? && params[:fine][:is_fine_waiver].present?? params[:fine][:is_fine_waiver] : 'false'\n financial_year_check\n unless @fee.nil?\n @particular_wise_paid = (@date.discount_mode != \"OLD_DISCOUNT\" && @fee.finance_transactions.map(&:trans_type).include?(\"particular_wise\"))\n # @particular_wise_paid = @fee.finance_transactions.map(&:trans_type).include?(\"particular_wise\")\n flash.now[:notice]=\"#{t('particular_wise_paid_fee_payment_disabled')}\" if @particular_wise_paid\n @batch = @fee.batch\n @financefee = @student.finance_fee_by_date @date\n # @financefee.update_attributes(:is_fine_waiver=>true) if params[:is_fine_waiver]\n # @linking_required = @fee_collection.has_linked_unlinked_masters(false, @student.id) if @student.present? and !@financefee.is_paid\n @due_date = @fee_collection.due_date\n @paid_fees = @fee.finance_transactions\n @fee_category = FinanceFeeCategory.find(@fee_collection.fee_category_id, :conditions => [\"is_deleted = false\"])\n @fine=nil\n @fine=params[:fine][:fee] if (params[:fine].present? and params[:fine][:fee].present?)\n particular_and_discount_details\n bal=(@total_payable-@total_discount).to_f\n days=(@transaction_date-@date.due_date.to_date).to_i\n auto_fine=@date.fine\n if days > 0 and auto_fine and !@financefee.is_fine_waiver\n if Configuration.is_fine_settings_enabled? && @financefee.balance <= 0 && @financefee.is_paid == false && !@financefee.balance_fine.nil?\n @fine_amount = @financefee.balance_fine\n else\n @fine=params[:fine][:fee].to_f if params[:fine].present? and params[:fine][:fee].present? and params[:fine][:fee].to_f > 0.0\n @fine_rule=auto_fine.fine_rules.find(:last, :conditions => [\"fine_days <= '#{days}' and created_at <= '#{@date.created_at}'\"], :order => 'fine_days ASC')\n @fine_amount=@fine_rule.is_amount ? @fine_rule.fine_amount : (bal*@fine_rule.fine_amount)/100 if @fine_rule\n if @fine_rule and @financefee.balance==0\n @fine_amount=@fine_amount-@financefee.paid_auto_fine\n end\n end\n elsif @financefee.is_fine_waiver \n @fine_amount =0.0\n end\n @fine_amount=0 if @financefee.is_paid\n render :update do |page|\n if params[:add_fine].present?\n page.replace_html 'modal-box', :partial => 'individual_fine_submission'\n page << \"Modalbox.show($('modal-box'), {title: ''});\"\n elsif @fine.nil? or @fine.to_f > 0\n # page.replace_html \"fee_submission\",\n # :partial => \"finance/fees_payment/#{@linking_required ? 'notice_link_particulars' : 'fees_submission_form'}\",\n # :with => @fine\n page.replace_html \"fee_submission\",\n :partial => \"finance/fees_payment/fees_submission_form\", :with => @fine\n page << \"Modalbox.hide();\"\n elsif @fine.to_f <=0\n page.replace_html 'modal-box', :text => 'fine_submission'\n page.replace_html 'form-errors', :text => \"<div id='error-box'><ul><li>#{t('finance.flash24')}</li></ul></div>\"\n end\n end\n else\n render :update do |page|\n page.replace_html \"fee_submission\", :text => '<p class=\"flash-msg\">No students have been assigned this fee.</p>'\n end\n end\n else\n render :update do |page|\n page.replace_html \"fee_submission\", :text => ''\n end\n end\n\n end",
"def fake_donation\n if params[:donate_token]\n Donation.create!(:amount => params[:amount].to_f, \n :user => current_user, \n :fundraiser => User.find_by_donate_token(params[:donate_token]))\n end\n render :action => 'thanks'\n end",
"def create\n @fee = Fee.new(fee_params)\n student = Student.find(params[:fee][:student_id])\n temp = student.due_date.to_date\n if student.term == 'Monthly'\n student.due_date = (temp + 1.month).to_s\n elsif student.term == \"Quarterly\"\n student.due_date = (temp + 3.month).to_s\n elsif student.term = \"Bi-annualy\"\n student.due_date = (temp + 6.month).to_s\n end\n student.save\n @fee.save\n redirect_to fee_path(@fee.id), notice: \"Fee Submitted Successfully\"\n end",
"def create\n\t\tuser = User.find_by(id: expense_params['user_id'])\n\t\tdebt = Debt.find_by(id: expense_params['debt_id'])\n\t\texpense = user.expenses.build(expense_params)\n\t\tif expense.save \n\t\t\tif debt\n\t\t\t\tdebt.expenses << expense\n\t\t\tend\n\t\t\trender json: user\n\t\telse\n\t\t\trender json: expense.errors, status: :unprocessable_entity\n\t\tend\n\tend",
"def create\n account = Account.where(\"account_number = ?\", params[:account_number]).first \n deposit_amount = params[:deposit_amount].to_f \n\n if (account && account.balance >= deposit_amount)\n deposit = Deposit.new\n deposit.account_id = account.id\n deposit.user_id = account.user_id\n\n tenure_in_years = params[:tenure_in_years].first\n tenure_in_months = params[:tenure_in_months].first\n tenure_in_days = params[:tenure_in_days].first\n\n deposit.tenure_in_years = tenure_in_years\n deposit.tenure_in_months = tenure_in_months\n deposit.tenure_in_days = tenure_in_days\n deposit.maturity_proceeds = params[:maturity_proceeds].present? ? params[:maturity_proceeds] : 0\n\n deposit.save\n\n user_age = account.user.age rescue 0\n\n # This is to calculate the rate of interest.\n #interest = deposit.calculate_interest(tenure_in_years, tenure_in_months, tenure_in_days, user_age)\n #deposit.update(:interest => interest)\n\n balance = (account.balance - deposit_amount)\n account.update(:balance => balance)\n else\n flash[:error] = \"Account doesn't exsits / balance is less. Please try again.\"\n redirect_to new_account_path\n end\n flash[:message]= \"Amount is deposited successfully.\"\n redirect_to new_account_path\n end",
"def create\n @transaction = Transaction.new(transaction_params)\n @flat_details = Flat.find_by_id(transaction_params[:flat_id])\n @flat_details.balance_amount = @flat_details.balance_amount.to_i - transaction_params[:debit].to_i\n @transaction.balance = @flat_details.balance_amount\n @flat_details.save\n respond_to do |format|\n if @transaction.save\n\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classification_fund = ClassificationFund.new(classification_fund_params)\n\n respond_to do |format|\n if @classification_fund.save\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully created.' }\n format.json { render :show, status: :created, location: @classification_fund }\n else\n format.html { render :new }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @funds = Fund.all\n\n render json: @funds\n end",
"def create\n @budget = Budget.new(budget_params)\n respond_to do |format|\n if @budget.save\n \n if !params[:budget][:items].nil?\n params[:budget][:items].each do |f| \n Item.where([\"id = #{f}\"]).first.update(budget_id: @budget.id)\n end\n end\n \n format.html { redirect_to budgets_path, notice: \"Budget was successfully created.\" }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @debt = Debt.new(params[:debt])\n\n respond_to do |format|\n if @debt.save\n format.html { redirect_to @debt, :notice => 'Debt was successfully created.' }\n format.json { render :json => @debt, :status => :created, :location => @debt }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @debt.errors, :status => :unprocessable_entity }\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 kentrade_params\n params.require(:kentrade).permit(:idf_document_fee, :payment_date)\n end",
"def create\n @fundraiser = Fundraiser.new(params[:fundraiser])\n\n respond_to do |format|\n if @fundraiser.save\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully created.' }\n format.json { render json: @fundraiser, status: :created, location: @fundraiser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bond = Bond.new(bond_params)\n @bond.citizen = current_citizen\n\n respond_to do |format|\n if @bond.save\n format.html { redirect_to \"/citizens/#{@bond.citizen.id}?tab=finances\", notice: 'Bond bought.' }\n format.json { render :show, status: :created, location: @bond }\n else\n format.html { render :new }\n format.json { render json: @bond.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fixed_asset = FixedAsset.new(fixed_asset_params)\n loan = @fixed_asset.asset_loan\n $asset_loan_total = $asset_loan_total + loan\n fixed_asset_cost = @fixed_asset.asset_cost\n $asset_cost_total = $asset_cost_total + fixed_asset_cost\n fixed_asset_paid = @fixed_asset.asset_paid\n $cash = $cash - fixed_asset_paid\n respond_to do |format|\n if @fixed_asset.save\n format.html { redirect_to fixed_assets_path, notice: 'Fixed asset was successfully created.' }\n format.json { render :show, status: :created, location: @fixed_asset }\n else\n format.html { render :new }\n format.json { render json: @fixed_asset.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @warranty = Warranty.new(warranty_params)\n\n respond_to do |format|\n if @warranty.save\n format.html { redirect_to @warranty, notice: 'Warranty was successfully created.' }\n format.json { render :show, status: :created, location: @warranty }\n else\n format.html { render :new }\n format.json { render json: @warranty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pay_fee = PayFee.new(pay_fee_params)\n\n respond_to do |format|\n if @pay_fee.save\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully created.' }\n format.json { render :show, status: :created, location: @pay_fee }\n else\n format.html { render :new }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_withdrawal_using_post_with_http_info(daily_withdrawal_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FundingApi.create_withdrawal_using_post ...'\n end\n # verify the required parameter 'daily_withdrawal_request' is set\n if @api_client.config.client_side_validation && daily_withdrawal_request.nil?\n fail ArgumentError, \"Missing the required parameter 'daily_withdrawal_request' when calling FundingApi.create_withdrawal_using_post\"\n end\n # resource path\n local_var_path = '/withdrawal'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['*/*'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(daily_withdrawal_request)\n auth_names = ['oauth2']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'DailyWithdrawal')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FundingApi#create_withdrawal_using_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\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 @membership_fee = MembershipFee.new(params[:membership_fee])\n\n respond_to do |format|\n if @membership_fee.save\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully created.' }\n format.json { render json: @membership_fee, status: :created, location: @membership_fee }\n else\n format.html { render action: \"new\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @financial = Financial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financial }\n end\n end",
"def add_bank_account\n\n get_balanced_key\n\n account_uri = params[:account_uri]\n company_name = \"Mindfire Solutions\"\n\n ##You can set your customer business / company name here \n customer = Balanced::Customer.new({name: company_name}).save\n customer_uri = customer.href\n get_customer = Balanced::Customer.fetch(customer_uri)\n \n bank_account = Balanced::BankAccount.fetch(account_uri)\n bank_account.associate_to_customer(customer_uri)\n \n ##befor debiting your customer you need to verify their bank account as per balanced payment\n bank_account = Balanced::BankAccount.fetch(account_uri)\n verify_bank_account = bank_account.verify\n verification = Balanced::BankAccountVerification.fetch(verify_bank_account.href)\n verification.confirm(\n amount_1 = 1,\n amount_2 = 1\n )\n \n amount_in_dollars = params[:amount].to_i\n #amount_in_dollars * 100 convert into cents\n debit = bank_account.debit(:amount => amount_in_dollars * 100, appears_on_statement_as: \"Debit Amount\")\n \n ##You can save the response in your db for future use\n #debit.transaction_number\n #debit.amount\n #debit.statusdebit.created_at\n \n #get your balanced marketplace\n marketplace = Balanced::Marketplace.my_marketplace\n \n credit = get_marketplace_bank_account.credit(:amount => debit.amount, appears_on_statement_as: \"Credit Amount\")\n\n \n return render json: {success: [\"Debit Transaction:: #{debit.attributes}\", \"Credit Transaction:: #{credit.attributes}\"] }\n\n end",
"def show\n render json: @fund\n end"
] |
[
"0.65340567",
"0.6393791",
"0.6371374",
"0.6208825",
"0.6162286",
"0.6146011",
"0.61390823",
"0.6119465",
"0.60814506",
"0.6075106",
"0.60108215",
"0.5993477",
"0.5993477",
"0.59488827",
"0.5924591",
"0.5907125",
"0.58687466",
"0.5862193",
"0.5857213",
"0.58563",
"0.5840352",
"0.5830936",
"0.5826132",
"0.5810807",
"0.58039397",
"0.57967615",
"0.57852036",
"0.57742363",
"0.5768081",
"0.5732232",
"0.57159334",
"0.56956834",
"0.5692933",
"0.5684849",
"0.5682486",
"0.5680199",
"0.567805",
"0.5664116",
"0.56514704",
"0.564434",
"0.56423295",
"0.5634896",
"0.56174165",
"0.5608522",
"0.56048214",
"0.5595911",
"0.5593028",
"0.5587541",
"0.55848193",
"0.5583783",
"0.5579041",
"0.5571658",
"0.5571107",
"0.5561239",
"0.5557649",
"0.5550264",
"0.5538758",
"0.5536892",
"0.5524883",
"0.55246603",
"0.5524572",
"0.55167973",
"0.55090696",
"0.55054045",
"0.55017334",
"0.5498437",
"0.5497807",
"0.5489942",
"0.5476801",
"0.54715675",
"0.5457773",
"0.54546034",
"0.54538745",
"0.5447634",
"0.5447145",
"0.54292196",
"0.54282665",
"0.5417083",
"0.54168814",
"0.54154",
"0.5412907",
"0.5399452",
"0.539675",
"0.5395252",
"0.53929484",
"0.538808",
"0.53861934",
"0.5371368",
"0.5365429",
"0.536484",
"0.5362603",
"0.53621835",
"0.5355042",
"0.53518873",
"0.5344449",
"0.5342476",
"0.5342476",
"0.533585",
"0.53298295",
"0.5328136"
] |
0.70836675
|
0
|
PATCH/PUT /donation_record/actual_funds/1 PATCH/PUT /donation_record/actual_funds/1.json
|
def update
respond_to do |format|
if @donation_record_actual_fund.update(donation_record_actual_fund_params)
format.html { redirect_to @donation_record }
format.json { render :show, status: :ok, location: @donation_record_actual_fund }
else
format.html { render :edit }
format.json { render json: @donation_record_actual_fund.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @financial_donation = FinancialDonation.find(params[:id])\n\n respond_to do |format|\n if @financial_donation.update_attributes(params[:financial_donation])\n format.html { redirect_to @financial_donation, notice: 'Financial donation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financial_donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_fund = Fund.find(params[:id])\n\n respond_to do |format|\n if @admin_fund.update_attributes(params[:admin_fund])\n format.html { redirect_to @admin_fund, notice: 'Fund was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @fund }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fund.update(fund_params)\n format.html { redirect_to @fund, notice: 'Fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @fund }\n else\n format.html { render :edit }\n format.json { render json: @fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @investment_fund.update(investment_fund_params)\n format.html { redirect_to @investment_fund, notice: 'Investment fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @investment_fund }\n else\n format.html { render :edit }\n format.json { render json: @investment_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @mutual_fund.update(mutual_fund_params)\r\n format.html { redirect_to @mutual_fund, notice: 'Mutual fund was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @mutual_fund }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @mutual_fund.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @funding_requirement.update(funding_requirement_params)\n format.html { redirect_to @funding_requirement, notice: 'Funding requirement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @funding_requirement.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 # go to params hash and get the id\n the_id = params['id']\n\n # grab a single donation based on the id\n donation = Donation.find_by(id: the_id)\n\n # update it\n if donation.update!(\n amount: params[:amount],\n frequency: params[:frequency])\n render json: donation.as_json\n else\n render json: {errors: donation.errors.full_messages}\n end\n end",
"def update\n respond_to do |format|\n if @record_financial.update(record_financial_params)\n format.html { redirect_to @record_financial, notice: 'Record financial was successfully updated.' }\n format.json { render :show, status: :ok, location: @record_financial }\n else\n format.html { render :edit }\n format.json { render json: @record_financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n # format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n # format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @financial = Financial.find(params[:id])\n\n respond_to do |format|\n if @financial.update_attributes(params[:financial])\n format.html { redirect_to @financial, notice: 'Financial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cb_fund.update(cb_fund_params)\n format.html { redirect_to @cb_fund, notice: 'Cb fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @cb_fund }\n else\n format.html { render :edit }\n format.json { render json: @cb_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @person_expense_record = PersonExpenseRecord.find(params[:id])\n\n if @person_expense_record.update(person_expense_record_params)\n head :no_content\n else\n render json: @person_expense_record.errors, status: :unprocessable_entity\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n\n respond_to do |format|\n if @budget.update_attributes(params[:budget])\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_funding_and_estimates\n self.save_without_validating\n end",
"def set_donation_record_actual_fund\n @donation_record_actual_fund = (id=params[:id]) ? DonationRecord::ActualFund.find(id) : DonationRecord::ActualFund.new\n end",
"def update\n respond_to do |format|\n if @fund_company_investment.update(fund_company_investment_params)\n format.html { redirect_to @fund_company_investment, notice: 'Fund company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fund_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end",
"def update\n # Expecting the following format:\n # {\n # \"dmp\": {\n # \"dmp_id\": {\n # 'type': 'doi',\n # 'identifier': '10.234/erfere.234d'\n # },\n # \"contributor\": [{\n # \"name\": 'Jane Doe',\n # \"mbox\": 'jane.doe@example.org',\n # \"roles\": 'https://credit.org/roles/program_officer',\n # \"affiliation\": {\n # \"name\": 'National Science Foundation (NSF)'\n # },\n # }],\n # \"project\": {\n # \"start_on\": '2020-05-15 10:34:21 UCT',\n # \"end_on\": '2022-05-15 10:34:21 UCT',\n # \"funding\": [{\n # \"name\": \"Example Funder\",\n # \"funder_id\": {\n # 'typer':'ROR',\n # 'identifier': 'http://ror.org/45y4545'\n # },\n # \"grant_id\": {\n # 'type': 'url',\n # 'identifier': 'http://awards.example.org/1234'\n # }\n # \"funding_status\": \"granted\"\n # }]\n # }\n # }\n # }\n @funding = Funding.where(id: params[:id]).first\n if @funding.present? && funding_params.fetch('dmp_id', {}).any? &&\n funding_params['dmp_id']['identifier'].present? &&\n funding_params.fetch('project', {})['funding'].present?\n\n dmp = DataManagementPlan.find_by_doi(funding_params['dmp_Id']['identifier']).first\n if @funding.project.data_management_plans.first.id == dmp.id\n prepare_project_for_update(params: funding_params['project'])\n prepare_funding_for_update(params: funding_params['project']['funding'].first)\n\n if funding_params.fetch('contributor', []).any? && authorize_person_assertions\n DataManagementPlan.contributors_from_json(\n provenance: current_client[:name],\n dmp: dmp,\n json: funding_params\n )\n end\n\n if dmp.save && @funding.project.save && @funding.save\n head :no_content, location: landing_page_url(id: dmp.dois.first&.value)\n\n else\n project_errs = @funding.project.errors.collect { |e, m| { \"#{e}\": m } } || []\n funding_errs = @funding.errors.collect { |e, m| { \"#{e}\": m } } || []\n errs = (project_errs + funding_errs).join(', ')\n Rails.logger.warn \"Error saving Project + Funding during api/v0/fundings#update: #{errs}\"\n render_error errors: \"Unable to assert your Funding: #{errs}\", status: :unprocessable_entity\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n else\n render_error errors: 'Unauthorized', status: :unauthorized\n end\n end",
"def update\n respond_to do |format|\n if @daily_data_payment.update(daily_data_payment_params)\n format.html { redirect_to @daily_data_payment, notice: 'Daily data payment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @daily_data_payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fund = Fund.friendly.find(params[:id])\n\n authorize! :manage, @fund\n if @fund.update(fund_params)\n head :no_content\n else\n render_validation_errors @fund.errors\n end\n end",
"def update\n respond_to do |format|\n if @tenant_fee.update(tenant_fee_params)\n format.html { redirect_to @tenant_fee, notice: 'Tenant fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @tenant_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n record = TaxRule.find(params[:id])\n record.update_attributes(params[:record])\n \n respond_to do |format|\n format.html\n format.json {\n render json: {}\n }\n end\n end",
"def update\n @title = t('view.trust_funds.edit_title')\n @trust_fund = TrustFund.find(params[:id])\n\n respond_to do |format|\n if @trust_fund.update_attributes(params[:trust_fund])\n format.html { redirect_to @trust_fund, notice: t('view.trust_funds.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trust_fund.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_trust_fund_url(@trust_fund), alert: t('view.trust_funds.stale_object_error')\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 @donation.update(donation_params)\n format.html { redirect_to api_v1_donation_url @donation, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: api_v1_donation_url(@donation) }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n budgets = update_budgets(params[:budgets])\n\n render json: budgets, status: :ok\n end",
"def update\n respond_to do |format|\n if @classification_fund.update(classification_fund_params)\n format.html { redirect_to @classification_fund, notice: 'Classification fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @classification_fund }\n else\n format.html { render :edit }\n format.json { render json: @classification_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pay_fee.update(pay_fee_params)\n format.html { redirect_to @pay_fee, notice: 'Pay fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_fee }\n else\n format.html { render :edit }\n format.json { render json: @pay_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fundraiser = Fundraiser.find(params[:id])\n\n respond_to do |format|\n if @fundraiser.update_attributes(params[:fundraiser])\n format.html { redirect_to @fundraiser, notice: 'Fundraiser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundraiser.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@klass_fee = KlassFee.find(params[:id])\n\n respond_to do |format|\n if @klass_fee.update_attributes(params[:klass_fee])\n format.html { redirect_to klass_klass_fees_path(@klass), notice: 'Klass fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klass_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'Budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @donation_purpose = DonationPurpose.find(params[:id])\n\n respond_to do |format|\n if @donation_purpose.update_attributes(params[:donation_purpose])\n format.html { redirect_to @donation_purpose, notice: 'Donation purpose was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @donation_purpose.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n if @donation.update_attributes(params[:donation])\n format.html { redirect_to donations_path, notice: 'Donation was successfully updated.' }\n #format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n #format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fund_request.update_attributes(params[:fund_request])\n flash[:notice] = 'Fund request was successfully updated.'\n format.html { redirect_to @fund_request }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fund_request.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 @donation = Donation.find(params[:id])\n\n respond_to do |format|\n if @donation.update_attributes(params[:donation])\n format.html { redirect_to @donation, :notice => 'Donation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @donation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @monthly_finance = MonthlyFinance.find(params[:id])\n respond_to do |format|\n if @monthly_finance.update_attributes(params[:monthly_finance])\n format.html { redirect_to @monthly_finance, notice: 'Monthly finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @monthly_finance.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 respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def update\n [:amount, :refund_amount].each do |a|\n next unless params[:payment].has_key?(a)\n params[:payment][a].gsub!(/[$,]/, \"\")\n params[:payment][a] = (params[:payment][a].to_f * 100).to_i\n end\n\n respond_to do |format|\n if @payment.update(payment_params)\n format.html { redirect_to :payments, notice: \"Payment was successfully updated.\" }\n format.json { render :show, status: :ok, location: @payment }\n else\n @editable = true\n format.html { render :show }\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fixed_deposit = FixedDeposit.find(params[:id])\n\n respond_to do |format|\n if @fixed_deposit.update_attributes(params[:fixed_deposit])\n flash[:notice] = 'FixedDeposit was successfully updated.'\n format.html { redirect_to(@fixed_deposit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fixed_deposit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order.status == \"preparing\"\n format.json { render text: '', status: 409 }\n else\n if @order.update(order_params)\n @drink = Drink.where(drink: @order.drink).first\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n response_json = {drink: @drink.drink, cost: @drink.cost, additions: @order.additions, _links: { next: {profile: \"http://#{my_address}:3000/payment\", href: \"http://#{my_address}:3000/payments/order/#{@order.id}\", enctype: 'application/json'}}}\n format.json { render text: response_json, status: :created, location: @order }\n \n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\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\n @expense = Expense.find params.fetch(:id)\n\n if @expense.update(expense_params)\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n respond_to do |format|\r\n if @fixed_deposit_investment.update(fixed_deposit_investment_params)\r\n format.html { redirect_to @fixed_deposit_investment, notice: 'Fixed deposit investment was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @fixed_deposit_investment }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @fixed_deposit_investment.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @api_v1_expense.update(api_v1_expense_params)\n format.html { redirect_to @api_v1_expense, notice: 'Expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_expense }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @donation = Donation.find(params[:id])\n\n respond_to do |format|\n if @donation.update_attributes(params[:donation])\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n\n respond_to do |format|\n if @arrest_record_and_conduct.update_attributes(params[:arrest_record_and_conduct])\n format.html { redirect_to @arrest_record_and_conduct.personal_detail, notice: 'Arrest record and conduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrest_record_and_conduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_for_order.update(budget_for_order_params)\n format.html { redirect_to @budget_for_order, notice: 'Budget for order was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_for_order }\n else\n format.html { render :edit }\n format.json { render json: @budget_for_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @company_financial = CompanyFinancial.find(params[:id])\n\n respond_to do |format|\n if @company_financial.update_attributes(params[:company_financial])\n format.html { redirect_to @company_financial, notice: 'Company financial was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @company_financial.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 if @fund.update(fund_params)\n redirect_to about_path, notice: 'Fund was successfully updated.'\n else\n render action: 'edit'\n end\n end",
"def update\n @membership_fee = MembershipFee.find(params[:id])\n\n respond_to do |format|\n if @membership_fee.update_attributes(params[:membership_fee])\n format.html { redirect_to @membership_fee, notice: 'Membership fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @membership_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @financial.update(financial_params)\n format.html { redirect_to @financial, notice: 'Financial was successfully updated.' }\n format.json { render :show, status: :ok, location: @financial }\n else\n format.html { render :edit }\n format.json { render json: @financial.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dailybank.update(dailybank_params)\n run_calc_rules(@dailybank)\n Cashfloat.count_cash(Cashfloat.where(:dailybank_id => @dailybank.id, :period =>\"Evening\").first)\n if dailybank_params[:status]==\"Mgmt re-calc\"\n format.html { redirect_to mgmt_review_dailybank_path(@dailybank)}\n else\n format.html { redirect_to edit_dailybank_path(@dailybank)}\n format.json { render :show, status: :ok, location: @dailybank }\n end\n else\n format.html { render :edit }\n format.json { render json: @dailybank.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @claim_datum.update(claim_datum_params)\n format.html { redirect_to @claim_datum, notice: 'Claim datum was successfully updated.' }\n format.json { render :show, status: :ok, location: @claim_datum }\n else\n format.html { render :edit }\n format.json { render json: @claim_datum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @much_withdraw.update(much_withdraw_params)\n format.html { redirect_to \"/\", notice: 'much withdraw so success' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @much_withdraw.errors, status: :unprocessable_entity }\n end\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 respond_to do |format|\n if @budget.update(budget_params)\n format.html { redirect_to @budget, notice: 'El presupuesto se actualizó correctamente' }\n format.json { render :show, status: :ok, location: @budget }\n else\n format.html { render :edit }\n format.json { render json: @budget.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 @benefit.update(benefit_params)\n @benefits = Benefit.where(person:@benefit.person)\n format.js\n else\n format.html {render :edit }\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to root_url, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: @donation }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:period])\n format.html { redirect_to @bill, notice: t('activerecord.attributes.bill.successfully') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_lead = FinanceLead.find(params[:id])\n\n respond_to do |format|\n if @finance_lead.update_attributes(params[:finance_lead])\n format.html { redirect_to @finance_lead, notice: 'Finance lead was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance_lead.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @warranty.update(warranty_params)\n format.html { redirect_to @warranty, notice: 'Warranty was successfully updated.' }\n format.json { respond_with_bip(@warranty) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@warranty) }\n end\n end\n end",
"def update\n @financial_statement = FinancialStatement.find(params[:id])\n\n respond_to do |format|\n if @financial_statement.update_attributes(params[:financial_statement])\n format.html { redirect_to @financial_statement, notice: 'Financial statement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financial_statement.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @drive_fixed = DriveFixed.find(params[:id])\n if params[:sem_data_final]\n @drive_fixed.date_limit = nil\n end\n respond_to do |format|\n if @drive_fixed.update_attributes(params[:drive_fixed])\n flash[:notice] = 'DriveFixed was successfully updated.'\n format.html { redirect_to(@drive_fixed) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @drive_fixed.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @line = Line.find(params[:id])\n @budget = @line.budget\n\n respond_to do |format|\n if @line.update_attributes(params[:line])\n format.html { redirect_to budget_path(@budget), notice: 'Line was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @line.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @withdrawal_request = WithdrawalRequest.find(params[:id])\n\n respond_to do |format|\n if @withdrawal_request.update_attributes(params[:withdrawal_request])\n format.html { redirect_to @withdrawal_request, notice: 'Withdrawal request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @withdrawal_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance_document = FinanceDocument.find(params[:id])\n\n if @finance_document.update(finance_document_params)\n audit(@finance_document, current_user)\n head :no_content\n else\n render json: @finance_document.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @rec_expense.update(rec_expense_params)\n format.html { redirect_to @rec_expense, notice: 'Rec expense was successfully updated.' }\n format.json { render :show, status: :ok, location: @rec_expense }\n else\n format.html { render :edit }\n format.json { render json: @rec_expense.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fee_cutting_record = FeeCuttingRecord.find(params[:id])\n\n respond_to do |format|\n if @fee_cutting_record.update_attributes(params[:fee_cutting_record])\n format.html { redirect_to(@fee_cutting_record) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\", message: \"成功更新扣款!\"}'}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @fee_cutting_record.errors, :status => :unprocessable_entity }\n format.json { render :text => \"{status: 'failed', error:#{@fee_cutting_record.errors.full_messages.to_json}}\"}\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: @donation }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: @donation }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: @donation }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @donation.update(donation_params)\n format.html { redirect_to @donation, notice: 'Donation was successfully updated.' }\n format.json { render :show, status: :ok, location: @donation }\n else\n format.html { render :edit }\n format.json { render json: @donation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @budget_approver.update(budget_approver_params)\n format.html { redirect_to @budget_approver, notice: 'Budget approver page was successfully updated.' }\n format.json { render :show, status: :ok, location: @budget_approver }\n else\n format.html { render :edit }\n format.json { render json: @budget_approver.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @component_fund.update(component_fund_params)\n format.html { redirect_to @component_fund, notice: 'Component fund was successfully updated.' }\n format.json { render :show, status: :ok, location: @component_fund }\n else\n format.html { render :edit }\n format.json { render json: @component_fund.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @proof_cost = ProofCost.find(params[:id])\n\n respond_to do |format|\n if @proof_cost.update_attributes(params[:proof_cost])\n format.html { redirect_to @proof_cost, notice: 'Proof cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proof_cost.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 @invoice = Invoice.find(params[:id])\n @invoice.year = Date.today.year\n\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n\n\n respond_to do |format|\n if @invoice.update_attributes(params[:invoice])\n format.html { redirect_to @invoice, notice: 'Invoice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @budget = Budget.find(params[:id])\n @budget1 = @budget\n respond_to do |format|\n if @budget.update(budget_params)\n BudgetMailer.budget_email(@budget1).deliver_now\n format.html { redirect_to reservation_requests_path, notice: 'Presupuesto modificado exitosamente.' }\n else\n @my_reservation_requests = ReservationRequest.find(budget_params[:reservation_request_id])\n @my_budget = Budget.find(params[:id])\n @services_details=@my_budget.budget_service_details\n @budget.budget_service_details.build\n @budget.budget_room_details.build\n format.html { render :edit }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fixed_cost.update(fixed_cost_params)\n format.html { redirect_to @fixed_cost, notice: 'Fixed cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @fixed_cost }\n else\n format.html { render :edit }\n format.json { render json: @fixed_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @donor = Donor.find(params[:id])\n\n respond_to do |format|\n if @donor.update_attributes(params[:donor])\n format.html { redirect_to @donor, notice: 'Donor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @donor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @personal_finance.update(personal_finance_params)\n format.html { redirect_to @personal_finance, notice: 'Personal finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @personal_finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @therapy_budget.update(therapy_budget_params)\n format.html { redirect_to @therapy_budget, notice: 'Therapy budget was successfully updated.' }\n format.json { render :show, status: :ok, location: @therapy_budget }\n else\n format.html { render :edit }\n format.json { render json: @therapy_budget.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @withdrawal = Withdrawal.find(params[:id])\n\n respond_to do |format|\n if @withdrawal.update_attributes(params[:withdrawal])\n format.html { redirect_to action: :index, notice: 'Withdrawal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @withdrawal.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @finance = Finance.find(params[:id])\n\n respond_to do |format|\n if @finance.update_attributes(params[:finance])\n format.html { redirect_to @finance, notice: 'Finance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @finance.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @individual_company_investment.update(individual_company_investment_params)\n format.html { redirect_to @individual_company_investment, notice: 'Individual company investment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @individual_company_investment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def donation_record_actual_fund_params\n params.require(:donation_record_actual_fund)\n .permit( :fund_type_id, :serialnum, fund_attributes: [:amount, :time, :comment], proof_attributes: [:file] )\n end",
"def update\n respond_to do |format|\n if @journal_debit.update(journal_debit_params) &&\n @journal_debit.journal_credit.update(journal_credit_params)\n format.html { redirect_to @journal_debit, notice: 'Journal debit was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @journal_debit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @banking_detail = BankingDetail.find(params[:id])\n\n respond_to do |format|\n if @banking_detail.update_attributes(params[:banking_detail])\n format.html { redirect_to @banking_detail, notice: 'Banking detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @banking_detail.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.7077915",
"0.6724212",
"0.66699964",
"0.6653356",
"0.6619549",
"0.6597654",
"0.6597654",
"0.6472627",
"0.6453055",
"0.6384767",
"0.6382418",
"0.6380618",
"0.6364759",
"0.63643014",
"0.63605064",
"0.6359064",
"0.6346527",
"0.6346527",
"0.634648",
"0.6337091",
"0.63262707",
"0.6280137",
"0.62770236",
"0.62216496",
"0.62113315",
"0.6206171",
"0.6202083",
"0.61997426",
"0.6192423",
"0.6159847",
"0.6157977",
"0.614879",
"0.6140043",
"0.6138854",
"0.6133165",
"0.6132919",
"0.61258155",
"0.61258155",
"0.61092085",
"0.61002374",
"0.6099541",
"0.6098608",
"0.6097216",
"0.6089323",
"0.6089101",
"0.6080147",
"0.6079685",
"0.6074911",
"0.6073309",
"0.6052863",
"0.6052863",
"0.6049274",
"0.6047758",
"0.60472786",
"0.6045393",
"0.60396206",
"0.603071",
"0.6024496",
"0.60162115",
"0.601507",
"0.6013077",
"0.6009302",
"0.60075563",
"0.6005095",
"0.5991246",
"0.59823203",
"0.59817815",
"0.597825",
"0.5975679",
"0.5975629",
"0.5966818",
"0.59641176",
"0.5962198",
"0.59597903",
"0.5953708",
"0.59529865",
"0.59522104",
"0.5934009",
"0.5928205",
"0.59227103",
"0.59212154",
"0.59212154",
"0.59212154",
"0.59212154",
"0.5920608",
"0.5920157",
"0.59198916",
"0.59184045",
"0.5911991",
"0.591176",
"0.5909051",
"0.59016746",
"0.5899925",
"0.589763",
"0.5896729",
"0.58925235",
"0.5887723",
"0.58864754",
"0.58850193",
"0.5880445"
] |
0.74511325
|
0
|
DELETE /donation_record/actual_funds/1 DELETE /donation_record/actual_funds/1.json
|
def destroy
@donation_record_actual_fund.destroy
respond_to do |format|
format.html { redirect_to @donation_record}
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @financial_donation = FinancialDonation.find(params[:id])\n @financial_donation.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n\n head :no_content\n end",
"def destroy\n @admin_fund = Fund.find(params[:id])\n @admin_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_funds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @daily_data_payment.destroy\n respond_to do |format|\n format.html { redirect_to daily_data_payments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trust_fund = TrustFund.find(params[:id])\n @trust_fund.destroy\n\n respond_to do |format|\n format.html { redirect_to trust_funds_url }\n format.json { head :ok }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @person_expense_record.destroy\n\n head :no_content\n end",
"def destroy\n @fund_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to fund_company_investments_url }\n format.json { head :no_content }\n end\n end",
"def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end",
"def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donate.destroy\n\n respond_to do |format|\n format.html { redirect_to(donates_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investment_fund.destroy\n respond_to do |format|\n format.html { redirect_to wallets_path, notice: 'Investment fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fund.destroy\n respond_to do |format|\n format.html { redirect_to funds_url, notice: 'Fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundation = Fundation.find(params[:id])\n @fundation.destroy\n resp ={\"resp\" => \"ok\"}\n\n respond_to do |format|\n format.html { redirect_to(fundations_url) }\n format.xml { head :ok }\n format.json {render :json=>resp}\n end\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial = Financial.find(params[:id])\n @financial.destroy\n\n respond_to do |format|\n format.html { redirect_to financials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_donations_url, notice: 'Donation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget = Budget.find(params[:id])\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\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 # @donation_purpose = DonationPurpose.find(params[:id])\n @donation_purpose.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_purposes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @record_financial.destroy\n respond_to do |format|\n format.html { redirect_to record_financials_url, notice: 'Record financial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @unpaid_debt = UnpaidDebt.find(params[:id])\n @unpaid_debt.destroy\n\n respond_to do |format|\n format.html { redirect_to unpaid_debts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation = Donation.find(params[:id])\n @donation.destroy\n\n respond_to do |format|\n format.html { redirect_to donations_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 @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n @arrest_record_and_conduct.destroy\n\n respond_to do |format|\n format.html { redirect_to @arrest_record_and_conduct.personal_detail }\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 @banking_detail = BankingDetail.find(params[:id])\n @banking_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to banking_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n record = TaxRule.find(params[:id])\n record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @financial_statement = FinancialStatement.find(params[:id])\n @financial_statement.destroy\n\n respond_to do |format|\n format.html { redirect_to financial_statements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation = Donation.find(params[:id])\n @donation.destroy\n\n respond_to do |format|\n format.html { redirect_to donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @mutual_fund.destroy\r\n respond_to do |format|\r\n format.html { redirect_to mutual_funds_url, notice: 'Mutual fund was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @therapy_budget.destroy\n respond_to do |format|\n format.html { redirect_to therapy_budgets_url, notice: 'Therapy budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @line = Line.find(params[:id])\n @line.destroy\n\n respond_to do |format|\n format.html { redirect_to budget_path(@line.budget) }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@klass_fee = KlassFee.find(params[:id])\n #@klass_fee.destroy\n\n respond_to do |format|\n format.html { redirect_to klass_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation_line = DonationLine.find(params[:id])\n @donation_line.destroy\n\n respond_to do |format|\n format.html { redirect_to donation_lines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to account_statement_url(params[:account_id],params[:statement_id]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation.destroy\n respond_to do |format|\n format.html { redirect_to donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay_record.destroy\n respond_to do |format|\n format.html { redirect_to pay_records_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cb_fund.destroy\n respond_to do |format|\n format.html { redirect_to cb_funds_url, notice: 'Cb fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @funding_requirement.destroy\n respond_to do |format|\n format.html { redirect_to funding_requirements_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\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 @withdrawal_request = WithdrawalRequest.find(params[:id])\n @withdrawal_request.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawal_requests_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 @dailybank.destroy\n respond_to do |format|\n format.html { redirect_to dailybanks_url, notice: 'Dailybank was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @investment_fund.destroy\n respond_to do |format|\n format.html { redirect_to products_path, notice: 'Investment fund was successfully destroyed.' }\n format.json { head :no_content }\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 @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: 'Budget was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reconciliation_detail = AccountingReconciliationDetail.find(params[:id])\n @reconciliation_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_reconciliation_details_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tax_rate = TaxRate.find(params[:id])\n @tax_rate.destroy\n\n respond_to do |format|\n format.html { redirect_to tax_rates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trx_detail = TrxDetail.find(params[:id])\n @trx_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to trx_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rec_expense.destroy\n respond_to do |format|\n format.html { redirect_to rec_expenses_url, notice: 'Rec expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank_detail.destroy\n respond_to do |format|\n format.html { redirect_to bank_details_url, notice: 'Bank detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n #binding.pry\n @balance = Balance.find(params[:id])\n @balance.destroy\n respond_to do |format|\n format.html { redirect_to balances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget.destroy\n respond_to do |format|\n format.html { redirect_to budgets_url, notice: \"Budget was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @fixed_deposit_investment.destroy\r\n respond_to do |format|\r\n format.html { redirect_to fixed_deposit_investments_url, notice: 'Fixed deposit investment was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @donation.destroy\n respond_to do |format|\n format.html { redirect_to root_url, notice: 'Donation 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 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 @donation.destroy\n respond_to do |format|\n format.html { redirect_to event_donations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @journal_debit.destroy\n respond_to do |format|\n format.html { redirect_to journal_debits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_line.destroy\n respond_to do |format|\n format.html { redirect_to budget_lines_url, notice: 'Budget line was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @commission_fixing = CommissionFixing.find(params[:id])\n if @commission_fixing.destroy\n render :json=>{:response=>\"success\"}\n else\n render :json=>failure1(:record=>\"Record not found\")\n end \n end",
"def destroy\n @api_v1_expense.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_expenses_url, notice: 'Expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee_cutting_record = FeeCuttingRecord.find(params[:id])\n @fee_cutting_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(fee_cutting_records_url) }\n format.xml { head :ok }\n format.json { render :text => '{status: \"success\"}'}\n end\n end",
"def destroy\n @withdrawal = Withdrawal.find(params[:id])\n @withdrawal.destroy\n\n respond_to do |format|\n format.html { redirect_to withdrawals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pay_fee.destroy\n respond_to do |format|\n format.html { redirect_to pay_fees_url, notice: 'Pay fee was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @donation.destroy\n respond_to do |format|\n format.html { redirect_to donations_url, notice: 'Donation was successfully removed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @service_dependance = ServiceDependance.find(params[:id])\n @service_dependance.destroy\n\n respond_to do |format|\n format.html { redirect_to service_dependances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bankdeposit.destroy\n respond_to do |format|\n format.html { redirect_to bankdeposits_url, notice: 'Bankdeposit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixed_deposit = FixedDeposit.find(params[:id])\n @fixed_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(fixed_deposits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\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 @record_expense.destroy\n respond_to do |format|\n format.html { redirect_to record_expenses_url, notice: 'Record expense was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @budget_request.destroy\n respond_to do |format|\n format.html { redirect_to budget_requests_url, notice: 'Budget request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bank_reconciliations = AccountingBankReconciliations.find(params[:id])\n @bank_reconciliations.destroy\n\n respond_to do |format|\n format.html { redirect_to(accounting_bank_reconciliations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @company_financial = CompanyFinancial.find(params[:id])\n @company_financial.destroy\n\n respond_to do |format|\n format.html { redirect_to company_financials_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @financial.destroy\n respond_to do |format|\n format.html { redirect_to financials_url, notice: 'Financial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n respond_with @expense.destroy, status: 204\n end",
"def destroy\n @bank = Bank.find(params[:id])\n @bank.destroy\n\n respond_to do |format|\n format.html { redirect_to banks_url, notice: t('view.banks.correctly_deleted') }\n format.json { head :ok }\n end\n end",
"def destroy\n @invoice_tax = InvoiceTax.find(params[:id])\n @invoice_tax.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_taxes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @electricity_bill.destroy\n respond_to do |format|\n format.html { redirect_to electricity_bills_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 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 @estimate = Estimate.find(params[:id])\n @estimate.destroy\n\n respond_to do |format|\n format.html { redirect_to estimates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @personal_finance.destroy\n respond_to do |format|\n format.html { redirect_to personal_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to expenses_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @individual_company_investment.destroy\n respond_to do |format|\n format.html { redirect_to individual_company_investments_url }\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 @classification_fund.destroy\n respond_to do |format|\n format.html { redirect_to classification_funds_url, notice: 'Classification fund was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @benefit = Benefit.find(params[:id])\n @benefit.destroy\n\n respond_to do |format|\n format.html { redirect_to(benefits_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @financial_statement.destroy\n respond_to do |format|\n format.html { redirect_to financial_statements_url, notice: 'Financial statement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fixed_cost.destroy\n respond_to do |format|\n format.html { redirect_to fixed_costs_url, notice: 'Fixed cost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fee_record = FeeRecord.find(params[:id])\n @fee_record.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_fee_records_url) }\n format.xml { head :ok }\n end\n end"
] |
[
"0.71260846",
"0.69668245",
"0.692731",
"0.6921285",
"0.6893681",
"0.68904257",
"0.6762004",
"0.6749507",
"0.6740935",
"0.6737535",
"0.6737535",
"0.6731841",
"0.6730209",
"0.6730209",
"0.6719878",
"0.6699781",
"0.66980433",
"0.6689116",
"0.6689069",
"0.668449",
"0.6666043",
"0.66527724",
"0.66269445",
"0.6618363",
"0.66150016",
"0.6613923",
"0.6610192",
"0.6601989",
"0.6601411",
"0.66012317",
"0.6590201",
"0.65838355",
"0.6579552",
"0.6576674",
"0.6575497",
"0.65751153",
"0.65743834",
"0.65685874",
"0.65684116",
"0.6561532",
"0.6559687",
"0.6558767",
"0.6557746",
"0.6551131",
"0.6547611",
"0.6545289",
"0.65408105",
"0.6538716",
"0.653776",
"0.6535708",
"0.6535708",
"0.6535708",
"0.6535182",
"0.6530725",
"0.65305203",
"0.65289354",
"0.6528632",
"0.6525907",
"0.652472",
"0.65241903",
"0.6518592",
"0.65179",
"0.65173906",
"0.6514853",
"0.65113175",
"0.65027606",
"0.64976746",
"0.648994",
"0.6489854",
"0.6481103",
"0.6476579",
"0.647468",
"0.6473342",
"0.64701587",
"0.64509135",
"0.6445061",
"0.64430475",
"0.64393985",
"0.64323145",
"0.6431193",
"0.64279836",
"0.64252865",
"0.64249676",
"0.6422991",
"0.6421817",
"0.64177316",
"0.64144075",
"0.6412466",
"0.6412466",
"0.6407345",
"0.64053357",
"0.6404941",
"0.6404538",
"0.64031875",
"0.64018583",
"0.6401192",
"0.640079",
"0.6396877",
"0.63966364",
"0.63955146"
] |
0.77491415
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_donation_record_actual_fund
@donation_record_actual_fund = (id=params[:id]) ? DonationRecord::ActualFund.find(id) : DonationRecord::ActualFund.new
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 donation_record_actual_fund_params
params.require(:donation_record_actual_fund)
.permit( :fund_type_id, :serialnum, fund_attributes: [:amount, :time, :comment], proof_attributes: [:file] )
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
|
name of context if ip in map, else nil
|
def lookup_device(ip)
@map[ip]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ptr(ip)\n # use cache if ip was already resolved\n return @cache[ip] if @cache[ip]\n\n begin\n name = @hypedns.getname(ip).to_s\n @cache[ip] = name\n return name\n rescue Resolv::ResolvError, SocketError\n return nil\n end\n end",
"def context_key(appt)\n \"#{appt.facility_id}/#{appt.clinic_id}\"\n end",
"def lookup(context, name)\n\t\t\tlookup = context\n\t\t\tname.split(\".\").each { |value| lookup = lookup[value] }\n\t\t\tlookup\n\t\tend",
"def readable_context_name\r\n self.name\r\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end",
"def name\n ip_address\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def lookup(context, name)\n lookup = context\n name.split(\".\").each { |value| lookup = lookup[value] }\n lookup\n end",
"def name\n return @map_infos[@map_id].name\n end",
"def location_name\n location ? location.common_name : nil\n end",
"def lookup_context; end",
"def lookup_context; end",
"def lookup_context; end",
"def name\n ip_address\n end",
"def pool_name()\n #This is a stub, used for indexing\n end",
"def resource_level\n CONTEXT_LEVELS.each do |k,v|\n if v[:inst] != institution_id.nil? &&\n v[:req_temp] != requirements_template_id.nil? &&\n v[:req] != requirement_id.nil? &&\n v[:res] != resource_id.nil?\n return v[:name]\n end\n end\n return \" \"\n end",
"def ipsource\n lanconfig[\"ip address source\"].downcase!\n end",
"def context_name_for(method); end",
"def lookup_context=(_arg0); end",
"def short_name\n @context.name\n end",
"def computed_name(context)\n @_name ||= case @name\n when String\n @name\n when Symbol\n context.public_send(@name) # todo\n when Proc\n context.instance_exec(&@name)\n when nil\n computed_path(context)\n else\n raise ArgumentError,\n \"Expected one of String, Symbol, or Proc, \" \\\n \"got #{@name.class}\"\n end\n end",
"def map_name; end",
"def info(ip:, key:)\n record = reader.get(ip)\n return unless record\n\n case key.to_sym\n when :country\n return record['country']['names'][lang] if record['country']\n when :continent\n return record['continent']['names'][lang] if record['continent']\n end\n end",
"def label context = nil\n label = aref\n\n label = [context.aref, label].compact.join '-' if\n context and context.respond_to? :aref\n\n label\n end",
"def context_pin; end",
"def domain_name_label\n label = nil\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n if ip_config['public_ipaddress']['attached']\n label = ip_config['public_ipaddress']['domain_name_label']\n end\n end\n end\n\n label\n end",
"def context_id\n params[\"#{ params[:constraint][:context_type].singularize }_id\"]\n end",
"def themed_host_name\n map2tags.compact.join('-')\n end",
"def on_call_local_name(context, expression = nil)\n node = function_node(context, expression)\n\n return node.respond_to?(:name) ? node.name : ''\n end",
"def parent_context\n parse\n return @names.last(@names.length-1).join('.') if !@names.empty?\n nil\n end",
"def member_get_ip(pool_member)\n server_ip = begin\n if pool_member.attribute?('cloud')\n if node.attribute?('cloud') && (pool_member['cloud']['provider'] == node['cloud']['provider'])\n pool_member['cloud']['local_ipv4']\n else\n pool_member['cloud']['public_ipv4']\n end\n else\n pool_member['ipaddress']\n end\n end\n server_ip\nend",
"def ip_or_hostname\n super\n end",
"def location_name\n pos = @state[\"position\"]\n pos ? pos.split(\"#\",2)[0] : nil\n end",
"def map_name; $game_temp.map_names[@map_id]; end",
"def current_city\n if @city \n @city.name\n elsif @institute\n @institute.name\n else #failsafe\n end\n end",
"def to_s\n\t\treturn \"Anonymous context\" if @name == nil\n\t\t\n\t\treturn \"#{@name} context\" \n\tend",
"def hostname\n Resolv.getname(ip_address) rescue nil\n end",
"def zone_name\n l = location\n l ? l.zone_name : state[\"zone\"]\n end",
"def dot_name_for(node_name)\n @topographer.node_cluster?(node_name) ? \"cluster_#{node_name}\" : node_name\n end",
"def default_lookup(req, *args)\n req.address\n end",
"def zone_identifier; end",
"def zone_identifier; end",
"def map_name(id)\n (load_data(\"Data/MapInfos.rvdata2\").find { |map| map[1].parent_id = id })[1].name\n end",
"def get_map_name(id=\"map\")\n return \"lh_#{id}\"\n end",
"def ip\n nil\n end",
"def context_type\n self.class.name.to_s\n end",
"def local_name; connection_space.name end",
"def localinfo\n if (pi = getlocalname)\n return pi[1] + ':' + pi[2].to_s\n end\n end",
"def ip_address_id(env)\n ip_address_record(env)[:id]\n end",
"def request_context\n @requester ? @requester.request : \"(unknown)\"\n end",
"def this_host_name\n if is_zz?\n return zz[:local_hostname]\n end\n\n return @this_host_name if @this_host_name != nil\n\n instances = ey['environment']['instances']\n # assume localhost if can't find\n @this_host_name = 'localhost'\n\n this_id = this_instance_id\n instances.each do |instance|\n if instance['id'] == this_id\n @this_host_name = instance['private_hostname']\n break\n end\n end\n @this_host_name\n end",
"def ipaddr?; end",
"def current_tab_if(route)\n flag = \"\"\n if route.respond_to? :each\n for x in route\n flag = \"current\" if request.path_info == x\n end\n else\n flag = \"current\" if request.path_info == route\n end\n flag\n end",
"def reverse_name_lookup(ip, type = :A)\n # look for all the zones\n type = type.to_sym if type.class != Symbol\n dns_name = String.new\n @dns.domains.each do |zone|\n @dns.domains.get(zone.id).records.each do | record |\n if record.data == ip and record.type.to_sym == type\n dns_name = record.name\n break\n end\n end\n end\n return dns_name\n end",
"def identify( request_env )\n return request_env['HTTP_X_FORWARDED_FOR'] || request_env['REMOTE_ADDR'], request_env['HTTP_USER_AGENT']\n end",
"def name\n return service_name if info.nil?\n info[:name]\n end",
"def current_address(tag,of_type = 'billing')\n if tag.locals.send(of_type).present?\n return tag.locals.send(of_type)\n end\n \n if tag.locals.shop_order.present?\n begin\n # Get the address type (order.billing)\n address = tag.locals.shop_order.send(of_type)\n return address unless address.nil?\n rescue\n nil\n end\n end\n \n if user = Users::Tags::Helpers.current_user(tag)\n begin\n address = user.send(of_type)\n return address unless address.nil?\n rescue\n nil\n end\n end\n \n nil\n end",
"def location_name(id)\n @acpl_cache.fetch(id) { |id| fetch_new_acpl(id) || id }\n end",
"def user_ip\n \trequest.location\n end",
"def is_context?(context_name)\n @type == context_name\n end",
"def dispatch_id\n local_ip + '/' + Process.pid.to_s\n end",
"def sourcename\n site ? site.name : \"Entity #{self.class.to_s} ##{id} has no site\"\n end",
"def ipaddr; end",
"def extract_context_names(options)\n context_names = [\n options.delete(:context),\n options.delete(:group),\n options.delete(:when),\n options.delete(:on)\n ].compact.first\n\n Array(context_names || :default)\n end",
"def lookup_ip_location\n if Rails.env.development? || Rails.env.test?\n Geocoder.search(request.remote_ip).first\n else\n request.location\n end\n end",
"def true_address\r\n addr = servlet_response.getLocalName\r\n $log.debug(\"True address/hostname is #{addr}\")\r\n addr\r\n end",
"def current_sign_in_ip; end",
"def current_sign_in_ip; end",
"def lookup_value(key, context=nil)\n [named_context[context] || {}, global].map {|c| c[key]}.compact.first\n end",
"def locate_by_ip\n request.location\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def location_name\n LOCATIONS[location.to_s]\n end",
"def name\n return @name unless @name.nil?\n \"#{@name_prefix}host:#{Socket.gethostname} pid:#{Process.pid}\" rescue \"#{@name_prefix}pid:#{Process.pid}\"\n end",
"def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err _(\"Could not resolve %{ip}: %{detail}\") % { ip: result[:ip], detail: detail }\n end\n result[:ip]\n end",
"def name_unless_default\n name == Rack::OAuth.default_instance_name ? nil : name\n end",
"def determine_site\n @current_site.nil? ? nil : @current_site.name\n end",
"def display_name\n @_context[:display_name]\n end",
"def address_container(ident)\n nil\n end",
"def current_workplace\n if @workplace && current_admin\n @workplace.name\n else#fail safe\n end \n end",
"def get_node_name(node_city)\n @nodes[node_city].name\n end",
"def zone_name\n compliance_data[:name]\n end",
"def context\n @context ||= [{'server' => hostname, 'type' => 'exception'}]\n end",
"def current_zone_name\n zone = @master_zone\n return GameData::Zone.get(zone).map_name if zone\n UNKNOWN_ZONE\n end",
"def realname\r\n return for_context(nil, false) { |c| c.realname }\r\n end",
"def do_map_name\r\n self[@symbol] ||\r\n do_target_class_map ||\r\n do_target_object_map ||\r\n do_target_vm_map ||\r\n do_object_class_map ||\r\n do_global_map\r\n end",
"def current_user_name\n logged_in? ? (user_name(current_user_id) || current_user_id) : nil\n end",
"def pickup_location_name(code)\n if Settings.ils.client == 'FolioClient'\n Folio::ServicePoint.name_by_code(code) || code\n else\n Mylibrary::Application.config.library_map[code] || code\n end\n end",
"def extract_key(ctx); end",
"def site_name\r\n site.name rescue nil\r\n end",
"def network_label\n network == \"users\" ? \"\" : network\n end",
"def prefix_path(ip_info=nil)\n # get rid of MockHops or invalid Hops\n @hops.find_all { |hop| hop.is_a?(Hop) }.map { |hop| (ip_info) ? ip_info.getPrefix(hop.ip) : hop.prefix }\n end",
"def hostname\n @options[:host][:name] if @options[:host]\n end",
"def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err \"Could not resolve #{result[:ip]}: #{detail}\"\n end\n result[:ip]\n end",
"def local_ip\n\nend",
"def find_with_context(key, context) \n return @config[context][key] if @config[context][key]\n return @config[:common][key] if @config[:common][key]\n return nil\n end",
"def id\n self[:ip_id]\n end"
] |
[
"0.59307575",
"0.5873855",
"0.58264774",
"0.56705517",
"0.5666831",
"0.5653831",
"0.5621642",
"0.561809",
"0.561809",
"0.561809",
"0.55739117",
"0.55609584",
"0.55510074",
"0.55510074",
"0.55510074",
"0.5479952",
"0.5463491",
"0.5452683",
"0.53916043",
"0.53842676",
"0.5381581",
"0.5379703",
"0.5373085",
"0.535762",
"0.53349787",
"0.5324512",
"0.5312622",
"0.5307552",
"0.5306747",
"0.529485",
"0.52237207",
"0.52223885",
"0.5208781",
"0.5206251",
"0.5204915",
"0.51888555",
"0.5187715",
"0.51674205",
"0.51294726",
"0.51193833",
"0.51166844",
"0.51083374",
"0.51081425",
"0.51081425",
"0.5103983",
"0.50951636",
"0.5091628",
"0.50823736",
"0.508018",
"0.50781786",
"0.5069557",
"0.5066884",
"0.5066853",
"0.5060134",
"0.50495917",
"0.5049405",
"0.50493914",
"0.50437987",
"0.50295633",
"0.5025959",
"0.50241596",
"0.5022128",
"0.50173587",
"0.5003234",
"0.49971163",
"0.498784",
"0.49864608",
"0.4986039",
"0.49819955",
"0.49819955",
"0.4975323",
"0.4969306",
"0.4953665",
"0.4953665",
"0.4953665",
"0.4953665",
"0.49510232",
"0.49503288",
"0.4948855",
"0.49459985",
"0.4944877",
"0.49443167",
"0.49417093",
"0.4939973",
"0.49348083",
"0.49337703",
"0.49302977",
"0.49297917",
"0.4923768",
"0.49214676",
"0.49178463",
"0.49169123",
"0.4913616",
"0.49121565",
"0.490944",
"0.49054506",
"0.49033484",
"0.49016038",
"0.49008662",
"0.49007204"
] |
0.5513688
|
15
|
Public: insert Allows a person to insert an object into the "dogs" table. Parameters: No Parameters Returns: id State changes: NA? This method IS working.
|
def insert
DATABASE.execute("INSERT INTO dogs (name, breed, age, serial_num, colour, description, temperament_id, owner_id) VALUES
('#{@name}', '#{@breed}', #{@age}, #{@serial_num}, '#{@colour}', '#{@description}', #{@temperament_id}, #{@owner_id})")
@id = DATABASE.last_insert_row_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_dog(name)\n @db.get_first_value('INSERT INTO dogs VALUES (null, :name)', \n ':name' => name)\n end",
"def save \n if self.id \n self.update\n else\n sql = <<-SQL\n INSERT INTO dogs (name, breed) \n VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.breed)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM dogs\")[0][0]\n\n dog = Dog.new(id:@id, name: self.name, breed: self.breed)\n return dog\n end\n end",
"def save\n sql = <<-SQL\n INSERT INTO dogs (name, breed) VALUES (?, ?)\n SQL\n\n DB[:conn].execute(sql, self.name, self.breed)\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() from dogs\")[0][0]\n end",
"def insert(table, id, attributes) # abstract\n end",
"def insert()\n\n end",
"def save \n if self.id\n self.update\n else\n sql = <<-SQL \n INSERT INTO dogs (name, breed) VALUES (?, ?)\n SQL\n DB[:conn].execute(sql, self.name, self.breed)\n #self.name and self.breed go into the respective question marks above \n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM dogs\")[0][0]\n #what's returned here is an array that contains one array that contains one element––the last inserted row ID\n #At the end of our save method, we use a SQL query to grab the value of the ID column of the last inserted row, and set that equal to the given song instance's id attribute.\n self\n end \n end",
"def insert\n DATABASE.execute(\"INSERT INTO terms (term, definition, phonetic) VALUES \n ('#{@term}', '#{@definition}', '#{@phonetic}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def insert(**opts)\n add(**opts)\n save!\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil) end",
"def save\n # CREATE/UPDATE\n # TODO: CREATE if id is nil / UPDATE if there is id\n if @id.nil?\n # TODO: CREATE\n query = \"INSERT INTO doctors (name, age, specialty) \"\\\n \"VALUES ('#{@name}', #{@age}, '#{@specialty}')\"\n DB.execute(query)\n else\n # TODO: UPDATE\n query = \"UPDATE doctors SET name = '#{@name}', \"\\\n \"age = #{@age}, specialty = '#{@specialty}' \"\\\n \"WHERE id = #{@id}\"\n DB.execute(query)\n end\n self\n end",
"def insert\n\n DBConnection.execute2(<<-SQL, attribute_values)\n INSERT INTO\n #{class_obj.table_name} #{sql_columns}\n VALUES\n #{sql_question_marks}\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert(object, table)\n sql = object.to_sql(table)\n execute(sql)\n end",
"def add_to_database\n if self.can_drink?\n CONNECTION.execute(\"INSERT INTO students (name, age) VALUES ('#{@name}', #{@age});\")\n \n @id = CONNECTION.last_insert_row_id\n else\n false\n end\n end",
"def insert(entity)\n id = Collection.to_mongodb_id(entity.id) unless entity.id.nil?\n id ||= BSON::ObjectId.new\n serialized_entity = _serialize(entity).merge('_id': id)\n insert_one(serialized_entity)\n entity.id = id.to_s\n entity\n end",
"def insert \n \n DATABASE.execute(\"INSERT INTO categories (genre) VALUES ('#{@genre}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def insert \n \n DATABASE.execute(\"INSERT INTO categories (genre) VALUES ('#{@genre}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def insert(object)\n key_name = attributes.key[0].name\n tuple = dump(object)\n tuple.delete(key_name)\n key_value = relation.insert(tuple)\n\n object.public_send(\"#{key_name}=\", key_value)\n\n object\n end",
"def buy_dog(dog_name)\n dog = Dog.new(dog_name)\n self.pets[:dogs] << dog\n end",
"def save()\n sql = \"\n INSERT INTO heroes\n ( name, description )\n VALUES\n ( '#{@name}', '#{@description}' )\n RETURNING *;\n \"\n\n @id = SqlRunner.run( sql )[0]['id'].to_i()\n end",
"def insert(entity)\n @service.insert_entity(self, entity)\n end",
"def insert\n # the array of ::columns of the class joined with commas, drop id\n col_names = self.class.columns[1..-1].join(\", \") \n # an array of question marks\n question_marks = ([\"?\"] * col_names.split.size).join(\", \")\n\n DBConnection.execute(<<-SQL, *attribute_values[1..-1])\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert\n DATABASE.execute(\"INSERT INTO students (name, age, github) VALUES (?, ?, ?)\", @name, @age, @github)\n @id = DATABASE.last_insert_row_id\n end",
"def insert\n col_names = self.class.columns.join(\", \")\n question_marks = ([\"?\"] * self.class.columns.length).join(\", \")\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{self.class.table_name} (#{col_names})\n VALUES\n (#{question_marks})\n SQL\n\n self.id = DBConnection.last_insert_row_id\n end",
"def insert(item)\n\n\n\n\n end",
"def save\n Rails.logger.debug {\"saving #{self}\"}\n\n result=self.class.collection\n .insert_one(_id:@id, city:@city, state:@state, pop:@population)\n @id=result.inserted_id\n end",
"def insert(sql, name = nil, pk = nil, id_value = nil, sequence_name = nil)\n insert_sql(sql, name, pk, id_value, sequence_name)\n end",
"def save \n Rails.logger.debug {\"saving #{self}\"}\n\n result=self.class.collection\n .insert_one(_id:@id, city:@city, state:@state, pop:@population)\n @id=result.inserted_id\n end",
"def insert\n \n attributes = []\n instance_variables.each do |i|\n attributes << i.to_s.delete(\"@\") if (i != :@id && i != :@table)\n end\n \n values = []\n attributes.each do |a|\n value = self.send(a)\n \n if value.is_a?(Integer)\n values << \"#{value}\"\n else values << \"'#{value}'\"\n end\n end\n \n DATABASE.execute(\"INSERT INTO students (#{attributes.join(\", \")}) \n VALUES (#{values.join(\", \")})\")\n @id = DATABASE.last_insert_row_id\n\n end",
"def insert\n DATABASE.execute(\"INSERT INTO locations (city) VALUES ('#{@city}')\")\n @id = DATABASE.last_insert_row_id # will return the value of the row id\n end",
"def new_dog\n system 'clear'\n dog_name = TTY::Prompt.new.ask('Enter the name of your dog')\n\n if dog_exist?(dog_name)\n puts 'That name already exists.'\n sleep(2)\n new_dog\n end\n\n new_dog = Dog.create(name: dog_name)\n dogs << new_dog\n puts \"#{dog_name} has been added to your account.\"\n sleep(2)\n end",
"def insert_obj(obj) # :nodoc:\n chk_conn\n tx = @hibernate_session.begin_transaction\n @hibernate_session.save(obj)\n tx.commit\n obj\n end",
"def create_kitten(db, name, age)\r\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\r\nend",
"def insert\n DATABASE.execute(\"INSERT INTO boards (title,description) VALUES ('#{@title}', '#{@description}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def new_patient(db, name, dob, insurance)\n\t\n\tdb.execute(\"INSERT INTO patient_info (name, dob, insurance) VALUES (?, ?, ?)\", [name, dob, insurance])\n\nend",
"def insert\n DATABASE.execute(\"INSERT INTO locations (location_name) \n VALUES ('#{@location_name}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def create_kitten(db, name, age)\n db.execute(\"INSERT INTO kittens (name, age) VALUES (?, ?)\", [name, age])\nend",
"def insert\n # Preparing for the query...\n cols = self.class.columns\n col_names = cols.map(&:to_s).join(\", \")\n question_marks = ([\"?\"] * cols.count).join(\", \")\n \n # The actual query\n DBConnection.execute(<<-SQL, *attribute_values)\n INSERT INTO\n #{ self.class.table_name } (#{ col_names })\n VALUES\n (#{ question_marks })\n SQL\n \n # Add an id number for the record\n self.id = DBConnection.last_insert_row_id\n end",
"def create\n @dog = Dog::Dog.new(params[:dog_dog])\n\n respond_to do |format|\n if @dog.save\n format.html { redirect_to @dog, notice: 'Dog was successfully created.' }\n format.json { render json: @dog, status: :created, location: @dog }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_insert\n @insert = Insert.find(params[:id])\n end",
"def buy_dog(name)\n dog = Dog.new(name)\n @pets[:dogs] << dog\n end",
"def create_pokemon(db, name, age, location, move)\n db.execute(\"INSERT INTO pokemon (name, age, location, move) VALUES (?, ?, ?, ?)\", [name, age, location, move])\nend",
"def save()\n sql = \"\n INSERT INTO players\n ( name, team )\n VALUES\n ( '#{@name}', '#{@team}' )\n RETURNING *;\n \"\n @id = SqlRunner.run( sql )[0]['id'].to_i()\n end",
"def insert\n \n attributes = []\n instance_variables.each do |i|\n attributes << i.to_s.delete(\"@\") if (i != :@id && i != :@table)\n end\n \n values = []\n attributes.each do |a|\n value = self.send(a)\n \n if value.is_a?(Integer)\n values << \"#{value}\"\n else values << \"'#{value}'\"\n end\n end\n \n DATABASE.execute(\"INSERT INTO slides (#{attributes.join(\", \")}) \n VALUES (#{values.join(\", \")})\")\n @id = DATABASE.last_insert_row_id\n return self\n end",
"def add_to_database\n if self.animal_in_non_retail?\n false\n else\n DB.execute(\"INSERT INTO products (location_id, category_id, name, cost, quantity) VALUES (#{@location_id}, #{@category_id}, '#{@name}', #{@cost}, #{@quantity});\")\n @id = DB.last_insert_row_id\n end\n end",
"def insert(index,object)\n\nend",
"def insert_object g\n @objects.add g\n end",
"def run_insert\n raise DataFactory::NoInsertStatement unless @insert_statement\n\n stmt = db_interface.execute_sql(@insert_statement, *@binds)\n stmt.close\n end",
"def insert(obj)\n obj.og_insert(self)\n end",
"def buy_dog(dog)\n new_dog = Dog.all.find do |dog_instance|\n dog_instance.name == dog \n end\n if new_dog \n Dog.new(new_dog.name, self)\n else \n brand_new_dog = Dog.new(dog, self)\n end \n end",
"def insert\n array = [[@name, @tagline, @github, @twitter, @blog_url, @image_url, @biography]]\n ins = DB[:conn].prepare(\"INSERT INTO students (name, tagline, github, twitter, blog_url, image_url, biography) VALUES (?, ?, ?, ?, ?, ?, ?);\")\n array.each { |s| ins.execute(s)}\n self.id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM students;\")[0][0]\n #ask steven re. index figures\n #inserting data into an instance\n end",
"def buy_dog(dog_name)\n self.dogs << Dog.new(dog_name,self)\n end",
"def create\n @user = User.find(params[:user_id])\n @dog = @user.dogs.new(params[:dog])\n \n if @dog.save\n if @user.dogs.count == 1\n redirect_to parks_path\n else\n redirect_to account_path\n end\n else\n render :action => \"new\"\n end\n end",
"def insert(*args)\n get_repository_object.insert(*args)\n end",
"def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n sql, binds = sql_for_insert(to_sql(arel, binds), pk, id_value, sequence_name, binds)\n value = exec_insert(sql, name, binds)\n id_value\n end",
"def insert(value)\n # YOUR WORK HERE\n end",
"def create\n Student.conn.exec('INSERT INTO students (name, age, spirit_animal, squad_id) values ($1,$2,$3,$4)', [ name, age, spirit_animal, squad_id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def set_dog\n @dog = Dog.find(params[:id])\n end",
"def insert(arel, name = nil, pk = nil, id_value = nil, sequence_name = nil, binds = [])\n exec_insert(to_sql(arel), name, binds)\n retval = last_inserted_id(nil)\n retval = id_value if retval == 0\n return retval\n end",
"def insert(instance, options = {})\n table_class = instance.class\n options = {:duplicate => :fail}.merge(options)\n raise \"Table for object class #{table_class} does not exist\" if @tables[table_class] == nil\n #TODO: Check if method dump is declared in the class\n raise \"Attempt to insert null key\" if instance.key == nil\n \n @semaphore.synchronize do\n if @tables[table_class][instance.key] == nil || options[:duplicate] == :replace\n @db.transaction do\n @db[\"tables\"][table_class][instance.key] = instance.dump\n @tables[table_class][instance.key] = instance\n end\n else\n if options[:duplicate] ==:fail \n raise \"Element #{instance} already exists in table #{table_class}\" \n end\n end\n end\n \n return instance\n end",
"def save\n if id\n conn = Kitten.establish_connection\n sql = \"UPDATE kittens SET name = '#{name}', laser_strength = #{laser_strength}, updated_at = '#{Time.now}' WHERE id = #{id};\"\n result = conn.exec(sql)\n result.result_status == PG::PGRES_COMMAND_OK\n else\n puts \"in here\"\n conn = Kitten.establish_connection\n sql = \"INSERT INTO kittens (name, laser_strength, created_at) VALUES ('#{name}', #{laser_strength}, '#{Time.now}') RETURNING id;\"\n result = conn.exec(sql)\n @id = result.first['id']\n result.result_status == PG::PGRES_COMMAND_OK\n end\n end",
"def insert(value)\n #YOUR WORK HERE\n end",
"def insert(options = {})\n prepare_insert(options) do\n if embedded?\n insert_as_embedded\n else\n insert_as_root\n end\n end\n end",
"def save()\n # Connect to our db\n db = PG.connect({dbname: 'bounties', host: 'localhost'})\n # Insert SQL command to be exacuted when save() is called\n # Below inserts values $1, 2, 3, 4 into the columns called\n #\n sql = \"INSERT INTO bounties (\n species,\n homeworld,\n danger_level,\n collected_by\n )\n VALUES (\n $1, $2, $3, $4\n )\n RETURNING * ;\n \"\n# tell the save function what your values are, which will be equal to the instance variables, which are part of the hashes of each bounty\n\n values = [@species, @homeworld, @danger_level, @collected_by]\n db.prepare('save', sql)\n # Line below assigns the database entry id to the id instance variable\n @id = db.exec_prepared(\"save\", values)[0]['id'].to_i\n db.close()\n\nend",
"def insert(name)\n CONN.execute(\"INSERT INTO artits(name) VALUES(?)\", name)\nend",
"def insert()\n\n # Kräver att det finns ett \"set_table(\"Table\")\" i klassen\n @insertable_vars_full = self.instance_variables # Ta med namnen user.username osv\n @insertable_vars_full.shift(1) # Kinda frisky\n @insertable_vars = []\n @insertable_values = []\n @insertable_vars_full.each do |var|\n @insertable_vars << var[1..-1]\n @insertable_values << self.instance_variable_get(var)\n end\n\n\n @insertable_vars_str = @insertable_vars.join(\", \")\n\n @question_marks = \"\"\n @insertable_vars.each do |key|\n @question_marks.concat(\"?,\")\n end\n @question_marks = @question_marks[0..-2]\n\n DB.execute(\"INSERT INTO #{@table} (#{@insertable_vars_str})\n VALUES (#{@question_marks})\", @insertable_values)\n\n end",
"def insert(*args)\n dataset.insert(*args)\n self\n end",
"def create_new_hero(db, name, age, specialty, turing_award)\r\n db.execute(\"INSERT INTO tech_heroes(name, age, specialty, turing_award) VALUES (?, ?, ?, ?)\", [name, age, specialty, turing_award])\r\nend",
"def insert_word(word)\n word = word.clone\n word_id = word.id\n\n @index_sense ||= @database.prepare('insert into senses_fts values (?, ?)')\n @index_literal ||= @database.prepare('insert into literals_fts values (?, ?, ?)')\n @insert_word ||= @database.prepare('insert into words values (?, ?)')\n\n word.literals.each do |literal| \n @index_literal.execute(literal.text, word_id, literal.priority)\n end\n\n word.readings.each do |reading| \n @index_literal.execute(reading.text, word_id, reading.priority) \n end\n\n word.senses.each do |sense|\n @index_sense.execute(sense.texts.join(';'), word_id)\n end\n\n # We can derive ID from table ID.\n word.id = 0\n\n @insert_word.execute(word_id, Word.encode(word))\n end",
"def exec_insert(sql, name = nil, binds = []) #:nodoc:\r\n log(sql, \"insert\", binds) { query(sql, binds) }\r\n end",
"def buy_dog(name)\n#know sabout its dogs\n pets[:dogs] << Dog.new(name)\n end",
"def save\n sql = <<-SQL\n INSERT INTO #{table_name_for_insert} (#{col_names_for_insert})\n VALUES (#{values_for_insert})\n SQL\n\n DB[:conn].execute(sql)\n # need to assign .id here because does not have id when instantiated, but now has one via its database\n @id = DB[:conn].execute(\"SELECT last_insert_rowid() FROM #{table_name_for_insert}\")[0][0]\n end",
"def insert \n DATABASE.execute(\"INSERT INTO contents (slide_order, title, body) \n VALUES (#{@slide_order}, '#{@title}', '#{@body}')\")\n @id = DATABASE.last_insert_row_id\n end",
"def create_review(db, banker_name, potential_id, house_info_id)\n\tdb.execute(\"INSERT INTO review (banker_name, potential_id, house_info_id) VALUES (?, ?, ?)\", [banker_name, potential_id, house_info_id])\nend",
"def pet_add(client_id)\n name = @prompt.ask(\"Pet Name?\") do |q|\n # error handling requiring input\n q.required true\n q.validate /[a-z]+/\n # error handling message\n q.messages[:valid?] = \"Name need to start with a letter.\"\n q.messages[:required?] = \"Required pet name\"\n q.modify :capitalize\n end\n\n age = @prompt.ask(\"Pet Age?\", convert: :integer) do |q|\n # error handling requiring input\n q.required true\n # error handling message\n q.messages[:required?] = \"Required pet age\"\n q.messages[:convert?] = \"Age has to be a number\"\n end\n\n # option to choose between cat and dog (animal type)\n type = @prompt.select(\"Pet type? \", [\n {name: \"#{@emoji[:smiling_cat_face_with_open_mouth]} Cat\", value: \"Cat\"},\n {name: \"#{@emoji[:dog_face]} Dog\", value: \"Dog\"},\n ])\n\n observations = @prompt.ask(\"Observations: \") do |q|\n q.modify :capitalize\n end\n \n new_id = @db.get_new_id(\"pets\")\n pet = Pet.new(new_id, name, age, type, observations, client_id)\n \n @db.add(\"pets\", pet)\n end",
"def do_insert(thing, team)\n target = instance_variable_get(thing)\n if target.leaf?\n instance_variable_set(thing,\n self.class.new(target, leafify(team))\n )\n else\n target.insert(team)\n end\n end",
"def create_pokemon(db, pokemon, cp, location)\n db.execute(\"INSERT INTO pokemon (pokemon, cp, location) VALUES (?, ?, ?)\", [pokemon, cp, location])\nend",
"def save\n if self.id.nil?\n self.insert\n else\n self.update\n end\n end",
"def create\n self.id = connection.insert(\n \"INSERT INTO #{self.class.table_name} \" +\n \"(#{quoted_column_names.join(', ')}) \" +\n \"VALUES(#{attributes_with_quotes.values.join(', ')})\",\n \"#{self.class.name} Create\",\n self.class.primary_key, self.id\n )\n \n @new_record = false\n end",
"def insert_tag(tag_name)\n return get_db_as_hash().execute(\"INSERT INTO tags (tag_name) VALUES (?)\", tag_name).first\n end",
"def insert_in_database\n Fetch.new(insertion_query).array\n end",
"def save\n id.nil? ? insert : update\n end",
"def create\n \n #handle upload\n handle_upload\n \n @dog = Dog.new(params[:dog])\n \n if @dog.save\n flash[:success] = \"Dog was successfully created\"\n redirect_to edit_admin_dog_path(@dog)\n else\n render action: \"new\" \n end\n\n end",
"def create\n @dog = Dog.new(dog_params)\n\n if @dog.save\n render json: @dog, status: 201\n else\n render json: {\n errors: @dog.errors\n }\n end\n end",
"def insert(table_name)\n if table_name == \"authors\"\n DATABASE.execute(\"INSERT INTO authors (name) VALUES ('#{@name}')\")\n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"location_keys\"\n DATABASE.execute(\"INSERT INTO location_keys (location_name, street, city, \n state, country, address, latitude, longitude) \n \n VALUES ('#{@location_name}', '#{@street}', '#{@city}', '#{@state}', \n '#{@country}', '#{@address}', #{@latitude}, #{@longitude})\")\n \n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"articles\"\n DATABASE.execute(\"INSERT INTO articles (date, author, text, title) \n \n VALUES ('#{@date}', #{@author}, '#{@text}', '#{@title}')\")\n \n @id = DATABASE.last_insert_row_id\n \n elsif table_name == \"articles_with_locations\"\n DATABASE.execute(\"INSERT INTO articles_with_locations (article_id, location_id) \n \n VALUES (#{@article_id}, #{@location_id})\")\n \n end #if loop\n \n end",
"def insert(cartridge)\n end"
] |
[
"0.70982844",
"0.7040118",
"0.6813493",
"0.6692974",
"0.6578374",
"0.63533133",
"0.63266695",
"0.6322296",
"0.6293022",
"0.6206442",
"0.6147826",
"0.6115783",
"0.60721695",
"0.6044648",
"0.60252905",
"0.6023231",
"0.59795785",
"0.59591275",
"0.5957428",
"0.5950503",
"0.59379715",
"0.5925682",
"0.5919763",
"0.590326",
"0.588837",
"0.58847713",
"0.5878401",
"0.5862506",
"0.5858752",
"0.58525896",
"0.5845177",
"0.58408654",
"0.5812422",
"0.58065724",
"0.5796131",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.57897115",
"0.5773261",
"0.57683057",
"0.5766381",
"0.576247",
"0.5754928",
"0.5750131",
"0.5738535",
"0.57367766",
"0.5735551",
"0.5731597",
"0.5721415",
"0.57099164",
"0.56970006",
"0.5685154",
"0.5681395",
"0.5671526",
"0.5666719",
"0.564183",
"0.56345296",
"0.5627822",
"0.56203246",
"0.56203246",
"0.56203246",
"0.56203246",
"0.56203246",
"0.56203246",
"0.56203246",
"0.5619741",
"0.56182444",
"0.559779",
"0.55942404",
"0.5590662",
"0.5582664",
"0.5569138",
"0.5568189",
"0.55569315",
"0.5552801",
"0.5545458",
"0.5545308",
"0.553834",
"0.5534237",
"0.5530735",
"0.55271757",
"0.55208004",
"0.55180013",
"0.55153304",
"0.55144376",
"0.55125487",
"0.55048704",
"0.54792583",
"0.54654765",
"0.54619807",
"0.5460327",
"0.5459953",
"0.5456004",
"0.54543227"
] |
0.74263877
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.