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 |
|---|---|---|---|---|---|---|
multiple full wallets => user address + residual + fee
|
def generate_withdrawal_transaction(exported_order)
tx = build_tx do |t|
input_amount = generate_inputs(t, exported_order)
validate_input_amount(input_amount, exported_order)
generate_withdrawal_output(t, exported_order)
generate_residual_output(t, input_amount, exported_order)
end
Base64.encode64(tx.to_payload)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def make_response(user)\n res = {email: user.email, wallets:[]}\n user.wallets.each{|wallet| res[:wallets] << { id: wallet.id, balance: wallet.display_balance, currency: wallet.balance_currency}}\n res\n end",
"def give_coins(from_addr, to_addr, coins, acc_balances)\n acc_balances[from_addr] = acc_balances[from_addr].to_i - coins.to_i\n acc_balances[to_addr] = acc_balances[to_addr].to_i + coins.to_i\n\n acc_balances\nend",
"def test_derive_child_wallet\n addresses = []\n path = File.join(File.dirname(__FILE__), 'addresses.txt')\n File.open(path).read.each_line do |line|\n addresses << line.strip\n end\n xpub = \"xpub6EPbauBbH3SYLqJrdPAK8yQuyQDow7pY4HDV8SMezH3VVb5g5htLpMAb7gvFXVdXPRp6m2fYHc1J3bjurfbfRd2DuNZQ9rKKiKAPirbj3F7\"\n wallet = Bip44::Wallet.from_xpub(xpub)\n\n addresses.each_with_index do |address, i|\n sub_wallet = wallet.sub_wallet(\"M/#{i}\")\n assert_equal sub_wallet.ethereum_address, address\n end\n \n end",
"def balance() @address.balance; end",
"def multi_addr(addresses)\n get(\"addr/\"+addresses.join(\",\")+\"/balance?noCache=1\")\n end",
"def generate_wallet(user)\n if user.wallet.nil?\n wallet_params = { user_id: user.id }\n wallet = Wallet.create(wallet_params)\n currency_params = [{ name: \"Bitcoin\", ticker: \"BTC\", wallet_id: wallet.id, amount: 0.0 },{ name: \"Ethereum\", ticker: \"ETH\", wallet_id: wallet.id, amount: 0.0 },{ name: \"Litecoin\", ticker: \"LTC\", wallet_id: wallet.id, amount: 0.0 }]\n currency_params.each do |item|\n WalletCurrency.create(item)\n end\n end\n end",
"def total_fee\n fee + fee2 + fee3 + fee4\n end",
"def finance\n authorize_user!\n \n @wallet_data = {}\n @wallets = [ENV['SHOPPING_CART_WALLET']] # BitcoinPayments.get_n_shopping_cart_wallets\n @wallets.each do |wallet|\n i = @wallet_data[wallet.to_sym] = {}\n i['bitcoins_in_wallet'] = 4500000 # 'lookup online, get satoshi' \n i['bitcoins_registered_in_database'] = BitcoinPayment.where(destination_address: wallet).map(&:value).sum # confirmations not right TODu\n i['bitcoins_withdrawn'] = 0 # BitcoinWithdrawls.sum\n i['missing_coins'] = i['bitcoins_in_wallet'] + i['bitcoins_withdrawn'] - i['bitcoins_registered_in_database'] # if not zero, hacking took place\n end\n \n @aggregate_shopping_cart_balance = @wallet_data.map { |wallet, values| values['bitcoins_in_wallet'] }.sum\n @aggregate_recorded_bitcoin_payments = @wallet_data.map { |wallet, values| values['bitcoins_registered_in_database'] }.sum\n @shipping_costs_by_month = [1,2,1,12,123,12,1] # getShippingCostsByMonthForYear(2014)\n @sales_by_month = [1,2,1,12,123,12,1] # get_sales_by_month_for_year(2014)\n @donations_by_month = [1,2,1,12,123,12,1]\n @number_of_sales = Sale.count\n end",
"def wallet\n # urls\n binance_url = \"http://bit.ly/binance-coinmarket\"\n coinbase_url = \"http://bit.ly/coinbasemacsfreeman\"\n wirex_url = \"https://bit.ly/2QgCLRH\"\n\n # names\n wirex_name = \"Wirex\"\n coinbase_name = \"CoinBase\"\n binance_name = \"Binance\"\n\n #messages\n wirex_msg1 = \"\\tWirex is the easiest wallet to use!\\n\"\n wirex_msg2 = \"\\tGet a visa card related to your cryptos!\\n\"\n wirex_msg3 = \"\\tWirex has just launched its own crypto!\"\n wirex_msg = wirex_msg1 + wirex_msg2 + wirex_msg3\n\n # concatenate\n wirex = wirex_url + \" (\" + wirex_name + \")\\n\" + wirex_msg\n coinbase = coinbase_url + \" (\" + coinbase_name + \")\"\n binance = binance_url + \" (\" + binance_name + \")\"\n\n dashes = \"-\" * 2 * coinbase.length\n # menu with options to choose\n puts dashes\n puts \"Option 1: #{wirex}\"\n puts \"Option 2: #{coinbase}\"\n puts \"Option 3: #{binance}\"\n puts dashes\nend",
"def wallet_params\n params.require(:wallet).permit(:btc_balance, :inr_balance,:user_id)\n end",
"def pay(amount, fee, sources, target, change)\n p = price('USD')\n satoshi = satoshi(amount)\n f = mfee(fee, size_of(amount, sources))\n satoshi += f if f.negative?\n raise Error, \"The fee #{f.abs} covers the entire amount\" if satoshi.zero?\n raise Error, \"The fee #{f.abs} is bigger than the amount #{satoshi}\" if satoshi.negative?\n builder = Bitcoin::Builder::TxBuilder.new\n unspent = 0\n size = 100\n utxos = Sibit::Json.new(http: @http, log: @log).get(\n URI(\"https://blockchain.info/unspent?active=#{sources.keys.join('|')}&limit=1000\")\n )['unspent_outputs']\n @log.info(\"#{utxos.count} UTXOs found, these will be used \\\n (value/confirmations at tx_hash):\")\n utxos.each do |utxo|\n unspent += utxo['value']\n builder.input do |i|\n i.prev_out(utxo['tx_hash_big_endian'])\n i.prev_out_index(utxo['tx_output_n'])\n i.prev_out_script = [utxo['script']].pack('H*')\n address = Bitcoin::Script.new([utxo['script']].pack('H*')).get_address\n i.signature_key(key(sources[address]))\n end\n size += 180\n @log.info(\n \" #{num(utxo['value'], p)}/#{utxo['confirmations']} at #{utxo['tx_hash_big_endian']}\"\n )\n break if unspent > satoshi\n end\n if unspent < satoshi\n raise Error, \"Not enough funds to send #{num(satoshi, p)}, only #{num(unspent, p)} left\"\n end\n builder.output(satoshi, target)\n f = mfee(fee, size)\n tx = builder.tx(\n input_value: unspent,\n leave_fee: true,\n extra_fee: [f, Bitcoin.network[:min_tx_fee]].max,\n change_address: change\n )\n left = unspent - tx.outputs.map(&:value).inject(&:+)\n @log.info(\"A new Bitcoin transaction #{tx.hash} prepared:\n #{tx.in.count} input#{tx.in.count > 1 ? 's' : ''}:\n #{tx.inputs.map { |i| \" in: #{i.prev_out.bth}:#{i.prev_out_index}\" }.join(\"\\n \")}\n #{tx.out.count} output#{tx.out.count > 1 ? 's' : ''}:\n #{tx.outputs.map { |o| \"out: #{o.script.bth} / #{num(o.value, p)}\" }.join(\"\\n \")}\n Min tx fee: #{num(Bitcoin.network[:min_tx_fee], p)}\n Fee requested: #{num(f, p)} as \\\"#{fee}\\\"\n Fee left: #{num(left, p)}\n Tx size: #{size} bytes\n Unspent: #{num(unspent, p)}\n Amount: #{num(satoshi, p)}\n Target address: #{target}\n Change address is #{change}\")\n unless @dry\n Sibit::Json.new(http: @http, log: @log).post(\n URI('https://blockchain.info/pushtx'),\n tx.to_payload.bth\n )\n end\n tx.hash\n end",
"def handle_create_tx keys, recipients, fee = 0\n keystore = Bitcoin::Wallet::SimpleKeyStore.new(file: StringIO.new(\"[]\"))\n keys.each do |k|\n begin\n key = Bitcoin::Key.from_base58(k)\n key = { addr: key.addr, key: key }\n rescue\n if Bitcoin.valid_address?(k)\n key = { addr: k }\n else\n begin\n key = Bitcoin::Key.new(nil, k)\n key = { addr: key.addr, key: key }\n rescue\n return { error: \"Input not valid address, pub- or privkey: #{k}\" }\n end\n end\n end\n keystore.add_key(key)\n end\n wallet = Bitcoin::Wallet::Wallet.new(@node.store, keystore)\n tx = wallet.new_tx(recipients.map {|r| [:address, r[0], r[1]]}, fee)\n return { error: \"Error creating tx.\" } unless tx\n [ tx.to_payload.hth, tx.in.map {|i| [i.sig_hash.hth, i.sig_address] rescue nil } ]\n rescue\n { error: \"Error creating tx: #{$!.message}\" }\n end",
"def validate_redeemtoaddress_inputs(data)\n response = {}\n response['status'] = false\n\n if data.length != 4\n response['err_msg'] = 'Insufficient number of parameters!'\n return response\n end\n\n begin\n data[1] = Integer(data[1])\n data[2] = btc_to_satoshi(Float(data[2]))\n\n transaction = retrieve_transaction_from_utxo(data[0], data[1])\n\n if transaction.nil?\n response['err_msg'] =\n 'Either invalid, non-wallet or already spent Transaction ID,' \\\n 'or incorrect vout index'\n return response\n end\n\n unless multisig_transaction?(\n transaction['trans_id'],\n transaction['vout_index']\n )\n\n response['err_msg'] =\n 'Transaction ID provided is not multisig transaction.' \\\n 'Please use `sendtoaddress` command for this.'\n return response\n end\n\n if btc_to_satoshi(transaction['value']) < (data[2] + TRANSACTION_FEE)\n response['err_msg'] =\n 'Amount to transfer must be less than the transaction amount'\n return response\n end\n\n unless valid_address? data[3]\n response['err_msg'] = 'Either invalid or non-wallet payee address'\n return response\n end\n\n response['status'] = true\n return response\n rescue\n response['err_msg'] = 'Invalid parameter values!'\n return response\n end\nend",
"def remainder_to_pay\n self.total_amount - self.checkout_wallet.unconfirmed_value_paid\n end",
"def pay(amount, fee, sources, target, change)\n p = price\n satoshi = satoshi(amount)\n f = mfee(fee, size_of(amount, sources))\n satoshi += f if f.negative?\n raise Error, \"The fee #{f.abs} covers the entire amount\" if satoshi.zero?\n raise Error, \"The fee #{f.abs} is bigger than the amount #{satoshi}\" if satoshi.negative?\n builder = Bitcoin::Builder::TxBuilder.new\n unspent = 0\n size = 100\n utxos = get_json(\n \"/unspent?active=#{sources.keys.join('|')}&limit=1000\"\n )['unspent_outputs']\n info(\"#{utxos.count} UTXOs found, these will be used \\\n(value/confirmations at tx_hash):\")\n utxos.each do |utxo|\n unspent += utxo['value']\n builder.input do |i|\n i.prev_out(utxo['tx_hash_big_endian'])\n i.prev_out_index(utxo['tx_output_n'])\n i.prev_out_script = [utxo['script']].pack('H*')\n address = Bitcoin::Script.new([utxo['script']].pack('H*')).get_address\n i.signature_key(key(sources[address]))\n end\n size += 180\n info(\" #{num(utxo['value'], p)}/#{utxo['confirmations']} at #{utxo['tx_hash_big_endian']}\")\n break if unspent > satoshi\n end\n if unspent < satoshi\n raise Error, \"Not enough funds to send #{num(satoshi, p)}, only #{num(unspent, p)} left\"\n end\n builder.output(satoshi, target)\n f = mfee(fee, size)\n tx = builder.tx(\n input_value: unspent,\n leave_fee: true,\n extra_fee: [f, Bitcoin.network[:min_tx_fee]].max,\n change_address: change\n )\n left = unspent - tx.outputs.map(&:value).inject(&:+)\n info(\"A new Bitcoin transaction #{tx.hash} prepared:\n #{tx.in.count} input#{tx.in.count > 1 ? 's' : ''}:\n #{tx.inputs.map { |i| \" in: #{i.prev_out.bth}:#{i.prev_out_index}\" }.join(\"\\n \")}\n #{tx.out.count} output#{tx.out.count > 1 ? 's' : ''}:\n #{tx.outputs.map { |o| \"out: #{o.script.bth} / #{num(o.value, p)}\" }.join(\"\\n \")}\n Min tx fee: #{num(Bitcoin.network[:min_tx_fee], p)}\n Fee requested: #{num(f, p)} as \\\"#{fee}\\\"\n Fee left: #{num(left, p)}\n Tx size: #{size} bytes\n Unspent: #{num(unspent, p)}\n Amount: #{num(satoshi, p)}\n Target address: #{target}\n Change address is #{change}\")\n post_tx(tx.to_payload.bth) unless @dry\n tx.hash\n end",
"def all_wallet_balances\n\t\ttotals = Hash.new {|h,uuid| h[uuid] = 0 }\n\t\ttotals[ GENESIS_WALLET ] = INITIAL_AMOUNT\n\n\t\tself.each_block do |block|\n\t\t\tblock.transactions.each do |tr|\n\t\t\t\ttotals[ tr[:to] ] += tr[:amount]\n\t\t\t\ttotals[ tr[:from] ] -= tr[:amount]\n\t\t\tend\n\t\tend\n\n\t\treturn totals.transform_values {|val| Money.new(val, :zmz) }\n\tend",
"def net_payments(current_user_id)\n payments = {\"you_are_owed\" => {}, \"you_owe\" => {}}\n # {\"Matt\"=>15.0, \"Sam\"=>10.0, \"Drew\"=>10.0, \"Tristan\"=>22.22} you_are_owed\n # {\"Matt\"=>11.11, \"Kyle\"=>25.22, \"Dega\"=>30.22, \"Drew\"=>30.22} you_owe\n\n you_owe_hash = you_owe(current_user_id)\n you_are_owed_hash = you_are_owed(current_user_id)\n\n\n # Find all the uniq keys of the two hashes, then sum the you_are_owed - you_owe, if value is positive, you are owed that amount, if value is negative you owe that amount\n user_payments = you_owe_hash.keys + you_are_owed_hash.keys\n user_payments = user_payments.uniq\n\n user_payments.each do |user|\n # user is in you_owe_hash and NOT you_are_owed_hash\n if you_owe_hash.has_key?(user) && !you_are_owed_hash.has_key?(user)\n payments[\"you_owe\"][user] = you_owe_hash[user]\n # user is NOT in you_owe_hash and in you_are_owed_hash\n elsif !you_owe_hash.has_key?(user) && you_are_owed_hash.has_key?(user)\n payments[\"you_are_owed\"][user] = you_are_owed_hash[user]\n # user is in both you_owe hash and you_are_owed hash\n else\n amount = (you_are_owed_hash[user] - you_owe_hash[user]).round(2)\n if amount > 0\n # Goes to you are owed\n payments[\"you_are_owed\"][user] = amount\n\n elsif amount < 0\n payments[\"you_owe\"][user] = -amount\n # Goes to you owe\n end\n end\n end\n\n payments\n\n end",
"def fDebitCoinsFrom (email, amount)\n @users.debitCoinsFrom(email, amount)\n end",
"def process( wallet )\n\t\tself.add_block do\n\t\t\tself.add_transaction( from: GENESIS_WALLET, to: wallet, amount: MINING_REWARD )\n\t\tend\n\tend",
"def get_confirmed_payments(options_hash = {})\n query_info = options_hash[:query_info].nil? ? nil : options_hash[:query_info]\n # form can be... :technical_payments, :confirmed_payments\n form = options_hash[:form].nil? ? :confirmed_payments : options_hash[:form]\n \n return self.bitcoin_payments.map{|x| x.value}.sum if we_looked_up_blockchain_info_recently?\n \n \n checkout_wallet_info, latest_block = query_blockchain_for_new_payments_to_checkout_wallet(self.checkout_wallet.input_address, query_info)\n self.checkout_wallet.update_attributes(:last_successful_manual_lookup => Time.zone.now)\n self.checkout_wallet.calculate_if_payment_complete\n \n if checkout_wallet_info.nil?\n Message.emergency(\"a query_blockchain_for_new_payments_to_checkout_wallet returned a nil checkout_wallet_info somehow\", \n \"#{__FILE__}:#{__LINE__} \\n input_address#{self.checkout_wallet.input_address}\")\n return self.bitcoin_payments.map{|x| x.value}.sum\n end\n \n \n \n \n latest_height = latest_block['height']\n txs = checkout_wallet_info['txs']\n \n \n case form\n when :confirmed_payments\n correct_destination_values = self.bitcoin_payments.map{|x| x.value}.sum\n correct_destination_values += check_txs_for_unrecorded_properly_destined_values(txs, latest_height)\n when :technical_payments\n correct_destination_values = self.technical_bitcoin_payments.map{|x| x.value}.sum\n correct_destination_values += check_txs_just_to_see_that_payments_came_into_them(txs, latest_height)\n end\n \n correct_destination_values\n end",
"def wallet_params\n params.require(:wallet).permit(:user_id, :amount, :memo, :deleted_at)\n end",
"def join(wallet, ledger: '/dev/null', baseline: false, master: false)\n if @id.nil?\n @id = wallet.id\n @key = wallet.key\n @network = wallet.network\n end\n unless wallet.network == @network\n @log.error(\"The wallet is from a different network '#{wallet.network}', ours is '#{@network}'\")\n return\n end\n unless wallet.key == @key\n @log.error('Public key mismatch')\n return\n end\n unless wallet.id == @id\n @log.error(\"Wallet ID mismatch, ours is #{@id}, theirs is #{wallet.id}\")\n return\n end\n seen = 0\n added = 0\n pulled = []\n wallet.txns.each do |txn|\n next if @txns.find { |t| t == txn }\n seen += 1\n if txn.amount.negative?\n dup = @txns.find { |t| t.id == txn.id && t.amount.negative? }\n if dup && !master\n @log.error(\"An attempt to overwrite existing transaction #{dup.to_text.inspect} \\\nwith a new one #{txn.to_text.inspect} from #{wallet.mnemo}\")\n next\n end\n if dup && master\n @log.debug(\"An overwrite to the existing transaction #{dup.to_text.inspect} \\\nis coming from a master node: #{txn.to_text.inspect} from #{wallet.mnemo}\")\n @txns.reject! { |t| t.id == txn.id && t.amount.negative? }\n end\n unless Signature.new(@network).valid?(@key, wallet.id, txn)\n @log.error(\"Invalid RSA signature at the transaction ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n else\n if Id::BANNED.include?(txn.bnf.to_s)\n @log.debug(\"The paying wallet is banned, #{wallet.id} can't accept this: #{txn.to_text.inspect}\")\n next\n end\n dup = @txns.find { |t| t.id == txn.id && t.bnf == txn.bnf && t.amount.positive? }\n if dup\n @log.error(\"Overwriting #{dup.to_text.inspect} with #{txn.to_text.inspect} \\\nfrom #{wallet.mnemo} (same ID/BNF)\")\n next\n end\n if !txn.sign.nil? && !txn.sign.empty?\n @log.error(\"RSA signature is redundant at ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless wallet.prefix?(txn.prefix)\n @log.debug(\"Payment prefix '#{txn.prefix}' doesn't match \\\nwith the key of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless @wallets.acq(txn.bnf, &:exists?)\n if baseline\n @log.debug(\"Paying wallet #{txn.bnf} is absent, \\\nbut the txn in in the baseline: #{txn.to_text.inspect}\")\n else\n next if pulled.include?(txn.bnf)\n pulled << txn.bnf\n if yield(txn) && !@wallets.acq(txn.bnf, &:exists?)\n @log.error(\"Paying wallet #{txn.bnf} file is absent even after PULL: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n if @wallets.acq(txn.bnf, &:exists?) &&\n !@wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n if baseline\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction, but we trust it, since it's a baseline: #{txn.to_text.inspect}\")\n else\n if pulled.include?(txn.bnf)\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n pulled << txn.bnf\n yield(txn)\n unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n end\n @txns << txn\n added += 1\n next unless txn.amount.negative?\n File.open(ledger, 'a') do |f|\n f.puts(\n [\n Time.now.utc.iso8601,\n txn.id,\n txn.date.utc.iso8601,\n wallet.id,\n txn.bnf,\n txn.amount.to_i * -1,\n txn.prefix,\n txn.details\n ].map(&:to_s).join(';') + \"\\n\"\n )\n end\n end\n end",
"def balances\n # Very inefficient at this point for a large network...\n self.network_as_users.map { |user|\n {:balance => self.balance_with(user), :user => user}\n }.select {|balance| balance[:balance].to_f != 0.0}\n end",
"def user_request_withdrawal(currency, amount, address, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_request_withdrawal ...\"\n end\n\n # verify the required parameter 'currency' is set\n fail \"Missing the required parameter 'currency' when calling user_request_withdrawal\" if currency.nil?\n\n # verify the required parameter 'amount' is set\n fail \"Missing the required parameter 'amount' when calling user_request_withdrawal\" if amount.nil?\n\n # verify the required parameter 'address' is set\n fail \"Missing the required parameter 'address' when calling user_request_withdrawal\" if address.nil?\n\n # resource path\n path = \"/user/requestWithdrawal\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"currency\"] = currency\n form_params[\"amount\"] = amount\n form_params[\"address\"] = address\n form_params[\"otpToken\"] = opts[:'otp_token'] if opts[:'otp_token']\n form_params[\"fee\"] = opts[:'fee'] if opts[:'fee']\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:POST, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Transaction')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_request_withdrawal. Result: #{result.inspect}\"\n end\n return result\n end",
"def fGetBetESSCoinsFrom (email)\n @users.getBetESSCoinsFrom(email)\n end",
"def balance(address)\n json = get_json(\"/rawaddr/#{address}\")\n info(\"Total transactions: #{json['n_tx']}\")\n info(\"Received/sent: #{json['total_received']}/#{json['total_sent']}\")\n json['final_balance']\n end",
"def user_outstanding_balance(user)\n invoicable_reservations = reservations.where(user: user).invoicable\n invoicable_game_passes = game_passes.where(user: user).invoicable\n\n invoicable_reservations.map(&:outstanding_balance).sum.to_f +\n invoicable_game_passes.map(&:price).sum.to_f\n end",
"def address_balance(address)\n total = $db.connection.execute(\n \"SELECT amount FROM wallet_transfers WHERE destination_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n spent_including_fees = $db.connection.execute(\n \"SELECT fee, amount FROM wallet_transfers WHERE from_address = ?\",\n address,\n ).flatten.map { |a| BigDecimal(a) }.reduce(&:+)\n\n total.to_i - spent_including_fees.to_i\n end",
"def fetch(wallet)\n query = { wallet: wallet, balance: { '$gt' => 1e-8 } }\n order = { balance: :desc }\n addresses = find_order_limit(query, order, 50)\n .map { |doc| Entities::Address.create_from(doc) }\n Entities::Wallet.create_from 'id' => wallet, 'name' => name(wallet),\n 'balance' => balance(wallet),\n 'size' => count(wallet),\n 'addresses' => addresses\n end",
"def points_balance\n user = User.find(params[:user_id])\n transactions = Transaction.sort_user_transactions(params[:user_id]) # sort by created_date\n payers = []\n\n transactions.each do |t|\n payer = payers.find{|p| p[:payer_name] == t.payer_name}\n if payer # if payer already exists in array\n payer[:points] = payer[:points] + t.original_points # add new points to existing balance\n else\n entry = {payer_name: t.payer_name, points: t.original_points} # create a new payer entry and add to array\n payers << entry\n end\n end\n payers.each {|p| p[:points] = p[:points].to_s + \" points\"} # convert to \"100 points\" format\n\n render json: payers\n end",
"def user_data(user, number = nil, sender = 0)\n address = user.ship_address\n number = if address.siodemka_number.blank? then @client_number else address.siodemka_number end\n {\n ulica: address.address1,\n email_kontakt: user.email,\n imie: address.firstname,\n numer: number,\n nazwisko: address.lastname,\n nrDom: address.address2,\n nrLokal: address.address2,\n kod: address.zipcode,\n nrExt: user.id,\n nazwa: if address.company.blank? then \"#{address.firstname} #{address.lastname}\" else address.company end,\n telKontakt: address.phone,\n nip: false,\n czyFirma: if address.company.blank? then 0 else 1 end,\n kodKraju: address.country.iso,\n miasto: address.city,\n fax: false,\n telefonKom: false,\n czyNadawca: sender\n }\n end",
"def fees\n @fees ||= {\n \"insurance_fee\" => (commission * ASSURANCE_SHARE).round(0),\n \"assistance_fee\" => (ASSISTANCE_COST * rental.duration).round(0)\n }.tap { |fees| fees[\"drivy_fee\"] = commission - fees.values.inject(:+) }\n end",
"def get_balance(address)\n #res = get(\"addr/\"+address+\"?noCache=1\")\n #(res['balance'] + res['unconfirmedBalance']).to_BTCFloat\n get(\"addr/\"+address+\"?noCache=1\")['balance'].to_BTCFloat\n end",
"def print_wallet\n\t\tputs \"\\n\\n\\n\"\n\t\tputs \"Your balance: #{@balance.round(2)}\"\n\tend",
"def transfer_swincoin(amount, payer, payee, key_private)\r\n payer_peer = search_peers_by_port(payee)\r\n if (payer_peer != -1)\r\n new_block(amount, payer, payee, key_private)\r\n else\r\n puts \"Transaction failed. The payee port does not exist!\".red\r\n $status = \"Transaction failed. The payee port does not exist!\"\r\n end\r\nend",
"def fee\n params['amount_fee']\n end",
"def wallet_address\n vault = current_resource_owner_vault\n return render({ json: nil, status: :no_content }) unless vault.present?\n render json: {wallet_address: vault.wallet_address}, status: :ok\n end",
"def calc_net_worth\r\n $peers.length.times do |i|\r\n $peers[i].balance = 0.0\r\n end\r\n $blockchain.length.times do |i|\r\n if (i == 0)\r\n genesis_node = search_peers_by_port($blockchain[i].miner.to_i)\r\n genesis_node.balance = GENESIS_REWARD + MINER_REWARD\r\n else\r\n payer = search_peers_by_port($blockchain[i].payer.to_i)\r\n payee = search_peers_by_port($blockchain[i].payee.to_i)\r\n miner = search_peers_by_port($blockchain[i].miner.to_i)\r\n payer.balance = payer.balance - $blockchain[i].amount.to_f\r\n payee.balance = payee.balance + $blockchain[i].amount.to_f\r\n miner.balance = miner.balance + MINER_REWARD\r\n end\r\n end\r\n $peers.length.times do |i|\r\n puts ($peers[i].name.to_s + \" \" + $peers[i].port.to_s + \" \" + $peers[i].balance.to_s).red\r\n end\r\nend",
"def payment_profile_options(user, params)\n bt_address = \"#{params[:billing][:address]}\"\n bt_address << \", #{params[:billing][:address2]}\" if params[:billing][:address2] && params[:billing][:address2].strip.length > 0 \n \n return { \n :customer_profile_id => user.authnet_customer_profile_id.to_i, \n :payment_profile => {\n :bill_to => {\n :first_name => params[:billing][:first_name],\n :last_name => params[:billing][:last_name],\n :address => bt_address,\n :city => params[:billing][:city],\n :state => params[:billing][:state],\n :zip => params[:billing][:zip],\n :phone_number => user.phone,\n :email => user.email\n }, \n :payment => {\n :credit_card => Caboose::StdClass.new({\n :number => params[:credit_card][:number],\n :month => params[:credit_card][:expiration_month].to_i,\n :year => \"20#{params[:credit_card][:expiration_year].to_i}\",\n :first_name => params[:billing][:first_name],\n :last_name => params[:billing][:last_name]\n })\n }\n },\n :validation_mode => :live\n }\n end",
"def deposit(user, amount)\n user.with_lock do\n user.my_wallet.balance += amount.to_f\n user.my_wallet.save!\n end\n end",
"def payment_address!\n return unless currency.coin?\n record = payment_address\n\n # The address generation process is in progress.\n if record.address.blank?\n record\n else\n # allows user to have multiple addresses.\n payment_addresses.create!(currency: currency)\n end\n end",
"def retrieve_fees\n return if stripe_charge_id.nil?\n\n transaction = Stripe::BalanceTransaction.retrieve(stripe_charge.balance_transaction)\n return if transaction.nil?\n\n self.fee = transaction.fee / 100.0\n self.received_amount = transaction.net / 100.0\n save\n end",
"def expect_frontend_addresses(user)\n expect_list_addresses(user.reload.addresses)\n\n l = Spree::AddressBookList.new(user)\n if l.user_bill\n within(%Q{tr.address[data-address=\"#{l.user_bill.id}\"]}) do\n expect(page).to have_content(Spree.t(:default_billing_address))\n end\n end\n\n if l.user_ship\n within(%Q{tr.address[data-address=\"#{l.user_ship.id}\"]}) do\n expect(page).to have_content(Spree.t(:default_shipping_address))\n end\n end\n end",
"def transfer_to_stakeholders_account params\n Notifyer.print( 'Stake#transfer_to_stakeholders_account' , params: params ) if Rails.env.development?\n \n \n begin\n order_item = Shop::OrderItem.cached_find( params[:order_item_id] )\n params[:application_fee] = Admin.digiramp_fees( params[:amount] )\n\n \n # sending transfers with same sender and recipient will fail\n begin\n send_micro_transaction params\n rescue => e\n errored('Stake#transfer_to_stakeholders_account', e ) unless Rails.env.development?\n Notifyer.print( 'Stake#transfer_to_stakeholders_account' , \"Not sending money to origin account\" ) if Rails.env.development?\n end\n \n update_income params\n\n rescue => e\n errored('Stake#transfer_to_stakeholders_account', e )\n end \n end",
"def bill_user(user)\n active_merchant_stubs_payeezy\n Time.zone = user.club.time_zone\n diff_between_next_bill_date_and_today = user.next_retry_bill_date - Time.zone.now\n next_bill_date = user.next_retry_bill_date + user.terms_of_membership.installment_period.days\n user.update_attribute(:next_retry_bill_date, Time.zone.now)\n\n Time.zone = 'UTC'\n answer = user.reload.bill_membership\n Time.zone = user.club.time_zone\n user.update_attribute(:next_retry_bill_date, user.next_retry_bill_date + diff_between_next_bill_date_and_today)\n assert (answer[:code] == Settings.error_codes.success), answer[:message]\n\n visit show_user_path(partner_prefix: user.club.partner.prefix, club_prefix: user.club.name, user_prefix: user.id)\n within('#table_membership_information') do\n find('#td_mi_next_retry_bill_date', text: I18n.l(next_bill_date, :format => :only_date))\n assert page.has_content?(I18n.l user.active_credit_card.last_successful_bill_date, :format => :only_date)\n end\n\n within('.nav-tabs') { click_on 'Operations' }\n within('#operations') { assert page.has_content?(\"Member billed successfully $#{user.terms_of_membership.installment_amount}\") }\n\n within('.nav-tabs') { click_on 'Transactions' }\n within('#transactions') do\n assert page.has_selector?('#transactions_table')\n Transaction.all.each do |transaction|\n assert(page.has_content?('Transaction Normal - Approved with Stub') || page.has_content?('Sale : This transaction has been approved with stub'))\n end\n assert page.has_content?(user.terms_of_membership.installment_amount.to_s)\n end\n\n within('#transactions_table') { assert page.has_selector?('#refund') }\n user.transactions.where('operation_type = 101').order(:created_at).last\n end",
"def show\n # Public method\n if @order.secure_hash != params[:secure_hash]\n respond_to do |format|\n format.html { redirect_to items_path }\n end\n return\n end\n\n @email_is_registered = User.exists?(email: @order.email)\n \n client = DogecoinClient.new\n\n if client.valid?\n @doges_deposited = client.get_received_by_address(@order.doge_address, 0)\n @doges_pending = @order.total_doges - @doges_deposited\n @doges_pending = 0 if @doges_pending < 0\n @is_payed = @doges_pending == 0\n else\n @doges_deposited = \"Error, no address generated. Please contact support.\"\n @doges_pending = 0\n @is_payed = false\n end\n \n end",
"def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end",
"def balance_for(other_user)\n Money.new(all_balances[other_user.id], 'PLN')\n end",
"def membership_fee\n if business_admin?\n {\"amount\" => 29900, \"id\" => \"business-29900\"}\n elsif church_admin?\n {\"amount\" => 9900, \"id\" => \"church-9900\"}\n elsif alliance_admin?\n {\"amount\" => 9900, \"id\" => \"alliance-9900\"}\n else\n {\"amount\" => 4900, \"id\" => \"individual-4900\"}\n end\n end",
"def wallet_transactions_listing(wallet_id, type)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json',\n 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}/transactions?type=#{type}\"), 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}/transactions?type=#{type}\", headers)\n JSON.parse(response)['data'] if response.present?\n rescue StandardError => e\n Rails.logger.error e\n nil\n end",
"def find_user_split_amt(all_users, equal_share , current_user)\n\t\tresult_array = [];\n\t\ttmp_array = all_users.map{|user| [user.email, equal_share - user.user_expense(self.id)]}\n\t\tp_array = tmp_array.select{|email, v| v > 0 }\n\t\tn_array = tmp_array - p_array\n\t\t#n_array = tmp_array.select{|email, v| v < 0 }\n\n\t\tp_array.each_with_index do |p_record, p_index|\n\t\t\tn_array.each_with_index do |n_record, n_index|\n\t\t\t\tif n_record[1].abs > p_record[1]\n\t\t\t\t\tputs \"#{p_record[0]} will pay to #{n_record[0]} value = #{p_record[1]}\"\n\t\t\t\t\tresult_array = create_result_set(p_record, n_record, current_user, result_array, p_record[1])\n\t\t\t\t\tn_value = n_record[1].abs - p_record[1]\n\t\t\t\t\tn_array[n_index] = [n_record[0], n_value]\n\t\t\t\t\tn_record = [n_record[0], n_value]\n\t\t\t\t\tp_array[p_index] = [p_record[0], 0]\n\t\t\t\t\tp_record = [p_record[0], 0]\n\t\t\t\telse\n\t\t\t\t\tputs \"#{p_record[0]} will pay to #{n_record[0]} value = #{n_record[1].abs}\"\n\t\t\t\t\tresult_array = create_result_set(p_record, n_record, current_user, result_array, n_record[1].abs)\n\t\t\t\t\tvalue = p_record[1] - n_record[1].abs\n\t\t\t\t\tp_array[p_index] = [p_record[0], value]\n\t\t\t\t\tp_record = [p_record[0], value]\n\t\t\t\t\tn_record = [n_record[0], 0]\n\t\t\t\t\tn_array[n_index] = [n_record[0], 0]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn result_array\n\tend",
"def full_address\n merchant.street + \", \" + merchant.city + \", \" + merchant.state + \" \" + merchant.zip\n end",
"def balance\n txns.inject(Amount::ZERO) { |sum, t| sum + t.amount }\n end",
"def wallet_info\n client.make_request('/wallet-info', 'post', params: {})\n end",
"def own_amounts\n hash_totals = {}\n\n self.user_currencies.each do |uc|\n if hash_totals[uc.currency.crypto]\n hash_totals[uc.currency.crypto][:amount] = hash_totals[uc.currency.crypto][:amount] + uc.amount.to_i\n else\n hash_totals[uc.currency.crypto] = { amount: uc.amount }\n end\n end\n hash_totals\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def test_add_coins_non_empty_account\n coins = 10\n receiver = 112_233\n address = { '445566' => 100 }\n assert_equal 10, @verify.add(coins, receiver, address)\n end",
"def call!\n account_from.update_balance!(side: :-, amount: amount)\n account_to.update_balance!(side: :+, amount: amount)\n end",
"def user_get_deposit_address(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: UserApi#user_get_deposit_address ...\"\n end\n\n # resource path\n path = \"/user/depositAddress\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'currency'] = opts[:'currency'] if opts[:'currency']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n\n\n auth_names = []\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'String')\n if Configuration.debugging\n Configuration.logger.debug \"API called: UserApi#user_get_deposit_address. Result: #{result.inspect}\"\n end\n return result\n end",
"def balance(address)\n first_one do |api|\n api.balance(address)\n end\n end",
"def balance_of(address)\n payload = Base58.decode(address).to_s(16)\n public_key_hash = payload.slice(0, payload.length - 4)\n unspent_txs = unspent_transaction_outputs_of(public_key_hash)\n unspent_txs.reduce(0) { |sum, tx_out| sum + tx_out.value }\n end",
"def getwalletinfo\n @api.request 'getwalletinfo'\n end",
"def all_fees\n services.map{|el| el[:fee]}\n end",
"def wallet_information(wallet_id)\n add_timestamp\n add_salt\n headers = { 'content-type' => 'application/json', 'signature' => signature('', 'get', \"/v1/user/#{wallet_id}\"),\n 'salt' => salt, 'timestamp' => timestamp, 'access_key' => access_key }\n response, msg = rest_client.getCall(\"/v1/user/#{wallet_id}\", headers)\n if response.present? && response.body.present? && JSON.parse(response.body)['status']['status'] == 'SUCCESS'\n JSON.parse(response.body)\n else\n msg\n end\n rescue StandardError => e\n Rails.logger.error e\n nil\n end",
"def paid_balance\n average = average_amount\n paid_infos.each do |k, v|\n paid_infos[k] = v - average\n end\n end",
"def recovery_wallet(xpubs: [])\n client.make_request('/recovery-wallet', 'post', params: {xpubs: xpubs})\n end",
"def expect_user_addresses(user)\n user.reload\n expect_selected(user.bill_address, :user, :bill)\n expect_selected(user.ship_address, :user, :ship)\n\n expect_list_addresses(user.addresses)\n end",
"def deliver(start_address, end_address)\n route = (end_address) - (start_address)\n if route < quota\n pay = 0.25 * route - 2\n else\n pay = 0.25 * route + (route - quota) * (0.25)\nend\n\n@experience += route\n@earnings += pay\nend",
"def show_balance(user)\n puts \"Name: #{user.name}, balance: #{user.balance}, points: #{user.card_points}\"\n end",
"def payment_amount\n convert_email_to_user && save\n return override_cost if override_cost.present?\n\n event&.get_cost(member: user&.present?)\n end",
"def spend_points\n # Quito el formato del rut dado.\n # Ejemplo\n # Run.remove_format('12.345.678-5')\n # # => '123456785'\n rut_without_format = Run.remove_format(self.rut)\n\n # Busco la cuenta del usuario por el RUT y Contraseña en la base de datos de la EFI\n # y se la asigno a la variable account.\n account = efi.accounts.find_by_rut_and_password(rut_without_format, self.password)\n\n if account\n # Si se encontro una cuenta,\n # se construye una transaccion para descontar los puntos de la misma.\n transaction = account.transactions.build(points: self.points, operation_id: Operation.expend_id)\n\n if transaction.save\n # Si los puntos en la cuenta son suficientes,\n # se indica que descontaron los puntos.\n return true\n else\n # Si los puntos en la cuenta son insuficientes,\n # se indica que no se pueden descontar los puntos.\n return false\n end\n else\n # Si no se encontro una cuenta se retorna nil,\n # para indicar que la cuenta no existe.\n return nil\n end\n end",
"def settle_up(settle_from, settle_to, amount)\n\n # You are looking for all of the billsplits where the recipient id is payer (settle_from) because those are the ones you want to now fulfill\n billsplits = Billsplit.joins(:bill).where('author_id = ?', settle_to).where('recipient_id = ?', settle_from).where('recipient_paid = false')\n\n\n # this actually needs to be calculated from net payments\n bill_settle_list = []\n\n\n billsplits.each do |split|\n temp_bill = []\n amount -= split.split_amount\n if amount > 0\n temp_bill.push(split.id)\n temp_bill.push(true)\n temp_bill.push(0)\n bill_settle_list.push(temp_bill)\n\n elsif amount < 0 # if settle up amount is less than a single billsplit amount\n temp_bill.push(split.id)\n temp_bill.push(false)\n temp_bill.push(-amount.round(2)) # settle_from user now still owes settle_to user by negative amount\n bill_settle_list.push(temp_bill)\n break # Do not continue going through billsplits\n\n else\n temp_bill.push(split.id)\n temp_bill.push(true)\n temp_bill.push(0)\n bill_settle_list.push(temp_bill)\n break # Do not continue going through billsplits\n\n end\n end\n\n # If after going through all of the billsplits amount > 0, then an overpayment has been made\n # and a new bill/billsplit needs to be created in the opposite direction.\n if amount > 0\n temp_bill = []\n temp_bill.push(\"new\")\n temp_bill.push(false)\n temp_bill.push(amount.round(2))\n bill_settle_list.push(temp_bill)\n end\n\n bill_settle_list\n\n end",
"def you_owe(current_user_id)\n\n you_owe_list = {}\n billsplits = Billsplit.joins(:bill).includes(:bill_author).where('recipient_id = ?', current_user_id).where('recipient_paid = false').where('paid = false')\n\n billsplits.each do |bill|\n if you_owe_list.has_key? bill.bill_author.username\n temp_amount = you_owe_list[bill.bill_author.username]\n you_owe_list[bill.bill_author.username] = temp_amount + bill.split_amount\n else\n you_owe_list[bill.bill_author.username] = bill.split_amount\n end\n end\n\n\n you_owe_list\n\n\n\n end",
"def lifetime_balances(user_ids = nil)\n reservations_relation = reservations.includes(:user)\n game_passes_relation = game_passes\n participations_relation = participations\n group_subscriptions_relation = group_subscriptions\n\n if user_ids.present?\n game_passes_relation.where!(user_id: user_ids)\n participations_relation.where!(user_id: user_ids)\n group_subscriptions_relation.where!(user_id: user_ids)\n # cannot do this on reservations because they may belong to a group, where we have to bill\n # the owner of that group (that's why we group on `fetch_owner_id`)\n # reservations_relation.where!(user_id: user_ids)\n end\n\n reservations_by_user = reservations_relation.group_by(&:fetch_owner_id)\n game_passes_balances = game_passes_relation.group(:user_id).sum(:price)\n participations_balances = participations_relation.group('participations.user_id').sum(:price)\n group_subscriptions_balances = group_subscriptions_relation.group(:user_id).sum(:price)\n\n users.map do |user|\n [user.id,\n (reservations_by_user[user.id].to_a.map(&:price).sum || 0).to_d +\n (game_passes_balances[user.id] || 0).to_d +\n (participations_balances[user.id] || 0).to_d +\n (group_subscriptions_balances[user.id] || 0).to_d\n ]\n end.to_h\n end",
"def reward\n business.add_to_balance(amount)\n end",
"def user_lifetime_balance(user)\n reservations_balance = reservations.where(user: user).sum(:price)\n game_passes_balance = game_passes.where(user: user).sum(:price)\n\n reservations_balance.to_f + game_passes_balance.to_f\n end",
"def getwalletinfo\n node.wallet ? node.wallet.to_h : {}\n end",
"def listunconfirmed(addr)\n json_get('address','unconfirmed',addr)['data']['unconfirmed']\n end",
"def apply_fees\n remove_fees\n unless waive_fees\n #CHALKLE\n self.chalkle_gst_number = Finance::CHALKLE_GST_NUMBER\n self.chalkle_fee = course.chalkle_fee_no_tax\n self.chalkle_gst = course.chalkle_fee_with_tax - chalkle_fee\n \n self.processing_fee = course.processing_fee\n self.processing_gst = course.processing_fee*3/23\n self.processing_fee = course.processing_fee-self.processing_gst\n\n #TEACHER FEE\n if provider_pays_teacher?\n self.teacher_fee = 0\n self.teacher_gst = 0\n else\n if fee_per_attendee?\n self.teacher_fee = course.teacher_cost\n elsif flat_fee?\n confirmed_booking_count = course.bookings.fees_not_waived.paid.confirmed.count\n if confirmed_booking_count > 0\n self.teacher_fee = course.teacher_cost / confirmed_booking_count\n else\n self.teacher_fee = course.teacher_cost\n end\n end\n end\n\n #TEACHER TAX\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst_number = course.teacher.tax_number\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n else\n self.teacher_gst = 0\n self.teacher_gst_number = nil\n end\n\n #PROVIDER\n self.provider_fee = course.provider_fee\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n\n #adjust in case calc_cost is not course cost, should only happen if flat_fee\n difference = course.cost - calc_cost\n if difference != 0\n self.provider_fee = course.provider_fee + difference\n if provider.tax_registered?\n self.provider_gst_number = provider.tax_number\n self.provider_gst = course.provider_fee*3/23\n self.provider_fee = self.provider_fee-self.provider_gst\n else\n self.provider_gst_number = nil\n self.provider_gst = 0\n end\n end\n\n #adjust in case payment has been made already\n difference = cost - calc_cost\n if difference != 0\n #adjust processing_fee\n self.processing_fee = cost * course.provider_plan.processing_fee_percent\n self.processing_gst = self.processing_fee*3/23\n self.processing_fee = self.processing_fee-self.processing_gst\n\n #reset difference to adjust for processing_fee changes\n difference = cost - calc_cost\n\n #if payment exists then adjust provider fee to ensure the payment amount matches calc_cost\n adjustment_for_provider = difference\n adjustment_for_teacher = 0\n\n if provider_fee+provider_gst+difference < 0\n #if adjusted provider_fee is negative then deduct that negative amount from teacher_fee and make provider_fee 0\n adjustment_for_teacher = provider_fee+provider_gst+difference \n self.provider_fee = 0\n self.provider_gst = 0\n else\n self.provider_fee = provider_fee+provider_gst+adjustment_for_provider\n if provider.tax_registered?\n self.provider_gst = provider_fee*3/23\n self.provider_fee = provider_fee - provider_gst\n end\n end\n \n if adjustment_for_teacher != 0\n self.teacher_fee = teacher_fee+teacher_gst+adjustment_for_teacher\n if course.teacher.present? && course.teacher.tax_registered?\n self.teacher_gst = teacher_fee*3/23\n self.teacher_fee = teacher_fee-teacher_gst\n end\n end\n end\n end\n cost\n end",
"def users_wallet_params\n params.require(:users_wallet).permit(:name)\n end",
"def balance\n # accounts.reduce(0){|sum, account| sum + account.balance}\n accounts.sum{|account| account.balance} \n end",
"def address_params\n params.require(:address).permit(:user_id, :address, :balance)\n end",
"def test_add_coins_empty_account\n coins = 10\n receiver = 112_233\n address = %w[445566]\n assert_equal 10, @verify.add(coins, receiver, address)\n end",
"def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options).body)\n fees = response.key?('fees') ? response['fees'] : []\n fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }\n end",
"def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options).body)\n fees = response.key?('fees') ? response['fees'] : []\n fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }\n end",
"def fees(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/fees\", options).body)\n fees = response.key?('fees') ? response['fees'] : []\n fees.map { |attributes| Promisepay::Fee.new(@client, attributes) }\n end",
"def extra_cash(db, user_name)\r\n\t# determine extra monies (conditional on + amount)\r\n\tdifference = (current_income(db, user_name) - current_expenses(db, user_name))\r\n\tcache_bonus = difference if difference > 0 || 0\r\nend",
"def fee\n (amount * 0.005) if amount\n end",
"def wallet\n get 'wallet'\n end",
"def fee_params\n params.require(:fee).permit(:user_id, :name, :price, :serial, :end_at, :deleted_at)\n end",
"def list_wallet_addresses(wallet_id: default_wallet_id)\n call :get, '/wallet/' + wallet_id + '/addresses'\n end",
"def full_order_to_address\n ship_address.address1 + ' ' + ship_address.address2\n end",
"def index\n @transactions = current_user.wallet.transactions\n\n end",
"def testnet_address; end",
"def new_address\n private_key, public_key = Bitcoin::generate_key\n address = Bitcoin::pubkey_to_address(public_key)\n [private_key, public_key, address]\nend",
"def verify_address_owners\n if complete?\n errors.add(:bill_address, 'Billing address should not have a user') if bill_address.try(:user_id)\n errors.add(:ship_address, 'Shipping address should not have a user') if ship_address.try(:user_id)\n else\n if bill_address && bill_address.valid? && !bill_address.user_id.nil? && bill_address.user_id != user_id\n errors.add(\n :bill_address,\n \"Billing address user #{bill_address.user_id.inspect} does not match order #{user_id.inspect}\"\n )\n end\n\n if ship_address && ship_address.valid? && !ship_address.user_id.nil? && ship_address.user_id != user_id\n errors.add(\n :ship_address,\n \"Shipping address user #{ship_address.user_id.inspect} does not match order #{user_id.inspect}\"\n )\n end\n end\n end",
"def complete_transaction(trans)\n trans = trans.split('>')\n\n return 1 if trans.size != 2\n\n s = trans[0]\n r = trans[1].split('(')[0]\n x = trans[1].split('(')[1].chomp(')')\n\n return 1 unless s.length == r.length && s.length == 6 && x.to_i.to_s == x\n\n sender = @wallets[s.to_i]\n recipient = @wallets[r.to_i]\n x = x.to_i\n\n # update sender wallet\n if @wallets[s.to_i].nil?\n @wallets[s.to_i] = Wallet.new(s, x * -1)\n else\n sender.balance -= x\n @negs.push(sender) if sender.address != 'SYSTEM' && sender.balance.negative?\n end\n\n # update recipients wallet\n if @wallets[r.to_i].nil?\n @wallets[r.to_i] = Wallet.new(r, x)\n else\n recipient.balance += x\n end\n\n @actives.add(s)\n @actives.add(r)\n end",
"def verify_transactions(maps)\n # hash literal same as Hash.new\n balance_map = {}\n valid = -1\n maps.each do |x|\n trans = x[:transactions].split(':')\n trans.each_with_index do |y, i|\n # verifing from address vaild/correct format\n from_addr = y[0..5]\n balance_map[from_addr] = 0 unless balance_map.key?(from_addr)\n if i == trans.length - 1\n valid = x[:id] unless from_addr == 'SYSTEM'\n else\n from_addr.delete!('0123456789')\n valid = x[:id] unless from_addr.empty?\n end\n # verifing > in position 7\n valid = x[:id] unless y[6] == '>'\n\n # verifing to address valid/correct format\n to_addr = y[7..12]\n balance_map[to_addr] = 0 unless balance_map.key?(to_addr)\n # puts balance_map[to_addr]\n to_addr.delete!('0123456789')\n valid = x[:id] unless to_addr.empty?\n valid = x[:id] unless y[13] == '('\n valid = x[:id] unless y[y.length - 1] == ')'\n\n amount_num = y[14..y.length - 2]\n balance_map[y[0..5]] -= amount_num.to_i\n balance_map[y[7..12]] += amount_num.to_i\n amount_num.delete!('0123456789')\n valid = x[:id] unless amount_num.empty?\n end\n end\n # really rubocop\n unless valid.to_i.negative?\n puts \"Line #{valid}: Could not parse transactions list.'#{maps[valid.to_i][:transactions]}'\\nBLOCKCHAIN INVALID\"\n return false\n end\n balance_map = balance_map\nend",
"def getaccount(coinaddress)\n coind.getaccount coinaddress\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 wallet_params\n params.permit(:user_id, :currency_id)\n end"
] |
[
"0.6424103",
"0.5942975",
"0.5940175",
"0.58603626",
"0.58356076",
"0.5773518",
"0.5760219",
"0.5751896",
"0.57362014",
"0.57227135",
"0.5708556",
"0.56459296",
"0.55991626",
"0.558161",
"0.5570114",
"0.5532367",
"0.5521252",
"0.55207366",
"0.55169135",
"0.55057484",
"0.5504701",
"0.5478419",
"0.547422",
"0.54386556",
"0.542787",
"0.54024714",
"0.53998935",
"0.5399334",
"0.53985316",
"0.53887564",
"0.53797466",
"0.5373651",
"0.5369044",
"0.5361032",
"0.5360317",
"0.5352031",
"0.53508925",
"0.5350653",
"0.53325063",
"0.53317475",
"0.53256315",
"0.5298086",
"0.52850354",
"0.5282026",
"0.52796775",
"0.5275519",
"0.52712566",
"0.5269543",
"0.5268278",
"0.5265531",
"0.52530146",
"0.5252152",
"0.52460027",
"0.5243748",
"0.5240948",
"0.5239315",
"0.5235011",
"0.52307564",
"0.5228632",
"0.52234876",
"0.5216642",
"0.521433",
"0.5187068",
"0.5185699",
"0.51854974",
"0.51812774",
"0.5172557",
"0.51702887",
"0.51676136",
"0.5166792",
"0.51658016",
"0.5161528",
"0.51571023",
"0.5152853",
"0.51515895",
"0.5150148",
"0.5148997",
"0.51406854",
"0.5138137",
"0.51362616",
"0.51344776",
"0.51227957",
"0.51225394",
"0.51217276",
"0.51217276",
"0.51217276",
"0.51097906",
"0.510844",
"0.51049083",
"0.50996894",
"0.50973314",
"0.509583",
"0.50950664",
"0.5094924",
"0.50944257",
"0.50918233",
"0.50856006",
"0.5085132",
"0.508481",
"0.50794184",
"0.50789696"
] |
0.0
|
-1
|
Internal: For a given +point+ in time, calculates the load which should be handled by transient energy producers, and assigns the calculated values to the producer's load curve. This is the "jumping off point" for calculating the merit order, and note that the method is called once per Merit::POINT. Since Calculator computes a value for every point (default 8,760 of them) even tiny changes can have large effects on the time taken to run the calculation. Therefore, always benchmark / profile your changes! order The Merit::Order being calculated. point The point in time, as an integer. Should be a value between zero and Merit::POINTS 1. producers An object supplying the always_on and transient producers. Returns nothing.
|
def compute_point(order, point, producers)
# Optimisation: This is order-dependent; it requires that always-on
# producers are before the transient producers, otherwise "remaining"
# load will not be correct.
#
# Since this method is called a lot, being able to handle always-on and
# transient producers in separate loops allows us to skip calling
# #always_on? in every iteration. This accounts for a 20% reduction in
# the calculation runtime.
if (remaining = demand(order, point)) < 0
raise SubZeroDemand.new(point, remaining)
end
producers.always_on(point).each do |producer|
remaining -= producer.max_load_at(point)
end
# Ignore the possibility for a Resortable to be delivered as the third
# method argument. We're going to resort the transients anyway.
transients = order.participants.transients(point)
.sort_by { |transient| Convergence.producer_cost(transient, point) }
while producer = transients.shift do
max_load = producer.max_load_at(point)
# Optimisation: Load points default to zero, skipping to the next
# iteration is faster then running the comparison / load_curve#set.
next if max_load.zero?
current = producer.load_curve.get(point)
headroom = max_load - current
chunk = producer.output_capacity_per_unit
remaining = 0 if remaining < 1e-10
next if headroom.zero?
if headroom <= remaining && headroom < chunk
# Strangely the producer has less than one unit of capacity left. We
# assign it to the maximum load.
add_load(producer, point, headroom)
remaining -= headroom
elsif remaining > chunk
# Assign load equal to the size of one plant.
add_load(producer, point, chunk)
remaining -= chunk
# Add the plant back to the collection. Determining the index of the
# first producer which is more expensive -- and inserting before
# that producer -- is 2x faster than resorting the list entirely.
insert_at = transients.index do |other|
Convergence.producer_cost(other, point) >=
Convergence.producer_cost(producer, point)
end
transients.insert(insert_at || transients.length, producer)
else
# There is less total load remaining to be assigned than the
# capacity of a new plant.
add_load(producer, point, remaining) if remaining > 0
assign_price_setting(order, producer, point)
# Optimisation: If all of the demand has been accounted for, there
# is no need to waste time with further iterations and expensive
# calls to Producer#max_load_at.
break
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def compute_point(order, point, participants)\n if (demand = demand_at(order, point)).negative?\n raise SubZeroDemand.new(point, demand)\n end\n\n demand = compute_always_ons(\n point, demand,\n participants.always_on,\n participants.flex.at_point(point)\n )\n\n dispatchables = participants.dispatchables.at_point(point)\n next_idx = 0\n\n if demand.positive?\n next_idx = compute_dispatchables(point, dispatchables, demand)\n\n # There was unmet demand after running all dispatchables. It is not possible to satisfy any\n # price-sensitive demands (below).\n return if next_idx.nil?\n end\n\n compute_price_sensitives(\n point,\n participants.price_sensitive_users.at_point(point),\n dispatchables,\n next_idx\n )\n\n nil\n end",
"def set(point, producer)\n case producer\n when :deficit, nil\n super(\n point,\n [\n @fallback_price,\n last_available_dispatchable(point)&.cost_strategy&.cost_at(point)\n ].compact.max\n )\n when :surplus\n super(point, 0.0)\n else\n super(point, producer.cost_at(point))\n end\n end",
"def local_producers(point, price)\n @local.participants.dispatchables.select do |producer|\n (producer.cost_strategy.sortable_cost(point) < price) &&\n (producer.max_load_at(point) > producer.load_curve.get(point))\n end\n end",
"def demand_at(order, point)\n order.demand_calculator.demand_at(point)\n end",
"def load_curve\n curve = Curve.new([], Merit::POINTS)\n\n Merit::POINTS.times do |point|\n if cheaper_locally?(point)\n curve.set(point, [\n available_capacity(point),\n foreign_demand(point),\n @capacity.get(point)\n ].min)\n else\n curve.set(point, 0.0)\n end\n end\n\n curve\n end",
"def foreign_demand(point)\n local_price = @local.price_curve.get(point)\n producers = foreign_producers(point, local_price)\n\n producers.reduce(0.0) do |sum, prod|\n amount = prod.load_curve.get(point) -\n Convergence.competitive_load(prod, point, local_price)\n\n sum + amount\n end\n end",
"def set_load(point, amount)\n load_curve[point] = amount\n end",
"def load_at(point)\n @load_curve[point]\n end",
"def available_capacity(point)\n local_producers(point, @abroad.price_curve.get(point))\n .reduce(0.0) do |sum, prod|\n sum + (prod.max_load_at(point) - prod.load_curve.get(point))\n end\n end",
"def price_at(point, allow_loaded = false) # rubocop:disable Style/OptionalBooleanParameter\n @cost_strategy.price_at(point, allow_loaded)\n end",
"def foreign_producers(point, price)\n @abroad.participants.dispatchables.select do |producer|\n Convergence.producer_cost(producer, point) > price &&\n producer.load_curve.get(point) > 0\n end\n end",
"def calculate(order)\n order.participants.lock!\n producers = order.participants.for_calculation\n\n each_point { |point| compute_point(order, point, producers) }\n\n self\n end",
"def participant_at(point)\n return :deficit if deficit?(point)\n\n ps = price_sensitive_at(point)\n\n return ps if ps && ps != @inflex_consumer_marker\n\n # Price-sensitives are always price-setting, except when they are the always-on price-marker,\n # in which case a dispatchable may be price setting if it is more expensive.\n\n di = dispatchable_at(point)\n\n return :surplus if ps.nil? && di.nil?\n\n return di if ps.nil?\n return ps if di.nil?\n\n ps.cost_at(point) > di.cost_at(point) ? ps : di\n end",
"def dispatchable_at(point)\n collection = @dispatchables.at_point(point)\n index = collection.rindex { |di| di.load_at(point).positive? }\n\n if index.nil? && @inflex_producer_marker&.active_at?(point)\n # No dispatchable is price setting, but an always on producer may set the price.\n return @inflex_producer_marker\n end\n\n index && collection[index]\n end",
"def inflexible_production_marker(order)\n # Can't set a price if there are no dispatchables.\n return nil if @dispatchables.empty?\n\n priced_inflexibles = order.participants.always_on.select(&:provides_price?)\n\n return nil unless priced_inflexibles.any?\n\n loaded_hours = Array.new(Merit::POINTS, false)\n\n Merit::POINTS.times do |point|\n loaded_hours[point] = priced_inflexibles.any? { |inflex| inflex.load_at(point)&.positive? }\n end\n\n MarginalMarker.producer(loaded_hours, @dispatchables)\n end",
"def cost_at(point)\n @cost_strategy.cost_at(point)\n end",
"def compute_always_ons(point, demand, always_ons, flex)\n produced = always_ons.sum { |producer| producer.max_load_at(point) }\n\n if produced > demand\n # There is enough production to meet demand and have some left over for flexibles.\n produced -= demand\n\n if produced.positive?\n flex.each do |part|\n produced -= part.barter_at(point, produced, 0)\n break if produced <= 0\n end\n end\n\n demand = 0.0\n elsif produced < demand\n demand -= produced\n end\n\n demand.negative? ? 0.0 : demand\n end",
"def compute_price\n \n # set the initial state of an order\n self.status = Order.possible_status[:wait_payment]\n \n # use the visitor pattern to traverse the product and its upgrades\n visitor = VisitorPrice.new\n visitor.visit_product product\n upgrades.each do |upgrade|\n visitor.visit_upgrade upgrade\n end\n self.price = visitor.price\n \n end",
"def hw11_3()\n p = [0, 2]\n q = [15, 6]\n n = 23\n a = 1\n current = {:r => p, :a => 1, :b => 0}\n for i in (0..20)\n print \"$R_#{i}$ & (#{current[:r][0]}, #{current[:r][1]}) & #{current[:a]} & #{current[:b]} \\\\\\\\\\n\"\n if current[:r][1] < 9\n if current[:r][0] == p[0] && current[:r][1] == p[1]\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n else\n current[:r] = ec_add_point(current[:r][0], current[:r][1], p[0], p[1], n)\n end\n current[:a] += 1\n elsif current[:r][1] < 17\n current[:r] = ec_add_point(current[:r][0], current[:r][1], q[0], q[1], n)\n current[:b] += 1\n else\n current[:r] = ec_double_point(current[:r][0], current[:r][1], n, a)\n current[:a] *= 2\n current[:b] *= 2\n end\n end\n\n puts 27 * 4 % 29\n print ec_multiply_point(11, 9, 23, 1, 7)\n print \"\\n\"\n print ec_multiply_point(15, 6, 23, 1, 3)\nend",
"def set_par_price\n @game.initial_offering.set_par_price(@company, @par_price)\n @game.market.add_company(@company, @par_price)\n end",
"def max_load_at(point_in_time)\n if @load_profile\n @load_profile[point_in_time] * (@max_production || max_production)\n else\n @available_output_capacity || available_output_capacity\n end\n end",
"def compute_performance_points(standard_points, decimals)\n score_calculator = ScoreCalculator.new(@season, @gender_type, @category_type, @pool_type, @event_type)\n score_calculator.get_custom_score(@meeting_individual_result.get_timing_instance, standard_points, decimals)\n end",
"def unit_saving(point)\n point.price - price\n end",
"def fetch_default_price_points\n @price_points = CacheManagement::OstPricePointsDefault.new.fetch\n\n success\n end",
"def saving(point)\n (point.price * volume) - (price * volume)\n end",
"def load_curve\n if always_on?\n max_load_curve\n else\n @load_curve\n end\n end",
"def price_sensitive_at(point)\n return nil if @price_sensitives.empty?\n\n collection = @price_sensitives.at_point(point)\n\n index = collection.rindex { |ps| ps.load_at(point).negative? }\n user = collection[index] if index\n\n if user.nil? && @inflex_consumer_marker&.active_at?(point)\n # No price-setting consumers, but the order has an always-on consumer which sets the price.\n return @inflex_consumer_marker\n end\n\n # If the user is completely fulfilled, it means there is extra unused production at the\n # current price, and the producer should determine the price.\n return nil if !user || user.unused_input_capacity_at(point).zero?\n\n # ... otherwise there is no remaining production at the current price, and there is\n # competition demand-side. The consumer sets the price.\n user\n end",
"def cheaper_locally?(point)\n @local.price_at(point) < @abroad.price_at(point)\n end",
"def merit_order\n order = Merit::Order.new\n\n producers.each do |producer|\n order.add(producer) unless producer.marginal_costs == Float::NAN\n end\n\n order.add(local_demand_user)\n\n order\n end",
"def production(unit = :mj)\n case unit\n when :mj\n load_curve.sum * 3600\n when :mwh\n load_curve.sum\n else\n raise \"Unknown unit: #{unit}\"\n end\n end",
"def inject_demand!\n full_load_hours = participant.full_load_hours\n\n full_load_seconds =\n if !full_load_hours || full_load_hours.nan?\n full_load_hours = 0.0\n else\n full_load_hours * 3600\n end\n\n target_api[:full_load_hours] = full_load_hours\n target_api[:full_load_seconds] = full_load_seconds\n\n target_api.demand =\n (full_load_seconds / input_efficiency) *\n participant.input_capacity_per_unit *\n participant.number_of_units\n end",
"def inflexible_consumption_marker(order)\n # Can't set a price if there are no price-sensitives.\n return nil if @price_sensitives.empty?\n\n priced_inflexibles = order.participants.users.select(&:provides_price?)\n\n return nil unless priced_inflexibles.any?\n\n loaded_hours = Array.new(Merit::POINTS, false)\n\n Merit::POINTS.times do |point|\n loaded_hours[point] = priced_inflexibles.any? { |inflex| inflex.load_at(point)&.positive? }\n end\n\n MarginalMarker.consumer(loaded_hours, @price_sensitives)\n end",
"def reward_resources_for_points(points, multiplier=nil)\n multiplier ||= 0.03\n\n reward = (points * multiplier).ceil\n metal = (Resources.volume_to_metal(reward) * 2).round\n energy = (Resources.volume_to_energy(reward) * 2).round\n zetium = (Resources.volume_to_zetium(reward) * 0.7).round\n #puts \"#{points} -> #{metal} m, #{energy} e, #{zetium} z\"\n \n reward_metal metal\n reward_energy energy\n reward_zetium zetium\n end",
"def populate_from_meet_for_mposts(meet, mposts, &coeff_calculator)\n graph.clear; pending.clear; seeded.clear\n\n # Don't case relation between meet members, only fillin between mposts\n # and meet.mposts\n meet.mposts.each {|mpost| \n #next unless mpost.active?\n graph[mpost] = Array.new\n # Fillin seeds with meet.mposts. Since meet can not be re-configured, they\n # all have infinite coeff values.\n seeded[mpost] = MeetProcesser.infinite_coeff\n }\n\n mposts.each {|mpost|\n graph_mpost = Array.new\n node_coeff = 0.0\n meet.mposts.each {|meet_mpost| \n #next unless meet_mpost.active?\n #if mpost.see_or_seen_by?(meet_mpost) # ZZZ, see_each_other?\n if mpost.see_each_other?(meet_mpost)\n coeff = coeff_calculator.call(mpost, meet_mpost)\n graph_mpost << [meet_mpost, coeff]\n node_coeff += coeff\n end\n }\n graph[mpost] = graph_mpost\n pending[mpost] = node_coeff\n }\n\n # Don't check coeff_stats, assign a mpost to it whenever possible\n self.coeff_stats = [0.0, 0.0]\n end",
"def recalculate_points_fast\n if @game.final? then\n tips = @game.tips\n tips.each do |tip|\n tip.points = calculate_tip_points(tip)\n tip.user.points += tip.points\n tip.save\n tip.user.save\n end\n end\n end",
"def custom_load_pf\n # adjusted power factors from \"power factor data.xlsx\"\n new_pf = {\n 'pool_pump' => '0.87',\n 'responsive_loads' => '0.95',\n 'unresponsive_loads' => '0.95',\n 'lights' => '0.90', # this is interior lighting\n 'plugs' => '0.95',\n 'exterior' => '0.95'\n }\n find_by_class('house').each do |h|\n # note that for the sake of performance we're assuming\n # all the ZIPloads are nested under the house\n # If they were downstream in some other way we'd need\n # to use h.downstream, which is slower\n h.nested.each do |d|\n if d[:class] == 'ZIPload'\n new_pf.each do |load_type, pf|\n if d[:base_power].include? load_type\n d[:power_pf] = d[:current_pf] = d[:impedance_pf] = pf\n break\n end\n end\n end\n end\n end\n end",
"def compute_dispatchables(point, dispatchables, remaining)\n # Hold and increment the index rather than using Enumerable#with_index, to avoid allocating an\n # Enumerator.\n index = -1\n\n dispatchables.each do |producer|\n index += 1\n max_load = producer.max_load_at(point)\n\n # Optimisation: Load points default to zero, skipping to the next iteration is faster then\n # running the comparison / load_curve#set.\n next if max_load.zero?\n\n if max_load < remaining\n producer.set_load(point, max_load)\n remaining -= max_load\n else\n producer.set_load(point, remaining) if remaining.positive?\n return index\n end\n end\n\n nil\n end",
"def calculate_points\n raise \"The bracket was not loaded\" if !@loaded\n\n calculate_team_points\n calculate_player_points\n end",
"def curve_points(points)\n cur_page.curve_points(points)\n end",
"def competitor_placing_points(competitor, judge_type)\n sc = scoring_calculator\n if sc.nil?\n 0\n else\n sc.total_points(competitor, judge_type)\n end\n end",
"def production_curve\n production = @adapters\n .select { |a| a.config.type == :producer && PRODUCTION_TYPES.include?(a.config.subtype) }\n .map { |c| c.participant.load_curve }\n\n (Merit::CurveTools.add_curves(production) || EMPTY_CURVE).map(&:-@)\n end",
"def adjourn_points_giocataend\r\n # at the end of the game remain to calculate the primiera\r\n player1 = @players[0]\r\n player2 = @players[1]\r\n hand1 = @carte_prese[player1.name]\r\n hand2 = @carte_prese[player2.name]\r\n prim_res_arr = calculate_primiera(hand1, hand2)\r\n @log.debug(\"Primiera of #{player1.name}:#{prim_res_arr[0]}, #{player2.name}: #{prim_res_arr[1]}\")\r\n # update points on all players\r\n ix = 0\r\n [player1, player2].each do |pl|\r\n points_info = @points_curr_segno[pl.name]\r\n points_info[:primiera] = prim_res_arr[ix]\r\n #calculate total\r\n tot = 0\r\n points_info.each do |k,v|\r\n next if k == :tot\r\n tot += v\r\n end\r\n points_info[:tot] = tot\r\n ix += 1\r\n end\r\n end",
"def update_current_plug_load\n set_instantaneous_plug_load(timestamp, value)\n\n s_i = slice_index\n load = calculate_plug_avgLoad(s_i)\n set_plug_avgLoad(s_i, load)\n\n # invalidate any future slices (none should exist; do a sanity check)\n invalidate_future_results\n end",
"def spare_load_curve\n max_load_curve - load_curve\n end",
"def setup(point)\n\t\t\n\tend",
"def products_at_point(x,y)\n -1.upto(1) do |j|\n -1.upto(1) do |k|\n unless (j == 0 && k == 0)\n product = 1\n 0.upto(ADJACENT - 1) do |factor|\n row = x + j * factor\n col = y + k * factor\n next if row < 0 || col < 0 || row >= GRID_SIZE || col >= GRID_SIZE\n product *= @grid[row][col]\n fin = factor == ADJACENT - 1\n @largest_product = product if fin && product > @largest_product\n end\n end\n end\n end\n end",
"def initialize set_point = 0, position = 0\n @set_point = set_point.to_f\n @position = position.to_f\n @sample_rate = 1.0 # seconds - figure this out through timing\n\n @integral_gain = 0.0\n @derivative_gain = 0.0\n @proportional_gain = 1.0\n\n # internal\n @derivative = 0.0\n @integral = 0.0\n @previous_error = @set_point - @position\n end",
"def get_product_service_kpi_from_to(product_service_map,time,time_list)\n @pro_normalPv_list = Array.new\n @pro_delayPv_list = Array.new\n size = time.size\n 0.upto(size-1) do |i|\n new_p,new_s = new_and_old_service(time[i]) \n product_service_map = concat_pro_ser(product_service_map,new_p,new_s)\n pro_kpi,pro_pv,pro_normalPv,pro_delayPv = get_kpi_by_collection_name(@db,\"count_kpi\",product_service_map,time_list[i],time_list[i+1])\n @pro_normalPv_list.push(pro_normalPv)\n @pro_delayPv_list.push(pro_delayPv)\n end\n pro_size = @pro_normalPv_list.size\n @pro_pv = 0\n @pro_delayPv = 0\n 0.upto(pro_size-1) {|i|@pro_pv += @pro_normalPv_list[i]+@pro_delayPv_list[i]; @pro_delayPv+=@pro_delayPv_list[i]} \n @pro_kpi = (@pro_pv-@pro_delayPv)/(@pro_pv*1.0)*100\n last = time_list.size-1\n @ser_kpi,@ser_pv,@ser_normalPv,@ser_delayPv = get_kpi_by_collection_name(@db,\"search_kpi\",nil,time_list[0],time_list[last])\n @pro_avi,@pro_yes_num,@pro_no_num = get_availability_by_collection_name(@db,\"count_usable\",time_list[0],time_list[last])\n @ser_avi,@ser_yes_num,@ser_no_num = get_availability_by_collection_name(@db,\"search_usable\",time_list[0],time_list[last])\n puts \"Starttime: #{time_list[0]}\\t Endtime: #{time_list[last]}\\t timegap: #{time_list.size-1} \"\n print nil\n end",
"def get_par_price(company)\n @par_prices ||= {}\n @par_prices[company]\n end",
"def update(point)\n\t\t\n\tend",
"def update(point)\n\t\t\n\tend",
"def calculate_price_of_next_foobar\n @initial_foobar_px = (@initial_foobar_px * (1+@percentage_px_increase)).round(2) # assumes that each subsequent price is rounded off to 2 digits immediately to imitate real life\n end",
"def default_points\n \tself.point_bank = 1000\n end",
"def calculate_points(item)\n if @customers.include?(item[\"customer\"])\n time_of_order = DateTime.parse(item[\"timestamp\"])\n customer = @customers[item[\"customer\"]]\n customer[:total_amount]= customer[:total_amount] + item[\"amount\"]\n\n # Reward points calculation based on the schedule\n if (time_of_order.hour >= 12 && time_of_order.hour < 13)\n temp_points = (item[\"amount\"]/3).ceil\n elsif (time_of_order.hour >= 11 && time_of_order.hour < 12) || (time_of_order.hour >= 13 && time_of_order.hour < 14)\n temp_points = (item[\"amount\"]/2).ceil\n elsif (time_of_order.hour >= 10 && time_of_order.hour < 11) || (time_of_order.hour >= 14 && time_of_order.hour < 15)\n temp_points = (item[\"amount\"]).ceil\n else\n temp_points = (item[\"amount\"]*0.25).ceil\n end\n if (temp_points >= 3 && temp_points < 21)\n customer[:orders] = customer[:orders] + 1\n customer[:points] = customer[:points] + temp_points\n end\n \n customer[:average_points] = (customer[:points]/customer[:orders])\n else\n add_customer(item)\n end\n end",
"def create\n @point_exchange = PointExchange.new(point_exchange_params)\n\n @remain_point = Customer.find(point_exchange_params[:customer_id]).customer_point.point\n @customer_point = Customer.find(point_exchange_params[:customer_id]).customer_point\n @customer_point.point = @customer_point.point - point_exchange_params[:point].to_i\n\n respond_to do |format|\n if @point_exchange.save and @customer_point.save\n format.html { redirect_to @point_exchange, notice: 'Point exchange was successfully created.' }\n format.json { render action: 'show', status: :created, location: @point_exchange }\n else\n format.html { render action: 'new' }\n format.json { render json: @point_exchange.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_experience_points\n end",
"def each_point(&block)\n Merit::POINTS.times(&block)\n end",
"def sum_of_point\n # Calculating point of each block\n calculate_points\n # Sum\n rubbish_count + not_clear_count + somewhat_count + understand_count\n end",
"def revenue_curve\n @revenue_curve ||= load_curve * order.price_curve\n end",
"def compute_enhance_points\n @enhance_points = 0\n if SeasonPersonalStandard.has_standard?(@season.id, @swimmer.id, @pool_type.id, @event_type.id)\n past_season_event_best = SeasonPersonalStandard.get_standard(@season.id, @swimmer.id, @pool_type.id, @event_type.id)\n return 0 if past_season_event_best.get_timing_instance.to_hundreds <= @meeting_individual_result.get_timing_instance.to_hundreds\n\n @enhance_points = (100 * past_season_event_best.get_timing_instance.to_hundreds / meeting_individual_result.get_timing_instance.to_hundreds).to_i - 100\n else\n return 0\n end\n @enhance_points > 10 ? 10 : @enhance_points\n end",
"def calculate_point_schedule(field_size)\n @point_schedule = [0]\n field_size.downto(1) { |i| @point_schedule << i }\n @point_schedule[1] += 6 if @point_schedule.length > 1\n @point_schedule[2] += 3 if @point_schedule.length > 2\n @point_schedule[3] += 1 if @point_schedule.length > 3\n end",
"def getInts(pep)\n rt_helper = RetentionTime::Helper\n pep_id = pep[0]\n p_int = pep[7] + rt_helper.RandomFloat(-5,2)\n if p_int > 10\n p_int -= 10\n end\n predicted_int = (p_int * 10**-1) * 14183000.0 \n low = 0.1*predicted_int\n relative_ints = (@db.execute \"SELECT ints FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n core_mzs = (@db.execute \"SELECT mzs FROM core_spec WHERE pep_id=#{pep_id}\").flatten[0].gsub(/\\[/,\"\").split(/,/).map{|val| val.to_f}\n avg = pep[5] #p_rt\n\n sampling_rate = @opts[:sampling_rate].to_f\n wobA = Distribution::Normal.rng(@opts[:wobA].to_f,0.0114199604).call #0.0014199604 is the standard deviation from Hek_cells_100904050914 file\n wobB = Distribution::Normal.rng(@opts[:wobB].to_f,0.01740082).call #1.20280082 is the standard deviation from Hek_cells_100904050914 file\n tail = Distribution::Normal.rng(@opts[:tail].to_f,0.018667495).call #0.258667495 is the standard deviation from Hek_cells_100904050914 file\n front = Distribution::Normal.rng(@opts[:front].to_f,0.01466692).call #4.83466692 is the standard deviation from Hek_cells_100904050914 file\n # These number didn't work. May need to get more samples or figure something else out. For now this will give us some\n # meta variance in any case\n mu = @opts[:mu].to_f\n\n index = 0\n sx = pep[9]\n sy = (sx**-1) * Math.sqrt(pep[8]) #abu\n\n shuff = rt_helper.RandomFloat(0.05,1.0)\n core_mzs.each_with_index do |mzmu,core_idx|\n\n relative_abundances_int = relative_ints[index]\n\n t_index = 1\n\n (Mspire::Simulator::Spectra::r_times[pep[10]..pep[11]]).each_with_index do |rt,i| \n\n\n if !@one_d\n #-------------Tailing-------------------------\n shape = (tail * (t_index / sx)) + front\n int = (rt_helper.gaussian((t_index / sx) ,mu ,shape,100.0))\n t_index += 1\n #---------------------------------------------\n\n else\n #-----------Random 1d data--------------------\n int = (relative_abundances_int * ints_factor) * shuff\n #---------------------------------------------\n end\n\n if int < 0.01\n int = rt_helper.RandomFloat(0.001,0.4)\n end\n\n=begin\n if !@one_d\n #-------------M/Z Peak shape (Profile?)-------\n fraction = rt_helper.gaussian(fin_mzs[i],mzmu,0.05,1)\n factor = fraction/1.0\n fin_ints[i] = fin_ints[i] * factor\n #---------------------------------------------\n end\n=end\t \n\n if int > 0.4\n #-------------Jagged-ness---------------------\n sd = (@opts[:jagA] * (1-Math.exp(-(@opts[:jagC]) * int)) + @opts[:jagB])/2\n diff = (Distribution::Normal.rng(0,sd).call)\n int += diff\n #---------------------------------------------\n end\n\n #-------------mz wobble-----------------------\n wobble_mz = nil\n if int > 0\n wobble_int = wobA*int**wobB\n wobble_mz = Distribution::Normal.rng(mzmu,wobble_int).call\n if wobble_mz < 0\n wobble_mz = 0.01\n end\n end\n #---------------------------------------------\n\n\n int = int*(predicted_int*(relative_abundances_int*10**-2)) * sy\n if int > low.abs and wobble_mz > 0\n @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL,#{core_idx})\"\n# @db.execute \"INSERT INTO spectra VALUES(#{@cent_id},#{pep_id},#{rt},#{wobble_mz},#{int},NULL)\"\n @cent_id += 1\n if @max_mz < wobble_mz\n @max_mz = wobble_mz\n end\n end\n end\n index += 1\n end\n end",
"def update(point)\n\t\t\t\t\n\t\t\tend",
"def fetch_price_points\n\n return error_with_go_to(\n 'tm_b_4',\n 'aux_chain_id_not_found',\n GlobalConstant::GoTo.token_setup\n ) unless @token[:aux_chain_id].present?\n aux_chain_id = @token[:aux_chain_id]\n\n price_points = KitSaasSharedCacheManagement::OstPricePoints.new([aux_chain_id]).fetch\n @api_response_data[:price_points] = price_points[aux_chain_id]\n success\n\n end",
"def ramping_curve\n Curve.new(load_curve.each_cons(2).map { |a, b| (b - a).abs })\n end",
"def initialize_points\n self.current_points = 0\n self.expiring_points = 0\n end",
"def calculate (bs, ap, buffer)\r\n\t\tpair_key = \"#{bs}-#{ap}\"\r\n\t\t@price_histogram[pair_key] = {} if !@price_histogram[pair_key]\r\n\t\t@price_histogram_topx[pair_key] = [] if !@price_histogram_topx[pair_key]\r\n\t\t\r\n\t # age histograms\r\n\t @price_histogram[pair_key].each do |k,v|\r\n\t \t@price_histogram[pair_key][k] = v * ap\r\n\t end\r\n\t # age histograms in top10 list\r\n\t @price_histogram_topx[pair_key].each do |t|\r\n\t \tt[1] = t[1] * ap\r\n\t end\r\n\t \t\r\n\t # calculate which bucket in the histogram the price belongs to\r\n\t bucket = (buffer[P].close / bs).to_i * bs\r\n\t # increase the bucket counter\r\n\t @price_histogram[pair_key][bucket] = (@price_histogram[pair_key][bucket] ? @price_histogram[pair_key][bucket] : 0) + 1\r\n\t\t# if the bucket belongs to the top10 list, increase the counter there too\r\n\t\tcorrected = false\r\n\t\t@price_histogram_topx[pair_key].each do |t|\r\n\t\t\tif t[0] == bucket\r\n\t\t\t\tt[1] = @price_histogram[pair_key][bucket]\r\n\t\t\t\tcorrected = true\r\n\t\t\t\tbreak\r\n\t\t\tend\r\n\t\tend\r\n\t\t\r\n\t\t# add the bucket to the top 10 (if we haven't increased an existing one)\r\n\t\tif !corrected\r\n\t\t\t@price_histogram_topx[pair_key].push([bucket,@price_histogram[pair_key][bucket]])\r\n\t\tend\r\n\t\t# re-sort the top10 prices by counter\r\n\t\t@price_histogram_topx[pair_key] = @price_histogram_topx[pair_key].sort_by { |k| -1 * k[1] }\r\n\t\t# chop off the last element to keep top10 array at the right length\r\n\t\tif @price_histogram_topx[pair_key].count > 10\r\n\t\t\t@price_histogram_topx[pair_key].pop\r\n\t\tend\r\n\t\t\r\n\t\t# is there a signal? compare current & previous bucket...\r\n\t\tbucket_current = (buffer[P].close / bs).to_i * bs\r\n\t\tbucket_previous = (buffer[P-1].close / bs).to_i * bs\r\n\t\t# ... if exiting a top10 bucket and entering a regular one - we have a signal!\r\n\t\tif bucket_current != bucket_previous && @price_histogram_topx[pair_key].map{ |t| t[0] }.include?(bucket_previous) && !@price_histogram_topx[pair_key].map{ |t| t[0] }.include?(bucket_current)\r\n\t\t\tif bucket_current > bucket_previous\r\n\t\t\t\treturn \"b\"\r\n\t\t\telse\r\n\t\t\t\treturn \"s\"\r\n\t\t\tend\r\n\t\telse\r\n\t\t\treturn \"h\"\r\n\t\tend\r\n\tend",
"def calculate_component_pricing\n purchase_price = BigDecimal.new(\"0\")\n price = BigDecimal.new(\"0\")\n margin = BigDecimal.new(\"0\")\n # Safeguard to prevent calculation on straightforward simple products\n if componentized? \n self.product_sets.each do |ps|\n # Components can disappear if their supply items disappear.\n # This is handled more elegantly by disabling these components from outside\n # when this occurs, but let's check for this here just to be safe.\n unless ps.component.nil?\n purchase_price += ps.purchase_price # Convenience method that does ps.quantity * ps.component.purchase_price\n end\n end\n\n margin = (purchase_price / BigDecimal.new(\"100.0\")) * self.applicable_margin_percentage_for_price(purchase_price) # Must not call through self.margin_percentage, because otherwise an infinite loop occurs\n gross_price = purchase_price + margin\n margin = BigDecimal.new(margin.to_s)\n gross_price = BigDecimal.new(gross_price.to_s)\n end\n @component_pricing ||= [gross_price, margin, purchase_price]\n return @component_pricing\n end",
"def add_product(p)\n \n raise \"This Flyer is readonly!\" if @readonly\n \n @now = now_with_offset\n \n # We compare the datetime the product was created with the current datetime\n # so that if we can use this object in other places (for example when converting from a csv file to JerkStore). It ensures that only products from a given datetime will appear in this flyer.\n tmp_now = p.datesummarized\n val_now = 0\n val_then = 0\n if (\"day\".eql?(self.timespan))\n val_now = @now.yday\n val_then = tmp_now.yday\n elsif (\"week\".eql?(self.timespan))\n val_now = @now.cweek\n val_then = tmp_now.cweek\n elsif (\"month\".eql?(self.timespan))\n val_now = @now.mon\n val_then = tmp_now.mon\n end\n \n #STDERR.puts \"Comparing #{val_now} to #{val_then} for #{ self.timespan }\"\n \n if (val_now == val_then)\n self.products.unshift(p) \n else\n nil\n end\n \n p\n end",
"def get_current_price\r\n if rank_two!=nil\r\n self.current_price= (rank_two.value + increment > rank_one.value ? rank_one.value : rank_two.value + increment)\r\n else\r\n self.current_price = self.minimal\r\n end\r\n\r\n end",
"def point_value\n return 500 if flush?\n return 300 if three_kind?\n return 200 if two_kind?\n return highest_card.numeric_rank\n 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 emit_points(metric, points, options= {})\n scope = override_scope options\n\n points.each do |p|\n p[0].kind_of? Time or raise 'Not a Time'\n p[0] = p[0].to_i\n p[1] = p[1].to_f # TODO: stupid to_f will never raise an exception\n end\n\n @metric_svc.submit(metric, points, scope, options)\n end",
"def calculate\n y = 0\n x = 0.1\n while x % 1 != 0\n x = (@price.to_f - @stamp1.to_f * y) / @stamp2.to_f\n y += 1\n end\n y -= 1\n @stamp1 = y.round(0).to_s # 3 cent stamps\n @stamp2 = x.round(0).to_s # 5 cent stamps\n end",
"def pedal_faster increase_by\n @speed = @speed + increase_by\n end",
"def curtailment_curve(demand)\n return zeroed_profile if @curtailment.zero?\n\n useable_profile.map.with_index do |curtailed_factor, frame|\n uncurtailed = demand * @profile[frame]\n uncurtailed - (demand * curtailed_factor)\n end\n end",
"def move_points(hash)\n\n\t\tpoints = Hash.new\n\n\t\tgc_hash = hash.select { |k,v| k.to_s.include?('gc') }\n\t\toc_hash = gc_hash.select { |k,v| v.include?('OC') }\n\n\t\t# Calculate OC count to calculate probablity.\n\t\tpoints[:oc_enumerator] = prob_points(oc_hash)\n\t\tpoints[:oc_probability] = return_rational(points[:oc_enumerator]).to_f\n\t\tpoints[:dc] = calculate_gc_dc_roll_probability(points[:oc_enumerator])\n\n\t\t# Calculate TT Roll in GC\n\t\tpoints[:gc_tt_enumerator] = calculate_gc_tt_roll_probability(hash)\n\t\tpoints[:gc_tt_roll] = return_rational(calculate_gc_tt_roll_probability(hash))\n\t\t\n\t\t# Create Symbols for Points\n\t\tfor i in 2..12 do\n\t\t\tdc_points = \"dc%02d_points\" % i\n\t\t\tpoints[dc_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\t\t\n\t\tpoints[:reverse] = 0\n\t\tpoints[:specialty_roll_probability_in_oc] = 0\n\n \t\tfor i in 1..6 do\n\t\t\ts_points = \"s#{i}_points\"\n\t\t\tpoints[s_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n \t\tpoints[:s_roll_prob_dq] = 0\n\t\tpoints[:s_roll_prob_pa] = 0\n\t\tpoints[:s_roll_prob_sub] = 0\n\t\tpoints[:s_roll_prob_xx] = 0\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_points = \"oc%02d_points\" % i\n\t\t\tpoints[oc_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_dq = \"oc%02d_dq\" % i\n\t\t\tpoints[oc_dq.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_pa = \"oc%02d_pa\" % i\n\t\t\tpoints[oc_pa.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_sub = \"oc%02d_sub\" % i\n\t\t\tpoints[oc_sub.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\toc_xx = \"oc%02d_xx\" % i\n\t\t\tpoints[oc_xx.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\t\t\n \t\tpoints[:oc_ropes_roll_probability] = 0\n \t\tpoints[:ropes_s_roll_probability] = 0\n\n \t\t# TODO: Refactor this into one method\n \t\tfor i in 2..12 do\n\t\t\tr_points = \"ro%02d_points\" % i\n\t\t\tpoints[r_points.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_dq = \"ro%02d_dq\" % i\n\t\t\tpoints[r_dq.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_pa = \"ro%02d_pa\" % i\n\t\t\tpoints[r_pa.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_sub = \"ro%02d_sub\" % i\n\t\t\tpoints[r_sub.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\t# TODO: Refactor this into one method\n\t\tfor i in 2..12 do\n\t\t\tr_xx = \"ro%02d_xx\" % i\n\t\t\tpoints[r_xx.to_sym] = 0\n\t\t\ti += 1\n\t\tend\n\n\t\tpoints[:sub_numerator] = 0\n\t\tpoints[:tag_save_numerator] = 0\n\n\t\t# Determine Points for DC Rolls\n\t\tdc_hash = hash.select { |k,v| k.to_s.include?('dc') }\n\t\tdc_hash.each { | k,v|\n\t\t\tif v == \"A\"\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_A\n\t\t\telsif v == \"C\"\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_C\n\t\t\telse\n\t\t\t\tpoints[\"#{k}_points\".to_sym] = DC_B\n\t\t\tend\n\t\t}\n\n\t\t# Calculate Reverse Roll in DC\n\t\treverse_roll = 0\n\t\tr_hash = hash.select { |k,v| k.to_s.include?('dc') && v.downcase.include?('reverse') }\n\t\tpoints[:reverse] = prob_points(r_hash)\n\n\t\t# Determine (S) Points\n\t\tpoints[:s1_points] = hash[:s1].split[0].to_i\n \t\tpoints[:s2_points] = hash[:s2].split[0].to_i\n \t\tpoints[:s3_points] = hash[:s3].split[0].to_i\n \t\tpoints[:s4_points] = hash[:s4].split[0].to_i\n \t\tpoints[:s5_points] = hash[:s5].split[0].to_i\n \t\tpoints[:s6_points] = hash[:s6].split[0].to_i\n\n \t\to_moves = hash.select { |k,v| k.to_s.include?('oc') }\n \t\to_moves.each { |k,v|\n \t\t\tkey = \"#{k}_points\".to_sym\n \t\t\tm = remove_move(v)\n \t\t\tpoints[key] = m\n \t\t}\n\n \t\tr_moves = hash.select { |k,v| k.to_s.include?('ro') }\n \t\tr_moves.each { |k,v|\n \t\t\tkey = \"#{k}_points\".to_sym\n \t\t\tm = remove_move(v)\n \t\t\tpoints[key] = m\n \t\t}\n\n \t\t# Get Specialty Roll Numerator in OC\n \t\ts = hash.select { |k,v| k.to_s.include?('oc') && v.include?('(S)') }\n \t\tpoints[:specialty_roll_enumerator_in_oc] = prob_points(s)\n \t\tpoints[:specialty_roll_probability_in_oc] = return_rational(points[:specialty_roll_enumerator_in_oc])\n\n \t\t# Get Specialty Roll Probability-DQ (x/6)\n \t\tpoints[:s_roll_prob_dq] = get_s_extra_values(hash, '(DQ)')\n \t\tpoints[:s_roll_prob_pa] = get_s_extra_values(hash, 'P/A')\n\t\tpoints[:s_roll_prob_sub] = get_s_extra_values(hash, '*')\n\t\tpoints[:s_roll_prob_xx] = get_s_extra_values(hash, '(xx)')\n \t\t\t\n\t\t# Find DQ, P/A, * and XX Values in OC and Ropes\n\t\t\n \t\tdq_hash = create_value_hash(hash, \"(DQ)\")\n \t\tpa_hash = create_value_hash(hash, \"P/A\")\n \t\tsub_hash = create_value_hash(hash, \"*\")\n \t\txx_hash = create_value_hash(hash, \"(xx)\")\n\n \t\tdq_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_dq\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n\t\tpa_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_pa\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t} \t\n\n \t\tsub_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_sub\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n \t\txx_hash.each { |k,v| \n \t\t\tkey = k.to_s + \"_xx\"\n \t\t\tpoints[key.to_sym] = 1\n \t\t}\n\n \t\t# Determine Ropes Roll Enumerator\n \t\toc_ropes_hash = hash.select { |k,v| v == 'Ropes' }\n\n \t\tpoints[:oc_ropes_roll_probability] = prob_points(oc_ropes_hash)\n\n \t\t# Determine Enumerator of (S) rolls in Ropes\n \t\tropes_s_hash = hash.select { |k,v| k.to_s.include?(\"ro\") && v.include?('(S)') }\n \t\tpoints[:ropes_s_roll_probability] = prob_points(ropes_s_hash)\n\n \t\tpoints[:prioritys] = hash[:prioritys].to_i\n \t\tpoints[:priorityt] = hash[:priorityt].to_i\n\n \t\tpoints[:sub_numerator] = sub_tag_numerator(hash[:sub])\n \t\tpoints[:tag_save_numerator] = sub_tag_numerator(hash[:tag])\n\n \t\tpoints[:sub_prob] = return_rational(points[:sub_numerator]).to_f\n \t\tpoints[:tag_prob] = return_rational(points[:tag_save_numerator]).to_f\n\n\t\treturn points\n\tend",
"def process_par(action)\n share_price = action.share_price\n corporation = action.corporation\n entity = action.entity\n raise GameError, \"#{corporation.name} cannot be parred\" unless @game.can_par?(corporation, entity)\n\n @game.stock_market.set_par(corporation, share_price)\n share = @game.share_by_id(\"#{corporation.name}_0\")\n buy_shares(entity, share.to_bundle)\n @game.after_par(corporation)\n track_action(action, action.corporation)\n end",
"def get_one_product_service_kpi(products,services,from,to)\n size = products.size\n 0.upto(size -1) do |i|\n res = get_a_product_no_service_normalPv_delayPv(@db,\"count_kpi\",products[i],[services[i]],from,to,true)[0]\n normalPv = res[\"normalPv\"]\n delayPv = res[\"delayPv\"]\n totalPv = normalPv + delayPv\n kpi = normalPv/(totalPv*1.0)*100\n puts \"Product/service: #{products[i]}/#{services[i]}\"\n puts \"KPI: #{per(kpi)}\\t PageView: #{common(totalPv)}\\t normalPv: #{common(normalPv)}\\t delayPv: #{common(delayPv)}\" \n end\n end",
"def assign_experience_points\n # publish event (from grade) - Deduce points awarded from draft or updated attribute.\n if workflow_state == 'published' &&\n (workflow_state_was == 'graded' || workflow_state_was == 'submitted')\n self.points_awarded ||= draft_points_awarded\n self.draft_points_awarded = nil\n end\n end",
"def last_available_dispatchable(point)\n dispatchables = @dispatchables.at_point(point)\n\n dispatchables.reverse_each do |producer|\n return producer if producer.max_load_at(point).positive?\n end\n\n nil\n end",
"def at_time(time)\n resource = @initial\n\n puts \"[START] initial: #{initial}\" if COPIOUS_DEBUGGING\n puts \"[START] time: #{time}\" if COPIOUS_DEBUGGING\n\n if intervals_at_time(@harvesters, time).size > 1\n generate_pairs(intervals_at_time(@harvesters, time)).each_with_index do |pair, index|\n puts \"[DEBUG] #{index}: STARTING LOOP\" if COPIOUS_DEBUGGING\n start_time = pair[0]\n next_time = pair[1]\n puts \"#{index}: start_time: #{start_time}\" if COPIOUS_DEBUGGING\n\n harvesters = @harvesters[start_time]\n puts \"#{index}: harvesters: #{harvesters}\" if COPIOUS_DEBUGGING\n\n period = next_time - start_time\n puts \"#{index}: period: #{period}\" if COPIOUS_DEBUGGING\n\n harvested = time_to_resource(period, harvesters)\n resource += harvested\n puts \"#{index}: harvested: #{harvested}\" if COPIOUS_DEBUGGING\n\n consumed = consumed_in_interval(start_time, next_time)\n resource -= consumed\n puts \"#{index}: consumed: #{consumed}\" if COPIOUS_DEBUGGING\n\n puts \"#{index}: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n else\n resource -= consumed_at_time(0)\n puts \"0: resource: #{resource}\" if COPIOUS_DEBUGGING\n end\n\n if resource < 0\n raise(InvalidEconomyError, \"The Starcraft economy does not allow deficit spending (deficit of #{resource} #{@type} at #{time} seconds).\")\n end\n\n puts \"[FINISH] at_time: #{resource}\" if COPIOUS_DEBUGGING\n resource\n end",
"def keep_calculating\n self.max_price = broker.max_mortgage.price.to_i\n self.min_price = broker.min_mortgage.price.to_i\n self.rate = broker.max_mortgage.rate\n end",
"def demand_curve\n @demand_curve ||= CurveTools.add_curves(\n participants.users.reject(&:provides_price?).map(&:load_curve)\n )\n end",
"def set_points_earned\n if !self.action.has_custom_points?\n self.update(points_earned: self.action.point_value)\n end\n end",
"def cost_global_pheromone_at_time(value_of_objective)\n\t# where q = [time=10, cost= 10_000, quality=0.0005]\n\t((1 - GLOBAL_EVAPORATION_RATE) * pheromone_at_t_minus_1) + cost_changed_pheromone(value_of_objective)\nend",
"def load_adjusted_input_efficiency\n producer = participant.producer\n\n efficiency = input_efficiency\n\n sum_input = 0.0\n sum_eff = 0.0\n\n Fever::FRAMES.times do |index|\n input = producer.source_at(index)\n\n sum_input += input\n sum_eff += input * efficiency[index]\n end\n\n sum_input.zero? ? 0.0 : sum_eff / sum_input\n end",
"def before_trade(options={})\n stock = options[:stock]\n quantity = options[:quantity] # + for buy, - for sell\n vfactor = volume_factor(stock)\n\n current_price = options[:price]\n total_execution_price = (1..(quantity.abs)).inject(0) do |total, _|\n # We have to stagger the price calculations by one for buy vs. sell,\n # to include the same set of prices when buying as selling.\n if quantity > 0 # buy\n price = current_price\n current_price *= vfactor\n total + price\n else # sell\n total + (current_price /= vfactor)\n end\n end\n average_execution_price = total_execution_price / quantity.abs\n\n {:price => average_execution_price}\n end",
"def calc(pg_value)\n @calc_time += pg_value\n addLogEntry(\"P/G #{pg_value.round(2)}\")\n # puts \"calc_time #{calc_time} calc_mileage #{@calc_mileage}\"\n end",
"def load_factor\n puts \"load_factor: #{@values} / #{@size}\"\n (@values + 0.0) / @size\n end",
"def determine_loads_state\n\n loads = @marketo.loads(:user => GOODDATA_USER,\n :pass => GOODDATA_PASSWORD,\n :project => GOODDATA_PROJECT,\n :marketo_client => @marketo)\n\n if loads.available?\n\n file = loads.available.first\n load = loads.create :name => file\n\n load.execute\n\n # Data from the job can now be accessed ARRAY load.storage\n # load.storage\n\n # Increment the load by one day if it is time related.\n\n case load.json[:method]\n\n when 'get_changes'\n\n one_day = (24*60*60)\n oca = load.arguments[:oldest_created_at]\n lca = load.arguments[:latest_created_at]\n\n load.arguments[:oldest_created_at] = (Time.parse(oca) + one_day).to_s\n load.arguments[:latest_created_at] = (Time.parse(lca) + one_day).to_s\n\n # If the latest time is later then today kill the load.\n if Time.parse(lca) > Time.now\n\n load.terminate\n\n determine_loads_state\n\n # Otherwise save the load and resume additional loads.\n else\n\n load.save\n\n determine_loads_state\n\n end\n\n when 'get_multiple'\n\n determine_loads_state\n\n else\n raise 'Unable to determine lead type (\"get_multiple\"/\"get_changes\")!'\n\n end\n\n else\n\n load = @queue.pop\n loads.create load\n\n determine_loads_state\n\n end\n\nend",
"def placeBuyOrder(epic:,size:,price:,params: {} )\n\n buy_order_params = {\n :\"epic\" => epic,\n :\"size\" => size,\n :\"level\" => price,\n :\"type\" => \"STOP\"\n }\n\n placeOrder(params: buy_order_params.merge(params))\n\n end",
"def calculate_genre\n calculate_name_embedded_points +\n calculate_points_from_peers\n end",
"def tally( p, first, x, lgx, prod, found )\n mult, log = 1, (lgx / Math.log( p[first] )).floor\n\n while 0 <= log\n pm = prod * mult\n break if pm > x\n\n if first < p.size - 1\n tally( p, first + 1, x, lgx, pm, found )\n else\n found[pm] = true\n end\n\n mult *= p[first]\n log -= 1\n end\n \n found.size\n end",
"def calculate_from_test_point(target_point)\n dist1 = calculate_distance(target_point, @point1)\n dist2 = calculate_distance(target_point, @point2)\n dist3 = calculate_distance(target_point, @point3)\n\n calculate_from_distances(dist1, dist2, dist3)\n end",
"def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end",
"def trade(ticker, day)\n # this day's price\n price = @account.broker.exchange.quote(ticker, day)\n\n# if @last_purchase.key? ticker # If we've purchased this stock before, we continue with Dr. Rushton's trading rule.\n if @account.portfolio[ticker] == 0 # try to buy the given ticker\n last_hold_time = if @last_purchase[ticker][:buy_day] && @last_purchase[ticker][:sell_day]\n @last_purchase[ticker][:buy_day] - @last_purchase[ticker][:sell_day]\n else\n 0\n end\n \n # Wait for a time interval equal to gamma * HT to pass (cool-down period) OR Price < P to buy more\n if(!@last_purchase.key?(ticker) || \n price < @last_purchase[ticker][:price] || \n @last_purchase[ticker][:sell_day] - day >= @gamma * last_hold_time)\n s = @account.buy_amap(ticker, day, @amount_per_company)\n @last_purchase[ticker] = {price: price, buy_day: day}\n puts \"bought #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n end\n else # try to sell our holdings of the given ticker\n # compute t, the return multiplier, given the interval between now and last purchase of the given stock (ticker)\n t = @fn_t.call(@last_purchase[ticker][:buy_day] - day)\n\n # compute alpha, given the value t, to determine the percentage gain multiplier\n alpha = @fn_alpha.call(t)\n\n puts \"t = #{t}\", \"alpha = #{alpha}\" if $DEBUG\n\n puts \"price of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date} is #{price}\" if $DEBUG\n\n if(price > (1.0 + alpha) * @last_purchase[ticker][:price])\n s = @account.sell_all(ticker, day)\n @last_purchase[ticker][:sell_day] = day\n puts \"sold #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n end\n end\n# else # We use SMA to make our initial purchase of each stock\n# # compute average over number of days\n# avg = average_price(ticker, day)\n\n # if price > avg -> price - avg = positive\n # price < avg -> price - avg = negative\n # price = avg -> price - avg = 0\n# @price_relation_to_average[\"#{ticker}#{day}\"] = price - avg\n\n # decide whether the price has just upcrossed or downcrossed the MA line\n# if(price > avg && @price_relation_to_average[\"#{ticker}#{day + 1}\"] < 0) # upcross - BUY as much as possible\n# s = @account.buy_amap(ticker, day, @amount_per_company)\n# @last_purchase[ticker] = {price: price, buy_day: day}\n# puts \"bought #{s} shares of #{ticker} on #{@account.broker.exchange.eod(ticker, day).date}\" if $DEBUG\n# end\n# end\n \n puts \"account: #{@account.to_s(day)}\" if $DEBUG\n end",
"def total_points\n Rails.cache.fetch(\"#{__method__}/#{cache_key_with_version}\") do\n points.sum(:value)\n end\n end",
"def price_definition_set_by_components(quantity,value_quarter_sheet,component,color_mode,options={})\n accumulate_t = 0\n accumulate_tr = 0\n \n \n if options[:by_price_definition_set]\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_id = ? AND component_type = ?\",component.id,component.class.to_s])\n if result\n accumulate_t = result.amount_t*quantity\n accumulate_tr = result.amount_tr*quantity\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n else\n result = eval(\"raw_material_price_definition_set_#{color_mode}_by_components\").first(:conditions => [\"component_type = ? AND base_amount = ?\",component.class.to_s,true])\n accumulate_t = result.amount_t*value_quarter_sheet\n accumulate_tr = result.amount_tr*value_quarter_sheet\n end\n {:t =>accumulate_t.round(2),:tr => accumulate_tr.round(2)}\n 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 time_in_months = 0.0\n \n case @population_density\n when 1..49 then time_in_months += 2.5\n when 50..99 then time_in_months += 2\n when 100..149 then time_in_months += 1.5\n when 150..199 then time_in_months += 1.0\n else time_in_months += 0.5\n end\n\n puts \" and it will spread across the state in #{time_in_months} months.\\n\\n\"\n\n end"
] |
[
"0.6321755",
"0.60812825",
"0.5981526",
"0.59455174",
"0.58839643",
"0.58198434",
"0.58046997",
"0.56684047",
"0.5536908",
"0.54751503",
"0.534222",
"0.52027094",
"0.51183224",
"0.50811666",
"0.5038798",
"0.501111",
"0.49826777",
"0.49811327",
"0.497791",
"0.49714407",
"0.494791",
"0.48871297",
"0.4836619",
"0.48096445",
"0.48028874",
"0.47829923",
"0.47595954",
"0.47362712",
"0.47285858",
"0.4717385",
"0.47122258",
"0.4684081",
"0.46806744",
"0.4660276",
"0.46357104",
"0.46342626",
"0.46303326",
"0.46063253",
"0.46027038",
"0.46000975",
"0.45878747",
"0.4583329",
"0.4567887",
"0.453969",
"0.44833758",
"0.44747517",
"0.44740322",
"0.44722843",
"0.44626856",
"0.446011",
"0.446011",
"0.4445533",
"0.4444912",
"0.44408795",
"0.44372025",
"0.4436191",
"0.44341904",
"0.4429311",
"0.44283226",
"0.44240546",
"0.44187388",
"0.44172013",
"0.44130242",
"0.43888405",
"0.43884856",
"0.43772125",
"0.43735483",
"0.43733776",
"0.437114",
"0.43676612",
"0.43653622",
"0.43535224",
"0.43436503",
"0.43385208",
"0.4328385",
"0.43247512",
"0.43174824",
"0.43085054",
"0.43042678",
"0.43020207",
"0.428452",
"0.42787173",
"0.4278707",
"0.4272894",
"0.42555976",
"0.42547938",
"0.42542827",
"0.42517802",
"0.4251709",
"0.42484158",
"0.42405644",
"0.42370284",
"0.42142415",
"0.4210848",
"0.4210809",
"0.4198278",
"0.4195898",
"0.41896155",
"0.4188035",
"0.41875592"
] |
0.76092327
|
0
|
Some methods require full username and password rather than just auth token
|
def fully_authed?
!(user.nil? || password.nil?)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def token_auth(*args, &block); end",
"def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def authenticate(username, password)\n end",
"def basic_auth\n \"#{username}:#{access_token}\"\n end",
"def token\n authenticate_username_password || render_unauthorized\n end",
"def basic_auth\n {\n username: @username,\n password: @password\n }\n end",
"def http_auth_login\n # FIXME: Implement\n end",
"def authenticate(username = nil, password = nil)\n @username = username\n @password = password\n response = self.request('login', :authenticate, {username: @username, password: @password})\n @token = response[:token]\n end",
"def login\n #localhost:3000/api/login -u 'admin:password'\n authenticate_or_request_with_http_basic do |username, password|\n if username.include? '%40'\n email = username.gsub('%40','@');\n @user = User.find_by_email(email.downcase)\n else\n @user = User.find_by_username(username.downcase)\n end\n\n if @user && @user.authenticate(password)\n remember_token = RememberToken.create(token: User.encrypt(User.new_remember_token), user_id: @user.id, accessed_at: Time.now)\n respond_to do |format|\n format.json { render :json => remember_token }\n end\n end\n end\n end",
"def process_auth\n return if username.empty? || password.empty?\n \"#{username}:#{password}\"\n end",
"def auth email_or_token, password = nil\n password ? post(\"auth\", email: email_or_token, password: password) :\n post(\"auth/#{email_or_token}\")\n end",
"def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end",
"def http_login(username, password)\n @request.env['HTTP_AUTHORIZATION'] = \"Basic #{Base64.encode64(username << ':' << password)}\"\n end",
"def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend",
"def auth_param; end",
"def capable_plain_auth?; end",
"def auth(value); end",
"def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end",
"def authenticate(username, password)\n dest = \"#{base_url}/api/v#{api_version}/users/auth_token\"\n options = {\n userpwd: username + ':' + password,\n headers: { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }\n }\n response = Typhoeus.post(dest, options)\n unless response.options[:response_code] == 201\n raise AuthenticationError.new(response)\n end\n\n @auth_token = JSON.parse(response.response_body)['name']\n self\n end",
"def auth\n build_response(\"token\") do\n connection.post do |req|\n req.headers.delete(\"Authorization\")\n req.url \"auth/\"\n req.body = { username: username, password: password }.to_json\n end\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n (user = User.find_by_name(username)) != nil \\\n && user.password == Digest::SHA1.hexdigest(password)\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def api_auth\n creator = Creator.find_by(username: request.headers[:username])\n if creator && creator.authenticate(request.headers[:password])\n render json: { auth_token: encodeJWT(creator) }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end",
"def login_from_basic_auth\nauthenticate_with_http_basic do |username, password|\nself.current_user = User.authenticate(username, password)\nend\nend",
"def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if (!@user.nil?)\n if (!@user.valid_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end",
"def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if (!@user.nil?)\n if (!@user.valid_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == ENV['USERNAMEV'] && password == ENV['PASSWORDV'] \n end \n end",
"def auth\n end",
"def auth\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def basic_auth_token\n 'Basic ' + [\"#{username}:#{password}\"].pack('m').delete(\"\\r\\n\")\n end",
"def auth(username, password)\n @user = username\n @pass = password\n\n return self\n end",
"def http_auth_hash; end",
"def api_token\n if @token.nil?\n raise ArgumentError, 'username is missing' if username.blank?\n raise ArgumentError, 'password is missing' if password.blank?\n response = connection.post do |req|\n req.url '/Authentication/V2.0'\n req.headers['x-dnb-user'] = username\n req.headers['x-dnb-pwd'] = password\n end\n @token = response.headers['Authorization']\n end\n @token\n end",
"def authenticate_user!\n token, options = ActionController::HttpAuthentication::Token.token_and_options(request)\n\n super unless token == 'rbMmEeoH8RxRDyN24PQv'\n end",
"def auth(opts = {})\n query = QueryBuilder.new\n .options(:without_api_path)\n .with('/api/login')\n .header(:content_type,\n 'application/x-www-form-urlencoded')\n .data(j_username: opts[:username])\n .data(j_password: opts[:password])\n .build\n\n @token = post(query, raw: true)\n self.class.send(:headers, 'Authorization' => @token)\n\n @token\n end",
"def auth(username, password)\n @username, @password = username, password\n end",
"def auth_query\n \"?login=fcoury&token=8f700e0d7747826f3e56ee13651414bd\"\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"Fun!\") do |username, password|\n username == ENV[\"FUN_ADMIN_USER\"] && password == ENV[\"FUN_ADMIN_PASS\"]\n end\n end",
"def authenticate(username, password)\n @username = username\n @password = password\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |user_name, password|\n # Change these to username and password required\n user_name == \"shitlister\" && password == \"letmein\"\n end\n end",
"def authenticate(password)\n true\n end",
"def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end",
"def authenticate\n @shoonga = authenticate_or_request_with_http_basic do |username, password|\n username == \"4vght\" && password == \"we8vds\"\n end\nend",
"def login_by_token\n\n end",
"def basic_auth(*args, &block); end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end",
"def capable_login_auth?; end",
"def http_auth?; end",
"def authentication\n {:username => @username, :password => @password}\n end",
"def basic_auth(opts); end",
"def auth(user, password, domain = T.unsafe(nil)); end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n self.username == username && self.password == password\n end\n end",
"def token\n authenticated\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end",
"def auth\n {:basic_auth => {:username => id, :password => password}}\n end",
"def authenticate!(level = 0, methods: [:token])\n user =\n if methods.include?(:token) && valid_token?\n logger.info 'Auth using token'\n env['gritsos.auth.method'] = :token\n \n find_user_with_token env['HTTP_TOKEN']\n \n elsif methods.include?(:password) && valid_user?\n logger.info 'Auth using username and password'\n env['gritsos.auth.method'] = :password\n\n find_user params['username'], params[:password]\n else\n halt 400, 'A token or password is required for authentication'\n end\n\n halt 401 unless user # Unauthorized\n halt 403 unless user.privileged? # Forbidden\n \n env['gritsos.user'] = user\n end",
"def basic_auth\n authenticate_or_request_with_http_basic do |username, password|\n username == Rails.application.credentials.basic[:username] && \n password == Rails.application.credentials.basic[:password]\n end\n end",
"def login(username, password)\n return @@auth_token if defined?(@@auth_token) && @@auth_token\n reset_login(username, password)\n end",
"def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: 'demo1@g.com', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend",
"def request_token(auth, opts)\n case auth[:method]\n when 'token'\n auth_token(auth)\n when 'userpass'\n auth_userpass(auth, opts)\n else\n raise ValidationError, \"Unknown auth method: #{auth[:method]}\"\n end\n end",
"def authenticate_user_with_basic_auth!\n @username, @password = ActionController::HttpAuthentication::Basic::user_name_and_password(request)\n\n request_http_basic_authentication(ENV[\"REALM\"], \"An Authentication object was not found in the SecurityContext\") if @username.blank? || @password.blank?\n end",
"def Authentication\n call('', '')\n end",
"def http_basic_authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"mustang\" && password == 'mustang' #\"must@ngs0undm3l0n\"\n end\n end",
"def get_token(username, password, opts={})\n opts[:params] ||= {}\n opts[:params].merge!({\n :grant_type => grant_type,\n :username => username,\n :password => password\n })\n opts[:authenticate] ||= :headers\n method = opts.delete(:method) || :post\n make_request(method, @token_path, opts)\n end",
"def authenticate_using_http_basic\n return if current_user\n authenticate_with_http_basic do |email, password|\n signin = Session.new email: email, password: password\n auth = User.authenticate_signin signin\n self.current_user = auth unless auth.kind_of? Symbol\n end\n end",
"def authenticate\n authenticate_or_request_with_http_basic(\"algo\") do |username, password|\n username == \"dupa\" && password == \"dupa\"\n end\n end",
"def grab_token(username, password)\n cmd = `curl -X POST -H \"Content-Type: application/json\" -d '{\"email\":\"#{username}\",\"password\":\"#{password}\"}' #{ENV[\"FDA_REST_ENDPOINT\"]}/login --insecure -s`\n return cmd\n end",
"def authenticate!\n error!(\"401 Unauthorized\", 401) unless check_auth_token \n end",
"def login\n puts '--- LOGIN ---'\n puts username: params[:user][:username]\n puts password: params[:user][:password]\n # = 'escape'\n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n else\n render json: {status: 401, message: \"Unauthorized - Login\"}\n end\n end",
"def authenticate!(request)\n if @username and @password \n request.basic_auth @username, @password\n end\n end",
"def basic_auth(u, p)\n @auth = {:username => u, :password => p}\n end",
"def authenticate\n command = AuthenticateUser.call(params[:email].to_s.strip.downcase, params[:password])\n if command.success?\n @auth_token = command.result\n else\n render json: { error: command.errors }, status: :unauthorized\n end\n end",
"def authenticate(next_service, username, password = T.unsafe(nil)); end",
"def username_token?\n username && password\n end",
"def get_token(username, password, params = {}, opts = {})\n params = {'grant_type' => 'password',\n 'username' => username,\n 'password' => password}.merge(params)\n @client.get_token(params, opts)\n end",
"def authenticate\n @username = params[:username]\n @password = params[:password]\n user = User.find_by(username: @username)\n\n # NEED TO ADD THE PASSWORD VERIFICATION BACK IN\n if user && user.authenticate(@password)\n render json: { auth_token: user.generate_auth_token, user_id: user.id, user_name: user.name }\n else\n render json: { error: 'Invalid username or password' }, status: :unauthorized\n end\n end",
"def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end",
"def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end",
"def login_from_basic_auth\n authenticate_with_http_basic do |login, password|\n self.current_user = User.authenticate(login, password)\n end\n end",
"def basic_auth!(user = :username, pass = :password)\n @authenticates = :basic_auth\n @credentials = [user, pass]\n end",
"def authenticate\n authenticate_or_request_with_http_basic do |username, password|\n username == \"admin\" && password == \"123\"\n end\n end",
"def basic_auth(user, password, domain = T.unsafe(nil)); end",
"def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end",
"def authenticate\n authenticate_or_request_with_http_basic('Administration') do |username, password|\n username == 'igp' && password == 'ehkra!Q2w#e'\n end\n end"
] |
[
"0.7508128",
"0.7461789",
"0.7455585",
"0.7402264",
"0.73788977",
"0.7351924",
"0.734027",
"0.7333475",
"0.7330807",
"0.7279449",
"0.7247431",
"0.7243605",
"0.7224711",
"0.72111505",
"0.71989",
"0.71882564",
"0.7147553",
"0.71340126",
"0.7132361",
"0.7130672",
"0.7103286",
"0.71015704",
"0.70924574",
"0.7080847",
"0.70742655",
"0.7050467",
"0.7050467",
"0.70468366",
"0.7045934",
"0.7045934",
"0.7043346",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.7043307",
"0.70407325",
"0.7038814",
"0.7029281",
"0.702892",
"0.7019596",
"0.70091313",
"0.70087403",
"0.70056856",
"0.6992592",
"0.69778997",
"0.6968269",
"0.695879",
"0.6927072",
"0.6921968",
"0.6919136",
"0.6912093",
"0.6904102",
"0.6901091",
"0.6893446",
"0.68918777",
"0.68879306",
"0.6885644",
"0.68856215",
"0.6885616",
"0.6885413",
"0.6885413",
"0.68807423",
"0.68791103",
"0.6867739",
"0.68672526",
"0.68644977",
"0.68579257",
"0.6852114",
"0.68466556",
"0.68416595",
"0.6836108",
"0.68354845",
"0.683393",
"0.6833659",
"0.6833429",
"0.68320566",
"0.68275446",
"0.68191946",
"0.6818967",
"0.6805248",
"0.68049645",
"0.68011934",
"0.6797336",
"0.6787687",
"0.67863256",
"0.67863256",
"0.67856735",
"0.678413",
"0.67757493",
"0.677247",
"0.6772426"
] |
0.0
|
-1
|
create a new secondary_publication_number
|
def create
@secondary_publication_number = SecondaryPublicationNumber.new(params[:secondary_publication_number])
@secondary_publication_number.save
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @secondary_publication_number = SecondaryPublicationNumber.find(params[:id])\n\t@secondary_publication_number.update_attributes(params[:secondary_publication_number])\n end",
"def create\n\t@secondary_publication = SecondaryPublication.new(params[:secondary_publication])\n \t@secondary_publication.display_number = @secondary_publication.get_display_number(params[:study_id])\n\t@secondary_publication.study_id = params[:study_id]\n\t@study_id = @secondary_publication.study_id\n\t@secondary_publication.save\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id =>params[:study_id]})\t\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\n if @saved = @secondary_publication.save\n\t\t\n\t# create newly specified outcomes\n\tif !params[:secondary_publication_numbers_attributes].nil?\n\tparams[:secondary_publication_numbers_attributes].each do |item|\n\t\t@spn = SecondaryPublicationNumber.new\n\t\t@spn.number = item[1][:number]\n\t\t@spn.number_type = item[1][:number_type]\n\t\t@spn.secondary_publication_id = @secondary_publication.id\n\t\t@spn.save\t\n\tend\t\n\tend\t\t\n\t\t@secondary_publication = SecondaryPublication.new\n\t\t@message_div = \"saved_item_indicator_2\"\n else\n \tproblem_html = create_error_message_html(@secondary_publication.errors)\n\t\tflash[:modal_error] = problem_html\n end\n\t@error_div = \"validation_message\"\n end",
"def new\n @secondary_publication_number = SecondaryPublicationNumber.new\n\t@secondary_publication_number.save\n\t@study = Study.find(params[:study_id])\t\n end",
"def create\n @primary_publication_number = PrimaryPublicationNumber.new(params[:primary_publication_number])\n\n respond_to do |format|\n if @primary_publication_number.save\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully created.') }\n format.xml { render :xml => @primary_publication_number, :status => :created, :location => @primary_publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication_number = PublicationNumber.new(params[:publication_number])\n\n respond_to do |format|\n if @publication_number.save\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully created.') }\n format.xml { render :xml => @publication_number, :status => :created, :location => @publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end",
"def create_publication(record, wssr)\n contrib = Contribution.new(\n author_id: author.id,\n cap_profile_id: author.cap_profile_id,\n featured: false, status: 'new', visibility: 'private'\n )\n Publication.create!( # autosaves contrib\n active: true,\n pub_hash: record.pub_hash,\n wos_uid: record.uid,\n pubhash_needs_update: true,\n contributions: [contrib]\n ) do |pub|\n pub.web_of_science_source_record = wssr if wssr.publication.blank?\n end\n end",
"def add_publication(pub_id)\n add_actions \"AddPublication(#{pub_id})\"\n end",
"def create\n @primary_publication = PrimaryPublication.new(params[:primary_publication])\n\t@primary_publication.study_id = params[:study_id]\n respond_to do |format|\n if @primary_publication.save\n\t\tformat.js{\n\t\t\trender :update do |page|\n\t\t\t\tsaved_html = \"<div class='success_message'>Saved Successfully!</div><br/>\"\n\t\t\t\tpage.replace_html 'primary_pub_save_message', saved_html\n\t\t\tend\n\t\t}\n\t\telse\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def secondary_id=(v)\n @secondary_id = alma_string v\n end",
"def create_affiliation!(publication_version_id:, person:, position:, reviewed_at: nil, reviewed_publication_version_id: nil)\n p2p = People2publication.create({\n publication_version_id: publication_version_id,\n person_id: person[:id],\n position: position,\n reviewed_at: reviewed_at,\n reviewed_publication_version_id: reviewed_publication_version_id\n })\n if p2p.errors.any?\n raise (V1::ControllerError.new(\n code: ErrorCodes::VALIDATION_ERROR,\n errors: { authors: p2p.errors.values }\n ))\n end\n if person[:departments].present?\n person[:departments].each.with_index do |department, j|\n d2p2p = Departments2people2publication.create({people2publication_id: p2p.id, department_id: department[:id], position: j + 1})\n if d2p2p.errors.any?\n raise (V1::ControllerError.new(\n code: ErrorCodes::VALIDATION_ERROR,\n errors: { authors: d2p2p.errors.values }\n ))\n end\n end\n end\n end",
"def new\n @primary_publication_number = PrimaryPublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication_number }\n end\n end",
"def create\n init = params[:distrik][:name][0]\n distributor = Distributor.find_by_name(params[:distributor_id])\n distrik_number = Distrik.create_number(params)\n @distrik = Distrik.new(distrik_params.merge(:distributor_id => (distributor.id rescue nil)))\n if @distrik.save\n flash[:notice] = t(:successfully_created)\n redirect_to distriks_path\n else\n flash[:error] = @distrik.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def InsertPublication (publication)\n puts \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n raise \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n thePub = nil\n medline = Bio::MEDLINE.new(publication) # convert retrieved format into the medline format\n reference = medline.reference\n thePub = Abstract.find_by_pubmed(reference.pubmed)\n begin \n if thePub.nil? || thePub.id < 1 then\n thePub = Abstract.create!(\n :endnote_citation => reference.endnote, \n :abstract => reference.abstract,\n :authors => reference.authors.join(\"\\n\"),\n :full_authors => medline.full_authors,\n :publication_date => medline.publication_date,\n :electronic_publication_date => medline.electronic_publication_date,\n :deposited_date => medline.deposited_date,\n :status => medline.status,\n :publication_status => medline.publication_status,\n :title => reference.title,\n :publication_type => medline.publication_type[0],\n :journal => medline.full_journal[0..253],\n :journal_abbreviation => medline.ta, #journal Title Abbreviation\n :volume => reference.volume,\n :issue => reference.issue,\n :pages => reference.pages,\n :year => reference.year,\n :pubmed => reference.pubmed,\n :url => reference.url,\n :mesh => reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n )\n else\n if thePub.publication_date != medline.publication_date || thePub.status != medline.status || thePub.publication_status != medline.publication_status then\n thePub.endnote_citation = reference.endnote\n thePub.publication_date = medline.publication_date\n thePub.electronic_publication_date = medline.electronic_publication_date\n thePub.deposited_date = medline.deposited_date\n thePub.publication_status = medline.publication_status\n thePub.status = medline.status\n thePub.volume = reference.volume\n thePub.issue = reference.issue\n thePub.pages = reference.pages\n thePub.year = reference.year\n thePub.pubmed = reference.pubmed\n thePub.url = reference.url\n thePub.mesh = reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n thePub.save!\n end\n # HandleMeshTerms(thePub.mesh, thePub.id)\n end\n rescue ActiveRecord::RecordInvalid\n if thePub.nil? then # something bad happened\n puts \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n raise \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n end\n end \n thePub\nend",
"def create\n @publication = Publication.new()\n pubmed_id = params[:publication][:pubmed_id]\n pubmed_id = nil if pubmed_id.blank?\n doi = params[:publication][:doi]\n doi = nil if doi.blank?\n result = get_data(@publication, pubmed_id, doi)\n @publication.contributor = current_user \n respond_to do |format|\n if @publication.save\n result.authors.each do |author|\n pa = PublicationAuthor.new()\n pa.publication = @publication\n pa.first_name = author.first_name\n pa.last_name = author.last_name\n pa.save\n end\n \n #Make a policy\n policy = Policy.create(:name => \"publication_policy\", :sharing_scope => 3, :access_type => 1, :use_custom_sharing => true, :contributor => current_user)\n @publication.asset.policy = policy\n policy.save\n @publication.asset.save\n #add managers (authors + contributor)\n @publication.asset.creators.each do |author|\n policy.permissions << Permission.create(:contributor => author, :policy => policy, :access_type => 4)\n end\n #Add contributor\n @publication.asset.policy.permissions << Permission.create(:contributor => @publication.contributor.person, :policy => policy, :access_type => 4)\n \n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(edit_publication_url(@publication)) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @online_student = OnlineStudent.new(params[:online_student])\n latest_id = OnlineStudent.maximum('id')\n if latest_id.nil?\n cur_id = 1\n else\n cur_id = latest_id + 1\n end\n\n # Generate Application Number\n @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n # @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n\n respond_to do |format|\n if @online_student.save\n format.html { redirect_to @online_student, notice: 'Your Application was successfully submitted.' }\n format.json { render json: @online_student, status: :created, location: @online_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @online_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end",
"def create\n init = params[:distributor][:name][0]\n area_id = Area.find_by_name(params[:area_id])\n distributor_number = Distributor.create_number(params)\n @distributor = Distributor.new(distributor_params.merge(:area_id => (area_id.id rescue nil)))\n if @distributor.save\n flash[:notice] = t(:successfully_created)\n redirect_to distributors_path\n else\n flash[:error] = @distributor.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def secondary_phone_number\n \"[SECONDARY_PHONE_NUMBER]\"\n end",
"def create_publisher\n pub = Publisher.new(description: 'Your description goes here!', user: self)\n pub.save\n end",
"def create_new_version!\n if self.new?\n raise DataCatalog::Error, \"document must be saved before versioning\"\n end\n unless self.id\n raise DataCatalog::Error, \"expected document to have an id\"\n end\n copy = self.dup\n copy.id = BSON::ObjectID.new.to_s\n copy.next_id = self.id\n copy.save!\n self.previous_id = copy.id\n copy\n end",
"def post(amount, secondary, description, journal=nil)\n journal ||= Journal.new\n journal.description = description\n\n reverse = !(self.debit ^ secondary.debit)\n\n journal.postings << self.postings.build(:amount => amount)\n journal.postings << secondary.postings.build(:amount => (reverse ? -amount : amount))\n journal.save!\n journal\n end",
"def increment_public_id\n if self.public_id.blank?\n self.public_id = Compound.exists? ? Compound.order(:public_id).last.public_id.next : 'RDDB00001'\n end\n end",
"def new\n @publication_number = PublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication_number }\n end\n end",
"def create\n @student_publication = StudentPublication.new(params[:student_publication])\n\n respond_to do |format|\n if @student_publication.save\n format.html { redirect_to(@student_publication, :notice => 'Student publication was successfully created.') }\n format.xml { render :xml => @student_publication, :status => :created, :location => @student_publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n respond_to do |format|\n if @publication.save\n format.html { redirect_to :controller => 'ubications', :action => \"new\", :id_pub => @publication.id }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new\n create_doc_keys(true)\n initialize_document(@docs[:num_comments], 0)\n\n\t\t@comment_id = increase_atomic_count(@docs[:num_comments])\n\n\t\tcreate_doc_keys(true)\n\n create_default_docs\n end",
"def create\n @page = Page.find(params[:page_id])\n @rendered_page = render_to_string(:template => \"pages/show\", :layout => Bop.layout)\n @publication = @page.publications.create({ :rendered_page => @rendered_page })\n flash[:notice] = t(:publication_created)\n redirect_to @publication.route\n end",
"def create_new\n @radlib_id = get_new_radlib_id\n @radlib_text_array.clean_for_database\n create_default_docs\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n if params[:save_and_submit]\n @publication.preplanned_submit!\n format.html { redirect_to @publication, \n notice: 'Publication was successfully created and submitted to the publication group.' }\n else\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render json: @publication, status: :created, location: @publication }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end",
"def published!(details)\n node = @meta.at_xpath('./a:publication', a: NS)\n unless node\n node = @doc.create_element('publication')\n @meta.at_xpath('./a:identification', a: NS).after(node)\n end\n\n node['showAs'] = details[:name] if details.has_key? :name\n node['name'] = details[:name] if details.has_key? :name\n node['date'] = details[:date] if details.has_key? :date\n node['number'] = details[:number] if details.has_key? :number\n end",
"def create_new\n @uid = get_new_uid\n create_default_docs\n if @super_user\n add_super_user(@uid)\n end\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n #puts \"==> #{status}: #{response}\"\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def assign_control_doc_number\n\t\tself.control_doc_number = Time.now.strftime(\"%Y\") + \"/\" + Time.now.to_i.to_s\n\t\tself.control_doc_number\n\tend",
"def new_interlink(sax, author_id)\n Interlink.new.tap do |interlink|\n interlink.author_id = author_id\n interlink.synset_id = sax.synset_id\n interlink.pwn = sax.pwn\n end\nend",
"def create\n @publication = Publication.new(publication_params)\n if @publication.save\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully created for #{@publication.client.client_name}\" \n else\n render :new\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def create\n @course = Course.new(params[:course])\n @course_template = CourseNumber.find(params[:course][:course_number_id]) unless params[:course][:course_number_id].blank?\n if @course_template\n @course.name = @course_template.name\n @course.number = @course_template.number \n end\n\n respond_to do |format|\n if @course.save\n flash[:notice] = 'Course was successfully created.'\n format.html { redirect_to(@course) }\n format.xml { render :xml => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publink = Publink.new(params[:publink])\n\n respond_to do |format|\n if @publink.save\n format.html { redirect_to @publink, notice: 'Publink was successfully created.' }\n format.json { render json: @publink, status: :created, location: @publink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end",
"def create_new\n Rails.logger.debug(\"CREATE_NEW\")\n @uid = get_new_uid\n Rails.logger.debug(@uid)\n create_default_docs\n if @super_user\n add_super_user(@uid)\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to publications_url, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @secondary_publication = SecondaryPublication.find(params[:id])\n @secondary_publication.study_id = params[:study_id]\n @study_id = @secondary_publication.study_id\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\t\n if @saved = @secondary_publication.update_attributes(params[:secondary_publication])\n\t\t\n\t# update any changes to previously specified publication numbers\n\t@spi_ids = []\n\tif !params[:secondary_publication_numbers_attributes].nil?\n\t\tparams[:secondary_publication_numbers_attributes].each do |item|\n\t\t\t@existing_id = item[1][:id]\n\t\t\t@spi_ids << @existing_id\n\t\t\t@spi = SecondaryPublicationNumber.find(@existing_id)\n\t\t\t@spi.number = item[1][:number]\n\t\t\t@spi.number_type = item[1][:number_type]\n\t\t\t@spi.secondary_publication_id = @secondary_publication.id\n\t\t\t@spi.save\n\t\tend\n\tend\n\t\n\t@spis_to_delete = SecondaryPublicationNumber.where([\"secondary_publication_id=(?) AND id NOT IN (?)\", @secondary_publication.id, @spi_ids]).all\n\t@spis_to_delete.each do |tp|\n\t\ttp.destroy\n\tend\n\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => @secondary_publication.study_id, :extraction_form_id => @secondary_publication.extraction_form_id})\t\n\t@extraction_form_id = @secondary_publication.extraction_form_id\n\t@secondary_publication = SecondaryPublication.new\n\t@message_div = \"saved_indicator_2\"\n\t@modal = true\n\telse\n\t\tproblem_html = create_error_message_html(@secondary_publication.errors)\n\t\tflash[:modal_error] = problem_html\n\tend\n\t@error_div = \"validation_message\"\n end",
"def create\n @secondary = Secondary.new(secondary_params)\n\n respond_to do |format|\n if @secondary.save\n format.html { redirect_to @secondary, notice: 'Secondary was successfully created.' }\n format.json { render :show, status: :created, location: @secondary }\n else\n format.html { render :new }\n format.json { render json: @secondary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication].merge(\n :user => User.current\n ))\n respond_to do |format|\n if @publication.save\n flash_notice(:runtime_created_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n flash_object_errors(@publication)\n format.html { render :action => :new }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def assign_uuid\n self.uuid = UUIDTools::UUID.random_create.to_s\n self.document_number ||= Numerator.get_number\n end",
"def pubid; end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render action: 'show', status: :created, location: @publication }\n else\n format.html { render action: 'new' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n thisNumber = SecondaryPublicationNumber.find(params[:id])\n thisNumber.destroy\n @secondary_publications = @study.get_secondary_publications(params[:extraction_form_id])\n end",
"def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to root_path, notice: 'Publicação foi criada com sucesso.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(args)\n version_params = {\n number: args[:number],\n pacticipant_id: args[:pacticipant_id],\n created_at: Sequel.datetime_class.now,\n updated_at: Sequel.datetime_class.now,\n build_url: args[:build_url]\n }.compact\n\n\n version = PactBroker::Domain::Version.new(version_params).upsert\n # branch can't be set from CRUD on the version resource, but it's convenient to be able\n # to make a version with a branch for internal code.\n branch_version_repository.add_branch(version, args[:branch]) if args[:branch]\n version\n end",
"def create_phone\n puts \"Please enter phone category: \"\n \tcat = gets.chomp\n puts \"Please enter phone number: \"\n \tdig = gets.chomp\n\n phone = Phonenumber.create({category: cat, digits: dig})\nend",
"def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @primary_publication_number.update_attributes(params[:primary_publication_number])\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def write_number(crl_number)\n @db.execute('UPDATE crl_number SET number=?', crl_number)\n end",
"def create_child_id\n return unless child_id.nil?\n \n recent = Child.find(:first, :conditions => [\"cohort = ? and child_id IS NOT NULL\", cohort], :select => \"child_id\", :order => \"child_id DESC\")\n last_child_id = recent != nil ? recent.child_id.to_i : \"6#{cohort}0000\".to_i\n \n\twrite_attribute(:child_id, last_child_id + 1)\n\tsave\n\t\n return last_child_id\n end",
"def create\n @saved_publication = SavedPublication.new(saved_publication_params)\n\n respond_to do |format|\n if @saved_publication.save\n format.html { redirect_to @saved_publication, notice: 'Saved publication was successfully created.' }\n format.json { render :show, status: :created, location: @saved_publication }\n else\n format.html { render :new }\n format.json { render json: @saved_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new_serial\n @soa[:serial] = self.class.next_serial(@soa[:serial])\n end",
"def create(name, email, *phone)\n check_duplicate_email!(email)\n new_contact = self.new(name, email) \n new_contact.save\n \n phone.flatten!\n if phone.length > 0\n (0...phone.length).step(2) do |item|\n new_number = PhoneNumbers.create(phone[item], phone[item+1], new_contact.id.to_i)\n p new_number\n end\n end\n end",
"def createPartnerSubmission(submission)\n updateModules()\n hasPartners = @modulesUsed.include?(\"Partners\")\n # return the submission created for partner\n if hasPartners then\n pSubmission = partnersAfterAutograde(submission)\n\n unless pSubmission.nil?\n pSubmission.save!\n end\n\n return pSubmission\n end\n end",
"def create_two_role_identifier(r1, r2)\n pc = @constellation.PresenceConstraint(\n :concept => :new,\n :vocabulary => @vocabulary,\n :name => r1.object_type.name+' '+r1.object_type.name+'PK',\n :role_sequence => [:new],\n :is_mandatory => true,\n :min_frequency => 1,\n :max_frequency => 1,\n :is_preferred_identifier => true\n )\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 0, :role => r1)\n @constellation.RoleRef(:role_sequence => pc.role_sequence, :ordinal => 1, :role => r2)\n end",
"def generate_number(isofferte)\n return id if isofferte.to_i == 1\n\n # TODO: scope per firm here!\n last_invoice = Invoice.order('number').last\n\n self.number = if last_invoice\n last_invoice.number + 1\n else\n # generate invoice nr based on year+month\n \"#{Time.new.strftime('%Y%m')}0001\".to_i\n end\n end",
"def create_finance_fee(collection, student)\n last_receipt_no = FinanceFee.last.receipt_no if FinanceFee.last\n fee = FinanceFee.new\n fee.finance_fee_collection_id = collection\n fee.student_id = student\n fee.is_paid = false\n if last_receipt_no.nil?\n fee.receipt_no = 001\n else\n fee.receipt_no = last_receipt_no.next\n end\n fee.save\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n @publication.end_date = @publication.effective_date + @publication.plan.duration.months\n \n @publication.payment_status = \"No realizado\"\n # Los planes gratuitos se inicializan en pagos\n @publication.payment_status = \"Realizado\" if (@publication.plan.id == Plan.get_free_plan_id)\n\n respond_to do |format|\n if @publication.save\n url_to_redirect = \"/publications/payment_return/#{@publication.id}/1\"\n if (@publication.plan.id != Plan.get_free_plan_id)\n url_to_redirect = @publication.url_de_pago\n end\n \n @publication.available!\n format.html { redirect_to url_to_redirect }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_public_id\n self.public_id = Time.now.to_i.to_s 36\n end",
"def create\n @publinktype = Publinktype.new(params[:publinktype])\n\n respond_to do |format|\n if @publinktype.save\n format.html { redirect_to @publinktype, notice: 'Publinktype was successfully created.' }\n format.json { render json: @publinktype, status: :created, location: @publinktype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publinktype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def primary_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.primary_phone = pn\n #update our locally stored number too\n update_phone_number\n end",
"def create_new\n create_doc_keys(true)\n @radlib_fillin_id = @docs[:fillin] unless @radlib_fillin_id && @radlib_fillin_id.length > 0 # if only the radlib_id and fillin_index were passed, set the @radlib_fillin_id\n create_default_docs\n end",
"def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"def create\n @puntuation = Puntuation.new(puntuation_params)\n\n respond_to do |format|\n if @puntuation.save\n @voted_contribution = Contribution.find(@puntuation.contribution_id)\n @voted_contribution.increment!(:puntuation, 1)\n format.html { redirect_to :back }\n format.json { render :show, status: :created, location: @puntuation }\n else\n format.html { render :new }\n format.json { render json: @puntuation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication_type = PublicationType.new(params[:publication_type])\n @publication_type.client_id = session[:client_id]\n\n respond_to do |format|\n if @publication_type.save\n format.html { redirect_to @publication_type, :notice => 'Publication type was successfully created.' }\n format.json { render :json => @publication_type, :status => :created, :location => @publication_type }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @publication_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n datasource = params[:publication][:datasource]\n sourceid = params[:publication][:sourceid]\n publication = {}\n\n if !ImportManager.datasource_valid?(datasource: datasource)\n error_msg(ErrorCodes::OBJECT_ERROR, \"Given datasource is not configured: #{datasource}\")\n render_json\n return\n end\n\n case datasource\n when \"none\"\n #do nothing\n else\n item = ImportManager.find(datasource: datasource, sourceid: sourceid)\n if item && item.errors.messages.empty?\n publication.merge!(item.json_data)\n else\n error_msg(ErrorCodes::VALIDATION_ERROR, \"Identifikatorn #{sourceid} hittades inte i #{datasource}\")\n render_json\n return\n end\n end\n\n # Check publication identifiers for possible duplications\n\n publication_identifiers = publication[:publication_identifiers] || []\n\n publication_identifier_duplicates = Publication.duplicates(publication_identifiers)\n publication[:publication_identifier_duplicates] = publication_identifier_duplicates\n\n @response[:publication] = publication\n render_json\n\n end",
"def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end",
"def generate(init)\n subject.transaction do\n # Create a record in internal_ids if one does not yet exist\n # and increment its last value\n #\n # Note this will acquire a ROW SHARE lock on the InternalId record\n (lookup || create_record(init)).increment_and_save!\n end\n end",
"def add_docidentifier\n @bib.docidentifier.each do |i|\n case i.type\n when \"isbn\" then @item.isbn = i.id\n when \"lccn\" then @item.lccn = i.id\n when \"issn\" then @item.issn = i.id\n end\n end\n end",
"def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end",
"def set_publication\n @publication = Publication.friendly.find(params[:slug])\n end",
"def update\n @publication_number = PublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @publication_number.update_attributes(params[:publication_number])\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n get_presentation\n @publication = Publication.new publication_params\n @publication.creator_id = current_user.id\n if @presentation.present? # The user doesn't see name or speaker names in the Manage Publications context\n @publication.name ||= @presentation.name\n @publication.speaker_names = 'N/A' # something meaningful to show Editors when looking at publication details regular users can't see\n end\n if @publication.save\n if @presentation.present?\n @presentation_publication = PresentationPublication.create presentation_id: @presentation.id, publication_id: @publication.id, creator_id: current_user.id, canonical: params[:canonical] == 'true'\n redirect_to manage_publications_presentation_path(@presentation)\n else\n redirect_to publication_path(@publication)\n end\n else\n @languages = Language.all.map{|l| [l.name, l.id]}\n flash[:error] = \"The publication could not be saved: #{ @publication.errors.full_messages.join(', ') }\"\n logger.error \"Publication save failed: #{ @publication.errors.full_messages }\"\n render 'new'\n end\n end",
"def lsepoch_create_replica_record(params, record)\n _replica = Vob.new(params[:vob])\n _replica[:tag] = record[:tag]\n _replica[:host_id] = record[:host_id]\n _replica[:replica_name] = record[:row_replica] # \"fresh\" value from parsing\n _replica[:replica_uuid] = record[:oid]\n _replica[:description] = \"Orphaned from the epoch table...\"\n _replica.save\n record[:row_replica] = _replica[:id]\n end",
"def new_institution(inst_name, inst_site, inst_number, inst_email)\n Institution.transaction do\n new_institution = Institution.new(name: inst_name,\n website: inst_site,\n phone_number: inst_number,\n email: inst_email)\n new_institution.id = @inst_id\n @inst_id += 1 if new_institution.save!\n @institutions << new_institution\n end\n end",
"def create_order_number\n return if order_number.present?\n\n generator = OrderNumberGenerator.get_generator(self)\n self.order_number = generator.generate\n end",
"def generate_submission_id(time = nil, prefix: true)\n prefix = SID_PREFIX if prefix.is_a?(TrueClass)\n time = time.is_a?(DateTime) ? time.to_time : (time || Time.now)\n base_id = time.tv_sec\n letter = SID_LETTERS.first + rand(SID_LETTER_SPAN)\n sprintf('%s%x%c%02d', prefix, base_id, letter, sid_counter)\n end",
"def create_local_npid(patient, malawi_national_id)\n assign_patient_v3_npid(patient)\n assign_patient_v28_malawiNid(patient, malawi_national_id) if malawi_national_id.present?\n end",
"def make_student_submissions\n\t1.upto(NUM_SUBMISSIONS) do |n|\n\t\ts = StudentSubmission.create()\n\t\ts.student = Student.find(n % NUM_STUDENT + 1)\n\t\ts.submission = Submission.find(n % NUM_SUBMISSIONS + 1)\n\t\ts.id = n\n\t\ts.save\n\tend\nend",
"def create\n @primary = Primary.new(primary_params)\n\n respond_to do |format|\n if @primary.save\n format.html { redirect_to @primary, notice: 'Primary article was successfully created.' }\n format.json { render :show, status: :created, location: @primary }\n else\n format.html { render :new }\n format.json { render json: @primary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @n_code = NCode.new(n_code_params)\n\n r = FederalRegister::Article.search(:conditions => {:term => @n_code.term})\n r.results.each do |a|\n #Toy#create accepts :document_number, :excerpts, :html_url, :type, :title\n params[:document_number] = a.document_number\n params[:html_url] = a.html_url\n params[:type] = a.type\n params[:title] = a.title\n # params[:n_code_id] = @n_code[:id]\n redirect_to new_n_code_toy_path(:n_code_id, @a, params) and return \n\n end\n\n respond_to do |format|\n if @n_code.save\n format.html { redirect_to @n_code, notice: 'N code was successfully created.' }\n format.json { render :show, status: :created, location: @n_code }\n else\n format.html { render :new }\n format.json { render json: @n_code.errors, status: :unprocessable_entity }\n end\n end\n\n\n\n end",
"def create\n respond_to do |format|\n if @publication.save\n format.html { redirect_to user_publication_path(@user, @publication), notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: user_publication_path(@user, @publication) }\n else\n format.html {\n breadcrumb\n add_breadcrumb 'Nouvelle publication'\n render :new\n }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_valid_slug_number\n retries_count = 0\n @slug_number = SlugNumber.instance.latest\n while Link.find_by_both_slugs(generate_slug)\n @slug_number = SlugNumber.instance.latest\n retries_count += 1\n\n # Break to prevent infinite look in case something goes very wrong.\n # Because slug_number will be taken, Link's uniqueness validation\n # will not allow for bad data to be created.\n #\n break if retries_count > 10\n end\n end",
"def create\n visit(CentralAdmin).create_institutional_proposal\n on ProposalLogLookup do |look|\n look.proposal_number.set @proposal_number\n look.search\n look.select_item @proposal_number\n end\n on InstitutionalProposal do |create|\n create.expand_all\n @document_id=create.document_id\n @doc_header=create.doc_title\n @proposal_number=create.institutional_proposal_number\n fill_out create, :proposal_type, :award_id, :activity_type, :project_title, :description\n set_sponsor_code\n create.save\n end\n if @proposal_log && $current_page.errors.size==0\n pi = make ProjectPersonnelObject, principal_name: @proposal_log.principal_investigator,\n full_name: @proposal_log.pi_full_name,\n document_id: @document_id,\n lookup_class: @lookup_class,\n search_key: @search_key,\n doc_header: @doc_header\n @project_personnel << pi\n view :contacts\n @project_personnel.principal_investigator.set_up_units\n end\n end",
"def destroy\n \tputs (\"CALL TO DESTROY -------------\")\n @secondary_publication = SecondaryPublication.find(params[:id])\n\t@study_id = @secondary_publication.study_id\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\t\n\t@secondary_publication.shift_display_numbers(@study_id)\n\t@extraction_form_id = @secondary_publication.extraction_form_id\n @secondary_publication.destroy\n secondary_publications = []\n @secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => @study_id, :extraction_form_id=>@extraction_form_id})\n @secondary_publication = SecondaryPublication.new\n puts \"Secondary Publications is of length #{@secondary_publications.length}\\n\\n\"\n end",
"def new_org_dxid\n Org.construct_dxorg(orgname)\n end",
"def create\n logger.info('POST Create:')\n logger.info(request_body)\n pub_hash = hashed_request\n fingerprint = Digest::SHA2.hexdigest(request_body)\n existing_record = UserSubmittedSourceRecord.find_by(source_fingerprint: fingerprint)\n if existing_record\n logger.info(\"Found existing record for #{fingerprint}: #{existing_record.inspect}; redirecting.\")\n redirect_to publication_path(existing_record.publication_id), status: :see_other\n else\n unless validate_or_create_authors(pub_hash[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n pub = Publication.build_new_manual_publication(pub_hash, request_body)\n pub.save!\n pub.reload\n logger.debug(\"Created new publication #{pub.inspect}\")\n render json: pub.pub_hash, status: :created\n end\n end",
"def create\n init = params[:promotion][:name][0]\n promotion_number = Promotion.create_number(params)\n @promotion = Promotion.new(promotion_params.merge(:code => (('%03d' % ((Promotion.last.code.to_i rescue 0)+1)))))\n if @promotion.save\n flash[:notice] = 'Warna berhasil ditambahkan'\n redirect_to promotions_path\n else\n flash[:error] = @promotion.errors.full_messages\n render \"new\"\n end\n end"
] |
[
"0.66986525",
"0.6678229",
"0.66055155",
"0.6441804",
"0.6333184",
"0.59490246",
"0.5908597",
"0.560981",
"0.5555847",
"0.55500203",
"0.5516568",
"0.55064684",
"0.5495526",
"0.54855627",
"0.54673856",
"0.5450609",
"0.5412726",
"0.5382135",
"0.53705555",
"0.535286",
"0.5335613",
"0.53199464",
"0.529649",
"0.52764505",
"0.5253869",
"0.5246477",
"0.5241298",
"0.5238697",
"0.5228459",
"0.5222822",
"0.5219895",
"0.5216556",
"0.5205447",
"0.51830685",
"0.51825565",
"0.51252884",
"0.51164067",
"0.511481",
"0.5108333",
"0.51041836",
"0.51036847",
"0.50693893",
"0.50693893",
"0.5068723",
"0.50653636",
"0.50496",
"0.50462914",
"0.5045373",
"0.5043415",
"0.50364333",
"0.50357306",
"0.50333315",
"0.50330555",
"0.5024868",
"0.50222003",
"0.50179106",
"0.50124687",
"0.50000685",
"0.49887216",
"0.49868134",
"0.49798363",
"0.49711832",
"0.4962217",
"0.49521095",
"0.4944091",
"0.4941738",
"0.4940077",
"0.49375904",
"0.4935049",
"0.49257168",
"0.49172944",
"0.49171412",
"0.49121085",
"0.49053055",
"0.49053055",
"0.4894452",
"0.4890422",
"0.4886626",
"0.4882554",
"0.4881021",
"0.48809558",
"0.48757675",
"0.4875245",
"0.4859286",
"0.48506021",
"0.48444092",
"0.48375443",
"0.48361495",
"0.48322964",
"0.48269108",
"0.48227456",
"0.48223326",
"0.48192433",
"0.48173967",
"0.48100087",
"0.48079044",
"0.4807296",
"0.48046675",
"0.48044288",
"0.48041874"
] |
0.8264091
|
0
|
update an existing secondary_publication_number
|
def update
@secondary_publication_number = SecondaryPublicationNumber.find(params[:id])
@secondary_publication_number.update_attributes(params[:secondary_publication_number])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @primary_publication_number.update_attributes(params[:primary_publication_number])\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @secondary_publication_number = SecondaryPublicationNumber.new(params[:secondary_publication_number])\n\t@secondary_publication_number.save\n end",
"def update\n @publication_number = PublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @publication_number.update_attributes(params[:publication_number])\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @secondary_publication = SecondaryPublication.find(params[:id])\n @secondary_publication.study_id = params[:study_id]\n @study_id = @secondary_publication.study_id\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\t\n if @saved = @secondary_publication.update_attributes(params[:secondary_publication])\n\t\t\n\t# update any changes to previously specified publication numbers\n\t@spi_ids = []\n\tif !params[:secondary_publication_numbers_attributes].nil?\n\t\tparams[:secondary_publication_numbers_attributes].each do |item|\n\t\t\t@existing_id = item[1][:id]\n\t\t\t@spi_ids << @existing_id\n\t\t\t@spi = SecondaryPublicationNumber.find(@existing_id)\n\t\t\t@spi.number = item[1][:number]\n\t\t\t@spi.number_type = item[1][:number_type]\n\t\t\t@spi.secondary_publication_id = @secondary_publication.id\n\t\t\t@spi.save\n\t\tend\n\tend\n\t\n\t@spis_to_delete = SecondaryPublicationNumber.where([\"secondary_publication_id=(?) AND id NOT IN (?)\", @secondary_publication.id, @spi_ids]).all\n\t@spis_to_delete.each do |tp|\n\t\ttp.destroy\n\tend\n\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => @secondary_publication.study_id, :extraction_form_id => @secondary_publication.extraction_form_id})\t\n\t@extraction_form_id = @secondary_publication.extraction_form_id\n\t@secondary_publication = SecondaryPublication.new\n\t@message_div = \"saved_indicator_2\"\n\t@modal = true\n\telse\n\t\tproblem_html = create_error_message_html(@secondary_publication.errors)\n\t\tflash[:modal_error] = problem_html\n\tend\n\t@error_div = \"validation_message\"\n end",
"def update_year_published_entry(db, year_pubished, id)\n\tdb.execute(\"UPDATE books SET year_pubished=? WHERE id=?\", [year_pubished, id])\nend",
"def edit\n @secondary_publication = SecondaryPublication.find(params[:id])\n\t@secondary_publication_numbers = SecondaryPublicationNumber.where(:secondary_publication_id => @secondary_publication.id).all\n @extraction_form_id = @secondary_publication.extraction_form_id\n\t@study_id = @secondary_publication.study_id\n\t@editing = true\nend",
"def write_number(crl_number)\n @db.execute('UPDATE crl_number SET number=?', crl_number)\n end",
"def new\n @secondary_publication_number = SecondaryPublicationNumber.new\n\t@secondary_publication_number.save\n\t@study = Study.find(params[:study_id])\t\n end",
"def update!(**args)\n @book_edition_isbn = args[:book_edition_isbn] if args.key?(:book_edition_isbn)\n @book_edition_mid = args[:book_edition_mid] if args.key?(:book_edition_mid)\n end",
"def secondary_id=(v)\n @secondary_id = alma_string v\n end",
"def update\n @student_publication = StudentPublication.find(params[:id])\n\n respond_to do |format|\n if @student_publication.update_attributes(params[:student_publication])\n format.html { redirect_to(@student_publication, :notice => 'Student publication was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @student_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @aux_bibkeys = args[:aux_bibkeys] if args.key?(:aux_bibkeys)\n @imprint = args[:imprint] if args.key?(:imprint)\n @num_rating_half_stars = args[:num_rating_half_stars] if args.key?(:num_rating_half_stars)\n @numberingrange = args[:numberingrange] if args.key?(:numberingrange)\n @partner_id = args[:partner_id] if args.key?(:partner_id)\n @product_edition_number = args[:product_edition_number] if args.key?(:product_edition_number)\n @publication_date = args[:publication_date] if args.key?(:publication_date)\n @publisher_name = args[:publisher_name] if args.key?(:publisher_name)\n @subject = args[:subject] if args.key?(:subject)\n end",
"def update\n @primary_publication = PrimaryPublication.find(params[:id])\n\n respond_to do |format|\n if @primary_publication.save\n\t\tformat.js{\n\t\t\trender :update do |page|\n\t\t\t\tsaved_html = \"<div class='success_message'>Saved Successfully!</div><br/>\"\n\t\t\t\tpage.replace_html 'primary_pub_save_message', saved_html\n\t\t\tend\n\t\t}\n\t\telse\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @publication.update(publication_params)\n render json: @publication, status: :ok\n else\n render json: @publication.errors, status: :unprocessable_entity\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to @publication, notice: 'Publication was successfully updated. Please note that it has been submitted to the publication group.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_invoice_number!\n return unless Spree::PrintInvoice::Config.use_sequential_number?\n return if invoice_number.present?\n\n update_columns(invoice_number: Spree::PrintInvoice::Config.increase_invoice_number)\n end",
"def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n @ubication = Ubication.find_by(publication_id: params[:id])\n format.html { redirect_to :controller => 'ubications', :action => \"edit\", :id => @ubication.id, :id_pub => @publication.id }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@publication.update_attributes(publication_params)\n\t\t@publication.current_user = current_user if @publication.current_user.nil?\n\t\t@publication.save!\n\t\tflash[:notice] = 'Success!'\n\t\tredirect_to publications_path\n\trescue ActiveRecord::RecordNotSaved, ActiveRecord::RecordInvalid\n\t\tflash.now[:error] = \"There was a problem updating the publication\"\n\t\trender :action => \"edit\"\n\tend",
"def update!(**args)\n @primary = args[:primary] if args.key?(:primary)\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n flash[:notice] = 'Publication was successfully updated.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n thisNumber = SecondaryPublicationNumber.find(params[:id])\n thisNumber.destroy\n @secondary_publications = @study.get_secondary_publications(params[:extraction_form_id])\n end",
"def update!(**args)\n @end_numbering = args[:end_numbering] if args.key?(:end_numbering)\n @number_type = args[:number_type] if args.key?(:number_type)\n @numbering_schema = args[:numbering_schema] if args.key?(:numbering_schema)\n @start_numbering = args[:start_numbering] if args.key?(:start_numbering)\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @publication = Publication.find(params[:id])\n\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n flash[:notice] = 'Publication was successfully updated.'\n format.html { redirect_to(@publication) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to publications_url, notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def increment_manuscript_rev_num\n if self.version && self.article\n num = self.manuscript_number \n rev = num.scan(/\\.R\\d+/)[0]\n if rev\n num.gsub!(/\\.R\\d+/,\"\")\n rev_num = rev.gsub(/\\.R/,\"\")\n rev_num = rev_num.to_i\n num+=\".R#{rev_num+1}\"\n else\n num = \"#{num}.R1\"\n end \n self.article.update_attribute(:manuscript_num,num)\n end\n end",
"def update_phone_number\n begin\n self.phone_number = self.primary_phone.tr('^0-9', '')\n rescue\n return nil\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to user_publication_path(@user, @publication), notice: 'Publication was successfully updated.' }\n format.json { render :show, status: :ok, location: user_publication_path(@user, @publication) }\n else\n format.html { render :edit }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @publication.update(publication_params)\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully updated for #{@publication.client.client_name}\"\n else\n render :edit\n end\n end",
"def primary_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.primary_phone = pn\n #update our locally stored number too\n update_phone_number\n end",
"def merge_authorship(pub)\n authorship = pub.pub_hash[:authorship]\n if duplicate_authorship? pub\n # Modify and save the pub_hash without authorship duplicates.\n pub.pub_hash[:authorship] = authorship.to_set.to_a\n pub.pubhash_needs_update!\n if pub.save\n @records_modified += 1\n @logger.info \"Publication #{pub[:id]} modified and saved at #{pub[:updated_at]}\"\n end\n end\n rescue StandardError => e\n msg = \"Problem with publication: #{pub[:id]}\\n\"\n msg += \"#{e.inspect}\\n\"\n msg += e.backtrace.join(\"\\n\")\n @logger.error msg\n end",
"def update!(**args)\n @pronunciation = args[:pronunciation] if args.key?(:pronunciation)\n end",
"def update\n @publication_type = PublicationType.find(params[:id])\n\n respond_to do |format|\n if @publication_type.update_attributes(params[:publication_type])\n format.html { redirect_to @publication_type, :notice => 'Publication type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @publication_type.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def secondary= school\n\t\tif @primary == school\n\t\t\t@primary = @secondary\n\t\tend\n\t\t@secondary = school\n\tend",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @saved_publication.update(saved_publication_params)\n format.html { redirect_to @saved_publication, notice: 'Saved publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @saved_publication }\n else\n format.html { render :edit }\n format.json { render json: @saved_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub? # only manually entered (i.e. non-harvested) publications may be updated with this method\n render json: {\n error: \"This record SulPubID #{old_pub.id} may not be modified. If you had originally entered details for the record, \" \\\n 'it has been superceded by a central record.'\n },\n status: :forbidden, format: 'json'\n return\n elsif !validate_or_create_authors(new_pub[:authorship])\n render json: { error: 'You have not supplied a valid authorship record.' }, status: :not_acceptable,\n format: 'json'\n return\n end\n logger.info(\"Update manual publication #{old_pub.inspect} with BibJSON:\")\n logger.info(request_body)\n old_pub.update_manual_pub_from_pub_hash(new_pub, request_body)\n old_pub.save!\n old_pub.reload\n logger.debug(\"resulting pub hash: #{old_pub.pub_hash}\")\n render json: old_pub.pub_hash, status: :accepted\n end",
"def update!(**args)\n @payment_network_mid = args[:payment_network_mid] if args.key?(:payment_network_mid)\n end",
"def update\n @publication = Publication.find(params[:id])\n #expire_action :action => :index\n respond_to do |format|\n if @publication.update_attributes(params[:publication])\n format.html { redirect_to @publication, notice: 'Publication was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update!(**args)\n @book_id = args[:book_id] if args.key?(:book_id)\n @discretized_citation_score = args[:discretized_citation_score] if args.key?(:discretized_citation_score)\n @previewable = args[:previewable] if args.key?(:previewable)\n @second_book_id = args[:second_book_id] if args.key?(:second_book_id)\n @second_discretized_citation_score = args[:second_discretized_citation_score] if args.key?(:second_discretized_citation_score)\n end",
"def update\n respond_to do |format|\n if @secondary.update(secondary_params)\n format.html { redirect_to @secondary, notice: 'Secondary was successfully updated.' }\n format.json { render :show, status: :ok, location: @secondary }\n else\n format.html { render :edit }\n format.json { render json: @secondary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@secondary_publication = SecondaryPublication.new(params[:secondary_publication])\n \t@secondary_publication.display_number = @secondary_publication.get_display_number(params[:study_id])\n\t@secondary_publication.study_id = params[:study_id]\n\t@study_id = @secondary_publication.study_id\n\t@secondary_publication.save\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id =>params[:study_id]})\t\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\n if @saved = @secondary_publication.save\n\t\t\n\t# create newly specified outcomes\n\tif !params[:secondary_publication_numbers_attributes].nil?\n\tparams[:secondary_publication_numbers_attributes].each do |item|\n\t\t@spn = SecondaryPublicationNumber.new\n\t\t@spn.number = item[1][:number]\n\t\t@spn.number_type = item[1][:number_type]\n\t\t@spn.secondary_publication_id = @secondary_publication.id\n\t\t@spn.save\t\n\tend\t\n\tend\t\t\n\t\t@secondary_publication = SecondaryPublication.new\n\t\t@message_div = \"saved_item_indicator_2\"\n else\n \tproblem_html = create_error_message_html(@secondary_publication.errors)\n\t\tflash[:modal_error] = problem_html\n end\n\t@error_div = \"validation_message\"\n end",
"def update\n @publink = Publink.find(params[:id])\n\n respond_to do |format|\n if @publink.update_attributes(params[:publink])\n format.html { redirect_to @publink, notice: 'Publink was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @publication.update(publication_params)\n format.html { redirect_to root_path, notice: 'Publicação foi atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @publication }\n else\n format.html { redirect_to root_path }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def assign_publisher_membership_code_and_switch_publisher_as_needed\n return if publisher.nil?\n return if @publisher_membership_code_as_text.blank?\n return if publisher_membership_code.try(:code) == @publisher_membership_code_as_text\n new_code = publisher.publisher_membership_codes.find_by_code(@publisher_membership_code_as_text)\n if publisher.publishing_group.present?\n new_code ||= publisher.publishing_group.publisher_membership_codes.find_by_code(@publisher_membership_code_as_text)\n end\n if new_code.present?\n self.publisher_membership_code = new_code\n if publisher != new_code.publisher\n self.publisher = new_code.publisher\n end\n end\n end",
"def update!(**args)\n @primary = args[:primary] if args.key?(:primary)\n @secondary = args[:secondary] if args.key?(:secondary)\n end",
"def update\n @publication = Publication.find(params[:id])\n respond_to do |format|\n if !can_edit?(@publication)\n format.html { redirect_to(publications_url) }\n format.xml { render :xml => \"can't edit\", :status => :unprocessable_entity }\n elsif @publication.update_attributes(params[:publication])\n flash_notice(:runtime_updated_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { head :ok }\n else\n flash_object_errors(@publication)\n format.html { render :action => :edit }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def moveup\n\t@secondary_publication = SecondaryPublication.find(params[:secondary_publication_id].to_i)\n\tSecondaryPublication.move_up_this(params[:secondary_publication_id].to_i, @secondary_publication.study_id)\n\t@study_id = @secondary_publication.study_id\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => @secondary_publication.study_id})\n @secondary_publication = SecondaryPublication.new\nend",
"def update!(**args)\n @html_title_fp = args[:html_title_fp] if args.key?(:html_title_fp)\n @index_selection_score = args[:index_selection_score] if args.key?(:index_selection_score)\n @num_backward_links = args[:num_backward_links] if args.key?(:num_backward_links)\n @num_related = args[:num_related] if args.key?(:num_related)\n @num_versions = args[:num_versions] if args.key?(:num_versions)\n @publication_day = args[:publication_day] if args.key?(:publication_day)\n @publication_month = args[:publication_month] if args.key?(:publication_month)\n @publication_year = args[:publication_year] if args.key?(:publication_year)\n @remove_link = args[:remove_link] if args.key?(:remove_link)\n @scholar_id = args[:scholar_id] if args.key?(:scholar_id)\n @title = args[:title] if args.key?(:title)\n @visible_prefix_terms = args[:visible_prefix_terms] if args.key?(:visible_prefix_terms)\n @author = args[:author] if args.key?(:author)\n end",
"def set_publication_name\n @publication_name = PublicationName.find(params[:id])\n end",
"def edit_publication\n \n edit_publication_routine\n \n add_breadcrumb \"Finalize Article\", 'finalize_article_url'\n set_breadcrumb_for @article, 'edit_publication_path' + \"(#{@article.id})\", \n \"Edit Publication Date\"\n end",
"def secondary_phone_number\n \"[SECONDARY_PHONE_NUMBER]\"\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def update!(**args)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"def update!(**args)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"def update!(**args)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"def update!(**args)\n @phone_number = args[:phone_number] if args.key?(:phone_number)\n end",
"def cleanup_numbering(faculty_semester)\n DB['update events\n set relative_sequence_number = null\n where deleted = true\n and relative_sequence_number is not null\n and faculty = :faculty\n and semester = :semester',\n faculty: faculty_semester.faculty,\n semester: faculty_semester.code,\n ].update\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def increment_public_id\n if self.public_id.blank?\n self.public_id = Compound.exists? ? Compound.order(:public_id).last.public_id.next : 'RDDB00001'\n end\n end",
"def set_publication\n @publication = Publication.friendly.find(params[:slug])\n end",
"def set_saved_publication\n @saved_publication = SavedPublication.find(params[:id])\n end",
"def set_saved_publication\n @saved_publication = SavedPublication.find(params[:id])\n end",
"def update!(**args)\n @document_id = args[:document_id] if args.key?(:document_id)\n end",
"def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end",
"def update!(**args)\n @sgn_domain = args[:sgn_domain] if args.key?(:sgn_domain)\n @sgn_pk = args[:sgn_pk] if args.key?(:sgn_pk)\n end",
"def update!(**args)\n @internal = args[:internal] if args.key?(:internal)\n end",
"def update!(**args)\n @docid = args[:docid] if args.key?(:docid)\n @news_content_type = args[:news_content_type] if args.key?(:news_content_type)\n @publication_time = args[:publication_time] if args.key?(:publication_time)\n @publisher = args[:publisher] if args.key?(:publisher)\n end",
"def set_secondary\n @secondary = Secondary.find(params[:id])\n end",
"def set_authors_publication\n @authors_publication = AuthorsPublication.find(params[:id])\n end",
"def update!(**args)\n @latest = args[:latest] if args.key?(:latest)\n @publication_date = args[:publication_date] if args.key?(:publication_date)\n @publication_time_to_display = args[:publication_time_to_display] if args.key?(:publication_time_to_display)\n end",
"def set_correct_published_revision_number(revision = nil)\n if self.published_revision_number == 0\n self.published_revision_number = revision ? revision.number : self.last_revision.number\n end\n end",
"def author_increment\n\n #loop through all the authors and update the lastbook\n \tself.authors.each do |author|\n\n \t\tauthor.lastbook = self.id\n\n \t\tauthor.save\n \tend\n end",
"def number2=(val)\n self.number('number2','key2',val)\n end",
"def update\n\n if !params[:number][:business_number].blank?\n params[:number][:business_number] = \"+1\"+Phony.normalize(params[:number][:business_number])\n end\n\n if !params[:number][:tracking_number].blank?\n params[:number][:tracking_number] = \"+1\"+Phony.normalize(params[:number][:tracking_number])\n end\n\n respond_to do |format|\n if @number.update(number_params)\n format.html { redirect_to numbers_url, notice: 'Number was successfully updated.' }\n format.json { render :show, status: :ok, location: @number }\n else\n format.html { render :edit }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n if !params[:number][:business_number].blank?\n params[:number][:business_number] = \"+1\"+Phony.normalize(params[:number][:business_number])\n end\n\n if !params[:number][:tracking_number].blank?\n params[:number][:tracking_number] = \"+1\"+Phony.normalize(params[:number][:tracking_number])\n end\n\n respond_to do |format|\n if @number.update(number_params)\n format.html { redirect_to numbers_url, notice: 'Number was successfully updated.' }\n format.json { render :show, status: :ok, location: @number }\n else\n format.html { render :edit }\n format.json { render json: @number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_phone_number(phone, location, primary = false, extension = nil)\n if primary\n old_primaries = phone_numbers.select { |phone| phone.primary == true }\n old_primaries.each do |old_primary|\n old_primary.primary = 0\n old_primary.save!\n end\n end\n\n old_phone_record = phone_numbers.select { |phone| phone.location == location }.first\n if old_phone_record\n old_phone_record.number = phone\n old_phone_record.extension = extension\n old_phone_record.primary = primary\n old_phone_record.save!\n else\n PhoneNumber.create!(number: phone, location: location, extension: extension, primary: primary, person_id: id)\n end\n end",
"def destroy\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n @primary_publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publication_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def update\n @pub = Pub.find(params[:id])\n\n\n if @pub.update(pub_params)\n head :no_content\n else\n render json: @pub.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @view_publication.update(view_publication_params)\n format.html { redirect_to @view_publication, notice: 'View publication was successfully updated.' }\n format.json { render :show, status: :ok, location: @view_publication }\n else\n format.html { render :edit }\n format.json { render json: @view_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_catalog_metadata\n source = metadata_builder.metadata_source.find_by(source_type: 'descriptive')\n raise 'Descriptive metadata source not available' unless source\n\n bibnumber = source.original_mappings['bibnumber']&.first\n raise 'Descriptive metadata does not contain bibnumber' if bibnumber.blank?\n\n source.set_metadata_mappings(clone_location)\n source.save!\n end",
"def update\n if article_number_changed == true\n return execute_update && change_article\n end\n return execute_update\n end",
"def number=(number)\n if (department and number and not number.blank?)\n self.course_title = CourseTitle.find_or_initialize_by_department_id_and_number(department.id, number)\n else\n self.course_title = nil\n end\n end",
"def update\n get_supplier\n @supplier_phone = @supplier.phones.find(params[:id])\n @supplier_phone.update_attributes(params[:supplier_phone])\n end",
"def update\n respond_to do |format|\n if @primary.update(primary_params)\n format.html { redirect_to @primary, notice: 'Primary article was successfully updated.' }\n format.json { render :show, status: :ok, location: @primary }\n else\n format.html { render :edit }\n format.json { render json: @primary.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @academic_year = AcademicYear.find(params[:id])\n\n if @academic_year.update_attributes(params[:san_subject])\n @academic_years = AcademicYear.paginate :page=>params[:page], :per_page=>15\n flash[:notice] = t('flash_msg45')\n else\n @errors = @academic_year.errors\n end\n end",
"def update\n \n params[:edition] = {} if !params[:edition]\n params[:edition][:isbn] = format_isbn(params[:edition][:isbn]) if params[:edition][:isbn]\n \n @edition = Edition.find(params[:id])\n \n respond_to do |format|\n if @edition.update_attributes_and_index(params[:edition])\n format.html { redirect_to(@edition, :notice => 'Edition was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @edition.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6854728",
"0.67690563",
"0.67131823",
"0.6328336",
"0.6055101",
"0.5972203",
"0.57662684",
"0.57261705",
"0.5677576",
"0.5607939",
"0.5600554",
"0.55821013",
"0.5572911",
"0.5495879",
"0.5495429",
"0.5473304",
"0.54580295",
"0.5451855",
"0.54463845",
"0.5443153",
"0.5438366",
"0.53993285",
"0.5394077",
"0.53922915",
"0.53922915",
"0.53922915",
"0.5379699",
"0.5360127",
"0.5345734",
"0.53413045",
"0.53388166",
"0.53329015",
"0.529698",
"0.5295368",
"0.5288528",
"0.5261875",
"0.5241562",
"0.52317697",
"0.5220181",
"0.520897",
"0.5174111",
"0.51714015",
"0.51702094",
"0.51590323",
"0.51582307",
"0.5157134",
"0.5150956",
"0.5143549",
"0.51406795",
"0.5133487",
"0.5126049",
"0.5123648",
"0.5113494",
"0.51099443",
"0.5100345",
"0.5093438",
"0.50905675",
"0.50905675",
"0.50905675",
"0.50905675",
"0.50821024",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.50716037",
"0.5069934",
"0.50451505",
"0.5039286",
"0.5039286",
"0.50112045",
"0.5010597",
"0.5010597",
"0.5004966",
"0.50047827",
"0.50024724",
"0.5001771",
"0.49989927",
"0.49877125",
"0.49864134",
"0.49707887",
"0.49675375",
"0.49675375",
"0.4961642",
"0.4956666",
"0.4948468",
"0.49475464",
"0.49455884",
"0.49322975",
"0.4923395",
"0.4921196",
"0.49172068",
"0.4913354",
"0.49125975"
] |
0.8558592
|
0
|
destroy the secondary_publication_number with id = params[:id]
|
def destroy
thisNumber = SecondaryPublicationNumber.find(params[:id])
thisNumber.destroy
@secondary_publications = @study.get_secondary_publications(params[:extraction_form_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n @primary_publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publication_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication_number = PublicationNumber.find(params[:id])\n @publication_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(publication_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n \tputs (\"CALL TO DESTROY -------------\")\n @secondary_publication = SecondaryPublication.find(params[:id])\n\t@study_id = @secondary_publication.study_id\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\t\n\t@secondary_publication.shift_display_numbers(@study_id)\n\t@extraction_form_id = @secondary_publication.extraction_form_id\n @secondary_publication.destroy\n secondary_publications = []\n @secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id => @study_id, :extraction_form_id=>@extraction_form_id})\n @secondary_publication = SecondaryPublication.new\n puts \"Secondary Publications is of length #{@secondary_publications.length}\\n\\n\"\n end",
"def destroy\n\n @publication = Publication.find_by_id(params[:id])\n @publication.destroy\n flash[:success] = \"Journal publication deleted.\"\n redirect_to :action=>\"index\"\n end",
"def destroy\n @primary_publication = PrimaryPublication.find(params[:id])\n @primary_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_publication = StudentPublication.find(params[:id])\n @student_publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(student_publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n head :no_content\n end",
"def destroy\n @publication = Publication.find(params[:id])\n respond_to do |format|\n if can_delete?(@publication)\n @publication.destroy\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n else\n format.html { redirect_to(publications_url) }\n format.xml { render :xml => \"can't delete\", :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @publication = Publication.find(params[:id])\n @publication.destroy\n #expire_action :action => :index\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication_type = PublicationType.find(params[:id])\n @publication_type.destroy\n\n respond_to do |format|\n format.html { redirect_to publication_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'La publicación fue destruida exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def remove_publication(pub_id)\n add_actions \"RemovePublication(#{pub_id})\"\n end",
"def destroy\n #remove all the links for this publication\n links = Link.find(:all, :conditions => { :object_type => \"Publication\", :object_id => @publication.id, :predicate => \"link\" })\n links.each do |link|\n link.destroy\n end\n @publication.destroy\n\n respond_to do |format|\n format.html { redirect_to(publications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'Publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'Publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'Publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_publication.destroy\n respond_to do |format|\n format.html { redirect_to saved_publications_url, notice: 'Saved publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publink = Publink.find(params[:id])\n @publink.destroy\n\n respond_to do |format|\n format.html { redirect_to publinks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n pub = Publication.find_by(id: params[:id])\n if pub.blank?\n head :not_found\n return\n elsif pub.deleted?\n head :gone\n return\n end\n pub.delete!\n render json: pub.id\n end",
"def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Publicação foi excluída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n deleted_publication = @publication.pub_name\n deleted_publication_client = @publication.client.client_name\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"Publication #{deleted_publication} for #{deleted_publication_client} was successfully deleted\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publication_name.destroy\n respond_to do |format|\n format.html { redirect_to publications_url, notice: 'Publication name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Ubication.delete_all(:publication_id => @publication.id)\n Image.delete_all(:publication_id => @publication.id)\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to :controller => 'dashboard', :action => \"index\", :id => current_user.id }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub = Pub.find(params[:id])\n @pub.destroy\n\n respond_to do |format|\n format.html { redirect_to pubs_url }\n format.json { head :no_content }\n end\n end",
"def update\n @secondary_publication_number = SecondaryPublicationNumber.find(params[:id])\n\t@secondary_publication_number.update_attributes(params[:secondary_publication_number])\n end",
"def destroy\n @pdf2 = Pdf2.find(params[:id])\n @pdf2.destroy\n\n respond_to do |format|\n format.html { redirect_to(pdf2s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n flash[:notice] = 'Distribution a bien été suprimée.'\n @distribution = Distribution.find(params[:id])\n @distribution.destroy\n\n respond_to do |format|\n format.html { redirect_to foyer_distributions_url(@foyer) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @primary.destroy\n respond_to do |format|\n format.html { redirect_to primarys_url, notice: 'Primary article was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @number = Number.where(:value => params[:number][:value]).first\n @number.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @view_publication.destroy\n respond_to do |format|\n format.html { redirect_to view_publications_url, notice: 'View publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub.destroy\n\n head :no_content\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_publication.destroy\n respond_to do |format|\n format.html { redirect_to user_publications_url, notice: 'Publication was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n document = Document.find(params[:id])\n document.destroy\n redirect_to :controller => 'related_service_requests', :action => 'show', :anchor => 'documents', :service_request_id => params[:friendly_id], :id => params[:ssr_id]\n end",
"def destroy\n @primary.destroy\n respond_to do |format|\n format.html { redirect_to primaries_url, notice: 'Primary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n \t@doc = Doc.find params[:id]\n @doc.destroy\nend",
"def destroy\n @number_master = NumberMaster.find(params[:id])\n @number_master.destroy\n\n respond_to do |format|\n format.html { redirect_to(number_masters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n logger.debug \"Deletion Transcription ID: \"+params[:id]\n @transcription = Transcription.find(params[:id])\n int_page_id = @transcription.page_id\n int_transcription_id = @transcriptionl.id\n @transcription.destroy\n\n arr_prev_page_data = get_prev_page_last_line_data(int_page_id)\n do_page_lines(arr_prev_page_data[0], arr_prev_page_data[1], int_page_id)\n\n str_redirect_link = \"/pages/\"+@transcription.int_page_id.to_s+\"/edit?notice=New%20Transcription%20With%20ID%20\"+int_transcription_id.to_s+\"%20Deleted\"\n\n respond_to do |format|\n format.html { redirect_to str_redirect_link }\n format.json { head :no_content }\n end\n end",
"def destroy\n @alternate_title = AlternateTitle.find(params[:id])\n @alternate_title.destroy\n\n respond_to do |format|\n format.html { redirect_to(add_details_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @published_document = PublishedDocument.find(params[:id])\n @published_document.destroy\n\n respond_to do |format|\n format.html { redirect_to(published_documents_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Author.delete(params[:id])\n redirect_to(authors_path)\n end",
"def destroy\n @part_num = PartNum.find(params[:id])\n @part_num.destroy\n\n respond_to do |format|\n format.html { redirect_to(part_nums_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @upload = Upload.find(params[:id])\n publication_id = @upload.publication_id\n publication_uploads_url = \"/publications/#{publication_id}/uploads\"\n @upload.destroy\n respond_to do |format|\n format.html { redirect_to publication_uploads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mtb_publisher = MtbPublisher.find(params[:id])\n @mtb_publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to mtb_publishers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nr_parameter = NrParameter.find(params[:id])\n @nr_parameter.destroy\n\n respond_to do |format|\n format.html { redirect_to(nr_parameters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @num_contenedor.destroy\n redirect_to \"/asignacion/\".to_s + @num_contenedor.asignations_id.to_s\n end",
"def destroy\n @publinktype = Publinktype.find(params[:id])\n @publinktype.destroy\n\n respond_to do |format|\n format.html { redirect_to publinktypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @secondary.destroy\n respond_to do |format|\n format.html { redirect_to secondaries_url, notice: 'Secondary was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @submission_detail.attachment = nil\n @submission_detail.destroy\n respond_to do |format|\n format.html { redirect_to submissions_url, notice: 'Document was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pubtype = Pubtype.find(params[:id])\n @pubtype.destroy\n\n respond_to do |format|\n format.html { redirect_to pubtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @phonenumber = Phonenumber.find(params[:id])\n @phonenumber.destroy\n\n head :no_content\n end",
"def destroy_student\n @signature = Signature.find(params[:id])\n @signature_student = @signature.signatures_students.find(:first,\n :conditions=>['year_id=? AND student_id=?', params[:year_id], params[:student_id]])\n @signature_student.destroy rescue flash[:notice] = 'No se puede borrar al alumno de esta asignatura'\n\n respond_to do |format|\n format.html { redirect_to(@signature) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @student_number.destroy\n respond_to do |format|\n format.html { redirect_to student_numbers_url, notice: 'Broj studenata je uspješno obrisan.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n Author.destroy(params[:id])\n redirect_to '/authors'\n end",
"def destroy\n @num = params[:num]\n \trender :\"book/destroy\"\n end",
"def destroy\n @insert_pub.destroy\n respond_to do |format|\n format.html { redirect_to insert_pubs_url, notice: 'Insert pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @page = @chapter.pages.find_by_number(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to manga_chapter_url(@manga, @chapter) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @issuance = Issuance.where(id: params[:id]).first\n @issuance.destroy\n redirect_to issuances_path\n end",
"def destroy\n @sched_prevision = SchedPrevision.find(params[:id])\n @sched_prevision.destroy\n\n flash[:notice] = 'Se eliminó la previsión con éxito'\n\n redirect_back_or_default({:controller => \"sched_previsions\"})\n end",
"def destroy_it_module\n @school_module = SchoolModule.find_by(id: params[:id])\n @school_module.destroy\n redirect_to school_modules_path\n end",
"def destroy\n @subscriber = Helpdesk::Subscriber.find_by_hashcode(params[:hashcode])\n @subscriber.destroy\n redirect_to root_path\n end",
"def destroy\n @publisher.destroy\n\n respond_to do |format|\n format.html { redirect_to(publishers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publication_request.destroy\n respond_to do |format|\n format.html { redirect_to publication_requests_url, notice: 'Publication request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @partner_link = PartnerLink.find(params[:id])\n @partner_link.destroy\n\n respond_to do |format|\n format.html { redirect_to(partner_links_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @publisher = Publisher.find(params[:id])\n @publisher.destroy\n\n respond_to do |format|\n format.js {render :nothing => true}\n format.html { redirect_to publishers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @publish = Publish.find(params[:id])\n @publish.destroy\n\n respond_to do |format|\n format.html { redirect_to publishes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @publicacion = Publicacion.find(params[:id])\n @publicacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(publicacions_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @person = Person.find((params[:person_id]))\n @person_identification_doc = PersonIdentificationDoc.find(params[:id])\n @person_identification_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to person_person_identification_docs_path, :notice => 'Documentação excluída.' }\n format.json { head :no_content }\n end\n end",
"def destroy\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 @sponsor.destroy\n respond_to do |format|\n format.html { redirect_to([:manage, sponsors_url]) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @thesis_proposal = ThesisProposal.find(params[:id])\n @thesis_proposal.destroy\n\n respond_to do |format|\n format.html { redirect_to(thesis_proposals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @digital_edition = DigitalEdition.find(params[:id])\n @digital_edition.destroy\n\n respond_to do |format|\n format.html { redirect_to digital_editions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @distributor = Distributor.find params[:id]\n @distributor.destroy\n flash[:success] = 'Distributor was successfully destroyed.'\n redirect_to admin_distributors_url\n end",
"def destroy\n @citation = Citation.find(params[:id])\n @citation.sites.destroy\n @citation.destroy\n\n # Someone might erase a citation they (or someone else) is 'linked' to so remove it for them\n # if necessary and in the layou we check if the citation exists and if not unlink them.\n session['citation'] = nil if session['citation'] == params[:id]\n\n respond_to do |format|\n format.html { redirect_to(citations_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end",
"def destroy \n Instagram.delete_subscription({:id => params[:id]})\n local_subscription = Subscription.find_by_original_id params[:id]\n local_subscription.destroy if local_subscription\n redirect_to :admin_subscriptions\n end",
"def destroy\n document = @issuer_document_tag.document\n @issuer_document_tag.destroy\n respond_to do |format|\n format.html { redirect_to edit_document_path(document), notice: 'Se ha eliminado el tag exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @published = Published.find(params[:id])\n @published.destroy\n\n respond_to do |format|\n format.html { redirect_to publisheds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\t\t\t @sub = Sub.find(params[:id])\n\t\t\t @sub.destroy\n\t\t\t head :no_content\n\t\t end",
"def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n standard_destroy(OrganizationType, params[:id])\n end",
"def destroy\n @alien_numeral.destroy\n respond_to do |format|\n format.html { redirect_to alien_numerals_url, notice: 'Alien numeral was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @recall = Recall.find(params[:id])\n @recall.destroy\n\n respond_to do |format|\n format.html { redirect_to [:admin,:recalls], notice: 'Отзыв удален.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @isbn.destroy\n respond_to do |format|\n format.html { redirect_to isbns_url, notice: 'Isbn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @secondary_publication_number = SecondaryPublicationNumber.new(params[:secondary_publication_number])\n\t@secondary_publication_number.save\n end",
"def destroy\n @number_record.destroy\n respond_to do |format|\n format.html { redirect_to number_records_url, notice: 'Number record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @quality_action_number = QualityActionNumber.find(params[:id])\n @quality_action_number.destroy\n\n respond_to do |format|\n format.html { redirect_to quality_action_numbers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pub.destroy\n respond_to do |format|\n format.html { redirect_to pubs_url, notice: 'Pub was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @post332 = Post332.find(params[:id])\n @post332.destroy\n\n respond_to do |format|\n format.html { redirect_to(post332s_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @citation.destroy\n end",
"def destroy\n @puntuation.destroy\n @unvoted_contribution = Contribution.find(@puntuation.contribution_id)\n @unvoted_contribution.decrement!(:puntuation, 1)\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end",
"def destroy\n @booking_postal_code = BookingPostalCode.find(params[:id])\n @booking_postal_code.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_booking_postal_codes_url }\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"
] |
[
"0.80431896",
"0.79194057",
"0.77324915",
"0.74989593",
"0.74416924",
"0.72103095",
"0.70939016",
"0.70771974",
"0.69101995",
"0.6900275",
"0.68852246",
"0.67765635",
"0.6715107",
"0.66988254",
"0.6673118",
"0.6650622",
"0.66505426",
"0.6644315",
"0.6644315",
"0.6644315",
"0.6606592",
"0.66055936",
"0.65955675",
"0.65955675",
"0.6594721",
"0.6583538",
"0.6516637",
"0.6511863",
"0.64425945",
"0.6431516",
"0.64081603",
"0.6385702",
"0.63853097",
"0.63834256",
"0.63762116",
"0.63565505",
"0.6355334",
"0.6353433",
"0.6353433",
"0.6353433",
"0.6338249",
"0.6330183",
"0.6322327",
"0.6303729",
"0.62492776",
"0.62430775",
"0.6237455",
"0.62354064",
"0.6234082",
"0.62248516",
"0.62194604",
"0.62155724",
"0.62147266",
"0.6206003",
"0.62023544",
"0.6199581",
"0.61926824",
"0.6170257",
"0.6168579",
"0.61670417",
"0.6151309",
"0.6150592",
"0.6150379",
"0.61477035",
"0.6146536",
"0.61413693",
"0.61409026",
"0.61362255",
"0.6127662",
"0.61186373",
"0.61118776",
"0.6109539",
"0.610625",
"0.60962707",
"0.6095411",
"0.60948807",
"0.6093955",
"0.6082149",
"0.60794944",
"0.6078259",
"0.60710794",
"0.6064832",
"0.60569954",
"0.6052463",
"0.6051214",
"0.6050212",
"0.6049631",
"0.6044102",
"0.6043405",
"0.60390395",
"0.6037183",
"0.6036228",
"0.6032393",
"0.6031062",
"0.6028489",
"0.6025711",
"0.60243005",
"0.60214067",
"0.60200816",
"0.60153675"
] |
0.8735176
|
0
|
create a new secondary publication number
|
def new
@secondary_publication_number = SecondaryPublicationNumber.new
@secondary_publication_number.save
@study = Study.find(params[:study_id])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @secondary_publication_number = SecondaryPublicationNumber.new(params[:secondary_publication_number])\n\t@secondary_publication_number.save\n end",
"def update\n @secondary_publication_number = SecondaryPublicationNumber.find(params[:id])\n\t@secondary_publication_number.update_attributes(params[:secondary_publication_number])\n end",
"def create\n\t@secondary_publication = SecondaryPublication.new(params[:secondary_publication])\n \t@secondary_publication.display_number = @secondary_publication.get_display_number(params[:study_id])\n\t@secondary_publication.study_id = params[:study_id]\n\t@study_id = @secondary_publication.study_id\n\t@secondary_publication.save\n\t@secondary_publications = SecondaryPublication.find(:all, :order => 'display_number ASC', :conditions => {:study_id =>params[:study_id]})\t\n\t@study = Study.find(@study_id)\n\t@project = Project.find(@study.project_id)\n if @saved = @secondary_publication.save\n\t\t\n\t# create newly specified outcomes\n\tif !params[:secondary_publication_numbers_attributes].nil?\n\tparams[:secondary_publication_numbers_attributes].each do |item|\n\t\t@spn = SecondaryPublicationNumber.new\n\t\t@spn.number = item[1][:number]\n\t\t@spn.number_type = item[1][:number_type]\n\t\t@spn.secondary_publication_id = @secondary_publication.id\n\t\t@spn.save\t\n\tend\t\n\tend\t\t\n\t\t@secondary_publication = SecondaryPublication.new\n\t\t@message_div = \"saved_item_indicator_2\"\n else\n \tproblem_html = create_error_message_html(@secondary_publication.errors)\n\t\tflash[:modal_error] = problem_html\n end\n\t@error_div = \"validation_message\"\n end",
"def create\n @primary_publication_number = PrimaryPublicationNumber.new(params[:primary_publication_number])\n\n respond_to do |format|\n if @primary_publication_number.save\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully created.') }\n format.xml { render :xml => @primary_publication_number, :status => :created, :location => @primary_publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end",
"def create\n @publication_number = PublicationNumber.new(params[:publication_number])\n\n respond_to do |format|\n if @publication_number.save\n format.html { redirect_to(@publication_number, :notice => 'Publication number was successfully created.') }\n format.xml { render :xml => @publication_number, :status => :created, :location => @publication_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_publication(record, wssr)\n contrib = Contribution.new(\n author_id: author.id,\n cap_profile_id: author.cap_profile_id,\n featured: false, status: 'new', visibility: 'private'\n )\n Publication.create!( # autosaves contrib\n active: true,\n pub_hash: record.pub_hash,\n wos_uid: record.uid,\n pubhash_needs_update: true,\n contributions: [contrib]\n ) do |pub|\n pub.web_of_science_source_record = wssr if wssr.publication.blank?\n end\n end",
"def add_publication(pub_id)\n add_actions \"AddPublication(#{pub_id})\"\n end",
"def assign_control_doc_number\n\t\tself.control_doc_number = Time.now.strftime(\"%Y\") + \"/\" + Time.now.to_i.to_s\n\t\tself.control_doc_number\n\tend",
"def pubid; end",
"def increment_public_id\n if self.public_id.blank?\n self.public_id = Compound.exists? ? Compound.order(:public_id).last.public_id.next : 'RDDB00001'\n end\n end",
"def secondary_id=(v)\n @secondary_id = alma_string v\n end",
"def create\n @primary_publication = PrimaryPublication.new(params[:primary_publication])\n\t@primary_publication.study_id = params[:study_id]\n respond_to do |format|\n if @primary_publication.save\n\t\tformat.js{\n\t\t\trender :update do |page|\n\t\t\t\tsaved_html = \"<div class='success_message'>Saved Successfully!</div><br/>\"\n\t\t\t\tpage.replace_html 'primary_pub_save_message', saved_html\n\t\t\tend\n\t\t}\n\t\telse\n format.html { render :action => \"new\" }\n format.xml { render :xml => @primary_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def published!(details)\n node = @meta.at_xpath('./a:publication', a: NS)\n unless node\n node = @doc.create_element('publication')\n @meta.at_xpath('./a:identification', a: NS).after(node)\n end\n\n node['showAs'] = details[:name] if details.has_key? :name\n node['name'] = details[:name] if details.has_key? :name\n node['date'] = details[:date] if details.has_key? :date\n node['number'] = details[:number] if details.has_key? :number\n end",
"def create\n @online_student = OnlineStudent.new(params[:online_student])\n latest_id = OnlineStudent.maximum('id')\n if latest_id.nil?\n cur_id = 1\n else\n cur_id = latest_id + 1\n end\n\n # Generate Application Number\n @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n # @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n\n respond_to do |format|\n if @online_student.save\n format.html { redirect_to @online_student, notice: 'Your Application was successfully submitted.' }\n format.json { render json: @online_student, status: :created, location: @online_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @online_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @primary_publication_number = PrimaryPublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @primary_publication_number }\n end\n end",
"def generate_public_id\n self.public_id = Time.now.to_i.to_s 36\n end",
"def create\n init = params[:distrik][:name][0]\n distributor = Distributor.find_by_name(params[:distributor_id])\n distrik_number = Distrik.create_number(params)\n @distrik = Distrik.new(distrik_params.merge(:distributor_id => (distributor.id rescue nil)))\n if @distrik.save\n flash[:notice] = t(:successfully_created)\n redirect_to distriks_path\n else\n flash[:error] = @distrik.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def create_record(init)\n subject.transaction(requires_new: true) do\n InternalId.create!(\n **scope,\n usage: usage_value,\n last_value: init.call(subject) || 0\n )\n end\n rescue ActiveRecord::RecordNotUnique\n lookup\n end",
"def create_new_version!\n if self.new?\n raise DataCatalog::Error, \"document must be saved before versioning\"\n end\n unless self.id\n raise DataCatalog::Error, \"expected document to have an id\"\n end\n copy = self.dup\n copy.id = BSON::ObjectID.new.to_s\n copy.next_id = self.id\n copy.save!\n self.previous_id = copy.id\n copy\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n #puts \"==> #{status}: #{response}\"\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def subscribe( publication )\n subscriptions.create(publication: publication) unless has_subscribed?(publication)\n rescue ActiveRecord::RecordNotUnique\n end",
"def create_publisher\n pub = Publisher.new(description: 'Your description goes here!', user: self)\n pub.save\n end",
"def create\n init = params[:distributor][:name][0]\n area_id = Area.find_by_name(params[:area_id])\n distributor_number = Distributor.create_number(params)\n @distributor = Distributor.new(distributor_params.merge(:area_id => (area_id.id rescue nil)))\n if @distributor.save\n flash[:notice] = t(:successfully_created)\n redirect_to distributors_path\n else\n flash[:error] = @distributor.errors.full_messages.join('<br/>')\n render \"new\"\n end\n end",
"def generate_submission_id(time = nil, prefix: true)\n prefix = SID_PREFIX if prefix.is_a?(TrueClass)\n time = time.is_a?(DateTime) ? time.to_time : (time || Time.now)\n base_id = time.tv_sec\n letter = SID_LETTERS.first + rand(SID_LETTER_SPAN)\n sprintf('%s%x%c%02d', prefix, base_id, letter, sid_counter)\n end",
"def newid( work )\n url = \"#{self.url}/dois\"\n payload = self.construct_payload( work )\n status, response = rest_post( url, payload )\n\n new_doi = response.dig('data', 'id')\n return status, \"doi:#{new_doi}\" if ok?( status ) && new_doi\n return status, ''\n end",
"def create_affiliation!(publication_version_id:, person:, position:, reviewed_at: nil, reviewed_publication_version_id: nil)\n p2p = People2publication.create({\n publication_version_id: publication_version_id,\n person_id: person[:id],\n position: position,\n reviewed_at: reviewed_at,\n reviewed_publication_version_id: reviewed_publication_version_id\n })\n if p2p.errors.any?\n raise (V1::ControllerError.new(\n code: ErrorCodes::VALIDATION_ERROR,\n errors: { authors: p2p.errors.values }\n ))\n end\n if person[:departments].present?\n person[:departments].each.with_index do |department, j|\n d2p2p = Departments2people2publication.create({people2publication_id: p2p.id, department_id: department[:id], position: j + 1})\n if d2p2p.errors.any?\n raise (V1::ControllerError.new(\n code: ErrorCodes::VALIDATION_ERROR,\n errors: { authors: d2p2p.errors.values }\n ))\n end\n end\n end\n end",
"def create_id(parent)\n \"#{parent}/#{noid_service.mint}\"\n end",
"def create\n @student_publication = StudentPublication.new(params[:student_publication])\n\n respond_to do |format|\n if @student_publication.save\n format.html { redirect_to(@student_publication, :notice => 'Student publication was successfully created.') }\n format.xml { render :xml => @student_publication, :status => :created, :location => @student_publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @student_publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n respond_to do |format|\n if @publication.save\n format.html { redirect_to :controller => 'ubications', :action => \"new\", :id_pub => @publication.id }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def generate_number(isofferte)\n return id if isofferte.to_i == 1\n\n # TODO: scope per firm here!\n last_invoice = Invoice.order('number').last\n\n self.number = if last_invoice\n last_invoice.number + 1\n else\n # generate invoice nr based on year+month\n \"#{Time.new.strftime('%Y%m')}0001\".to_i\n end\n end",
"def assign_uuid\n self.uuid = UUIDTools::UUID.random_create.to_s\n self.document_number ||= Numerator.get_number\n end",
"def create\n set_unique_id if respond_to?(:set_unique_id) # hack\n save_doc\n end",
"def create_new\n create_doc_keys(true)\n initialize_document(@docs[:num_comments], 0)\n\n\t\t@comment_id = increase_atomic_count(@docs[:num_comments])\n\n\t\tcreate_doc_keys(true)\n\n create_default_docs\n end",
"def post(amount, secondary, description, journal=nil)\n journal ||= Journal.new\n journal.description = description\n\n reverse = !(self.debit ^ secondary.debit)\n\n journal.postings << self.postings.build(:amount => amount)\n journal.postings << secondary.postings.build(:amount => (reverse ? -amount : amount))\n journal.save!\n journal\n end",
"def create(args)\n version_params = {\n number: args[:number],\n pacticipant_id: args[:pacticipant_id],\n created_at: Sequel.datetime_class.now,\n updated_at: Sequel.datetime_class.now,\n build_url: args[:build_url]\n }.compact\n\n\n version = PactBroker::Domain::Version.new(version_params).upsert\n # branch can't be set from CRUD on the version resource, but it's convenient to be able\n # to make a version with a branch for internal code.\n branch_version_repository.add_branch(version, args[:branch]) if args[:branch]\n version\n end",
"def create\n @publication = Publication.new()\n pubmed_id = params[:publication][:pubmed_id]\n pubmed_id = nil if pubmed_id.blank?\n doi = params[:publication][:doi]\n doi = nil if doi.blank?\n result = get_data(@publication, pubmed_id, doi)\n @publication.contributor = current_user \n respond_to do |format|\n if @publication.save\n result.authors.each do |author|\n pa = PublicationAuthor.new()\n pa.publication = @publication\n pa.first_name = author.first_name\n pa.last_name = author.last_name\n pa.save\n end\n \n #Make a policy\n policy = Policy.create(:name => \"publication_policy\", :sharing_scope => 3, :access_type => 1, :use_custom_sharing => true, :contributor => current_user)\n @publication.asset.policy = policy\n policy.save\n @publication.asset.save\n #add managers (authors + contributor)\n @publication.asset.creators.each do |author|\n policy.permissions << Permission.create(:contributor => author, :policy => policy, :access_type => 4)\n end\n #Add contributor\n @publication.asset.policy.permissions << Permission.create(:contributor => @publication.contributor.person, :policy => policy, :access_type => 4)\n \n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(edit_publication_url(@publication)) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @publication_number = PublicationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @publication_number }\n end\n end",
"def create_new\n @uid = get_new_uid\n create_default_docs\n if @super_user\n add_super_user(@uid)\n end\n end",
"def generate_subjectid\n\t\tsubjectids = ( (1..999999).to_a - StudySubject.select('subjectid'\n\t\t\t).collect(&:subjectid).collect(&:to_i) )\n\t\tsprintf(\"%06d\",subjectids[rand(subjectids.length)].to_i)\n\tend",
"def generate(init)\n subject.transaction do\n # Create a record in internal_ids if one does not yet exist\n # and increment its last value\n #\n # Note this will acquire a ROW SHARE lock on the InternalId record\n (lookup || create_record(init)).increment_and_save!\n end\n end",
"def secondary_phone_number\n \"[SECONDARY_PHONE_NUMBER]\"\n end",
"def create\n @page = Page.find(params[:page_id])\n @rendered_page = render_to_string(:template => \"pages/show\", :layout => Bop.layout)\n @publication = @page.publications.create({ :rendered_page => @rendered_page })\n flash[:notice] = t(:publication_created)\n redirect_to @publication.route\n end",
"def create(params)\n params.merge!(\n :order_no => (Time.now.to_f * 10000).to_i.to_s, # Produce a unique order_no - it's not used anywhere, but ePay needs this\n :amount => 0\n )\n \n post = Api.default_post_for_params(params).merge({\n :subscription => 1,\n :subscriptionname => params[:description]\n })\n \n query = Api.authorize(post)\n \n if query['accept']\n # Return the new subscriber\n subscription = new(query[\"subscriptionid\"].to_i).reload\n \n # Set (obfuscated) card number:\n subscription.card_no = query[\"tcardno\"]\n \n subscription\n else\n new(nil, 'error' => query[\"error\"])\n end\n end",
"def InsertPublication (publication)\n puts \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n raise \"InsertPublication: this shouldn't happen - publication was nil\" if publication.nil?\n thePub = nil\n medline = Bio::MEDLINE.new(publication) # convert retrieved format into the medline format\n reference = medline.reference\n thePub = Abstract.find_by_pubmed(reference.pubmed)\n begin \n if thePub.nil? || thePub.id < 1 then\n thePub = Abstract.create!(\n :endnote_citation => reference.endnote, \n :abstract => reference.abstract,\n :authors => reference.authors.join(\"\\n\"),\n :full_authors => medline.full_authors,\n :publication_date => medline.publication_date,\n :electronic_publication_date => medline.electronic_publication_date,\n :deposited_date => medline.deposited_date,\n :status => medline.status,\n :publication_status => medline.publication_status,\n :title => reference.title,\n :publication_type => medline.publication_type[0],\n :journal => medline.full_journal[0..253],\n :journal_abbreviation => medline.ta, #journal Title Abbreviation\n :volume => reference.volume,\n :issue => reference.issue,\n :pages => reference.pages,\n :year => reference.year,\n :pubmed => reference.pubmed,\n :url => reference.url,\n :mesh => reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n )\n else\n if thePub.publication_date != medline.publication_date || thePub.status != medline.status || thePub.publication_status != medline.publication_status then\n thePub.endnote_citation = reference.endnote\n thePub.publication_date = medline.publication_date\n thePub.electronic_publication_date = medline.electronic_publication_date\n thePub.deposited_date = medline.deposited_date\n thePub.publication_status = medline.publication_status\n thePub.status = medline.status\n thePub.volume = reference.volume\n thePub.issue = reference.issue\n thePub.pages = reference.pages\n thePub.year = reference.year\n thePub.pubmed = reference.pubmed\n thePub.url = reference.url\n thePub.mesh = reference.mesh != '' ? reference.mesh.join(\";\\n\") : nil\n thePub.save!\n end\n # HandleMeshTerms(thePub.mesh, thePub.id)\n end\n rescue ActiveRecord::RecordInvalid\n if thePub.nil? then # something bad happened\n puts \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n raise \"InsertPublication: unable to find or insert reference with the pubmed id of '#{reference.pubmed}\"\n end\n end \n thePub\nend",
"def new_serial\n @soa[:serial] = self.class.next_serial(@soa[:serial])\n end",
"def new_interlink(sax, author_id)\n Interlink.new.tap do |interlink|\n interlink.author_id = author_id\n interlink.synset_id = sax.synset_id\n interlink.pwn = sax.pwn\n end\nend",
"def reserve_id(doi:)\n if id_exists?\n @resource.identifier.to_s\n else\n ezid_client.create_identifier(doi, status: 'reserved', profile: 'datacite')\n doi\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n if @publication.save\n redirect_to root_path, notice: \"Publication #{@publication.pub_name} was successfully created for #{@publication.client.client_name}\" \n else\n render :new\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n if params[:save_and_submit]\n @publication.preplanned_submit!\n format.html { redirect_to @publication, \n notice: 'Publication was successfully created and submitted to the publication group.' }\n else\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render json: @publication, status: :created, location: @publication }\n end \n else\n format.html { render action: \"new\" }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def pub_id(doc)\n # anchor(doc).gsub(\".\", \" \")\n fetch_doi(doc).split(\"/\")[1..].join(\"/\").gsub(\".\", \" \").sub(/^nist\\sir/, \"NIST IR\")\n end",
"def create\n @publication = Publication.new(params[:publication].merge(\n :user => User.current\n ))\n respond_to do |format|\n if @publication.save\n flash_notice(:runtime_created_at.t(:type => :publication))\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n flash_object_errors(@publication)\n format.html { render :action => :new }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to([:admin, @publication]) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_publication_name\n @publication_name = PublicationName.find(params[:id])\n end",
"def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"def add_serial_number\n serial_number = serial_number_stub\n # Converting to Base 36 can be useful when you want to generate random combinations of letters and numbers, since it counts using every number from 0 to 9 and then every letter from a to z. Read more about base 36 here: https://en.wikipedia.org/wiki/Senary#Base_36_as_senary_compression\n alphanumerics = (0...36).map{ |i| i.to_s 36 }\n 13.times{|t| serial_number << alphanumerics.sample}\n self.update(serial_number: serial_number)\n end",
"def create_pubsub_topic topic_id\n pubsub = Google::Cloud::Pubsub.new project: @project_id\n topic = pubsub.create_topic topic_id\n policy = topic.policy do |p|\n p.add \"roles/pubsub.publisher\",\n \"serviceAccount:cloud-iot@system.gserviceaccount.com\"\n end\n @topics << topic\n topic\n end",
"def set_publication\n @publication = Publication.friendly.find(params[:slug])\n end",
"def new_resource_id!\n uuid = Viziwiki::new_uuid\n # TODO write lock with create only\n #do\n # uuid = Viziwiki::new_uuid\n #unless lock_resource (uuid)\n uuid\n end",
"def create_new\n Rails.logger.debug(\"CREATE_NEW\")\n @uid = get_new_uid\n Rails.logger.debug(@uid)\n create_default_docs\n if @super_user\n add_super_user(@uid)\n end\n end",
"def publication(topic_id, id)\n Sensit::Api::Publication.new topic_id, id, @http_client\n end",
"def destroy\n thisNumber = SecondaryPublicationNumber.find(params[:id])\n thisNumber.destroy\n @secondary_publications = @study.get_secondary_publications(params[:extraction_form_id])\n end",
"def update\n @primary_publication_number = PrimaryPublicationNumber.find(params[:id])\n\n respond_to do |format|\n if @primary_publication_number.update_attributes(params[:primary_publication_number])\n format.html { redirect_to(@primary_publication_number, :notice => 'Primary publication number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @primary_publication_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_finance_fee(collection, student)\n last_receipt_no = FinanceFee.last.receipt_no if FinanceFee.last\n fee = FinanceFee.new\n fee.finance_fee_collection_id = collection\n fee.student_id = student\n fee.is_paid = false\n if last_receipt_no.nil?\n fee.receipt_no = 001\n else\n fee.receipt_no = last_receipt_no.next\n end\n fee.save\n end",
"def assign_patient_v3_npid(patient)\n identifier_type = PatientIdentifierType.find_by(name: 'National id')\n identifier_type.next_identifier(patient: patient)\n end",
"def publisher_id=(pub_id)\n @@publisher_id = pub_id\n end",
"def set_subscription_new_main\n @subscription_new_main = SubscriptionNewMain.find(params[:id])\n end",
"def create\n @publink = Publink.new(params[:publink])\n\n respond_to do |format|\n if @publink.save\n format.html { redirect_to @publink, notice: 'Publink was successfully created.' }\n format.json { render json: @publink, status: :created, location: @publink }\n else\n format.html { render action: \"new\" }\n format.json { render json: @publink.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(params[:publication])\n\n respond_to do |format|\n if @publication.save\n flash[:notice] = 'Publication was successfully created.'\n format.html { redirect_to(@publication) }\n format.xml { render :xml => @publication, :status => :created, :location => @publication }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @publication.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_new\n @radlib_id = get_new_radlib_id\n @radlib_text_array.clean_for_database\n create_default_docs\n end",
"def mintPub(postNum, pub)\n\n # Pick the best item for its metadata (don't consider Elements metadata)\n nonElemItems = pub.items.reject { |item| item.isFromElements }\n bestItem = nonElemItems.inject { |memo, item| isBetterItem(item, memo) ? item : memo }\n\n # Combine all the identifiers and remove duplicates\n ids = nonElemItems.map { |item| item.ids }.flatten(1).uniq\n campusIDs = nonElemItems.map { |item| item.campusIDs }.flatten(1).uniq\n\n # For existing groups, we'll already have an identifier in the database. Re-use it.\n foundOaps = Set.new\n campusToOAP = Hash.new{|h, k| h[k] = Hash.new }\n campusIDs.each { |scheme, id|\n old_oapID = db_get_first_value(\"SELECT oap_id FROM ids WHERE campus_id = ?\", \"#{scheme}::#{id}\")\n if old_oapID\n joined = db_get_first_value(\"SELECT isJoinedRecord FROM oap_flags WHERE oap_id = ?\", old_oapID)\n foundOaps << [joined ? 1 : 0, old_oapID]\n end\n campusToOAP[scheme][id] = old_oapID\n oapID ||= old_oapID\n }\n # If there are multiple OAP IDs, prefer the one that was joined, in case we're going to delete the other.\n oapID = foundOaps.empty? ? nil : foundOaps.sort()[-1][1]\n\n # If we can't find one, mint a new one.\n if not oapID\n idStr = ids.to_a.map { |scheme, id| \"#{scheme}::#{id}\" }.join(' ')\n if not $testMode\n puts \"[Minting new OAP ID for upcoming post #{postNum}]\"\n end\n # Determine the EZID metadata\n meta = { 'erc.what' => normalizeERC(\"Grouped OA Publication record for '#{bestItem.title}' [IDs #{idStr}]\"),\n 'erc.who' => normalizeERC(bestItem.authors.map { |auth| auth.split(\"|\")[0] }.join('; ')),\n 'erc.when' => DateTime.now.iso8601 }\n # And mint the ARK\n oapID = mintOAPID(meta)\n end\n\n # Associate this OAP identifier with all the item IDs so that in future this group will reliably\n # receive the same identifier.\n campusCache = Hash.new { |h,k| h[k] = Set.new }\n assocChanges = nil\n campusIDs.each { |scheme, id|\n if campusToOAP[scheme] && campusToOAP[scheme][id]\n if campusToOAP[scheme][id] == oapID\n checkNewAssoc(scheme, id, oapID, campusCache)\n # Unchanged association - don't need to update db\n else\n (assocChanges ||= Array.new) << [\"#{scheme}::#{id}\", campusToOAP[scheme][id], oapID]\n checkNewAssoc(scheme, id, oapID, campusCache)\n end\n else\n # New association - add it to the db\n checkNewAssoc(scheme, id, oapID, campusCache)\n #puts \" Inserting new OAP ID.\"\n db_execute(\"INSERT INTO ids (campus_id, oap_id) VALUES (?, ?)\", [\"#{scheme}::#{id}\", oapID])\n end\n }\n\n # Dissociate any item IDs that aren't in this group\n checkAgainst = campusIDs.map { |scheme, id| \"#{scheme}::#{id}\" }\n db_execute(\"SELECT campus_id FROM ids WHERE oap_id = ?\", oapID).each { |row|\n if !checkAgainst.include?(row[0])\n (assocChanges ||= Array.new) << [row[0], oapID, nil]\n end\n }\n\n if $onlyElem\n return unless isOnlyElem(ids, oapID)\n end\n\n # Special handling of items hopping from one OAP pub to another\n if assocChanges\n $elementsAPIMutex.synchronize {\n return unless handleAssocChanges(postNum, pub, ids, oapID, assocChanges)\n }\n end\n\n # Ready for import\n $importQueue << [postNum, pub, ids, bestItem, oapID]\nend",
"def bib_number\n get_id_from_lane_assignment(competition, heat, lane) || 0\n end",
"def new_org_dxid\n Org.construct_dxorg(orgname)\n end",
"def add_docidentifier\n @bib.docidentifier.each do |i|\n case i.type\n when \"isbn\" then @item.isbn = i.id\n when \"lccn\" then @item.lccn = i.id\n when \"issn\" then @item.issn = i.id\n end\n end\n end",
"def make_id\n new_id = @id\n @id += 1\n new_id\n end",
"def create_local_npid(patient, malawi_national_id)\n assign_patient_v3_npid(patient)\n assign_patient_v28_malawiNid(patient, malawi_national_id) if malawi_national_id.present?\n end",
"def new\n \n @subject = Subject.new(:name => 'Default')\n @subject_count = Subject.count + 1\n end",
"def reserve_id(doi:)\n doi\n end",
"def create\n datasource = params[:publication][:datasource]\n sourceid = params[:publication][:sourceid]\n publication = {}\n\n if !ImportManager.datasource_valid?(datasource: datasource)\n error_msg(ErrorCodes::OBJECT_ERROR, \"Given datasource is not configured: #{datasource}\")\n render_json\n return\n end\n\n case datasource\n when \"none\"\n #do nothing\n else\n item = ImportManager.find(datasource: datasource, sourceid: sourceid)\n if item && item.errors.messages.empty?\n publication.merge!(item.json_data)\n else\n error_msg(ErrorCodes::VALIDATION_ERROR, \"Identifikatorn #{sourceid} hittades inte i #{datasource}\")\n render_json\n return\n end\n end\n\n # Check publication identifiers for possible duplications\n\n publication_identifiers = publication[:publication_identifiers] || []\n\n publication_identifier_duplicates = Publication.duplicates(publication_identifiers)\n publication[:publication_identifier_duplicates] = publication_identifier_duplicates\n\n @response[:publication] = publication\n render_json\n\n end",
"def generate_slug\n date = DateTime.current\n seed = sprintf '%03d', rand(0..999)\n major, minor = VERSION.split('.')[0..1]\n minor = sprintf '%02d', minor\n self.slug = date.strftime(\"%m%d-%y-#{major}#{minor}#{seed}\")\n end",
"def publish\n self.push_message_to_client\n update_attribute(:number, self.number+1)\n end",
"def new_id\n dbm = self.class.dbm\n\n max = dbm.keys.map { |k| k.to_i }.max || 0\n id = max + 1\n\n dbm[id.to_s] ||= \"\"\n\n id.to_s\n end",
"def primary_phone=(n)\n pull unless @details\n pn = Quickbooks::Model::TelephoneNumber.new\n pn.free_form_number = n\n @details.primary_phone = pn\n #update our locally stored number too\n update_phone_number\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def create\n @saved_publication = SavedPublication.new(saved_publication_params)\n\n respond_to do |format|\n if @saved_publication.save\n format.html { redirect_to @saved_publication, notice: 'Saved publication was successfully created.' }\n format.json { render :show, status: :created, location: @saved_publication }\n else\n format.html { render :new }\n format.json { render json: @saved_publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_new_document(out = nil)\n print out if out\n exit 207\n end",
"def set_invoice_number\n self.invoice_number = self.id + 777777\n self.save\n end",
"def create\n @course = Course.new(params[:course])\n @course_template = CourseNumber.find(params[:course][:course_number_id]) unless params[:course][:course_number_id].blank?\n if @course_template\n @course.name = @course_template.name\n @course.number = @course_template.number \n end\n\n respond_to do |format|\n if @course.save\n flash[:notice] = 'Course was successfully created.'\n format.html { redirect_to(@course) }\n format.xml { render :xml => @course, :status => :created, :location => @course }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @course.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def new_id\n @last_id ||= 0\n @last_id += 1\n end",
"def publication_date\n pubdate=@pubmed['DP'].strip.split(\" \")\n if pubdate.length > 2\n pubdate[2].to_s + '-' + pubdate[1].to_s + '-' + pubdate[0].to_s\n elsif pubdate.length == 2\n '01-'+ pubdate[1]+'-'+ pubdate[0]\n elsif pubdate.length == 1\n '01-JAN-'+ pubdate[0]\n else\n nil\n end\n end",
"def register_with_pkyp\n send_to_pkyp(@pub.to_s)\n end",
"def pmid\n pmid = params[:pmid].to_i\n @paper = Paper.find_or_create_by_pubmed_id(pmid)\n if @paper.title.nil?\n @paper.lookup_info\n end\n @paper.save\n\n if @error\n flash[:error] = @error\n redirect_to :back\n else\n respond_to do |format|\n format.html { redirect_to @paper}\n format.xml { render :xml => @paper.xml_hash}\n end\n\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @publication = Publication.new(publication_params)\n\n respond_to do |format|\n if @publication.save\n format.html { redirect_to @publication, notice: 'Publication was successfully created.' }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def newId\r\n @seed = @seed + 1\r\n \"X#{@seed}\"\r\n end",
"def create\n @publication = Publication.new(publication_params)\n @publication.user_id = current_user.id\n @publication.end_date = @publication.effective_date + @publication.plan.duration.months\n \n @publication.payment_status = \"No realizado\"\n # Los planes gratuitos se inicializan en pagos\n @publication.payment_status = \"Realizado\" if (@publication.plan.id == Plan.get_free_plan_id)\n\n respond_to do |format|\n if @publication.save\n url_to_redirect = \"/publications/payment_return/#{@publication.id}/1\"\n if (@publication.plan.id != Plan.get_free_plan_id)\n url_to_redirect = @publication.url_de_pago\n end\n \n @publication.available!\n format.html { redirect_to url_to_redirect }\n format.json { render :show, status: :created, location: @publication }\n else\n format.html { render :new }\n format.json { render json: @publication.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_publication\n @publication = Publication.find(params[:id])\n end",
"def create_or_update_study\n puts \"#{nct_id}\"\n study = Study.find_by(nct_id: nct_id)\n if study\n study.remove_study_data \n else\n puts \" not-found\"\n end\n s = Time.now\n build_study\n puts \" insert-study #{Time.now - s}\"\n end",
"def increment_manuscript_rev_num\n if self.version && self.article\n num = self.manuscript_number \n rev = num.scan(/\\.R\\d+/)[0]\n if rev\n num.gsub!(/\\.R\\d+/,\"\")\n rev_num = rev.gsub(/\\.R/,\"\")\n rev_num = rev_num.to_i\n num+=\".R#{rev_num+1}\"\n else\n num = \"#{num}.R1\"\n end \n self.article.update_attribute(:manuscript_num,num)\n end\n end"
] |
[
"0.7821808",
"0.652723",
"0.6334438",
"0.62523",
"0.6138741",
"0.6051078",
"0.5921318",
"0.58881074",
"0.5673987",
"0.5639798",
"0.5617764",
"0.5617585",
"0.55672526",
"0.5545342",
"0.55273485",
"0.54887897",
"0.5443621",
"0.54332507",
"0.5428697",
"0.53808475",
"0.537051",
"0.53481436",
"0.5327455",
"0.5306474",
"0.530448",
"0.5280392",
"0.52597576",
"0.52534056",
"0.52520293",
"0.5250081",
"0.52396137",
"0.5237111",
"0.52362305",
"0.52271116",
"0.5220366",
"0.52184546",
"0.52156436",
"0.5207621",
"0.5199333",
"0.5197691",
"0.5191456",
"0.51666",
"0.5161028",
"0.5146757",
"0.51247585",
"0.51238114",
"0.51120776",
"0.5107458",
"0.50953466",
"0.5091474",
"0.50843155",
"0.5050165",
"0.50426733",
"0.50316846",
"0.5028129",
"0.5028129",
"0.5017123",
"0.50144535",
"0.5013871",
"0.50031054",
"0.5001929",
"0.4998061",
"0.49960837",
"0.49946332",
"0.4993766",
"0.49853528",
"0.49810633",
"0.4974266",
"0.4974141",
"0.49737072",
"0.4968463",
"0.49587885",
"0.49562463",
"0.49511728",
"0.4945299",
"0.4943993",
"0.4937037",
"0.4934656",
"0.49259874",
"0.4922547",
"0.4922492",
"0.49201673",
"0.49160135",
"0.4915832",
"0.49091202",
"0.49076974",
"0.49072698",
"0.49059162",
"0.4904728",
"0.4904728",
"0.48963812",
"0.48945135",
"0.4891878",
"0.48913428",
"0.48913428",
"0.4886304",
"0.4885167",
"0.48833352",
"0.4877717",
"0.4877292"
] |
0.6519648
|
2
|
this will be overriden by csv uploads if the file has the overriden date in it
|
def update_base_price
@calendar = Calendar.find_by(date: params[:date][:date])
@calendar.base_value = params[:cost][:cost]
@calendar.save
UpdatePrice.update_calendar_item(@calendar)
redirect_to admin_path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def setUploadedDateFormat(uploadedDateFormat)\r\n\t\t\t\t\t@uploadedDateFormat = uploadedDateFormat\r\n\t\t\t\tend",
"def file_datetime\n @file_datetime\n end",
"def setUploadedDate(uploadedDate)\r\n\t\t\t\t\t@uploadedDate = uploadedDate\r\n\t\t\t\tend",
"def save_to_dropbox_only_on_date_change(file_name)\n if @last_file_name and file_name != @last_file_name\n save_to_dropbox @last_file_name\n end\n @last_file_name = file_name\n end",
"def read_date=(_); end",
"def upload_date\n data.upload_date\n end",
"def data_upload_date\n formatted_timestamp(data['modifyDate'])\n end",
"def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"def date_overwrite(original, overwrite)\n date_present?(original) ? original : overwrite\n end",
"def file_name_date_to_date(record,row)\n #rintraccio il file\n file = ImportFile.find(session[:file_id])\n #campagna 199X\n camp90 = /([9])(\\d)\\D+\\d+[.]\\S*/\n #campagna 20XX in avanti\n camp00 = /(\\d+)\\D+\\d+[.]\\S*/\n #se il file si riferisce alle campagne dal 1990 al 1999\n if file.file_name =~ camp90\n #anno = 19 + numeri rimanenti\n anno = \"19\" + $1 + $2\n #se il file si riferisce alle campagne dal 2000 al 2099\n elsif file.file_name =~ camp00\n #anno = 20 + numeri rimanenti\n anno = \"20\" + $1\n end\n #memorizzo temporaneamente la data per poterci lavorare sopra\n data_temp = Copl.new\n data_temp.data = record.data\n #a meno che l'anno della data del record non corrisponda a quello del nome del file\n unless data_temp.data.year == anno.to_i\n #salvo l'errore\n save_error(record,\"File name - Data\",row)\n #segnalo che c'è stato un errore sulla riga\n session[:row_error] = true\n #e segnalo l'errore sul file\n session[:file_error] = true\n end\n end",
"def set_file_mtime\n write_attribute(:file_mtime, File.mtime(file_name)) if (file_mtime.blank? and !file_name.blank?)\n end",
"def modification_date=(_); end",
"def modified_files; end",
"def read_date; end",
"def getUploadedDateFormat\r\n\t\t\t\t\treturn @uploadedDateFormat\r\n\t\t\t\tend",
"def date_for_analytics(file)\n earliest = Sufia.config.analytic_start_date\n date_uploaded = string_to_date file.date_uploaded\n date_analytics = date_uploaded ? date_uploaded : file.create_date\n return date_analytics if earliest.blank?\n earliest > date_analytics ? earliest : date_analytics\n end",
"def modification_date; end",
"def setUploadedDateLong(uploadedDateLong)\r\n\t\t\t\t\t@uploadedDateLong = uploadedDateLong\r\n\t\t\t\tend",
"def getUploadedDate\r\n\t\t\t\t\treturn @uploadedDate\r\n\t\t\t\tend",
"def upload_date_time=(value)\n @upload_date_time = value\n end",
"def changed?(uploaded_file)\n record.reload\n super\n end",
"def date_in_file?(file, date)\n CSV.foreach(file, \"rb\") do |row|\n next unless row[0] == date\n return true\n end\n\n return false\nend",
"def upload_date_time\n return @upload_date_time\n end",
"def build_new_file(old_file_path:)\n headers = CSV.read(old_file_path, 'r').first\n\n CSV.open(ORIGINAL_FULL_PATH, 'w') do |csv|\n csv << headers\n CSV.foreach(old_file_path, headers: true).with_index(0) do |row, i|\n row['ScheduledTime'] = i.hour.from_now.strftime('%s')\n csv << row\n end\n end\n end",
"def getUploadedDateLong\r\n\t\t\t\t\treturn @uploadedDateLong\r\n\t\t\t\tend",
"def date\n file.version.authored_date.strftime(\"%B %d, %Y\")\n end",
"def file_uploaded_during_this_membership_term?\n return false unless current_member? || in_grace_period?\n\n if current_member?\n file_uploaded_on_or_after?(current_membership.first_day)\n else\n # is in_grace_period\n file_uploaded_on_or_after?(most_recent_membership.first_day) # FIXME is this correct?\n end\n end",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def get_processed_filename\n # We can make this if statement a single line, but then it'd be too long.\n filename = if file_options.nil? || file_options[:name].blank?\n name + '.csv'\n else\n file_options[:name]\n end\n if filename =~ /\\Ay#/\n date = Date.today.advance(days: -1)\n return date.strftime(filename[2..-1])\n else\n date = Date.today\n return date.strftime(filename)\n end\n end",
"def pre_process_logger_file\n\n require 'csv_helper'\n @data_template = parent.managed_repository{Voeis::DataStream.get(params[:data_template_id].to_i)} \n @project = parent\n @current_user = current_user\n #save uploaded file if possible\n if !params[:datafile].nil? && datafile = params[:datafile]\n if !params['datafile'].original_filename.include?(\".csv\") &&\n !params['datafile'].original_filename.include?(\".xls\") &&\n !params['datafile'].original_filename.include?(\".xlsx\") &&\n !params['datafile'].original_filename.include?(\".dat\") \n #! ['text/csv', 'text/comma-separated-values', 'application/vnd.ms-excel','application/octet-stream','application/csv','application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'].include?(datafile.content_type)\n flash[:error] = \"File #{params['datafile'].original_filename} has an usupported file extension. Voeis accepts .csv, .xls, .xlsx and .dat(csv format).\"\n redirect_to(:controller =>\"voeis/logger_imports\", :action => \"pre_process_logger_file_upload\", :params => {:id => params[:project_id]})\n\n else\n begin\n #file can be saved\n name = Time.now.to_s + params['datafile'].original_filename\n directory = \"data/\" + @project.id + \"/\" + Date.today.to_s\n unless Dir.exists?(directory)\n unless Dir.exist?(\"data/\" + @project.id)\n Dir.mkdir(\"data/\" + @project.id)\n end\n Dir.mkdir(directory)\n end\n @new_file = File.join(directory,name)\n File.open(@new_file, \"wb\"){ |f| f.write(params['datafile'].read)}\n \n if name.include?('.xlsx')\n xlsx = Excelx.new(\"#{directory}/#{name}\")\n csv_name = name.gsub('.xlsx','csv')\n xlsx.to_csv(\"#{directory}/#{csv_name}\")\n @new_file = File.join(directory,csv_name)\n elsif name.include?('.xls')\n xls = Excel.new(\"#{directory}/#{name}\")\n csv_name = name.gsub('.xls', '.csv')\n xls.to_csv(\"#{directory}/#{csv_name}\")\n @new_file = File.join(directory,csv_name)\n end\n \n @start_line = params[:start_line].to_i\n if params[:header_box] == \"Campbell\"\n @start_line = 5\n end\n #get the first row that has information in the CSV file\n @start_row = get_row(@new_file, @start_line)\n @row_size = @start_row.size-1\n\n @header_rows = @start_line < 2 ? -1 : @start_line -2\n\n\n @columns = Array.new\n (1..@start_row.size).map{|x| @columns << x}\n @vars = Hash.new\n\n Voeis::Variable.all.each do |v| \n\n @vars=@vars.merge({v.variable_name => v.id})\n end\n\n\n\n # @site_offset = Hash.new\n # @sites = {\"None\"=>\"None\"}\n # parent.managed_repository{Voeis::Site.all}.each do |s|\n # @sites = @sites.merge({s.name => s.id})\n # @site_offset = @site_offset.merge({s.id => s.time_zone_offset})\n # if s.time_zone_offset.to_s == \"unknown\"\n # begin\n # s.fetch_time_zone_offset\n # rescue\n # #do nothing\n # end\n # end\n # end\n @site = parent.managed_repository{Voeis::Site.get(params[:site_id].to_i)}\n if @site.time_zone_offset.to_s == \"unknown\" || @site.time_zone_offset.nil?\n begin\n @site.fetch_time_zone_offset\n rescue\n #do nothing\n end\n end\n @utc_offset_options=Hash.new\n (-12..12).map{|k| @utc_offset_options = @utc_offset_options.merge({k => k})} \n @sources = {\"None\"=>\"None\", \"Example:SampleName\"=>-1}\n Voeis::Source.all.each do |s|\n @sources = @sources.merge({s.organization + ':' + s.contact_name => s.id})\n end\n\n @variables = Voeis::Variable.all\n @var_properties = Array.new\n Voeis::Variable.properties.each do |prop|\n\n @var_properties << prop.name\n end\n @var_properties.delete_if {|x| x.to_s == \"id\" || x.to_s == \"his_id\" || x.to_s == \"time_units_id\" || x.to_s == \"is_regular\" || x.to_s == \"time_support\" || x.to_s == \"variable_code\" || x.to_s == \"created_at\" || x.to_s == \"updated_at\" || x.to_s == \"updated_by\" || x.to_s == \"updated_comment\"}\n\n @campbell_scientific = params[:header_box]\n @variable = Voeis::Variable.new\n @lab_methods = Voeis::LabMethod.all\n @field_methods = Voeis::FieldMethod.all\n @units = Voeis::Unit.all\n @offset_units = @units\n @spatial_offset_types = Voeis::SpatialOffsetType.all\n @time_units = Voeis::Unit.all(:units_type.like=>'%Time%')\n @variable_names = Voeis::VariableNameCV.all\n @quality_control_levels = Voeis::QualityControlLevel.all\n @sample_mediums= Voeis::SampleMediumCV.all\n @sample_types = Voeis::SampleTypeCV.all\n @sensor_types = Voeis::SensorTypeCV.all\n @logger_types = Voeis::LoggerTypeCV.all\n @value_types= Voeis::ValueTypeCV.all\n @speciations = Voeis::SpeciationCV.all\n @data_types = Voeis::DataTypeCV.all\n @general_categories = Voeis::GeneralCategoryCV.all\n @batch = Voeis::MetaTag.first_or_create(:name => \"Batch\", :category =>\"Chemistry\", :value=>\"\")\n @labs = Voeis::Lab.all\n\n \n @label_array = Array[\"Variable Name\",\"Variable Code\",\"Unit Name\",\"Speciation\",\"Sample Medium\",\"Value Type\",\"Is Regular\",\"Time Support\",\"Time Unit ID\",\"Data Type\",\"General Cateogry\"]\n @current_variables = Array.new \n @variables.all(:order => [:variable_name.asc]).each do |var|\n @temp_array =Array[var.variable_name, var.variable_code,@units.get(var.variable_units_id).units_name, var.speciation,var.sample_medium, var.value_type, var.is_regular.to_s, var.time_support.to_s, var.time_units_id.to_s, var.data_type, var.general_category]\n @current_variables << @temp_array\n end\n\n #parse csv file into array\n @csv_array = Array.new\n csv_data = CSV.read(@new_file)\n i = 0\n csv_data[0..-1].each do |row|\n temp_array = Array.new\n row.map! { |k| temp_array << k }\n @csv_array[i] = temp_array\n i = i + 1\n end\n @csv_size = i -1\n rescue\n flash[:error] = \"File #{params['datafile'].original_filename} could not be parsed correclty by VOEIS. Check your file to be sure it is correct.\"\n redirect_to(:controller =>\"voeis/logger_imports\", :action => \"pre_process_logger_file_upload\", :params => {:id => params[:project_id]})\n end\n end \n else\n flash[:error] = \"It appears something was wrong with you file. Please try again. You may need to try another version of your file.\"\n redirect_to(:controller =>\"voeis/logger_imports\", :action => \"pre_process_logger_file_upload\", :params => {:id => params[:project_id]})\n end\n end",
"def update(path, symbol, date, *args)\n unless path.exist?\n puts \"#{path} doesn't exist\"\n return\n end\n\n if date_in_file?(path, date)\n puts \"#{symbol}: #{date} already in file\"\n return\n end\n\n CSV.open(path, \"ab+\") do |csv|\n csv << [date] + args\n end\n\n puts \"#{symbol}: Updated\"\nend",
"def date\n self.publicized_or_packaged || super\n end",
"def date\n self.publicized_or_packaged || super\n end",
"def file_uploaded_now?(item = nil)\n item ||= default_to_self\n item.reload if item.is_a?(ActiveRecord::Base)\n file_uploaded?(item)\n end",
"def source_file_mtime; end",
"def touch_csv(csv_file_or_object, fields, field_generators = {})\n Slacker.touch_csv(csv_file_or_object, fields, field_generators)\n end",
"def update(uploaded_file)\n super\n record.save_changes(validate: false)\n end",
"def export_date_override\n return nil unless ENV.key?('EXPORT_DATE_OVERRIDE')\n\n today = Date.today\n days_ago = (0..30).find do | days_ago |\n exists_export? date: today-days_ago\n end.to_i\n\n days_ago -= 1 unless days_ago.zero?\n ( today - days_ago ).strftime( DATE_FORMAT )\n end",
"def creation_date=(_); end",
"def set_file_timestamps(file)\n self.created = file.ctime.to_s\n self.last_accessed = file.atime.to_s\n self.last_modified = file.mtime.to_s\n end",
"def create\n @feefile = Feefile.new(params[:feefile])\n ffile = params[:feefile][:feefilename]\n @feefile.feefilename= ffile.original_filename\n \n directory= \"uploads\"\n path =File.join(directory,ffile.original_filename)\n #FileUtils.copy(ffile.local_path, \"#{RAILS_ROOT}/public/uploads/#{ffile.original_filename}\")\n File.open(path,\"wb\"){ |f| f.write(ffile.read)}\n @feefile_dates= get_feefile_daterange(@feefile.feefilename) \n #@feefile.enddate = get_feefile_daterange(@feefile.feefilename)[1]\n @feefile.enddate = Date.strptime(@feefile_dates[1],'%d/%m/%Y')\n respond_to do |format|\n if @feefile.save\n format.html { redirect_to(@feefile, :notice => 'Feefile was successfully created.') }\n format.xml { render :xml => @feefile, :status => :created, :location => @feefile }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @feefile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def import_csv_lite_date(csv_params:, \n table_name:, \n table_cols:, \n date_col_name:, \n date_val:)\n \n # using table name temp load the intial csv\n # and then updating the results back in.\n table_name_temp = table_name.to_s + \"_clone\"\n \n # 1. clone and load\n ###################\n self.clone_and_load(csv_params: csv_params, \n table_name: table_name, \n table_cols: table_cols)\n \n # 2. fetch date\n ################\n recent_row = @db_insert.client[table_name].reverse_order(date_col_name).first\n most_recent_date = recent_row[date_col_name]\n @log.debug \">>\" + date_col_name.to_s\n @log.debug \">>\" + most_recent_date.to_s\n \n # 3. update.\n ############\n # Insert back the rows that are missing.\n # using the date param.\n where_param = date_col_name.to_s + \" > ?\", date_val.to_s\n @db_insert.import_from src_table: table_name_temp.to_sym, \n dest_table: table_name.to_sym, \n table_cols: table_cols, \n where_param: where_param\n \n return false\n end",
"def update(uploaded_file)\n super\n record.save(raise_on_failure: true)\n end",
"def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end",
"def upload_date(upload_date)\n return if upload_date.nil?\n\n Time.zone.at(upload_date / 1000).strftime('%Y-%m-%d')\n end",
"def masterfile_defaults\n {'date_end' => Date.new(2090,1,1), 'inv_code' => 'UL'}\n end",
"def released_on=date\n super DateTime.strptime(date, '%m/%d/%Y')\n end",
"def unique_date?\n if config['BATCH']['date']\n date_index = config['BATCH']['date'][0]\n dates = csv.collect{|row| row[date_index]}.compact\n dates.uniq.length == 1\n else\n true\n end\n end",
"def date() updated; end",
"def uploaded?\n Debate.where(:log_date => date).size > 0\n end",
"def set_file_from_raw_data\n self.status = 'archived'\n self.file = ActionDispatch::Http::UploadedFile.new(filename: filename, tempfile: tempfile_for_filedata)\n end",
"def original_purchase_date\n read_datetime_from_string('original_purchase_date')\n end",
"def mod_time\n File.mtime(@filepath)\n end",
"def read_pic_fdate(filename)\n date = File.mtime(filename)\nend",
"def read_pic_date(filename)\n date = read_pic_edate(filename) \n if date == nil \n date = read_pic_fdate(filename) \n end\n return date\nend",
"def roll_file?\n if @manual\n true\n else\n date = Date.today\n if date.year > @file_date.year\n true\n elsif @roll_period == :daily && date.yday > @file_date.yday\n true\n elsif @roll_period == :weekly && date.cweek != @file_date.cweek\n true\n elsif @roll_period == :monthly && date.month > @file_date.month\n true\n else\n false\n end\n end\n end",
"def archive_file_suffix\n case @roll_period\n when :weekly\n @file_date.strftime(\"week-of-%Y-%m-%d\").to_s\n when :monthly\n @file_date.strftime(\"%Y-%m\").to_s\n else\n @file_date.strftime(\"%Y-%m-%d\").to_s\n end\n end",
"def should_update?(file, since_date=nil)\n if since_date.nil?\n # if there is no specified date, then update everything\n return true\n else\n # if a file has been updated since a time specified by user\n file_date = File.mtime(file)\n return file_date > since_date\n end\nend",
"def check_dates\n if(self.d_publish.nil?) && (self.d_remove.nil?)\n self.d_remove = \"2094-03-25\"\n self.d_publish = Time.zone.today\n elsif(self.d_publish?)\n self.d_remove = \"2094-03-25\"\n elsif(self.d_remove?)\n self.d_publish = Time.zone.today\n end\n end",
"def check_esitate_epex(file_epex)\n csv = Roo::CSV.new(file_epex.to_s, csv_options: {col_sep: \";\"}) \n if csv.cell(1,2) != \"#{$day}/#{$month}/#{$year}\"\n @errore << \"La data all'interno del file #{file_epex.to_s} non coincide con la data selezionata\"\n end\n end",
"def outofdate?(path)\n fileutils.outofdate?(path, to_a)\n end",
"def getLogsSingleFileByDate(path,start_file_name,from_date,asc_by_fname,persist_from_date)\n require 'date'\n logs_date = Date.new\n valid_items = nil\n if(from_date != nil)\n begin\n from_date = Date.parse(from_date)\n rescue Exception => ex\n puts \"[Logstat] : Incorrect 'from_date' parameter: #{from_date}\"\n return\n end\n end\n date_regex = /\\A((\\d{1,2}[-\\/]\\d{1,2}[-\\/]\\d{4})|(\\d{4}[-\\/]\\d{1,2}[-\\/]\\d{1,2}))/\n list_logs = Array.new\n check_log_start = false\n log_items = \"\"\n\n File.foreach(path+\"/\"+start_file_name) do |line|\n #check first line start with a date string\n if((line.strip != \"\") && (line =~ date_regex))\n str_date = line[date_regex,1]\n #check if date is validate\n begin\n logs_date = Date.parse(str_date)\n #if monitor type is date\n if(from_date != nil)\n #if monitor only 1 file or multi file with sort by ASC file name\n if(asc_by_fname == nil || asc_by_fname) \n if(from_date <= logs_date)\n check_log_start = true\n valid_items = true\n else\n if(valid_items)\n list_logs << log_items\n end\n valid_items = false\n end\n else\n #if monitor multi file with sort by DESC file name\n if(from_date >= logs_date)\n check_log_start = true\n valid_items = true\n else\n if(valid_items)\n list_logs << log_items\n end\n valid_items = false\n end\n end\n else\n check_log_start = true\n end\n persist_from_date[\"persist_from_date\"] = str_date\n rescue Exception => e\n check_log_start = false\n puts \"[Logstat] : #{e}\"\n end\n else\n check_log_start = false\n end\n #Add log_items to list_logs\n if(valid_items.nil?)\n if(check_log_start )\n if(log_items.strip != \"\")\n list_logs << log_items\n end\n #New logs items\n log_items = line\n else\n if(log_items.strip != \"\")\n log_items += line\n end\n end\n else\n #if a new logs start,and previous items is valid then add it to list log\n if(check_log_start && valid_items)\n if(log_items.strip != \"\")\n list_logs << log_items\n end\n #New logs items\n log_items = line\n else\n if(log_items.strip != \"\")\n log_items += line\n end\n end\n end\n end\n\n #Last items\n if(valid_items == true )\n list_logs << log_items\n end\n return list_logs\nend",
"def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end",
"def initialize(filename)\r\n fp = File.open(filename, \"rb\").each_line do |line|\r\n dt = line.match(EXIF_datetime_regexp)\r\n if dt\r\n self.has_datetime = true\r\n self.datetime = dt[1] + dt[2] + dt[3] + dt[4] + dt[5] + dt[6] + '.jpg'\r\n\t\t\t self.timestamp = Time.local(dt[1], dt[2], dt[3], dt[4], dt[5], dt[6])\r\n end\r\n end\r\n fp.close\r\n end",
"def file_does_not_exist\n if self.xml_updated_at.present? && self.xml_content_type.present?\n file = self.xml.queued_for_write[:original]\n if file.present?\n doc = Nokogiri::XML(file)\n conf = doc.at_css('Conference')\n if conf.present?\n already_exists = Conference.not_deleted.where(:start_date => conf.at_css('StartDate').text[0..9])\n\n if already_exists.present? && !self.id.present?\n errors.add(:xml, I18n.t('activerecord.messages.agendas.cannot_be_public', :file_name => self.xml_file_name))\n end\n end\n file.rewind\n end\n end\n end",
"def old_post?\n post? && Time.utc(*filename_date_string.split(\"/\")) < Time.utc(2013, 4, 1)\n end",
"def should_generate_new_friendly_id?\n datetime_from_exif_changed? ||\n datetime_from_file_changed? ||\n datetime_from_manual_entry_year_changed? ||\n datetime_from_manual_entry_month_changed? ||\n datetime_from_manual_entry_day_changed? ||\n datetime_from_manual_entry_hour_changed? ||\n datetime_from_manual_entry_minute_changed? ||\n datetime_from_manual_entry_second_changed? ||\n source_attachment.changed? ||\n source_catalog_file_path_changed? ||\n source_type_changed? ||\n super\n end",
"def original_filename; end",
"def read_arrival(upload)\n active_date = self.active_date.to_date\n ArrivalFlight.arrival_codeshare(active_date)\n ArrivalFlight.arrival_codeshare(active_date.tomorrow)\n path = File.join(\"public/system/dailyrosters/#{active_date.to_formatted_s(:number)}\", upload)\n File.open(path, 'r') {|f|\n lines = f.readlines(\"\\n\")\n lines.each do |line|\n a = line.split(%r{[|\\s]+})\n if (a.length > 5 && a[3].match(/VN.*/))\n route = Routing.find_or_create_by_routing(a[4], {:is_arrival => true, :destination => \"Sai Gon\"})\n if (route.destination == \"Sai Gon\")\n aircraft = get_aircraft(a[2])\n time_raw = a[5].split(':')\n if (!a[6].nil? && a[6] == 'ARRNEXTDAY')\n flight_date = active_date.advance(:days => 1)\n sta_time = Time.local(flight_date.year, flight_date.month, flight_date.day, time_raw[0], time_raw[1])\n else\n sta_time = Time.local(active_date.year, active_date.month, active_date.day, time_raw[0], time_raw[1])\n flight_date = active_date\n end\n flight = ArrivalFlight.find_or_initialize_by_flight_no_and_flight_date(a[3], flight_date)\n # flight.flight_no = flight_no(a[3], route, flight_date)\n if a[3] == \"VN\"\n flight.flight_no = 'YY' + (ArrivalFlight.max_flight_number(flight_date) + 1).to_s\n flight.remarks = \"Pls check flight no.\"\n else\n flight.flight_no = a[3]\n flight.remarks = a[6] if !a[6].blank?\n end\n flight.routing_id = route.id\n flight.reg_no = aircraft.reg_no\n flight.flight_date = flight_date\n flight.is_domestic = flight.update_is_domestic\n flight.sta = sta_time\n flight.is_active = true\n flight.is_approval = false\n begin\n flight.save!\n rescue ActiveRecord::StatementInvalid => e\n if flight.flight_no == \"VN\"\n flight.flight_no = 'YY' + (ArrivalFlight.max_flight_number(flight_date) + 1)\n flight.remarks += \"Pls check flight no.\"\n flight.save!\n end\n rescue ActiveRecord::RecordNotSaved => e\n flight.errors.full_messages\n end\n end\n end\n end\n }\n path\n end",
"def cache!( new_file )\n super\n @old_tmp_file = new_file\n end",
"def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end",
"def import\n att_file_name = File.join(@dir, \"attendance_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n enr_file_name = File.join(@dir, \"enrollment_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n ili_file_name = File.join(@dir, \"ili_ads_#{Time.now.year}_#{Time.now.month}_#{Time.now.day}.csv\")\n EnrollmentImporter.new(@enroll_file).import_csv unless @enroll_file.blank?\n AttendanceImporter.new(@attendance_file).import_csv unless @attendance_file.blank?\n IliImporter.new(@ili_file).import_csv unless @ili_file.blank?\n File.rename(@enroll_file, enr_file_name) unless @enroll_file.blank?\n File.rename(@attendance_file, att_file_name) unless @attendance_file.blank?\n File.rename(@ili_file, ili_file_name) unless @ili_file.blank?\n FileUtils.mv(enr_file_name, File.join(@dir, \"archive\")) unless @enroll_file.blank?\n FileUtils.mv(att_file_name, File.join(@dir, \"archive\")) unless @attendance_file.blank?\n FileUtils.mv(ili_file_name, File.join(@dir, \"archive\")) unless @ili_file.blank?\n end",
"def datacite_available_date\n res = resources.files_published.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def set_MinUploadDate(value)\n set_input(\"MinUploadDate\", value)\n end",
"def getUploadedOn\r\n\t\t\t\t\treturn @uploadedOn\r\n\t\t\t\tend",
"def filename\n return unless original_filename\n if model.instance_variable_get('@_temporal_filename')\n model.instance_variable_get('@_temporal_filename')\n else\n timestamp = DateTime.now.strftime(\"%d-%m-%Y-%H-%M\")\n random_id = SecureRandom.hex\n temporal_filename = \"#{timestamp}-#{random_id}-#{original_filename}\"\n model.instance_variable_set('@_temporal_filename', temporal_filename)\n end\n end",
"def released_on=date\n super Date.strptime(date, '%m/%d/%Y') #Converts the string entered in the form to be formatted to a date\n end",
"def ensure_correct_added_date_format\n date = Date.parse(added) rescue nil\n self.added = date.strftime(\"%Y-%m-%d\") if date.present?\n end",
"def file_field; end",
"def existing_files; end",
"def set_mtime(entry, file)\n entry.time = ::Zip::DOSTime.at(File.mtime(file))\n entry.extra.delete('UniversalTime')\n end",
"def import_csv\n if current_admin.present? \n updated_user_id = current_admin.id\n create_user_id = current_admin.id\n else\n updated_user_id = current_user.id\n create_user_id = current_user.id\n end\n if (params[:file].nil?)\n redirect_to upload_csv_posts_path, notice: Messages::REQUIRE_FILE_VALIDATION \n elsif !File.extname(params[:file]).eql?(\".csv\")\n redirect_to upload_csv_posts_path, notice: Messages::WRONG_FILE_TYPE \n else\n error_msg = PostsHelper.check_header(Constants::HEADER,params[:file])\n if error_msg.present?\n redirect_to upload_csv_posts_path, notice: error_msg\n else \n Post.import(params[:file],create_user_id,updated_user_id)\n redirect_to posts_path, notice: Messages::UPLOAD_SUCCESSFUL\n end\n end\n end",
"def date; end",
"def date; end",
"def date; end",
"def date; end",
"def local_uploaded_time\n self.uploaded_at.strftime(\"%Y-%m-%d %H:%M\")\n end",
"def fix_csv(old_csv)\n\t\told_csv.pop\n\t\tproper_headers(old_csv)\n\t\tCSV.open(\"public/ephemeral.csv\", 'wb') do |write_crude|\n\t\t\told_csv.each do |fix_csv|\n\t\t\t\twrite_crude << fix_csv\n\t\t\tend\n\t\tend\n\tend",
"def dailyroster_file\n active_date = self.active_date.to_date\n path = File.join(\"public/system/dailyrosters/#{active_date.to_formatted_s(:number)}\", self.dailyroster_file_name)\n flight_date = active_date\n DataFile.load_codeshare_flights(flight_date)\n Spreadsheet.open(path, 'r') do |book|\n sheet = book.worksheet 0\n (7..sheet.row_count).each do |i|\n if (!sheet.row(i)[0].nil?)\n aircraft = get_aircraft(sheet.row(i)[1].to_s)\n flight_no = sheet.row(i)[2]\n routing_raw = sheet.row(i)[3].strip\n route = Routing.find_or_create_by_routing(routing_raw)\n if (sheet.row(i)[3].slice(0,3) == \"SGN\")\n # flight = Flight.unscoped.find_or_initialize_by_flight_no_and_flight_date(flight_no, flight_date)\n # flight.flight_no = flight_no\n # flight.routing_id = route.id\n # flight.aircraft_id = aircraft.id\n # flight.flight_date = calculate_flight_date(flight_date,sheet.row(i))\n # flight.std = calculate_flight_time(flight_date, sheet.row(i))\n # flight.remark = sheet.row(i)[9] unless sheet.row(i)[9].nil?\n # flight.save!\n else\n if (flight_no.slice(0,2) != \"VN\")\n cs_flight = FlightType.find_by_flight_no_to(flight_no)\n flight_no = cs_flight.flight_no_from unless cs_flight.nil?\n end\n flight = ArrivalFlight.unscoped.find_or_initialize_by_flight_no_and_flight_date(flight_no, calculate_flight_date(flight_date,sheet.row(i))) \n flight.routing_id = route.id\n flight.reg_no = aircraft.reg_no\n flight.flight_date = calculate_flight_date(flight_date,sheet.row(i))\n flight.sta = calculate_flight_time(flight_date, sheet.row(i))\n flight.update_is_domestic\n flight.is_active = true\n flight.is_approval = false\n sheet.row(i)[9].nil? ? flight.remarks = \"\" : flight.remarks = sheet.row(i)[9]\n cs_flight.nil? ? flight.remarks = flight.remarks + \"\" : flight.remarks = cs_flight.flight_no_to + \"|#{flight.remarks}\"\n flight.save!\n end\n end\n end\n end\n path\n end",
"def csv_file_format\n if file.original_filename !~ /.*\\.csv/\n errors.add :file, 'is not a .csv file'\n end\n end",
"def combine_files!(infiles)\n make_files_by_datetime\n infiles.merge!(@files_by_datetime) do |key, oldval, newval|\n log_error(\"Key collision: #{key}, #{oldval}, #{newval}\")\n raise\n end\n end",
"def before_create_file(path, data, parent_node, modified)\n return true unless parent_node.is_a?(ICalendar)\n\n validate_i_calendar(\n data,\n path,\n modified,\n @server.http_request,\n @server.http_response,\n true\n )\n true\n end",
"def file_date_valid?(file)\n dt = file.split('_').first\n return false if dt.length != 12\n\n begin\n Time.parse(dt)\n rescue StandardError\n return false\n end\n\n true\n end",
"def setUploadedOn(uploadedOn)\r\n\t\t\t\t\t@uploadedOn = uploadedOn\r\n\t\t\t\tend",
"def date_of_backup(filename)\n m = filename.match(/^(?:undone)?(?<date>\\d{4}-\\d{2}-\\d{2})_(?<time>\\d{2}\\.\\d{2}\\.\\d{2})___(?<file>.*?)$/)\n return nil if m.nil?\n\n [Time.parse(\"#{m['date']} #{m['time'].gsub(/\\./, ':')}\"), m['file']]\n end"
] |
[
"0.6413626",
"0.64014226",
"0.6307236",
"0.61452013",
"0.61316615",
"0.61126953",
"0.60991704",
"0.6078403",
"0.60653466",
"0.6032585",
"0.602153",
"0.6009576",
"0.5981251",
"0.59667706",
"0.5926942",
"0.5885968",
"0.58296746",
"0.5812186",
"0.5793294",
"0.5693234",
"0.5664742",
"0.56570363",
"0.5647997",
"0.5646988",
"0.5627881",
"0.5609142",
"0.5599025",
"0.5590976",
"0.5590976",
"0.55860883",
"0.55851275",
"0.557344",
"0.55722076",
"0.55722076",
"0.5571382",
"0.5566352",
"0.55518806",
"0.5551312",
"0.5537051",
"0.55127746",
"0.5490941",
"0.54849374",
"0.5481174",
"0.54753953",
"0.5455641",
"0.5450558",
"0.5447759",
"0.5446959",
"0.5446167",
"0.5445316",
"0.54398185",
"0.54361194",
"0.543509",
"0.5431697",
"0.5421139",
"0.54098177",
"0.540738",
"0.5399349",
"0.53887004",
"0.5381576",
"0.5377354",
"0.53687084",
"0.53630406",
"0.536249",
"0.5360526",
"0.53602904",
"0.53549194",
"0.53311557",
"0.5321165",
"0.5320976",
"0.5309197",
"0.5308178",
"0.53022784",
"0.52910554",
"0.52886593",
"0.52886593",
"0.52886593",
"0.52886593",
"0.52886593",
"0.52886593",
"0.52864414",
"0.527335",
"0.5270772",
"0.5247433",
"0.5236861",
"0.52311724",
"0.52309835",
"0.522888",
"0.5223941",
"0.5223941",
"0.5223941",
"0.5223941",
"0.52184767",
"0.52177566",
"0.52114516",
"0.5209505",
"0.5202617",
"0.51988673",
"0.519753",
"0.5189076",
"0.5184934"
] |
0.0
|
-1
|
GET /product_cates GET /product_cates.json
|
def index
@product_cates = ProductCate.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def index\n @candies_products = CandiesProduct.all\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end",
"def list\n hash = JSON.parse(CrateAPI::Base.call(\"#{CrateAPI::Base::CRATES_URL}/#{CRATE_ACTIONS[:list]}\", :get))\n return Crates.from_array(hash[\"crates\"])\n end",
"def index\n @product_cats = ProductCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_cats }\n end\n end",
"def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n @crates = Crate.all\n end",
"def customers\n ShopifyAPI::Customer.all\n end",
"def index\n @products = @co.products\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end",
"def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\n end\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def index\n @template_cates = Templates::Cate.all\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def index\n \tproducts = Product.all\n \trender json: products\n \tend",
"def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end",
"def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_product }\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def show\n @product = Product.find(params[:id])\n @donor = Donor.all\n @event = Event.all\n @category = Category.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def index\n courses = Course.includes(:professors).includes(:ratings).all\n\n render json: courses.to_json(include: [:professors, :ratings])\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end",
"def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end",
"def licenses\n publisher_id = current_user.id\n @licenses = PowerChip.where(:publisher_id=>publisher_id)\n respond_to do |format|\n format.html # licenses.html.erb\n format.json { render json: @licenses }\n end\n end",
"def show\n render json: @pricing\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def index\n \t@categories = Category.all\n @products = Product.order(params[:order]).paginate(:page => params[:page], :per_page => 20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def index\n @prod_cotis = ProdCoti.all\n end",
"def delivery_report\n @product=Product.new\n @details=Array.new\n @customers=Customer.all\n @retire_notes= RetireNote.where(\"date between current_date-31 and current_date and retire_note_state_id = 1\")\n respond_to do |format|\n format.html # products_by_customer.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n #@category = Category.find(params[:id])\n @products = @category.products.all\n @max = @category.products.maximum(:price)\n @colors = @category.products.select(:params).distinct\n respond_to do |format|\n format.json { render :json => {:category => @category,\n :products => @products,\n :colors => @colors,\n :maxprice => @max\n } }\n end\n end",
"def index\n @cp_changes = CpChange.all\n\n render json: @cp_changes\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def customer_list\n perform_get_request('/customer/list')\n end",
"def show\n if is_my_resource(@product.prossumer_id)\n render json: @product.as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n end\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\n end",
"def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end",
"def index\n start_time, end_time = normalize_start_and_end_time(params[:start_time], params[:end_time])\n authorize! :read, PaymentInvoice\n if !set_customer\n return #Already rendered errors json\n end\n @payment_invoices = @customer.payment_invoices.where(receipt_date: start_time..end_time)\n render json: @payment_invoices\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @voip_costs = VoipCost.order(\"start_date desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @voip_costs }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def show\n @product_cat = ProductCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_cat }\n end\n end",
"def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end",
"def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end",
"def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end",
"def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end",
"def show\n render json: @product\n end",
"def all\n hash = JSON.parse(CrateAPI::Base.call(\"#{CrateAPI::Base::ITEMS_URL}/#{CRATE_ACTIONS[:list]}\", :get))\n return Crates.from_array(hash[\"crates\"])\n end",
"def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end",
"def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end",
"def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end",
"def index\n @cateroties = Cateroty.all\n end",
"def index\n\t@products = Product.where(:inventory => true).order(:category_id).page(params[:page])\n @donors = Donor.all\n @categories = Category.all\n @products2 = Product.where(:inventory => false).order(:category_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def get_customers\n return ShopifyAPI::Customer.all\n end",
"def show\n render json: @product\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def index\n $products = Array.new\n @customers=Customer.all\n @cities=City.all\n $product=Product.new\n $receivers = Receiver.find(:all)\n $addresses=Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: $products }\n end\n end",
"def show\n render json: @product_buy_click\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def index\n scope = Product.includes(:merchant, :brand, :category, :founder, :likers, comments: :user)\n scope = scope.order(updated_at: :desc)\n @products = paginate scope.all\n respond_to do |format|\n format.html\n format.json { render json: @products }\n end\n end",
"def crates(); @crates || CrateAPI::Crates.new(); end",
"def listall\n return render :json => Customer.all.as_json(:only => [:id, :custID, :interested, :bought])\n end",
"def index\n @purchases = Purchase.all.order(purchase_date: :desc).order(created_at: :desc).paginate(:page => params[:page], per_page: 10)\n\n render json: {purchases: @purchases, total_pages: @purchases.total_pages, current_page: @purchases.current_page}\n end",
"def creditCardIndex\n render json: Approved.allCreditCard\n end",
"def new\n @crate = Crate.new\n @payers = get_cratepayers()\n @types = get_crate_types()\n @priorities = get_crate_priorities()\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @crate }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def index\n @conducta = Conductum.all\n end",
"def index\n @cities = City.all\n\n render json: @cities\n end",
"def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end",
"def index\n lat = request.headers['lat'].to_f\n long = request.headers['long'].to_f\n\n @user = User.find(current_user)\n @concerts = @user.artists.map do |a|\n a.concerts.select{|c| Date.parse(c.date) > Date.today && Date.parse(c.date) < (Date.today + 7)}\n end\n @concerts = @concerts.flatten.sort do |concert1, concert2|\n order = Date.parse(concert1.date) <=> Date.parse(concert2.date)\n if order != 0\n order\n else\n concert1.distance(lat, long) <=> concert2.distance(lat, long)\n end\n end\n render json: {concerts: @concerts}\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def list\n @customers = Customer.all\n\n respond_to do |format|\n format.html { render action: \"index\" }\n format.json { render json: @customers }\n end\n end",
"def index\n @categories = Category.all\n @products = {}\n @categories.each do |c|\n products_by_category = c.products\n @products[c.id.to_s] = products_by_category\n end\n @products = Product.all if @products.nil?\n logger.info(@products)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @products }\n end\n end",
"def products\n request :public, :get, :products\n end",
"def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend",
"def show\n render json: @competitor_price\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: CashPurchaseDatatable.new(view_context, current_user) }\n end\n end",
"def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation }\n end\n end",
"def index\n render :json => Producto.all\n end"
] |
[
"0.635632",
"0.61790925",
"0.61187536",
"0.61152655",
"0.60723484",
"0.60031974",
"0.5997642",
"0.5995273",
"0.5953059",
"0.5925261",
"0.59197694",
"0.5915861",
"0.588498",
"0.5865731",
"0.5847437",
"0.5837887",
"0.58280647",
"0.5827365",
"0.5813459",
"0.5810902",
"0.5791068",
"0.57901037",
"0.57782674",
"0.575995",
"0.57472277",
"0.57454216",
"0.5742464",
"0.5736247",
"0.57255805",
"0.57252",
"0.57175934",
"0.5711433",
"0.57086277",
"0.5698226",
"0.5683798",
"0.5682852",
"0.56584674",
"0.5654966",
"0.5654274",
"0.5653464",
"0.5651061",
"0.564339",
"0.5640449",
"0.56388044",
"0.5637877",
"0.5637471",
"0.56311774",
"0.56299543",
"0.56284636",
"0.5628411",
"0.56271094",
"0.56248724",
"0.56248724",
"0.56222403",
"0.5604321",
"0.56021255",
"0.56019855",
"0.5599592",
"0.558881",
"0.5585169",
"0.55836654",
"0.5582622",
"0.55819327",
"0.5574054",
"0.55720246",
"0.5561321",
"0.5561029",
"0.5558778",
"0.55514807",
"0.55478144",
"0.55459917",
"0.5545837",
"0.5543797",
"0.55403197",
"0.5536369",
"0.5531291",
"0.552974",
"0.5528597",
"0.5528143",
"0.5528143",
"0.5525207",
"0.5523643",
"0.55140424",
"0.55078655",
"0.54969686",
"0.5496136",
"0.54948467",
"0.54900837",
"0.5489726",
"0.5489371",
"0.54887384",
"0.5488624",
"0.5488369",
"0.54862857",
"0.54825324",
"0.54819185",
"0.5478629",
"0.5477643",
"0.5477479",
"0.5475157"
] |
0.7525631
|
0
|
GET /product_cates/1 GET /product_cates/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @product_cates = ProductCate.all\n end",
"def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end",
"def index\n @crates = Crate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crates }\n end\n end",
"def index\n @product_cats = ProductCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_cats }\n end\n end",
"def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end",
"def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end",
"def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end",
"def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end",
"def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end",
"def customer_single_orders\n @orders = Order.where(customer_id: current_user.customer_id, category: :single)\n render json: @orders, status: 200\n\n end",
"def show\n if is_my_resource(@product.prossumer_id)\n render json: @product.as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n end\n end",
"def index\n @products = @co.products\n end",
"def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_product }\n end\n end",
"def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end",
"def show\n @product_cat = ProductCat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_cat }\n end\n end",
"def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end",
"def show\n json_response(@api_v1_product)\n end",
"def index\n @products = Product.all\n render json: @products\n end",
"def index\n @candies_products = CandiesProduct.all\n end",
"def show\n @product = Product.find(params[:id])\n @donor = Donor.all\n @event = Event.all\n @category = Category.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product }\n end\n end",
"def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end",
"def index\n @food_products = FoodProduct.all\n render json: @food_products\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def index\n \tproducts = Product.all\n \trender json: products\n \tend",
"def show\n #@category = Category.find(params[:id])\n @products = @category.products.all\n @max = @category.products.maximum(:price)\n @colors = @category.products.select(:params).distinct\n respond_to do |format|\n format.json { render :json => {:category => @category,\n :products => @products,\n :colors => @colors,\n :maxprice => @max\n } }\n end\n end",
"def show\n render json: @product\n end",
"def show\n render json: @product\n end",
"def show\n render json: @product, status: 200\n end",
"def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end",
"def index\n info = Aws.get_recipes_from_db\n render :json => info\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def show\n render json: @product_buy_click\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n \tcustomers = Customer.all\n \trender json: customers\n \tend",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end",
"def index\n @careers = Career.all\n json_response(@careers)\n end",
"def index\n @benefit_categories = BenefitCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @benefit_categories }\n end\n end",
"def show\n @crate = Crate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @crate }\n end\n end",
"def show\n render json: @food_product\n end",
"def show\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_cost }\n end\n end",
"def customer_recurring_orders\n # 1 represents \n @orders = Order.where(customer_id: current_user.customer_id, category: :recurring)\n render json: @orders, status: 200\n \n \n end",
"def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end",
"def show\n render json: @pricing\n end",
"def show\n @product = Product.find(params[:id])\n json_response(params)\n end",
"def index\n render :json => Producto.all\n end",
"def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end",
"def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend",
"def index\n\t@products = Product.where(:inventory => true).order(:category_id).page(params[:page])\n @donors = Donor.all\n @categories = Category.all\n @products2 = Product.where(:inventory => false).order(:category_id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\n end\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def delivery_report\n @product=Product.new\n @details=Array.new\n @customers=Customer.all\n @retire_notes= RetireNote.where(\"date between current_date-31 and current_date and retire_note_state_id = 1\")\n respond_to do |format|\n format.html # products_by_customer.html.erb\n format.json { render json: @product }\n end\n end",
"def show\n @product_category = ProductCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_category }\n end\n end",
"def show\n @sales_productivity = SalesProductivity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sales_productivity }\n end\n end",
"def index\n @pricings = Pricing.all\n\n render json: @pricings\n end",
"def consulta_prod\n @product = Product.select('codigo_ncm,cest').where(name: params[:name]).first\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n #------------DEU CERTO GLORIA Á DEUS!!!-----------------------------------------------\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @productcategory = Productcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productcategory }\n end\n end",
"def index\n @crates = Crate.all\n end",
"def index\n @crate_priorities = CratePriority.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @crate_priorities }\n end\n end",
"def show\n response = Aws.list_recipe(params[:id])\n render :json => response\n end",
"def customers\n ShopifyAPI::Customer.all\n end",
"def index\n @shop_bonus_offers = Shop::BonusOffer.order('resource_id asc, currency asc, price asc')\n \n respond_to do |format|\n format.html # index.html.erb\n format.json do\n @shop_bonus_offers.each do |offer|\n offer[:resource_effect] = offer.effect_for_character(current_character) \n end\n \n render json: @shop_bonus_offers\n end\n end\n end",
"def show\n @customer = Customer.includes(:invoices).find(params[:id].split(\",\"))\n\n render json: @customer\n end",
"def index\n @products = Product.all\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n end",
"def show\n @product_price = ProductPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_price }\n end\n end",
"def index\n @pend_crates = Overview.get_pending_crates \n @paid_crates = Overview.get_last_paid_crates \n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render :json => @crates }\n end\n end",
"def index\n @karyalay_caterers = KaryalayCaterer.all\n render json: @karyalay_caterers\n end",
"def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end",
"def index\n @recipes = Recipe.all\n render json: @recipes\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cn_curve }\n end\n end",
"def index\n @voip_costs = VoipCost.order(\"start_date desc\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @voip_costs }\n end\n end",
"def show\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @onecompany_product }\n end\n end",
"def show\n @breadcrumb = 'read'\n @product = $product\n @supplier = $supplier\n @purchase_price = PurchasePrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @purchase_price }\n end\n end",
"def index\n @cp_changes = CpChange.all\n\n render json: @cp_changes\n end",
"def index\n $products = Array.new\n @customers=Customer.all\n @cities=City.all\n $product=Product.new\n $receivers = Receiver.find(:all)\n $addresses=Array.new\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: $products }\n end\n end",
"def new\n @product_cost = ProductCost.new\n\t@products = Product.find_all\n\t@tax_masters = TaxMaster.find_all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @product_cost }\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: @products }\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: @products }\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: @products }\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: @products }\n end\n end",
"def index\n \t@categories = Category.all\n @products = Product.order(params[:order]).paginate(:page => params[:page], :per_page => 20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @products }\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 index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end",
"def show\n @cycdatum = Cycdatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cycdatum }\n end\n end",
"def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @circulation }\n end\n end",
"def index\n @prod_cotis = ProdCoti.all\n end",
"def index\n @category_offers = CategoryOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @category_offers }\n end\n end",
"def index\n @logical_products = LogicalProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @logical_products }\n end\n end",
"def show\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carts_product }\n end\n end",
"def show\n render json: @citation\n end",
"def show\n render json: @citation\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 => @products }\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 => @products }\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 => @products }\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 => @products }\n end\n end",
"def index\n @customers = @user.customers.all\n render json: @customers\n end",
"def index\n begin\n @products = Product.all\n render json: @products, status: 200\n rescue => exception\n render json: { errors: exception }\n end\n end",
"def index\n @purchases = purchases.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end",
"def show\n\n respond_to do |format|\n format.json { render json: @cage }\n end\n end",
"def show\n render json: @competitor_price\n end"
] |
[
"0.72052526",
"0.64012355",
"0.62206465",
"0.607359",
"0.6059173",
"0.6050131",
"0.60356826",
"0.60250694",
"0.6020901",
"0.5984413",
"0.5976167",
"0.5973951",
"0.59602493",
"0.5946021",
"0.5932691",
"0.59313977",
"0.59236753",
"0.59057844",
"0.5895616",
"0.58921534",
"0.5891156",
"0.58884513",
"0.5865692",
"0.5857763",
"0.5849891",
"0.58276725",
"0.5822451",
"0.58116066",
"0.5803807",
"0.5798256",
"0.5792687",
"0.5791603",
"0.57730126",
"0.5763579",
"0.5759818",
"0.575827",
"0.5755803",
"0.574564",
"0.5731782",
"0.572245",
"0.57216406",
"0.5718164",
"0.5716298",
"0.5708185",
"0.56963474",
"0.5694159",
"0.5694094",
"0.5691513",
"0.5690523",
"0.5689382",
"0.5687841",
"0.56836754",
"0.5678745",
"0.5677723",
"0.56770444",
"0.56718475",
"0.5667234",
"0.56652683",
"0.5660996",
"0.5653377",
"0.5651038",
"0.5649811",
"0.56476253",
"0.56470686",
"0.5639749",
"0.5637098",
"0.5630527",
"0.562726",
"0.56259215",
"0.5624969",
"0.562377",
"0.5619008",
"0.5618517",
"0.5616502",
"0.5606267",
"0.56050026",
"0.56038135",
"0.5603451",
"0.5603451",
"0.5603451",
"0.5599935",
"0.55973566",
"0.55967116",
"0.5595225",
"0.55914384",
"0.55874014",
"0.55850416",
"0.5583567",
"0.55824286",
"0.55811894",
"0.5580949",
"0.5580949",
"0.5577592",
"0.5577592",
"0.5577592",
"0.5577592",
"0.55755913",
"0.5572108",
"0.5571119",
"0.55697817",
"0.5567729"
] |
0.0
|
-1
|
POST /product_cates POST /product_cates.json
|
def create
@product_cate = ProductCate.new(product_cate_params)
respond_to do |format|
if @product_cate.save
format.html { redirect_to @product_cate, notice: 'Product cate was successfully created.' }
format.json { render :show, status: :created, location: @product_cate }
else
format.html { render :new }
format.json { render json: @product_cate.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @product_cates = ProductCate.all\n end",
"def create\n @candies_product = CandiesProduct.new(candies_product_params)\n\n respond_to do |format|\n if @candies_product.save\n format.html { redirect_to @candies_product, notice: 'Candies product was successfully created.' }\n format.json { render :show, status: :created, location: @candies_product }\n else\n format.html { render :new }\n format.json { render json: @candies_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @copon = Copon.new(copon_params)\n get_product(@copon, params.require(:copon)[:product])\n set_associative_criteria @copon, params.require(:copon)\n\n respond_to do |format|\n if @copon.save\n format.html { redirect_to @copon, notice: 'Copon was successfully created.' }\n format.json { render :show, status: :created, location: @copon }\n else\n format.html { render :new }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer_event_product = CustomerEventProduct.new(customer_event_product_params)\n\n respond_to do |format|\n if @customer_event_product.save\n format.html { redirect_to :back, notice: 'Product was successfully added.', method: :get }\n format.js\n else\n format.html { render :new }\n format.json { render json: @customer_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @prd_attribute = PrdAttribute.new\n\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee'].to_i\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee'].to_i\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n if @prd_attribute.save\n format.html { redirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully created.') }\n format.xml { render :xml => @prd_attribute, :status => :created, :location => @prd_attribute }\n format.json {\n\t\t\tproduct = Product.new\n product.prd_attribute_id = @prd_attribute.id\n product.save!\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = product.id\n prd_attribute_device.save!\n end\n end\n\n # product에 대한 기본 conditions 설정\n #\n product.set_default_conditions(@prd_attribute, product)\n\n\t\t\trender :json => mapping_to_hash(@prd_attribute, PrdAttribute.json_mapping_table), :status => :created, :location => @prd_attribute \n\t\t}\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n format.json { \n\t\t\trender :json => @prd_attribute.errors, :status => :unprocessable_entity \t}\n end\n end\n end",
"def create\n @cp_product = Product.new(cp_product_params)\n\n respond_to do |format|\n if @cp_product.save\n format.html { redirect_to cp_product_url(@cp_product), notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @cp_product }\n else\n format.html { render :new }\n format.json { render json: @cp_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n \n respond_to do |format|\n if @service_order.save\n cont =0\n @products.each do |p|\n detalle = ServiceOrderDetail.new(product_id: p, quantity: @quantity[cont], service_order_id:@service_order.id)\n detalle.save\n cont +=1\n end\n \n format.html { redirect_to @service_order, notice: 'Service order was successfully created.' }\n format.json { render :show, status: :created, location: @service_order }\n else\n format.html { render :new }\n format.json { render json: @service_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @discounts_product = DiscountsProduct.new(discounts_product_params)\n\n respond_to do |format|\n if @discounts_product.save\n format.html { redirect_to @discounts_product, notice: 'Discounts product was successfully created.' }\n format.json { render :show, status: :created, location: @discounts_product }\n else\n format.html { render :new }\n format.json { render json: @discounts_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @template_cate = Templates::Cate.new(template_cate_params)\n\n respond_to do |format|\n if @template_cate.save\n format.html { redirect_to @template_cate, notice: 'Cate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template_cate }\n else\n format.html { render action: 'new' }\n format.json { render json: @template_cate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_cost = ProductCost.new(params[:product_cost])\n\t@products = Product.find_all\n\t@tax_masters = TaxMaster.find_all\n\n respond_to do |format|\n if @product_cost.save\n format.html { redirect_to @product_cost, :notice => 'Product cost was successfully created.' }\n format.json { render :json => @product_cost, :status => :created, :location => @product_cost }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe = Recipe.new(recipe_params)\n @recipe.cusine = params[:recipe][:cusine]\n\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to recipes_path, notice: 'Recipe was successfully created.' }\n format.json { render :show, status: :created, location: @recipe }\n else\n @recipes = Recipe.all\n format.html { render :index }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_cach_params\n params.require(:product_cach).permit(:key, :name, :values, :date_created)\n end",
"def create\n params[:coupon][:code] = (params[:coupon][:code]).downcase\n params[:coupon][:valid_category] = (params[:valid_category]||{}).to_json\n params[:coupon][:valid_product] = (params[:valid_product]||{}).to_json\n params[:coupon][:valid_company] = (params[:valid_company]||{}).to_json\n @coupon = Coupon.new(coupon_params)\n respond_to do |format|\n if @coupon.save\n format.html { redirect_to @coupon, notice: 'Coupon was successfully created.' }\n format.json { render :show, status: :created, location: @coupon }\n else\n format.html { render :new }\n format.json { render json: @coupon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_buy_click = ProductBuyClick.new(product_buy_click_params)\n @product_buy_click.user = current_user if is_client_app?\n\n if @product_buy_click.save\n render json: @product_buy_click, status: :created, location: @product_buy_click\n else\n render json: @product_buy_click.errors, status: :unprocessable_entity\n end\n end",
"def create\n @contract_product = ContractProduct.new(params[:contract_product]) \n respond_to do |format|\n if @contract_product.save\n format.html { redirect_to new_contract_product_url(:contract_id => @contract_product.contract_id), notice: 'Contract product was successfully created.' }\n format.json { render json: @contract_product, status: :created, location: @contract_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @mobile_cfr_prods = CfrProduct.where(:city_id => mobile_cfr_prod_params[:city_id]).find(:all)\n respond_to do |format|\n if @mobile_cfr_prods.nil?\n format.html { render action: 'show' }\n format.xml# { render json: @mobile_cfr_prods.errors, status: :unprocessable_entity }\n else\n format.xml# { render :xml => @mobile_cfr_prods.to_xml }\n end\n end\n \n \n # @mobile_cfr_prod = CfrProduct.new(mobile_cfr_prod_params)\n# \n # respond_to do |format|\n # if @mobile_cfr_prod.save\n # format.html { redirect_to @mobile_cfr_prod, notice: 'Mobile cfr prod was successfully created.' }\n # format.json { render action: 'show', status: :created, location: @mobile_cfr_prod }\n # else\n # format.html { render action: 'new' }\n # format.json { render json: @mobile_cfr_prod.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @product = @collection.products.build(product_params)\n\n if @product.save\n render json: @product, status: :created#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def new\n flash[:notice]=\"\"\n @cities = City.all\n \n $product = Product.new\n $product.created_at=$product.format_admission_date\n $products=Array.new\n #Obtengo la lista de notas de retiro para mostrar en el autocom´ete\n #En la lista muestro todas las notas de retiro no procesadas cuya fecha sea hasta 31 dias antes de la fecha actual\n $retire_notes= RetireNote.find(:all, :conditions=> \"retire_note_state_id= 2 and date between current_date-31 and current_date\")\n $receivers = Receiver.find(:all)\n \n $addresses=Array.new\n $item = 1\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: $product }\n end\n end",
"def create\n @customer = Customer.new(customer_params.map{|k,v| {k.to_sym => v.class == ActionController::Parameters ? [v.to_hash] : v.to_s}}.reduce({}, :merge))\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: 'Customer was successfully created.' }\n format.json { render :show, status: :created, location: @customer }\n else\n format.html { render :new }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def candies_product_params\n params.require(:candies_product).permit(:product_id, :candy_id, :count, :id)\n end",
"def create\n @product = Product.new(product_params)\n @product.user = current_api_v1_user\n respond_to do |format|\n if @product.save\n params[:product][:properties].try(:each) do |k,v|\n @product.product_properties.create(property: Property.find(k), value: v)\n end\n params[:product][:colors].try(:each) do |c|\n @product.colors.create(name: c[:name].downcase, code: c[:code])\n end\n params[:product][:photos].try(:each) do |c|\n @product.photos.create(image: c)\n end\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created}\n else\n format.html { render :new }\n format.json { render json: @product.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.create!(product_params)\n json_response(@product, :created)\n end",
"def create\n @sales_coffee = SalesCoffee.new(sales_coffee_params)\n\n respond_to do |format|\n if @sales_coffee.save\n format.html { redirect_to @sales_coffee, notice: \"Sales coffee was successfully created.\" }\n format.json { render :show, status: :created, location: @sales_coffee }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @sales_coffee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ccbs_product = CcbsProduct.new(params[:ccbs_product])\n\n respond_to do |format|\n if @ccbs_product.save\n format.html { redirect_to(@ccbs_product, :notice => 'CcbsProduct was successfully created.') }\n format.xml { render :xml => @ccbs_product, :status => :created, :location => @ccbs_product }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ccbs_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def createCustomer(customer_properties)\n url_data = \"/api/customers/\"\n @json_customer_properties = customer_properties.to_json\n options = {\n :digest_auth => @auth_digest,\n :body => @json_customer_properties\n }\n url_request = \"#{url_data}\"\n postData(url_request, options)\n end",
"def create\n @product_cat = ProductCat.new(params[:product_cat])\n\n respond_to do |format|\n if @product_cat.save\n format.html { redirect_to @product_cat, notice: 'Product cat was successfully created.' }\n format.json { render json: @product_cat, status: :created, location: @product_cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @care_plan = CarePlan.new(care_plan_params)\n\n if @care_plan.save\n render json: @care_plan, status: :created, location: @care_plan\n else\n render json: @care_plan.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tcustomerproduct = Tcustomerproduct.new(tcustomerproduct_params)\n\n respond_to do |format|\n if @tcustomerproduct.save\n format.html { redirect_to @tcustomerproduct, notice: 'Tcustomerproduct was successfully created.' }\n format.json { render :show, status: :created, location: @tcustomerproduct }\n else\n format.html { render :new }\n format.json { render json: @tcustomerproduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @contract_product = ContractProduct.new(cont_params)\n \n if @contract_product.save\n redirect_to @contract_product\n else\n render 'new'\n end\n end",
"def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end",
"def create\n @cerc = Cerc.new(params[:cerc])\n\n if @cerc.save\n render json: @cerc, status: :created, location: @cerc\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cta_cte = CtaCte.new(cta_cte_params)\n\n respond_to do |format|\n if @cta_cte.save\n format.html { redirect_to @cta_cte, notice: 'Se creo correctamente.' }\n format.json { render :show, status: :created, location: @cta_cte }\n else\n format.html { render :new }\n format.json { render json: @cta_cte.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n if @customer.save\n # render json: {name:@customer.name,mobile:@customer.mobile,email:@customer.email,state_name:@customer.state.name,\n # city_name:@customer.city.name,state_id:@customer.state_id,city_id:@customer.city_id}\n render json: @customer.attributes.merge(state_name:@customer.state.name,city_name:@customer.city.name,customer_count:Customer.count);\n else\n render json:{error: @customer.errors.full_messages}\n end\n end",
"def create\n @cycdatum = Cycdatum.new(params[:cycdatum])\n\n respond_to do |format|\n if @cycdatum.save\n format.html { redirect_to @cycdatum, notice: 'Cycdatum was successfully created.' }\n format.json { render json: @cycdatum, status: :created, location: @cycdatum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cycdatum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @recipe_prod = RecipeProd.new(recipe_prod_params)\n\n respond_to do |format|\n if @recipe_prod.save\n format.html { redirect_to @recipe_prod, notice: 'Recipe prod was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_prod }\n else\n format.html { render :new }\n format.json { render json: @recipe_prod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @coupon = Coupon.new(coupon_params)\n if @coupon.save\n @obj = {\n id: @coupon.id,\n name: @coupon.name,\n code: @coupon.code,\n category: @coupon.category,\n description: @coupon.description,\n is_porcentage: @coupon.is_porcentage,\n value: @coupon.value,\n quantity: @coupon.quantity,\n cargapp_model_id: @coupon.cargapp_model_id,\n user_id: @coupon.user_id,\n company_id: @coupon.company_id,\n active: @coupon.active,\n image: @coupon.image.attached? ? url_for(@coupon.image) : nil,\n created_at: @coupon.created_at,\n updated_at: @coupon.updated_at\n }\n render json: @obj, status: :created, location: @coupon\n else\n render json: @coupon.errors, status: :unprocessable_entity\n end\n end",
"def create\n @product = current_user.products.new(name: product_params[:name],description:product_params[:description],price:product_params[:price])\n @product.brand = Brand.find_by(brandName: product_params[:brand])\n @product.categories = Category.where(category:product_params[:category])\n respond_to do |format|\n if @product.save \n format.html { redirect_to new_product_location_path(@product), notice: \"Product was successfully created.\"}\n format.json { render json: @product}\n \n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @cn_curve = CnCurve.new(cn_curve_params)\n\n respond_to do |format|\n if @cn_curve.save\n format.html { redirect_to @cn_curve, notice: 'Cn curve was successfully created.' }\n format.json { render json: @cn_curve, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @cn_curve.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create # rubocop:disable MethodLength\n @product = Product.new(product_params)\n\n respond_to do |format|\n if @product.save\n format.html do\n redirect_to @product, notice: 'Product was successfully created.'\n end\n format.json { render :show, status: :created, location: @product }\n else\n @categories = Category.all\n format.html { render :new }\n format.json do\n render json: @product.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def create\n @customer = Customer.new(customer_params)\n\n if @customer.save\n render json: @customer, status: :created, location: @customer\n else\n ap errors(@customer.errors)\n render json: errors(@customer.errors), status: :unprocessable_entity\n end\n end",
"def create\n @customer = @user.customers.build(customer_params)\n if @customer.save\n render json: @customer, status: :created\n else\n render json: @customer.errors, status: :unprocessable_entity\n end\n\n end",
"def create\n @complaint = Complaint.new(complaint_params)\n @complaint.customer_id = current_user.customer_id\n @complaint.region_id = current_user.customer.region_id\n\n if @complaint.save\n render json: @complaint, status: :created, location: api_v1_complaint_url(@complaint)\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end",
"def add_discount_product(payload, register_id, client)\n {\n 'product_id'=> client.get_discount_product,\n 'register_id'=> register_id,\n 'sequence'=> '0',\n 'handle'=> 'vend-discount',\n 'sku'=> 'vend-discount',\n 'name'=> 'Discount',\n 'quantity'=> -1,\n 'price'=> payload['totals']['discount'],\n 'price_set'=> 1,\n 'discount'=> 0,\n 'loyalty_value'=> 0,\n 'price_total'=> payload['totals']['discount']*-1,\n 'display_retail_price_tax_inclusive'=> '1',\n 'status'=> 'CONFIRMED'\n }\n end",
"def create\n @crate = Crate.new(crate_params)\n\n respond_to do |format|\n if @crate.save\n format.html { redirect_to tenant_crates_path(@tenant), notice: 'Crate was successfully created.' }\n format.json { render :show, status: :created, location: @crate }\n else\n format.html { render :new }\n format.json { render json: @crate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n @product.user = current_user\n @product.uname = current_user.name;\n @product.contact = current_user.contact;\n @product.pid = 0\n Time.zone = \"UTC\"\n @product.price = @product.startbid \n @product.pbidprice = @product.price\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render :show, status: :created, location: @product }\n else\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @invoice = Invoice.new(params[:invoice])\n @invoice.client_id = params[:clients]\n @invoice.discount_id = params[:discount_id]\n @invoice.tax_id = params[:tax_id]\n @invoice.status = Invoice::DRAFT\n @invoice.year = @counter.year\n @invoice.invoice_id = @counter.number\n respond_to do |format|\n if @invoice.save\n format.html { redirect_to @invoice, notice: 'Invoice was successfully created.' }\n format.json { render json: @invoice, status: :created, location: @invoice }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @payment = Payment.new(params[:payment])\n @collect_c = collect_c\n current_client = Client.find_by_phone(params[:payment][:client].split(\" - \").last) if params[:payment][:client].present?\n if current_client.present?\n @client_courses_edit = current_client.courses\n if params[:course_id].present? && params[:course_id].first.present?\n @payment.course_id = params[:course_id].first\n end\n respond_to do |format|\n if @payment.save\n format.html { redirect_to @payment, notice: 'Payment was successfully created.' }\n format.json { render json: @payment, status: :created, location: @payment }\n format.js\n else\n format.html { render 'new'}\n format.json { render json: @payment.errors, status: :unprocessable_entity }\n format.js\n end\n end\n else\n render \"new\"\n end\n end",
"def delivery_report\n @product=Product.new\n @details=Array.new\n @customers=Customer.all\n @retire_notes= RetireNote.where(\"date between current_date-31 and current_date and retire_note_state_id = 1\")\n respond_to do |format|\n format.html # products_by_customer.html.erb\n format.json { render json: @product }\n end\n end",
"def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end",
"def create\n @productos_por_cliente = ProductosPorCliente.new(productos_por_cliente_params)\n\n respond_to do |format|\n if @productos_por_cliente.save\n format.html { redirect_to @productos_por_cliente, notice: 'Productos por cliente was successfully created.' }\n format.json { render :show, status: :created, location: @productos_por_cliente }\n else\n format.html { render :new }\n format.json { render json: @productos_por_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def index\n @customer_event_products = CustomerEventProduct.all\n @customer_event_product = CustomerEventProduct.new\n end",
"def create\n @customer_purchase = CustomerPurchase.new(customer_purchase_params)\n\n respond_to do |format|\n if @customer_purchase.save\n format.html { redirect_to @customer_purchase, notice: 'Customer purchase was successfully created.' }\n format.json { render :show, status: :created, location: @customer_purchase }\n else\n format.html { render :new }\n format.json { render json: @customer_purchase.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @capex = Capex.new(capex_params)\n\n respond_to do |format|\n if @capex.save\n format.html { redirect_to @capex, notice: 'Capex was successfully created.' }\n format.json { render action: 'show', status: :created, location: @capex }\n else\n format.html { render action: 'new' }\n format.json { render json: @capex.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product = Product.new(product_params)\n\n if @product.save\n render json: @product, status: :created, location: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def create\n @cp_change = CpChange.new(cp_change_params)\n\n if @cp_change.save\n render json: @cp_change, status: :created, location: @cp_change\n else\n render json: @cp_change.errors, status: :unprocessable_entity\n end\n end",
"def create\n @services = params[:inputserv]#[:inputcantidad]\n @quantity = params[:inputcantidad]\n @citation = Citation.new(citation_params)\n @client = Client.where(:id => @citation.client_id).select(:email)\n @client_name = Client.where(:id => @citation.client_id).select(:name, :firstlastname)\n\n respond_to do |format|\n if @citation.save\n cont = 0\n @services.each do |p|\n detalle = CitationDetail.new(service_id: p, quantity: @quantity[cont], citation_id:@citation.id)\n detalle.save\n cont +=1\n end\n #NotifyMailer.notify_mail(@citation).deliver\n \n format.html { redirect_to @citation, notice: 'Citation was successfully created.' }\n format.json { render :show, status: :created, location: @citation }\n else\n @clients = Client.all.map{|p| [ p.name, p.id ] }\n @services_combo = Service.all.map{|p| [ p.name, p.id ] }\n @citation_details = CitationDetail.where(:service_id => params[:id])\n #@services = params[:inputserv][:inputcantidad]\n format.html { render :new }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n return unless product_params\n render json: Product.create_product(\n @product_params,\n category_list,\n @current_user.id\n ).simple_info, status: :created\n rescue => e\n render json: { error: e }, status: :bad_request\n end",
"def create\n @product_product_attribute = ProductProductAttribute.new(product_product_attribute_params)\n\n respond_to do |format|\n if @product_product_attribute.save\n format.html { redirect_to @product_product_attribute, notice: 'Product product attribute was successfully created.' }\n format.json { render :show, status: :created, location: @product_product_attribute }\n else\n format.html { render :new }\n format.json { render json: @product_product_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def create\n @product = Product.new(params[:product])\n @manufacturers = Manufacturer.all\n @categories = Category.all\n respond_to do |format|\n if @product.save\n \n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_license\n @power_chip = PowerChip.find(params[:id])\n respond_to do |format|\n params[:power_chip][\"start_date\"] = params[:power_chip][\"start_date\"].to_i/1000\n params[:power_chip][\"end_date\"] = params[:power_chip][\"end_date\"].to_i/1000\n if @power_chip.update_attributes(params[:power_chip])\n format.html { redirect_to publisher_licenses_path, notice: 'License was successfully updated.' }\n else\n format.html { render action: \"edit_license\" }\n format.json { render json: @power_chip.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n product_ids=Array.new\n product_ids=params[:ids].split\n product_ids.each do |product|\n @checkout = Checkout.new(checkout_params)\n @checkout.product_id=product\n @checkout.save\n end\n respond_to do |format|\n if @checkout.save\n format.html { redirect_to \"/\", notice: 'Checkout was successfully done.' }\n format.json { render :products, status: :created, location: @checkout }\n else\n format.html { render :new }\n format.json { render json: @checkout.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n params[:customer][:admitted_on] = Chronic.parse(params[:customer][:admitted_on])\n params[:customer][:released_on] = Chronic.parse(params[:customer][:released_on])\n unless params[:customer][:program].nil?\n params[:customer][:program] = Program.find(params[:customer][:program])\n end\n @customer = Customer.new(params[:customer])\n\n respond_to do |format|\n if @customer.save\n flash[:notice] = 'Customer was successfully created.'\n format.html { redirect_to new_customer_path }\n format.xml { render :xml => @customer, :status => :created, :location => @customer }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @customer.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @cateroty = Cateroty.new(cateroty_params)\n\n respond_to do |format|\n if @cateroty.save\n format.html { redirect_to @cateroty, notice: 'Cateroty was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cateroty }\n else\n format.html { render action: 'new' }\n format.json { render json: @cateroty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n product_details = params.permit(:title, :inventory_count, :price)\n success = Product.create(product_details)\n\n render json: { success: success }\n end",
"def create\n product = Product.new(product_params)\n if product.save\n render json: ProductSerializer.new(product).serialized_json\n end\n end",
"def create\n @substrate = Substrate.new(params[:substrate])\n\n respond_to do |format|\n if @substrate.save\n format.html { redirect_to @substrate, notice: 'Substrate was successfully created.' }\n format.json { render json: @substrate, status: :created, location: @substrate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @substrate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n valor1 = customer_invoice_params[\"invoice_value\"].gsub('$','').gsub(',','')\n params[\"invoice_value\"] = valor1\n\n @customer_invoice = CustomerInvoice.create(customer_invoice_params)\n\n if @customer_invoice.save\n recalculate_cost_center(@customer_invoice.sales_order.cost_center_id)\n render :json => {\n message: \"¡El Registro fue creado con exito!\",\n register: @customer_invoice,\n type: \"success\"\n }\n else\n render :json => {\n message: \"¡El Registro no fue creado!\",\n type: \"error\",\n message_error: @customer_invoice.errors.full_messages\n }\n end\n \t\n end",
"def create\n @chocolate = Chocolate.new(chocolate_params)\n\n respond_to do |format|\n if @chocolate.save\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully created.\" }\n format.json { render :show, status: :created, location: @chocolate }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @concert = Concert.new(concert_params)\n\n respond_to do |format|\n if @concert.save\n format.html { redirect_to @concert, notice: 'Concert was successfully created.' }\n format.json { render :show, status: :created, location: @concert }\n else\n format.html { render :new }\n format.json { render json: @concert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def create\n render json: Beverage.create!(beverage_post_params), status: :created\n end",
"def create\n @customer = Customer.new(params[:customer])\n @customer_types =\n CustomerType.new(\n :customer_type => params[:customer_type],\n :customer_type_name => params[:customer_type_name],\n :zip_number => params[:zip_number],\n :prefecture_cd => params[:prefecture_cd],\n :city => params[:city],\n :oaza => params[:oaza],\n :town => params[:town],\n :building_name => params[:building_name],\n :customer_type_memo => params[:customer_type_memo])\n\n @customer.customer_types << @customer_types\n\n respond_to do |format|\n if @customer.save\n format.html { redirect_to @customer, notice: '以下の情報が登録されました。' }\n format.json { render json: @customer, status: :created, location: @customer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @customer.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @c_attribute = CAttribute.new(c_attribute_params)\n\n respond_to do |format|\n if @c_attribute.save\n format.html { redirect_to @c_attribute, notice: 'C attribute was successfully created.' }\n format.json { render :show, status: :created, location: @c_attribute }\n else\n format.html { render :new }\n format.json { render json: @c_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @price = @product.prices.new(price_params)\n\n respond_to do |format|\n if @price.save\n format.html { redirect_to product_path(@product), notice: 'Price was successfully created.' }\n format.json { render :show, status: :created, location: @price }\n else\n format.html { render :new }\n format.json { render json: @price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def confirmer_cart\n _user = current_client\n _confirmation = rand(36**10).to_s(36)\n _cart = Commande.new()\n _cart.client_id = _user.id\n if params[:addr_id] != '-1'\n _cart.adresse_id = params[:addr_id]\n else\n _cart.adresse_id = client_adresse.id \n end\n _cart.no_confirmation = _confirmation\n _cart.date_de_commande = params[:date_de_commande]\n _cart.heure_de_commande = params[:heure_de_commande]\n _cart.prix_total = params[:prix_total]\n _cart.status_pret = false\n _cart.save\n render json: _cart\n end",
"def new\n @payment = Payment.new\n\n @collect_c = collect_c\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n format.js\n end\n end",
"def create\n @cryptocurrency_price = CryptocurrencyPrice.new(cryptocurrency_price_params)\n\n respond_to do |format|\n if @cryptocurrency_price.save\n format.html { redirect_to @cryptocurrency_price, notice: \"Cryptocurrency price was successfully created.\" }\n format.json { render :show, status: :created, location: @cryptocurrency_price }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @cryptocurrency_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n render json: ::Transaction::CreditSerializer.new( do_credit! ), status: :created\n end",
"def create\n @circulation = Circulation.new(params[:circulation])\n\n respond_to do |format|\n if @circulation.save\n format.html { redirect_to @circulation, notice: 'Circulation was successfully created.' }\n format.json { render json: @circulation, status: :created, location: @circulation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @circulation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @product_price = ProductPrice.new(params[:product_price])\n\n respond_to do |format|\n if @product_price.save\n format.html { redirect_to @product_price, notice: 'Product price was successfully created.' }\n format.json { render json: @product_price, status: :created, location: @product_price }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product_price.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @product = Product.new(params[:product])\n @a = @product.vat\n @b = @a / 100.0 *@product.price\n @product.total = @b + @product.price\n # if Product.last\n # @last = Product.last.prid\n # @temp = @last.gsub(/[^\\d]/, '')\n # @prid = \"PDCT #{@temp.to_i + 1}\"\n # else\n # @prid = \"PDCT 1001\"\n # end\n @c = @product.quantity\n @d = @c * @product.price\n @product.total = @d\n\n respond_to do |format|\n if @product.save\n format.html { redirect_to @product, notice: 'Product was successfully created.' }\n format.json { render json: @product, status: :created, location: @product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @crate = Crate.new(params[:crate])\n\n respond_to do |format|\n if @crate.save\n CratesNotifier.crate_received(@crate).deliver\n format.html { redirect_to @crate, :notice => 'Crate was successfully created.' }\n format.json { render :json => @crate, :status => :created, :location => @crate }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @crate.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end",
"def create\n @xrf_coc = XrfCoc.new(xrf_coc_params)\n @xrf_coc.date = Time.now\n\n respond_to do |format|\n if @xrf_coc.save\n # format.html { redirect_to @xrf_coc, notice: 'Xrf coc was successfully created.' }\n format.html { redirect_to xrf_coc_path(@xrf_coc) }\n format.json { render :show, status: :created, location: @xrf_coc }\n else\n format.html { render :new }\n format.json { render json: @xrf_coc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @productserviceline = current_user.productservicelines.new(params[:productserviceline]) \n respond_to do |format|\n if @productserviceline.save\n \n @productservicelines = Productserviceline.all\n format.html { redirect_to productservicelines_path, notice: 'Productserviceline was successfully created.' }\n format.json { render json: @productserviceline, status: :created, location: @productserviceline }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @productserviceline.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def create\n @precioproducto = Precioproducto.new(params[:precioproducto])\n\n respond_to do |format|\n if @precioproducto.save\n format.html { redirect_to @precioproducto, notice: 'Precioproducto was successfully created.' }\n format.json { render json: @precioproducto, status: :created, location: @precioproducto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @precioproducto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n client_params[:specialDiscount].to_s.gsub!(',', '.')\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n\n format.html { redirect_to @client, notice: 'El Cliente fue Creado Exitosamente.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n discounts = []\n (1..params[:discount_number].to_i).each do |i|\n @discount = Discount.new(params[:discount])\n @discount.generate_token params[:discount_six_length].to_i\n @discount.save\n discounts << @discount\n end\n respond_to do |format|\n format.html { redirect_to discounts_url, notice: I18n.t(:discount_created, n: params[:discount][:name], c: params[:discount_number] ) }\n format.json { render json: discounts, status: :created, location: discounts }\n end\n end",
"def create\n @order = Order.new(order_params)\n @time = Time.now \n @order_last = Order.last()\n if @order_last == nil\n @ponum = \"4900000001\"\n else\n @ponum = @order_last.PONumber.to_i + 1\n end\n @supp = Supplier.all\n arr = Array.new(params[:order][:order_lines_attributes].length)\n i = 0\n while i < params[:order][:order_lines_attributes].length do\n arr[i] = params[:order][:order_lines_attributes][\"#{i}\"][:consolidate_id]\n i +=1\n end\n @consolidate = Consolidate.find(arr)\n # raise params.inspect\n if @order.save\n @consolidate.each do |cons|\n params = ActionController::Parameters.new({\n request: {\n status: \"Purchase Ordered\"\n }\n })\n permitted = params.require(:request).permit(:status)\n cons.update(permitted)\n end\n flash[:success] = \"Purchase Order has successfully generated\"\n redirect_to orders_path\n else\n render 'new'\n end\n end",
"def create\n @product = Product.new(product_params)\n if @product.save\n render json: {id: @product.id}\n else\n render json: {msg: @product.errors.full_messages.first}, status: :unprocessable_entity\n end\n end",
"def create\n @power_order = PowerOrder.new(power_order_params)\n @power_order.save\n render json: @power_order\n end",
"def create\n # Create the new product object from the parameters received\n @product = Product.create(product_params)\n\n respond_to do |format|\n # Try and save the product to the database\n if @product.save\n update_nil_values(@product)\n # Product saved successfully. We will create the entry in the product_categories table\n @category = Category.find(params[:category_id])\n @product.product_categories.create(category: @category)\n\n # Redirect to the products list indicating success\n format.html { redirect_to admin_products_url, notice: 'Product was successfully added.' }\n else\n # Product did not save successfully. Redirect to the products list indicating failure\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.6179065",
"0.6047354",
"0.58769214",
"0.58728254",
"0.58627504",
"0.5812873",
"0.5778166",
"0.56561",
"0.56438977",
"0.5642931",
"0.563476",
"0.562332",
"0.5602068",
"0.5562614",
"0.5558732",
"0.5547944",
"0.5540008",
"0.55357414",
"0.55110925",
"0.5501101",
"0.550062",
"0.55001795",
"0.5483818",
"0.5476243",
"0.5453747",
"0.5450359",
"0.543728",
"0.5436031",
"0.5416178",
"0.54160523",
"0.5409113",
"0.54016757",
"0.5388948",
"0.5381184",
"0.5380066",
"0.5377482",
"0.5368501",
"0.5367721",
"0.5356691",
"0.535576",
"0.5351678",
"0.5346984",
"0.5337774",
"0.5333387",
"0.53320974",
"0.53259575",
"0.5307176",
"0.5307044",
"0.5305911",
"0.5304804",
"0.53033924",
"0.5296914",
"0.52956027",
"0.5282097",
"0.5278904",
"0.52711314",
"0.5270637",
"0.52671134",
"0.526511",
"0.52637297",
"0.5261592",
"0.52591825",
"0.5259111",
"0.52575535",
"0.5255127",
"0.52550656",
"0.52492243",
"0.5245077",
"0.52436626",
"0.5242944",
"0.52402866",
"0.52398056",
"0.5239125",
"0.52354693",
"0.52340823",
"0.5232534",
"0.5232534",
"0.5231816",
"0.522995",
"0.5222404",
"0.52211255",
"0.5217962",
"0.5211679",
"0.5210913",
"0.5206437",
"0.52061623",
"0.5200125",
"0.5199842",
"0.519654",
"0.5195368",
"0.51923394",
"0.51901495",
"0.51842076",
"0.5184177",
"0.51827836",
"0.5180507",
"0.5179529",
"0.51787186",
"0.51775384",
"0.5176367"
] |
0.66350067
|
0
|
PATCH/PUT /product_cates/1 PATCH/PUT /product_cates/1.json
|
def update
respond_to do |format|
if @product_cate.update(product_cate_params)
format.html { redirect_to @product_cate, notice: 'Product cate was successfully updated.' }
format.json { render :show, status: :ok, location: @product_cate }
else
format.html { render :edit }
format.json { render json: @product_cate.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @contract_product.update_attributes(params[:contract_product])\n format.html { redirect_to @contract_product, notice: 'Contract product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @record = Product.find(params[:id])\n @record.update_attributes(params[:product])\n \n respond_to do |format|\n format.json {\n render json: {}\n }\n end\n end",
"def update\n respond_to do |format|\n if @customer_event_product.update(customer_event_product_params)\n format.html { redirect_to :back, notice: 'Piece was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render :edit }\n format.json { render json: @customer_event_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n set_associative_criteria @copon, params.require(:copon)\n get_product(@copon, params.require(:copon)[:product])\n respond_to do |format|\n if @copon.update(copon_params)\n format.html { redirect_to @copon, notice: 'Copon was successfully updated.' }\n format.json { render :show, status: :ok, location: @copon }\n else\n format.html { render :edit }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @collection\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @candies_product.update(candies_product_params)\n format.html { redirect_to @candies_product, notice: 'Candies product was successfully updated.' }\n format.json { render :show, status: :ok, location: @candies_product }\n else\n format.html { render :edit }\n format.json { render json: @candies_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @discount = Discount.find(params[:id])\n @discount.products = Product.find(params[:products].keys.select{|key| params[:products][key] != '0'})\n\n respond_to do |format|\n if @discount.update_attributes(params[:discount])\n format.html { redirect_to administration_discounts_url, notice: 'Discount was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @discount.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prod_coti.update(prod_coti_params)\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_coti }\n else\n format.html { render :edit }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cp_product.update(cp_product_params)\n format.html { redirect_to cp_product_url(@cp_product), notice: 'Product was successfully updated.' }\n format.json { render :show, status: :ok, location: @cp_product }\n else\n format.html { render :edit }\n format.json { render json: @cp_product.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 @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @product.update(product_params)\n render json: @product\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @product_request.update(product_request_params)\n format.html { redirect_to @product_request, notice: 'Product request was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_request }\n else\n format.html { render :edit }\n format.json { render json: @product_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_cach.update(product_cach_params)\n format.html { redirect_to @product_cach, notice: 'Product cache was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_cach }\n else\n format.html { render :edit }\n format.json { render json: @product_cach.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 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 @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n if @carts_product.update_attributes(params[:carts_product])\n format.html { redirect_to @cart, notice: 'Carts product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_cat = ProductCat.find(params[:id])\n\n respond_to do |format|\n if @product_cat.update_attributes(params[:product_cat])\n format.html { redirect_to @product_cat, notice: 'Product cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_cat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_cost = ProductCost.find(params[:id])\n\t@products = Product.find_all\n\t@tax_masters = TaxMaster.find_all\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:product_cost])\n format.html { redirect_to @product_cost, :notice => 'Product cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product_cost.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sc_product.update(sc_product_params)\n format.html { redirect_to @sc_product, notice: 'Sc product was successfully updated.' }\n format.json { render :show, status: :ok, location: @sc_product }\n else\n format.html { render :edit }\n format.json { render json: @sc_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @productrequest.update(productrequest_params)\n format.html { redirect_to @productrequest, notice: 'Productrequest was successfully updated.' }\n format.json { render :show, status: :ok, location: @productrequest }\n else\n format.html { render :edit }\n format.json { render json: @productrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_prod.update(recipe_prod_params)\n format.html { redirect_to @recipe_prod, notice: 'Recipe prod was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_prod }\n else\n format.html { render :edit }\n format.json { render json: @recipe_prod.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product_spec.update(product_spec_params)\n format.html { redirect_to @product_spec, notice: 'Product spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_spec }\n else\n format.html { render :edit }\n format.json { render json: @product_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chocolate.update(chocolate_params)\n format.html { redirect_to @chocolate, notice: \"Chocolate was successfully updated.\" }\n format.json { render :show, status: :ok, location: @chocolate }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @chocolate.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product.assign_attributes object_params.reject{|_, v| v.blank?}\n # In a normal app we have a pre filled form of the object to update,\n # so when we do a PATCH (or PUT) we send all the attributes again,\n # in the API we permit to send any field to update, so we need to remove\n # all the blank params of the object to prevent validations triggers of\n # attributes that we don't send to update\n if @product.save\n render json: @product.to_json\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n if @productonegocio.update_attributes(params[:productonegocio])\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @prd_attribute = PrdAttribute.find(params[:id])\n\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee']\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee']\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n format.html { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\tredirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully updated.') \n\t\t\telse \n \t\tformat.html { render :action => \"edit\" }\n\t\t\tend\n\t\t}\n format.xml { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\thead :ok \n\t\t\telse \t\t\n \t\tformat.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\t}\n format.json {\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = @prd_attribute.products[0].id\n prd_attribute_device.save!\n end\n end\n\n \t#render :json => @prd_attribute.errors, :status => :unprocessable_entity\n\t\t\thead :ok\n\t }\n end\n end",
"def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end",
"def update\n respond_to do |format|\n if @product_catalog.update(product_catalog_params)\n format.html { redirect_to @product_catalog, notice: 'Product catalog was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_catalog }\n else\n format.html { render :edit }\n format.json { render json: @product_catalog.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.update!(@product_params)\n rescue => e\n render json: { error: e }, status: :ok\n end",
"def update\n @product = Product.find(params[:id])\n\n if @product.update(product_params)\n head :no_content\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end",
"def update\n # Find the existing product in the database\n @product = Product.find(params[:id])\n\n respond_to do |format|\n # Try and update the product in the database\n if @product.update(product_params)\n update_nil_values(@product)\n # Product updated successfully. We will update the entry in the product_categories table if required\n if !params[:category_id].nil?\n @category = Category.find(params[:category_id])\n # Check to see if we have product_categories to update\n if @product.product_categories.exists?\n @product.product_categories.update_all(category_id: @category.id)\n else\n @product.product_categories.create(category: @category)\n end\n end\n\n # Redirect to the products list\n format.html {redirect_to admin_products_url}\n format.json {respond_with_bip(@product) }\n else\n # Product did not update successfully\n\n # Retrieve the categories to display in the caterogy filter dropdown\n @all_categories = Category.order(:name)\n\n format.html { render :new }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n \n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sales_coffee.update(sales_coffee_params)\n format.html { redirect_to @sales_coffee, notice: \"Sales coffee was successfully updated.\" }\n format.json { render :show, status: :ok, location: @sales_coffee }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @sales_coffee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply_approve\n \t# condition for check the cancelled flag then update flag as false else update only apply approve\n @product.cancelled ? @product.update(apply_approve: true,cancelled: false) : @product.update(apply_approve: true)\n @product.update(apply_approve: true)\n respond_to do |format|\n format.html { redirect_to publish_product_url(@product)}\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @tcustomerproduct.update(tcustomerproduct_params)\n format.html { redirect_to @tcustomerproduct, notice: 'Tcustomerproduct was successfully updated.' }\n format.json { render :show, status: :ok, location: @tcustomerproduct }\n else\n format.html { render :edit }\n format.json { render json: @tcustomerproduct.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @my_product.update(my_product_params)\n render :show, status: :ok\n else\n render json: @my_product.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cookbook.update(cookbook_params)\n format.html { redirect_to cookbook_path(@cookbook), notice: 'Cookbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cookbook.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capex.update(capex_params)\n format.html { redirect_to @capex, notice: 'Capex was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capex.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:spree_product_cost])\n format.json { head :ok }\n else\n format.json { render json: @product_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:spree_product_cost])\n format.json { head :ok }\n else\n format.json { render json: @product_cost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params[:product][:price] = format_float params[:product][:price]\n @product = Product.find(params[:id])\n\n respond_to do |format|\n params[:product][:price] = format_float params[:product][:price]\n if @product.update_attributes(params[:product])\n format.html { redirect_to admin_product_path(@product), notice: t(:'products.edited') }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def product_updates\n if params[\"product_id\"] == \"new\"\n @product = Product.new\n @product.florist_id = session[\"found_florist_id\"] \n else\n @product = Product.where(id: params[\"product_id\"]).first\n end\n @product.product_type= params[\"product_type\"]\n @product.name = params[\"product_name\"]\n if params[\"items_per_bunch\"] && params[\"items_per_bunch\"].to_f > 0\n @product.items_per_bunch = params[\"items_per_bunch\"].to_f * 100\n if params[\"cost_per_bunch\"] && params[\"cost_per_bunch\"].to_f > 0\n @product.cost_per_bunch = params[\"cost_per_bunch\"].to_f * 100.round(2)\n numerator = params[\"cost_per_bunch\"].to_f * 100.0.round(2)\n denominator = params[\"items_per_bunch\"].to_f * 100.0.round(2)\n \n @product.cost_for_one = (numerator / denominator).round(2)*100\n end\n end\n if params[\"markup\"] && params[\"markup\"].to_f >= 0 \n @product.markup = params[\"markup\"].to_f * 100\n end\n @product.status = params[\"status\"]\n if params[\"display_name\"] == \"\" || params[\"display_name\"] == nil\n @product.display_name = @product.name\n else\n @product.display_name = params[\"display_name\"]\n end\n @product.updated_by = Employee.where(id: session[\"found_user_id\"]).first.name\n @product.florist_id = session[\"found_florist_id\"]\n if @product.save\n redirect_to \"/product/#{@product.id}\" and return\n else\n render(:product_updates) and return\n end \n end",
"def update\n respond_to do |format|\n if @product_product_attribute.update(product_product_attribute_params)\n format.html { redirect_to @product_product_attribute, notice: 'Product product attribute was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_product_attribute }\n else\n format.html { render :edit }\n format.json { render json: @product_product_attribute.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product.update(product_params)\n set_products\n end",
"def update\n @ccbs_product = CcbsProduct.find(params[:id])\n\n respond_to do |format|\n if @ccbs_product.update_attributes(params[:ccbs_product])\n format.html { redirect_to(@ccbs_product, :notice => 'CcbsProduct was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ccbs_product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n @product.name_prefix = @product.name.first.upcase\n respond_to do |format|\n if @product.update_attributes(params[:product])\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sales_productivity = SalesProductivity.find(params[:id])\n\n respond_to do |format|\n if @sales_productivity.update_attributes(params[:sales_productivity])\n format.html { redirect_to @sales_productivity, notice: 'Sales productivity was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sales_productivity.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 render json: @sub_product.errors unless @sub_product.update(sub_product_params)\n end",
"def update\n render json: @sub_product.errors unless @sub_product.update(sub_product_params)\n end",
"def update\n @precioproducto = Precioproducto.find(params[:id])\n\n respond_to do |format|\n if @precioproducto.update_attributes(params[:precioproducto])\n format.html { redirect_to @precioproducto, notice: 'Precioproducto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @precioproducto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @productserviceline = Productserviceline.find(params[:id])\n @productserviceline.user = current_user\n\n respond_to do |format|\n if @productserviceline.update_attributes(params[:productserviceline]) \n\n @productservicelines = Productserviceline.all\n \n format.html { redirect_to productservicelines_path, notice: 'Productserviceline 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: @productserviceline.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to edit_product_path(@product), notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n respond_to do |format|\n @product.edit\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product,\n :notice=> 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json=> @product.errors,\n :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.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 respond_to do |format|\n if @carts_product.update(carts_product_params)\n format.html { redirect_to carts_products_url, notice: 'Quantity was successfully updated.' }\n format.json { render :show, status: :ok, location: @carts_product }\n else\n format.html { render :edit }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_product.update(food_product_params)\n end",
"def update\n\n ActiveRecord::Base.transaction do\n respond_to do |format|\n if @product.update(product_params)\n\n ImpactLineItem.all.each do |impact_line_item|\n product_impact_line_item = @product.product_impact_line_items.find_by_impact_line_item_id(impact_line_item.id)\n\n Category.all.each do |category|\n impact_entry = product_impact_line_item.find_impact_entry(category)\n impact_entry.update( value: params[:impact_entry][impact_line_item.id.to_s][category.id.to_s])\n end\n end\n\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end",
"def update!(**args)\n @annotations = args[:annotations] if args.key?(:annotations)\n @cancellations = args[:cancellations] if args.key?(:cancellations)\n @id = args[:id] if args.key?(:id)\n @price = args[:price] if args.key?(:price)\n @product = args[:product] if args.key?(:product)\n @quantity_canceled = args[:quantity_canceled] if args.key?(:quantity_canceled)\n @quantity_delivered = args[:quantity_delivered] if args.key?(:quantity_delivered)\n @quantity_ordered = args[:quantity_ordered] if args.key?(:quantity_ordered)\n @quantity_pending = args[:quantity_pending] if args.key?(:quantity_pending)\n @quantity_returned = args[:quantity_returned] if args.key?(:quantity_returned)\n @quantity_shipped = args[:quantity_shipped] if args.key?(:quantity_shipped)\n @return_info = args[:return_info] if args.key?(:return_info)\n @returns = args[:returns] if args.key?(:returns)\n @shipping_details = args[:shipping_details] if args.key?(:shipping_details)\n @tax = args[:tax] if args.key?(:tax)\n end",
"def update\n respond_to do |format|\n if @productos_por_cliente.update(productos_por_cliente_params)\n format.html { redirect_to @productos_por_cliente, notice: 'Productos por cliente was successfully updated.' }\n format.json { render :show, status: :ok, location: @productos_por_cliente }\n else\n format.html { render :edit }\n format.json { render json: @productos_por_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @own_product.update(own_product_params)\n format.html { redirect_to @own_product, notice: 'Own product was successfully updated.' }\n format.json { render :show, status: :ok, location: @own_product }\n else\n format.html { render :edit }\n format.json { render json: @own_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update!(product_params)\n format.html { redirect_to products_url, notice: 'Product was successfully updated.' }\n format.json { render json: @product }\n else\n format.html { render :edit }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, :notice => 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #@product = Product.find(params[:id]) #하단에서 미리 선언\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: '상품이 수정되었습니다.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @client.update(client_params)\n render json: @client\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @so_product.update(so_product_params)\n format.html { redirect_to @so_product, notice: 'So product was successfully updated.' }\n format.json { render :show, status: :ok, location: @so_product }\n else\n format.html { render :edit }\n format.json { render json: @so_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update # rubocop:disable MethodLength\n respond_to do |format|\n if @product.update(product_params)\n format.html do\n redirect_to @product,\n notice: 'Product was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @product }\n else\n @categories = Category.all\n format.html { render :edit }\n format.json do\n render json: @product.errors, status: :unprocessable_entity\n end\n end\n end\n end",
"def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end",
"def update\n @product = Product.find(params[:id])\n\n respond_to do |format|\n if @product.update_attributes(params[:product])\n format.html { redirect_to @product, notice: t(:product_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.639863",
"0.62911946",
"0.62647307",
"0.6262825",
"0.62416273",
"0.6198839",
"0.6180561",
"0.6176916",
"0.61735255",
"0.6131851",
"0.6123692",
"0.6112642",
"0.6085035",
"0.6079833",
"0.6065551",
"0.6054328",
"0.60374725",
"0.60122794",
"0.6012121",
"0.6010751",
"0.60007423",
"0.6000696",
"0.5989474",
"0.5986362",
"0.59845906",
"0.5968797",
"0.59596616",
"0.59484595",
"0.59467626",
"0.59453183",
"0.59336317",
"0.59304",
"0.5927154",
"0.5916236",
"0.5910438",
"0.5899772",
"0.58899003",
"0.587978",
"0.58708304",
"0.58683324",
"0.5866385",
"0.58616537",
"0.58585167",
"0.58585167",
"0.58581454",
"0.5857236",
"0.5857169",
"0.5848114",
"0.5840704",
"0.583367",
"0.58259976",
"0.58244985",
"0.5824274",
"0.5824274",
"0.58242136",
"0.5821802",
"0.5819836",
"0.5810355",
"0.58062106",
"0.5804459",
"0.5804459",
"0.5803901",
"0.58016664",
"0.5800329",
"0.5799334",
"0.5797997",
"0.5797047",
"0.5796007",
"0.578921",
"0.57858557",
"0.57858557",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785601",
"0.5785386",
"0.57828665",
"0.5779245",
"0.57753754",
"0.57753754",
"0.57753754",
"0.57753754",
"0.57753754",
"0.5774911",
"0.5774013",
"0.5770312",
"0.57702863"
] |
0.6227128
|
5
|
DELETE /product_cates/1 DELETE /product_cates/1.json
|
def destroy
@product_cate.destroy
respond_to do |format|
format.html { redirect_to product_cates_url, notice: 'Product cate was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @product.destroy\n\n render json: @product, status: :ok#, location: @collection\n end",
"def destroy\n @product.destroy\n render json: {}\n end",
"def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contract_product.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_products_url(:contract_id => @contract_product.contract_id) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @discounts_product.destroy\n respond_to do |format|\n format.html { redirect_to discounts_products_url, notice: 'Discounts product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @prod_coti.destroy\n respond_to do |format|\n format.html { redirect_to prod_cotis_url, notice: 'Prod coti was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end",
"def destroy\n @product_cach.destroy\n respond_to do |format|\n format.html { redirect_to product_caches_url, notice: 'Product cache was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end",
"def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to product_lines_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @candies_product.destroy\n respond_to do |format|\n format.html { redirect_to candies_products_url, notice: 'Candies product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchase_datum.destroy\n respond_to do |format|\n format.html { redirect_to purchase_data_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mobile_cfr_prod.destroy\n respond_to do |format|\n format.html { redirect_to mobile_cfr_prods_url }\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 @cateroty.destroy\n respond_to do |format|\n format.html { redirect_to cateroties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @record = Product.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end",
"def destroy\n @recipe_prod.destroy\n respond_to do |format|\n format.html { redirect_to recipe_prods_url, notice: 'Recipe prod was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productonegocio = Productonegocio.find(params[:id])\n @productonegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to productonegocios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_cost = ProductCost.find(params[:id])\n @product_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to product_costs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # @core_stock_product.destroy\n # respond_to do |format|\n # format.html { redirect_to core_stock_products_url }\n # format.json { head :no_content }\n # end\n end",
"def delete\n render json: Company.delete(params[\"id\"])\n end",
"def destroy\n @produtc = Produtc.find(params[:id])\n @produtc.destroy\n\n respond_to do |format|\n format.html { redirect_to produtcs_url }\n format.json { head :no_content }\n end\n end",
"def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end",
"def destroy\n @substrate = Substrate.find(params[:id])\n @substrate.destroy\n\n respond_to do |format|\n format.html { redirect_to substrates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cp_product.destroy\n respond_to do |format|\n format.html { redirect_to cp_products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product1.destroy\n respond_to do |format|\n format.html { redirect_to product1s_url, notice: \"Product1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @magento_product = MagentoProduct.find(params[:id])\n @magento_product.destroy\n\n respond_to do |format|\n format.html { redirect_to magento_products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tcustomerproduct.destroy\n respond_to do |format|\n format.html { redirect_to tcustomerproducts_url, notice: 'Tcustomerproduct was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sc_product.destroy\n respond_to do |format|\n format.html { redirect_to sc_products_url, notice: 'Sc product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @calorie_consumption.destroy\n respond_to do |format|\n format.html { redirect_to calorie_consumptions_url, notice: 'Calorie consumption was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_productivity = SalesProductivity.find(params[:id])\n @sales_productivity.destroy\n\n respond_to do |format|\n format.html { redirect_to sales_productivities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end",
"def destroy\n @price_schema.destroy\n respond_to do |format|\n format.html { redirect_to price_schemas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@product = Product.find(params[:id]) #하단에서 미리 선언\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productrequest.destroy\n respond_to do |format|\n format.html { redirect_to productrequests_url, notice: 'Productrequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n render json: {is_success: true, error_code: 200, message: \"Deleted Successfully\", result: @product}, status: 200\n end",
"def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end",
"def destroy\n @product.deleted = true\n @product.update_attributes(:deleted => true) \n # @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @groceryproduct.destroy\n respond_to do |format|\n format.html { redirect_to groceryproducts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_request.destroy\n respond_to do |format|\n format.html { redirect_to product_requests_url, notice: 'Product request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @purchase.destroy\n respond_to do |format|\n format.html { redirect_to purchase_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_cat = ProductCat.find(params[:id])\n @product_cat.destroy\n\n respond_to do |format|\n format.html { redirect_to product_cats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capex.destroy\n respond_to do |format|\n format.html { redirect_to capexes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @productos_por_cliente.destroy\n respond_to do |format|\n format.html { redirect_to productos_por_clientes_url, notice: 'Productos por cliente was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @precioproducto = Precioproducto.find(params[:id])\n @precioproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to precioproductos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @e_commerce.destroy\n respond_to do |format|\n format.html { redirect_to e_commerces_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @template_cate.destroy\n respond_to do |format|\n format.html { redirect_to template_cates_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\n @purchase.destroy\n respond_to do |format|\n\n format.html { redirect_to purchases_url }\n format.json { head :no_content }\n end\n\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def destroy\n @cate_item = CateItem.find(params[:id])\n @cate_item.destroy\n\n respond_to do |format|\n format.html { redirect_to '/cate_items' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @purchases.destroy\n respond_to do |format|\n format.html { redirect_to purchases_url, notice: 'Purchase deleted with success.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n product = Product.find(params[:id])\n product.destroy\n render json: {id: product.id}\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @carts_product = @cart.carts_products.find(params[:id])\n @carts_product.destroy\n\n respond_to do |format|\n format.html { redirect_to @cart }\n format.json { head :no_content }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @producto_seccion.destroy\n respond_to do |format|\n format.html { redirect_to producto_seccions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chocolate.destroy\n respond_to do |format|\n format.html { redirect_to chocolates_url, notice: \"Chocolate was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end",
"def destroy\n @line_item_product.destroy\n respond_to do |format|\n format.html { redirect_to line_item_products_url, notice: 'Line item product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @customer.destroy\n respond_to do |format|\n format.html { redirect_to customers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ccbs_product = CcbsProduct.find(params[:id])\n @ccbs_product.destroy\n\n respond_to do |format|\n format.html { redirect_to(ccbs_products_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @prod = Prod.find(params[:id])\n @prod.destroy\n\n respond_to do |format|\n format.html { redirect_to prods_url }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @hqproduct.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 @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end",
"def destroy\n @cycdatum = Cycdatum.find(params[:id])\n @cycdatum.destroy\n\n respond_to do |format|\n format.html { redirect_to cycdata_url }\n format.json { head :ok }\n end\n end",
"def remove_from_cart\n render json: CartProduct.find(params[:id]).destroy\n end",
"def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sales_coffee.destroy\n respond_to do |format|\n format.html { redirect_to sales_coffees_url, notice: \"Sales coffee was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_line = ProductLine.find(params[:id])\n @product_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(product_lines_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @product = Product.find(params[:id])\n @product.delete!\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n render :json => { :success => true, :message => \"Delete product #{@client.id}\", :client => @client }\n # respond_to do |format|\n # format.html { redirect_to(contacts_url) }\n # format.xml { head :ok }\n # end\n end",
"def destroy\n puts(\"you are in destroy \")\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.6717103",
"0.66579306",
"0.6639093",
"0.66334236",
"0.6604102",
"0.6576996",
"0.6570536",
"0.65475726",
"0.65408087",
"0.65389717",
"0.6515142",
"0.65117294",
"0.65108854",
"0.65104043",
"0.6507789",
"0.6505897",
"0.6497713",
"0.6489978",
"0.6483425",
"0.6475791",
"0.645818",
"0.6451121",
"0.644724",
"0.6447118",
"0.643965",
"0.6438133",
"0.64336956",
"0.6428292",
"0.6427456",
"0.6418624",
"0.6414229",
"0.64138514",
"0.6413833",
"0.64017004",
"0.6393721",
"0.63916177",
"0.6388213",
"0.63856333",
"0.6383847",
"0.6376272",
"0.63749963",
"0.63711554",
"0.6368107",
"0.6365962",
"0.63618064",
"0.63603234",
"0.63594633",
"0.63559103",
"0.635523",
"0.63529944",
"0.6352309",
"0.63515365",
"0.6351441",
"0.6351277",
"0.6346102",
"0.6345061",
"0.6344795",
"0.63442945",
"0.634278",
"0.63357615",
"0.6335452",
"0.6335367",
"0.6335072",
"0.63331646",
"0.6326755",
"0.6324921",
"0.63224834",
"0.6318552",
"0.63165355",
"0.63142663",
"0.63142663",
"0.63142663",
"0.63142663",
"0.63142663",
"0.63142663",
"0.63142663",
"0.63142663",
"0.6309018",
"0.6305027",
"0.6301985",
"0.6301944",
"0.6301354",
"0.62995505",
"0.6297011",
"0.6293404",
"0.62932855",
"0.6292212",
"0.628887",
"0.6287113",
"0.6287113",
"0.6287113",
"0.6287113",
"0.6287113",
"0.6287113",
"0.62861764",
"0.628581",
"0.6284432",
"0.6283326",
"0.6281296",
"0.6280494"
] |
0.69883144
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_product_cate
@product_cate = ProductCate.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 product_cate_params
params.require(:product_cate).permit(:name, :product_cate_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
|
arr_1 = [ ["a", "b", "c"], ["d", "e", "f"], ["g", "h", "i"] ] expected_1 = [ ["a", "d", "g"], ["b", "e", "h"], ["c", "f", "i"] ]
|
def my_transpose
ret = []
i=0
while i < self.length
j=0
ret2 = []
while j < self[i].length
ret2 << self[j][i]
j += 1
end
ret << ret2
i += 1
end
ret
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def merge(arr1, arr2)\n new_array = []\n arr2.each { |e| arr1 << e} \n arr1.each { |e| new_array << e unless new_array.include?(e)}\n new_array\nend",
"def custom_zip(arr1, arr2)\n final=[]\n arr1.each_with_index do |item, index|\n nested_array= []\n arr2.each_with_index do |item2, index2|\n if index == index2\n nested_array << item\n nested_array << item2\n final << nested_array\n end\n end\n end\n final\nend",
"def merge(arr1, arr2)\n arr1 = arr1.dup\n arr2 = arr2.dup # duplicate to prevent mutation of original array\n result = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n result << arr2.shift\n elsif arr2.empty?\n result << arr1.shift\n else\n if arr1[0] <arr2[0]\n result << arr1.shift\n else\n result << arr2.shift\n end\n end\n end\n result\nend",
"def merge(arr_1, arr_2)\n temp = arr_1.dup\n for el in arr_2\n temp << el unless temp.include? el\n end\n temp\nend",
"def duplicates_subarray2(arr)\n arr_srt = arr.sort {|a, b| a.ord <=> b.ord}\n new_arr = [[arr_srt[0]]]\n arr_srt.each_with_index do |elm, idx|\n next if idx == 0\n if new_arr[-1].include? elm\n new_arr[-1] << elm\n else\n new_arr << [elm]\n end\n end\n new_arr\nend",
"def my_arr_diff(arr1, arr2)\n\n duplicate = arr1.dup\n return duplicate if arr2.empty?\n duplicate.delete(arr2[0]) if duplicate.include?(arr2[0])\n my_arr_diff(arr1, arr2[1..-1])\nend",
"def merge_arrays(arr_one, arr_two)\n ret = []\n while arr_one.length > 0 || arr_two.length > 0\n if arr_one[0] < arr_two[0]\n ret << arr_one.shift\n elsif arr_two[0] < arr_one[0]\n ret << arr_two.shift\n elsif arr_two.empty?\n ret += arr_one\n elsif arr_one.empty?\n ret += arr_two\n else\n ret\n end\n end\n ret\nend",
"def merge(arr1, arr2)\n result = []\n arr1.each {|i| result << i if !result.include?(i)}\n arr2.each {|i| result << i if !result.include?(i)}\n result\nend",
"def merge(arr1, arr2)\n merged = []\n arr1.each { |el| merged << el }\n arr2.each { |el| merged << el }\n merged.uniq\nend",
"def merge(arr1, arr2)\n arr1 << arr2\n arr1.flatten(1).uniq\nend",
"def array_concat(array_1, array_2)\n # create new holder of correct length\n ret = []\n # iterate over first array\n array_1.each do |entry|\n #copy contents into holder\n \tret << entry\n end\n # iterate over second array, append to end\n array_2.each do |entry|\n \tret << entry\n end\n return ret\nend",
"def merge_sorted_arrays2(arr1, arr2)\n arr1_item = arr1[0]\n arr2_item = arr2[0]\n merged = []\n i = 1\n j = 1\n\n while arr1_item || arr2_item\n if !arr2_item || arr1_item < arr2_item\n merged << arr1_item\n arr1_item = arr1[i]\n i +=1\n else\n merged << arr2_item\n arr2_item = arr2[j]\n j +=1\n end\n end\n merged\nend",
"def merge(arr1, arr2)\n arrays = (arr1 + arr2).flatten\n one_array = []\n arrays.each { |n| one_array << n unless one_array.include?(n) }\n one_array\nend",
"def sub_arrays(arr)\n sub_arr = []\n i_arr = []\n arr.length.times do |x|\n arr.map do |ele1|\n i_arr += [ele1]\n sub_arr << i_arr\n end\n i_arr = []\n arr.shift\n end\n sub_arr\nend",
"def combine_arrays(arr1, arr2)\n\tcombo = arr1 + arr2\n\tswapped = true\n\n\twhile swapped\n\t\tswapped = false\n\t\t(combo.length-1).times do |i|\n\t\t\tif combo[i] > combo[i+1]\n\t\t\t\tcombo[i], combo[i+1] = combo[i+1], combo[i]\n\t\t\t\tswapped= true\n\t\t\tend\n\t\tend\n\tend\n\tcombo\nend",
"def custom_union(arr1, arr2)\n final = []\n arr1.each { |item| final << item unless final.include?(item) }\n arr2.each { |item| final << item unless final.include?(item) }\n final\nend",
"def merge_again(arr1, arr2)\n\tfinal_array = []\n\twhile(arr1.size > 0 && arr2.size > 0)\n\t\tif arr1[0] < arr2[0]\n\t\t\tfinal_array << arr1[0]\n\t\t\tarr1 = arr1[1...arr1.length]\n\t\telse\n\t\t\tfinal_array << arr2[0]\n\t\t\tarr2 = arr2[1...arr2.length]\n\t\tend\n\n\tend\n\n\tif arr1.length == 0\n\t\tfinal_array.concat arr2\n\telsif arr2.length == 0\n\t\tfinal_array.concat arr1\n\tend\n\n\tfinal_array\nend",
"def interleave(array1, array2)\n new_array = []\n if array1.size != array2.size\n puts \"Arrays are different size\"\n else\n array1.each_with_index do |v, i|\n new_array << v \n new_array << array2[i]\n end\n end\n new_array\nend",
"def merge(arr1, arr2)\n new_arr = []\n i1=0\n i2=0\n while i1 < arr1.length\n if i2 == arr2.length\n new_arr.concat(arr1[i1..-1])\n break\n elsif (arr1[i1] < arr2[i2])\n new_arr << arr1[i1]\n i1 += 1\n else\n new_arr << arr2[i2]\n i2 += 1\n end\n end\n if i2 != arr2.length\n (i2...arr2.length).each { |idx2| new_arr << arr2[idx2] }\n end\n return new_arr\n end",
"def join_arrays(arr1,arr2)\n arr1.concat(arr2)\nend",
"def custom_zip(arr1, arr2)\n new_nested = []\n arr1.each_with_index do | arr1_value, arr1_index |\n arr2.each_with_index do | arr2_value, arr2_index |\n if arr1_index == arr2_index\n arr3 = [arr1[arr1_index], arr2[arr2_index]]\n new_nested << arr3\n end # end of if\n end # end of do (array 2)\n end # end of do (array 1)\n new_nested\nend",
"def flat(arr1=[],arr2=[],i=0)\n if i >= arr1.length\n return arr2\n else\n if arr1[i].kind_of?(Array)\n flat(arr1[i],arr2) \n else\n arr2.push(arr1[i])\n end\n return flat(arr1,arr2,i+1)\n end\nend",
"def interleave(arr1, arr2)\n\tnew_arr = []\n\tcounter = 0\n\tloop do\n\t\tbreak if counter == arr1.size \n\t\tnew_arr << arr1[counter]\n\t\tnew_arr << arr2[counter]\n\t\tcounter += 1\n\tend\t\n\tnew_arr\nend",
"def merge(arr1, arr2=[])\n ind1 = ind2 = 0\n new_arr = []\n\n loop do\n break if arr1 == [] || arr2 == []\n if arr1[ind1] > arr2[ind2]\n new_arr << arr2[ind2]\n ind2 += 1\n else\n new_arr << arr1[ind1]\n ind1 += 1\n end\n break if ind1 >= arr1.size || ind2 >= arr2.size\n end\n\n if ind1 == arr1.size\n temp = arr2[ind2..-1]\n else\n temp = arr1[ind1..-1]\n end\n\n temp.each {|element| new_arr << element}\n\n new_arr\nend",
"def custom_sub(arr1, arr2)\n fin_ar = arr1.dup\n arr2.each {|el2| fin_ar.delete(el2) }\nfin_ar\nend",
"def custom_sub(arr1, arr2)\n fin_ar = arr1.dup\n arr2.each {|el2| fin_ar.delete(el2) }\nfin_ar\nend",
"def interleave(arr1, arr2)\n # new_arr = []\n # arr1.size.times do |count|\n # new_arr << arr1[count] << arr2[count]\n # end\n # new_arr\n\n # using Array#zip and Array#flatten\n arr1.zip(arr2).flatten\nend",
"def interleave(arr_1, arr_2)\n arr_1.zip(arr_2).flatten\nend",
"def arrange(reduced_array, matrix_2, matrix_1)\n result_matrix = []\n element = matrix_2[0].length\n until result_matrix.length == matrix_1.length\n result_matrix << reduced_array.take(element)\n end\n return result_matrix\n end",
"def union(*arr)\n final =[] #setting up an array to populate\n #--- Iterate through outer and inner arrays to shovel in single elements\n arr.each do |inner_array|\n inner_array.each do |elem|\n final << elem\n end\n end\n #--- Return a single array with elements\n return final\n end",
"def merge(arr1, arr2)\n merged_arr = []\n\n arr1.each { |el| merged_arr << el }\n arr2.each { |el| merged_arr << el }\n\n merged_arr.uniq\nend",
"def interleave(arr1, arr2)\n results = []\n arr1.each.with_index do |el,idx|\n results << el << arr2[idx]\n end\n results\nend",
"def interleave(arr1,arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n inter_arr = []\n idx = 0\n\n loop do\n inter_arr << arr1[idx]\n inter_arr << arr2[idx]\n \n idx += 1\n break if idx >= arr2.length\n end\n inter_arr\nend",
"def array_subsets(arr)\n return [[]] if arr.empty?\n partial_subset = array_subsets(arr[0..-2])\n addition = partial_subset.map {|ele| ele + [arr[-1]]}\n partial_subset + addition\nend",
"def array_concat(array_1, array_2)\n # Your code here\n \n new_array = Array.new\n array_1.each do |entry|\n if array_1.empty? == false\n new_array.push(entry)\n end\n end\n \n array_2.each do |entry|\n if array_2.empty? == false\n new_array.push(entry)\n end\n end\n \n new_array\nend",
"def merge_helper(arr1, arr2)\n merged = []\n until arr1.empty? && arr2.empty?\n if arr1.empty?\n merged << arr2.shift\n elsif arr2.empty?\n merged << arr1.shift\n elsif arr1.first < arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n merged\nend",
"def array_concat(array_1, array_2)\n # Your code here\n if ((array_1 == []) && (array_2 == []))\n \treturn []\n else\n \tarray_2.each do |element_2|\n \t\tarray_1.push(element_2)\n \tend\n end\n return array_1\nend",
"def interleave(arr1, arr2)\n arr3 = []\n arr1.each_with_index do |element, idx|\n arr3 << element << arr2[idx]\n end\n arr3\nend",
"def interleave(arr1, arr2)\n result = []\n arr1.each_with_index do |elem, indx|\n result << elem << arr2[indx]\n end\n result\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each do |item|\n \tnew_array.push(item)\n end\n array_2.each do |item|\n \tnew_array.push(item)\n end\n new_array\nend",
"def merge(arr1, arr2)\r\n merged_array = []\r\n arr1.each do |x|\r\n merged_array << x unless merged_array.include?(x)\r\n end\r\n arr2.each do |x|\r\n merged_array << x unless merged_array.include?(x)\r\n end\r\n merged_array\r\nend",
"def array_concat(array_1, array_2)\n concat_arrays = []\n array_1.each do |x|\n \tconcat_arrays << x\n end\n array_2.each do |x|\n \tconcat_arrays << x\n end\n concat_arrays\nend",
"def interleave(arr1, arr2)\n return_array = []\n arr1.each_with_index do |element, index|\n return_array << element << arr2[index]\n end\nend",
"def two_d_translate(arr)\n one_d_arr = []\n arr.each do | outer |\n outer.each.with_index do | inner, i |\n if i == 0\n outer[1].times do\n one_d_arr << inner\n end\n end\n end\n end\n return one_d_arr\nend",
"def subsets(arr)\n #base case(s)\n p arr\n return [arr] if arr.empty?\n # return [[], arr] if arr.length == 1\n #inductive step\n remaining_arr = subsets(arr[0...-1])\n remaining_arr + remaining_arr.map { |ele| ele + [arr.last] }\n # subsets(arr) + subsets(arr[0...-1])\nend",
"def custom_union(arr1, arr2)\n arr1.dup.concat(arr2).uniq # dup is make orizal array not changed\nend",
"def array_concat(array_1, array_2)\n if array_1.length == 0 && array_2.length == 0\n return []\n else\n x = 1\n while x <= array_2.length\n array_2.each do |new_item|\n array_1.push(new_item)\n x += 1\n end\n end\n return array_1 \n end\nend",
"def interleave(arr1, arr2)\n return_array = arr1.zip(arr2).flatten\nend",
"def interleave ( arr1 , arr2 )\n\tc = []\n\tif arr1.length > arr2.length \n\t\ta=arr1\n\t\tb=arr2\n\telse\n \t\ta=arr2\n \t\tb=arr1\n\tend\n\tc = a.slice(b.length..a.length-1)\n\treturn b.zip(a).flatten(1).slice!(0..b.length*2 -1) + c\nend",
"def array_concat(array_1, array_2)\n # Your code here\n # Initial solution\n=begin\n array_3 = []\n array_1.each do |n| \n array_3.push n\n end\n array_2.each do |m|\n array_3.push m\n end\n return array_3\nend\n=end\n # Refactored solution\n return array_1.concat array_2\nend",
"def interleaver(arr1, arr2)\n arr1.map.with_index { |el, idx| [el, arr2[idx]] }.flatten\nend",
"def arrange_arr(arr)\n arr.shift\n arr\n end",
"def interleave(arr_1, arr_2)\n current_index = 0\n combined_arr = []\n while current_index < arr_1.size\n combined_arr.push(arr_1[current_index])\n combined_arr.push(arr_2[current_index])\n current_index += 1\n end\n \n combined_arr\nend",
"def interleave(arr1, arr2)\n combined = []\n\n arr1.each_with_index do |item, index|\n combined.push(arr1[index])\n combined.push(arr2[index])\n end\n\n combined\nend",
"def duplicates_subarray(arr)\n new_arr = []\n arr.each do |elm|\n duplicate = false\n new_arr.each do |sub_arr|\n if sub_arr.include?(elm)\n sub_arr << elm\n duplicate = true\n end\n end\n new_arr << [elm] unless duplicate\n end\n new_arr.sort_by {|sub_arr| sub_arr[0].ord }\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def interleave(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def merge(arr1, arr2)\n\tmerged_arr = []\n\tuntil arr1.empty? or arr2.empty?\n\t\tif arr1.first <= arr2.first\n\t\t\tmerged_arr << arr1.shift\n\t\telse\n\t\t\tmerged_arr << arr2.shift\n\t\tend\n\tend\n\treturn merged_arr.concat(arr1).concat(arr2)\nend",
"def array_2(array2)\n array2.sort!\n return array2\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_3=[]\n array_1.each{|element| array_3<<element}\n array_2.each{|element| array_3<<element}\n return array_3\nend",
"def combinations(arr)\n new_array = []\n \n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1\n new_array << [ele1, ele2]\n end\n end\n end\n \n return new_array\nend",
"def array_concat(array_1, array_2)\n # Your code here\n combined_array = []\n\n array_1.each { |i| \n combined_array.push(i)\n }\n\n array_2.each do |j| \n combined_array.push(j)\n end\n\n return combined_array\nend",
"def array_concat(array_1, array_2)\n if array_1.empty? && array_2.empty?\n \tfinal_array = []\n else\n \tcount = 0\n \twhile count < array_2.length\n \t\tfinal_array = array_1.push array_2[count]\n \t\tcount += 1\n \tend\n end\n return final_array\nend",
"def test_fix_nested_array\n array = [1, [2], [3, [4,[5]]], 6]\n array = array.flatten\n assert_equal [1,2,3,4,5,6], array\n end",
"def interleave(arr1, arr2)\n results = []\n\n arr1.each_with_index do |el, i|\n results << el << arr2[i]\n # results << el << arr2[arr1.index(el)] ## if you wanted to do it without index as block param\n end\n\n results\nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.each_with_index do |element, index|\n new_arr << arr1[index]\n new_arr << arr2[index]\n end\n new_arr\nend",
"def combine_arrays(arr1, arr2)\r\n combo = arr1 + arr2 # and unsorted combo of arr1 and arr2\r\n length = combo.length\r\n sort = [] # set up array variable for eventual return.\r\n\r\n while sort.length < length # loops until an equal amount of elements are pushed to sort as exist in combo. this is unncessary.\r\n combo.each.with_index do |x, i| # loop through all elements in combo. again, could have used #each_index without x.\r\n if combo[i + 1] != nil && combo[i] > combo[i + 1] # safeguarding against nil comparison, checking if the element above combo[i] is smaller\r\n combo[i], combo[i + 1] = combo[i + 1], combo[i] # if so, the values are exchanged using the indices within combo.\r\n end\r\n end\r\n\r\n sort.unshift(combo.pop) # add as the first element of sort the last element of the already sorted combo array\r\n end # upon review, this may violate the exercises restrictions.\r\n\r\n sort # returns the sorted array after sort.length == combo.length\r\nend",
"def array_concat(array_1, array_2)\n\tif array_1.length == 0 && array_2.length == 0\n\t\treturn []\n\tend\n\ti = 0\n\twhile i < array_2.length\n\t\tarray_1.push(array_2[i])\n\t\ti+=1\n\tend\n return array_1\nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.each_with_index do |_, index|\n new_arr << arr1[index]\n new_arr << arr2[index]\n end\n new_arr\nend",
"def weave_array(array1, array2)\n result = []\n idx1 = 0\n idx2 = 1\n while #some condition\n temp_array = []\n while idx1 < array1.length && idx2 < array2.length\n if\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n if\n temp_array.push(array2[idx2])\n idx2 += 1\n end\n end\n while idx1 < array1.length\n temp_array.push(array1[idx1])\n idx1 += 1\n end\n while idx2 < array2.length\n temp_array.push(array1[idx2])\n idx2 += 1\n end\n result.push(temp_array)\n end\n result\nend",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |element|\n array_1 << element\n end\n array_1\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1[array_1.length] = x\n end\n return array_1\nend",
"def subsets(arr)\n return [ [] ] if arr.empty?\n subs = subsets(arr.drop(1)) # [ [] ]\n return subs.concat(subs.map { |sub| [arr.first].concat(sub) })\nend",
"def interleave(arr1, arr2)\n output_arr = []\n arr1.size.times do |idx|\n output_arr << arr1[idx]\n output_arr << arr2[idx]\n end\n output_arr\nend",
"def test_concat_arrays\n array = []\n array_one = [1,2,3,4,5]\n array_two = [6,7,8,9,10]\n array = array_one.concat(array_two)\n assert_equal [1,2,3,4,5,6,7,8,9,10], array\n end",
"def merge(arr1, arr2)\n result, idx1, idx2 = [], 0, 0\n until arr1[idx1] == nil || arr2[idx2] == nil\n if arr1[idx1] > arr2[idx2]\n result << arr2[idx2]\n idx2 += 1\n else\n result << arr1[idx1]\n idx1 += 1\n end\n end\n arr2[idx2] == nil ? result << arr1[idx1..-1] : result << arr2[idx2..-1] \n result.flatten\nend",
"def interleave(arr1, arr2)\n new_array = []\n for i in 1..(arr1.size)\n new_array << arr1[(i-1)]\n new_array << arr2[(i-1)]\n end\n new_array\nend",
"def array_concat(array_1, array_2)\n\n array_2.each do |a2_element|\n array_1.push(a2_element)\n end\n\n return array_1\n\nend",
"def interleave(arr1, arr2)\n new_arr = []\n arr1.size.times{ |idx| new_arr << arr1[idx] << arr2[idx] }\n new_arr\nend",
"def merge(ary_1, ary_2)\r\n ary_2.uniq.each_with_object(ary_1.uniq){ |element, merged| merged << element unless merged.include?(element) }\r\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each {|val| new_array.push (val)}\n array_2.each {|val| new_array.push (val)}\n new_array\nend",
"def zip(*arr)\n new_arr = []\n i = 0\n while i < arr[0].length\n temp = []\n arr.each do |subarray|\n temp << subarray[i]\n end\n new_arr << temp\n i += 1\n end\n new_arr\nend",
"def merge(arr1, arr2)\n return arr2 if arr1.size < 1\n return arr1 if arr2.size < 1\n\n merged_lists = []\n counter1 = 0\n counter2 = 0\n iterations = arr1.size + arr2.size\n\n iterations.times do |n|\n if arr1[counter1] == nil\n merged_lists << arr2[counter2]\n elsif arr2[counter2] == nil\n merged_lists << arr1[counter1]\n elsif arr1[counter1] <= arr2[counter2]\n merged_lists << arr1[counter1]\n counter1 += 1\n else\n merged_lists << arr2[counter2]\n counter2 += 1\n end\n end\n\n merged_lists\nend",
"def array_concat(array_1, array_2)\n newarray = Array.new\n for i in 0..(array_1.length-1)\n newarray[i] = array_1[i]\n end\n for j in 0..(array_2.length-1)\n newarray[array_1.length+j] = array_2[j]\n end\n return newarray\nend",
"def array_concat(array_1, array_2)\n new_array = []\n array_1.each { |value| new_array << value }\n array_2.each { |value| new_array << value }\n return new_array\nend",
"def merge(first_arr, second_arr)\n return_arr = []\n\n loop do\n break if first_arr.empty? || second_arr.empty?\n if first_arr[0] <= second_arr[0]\n return_arr << first_arr.shift\n else\n return_arr << second_arr.shift\n end\n end\n\n loop do\n break if first_arr.empty? && second_arr.empty?\n if first_arr.empty?\n return_arr << second_arr.shift\n else\n return_arr << first_arr.shift\n end \n end\n\n return_arr\nend",
"def array_concat(array_1, array_2)\n concat_array = []\n array_1.each {|value| concat_array << value}\n array_2.each {|value| concat_array << value}\n concat_array\nend",
"def array_concat(array_1, array_2)\n array_2.each do |x|\n array_1.push x\n end\n return array_1\nend",
"def merge(arr1, arr2)\n counter1, counter2 = 0, 0\n return_arr = []\n \n until counter1 >= arr1.size && counter2 >= arr2.size\n break if arr2[counter2] == nil || arr1[counter1] == nil\n\n if arr1[counter1] == nil || arr1[counter1] >= arr2[counter2]\n return_arr << arr2[counter2]\n counter2 += 1\n else\n return_arr << arr1[counter1]\n counter1 += 1\n end\n end\n return_arr + (arr1[counter1].nil? ? arr2[counter2..-1] : arr1[counter1..-1])\nend",
"def interleave(arr1, arr2)\r\n combined_arr = []\r\n counter = 0\r\n arr1.size.times do\r\n combined_arr << arr1[counter]\r\n combined_arr << arr2[counter]\r\n counter += 1\r\n end\r\n combined_arr\r\nend",
"def interleave2(arr1, arr2)\n arr1.zip(arr2).flatten\nend",
"def subsets(arr)\n return [[]] if arr.length == 0\n #return [arr] if arr.length == 1\n\n prev_set = subsets(arr[0..-2])\n new_subset = prev_set.map { |subarr| subarr + [arr[-1]] }\n\n prev_set + new_subset\nend",
"def array_concat(array_1, array_2)\n\treturn [] if both_empty?(array_1, array_2)\n\treturn array_1 if two_empty?(array_1, array_2)\n\treturn array_2 if one_empty?(array_1, array_2)\n\tfor x in array_2[0..-1]\n\t\tarray_1 << x\n\tend\n\treturn array_1\nend",
"def test_compare_two_string_arrays_more_than_one\n \ttest_list1 = [\"cat\", \"dog\", \"cow\"]\n \ttest_list2 = [\"dog\", \"rat\", \"cow\"]\n \tassert_equal @w.compare_two_string_arrays(test_list1, test_list2), [\"dog\", \"cow\"]\n end",
"def array_concat(array_1, array_2)\n # Your code here\n array_2.each do |val|\n \tarray_1 << val\n end\n array_1\nend",
"def interleave(array_1, array_2)\n results_array = []\n array_1.each_with_index do |elem, index|\n results_array << elem << array_2[index]\n end\n results_array\nend"
] |
[
"0.6332554",
"0.6311515",
"0.6305388",
"0.62789583",
"0.6255395",
"0.6254024",
"0.62375754",
"0.62201613",
"0.615454",
"0.61422014",
"0.61388826",
"0.61375445",
"0.6132739",
"0.6127048",
"0.6112288",
"0.61070293",
"0.6104327",
"0.61003363",
"0.6088657",
"0.60740775",
"0.60608995",
"0.6059151",
"0.6047181",
"0.60469884",
"0.60466105",
"0.60466105",
"0.60318434",
"0.6017391",
"0.6014316",
"0.60101",
"0.6005239",
"0.6003487",
"0.6002048",
"0.5985256",
"0.5979618",
"0.5978265",
"0.59577554",
"0.5956208",
"0.5952114",
"0.59341455",
"0.5932156",
"0.5931713",
"0.59261173",
"0.5913354",
"0.58943313",
"0.5892836",
"0.58851737",
"0.58823466",
"0.5880024",
"0.58757067",
"0.58756727",
"0.58703655",
"0.5866919",
"0.58621234",
"0.58581984",
"0.58578223",
"0.5856484",
"0.5856484",
"0.5856484",
"0.5856484",
"0.5856484",
"0.5856484",
"0.5856033",
"0.5849231",
"0.5846317",
"0.5844896",
"0.58424795",
"0.58412594",
"0.5838299",
"0.5834876",
"0.582992",
"0.5827535",
"0.58113974",
"0.58071375",
"0.58040947",
"0.580139",
"0.58008623",
"0.5795545",
"0.5793122",
"0.5783446",
"0.5779569",
"0.57745594",
"0.57737935",
"0.57722294",
"0.57711095",
"0.57708514",
"0.57646203",
"0.5760731",
"0.575793",
"0.57578063",
"0.5756734",
"0.5752395",
"0.57498837",
"0.5744937",
"0.574353",
"0.57424337",
"0.5734859",
"0.57323414",
"0.5731497",
"0.5729255",
"0.57240355"
] |
0.0
|
-1
|
def update like = Like.find(params[:id]) like.update_attributes(like_params) render json: like end
|
def destroy
authenticate!
if Dislike.find(params[:id]).user_id == current_user.id
Dislike.destroy(params[:id])
render json: { message: 'Item deleted' }
else
render:json => { :msg => "Dislike deletion failed.." }, :status => :bad_request
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n render json: Like.update(params[\"id\"], params[\"like\"])\n end",
"def update\n respond_to do |format|\n if @like.update(like_params)\n format.json { render json: @like, status: :ok }\n else\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @like = Like.find(params[:id])\n\n respond_to do |format|\n if @like.update_attributes(params[:like])\n format.html { redirect_to @like, notice: 'Like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @like.update(like_params)\n format.html { redirect_to @like, notice: 'Like was successfully updated.' }\n format.json { render :show, status: :ok, location: @like }\n else\n format.html { render :edit }\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @like.update(like_params)\n format.html { redirect_to @like, notice: 'Like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post_like = PostLike.find(params[:id])\n\n respond_to do |format|\n if @post_like.update_attributes(params[:post_like])\n format.html { redirect_to @post_like, notice: 'Post like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_like = UserLike.find(params[:id])\n\n respond_to do |format|\n if @user_like.update_attributes(params[:user_like])\n format.html { redirect_to @user_like, notice: 'User like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @post_like.update(post_like_params)\n format.html { redirect_to @post_like, notice: 'Post like was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_like }\n else\n format.html { render :edit }\n format.json { render json: @post_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @song_like = SongLike.find(params[:id])\n\n respond_to do |format|\n if @song_like.update_attributes(params[:song_like])\n format.html { redirect_to @song_like, notice: 'Song like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @song_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @music_like = MusicLike.find(params[:id])\n\n respond_to do |format|\n if @music_like.update_attributes(params[:music_like])\n format.html { redirect_to @music_like, :notice => 'Music like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @music_like.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_likes\n @wish.update(like_params)\n end",
"def update\n respond_to do |format|\n if @trans_like.update(trans_like_params)\n format.html { redirect_to @trans_like, notice: \"Trans like was successfully updated.\" }\n format.json { render :show, status: :ok, location: @trans_like }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @trans_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_post_like.update(user_post_like_params)\n format.html { redirect_to @user_post_like, notice: 'User post like was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_post_like }\n else\n format.html { render :edit }\n format.json { render json: @user_post_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @question_like.update(question_like_params)\n format.html { redirect_to @question_like, notice: 'Question like was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @like_list.update(like_list_params)\n format.html { redirect_to @like_list, notice: 'Like list was successfully updated.' }\n format.json { render :show, status: :ok, location: @like_list }\n else\n format.html { render :edit }\n format.json { render json: @like_list.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @idea_like.update(idea_like_params)\n format.html { redirect_to @idea_like, notice: 'Idea like was successfully updated.' }\n format.json { render :show, status: :ok, location: @idea_like }\n else\n format.html { render :edit }\n format.json { render json: @idea_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @c_like.update(c_like_params)\n format.html { redirect_to @c_like, notice: 'C like was successfully updated.' }\n format.json { render :show, status: :ok, location: @c_like }\n else\n format.html { render :edit }\n format.json { render json: @c_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @like_system_like = LikeSystem::Like.find(params[:id])\n\n respond_to do |format|\n if @like_system_like.update_attributes(params[:like_system_like])\n format.html { redirect_to @like_system_like, notice: 'Like was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @like_system_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_like = UserLike.find(params[:id])\n\n respond_to do |format|\n if @user_like.update_attributes(params[:user_like])\n format.html { redirect_to([:scaffold, @user_like], :notice => 'User like was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_like.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def like #todo not working properly and should be benchmarked\n item = Item.find(params[:id])\n like = Like.like(item, current_user) #should return these should be called thru Item model(let this = same here)\n\n if like && item.update_attributes(tot_likes: item.likes.size )\n item.reload #todo find a better way to do this please\n # if request.xhr? #will always be true\n render json: { likes: item.tot_likes, id: params[:id] }\n # end\n else\n redirect_to items_path\n end\n end",
"def update\n respond_to do |format|\n if @look_a_like.update(look_a_like_params)\n format.html { redirect_to @look_a_like, notice: \"Look a like was successfully updated.\" }\n format.json { render :show, status: :ok, location: @look_a_like }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @look_a_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hitcher_like.update(hitcher_like_params)\n format.html { redirect_to @hitcher_like, notice: 'Hitcher like was successfully updated.' }\n format.json { render :show, status: :ok, location: @hitcher_like }\n else\n format.html { render :edit }\n format.json { render json: @hitcher_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @like = Like.find(params[:id])\n if current_user.already_likes?(@like.post)\n user_likeship = UserLikeship.find_by_user_id current_user.id, conditions: ['like_id = ?', @like.id]\n user_likeship.destroy\n @like.update_attribute(:count, \"#{@like.count - 1}\")\n else\n user_likeship = UserLikeship.create( like: @like, user: current_user )\n @like.update_attribute(:count, \"#{@like.count + 1}\")\n end\n respond_to do |format|\n format.js\n format.html { redirect_to index_url, notice: 'Like was successfully updated.' }\n end\n end",
"def update\n @like_button = LikeButton.find(params[:id])\n\n respond_to do |format|\n if @like_button.update_attributes(params[:like_button])\n format.html { redirect_to(@like_button, :notice => 'Like button was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @like_button.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dislike.update(dislike_params)\n format.html { redirect_to @dislike, notice: 'Dislike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dislike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @like_log.update(like_log_params)\n format.html { redirect_to @like_log, notice: \"Like log was successfully updated.\" }\n format.json { render :show, status: :ok, location: @like_log }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @like_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @notifylike.update(notifylike_params)\n format.html { redirect_to @notifylike, notice: 'Notifylike was successfully updated.' }\n format.json { render :show, status: :ok, location: @notifylike }\n else\n format.html { render :edit }\n format.json { render json: @notifylike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def update\n attributes = recommendation_params\n if not attributes[:liked].nil?\n rec = Recommendation.find_by(id:params[:id])\n if rec && current_user.id == rec.user_id\n rec.update(recommendation_params)\n render json:rec, status:200\n else\n render json:{errors:\"Invalid recommendation_id\"},status:422\n end\n else\n render json:{errors:\"must provide liked param\"}, status:400\n end\n end",
"def update\n @feed_dislike = FeedDislike.find(params[:id])\n\n respond_to do |format|\n if @feed_dislike.update_attributes(params[:feed_dislike])\n format.html { redirect_to @feed_dislike, notice: 'Feed dislike was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feed_dislike.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @script_like.update(script_like_params)\n format.html { redirect_to @script_like, notice: 'Script like was successfully updated.' }\n format.json { render :show, status: :ok, location: @script_like }\n else\n format.html { render :edit }\n format.json { render json: @script_like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @liked_item = LikedItem.find(params[:id])\n\n respond_to do |format|\n if @liked_item.update_attributes(params[:liked_item])\n format.html { redirect_to @liked_item, notice: 'Liked item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @liked_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @post =Post.find(params[:post_id])\n @liked_post = @post.liked_posts.build(liked_post_params)\n @liked_post.user_id = current_user.id\n\n respond_to do |format|\n if @liked_post.update(liked_post_params)\n format.html { redirect_to @liked_post, notice: 'Like was successfully updated.' }\n format.json { render :show, status: :ok, location: @liked_post }\n else\n format.html { render :edit }\n format.json { render json: @liked_post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dislike_count.update(dislike_count_params)\n format.html do\n redirect_to @dislike_count,\n notice: 'Dislike count was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @dislike_count }\n else\n format.html { render :edit }\n format.json do\n render json: @dislike_count.errors,\n status: :unprocessable_entity\n end\n end\n end\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def update\n if params.has_key? :like\n @client.put(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unlike\n @client.delete(\"/me/favorites/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :repost\n @client.put(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n if params.has_key? :unpost\n @client.delete(\"/me/track_reposts/#{params[:id]}\")\n head :ok and return\n end\n\n head :bad_request\n end",
"def updated_likes\n @post = Post.find_by_id(params[:id])\n @current_like = @post.likes\n @post.update(likes: (@current_like + 1))\n redirect_to post_path\n end",
"def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end",
"def update \n @idea = @agenda.ideas.find(params[:id])\n @like = Like.find_by_sql([\"select * from likes where user_id = ? and agenda_id = ? and idea_id = ?\", current_user.id, @agenda.id, @idea.id])\n if @like.size == 0\n @like_new = Like.new(params[:like])\n @like_new.user_id = current_user.id\n @like_new.agenda_id = @agenda.id\n @like_new.idea_id = @idea.id\n @like_new.save\n if @idea.likes == nil\n @idea.likes = 1\n else\n @idea.likes += 1\n end \n @idea.update_attribute(:likes, @idea.likes)\n redirect_to agenda_path(@agenda)\n else\n flash[:error] = 'You have already liked the idea.'\n redirect_to agenda_path(@agenda)\n end\n end",
"def set_like\n @like = Like.find(params[:id])\n end",
"def update\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n if @likesforreply.update_attributes(params[:likesforreply])\n format.html { redirect_to @likesforreply, notice: 'Likesforreply was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @likesforreply.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @article = Article.find(params[:id])\n\n if @current_user.likes?(@article.comment)\n @current_user.unlike!(@article.comment)\n else\n @current_user.like!(@article.comment)\n end\n\n puts \"HI TEST\"\n respond_to do |format|\n format.html {redirect_to article_path(article)}\n format.js\n end\n end",
"def update\n dream = Dream.find params[:id]\n dream.update dream_params\n render json: {dream: dream}\n end",
"def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end",
"def quote_like\n @quote = set_quote\n @quote.cnt += 1\n respond_to do |format|\n if @quote.save\n #format.html { redirect_to @quote, notice: 'Quote was successfully liked.' }\n #format.json { render :show, status: :created, location: @quote }\n format.json { render json: {:data => { :quotes => @quote}, :result => { :errorcode => \"\", :messages => \"ok\", :rstatus => 1 }} }\n else\n #format.html { render :new }\n #format.json { render json: @quote.errors, status: :unprocessable_entity }\n format.json { render json: { :result => { :errorcode => \"\", :messages => @quote.errors, :rstatus => 0 }} }\n end\n end\n end",
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end",
"def update_attributes\n find_postlike.update_attributes(\n title: request_body[\"title\"],\n description: request_body[\"body\"],\n price_in_cents: request_body[\"price\"]\n )\n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @tweet.update(tweet_params)\n respond_with(@tweet)\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 user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end",
"def like\n \n Like.create( id_api: params[:id_api], user: current_user)\n render json: {text: \"create\"}\n \n \n \nend",
"def like_params\n params.require(:like).permit(:id, :user_id, :post_id)\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :show, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @wishlist.update(wishlist_params)\n format.html { redirect_to @wishlist, notice: 'Wishlist was successfully updated.' }\n format.json { render :index, status: :ok, location: @wishlist }\n else\n format.html { render :edit }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",
"def like_article\n @article = Article.find(params[:article_id])\n @like = Like.new(like_params)\n @like.article = @article\n @like.save\n \n end",
"def update\n @wishlist = Wishlist.find(params[:id])\n\n respond_to do |format|\n if @wishlist.update_attributes(params[:wishlist])\n format.html { redirect_to wishlists_url, notice: 'Wishlist was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", error: @wishlist.errors }\n format.json { render json: @wishlist.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n render json: Like.find(params[\"id\"])\n end",
"def create\n @like = Like.new(like_params)\n\n respond_to do |format|\n if @like.save\n format.json { render json: @like, status: :created }\n else\n format.json { render json: @like.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @comment = Comment.find(params[:comment_id])\n @comment.update(comment_params)\n render json: @comment\n end",
"def like \n activity=Activity.find(params[:id]) \n activity.update_attribute(\"like\",activity.like+1)\n flash[:notice]=\"U Liked The Activity:#{activity.activity_name}\"\n redirect_to :action=>\"home\"\n end",
"def update\n @wish = Wish.find(params[:id])\n\n respond_to do |format|\n if @wish.update_attributes(params[:wish])\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_like\n post = Post.find(params[:id])\n post.add_like\n render nothing: true\n end",
"def create\n @like = Like.new(like_params)\n if @like.save\n render json: @like, status: 201\n else\n render json: @like.errors, status: 422\n end\n end",
"def create\n # debugger\n like = Like.new(like_params)\n\n if like.save\n render json: like\n else\n render json: like.errors.full_messages, status: 422\n end\n end",
"def like_params\n params.permit(:id, :likable_id, :likable_type, :user_id)\n end",
"def update_my_quote\n\t\tif @user.update_attributes(my_quote: params[:my_quote])\n\t # response to the JSON\n\t\t\trender json: { success: true,message: \"My quote Successfully Updated.\", response: {my_quote: @user.my_quote} },:status=>200\n\t else\n\t render :json=> { success: false, message: @user.errors },:status=> 203\n\t end\t\n\tend",
"def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end",
"def update\n respond_to do |format|\n if @loveinstagram.update(loveinstagram_params)\n format.html { redirect_to @loveinstagram, notice: 'Loveinstagram was successfully updated.' }\n format.json { render :show, status: :ok, location: @loveinstagram }\n else\n format.html { render :edit }\n format.json { render json: @loveinstagram.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end",
"def like_params\n params.require(:like).permit(:likeable_id, :likeable_type, :user_id)\n end",
"def like_params\n params.require(:like).permit(:likeable_id, :likeable_type, :user_id)\n end",
"def update\n # find our musician\n @musician = Musician.find(params[:id])\n\n # set the status to true\n @musician.update_attributes(:status => true)\n @musician.save\n\n respond_to do |format|\n format.js {render inline: \"location.reload();\" }\n end\n end",
"def update\r\n rating = Rating.where(rater_id: current_user.id, ratee_id: params[:id]).first\r\n\r\n if rating.update(score: params[:score], comment: params[:comment], rater_id: current_user.id, ratee_id: params[:ratee_id])\r\n render json: rating\r\n else\r\n render json: { error: rating.errors }, status: :unprocessable_entity\r\n end\r\n end",
"def update\n message = Message.find(params[:id])\n message.update(message_params)\n render json: message\n end",
"def update\n neuron = Neuron.find(params[:id])\n\n neuron.update_attributes! params\n\n render :json => neuron\n # @neuron = Neuron.find(params[:id])\n # \n # respond_to do |format|\n # if @neuron.update_attributes(params[:neuron])\n # format.html { redirect_to @neuron, notice: 'Neuron was successfully updated.' }\n # format.json { head :ok }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @neuron.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def like_picture\n @like = Like.new(:user_id=>@login_user.id,:likable_id=>params[:id],:likable_type=>\"Picture\")\n @pic = Picture.find(params[:id])\n if @like.save\n respond_to do |format|\n format.js\n end\n else\n render :text=>\"Fail\"\n end\n end",
"def update\n @wish_list_item = WishListItem.find(params[:id])\n\n respond_to do |format|\n if @wish_list_item.update_attributes(params[:wish_list_item])\n format.html { redirect_to @wish_list_item, notice: 'Wish list item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wish_list_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_attributes\n find_postlike.update_attributes(\n name: request_body[\"title\"],\n description: request_body[\"body\"],\n date: request_body[\"date\"],\n start_time: request_body[\"starts_at\"],\n end_time: request_body[\"ends_at\"],\n venue: request_body[\"venue\"],\n address: request_body[\"address\"],\n tag_list: request_body[\"tags\"])\n end",
"def update\n respond_to do |format|\n if @wish.update(wish_params)\n format.html { redirect_to @wish, notice: 'Wish was successfully updated.' }\n format.json { render :show, status: :ok, location: @wish }\n else\n format.html { render :edit }\n format.json { render json: @wish.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @quote = Quote.find(params[:id])\n title=params['q_param']['title']\n total=params['q_param']['total']\n tax_rate=params['q_param']['tax_rate']\n l=params['q_param']['list']\n comment=params['q_param']['comment']\n list=Array.new\n l.keys.each do |j|\n list << [l[j][0],l[j][1],l[j][2],l[j][3]]\n end\n quote_p={:title=>title,:total=>total,:list=>list,:tax_rate=>tax_rate,:comment=>comment}\n @quote.update(quote_p)\n\n # respond_to do |format|\n # if @quote.update(quote_p)\n # format.html {}\n format.json { head :no_content }\n # else\n # format.html {}\n # format.json { render json: @quote.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def like_params\n params.permit(:totalLikes, :user_id, :post_id)\n end",
"def like\n @movie.upvote_by current_user\n @movie.update_reddit_score\n respond_to do |format|\n format.html { redirect_to(:back) }\n format.js { render :js, file: 'movies/js/like' }\n end\n end",
"def update\n question = Question.find_by!(id: params[:id])\n if question\n question.name = params[:name]\n question.description = params[:description]\n question.user_id = params[:user_id]\n question.category_id = params[:category_id]\n question.zavrseno = params[:zavrseno]\n question.uposlenik_id = params[:uposlenik_id]\n question.save\n render json: question, status: 200 \n else\n render json: { errors: \"This link is invalid.\"}, status: 404\n end\n end",
"def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end",
"def set_comment_like\n @comment_like = CommentLike.find(params[:id])\n end",
"def update\n # @user_trick = UserTrick.find(params[:id])\n @user_trick.update(user_trick_params)\n render json: UserTrickSerializer.new(@user_trick).serialized_json\n end",
"def like_params\n params.require(:like).permit(:tweet_id, :user_id)\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"
] |
[
"0.9527674",
"0.8961223",
"0.86984545",
"0.84735143",
"0.843261",
"0.8423937",
"0.8280598",
"0.8167784",
"0.8121424",
"0.8084288",
"0.7982549",
"0.7857411",
"0.7797125",
"0.7784984",
"0.777795",
"0.77765286",
"0.77279323",
"0.76378053",
"0.7630234",
"0.76281214",
"0.7558547",
"0.7532659",
"0.74916",
"0.7485995",
"0.74786305",
"0.74576133",
"0.7355802",
"0.72717845",
"0.72717845",
"0.72717845",
"0.7253892",
"0.72479945",
"0.721133",
"0.7157133",
"0.71495664",
"0.71444577",
"0.71112096",
"0.71112096",
"0.71112096",
"0.71112096",
"0.71112096",
"0.71112096",
"0.71112096",
"0.71112096",
"0.70572865",
"0.7037707",
"0.7012541",
"0.6982865",
"0.6953856",
"0.69317555",
"0.6890104",
"0.68868506",
"0.68699837",
"0.68699837",
"0.6834978",
"0.68229884",
"0.6817695",
"0.6816793",
"0.68131095",
"0.6799349",
"0.6799042",
"0.6782723",
"0.677844",
"0.677744",
"0.67763335",
"0.67755866",
"0.6769319",
"0.67663074",
"0.6745606",
"0.6731807",
"0.6711967",
"0.66970426",
"0.66941565",
"0.6690799",
"0.66652006",
"0.6660978",
"0.664719",
"0.6632723",
"0.6611828",
"0.6608725",
"0.66013974",
"0.6589052",
"0.6589052",
"0.65842986",
"0.6581544",
"0.6579456",
"0.65787673",
"0.65783817",
"0.6567102",
"0.65650177",
"0.6564703",
"0.65626574",
"0.6559924",
"0.6557698",
"0.6557216",
"0.654824",
"0.6540333",
"0.6537627",
"0.6533348",
"0.65275",
"0.65239596"
] |
0.0
|
-1
|
Some order attribute might be short alias.
|
def convert_sort_order(order)
return nil if order.blank?
o = order.clone
SORT_ORDER_ALIASES.each_pair do|value_alias, real_value|
o.gsub!(value_alias, real_value)
end
o
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def attrs_to_orderings(order)\n order.map do |o|\n Arel::Attribute === o ? o.asc : o\n end\n end",
"def common_name(tax_order = T.unsafe(nil)); end",
"def ordered_by(attribute_name)\n ordering[attribute_name]\n end",
"def build_order\n\t\t\tp = params.permit(:terms, :order)\n\t\t\tif p['order']\n\t\t\t\tattribute, asc_desc = p['order'].split(\" \")\n\t\t\t\tif ['terms', 'count', 'updated_at'].include?(attribute) && ['asc', 'desc'].include?(asc_desc)\n\t\t\t\t\treturn \"#{attribute} #{asc_desc}\"\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn \"updated_at desc\"\n\t\tend",
"def order\n @order || \"99_99\"\n end",
"def order=(order)\n @order = order\n return if order.blank?\n if is_sphinx_scope?(order) # We first check for scopes since they might be named ascend_by_scopename.\n scopes[order.to_sym] = true\n elsif order.to_s =~ /^(ascend|descend)_by_(\\w+)$/\n @order_direction = ($1 == 'ascend') ? :asc : :desc\n if is_sphinx_attribute?($2)\n @order_attribute = $2.to_sym\n elsif [:weight, :relevance, :rank, :id, :random, :geodist].include?($2.to_sym)\n @order_attribute = \"@#{$2} #{@order_direction}\"\n end\n end\n end",
"def attr_orders\n @attr_orders\n end",
"def custom_order_attribute(custom_key, value_instruction=nil)\n Order.custom_order_attribute(custom_key, value_instruction)\n end",
"def attribute_alias(name)\n attribute_aliases[name.to_s]\n end",
"def correct_abbreviations_attributes; end",
"def attribute_alias?(new_name)\n attribute_aliases.key? new_name.to_s\n end",
"def attr_alias(name)\n name = name.intern\n if synonym = self.class.attr_alias(name)\n return synonym\n else\n return name\n end\n end",
"def normalize_order(order); end",
"def aref_prefix\n 'attribute'\n end",
"def order_union_attributes(*args)\n arguments = preprocess_order_args(args)\n arguments.flat_map do |arg|\n case arg\n when String, Symbol\n arg\n when Hash\n arg.map do |field, order|\n [:asc, :desc].include?(order.to_sym.downcase) ? \"#{field.to_s} #{order.to_s.upcase}\" : field.to_s\n end\n end\n end\n end",
"def canonical_name_attr(attr = nil)\n if attr\n @canonical_name_attr = attr.to_sym\n else\n @canonical_name_attr || CANONICAL_NAME_ATTR\n end\n end",
"def reorder!(order)\n @order = order\n\n @attributes = order!(@attributes, order)\n @name = name!(@attributes)\n\n if @name[-2, 2] == \".,\" # Fix this.\n @name = @name[0..-3]\n end\n\n self\n end",
"def ordered_by!(att)\n\t\tself.sort_by! { |element| element.send(att).to_f }.reverse!\n\tend",
"def aliases\n short ? [name, short] : [name]\n end",
"def set_order(ordering)\n\t\to = \"\"\n\t\tordering.each do |obj_place|\n\t\t\to << (obj_place.model + \"_\" + obj_place.id.to_s + \"///,\")\n\t\tend\n\t\tself.update_attribute :order, o\n\tend",
"def shortname\n attributes['shortName']\n end",
"def first_ordered_by(attribute_name)\n direction, level = ordering[attribute_name]\n return direction if level == 0\n end",
"def attr_get_oradate(attr_type, strict = true)\n #This is a stub, used for indexing\n end",
"def orders\n \"assetcode ASC\"# \"staffgrade_id ASC\"\n end",
"def ordering_by\n order && order.to_s.gsub(/^(ascend|descend)_by_/, '')\n end",
"def a_or_d(order_end)\n case order_end\n when 'asc' then \"A\"\n when 'desc','',nil then \"D\"\n else nil\n end\n end",
"def attribute(name); end",
"def variant_column\n \"option_value_#{ order_in_good }\"\n end",
"def encode_attr(name)\n \"a$\" + @attribute_name_generator.get(name.to_s)\n end",
"def sortable_attribute(attribute, options = {})\n attribute = attribute.to_s\n sortable_attributes << attribute\n sortable_attributes_options[attribute] = options\n end",
"def attr_without_feed_prefix (attr_sym)\n self[attr_sym].slice feed.prefix if self.gtfs_cols_with_prefix.include? (attr_sym)\n end",
"def order=(_arg0); end",
"def order_hint\n return @order_hint\n end",
"def reference_attribute\n\t\t\tsorted_attributes.first\n\t\tend",
"def attribute_parse_naming\n OBJ_ATTRIBUTE_PARSE_NAMING\n end",
"def order_type\n xml_field('orderType', 1, false)\n end",
"def order=( o )\n\t\torig = @order\n\t\t@order = o\n\t\traise_on_invalid_column if o\n\t\torig\n\tend",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def attribute_name; end",
"def order(ordering=nil)\n @options[:order] = ordering if ordering.kind_of?(String)\n end",
"def xmlns_attr\n short.nil? ? \"xmlns\" : \"xmlns:#{short}\"\n end",
"def normalize_order(order)\n\t\t\t\torder = Array(order)\n\t\t\t\tif order.length == 2 && !order[0].is_a?(Array) && [:asc, :desc].include?(order[1])\n\t\t\t\t\torder = [order]\n\t\t\t\telse\n\t\t\t\t\torder = order.map {|pair| pair.is_a?(Array) ? pair : [pair, :asc] }\n\t\t\t\tend\n\t\t\t\torder.each do |pair|\n\t\t\t\t\tpair.length == 2 or raise ArgumentError, \"each order clause must be a pair (unknown clause #{pair.inspect})\"\n\t\t\t\t\t[:asc, :desc].include?(pair[1]) or raise ArgumentError, \"order must be specified with :asc or :desc (unknown key #{pair[1].inspect})\"\n\t\t\t\tend\n\t\t\t\torder\n\t\t\tend",
"def anchored_attribute(attribute, options = {})\n resource = object.class.name.demodulize.underscore\n anchor_name = [resource, attribute.tr(' ', '_')].join('.').downcase\n anchor_and_label_markup(anchor_name, nil, options)\n end",
"def aliased_name; end",
"def arg_order(*args)\n if args.size > 0\n begin\n args = args.uniq\n args.each do |x|\n __doodle__.handle_error :arg_order, ArgumentError, \"#{x} not a Symbol\", Doodle::Utils.doodle_caller if !(x.class <= Symbol)\n __doodle__.handle_error :arg_order, NameError, \"#{x} not an attribute name\", Doodle::Utils.doodle_caller if !doodle.attributes.keys.include?(x)\n end\n __doodle__.arg_order = args\n rescue Exception => e\n __doodle__.handle_error :arg_order, InvalidOrderError, e.to_s, Doodle::Utils.doodle_caller(e)\n end\n else\n __doodle__.arg_order + (__doodle__.attributes.keys - __doodle__.arg_order)\n end\n end",
"def special_attribute(name)\n @special_attributes[name]\n end",
"def get_key_order\n\t\t\t\tsuper.concat(BingAdsApi::Config.instance.\n\t\t\t\t\tcampaign_management_orders['keyword'])\n\t\t\tend",
"def order(order)\n attribute, order_type = order.gsub(/\\s+/, ' ').split(' ')\n raise 'Invalid attribute in order clause' unless (model.attributes.keys + ['id', 'created_at']).include?(attribute)\n\n attribute = model.map_to_syncano_attribute(attribute)\n order_type = order_type.to_s.downcase == 'desc' ? 'DESC' : 'ASC'\n\n self.parameters.merge!({ order_by: attribute, order: order_type })\n\n self\n end",
"def is_alias?; end",
"def order(order_str:)\n @order_by = \"ORDER BY #{order_str}\"\n end",
"def attr\n @attr.map{|k,v| \"#{k}=\\\"#{h v}\\\"\"}.sort.join(' ')\n end",
"def order_hint=(value)\n @order_hint = value\n end",
"def keyword\n return OrderedStringHelper.deserialize(super )\n end",
"def keyword\n return OrderedStringHelper.deserialize(super )\n end",
"def authorizable_ransackable_attributes\n if Ransack::SUPPORTS_ATTRIBUTE_ALIAS\n column_names + _ransackers.keys + _ransack_aliases.keys +\n attribute_aliases.keys\n else\n column_names + _ransackers.keys + _ransack_aliases.keys\n end.uniq\n end",
"def extra=(extra)\n alias_of.extra(extra)\n end",
"def normalize_order(order)\n order = Array(order)\n\n if order.length == 2 && !order[0].is_a?(Array) && [:asc, :desc].include?(order[1])\n order = [order]\n else\n order = order.map {|pair| pair.is_a?(Array) ? pair : [pair, :asc] }\n end\n\n order.each do |pair|\n pair.length == 2 or raise ArgumentError, \"each order clause must be a pair (unknown clause #{pair.inspect})\"\n [:asc, :desc].include?(pair[1]) or raise ArgumentError, \"order must be specified with :asc or :desc (unknown key #{pair[1].inspect})\"\n end\n\n order\n end",
"def is_ordering?\n name =~ /^(ascend_by|descend_by)/ || arguments.blank?\n end",
"def sortable_attribute_options(attribute)\n sortable_attributes_options.fetch(attribute.to_s, {})\n end",
"def ordinal_abbreviation; end",
"def atomic_attribute_name(name)\n embedded? ? \"#{atomic_position}.#{name}\" : name\n end",
"def ingredient_order_by(model_tag)\n return model_tag + \".name ASC\" \n end",
"def allowed_sort_attributes\n @scope.attribute_names\n end",
"def order_number_label\n\t\t$tracer.trace(__method__)\n return ToolTag.new(span.className(create_ats_regex_string(\"ats-ordnumlbl\")), __method__)\n\tend",
"def canonical_option_sym opt_sym\n @options_with_short_keys[opt_sym].name.to_sym\n end",
"def original_order\n end",
"def normalize_order(order)\n order = Array(order)\n\n if order.length == 2 && !order[0].is_a?(Array) && [:asc, :desc].include?(order[1])\n order = [order]\n else\n order = order.map {|pair| pair.is_a?(Array) ? pair : [pair, :asc] }\n end\n\n order.each do |pair|\n pair.length == 2 or raise ArgumentError, \"each order clause must be a pair (unknown clause #{pair.inspect})\"\n [:asc, :desc].include?(pair[1]) or raise ArgumentError, \"order must be specified with :asc or :desc (unknown key #{pair[1].inspect})\"\n end\n\n order\n end",
"def test_alias_field_construction\n value_ = ::Versionomy.create({:major => 1, :minor => 9, :special_suffix => 'pre2'}, :semver)\n assert_equal([1, 9, 0, 'pre2'], value_.values_array)\n end",
"def default_order\n \"name\"\n end",
"def ext_attr\n attribute_prop(10)\n end",
"def alias_names; end",
"def orders\n \"staffgrade_id ASC\"\n end",
"def orders\n \"staffgrade_id ASC\"\n end",
"def validate_order!(options)\r\n return unless options && options[:order]\r\n\r\n (options[:order] = options[:order].to_s).split(/, +/).each do |order|\r\n sort = order.split(/ +/)\r\n\r\n if [1, 2].include? sort.size\r\n attribute, direction = sort\r\n else\r\n raise InvalidSort, \"order must be in the form 'attribute [asc/desc]'\"\r\n end\r\n\r\n if column = sortable(options[:version])[attribute.to_sym]\r\n if column.is_a? TrueClass\r\n column = attributes(options[:version])[attribute.to_sym].to_s\r\n end\r\n\r\n options[:order] = options[:order].sub attribute, column\r\n else\r\n if sortable.empty?\r\n raise InvalidSort, \"this resource can not be sorted\"\r\n else\r\n raise InvalidSort, \"order must be one of #{sortable.keys * ', '}\"\r\n end\r\n end\r\n\r\n unless direction.nil? || direction =~ /^(?:asc|desc)$/i\r\n raise InvalidSort, \"order direction must be 'asc' or 'desc'\"\r\n end\r\n end\r\n\r\n options[:order]\r\n end",
"def columns_for_distinct(columns, orders) # :nodoc:\n order_columns = orders.compact_blank.map { |s|\n # Convert Arel node to string\n s = visitor.compile(s) unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, \"\")\n }.compact_blank.map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n (order_columns << super).join(\", \")\n end",
"def parse_order(data)\n\t\torder = Custom::Order.new\n\t\t@columns.each do |column_name, index|\n\t\t\tsetter_method_name = column_name.downcase.tr(' ','_') + \"=\"\n\t\t\tif order.respond_to?(setter_method_name.to_sym) and !data[index].nil?\n\t\t\t\torder.send setter_method_name.to_sym, data[index].strip \n\t\t\tend\n\t\tend\n\t\treturn order\n\tend",
"def define_order(s_order)\n s_order=='Crescente' ? :asc : :desc\n end",
"def to_xml\n %Q{\n\t\t<a:Orders>\n\t\t <a:Order>\n\t\t <a:attributeName>#{attribute_name}</a:attributeName>\n\t\t <a:orderType>#{order_type}</a:orderType>\n\t\t </a:Order>\n\t\t</a:Orders>\n }\n end",
"def attribute_method_with_special_attr?(name)\n name2 = strip_predicate_and_index(name)\n if name2.start_with?('zzz_') && !name2.end_with?('before_type_cast')\n true\n else\n attribute_method_without_special_attr?(name)\n end\n end",
"def contains_alias(aliaz)\n\n end",
"def alias_attribute(alias_name, fully_qualified_name)\n self.class_eval <<-EOF\n def #{alias_name}\n read_attribute(\"#{fully_qualified_name}\")\n end\n def #{alias_name}=(value)\n write_attribute(\"#{fully_qualified_name}\", value)\n end\n EOF\n end",
"def attribute_name_fully_qualified_for_all_but_main_table_columns #:nodoc:\n self.main_table ? attribute : table_alias_or_table_name + '.' + attribute\n end",
"def shortName\n self.short_name\n end",
"def columns_for_distinct(columns, orders) #:nodoc:\n order_columns = orders.reject(&:blank?).map{ |s|\n # Convert Arel node to string\n s = s.to_sql unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, '')\n .gsub(/\\s+NULLS\\s+(?:FIRST|LAST)\\b/i, '')\n }.reject(&:blank?).map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n [super, *order_columns].join(', ')\n end",
"def attr\n @attr || header.downcase\n end",
"def attr\n @attr || header.downcase\n end",
"def ordering_id\n \"#{feature.ordering_id}:#{lines.first}\"\n end",
"def add_order_by_for_association_limiting!(sql, options)\n return sql if options[:order].blank?\n\n order = options[:order].split(',').collect { |s| s.strip }.reject(&:blank?)\n order.map! {|s| $1 if s =~ / (.*)/}\n order = order.zip((0...order.size).to_a).map { |s,i| \"alias_#{i}__ #{s}\" }.join(', ')\n\n sql << \" ORDER BY #{order}\"\n end",
"def mangopay_order_tag\n \" - Order: #{id} - User: #{user.id}, #{user.first_name.first}.#{user.last_name} -Slot: #{slot.id} du #{slot.date.strftime('%d/%m/%y')} - Course: #{slot.course.id}, #{slot.course.name} - Coach: #{slot.course.coach_id}/User_id: #{slot.course.coach.user.id}, #{slot.course.coach.user.first_name.first}.#{slot.course.coach.user.last_name} \"\n end",
"def idx_group_attrs(table, orderings, grouping)\n if orderings.empty? or orderings.any? {|o| o.relation != table} or orderings.map {|o| o.class}.uniq.length != 1\n [grouping]\n else\n order_class = orderings.first.class\n orderings = orderings.map {|o| o.attribute}\n idx = indexes_for_table(table).select {|atts| atts[0...orderings.length] == orderings}\n ((idx.min {|a, b| a.length <=> b.length} || []) + [grouping]).map {|a| order_class.new(a)}\n end\n end",
"def columns_for_distinct(columns, orders) #:nodoc:\n order_columns = orders.reject(&:blank?).map{ |s|\n # Convert Arel node to string\n s = s.to_sql unless s.is_a?(String)\n # Remove any ASC/DESC modifiers\n s.gsub(/\\s+(?:ASC|DESC)\\b/i, '')\n .gsub(/\\s+NULLS\\s+(?:FIRST|LAST)\\b/i, '')\n }.reject(&:blank?).map.with_index { |column, i| \"#{column} AS alias_#{i}\" }\n\n (order_columns << super).join(', ')\n end",
"def method_missing( sym, *args )\n\t\tplainsym = sym.to_s.sub( /[=\\?]$/, '' ).to_sym\n\t\treturn super unless self.valid_attribute_oids.include?( plainsym )\n\n\t\tif sym.to_s[ -1 ] == ?=\n\t\t\treturn self[ plainsym ] = args\n\t\telsif sym.to_s[ -1 ] == ??\n\t\t\tif self.directory.schema.attribute_types[ plainsym ].single?\n\t\t\t\treturn self[ plainsym ] ? true : false\n\t\t\telse\n\t\t\t\treturn self[ plainsym ].first ? true : false\n\t\t\tend\n\t\telse\n\t\t\treturn self[ plainsym ]\n\t\tend\n\tend",
"def order_type\n 'Dealer DropShip'\n end",
"def related_flex_attr(attr)\n name_field = flex_options[:name_field]\n if flex_options[:versioned]\n related_attrs.to_a.find {|r| r.send(name_field) == attr && r.send(flex_options[:version_column]) == self.send(flex_options[:version_column])}\n else\n related_attrs.to_a.find {|r| r.send(name_field) == attr}\n end\n end",
"def attribute(name, options={:strip => true, :null_if_blank => true})\n\t\t\treturn @attributes[name.to_sym] if @attributes && @attributes[name.to_sym]\n\t\t\treturn nil unless @node.attribute(name)\n\t\t\t@attributes = {} unless @attributes\n\t\t\t@attributes[name] = @node.attribute(name).evaluate(@node, :attrs => true).to_s\n\t\t\t@attributes[name].strip! if options[:strip]\n\t\t\t@attributes[name] = nil if @attributes[name].blank? && options[:null_if_blank]\n\t\t\t@attributes[name]\n\t\tend"
] |
[
"0.6177322",
"0.58498573",
"0.5814641",
"0.58099926",
"0.5791551",
"0.57220495",
"0.56635547",
"0.560482",
"0.5595079",
"0.55911016",
"0.5572567",
"0.5490295",
"0.5467577",
"0.5404054",
"0.537944",
"0.5378396",
"0.53201354",
"0.5293043",
"0.52819616",
"0.5271521",
"0.5266979",
"0.5262931",
"0.52516276",
"0.5222619",
"0.5211304",
"0.52073675",
"0.5177778",
"0.51694405",
"0.5161036",
"0.5143741",
"0.5138023",
"0.51335204",
"0.5132451",
"0.5124003",
"0.51226884",
"0.51042926",
"0.51007086",
"0.50967395",
"0.50967395",
"0.50967395",
"0.50967395",
"0.50967395",
"0.50967395",
"0.50967395",
"0.50947917",
"0.50932527",
"0.5092159",
"0.50916",
"0.50900847",
"0.5088767",
"0.50816745",
"0.5081426",
"0.5077413",
"0.50658554",
"0.50556755",
"0.5032736",
"0.5023289",
"0.501588",
"0.501588",
"0.50153023",
"0.5013372",
"0.5006211",
"0.50016767",
"0.5000008",
"0.49976647",
"0.4993091",
"0.49818012",
"0.49719548",
"0.49712113",
"0.49585018",
"0.4953048",
"0.49459416",
"0.4943875",
"0.4941857",
"0.49392834",
"0.49391624",
"0.493694",
"0.493694",
"0.4933602",
"0.49324712",
"0.49182254",
"0.49118182",
"0.49096498",
"0.49062338",
"0.4902282",
"0.4900331",
"0.4898454",
"0.48974943",
"0.4892011",
"0.48847282",
"0.48847282",
"0.48806605",
"0.48781687",
"0.48741272",
"0.48732156",
"0.48697385",
"0.48598462",
"0.4855193",
"0.48507953",
"0.4849766"
] |
0.5463952
|
13
|
method should return new scope based on base_scope
|
def get_conditions_for(base_scope, query)
unless query.blank?
base_scope = base_scope.like_any([:name, :description], query.split)
end
base_scope
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def inherit_scope(other)\n @scope = other.scope\n end",
"def scope\n @scope.dup\n end",
"def scope( new_scope=nil )\n\t\tif new_scope\n\t\t\tself.log.debug \"cloning %p with new scope: %p\" % [ self, new_scope ]\n\t\t\treturn self.clone( :scope => new_scope.to_sym )\n\t\telse\n\t\t\treturn @options[:scope]\n\t\tend\n\tend",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = AssemblyComponent.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def apply_scopes(*)\n relation = super\n relation = relation.accessible_by(current_ability) if scope_accessible?\n relation\n end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def scope; end",
"def get_scope(cur_scope = nil)\n # base default scope is set up here so that deactivated module can update this\n cur_scope = StateComponentTypeTax.scoped if (cur_scope.nil?)\n return (defined?(super)) ? super(cur_scope) : cur_scope\n end",
"def apply_to_scope(scope)\n scope\n end",
"def subscope\n self.clone\n end",
"def scope\n finder_or_run(:scope)\n end",
"def scope\n @scope ||= {}\n end",
"def scope\n @scope ||= {}\n end",
"def merge(new_scopes); end",
"def scope\n @scope ||= Scope.new(parent)\n end",
"def scope() binding end",
"def carry_scope(acts=nil,scope=nil)\n scope||= get_scope\n return if scope.nil?\n acts.each_with_index do |act,index|\n if act.start_with?('new')\n acts[index]=\"#{act}?scope=#{scope}\"\n end\n end \n end",
"def base_scope\n ApplicationRecord.none\n end",
"def create_with_scope(name); end",
"def add_scopes(params, base = self)\n # scopes are stored as strings but we want to allow\n params = params.with_indifferent_access\n base = self.add_static_scopes(params, base)\n return self.add_dynamic_scopes(params, base)\n end",
"def scopes; end",
"def default_scope; end",
"def newscope(parent, options = {})\n raise _('having multiple named scopes is not supported when scripting')\n end",
"def current_scope\n @scope\n end",
"def add_dynamic_scopes(params, base)\n self.dynamic_scopes.each_pair do |name, args|\n # make sure we have all required arguments\n next unless self.check_required_scope_args(args, params[name])\n\n # the args we will apply\n caller_args = []\n\n # iterate through our args and add them to an array to send to our\n # scope\n args.keys.each do |subkey|\n # we only apply things that are present or explicitly false\n if val = self.get_scope_arg_value(subkey, params[name][subkey])\n caller_args << val\n end\n end\n # call our scope with the supplied args\n base = base.send(name, *caller_args)\n end\n return base\n end",
"def scopes\n read_inheritable_attribute(:scopes) || write_inheritable_attribute(:scopes, {})\n end",
"def scope\n @scope\n end",
"def scope\n @scope\n end",
"def build_scope_from_columns\n self.scope\n end",
"def scope=(_); end",
"def scope_level; end",
"def define_scope_method(name)\n singleton_class.class_eval do\n ruby2_keywords(\n define_method(name) do |*args|\n scoping = _declared_scopes[name]\n scope = instance_exec(*args, &scoping[:scope])\n extension = scoping[:extension]\n to_merge = scope || queryable\n criteria = to_merge.empty_and_chainable? ? to_merge : with_default_scope.merge(to_merge)\n criteria.extend(extension)\n criteria\n end\n )\n end\n end",
"def scope() yield end",
"def all\n if current_scope\n current_scope.clone\n else\n default_scoped\n end\n end",
"def apply_standard_scope\n each_sort do |attribute, direction|\n @scope = resource.adapter.order(@scope, attribute, direction)\n end\n @scope\n end",
"def build_collection_scope_base(some_instance)\n some_instance.send(@collection_name).scoped\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n return @scope\n end",
"def scope\n @scope ||= Array(@root_scope) + [Inflector.underscore(name)]\n end",
"def current_base\n current = @@policies\n @@scopes.each do |scope|\n next unless scope\n current[scope] = {} unless current[scope]\n current = current[scope]\n end\n current\n end",
"def current_scope\n params[:scope].try(:to_sym) || railgun_resource.default_scope.try(:key)\n end",
"def update_scope\n @scope = params[:scope] || params[:q] || {}\n end",
"def inherited(subclass)\n super\n subclass.scopes = scopes.dup\n end",
"def valid_scope(valid_scopes, scope)\n\t\tend",
"def find_scope!(obj); end",
"def chain(new_scope = {})\n new_scope = {} if new_scope.nil?\n\n self.class.new(collection_path, collection_name, client).tap do |new_request|\n new_request.scope.merge!(scope)\n new_request.scope.merge!(new_scope)\n end\n end",
"def scope_chain\n scope ? [[scope]] : [[]]\n end",
"def scope_name; end",
"def try_to_set_scope\n #this is a commodity method\n if self.featurable.is_a?(Account)\n self.scope = \"AccountPlan\"\n end\n end",
"def dynamic_scopes\n self.scope_definition.select { |_k, v| v.present? }\n end",
"def get_closest_containing_scope\n self\n end",
"def dynamic_scopes\n self.scopes.select { |name, args| args.present? }\n end",
"def subscope(namespace)\n namespace = unique_name(namespace)\n namespace = self.namespace + '/' + namespace if self.namespace != ''\n sub_scope = Tensorflow::Scope.new\n sub_scope.graph = graph.clone\n sub_scope.namemap = namemap.clone\n sub_scope.namespace = namespace.clone\n sub_scope\n end",
"def scope(*args); end",
"def apply_custom_scope\n each_sort do |attribute, direction|\n @scope = custom_scope\n .call(@scope, attribute, direction, resource.context)\n end\n @scope\n end",
"def scope_options; end",
"def scope_options; end",
"def scope\n parameter[:scope]\n end",
"def scope= new_scope\n case new_scope\n when Array\n new_scope.each do |scope|\n if scope.include? \" \"\n raise ArgumentError,\n \"Individual scopes cannot contain the space character.\"\n end\n end\n @scope = new_scope\n when String\n @scope = new_scope.split \" \"\n when nil\n @scope = nil\n else\n raise TypeError, \"Expected Array or String, got #{new_scope.class}\"\n end\n end",
"def scopes\n @@scopes ||= {}\n end",
"def custom_scope_get scope_name\n\t\t\tThread.current[SESSION].custom_scope_get scope_name\n\t\tend",
"def scope\n read_attr :scope, :to_sym\n end",
"def new_scope(names)\n values = names.map { |n| self[n] }\n self.class.new(names, values + extras, self)\n end",
"def newscope(parent, options = {})\n parent ||= topscope\n scope = Puppet::Parser::Scope.new(self, **options)\n scope.parent = parent\n scope\n end",
"def search_scope\n super\n end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope=(_arg0); end",
"def scope(scope_name)\n Scope.new(@backend, @name, scope_name)\n end",
"def scopes\n @scopes ||= {}\n end",
"def as(scope); end",
"def scopes\n scope ? [scope] : []\n end",
"def scope\n scope!(operator) if @scopes.empty?\n scope!(\"AND\") if @scopes.last.is_a?(NestedScope)\n @scopes.last\n end",
"def scope\n if tree.columns.scope?\n tree.base_class.where Hash[tree.columns.scope.map { |column| [column, record[column]] }]\n else\n tree.base_class.where(nil)\n end\n end",
"def extra_scopes()\n @scopes_added_by_common_scopes\n end",
"def scope=(v); end",
"def scope=(v); end",
"def policy_scope(scope, policy_scope_class: nil)\n api_scope = self.class.inherited_pundit_api_scope || []\n\n super(api_scope + [scope], policy_scope_class: policy_scope_class)\n end",
"def target_scope\n AssociationRelation.create(klass, self).merge!(klass.scope_for_association)\n end",
"def base_scope\n Transaction.where(cents: mint.cents, type: imported_type)\n .where(\"date between ? and ?\", mint.date - 1.day, mint.date + 1.day)\n end",
"def scope\n klass\n end",
"def scope\n\t\treturn @scopes.last\n\tend",
"def dampen_scope(scope)\n define_method(:dampening_scope) do\n scope\n end\n end",
"def it_scope\n @it_scope ||= Example::Scope.new(self)\n end",
"def with_scope(scope)\n (@@scopes ||= []) << scope\n yield ensure @@scopes.pop\n end",
"def with_scope(scope)\n (@@scopes ||= []) << scope\n yield ensure @@scopes.pop\n end",
"def scope_by(&block)\n raise 'Cannot define scope after scope has been called.' if @scope\n\n @scope_block = block\n end",
"def local_scope; @scope = :local end",
"def scope\n if @scope.kind_of? String\n @scope = @scope.split \",\"\n else\n @scope || []\n end\n end"
] |
[
"0.7404326",
"0.7391623",
"0.71096414",
"0.69901305",
"0.6923455",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.6903669",
"0.69012696",
"0.68939453",
"0.68583786",
"0.68343097",
"0.6826762",
"0.6826762",
"0.6822231",
"0.6802909",
"0.67642325",
"0.6704829",
"0.6684537",
"0.6650138",
"0.6648013",
"0.66178507",
"0.6606998",
"0.65804315",
"0.6528757",
"0.6511904",
"0.65095055",
"0.6506106",
"0.6506106",
"0.64846015",
"0.64786655",
"0.64405",
"0.6398005",
"0.63962054",
"0.6384163",
"0.6375717",
"0.63520426",
"0.6337412",
"0.6337412",
"0.6337412",
"0.6337412",
"0.6337412",
"0.6337412",
"0.63192457",
"0.6317242",
"0.631029",
"0.62842506",
"0.62805593",
"0.6272204",
"0.6267376",
"0.6240967",
"0.6238463",
"0.62056684",
"0.615297",
"0.6149309",
"0.6141772",
"0.61400276",
"0.61300135",
"0.61179113",
"0.6102867",
"0.60872257",
"0.60872257",
"0.60816926",
"0.6078142",
"0.6064491",
"0.60491604",
"0.6047653",
"0.604481",
"0.60412675",
"0.60367256",
"0.60366875",
"0.60366875",
"0.60366875",
"0.60303766",
"0.60148925",
"0.6006847",
"0.59912056",
"0.59875506",
"0.59874225",
"0.5975658",
"0.59638464",
"0.59638464",
"0.5963116",
"0.595828",
"0.59466183",
"0.59433436",
"0.593815",
"0.5932208",
"0.5928635",
"0.5925275",
"0.5925275",
"0.5912215",
"0.58991975",
"0.58866054"
] |
0.0
|
-1
|
Add or change an asset id in the asset id cache. This can be used for SASS on Heroku. :api: public
|
def add_to_asset_ids_cache(source, asset_id)
self.asset_ids_cache_guard.synchronize do
self.asset_ids_cache[source] = asset_id
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rails_asset_id(source)\n if asset_id = ENV[\"RAILS_ASSET_ID\"]\n asset_id\n else\n if self.cache_asset_ids && (asset_id = self.asset_ids_cache[source])\n asset_id\n else\n path = File.join(config.assets_dir, source)\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if self.cache_asset_ids\n add_to_asset_ids_cache(source, asset_id)\n end\n\n asset_id\n end\n end\n end",
"def rails_asset_id(source)\n if asset_id = ENV[\"RAILS_ASSET_ID\"]\n asset_id\n else\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end\n end",
"def rails_asset_id_with_cloudfront(source)\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n rewrite_path = File.exist?(path) && !CloudfrontAssetHost.disable_cdn_for_source?(source) && CloudfrontAssetHost::Uploader.current_paths.include?(path)\n asset_id = if rewrite_path \n CloudfrontAssetHost.key_for_path(path) \n\n elsif File.exists?(path)\n (\"?\" + File.mtime(path).to_i.to_s)\n else\n ''\n end\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end",
"def rails_asset_id(source)\n asset_id = ENV[\"RAILS_ASSET_ID\"]\n return asset_id if asset_id\n return asset_id if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n\n path = Rails.root.join('public', source).to_s\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def id_for_assets\n name\n end",
"def set_asset_tag\n @asset_tag = AssetTag.find(params[:id])\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def cache_key(id); end",
"def install_asset_id=(asset_id)\n asset = Asset.find_by_guid(asset_id)\n hist = AssetOnSegmentHistory.create()\n asset_on_segment_historys << hist\n hist.install(asset)\n asset.save\n AssetObserver.install(asset, hist)\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def rewrite_asset_path(source)\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end",
"def randomize_id\n begin\n self.id = SecureRandom.hex 5\n end while ItAsset.where(id: self.id).exists?\n end",
"def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end",
"def process_replace_asset_id(data)\n\t\tdata.each do |item|\n\t\t\tid = @user.assets_id_by_name(item[:name])\n\t\t\tif id\n\t\t\t\titem[:rplcstr] = id[:asset]\n\t\t\t\tputs item\n\t\t\t\tresponse = @user.process_find_and_replace(item)\n\t\t\t\t@user.lastfindreplace\n\t\t\t\tsleep 5\n\t\t\telse\n\t\t\t\tputs \"asset name #{item[:name]} does not exist\"\n\t\t\tend\n\t\tend\n\tend",
"def build_asset(path, pathname, options)\n # Memory cache\n key = cache_key_for(pathname, options)\n if @assets.key?(key)\n @assets[key]\n else\n @assets[key] = begin\n # Persisted cache\n cache_asset(key) do\n super\n end\n end\n end\n end",
"def set_asset_file\n @asset_file = AssetFile.find(params[:id])\n end",
"def set_asset_file\n @asset_file = AssetFile.find(params[:id])\n end",
"def set_id_to_cache_key_map\n @ids.each do |id|\n @id_to_cache_key_map[id] = {\n kit: get_kit_cache_key(id),\n saas: get_saas_cache_key(id)\n }\n end\n end",
"def compile_asset_from_cache(asset_path, &block)\n # TODO(philc): We should not check the file's md5 more than once when we're running in production mode.\n contents = File.read(asset_path)\n md5 = Digest::MD5.hexdigest(contents)\n cached_asset = $compiled_cache[asset_path]\n if md5 != cached_asset[:md5]\n cached_asset[:contents] = block_given? ? block.yield(asset_path) : File.read(contents)\n cached_asset[:md5] = md5\n end\n cached_asset[:contents]\n end",
"def cache_for(bundle_path, variant)\n key = [\"#{bundle_path}.scss\", variant].join(CONFIG['manifest_key_seperator'])\n fingerprint = combined_checksums[key]\n raise \"Fingerprint not found. #{bundle_path} #{variant}\" unless fingerprint\n fingerprint\n end",
"def set_asset\n @asset = @org.assets.find(params[:id])\n end",
"def cache_impression\n impressionable.impressioners_ids.add(user_id)\n end",
"def asset_key\n \"asset-uri:#{compressed_path}\"\n end",
"def staging_cache_key\n \"#{url_path.gsub(/[^[:alnum:]]/, \"_\")}_#{slug}\"\n end",
"def delete_asset_id=(asset_id)\n if asset = installed_assets.detect {|asset| asset.g_u_i_d == asset_id }\n hist = asset.asset_on_segment_history\n hist.uninstall(asset)\n AssetObserver.remove(asset, hist)\n asset.asset_on_segment_history_id = nil\n assets_to_save << asset \n end\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def store_path_assets(path, assets)\n return if assets.empty?\n redis.sadd path_assets_key(path), assets\n end",
"def asset(asset_id)\n get \"/video/v1/assets/##{asset_id}\"\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end",
"def cache_id\n index + 1\n end",
"def set_asset\n @asset = Asset.find(params[:id])\n end",
"def set_asset_scrapping_entry\n @asset_scrapping_entry = AssetScrappingEntry.find(params[:id])\n end",
"def cache_id\n \"#{self.class.name.underscore}:#{self.id}\"\n end",
"def image_asset_id\n item_code_name_cd&.delete('IMG_').to_i\n end",
"def set_ds_asset_tag\n @ds_asset_tag = DsAssetTag.find(params[:id])\n end",
"def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end",
"def set_asset\n @asset = current_user.assets.find_by(id: params[:id])\n \n # If the file the user is looking for isn't owned by them, but is shared to them, the subsequent \n # code finds it. \n if(@asset == nil)\n @assets = list_shared_assets\n \n 0.upto(@assets.length-1) do |x|\n if(params[:id].to_i == @assets[x].id.to_i)\n @asset = @assets[x]\n end\n end\n end\n \n # If the requested file was neither owned by the user nor shared to them, this code executes.\n if(@asset == nil)\n flash[:danger] = \"File does not exist!\"\n redirect_to assets_path\n end\n end",
"def rewrite_asset_path(source, path = nil)\n if path && path.respond_to?(:call)\n return path.call(source)\n elsif path && path.is_a?(String)\n return format(path, source)\n end\n\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def set_slug_cache\n if new_cache_needed?\n send \"#{friendly_id_config.cache_column}=\", slug.to_friendly_id\n send :update_without_callbacks\n end\n end",
"def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 2 en la segunda posicion denota que es una ANP\n # Y despues se ajusta a 8 digitos, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"22#{region_id.to_s.rjust(8,'0')}\".to_i\n end",
"def cache_key\n \"#{self.class.cache_key_base}/#{self.id}\"\n end",
"def update\n @asset = OtherAsset.find(params[:id])\n asset_update(params[:asset], others_url)\n end",
"def update_asset_settings!\n AssetSettings[:development].files[@file_id] = @sfiles.map(&:local_url)\n return unless AssetMapper.compile?\n\n AssetSettings[:production].files[@file_id] = @cloud_files.map(&:production_url)\n AssetSettings[:production].files[@file_id] << @tfile.production_url if @tfile.production_url\n\n AssetSettings[:local_assets].files[@file_id] = @cloud_files.map(&:local_url)\n AssetSettings[:local_assets][@file_id] << @tfile.local_url if @tfile.local_url\n end",
"def populate_id\n @id = Digest::SHA256.hexdigest(@source_url).slice(0, ID_LENGTH)\n end",
"def set_asset_data\n @asset_data = AssetData.find(params[:id])\n end",
"def update!(**args)\n @asset = args[:asset] if args.key?(:asset)\n end",
"def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end",
"def cached_slug\n id.to_s\n end",
"def sass_cache_bust(file_name)\n require 'digest/md5'\n file_contents = Dir.glob(\"_sass/*\").map{|f| File.read(f) }.join\n file_name + '?' + Digest::MD5.hexdigest(file_contents)\n\n end",
"def set_asset\n @asset = @user.assets.find(params[:id])\n end",
"def recompile_assets!(compiler)\n compiler.reset!\n compiler.compile!\n compiler.assets.each do |a|\n path_and_name = a.path == '' ? a.name : \"#{a.path}/#{a.name}\"\n @@asset_hashes[path_and_name] = a.current_hash\n end\n end",
"def asset_path(url)\n \"/assets/cb#{settings.cachebust}/#{url}\"\n end",
"def asset(id, params = {})\n get \"assets/#{id}\", {query: params}\n end",
"def get_cache_key(id)\n # It uses shared cache key between company api and saas.\n memcache_key_object.key_template % @options.merge(id: id)\n end",
"def set_game_asset\n @game_asset = GameAsset.find(params[:id])\n end",
"def discover_asset(asset_id: nil)\n # TODO: ...\n end",
"def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 0 en la segunda posicion denota que es un estado\n # Y despues se ajusta a 8 digitos el numero de estado, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"20#{region_id.to_s.rjust(8,'0')}\".to_i\n end",
"def generate_photo_cache_key(photo_id:)\n \"flickr_photo/#{photo_id}\"\n end",
"def set_slug_cache\n if new_cache_needed?\n self.attribute_set(friendly_id_config.cache_column, slug.to_friendly_id)\n self.save_self(false) # save!\n end\n end",
"def set_cache_flag\n @cache_flag = CacheFlag.find(params[:id])\n end",
"def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def rewrite_asset_path(source, dir)\n source = \"/#{dir}/#{source}\" unless source[0] == ?/\n path = config.asset_path\n\n if path && path.respond_to?(:call)\n return path.call(source)\n elsif path && path.is_a?(String)\n return path % [source]\n end\n\n asset_id = rails_asset_id(source)\n if asset_id.empty?\n source\n else\n \"#{source}?#{asset_id}\"\n end\n end",
"def set_asset_allocate\n @asset_allocate = AssetAllocate.find(params[:id])\n end",
"def cache_key(id)\n \"_session_id:#{id}\"\n end",
"def set_asset\n @asset = current_user.assets.find(params[:id])\n end",
"def cache_key\n end",
"def manually_expire_asset(asset_name)\n asset = Rails.application.assets[asset_name]\n def asset.fresh?(env); false; end\nend",
"def update_cache(type, id, data)\n end",
"def cache_key; @cache.to_sym; end",
"def set_slug_cache\n if new_cache_needed?\n begin\n send \"#{friendly_id_config.cache_column}=\", slug.to_friendly_id\n update_without_callbacks\n rescue ActiveRecord::StaleObjectError\n reload\n retry\n end\n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def set_data_asset\n @data_asset = DataAsset.find(params[:id])\n end",
"def asigna_redis_id\n # El 2 inicial es para saber que es un region\n # El 1 en la segunda posicion denota que es un municipio\n # Y despues se ajusta a 8 digitos, para dar un total de 10 digitos\n self.redis = {} unless redis.present?\n self.redis[\"id\"] = \"21#{region_id.to_s.rjust(8,'0')}\".to_i\n end",
"def store_cache(key, name)\n checksum = Digest::MD5.hexdigest(key)\n node.default['data-bag-cache']['__checksums__'][checksum] = name\n end",
"def asset_path(site, post_id)\n\n # post_id\n\n new_id = post_id.gsub(\"jekyll/update/\", \"\")\n\n site + \"post-assets/\" + new_id.gsub(\"/\", \"-\")[1..-1]\n\n # jekyll/update/2014/02/15/nyt-4th-down-bot-goes-back-in-the-box\n # post_id.gsub(\"jekyll/update/\", \"\").gsub(\"/\", \"-\")[1..-1]\n end",
"def set_barcode_asset\n @barcode_asset = BarcodeAsset.find(params[:id])\n end",
"def asset_id(file)\n File.basename file, '.*'\n end",
"def cache_key\n name.to_s\n end",
"def add_asset_to_stage\n if !params[:asset_ids].nil?\n @stage = Stage.find(session[:stage_id])\n asset_set = Set.new\n params[:asset_ids].each do |asset_id|\n asset_set.add(Asset.find(asset_id.to_i))\n end\n asset_set.each do |new_asset|\n @stage.assets.each do |current_asset|\n if current_asset.id == new_asset.id\n asset_set.delete(new_asset)\n break\n end\n end\n end\n \n asset_set.each do |asset|\n @stage.assets << asset\n end\n \n if @stage.save\n redirect_to :back, :notice =>\"Successfully added to the stage.\"\n else\n redirect_to :back, :error => \"Assets were not added to the stage.\"\n end\n else\n redirect_to :back, :alert => \"No assets were selected\"\n end\n end",
"def css_id name\n attr \"##{name}\"\n end",
"def cache_key\n Digest::SHA1.hexdigest \"#{self.class.name}#{base_url}#{hashable_string_for(options)}\"\n end"
] |
[
"0.69767493",
"0.6781146",
"0.67287135",
"0.65945554",
"0.60452086",
"0.60452086",
"0.60452086",
"0.60452086",
"0.60452086",
"0.60452086",
"0.60452086",
"0.60411817",
"0.6000291",
"0.59650934",
"0.591125",
"0.5885534",
"0.58758545",
"0.5866846",
"0.5865538",
"0.57829213",
"0.5755654",
"0.5693489",
"0.567236",
"0.5665012",
"0.5665012",
"0.5658213",
"0.56249774",
"0.5624745",
"0.56132656",
"0.5608211",
"0.5603236",
"0.5590492",
"0.5568785",
"0.5559245",
"0.5559245",
"0.5559245",
"0.5559245",
"0.5559245",
"0.55583113",
"0.5554375",
"0.5538146",
"0.5518762",
"0.55155057",
"0.5506554",
"0.54886395",
"0.5481516",
"0.54553443",
"0.54544383",
"0.5451873",
"0.5447434",
"0.5442559",
"0.5420212",
"0.54147285",
"0.54120755",
"0.539398",
"0.53874755",
"0.5386275",
"0.5386095",
"0.5364067",
"0.53572726",
"0.53555405",
"0.53508246",
"0.53505653",
"0.5347337",
"0.53357875",
"0.53352183",
"0.53282386",
"0.5320454",
"0.5319072",
"0.5300691",
"0.529113",
"0.52897966",
"0.5261681",
"0.52600056",
"0.52576065",
"0.52575386",
"0.52575386",
"0.52483225",
"0.52363306",
"0.5227835",
"0.52268595",
"0.5226633",
"0.52094346",
"0.51995885",
"0.5197397",
"0.51872677",
"0.51832616",
"0.51832616",
"0.51832616",
"0.51832616",
"0.51805943",
"0.51760983",
"0.51754713",
"0.51613545",
"0.5138501",
"0.51306933",
"0.5123544",
"0.50989467",
"0.5096944",
"0.5087028"
] |
0.7340529
|
0
|
Break out the asset path rewrite in case plugins wish to put the asset id someplace other than the query string.
|
def rewrite_asset_path(source, dir)
source = "/#{dir}/#{source}" unless source[0] == ?/
path = config.asset_path
if path && path.respond_to?(:call)
return path.call(source)
elsif path && path.is_a?(String)
return path % [source]
end
asset_id = rails_asset_id(source)
if asset_id.empty?
source
else
"#{source}?#{asset_id}"
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rewrite_asset_path(source)\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def rewrite_asset_path(source, path = nil)\n if path && path.respond_to?(:call)\n return path.call(source)\n elsif path && path.is_a?(String)\n return format(path, source)\n end\n\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def rewrite_asset_path(source, dir, options = {})\n logger.debug \"rewriting asset path for #{source}\"\n #if source[0] == ?/\n # logger.debug 'bah!'\n # source\n #else\n source = digest_for(source.to_s)\n source = Pathname.new(\"/\").join(dir, source).to_s\n source\n #end\n end",
"def asset_path(site, post_id)\n\n # post_id\n\n new_id = post_id.gsub(\"jekyll/update/\", \"\")\n\n site + \"post-assets/\" + new_id.gsub(\"/\", \"-\")[1..-1]\n\n # jekyll/update/2014/02/15/nyt-4th-down-bot-goes-back-in-the-box\n # post_id.gsub(\"jekyll/update/\", \"\").gsub(\"/\", \"-\")[1..-1]\n end",
"def site_asset_path(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets}/\"))\n end",
"def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end",
"def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end",
"def rewrite_asset_path_with_cloudfront(source, path=nil)\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n elsif asset_id.starts_with?('?')\n source + asset_id\n else\n \"/#{asset_id}#{source}\"\n end\n end",
"def asset_path(*args)\n path = args.join('/')\n page = sitemap[path]\n if production?\n raise \"Missing asset #{path}\" if page.blank?\n if page[:digest] == true\n raise \"Missing digest for #{path}\" if page[:digest_path].blank?\n path = page[:digest_path]\n end\n end\n asset_http_prefix + path\n end",
"def site_asset_url(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets_url}/\"))\n end",
"def add_asset_path_helper(content)\n content.gsub /url\\((.*?)\\)/, 'url(<%= asset_path \"mediaelement_rails/\\1\" %>)'\n end",
"def replace_asset_urls(content)\n return if content.blank?\n content.force_encoding('utf-8').gsub!(/[(\"']([^)\"';]*)\\/sites\\/[0-9a-f]{24}\\/theme\\/(([^;.]+)\\/)*([a-zA-Z_\\-0-9]+\\.[a-z]{2,3})[)\"']/) do |path|\n \"#{path.first}/#{$2 + $4}#{path.last}\"\n end\n end",
"def bypass_by_path?(req)\n req.path =~ /^\\/assets/\n end",
"def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end",
"def generate_rewrite_path(path)\n path.gsub(current_localization.path, self.description.rewrite_route)\n end",
"def prepare_asset(assets, asset, name, subname = nil)\n return if asset.start_with?(asset_root)\n\n if subname.nil?\n assets[name] = \"#{asset_root}/#{asset}\"\n else\n assets[name][subname] = \"#{asset_root}/#{asset}\"\n end\n end",
"def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end",
"def rewrite_script_paths(body)\n body.gsub(%r%src=(\"|')/?javascripts/(.*)(\"|')%) { %|src=#{$1}%s#{$1}\"| % Rails.root.join(\"public/javascripts/#{$2}\") }\n end",
"def rewrite_script_paths(body)\n body.gsub(%r%src=(\"|')/?javascripts/(.*)(\"|')%) { %|src=#{$1}%s#{$1}\"| % Rails.root.join(\"public/javascripts/#{$2}\") }\n end",
"def normalized_asset_path(path)\n path.sub(/^\\/assets\\//, \"\")\n end",
"def site_asset_media_path(src)\n rewrite_asset_path(DmCms::MediaUrlService.call(src))\n end",
"def replace_content_asset_urls(content)\n return if content.blank?\n content.force_encoding('utf-8').gsub!(/[(\"']\\/sites\\/[0-9a-f]{24}\\/assets\\/(([^;.]+)\\/)*([a-zA-Z_\\-0-9]+)\\.[a-z]{2,3}[)\"']/) do |path|\n \"/#{$3}\"\n end\n end",
"def short_path\n self.path =~ /^(javascripts|stylesheets|fonts)\\/(.*)$/\n $2\n end",
"def replace_asset_url(rule, type)\n replace_all rule, /url\\((.*?)\\)/, \"url(if($flat-ui-sass-asset-helper, flat-ui-#{type}-path(\\\\1), \\\\1))\"\n end",
"def asset_resolver_strategies; end",
"def asset_resolver_strategies; end",
"def fix_path(path)\n path_segments = path.split(\"/\")\n \"/\" + path_segments[1] + \"/act_\" + path_segments[2]\n end",
"def static_asset_path\n return '' unless static_asset?\n\n @path[1..-1]\n end",
"def asset_path(source, options = {})\n return source if source =~ URI_MATCH\n \n # Extract the path, so we can add any query string items back on.\n uri = URI.parse(source)\n source = uri.path\n \n # Append extension if necessary\n if options[:ext] && File.extname(source).empty?\n source << \".#{options[:ext]}\"\n end\n \n source = materialize_path(source, options)\n \n # Return the reconstructed URI\n source << \"?#{uri.query}\" if uri.query\n source << \"##{uri.fragment}\" if uri.fragment\n source\n end",
"def resolve_asset; end",
"def resolve_asset; end",
"def process_path(env, request)\n path = request.path_info\n locale = Integral.frontend_locales.find { |locale| path.starts_with?(\"/#{locale}/\") || path == \"/#{locale}\" } || Integral.frontend_locales.first if Integral.multilingual_frontend?\n\n page_id = page_identifier(path)\n if page_id\n rewrite_path(env, request, localized_path(\"/pages/#{page_id}\", locale))\n else\n if category_id = category_identifier(path, locale)\n rewrite_path(env, request, localized_path(\"/#{Integral.blog_namespace}/categories/#{category_id}\", locale))\n end\n end\n rescue StandardError => e\n handle_rewrite_error(e)\n end",
"def rewrite_path # :nodoc:\n if uri.path[0] != ?/\n prepend_path File.join('/', options[:dir].to_s)\n end\n end",
"def modify_uri\n uri = @request.uri\n @conf.aliases.each do |a|\n if uri.include? a\n uri = uri.sub(a, @conf.alias_path(a))\n end\n end\n if uri != @request.uri\n return uri\n end\n @conf.script_aliases.each do |a|\n if uri.include? a\n uri = uri.sub(a, @conf.script_alias_path(a))\n end\n end\n uri\n end",
"def assets_path path = nil\n @assets_path = root + normalize_path(path).freeze if path\n @assets_path ||= '' << root << 'public/'.freeze\n end",
"def prefix_vite_asset(path)\n File.join(\"/#{ config.public_output_dir }\", path)\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def get_path\n \"system/mailskinassets/mailskinassets/000/#{id}/original/\"\n end",
"def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore",
"def asset_path(url)\n \"/assets/cb#{settings.cachebust}/#{url}\"\n end",
"def generate_path_slug\n slug = \"/#{archive.slug}/\"\n slug += sluggerize(study.ddi_id)\n end",
"def compute_asset_path(path, options = T.unsafe(nil)); end",
"def compute_asset_path(path, options = T.unsafe(nil)); end",
"def asset_paths\n paths = @parts.values.map(&:asset_path)\n paths << File.dirname(script) if script\n paths << File.dirname(stylesheet) if stylesheet\n paths.compact.uniq\n end",
"def assets_path path, strict=true\n path_under \"assets\", path, strict\n end",
"def reassemble\n tmps = params[:path].join(\"/\")\n started, qs = false, String.new\n params.each_key do |k|\n if k != \"controller\" && k != \"action\" && k != \"path\"\n started ? qs << \"&#{k}=#{params[k]}\" : qs << \"?#{k}=#{params[k]}\"\n started = true\n end\n end\n tmps << CGI::escape(qs)\n logger.info \"REASSEMBLED URL [#{tmps}]\"\n return tmps\n end",
"def call env\n dir = File.join @public_dir, env['PATH_INFO']\n rewrite = env['PATH_INFO'] \n @order.reverse.each do |index|\n full_index = File.join dir, index\n new_path = File.join env['PATH_INFO'], index\n rewrite = new_path if File.exist? full_index\n end if File.directory? dir\n env['PATH_INFO'] = rewrite\n @app.call env\n end",
"def asset_path(source, extension = nil)\n return source if is_uri?(source)\n source = source.to_s\n source = rewrite_extension(source, extension)\n source = rewrite_asset(source)\n source = rewrite_asset_path(source)\n source = rewrite_asset_host(source)\n source\n end",
"def path\n if auditable_type.include? 'Asset'\n \"inventory_path(:id => '#{auditable.object_key}')\"\n else\n \"#{auditable_type.underscore}_path(:id => '#{auditable.object_key}')\"\n end\n\tend",
"def site_image_path(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets}/images/\"))\n end",
"def compute_asset_path(source, options = T.unsafe(nil)); end",
"def filtered_path; end",
"def asset_paths\n @asset_paths ||= [prefix] \n end",
"def asset_http_prefix\n prefix = config[:asset_http_prefix] || http_prefix\n prefix += '/' unless prefix =~ %r{/$}\n prefix\n end",
"def route_assets?\n request.path_info.match %r{^/assets/}\n end",
"def fix_asset_references\n asset_converter = Hash.new\n \n Dir.chdir(@docs_dir)\n file_list = Dir.glob(\"**/*.*\").reject {|fn| File.directory?(fn) }\n \n # generate the converter list\n file_list.each do |f|\n case File.extname(f)\n when \".js\"\n when \".css\"\n asset_converter[File.basename(f)] = f\n end\n end\n \n file_list.each do |f|\n absoluteFilePath = File.join(@plugin_directory, @docs_dir, f)\n \n if File.extname(f) == \".html\"\n doc = Nokogiri::HTML(File.open(absoluteFilePath))\n \n # remove javascript if desired\n if @strip_javascript\n doc.xpath(\"//script\").remove\n \n # when scraping this method wont be called\n # set to false for when we are not scraping so generate_structure can strip JS if needed\n @strip_javascript = false\n end\n \n # relink css\n doc.xpath(\"//link\").each do |link|\n originalLinkPath = File.basename(link[\"href\"])\n \n next if File.extname(originalLinkPath) != \".css\"\n next if not asset_converter.has_key? File.basename(originalLinkPath)\n \n # convert the link paths\n link[\"href\"] = (\"../\" * (f.count \"/\")) + asset_converter[File.basename(link[\"href\"])]\n end\n \n # relink images\n \n # write the converted file\n File.open(absoluteFilePath, \"w\") { |file| file.puts doc }\n end\n end\n end",
"def asset_path(source, options = {})\n unless options[:debug]\n check_errors_for(source, options)\n end\n super(source, options)\n end",
"def path_for_asset(asset)\n \"#{assets_path}/#{asset}\"\n end",
"def public_compute_asset_path(source, options = T.unsafe(nil)); end",
"def lookup_debug_asset(path, options = T.unsafe(nil)); end",
"def lookup_debug_asset(path, options = T.unsafe(nil)); end",
"def rewrite_inline_code(code)\n # chance_files refer, usually, to sprites.\n code.gsub!(/chance_file\\([\"'](.*?)['\"]\\)/) {|match|\n path = entry[:resource_name] + \"-\" + $1\n \"static_url('#{path}')\"\n }\n\n code.gsub!(/external_file\\([\"'](.*?)['\"]\\)/) {|match|\n \"static_url('#{$1}')\"\n }\n\n # look for sc_require, require or sc_resource. wrap in comment\n code.gsub!(/((sc_require|require|sc_resource)\\(\\s*['\"].*[\"']\\s*\\)\\s*\\;)/, '/* \\1 */')\n replace_static_url(code)\n code\n end",
"def assets_path path = nil\n @assets_path = (root + path.to_s).freeze if path\n @assets_path ||= (root + 'public/').freeze\n end",
"def site_asset_media_url(src)\n rewrite_asset_path(DmCms::MediaUrlService.call(src))\n end",
"def _assets path, domain = '/'\n\t\t\"#{domain}_assets/#{path}\"\n\tend",
"def replace_static_url(line)\n line.gsub!(sc_static_match) do | rsrc |\n entry_name = $2\n entry_name = \"#{$2}:index.html\" if $1 == 'sc_target'\n\n static_entry = entry.manifest.find_entry($2)\n\n if !static_entry\n SC.logger.warn \"#{$2} was not found. Line: #{rsrc}\"\n url = ''\n elsif $1 == 'sc_target'\n url = static_entry[:friendly_url] || static_entry.cacheable_url\n else\n url = static_entry.cacheable_url\n end\n\n static_url(url)\n end\n end",
"def asset_url(asset_name)\n \"#{@server.base_uri}?sabreAction=asset&assetName=#{URI.escape(asset_name)}\"\n end",
"def assets_path\n @assets_path ||= 'assets'\n end",
"def normalize_path(api_path, resource_id)\n return api_path unless resource_id\n\n format(api_path, resource_id: resource_id)\n end",
"def asset_path\n \"user/#{self.user_id}/assets/\"\n end",
"def original_asset_url(x)\n if x =~ ASSET\n # example: https://cdnb3.artstation.com/p/assets/images/images/003/716/071/large/aoi-ogata-hate-city.jpg?1476754974\n original_url = x.sub(%r!/(?:medium|small|large)/!, \"/original/\")\n\n if http_exists?(original_url, headers)\n return original_url\n end\n\n if x =~ /medium|small/\n large_url = x.sub(%r!/(?:medium|small)/!, \"/large/\")\n\n if http_exists?(large_url, headers)\n return large_url\n end\n end\n end\n\n return x\n end",
"def target_asset_path(asset)\n File.join('public', asset.folder, asset.filename)\n end",
"def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end",
"def assets\n \n if !params[:path].blank? or !params[:format].blank?\n if get_from_asset_folder\n return\n else\n render_404 and return\n end\n end\n end",
"def path_to(plugin_id); end",
"def output_path(asset_module, format)\n asset_module.cache_asset(format).absolute_path\n end",
"def account_protected_assets_base(leading_slash = true)\n leading_slash ? \"/#{PROTECTED_ASSET_TRIGGER}\" : PROTECTED_ASSET_TRIGGER\n end",
"def append_path(path)\n @app.sitemap.rebuild_resource_list!(:sprockets_paths)\n\n super\n end",
"def asset_url_for( filename )\n\n # get a host\n hostname = config.asset_host || root_url.gsub( /^\\//, '' )\n\n # blah\n suff = ( Rails.env.development? ? \"?#{Time.now.to_i}\" : '' )\n\n # return\n \"#{hostname}/#{Rails.application.config.assets[:url]}/#{versioned_filename_for( filename )}\".gsub( /(?<!:)\\/\\/+/, '/' ) + suff\n\n end",
"def path_mapped(script_name, *args)\n return cleanup_paths(\"/#{script_name}/#{@locations[:root]}\") if args.empty?\n a = replace_symbols(script_name, *args)\n cleanup_paths(\"/#{script_name}/#{@locations[:root]}/#{a.join('/')}\")\n end",
"def rewritePath(env)\n @@REWRITE.each do |key|\n env[key] = env[key].gsub(@path, '')\n end\n end",
"def asset_key\n \"asset-uri:#{compressed_path}\"\n end",
"def each_asset\n assets.each do |(path, destination)|\n path = path.to_s\n if destination == :root\n yield path, File.join(output_directory.to_s, File.basename(path))\n else\n yield path, File.join(output_directory.to_s, destination.to_str)\n end\n end\n end",
"def asset_url(path)\n path.sub!(%r[^(#{@mount_point})?/?], \"\")\n mounted_path = \"#{@mount_point}/#{path}\"\n\n # TODO: Change the real file behavior if I replace the use of Rack::File above\n return mounted_path if @watcher.find(path)\n\n return mounted_path unless @environment == \"production\"\n\n # Add on a checksum tag in production\n asset = find_asset(path)\n raise \"Error: no such asset available: #{path}\" unless asset\n mounted_path, dot, extension = mounted_path.rpartition(\".\")\n return mounted_path if dot.empty?\n \"#{mounted_path}-#{asset.checksum}.#{extension}\"\n end",
"def process_replace_asset_id(data)\n\t\tdata.each do |item|\n\t\t\tid = @user.assets_id_by_name(item[:name])\n\t\t\tif id\n\t\t\t\titem[:rplcstr] = id[:asset]\n\t\t\t\tputs item\n\t\t\t\tresponse = @user.process_find_and_replace(item)\n\t\t\t\t@user.lastfindreplace\n\t\t\t\tsleep 5\n\t\t\telse\n\t\t\t\tputs \"asset name #{item[:name]} does not exist\"\n\t\t\tend\n\t\tend\n\tend",
"def asset_path name\n fdpath = @app.asset(name)\n\n if fdpath && fdpath.start_with?(@app.assets_dir)\n if fdpath.start_with?(@app.public_dir)\n fdpath[@app.public_dir.length..-1]\n else\n fdpath[@app.assets_dir.length..-1]\n end\n else\n path = File.join('', name)\n [path, *@app.asset_version(name)].compact.join(\"?\")\n end\n end",
"def fix_path(path)\n if path.count('?') > 1\n return path.gsub('?', '&').sub('&', '?')\n else\n return path\n end\n end",
"def defaulft_asset_path_for(asset_url, asset_prefix)\n File.join(theme_path_for('default'), asset_prefix, params[:asset])\n end",
"def compute_public_path_with_application_assets(source, dir, *args)\n if source.match(PrefixRe)\n s = source.sub(PrefixRe, \"#{dir}/\")\n d = ApplicationName\n else\n s = source\n d = dir\n end\n compute_public_path_without_application_assets(s, d, *args)\n end",
"def asset_path(kind, source)\n return source if source =~ /^http/\n asset_folder = case kind\n when :css then settings.css_dir\n when :js then settings.js_dir\n when :images then settings.images_dir\n else kind.to_s\n end\n source = source.to_s.gsub(/\\s/, '')\n ignore_extension = (kind == :images) # don't append extension\n source << \".#{kind}\" unless ignore_extension or source =~ /\\.#{kind}/\n result_path = source if source =~ %r{^/} # absolute path\n result_path ||= asset_url(source, asset_folder)\n timestamp = asset_timestamp(result_path)\n \"#{result_path}#{timestamp}\"\n end",
"def rebase(base_path)\n path = Pathname.new(filename).relative_path_from(Pathname.new(base_path)).to_s\n\n Juicer::Asset::Path.new(path,\n :base => base_path,\n :hosts => hosts,\n :document_root => document_root)\n end",
"def asset_path(asset_relative_path)\n \"#{ASSETS_BASE_PATH}/#{asset_relative_path}\"\n end",
"def asset_link_filter(asset_array)\n asset_array.select do |asset|\n asset.split(//).last != '/'\n end\n # TODO: also filter out .html endings\n end",
"def path_assets\n arr_classes = page_classes.split( ' ' )\n\n if arr_classes.length < 2\n\n arr_classes[ 0 ]\n\n else\n\n arr_section = arr_classes[ ( arr_classes.length - 1 ) ].split( '_' )\n asset_path = ''\n\n arr_section.each_with_index do |lista, i|\n if i == ( arr_section.length - 1 )\n asset_path = asset_path + lista\n else\n asset_path = asset_path + lista + '/'\n end\n end\n\n asset_path\n\n end\n end",
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def new_asset_path_with_session_information(asset_type)\n session_key = Rails.application.config.session_options[:key]\n if asset_type == \"picture\"\n alchemy.admin_pictures_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token, :format => :js)\n elsif asset_type == \"attachment\"\n alchemy.admin_attachments_path(session_key => cookies[session_key], request_forgery_protection_token => form_authenticity_token, :format => :js)\n end\n end",
"def replace_asset_urls(content)\n return '' if content.blank?\n\n _content = content.dup\n\n content.force_encoding('utf-8').scan(REGEX).map do |match|\n url, type, filename = match[0], match[2], match[5]\n folder = case type\n when 'assets', 'pages' then File.join('samples', \"_#{env}\", type)\n when 'theme' then $4\n when /\\Acontent_entry/ then File.join('samples', \"_#{env}\", 'content_entries')\n end\n\n Thread.new do\n if filepath = write_asset(url, File.join(path, 'public', folder, filename))\n [url, File.join('', folder, File.basename(filepath)).to_s]\n else\n [url, '']\n end\n end\n end.map(&:value).each do |(url, replacement)|\n _content.gsub!(url, replacement)\n end\n\n _content\n end",
"def normalize_path(path); end"
] |
[
"0.71739924",
"0.6779412",
"0.63515854",
"0.62743807",
"0.62141544",
"0.6133092",
"0.6133092",
"0.61316854",
"0.60997885",
"0.59017044",
"0.58894795",
"0.5798455",
"0.5776646",
"0.57129055",
"0.569508",
"0.568026",
"0.5677606",
"0.56591713",
"0.56591713",
"0.5656027",
"0.56430656",
"0.5566144",
"0.5512081",
"0.551191",
"0.55078995",
"0.55078995",
"0.55018985",
"0.5494979",
"0.54916173",
"0.54867595",
"0.54867595",
"0.54855025",
"0.54697675",
"0.5461839",
"0.5446511",
"0.54429114",
"0.5411078",
"0.5411078",
"0.54048336",
"0.5395107",
"0.5382839",
"0.53745705",
"0.53735006",
"0.53735006",
"0.53662527",
"0.5361068",
"0.536105",
"0.5339729",
"0.53331566",
"0.5324692",
"0.5321682",
"0.5315811",
"0.53047615",
"0.5286516",
"0.528552",
"0.5274227",
"0.52663785",
"0.52539283",
"0.52527094",
"0.5252165",
"0.5248981",
"0.5247744",
"0.52248806",
"0.5224217",
"0.5220721",
"0.5218773",
"0.5218526",
"0.52092695",
"0.52031386",
"0.519522",
"0.51713026",
"0.5171258",
"0.517105",
"0.51639515",
"0.51524913",
"0.51509947",
"0.5143815",
"0.5135539",
"0.5130074",
"0.51292485",
"0.5125935",
"0.51135886",
"0.51031876",
"0.5100636",
"0.50942755",
"0.509102",
"0.5082133",
"0.50739",
"0.5070077",
"0.5060902",
"0.5057321",
"0.50486517",
"0.50390923",
"0.5019125",
"0.50177443",
"0.50174177",
"0.50174177",
"0.5003535",
"0.50031376",
"0.50017756"
] |
0.6486046
|
2
|
Use the RAILS_ASSET_ID environment variable or the source's modification time as its cachebusting asset id.
|
def rails_asset_id(source)
if asset_id = ENV["RAILS_ASSET_ID"]
asset_id
else
if self.cache_asset_ids && (asset_id = self.asset_ids_cache[source])
asset_id
else
path = File.join(config.assets_dir, source)
asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''
if self.cache_asset_ids
add_to_asset_ids_cache(source, asset_id)
end
asset_id
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rails_asset_id(source)\n if asset_id = ENV[\"RAILS_ASSET_ID\"]\n asset_id\n else\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end\n end",
"def rails_asset_id(source)\n asset_id = ENV[\"RAILS_ASSET_ID\"]\n return asset_id if asset_id\n return asset_id if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n\n path = Rails.root.join('public', source).to_s\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end",
"def rails_asset_id_with_cloudfront(source)\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n rewrite_path = File.exist?(path) && !CloudfrontAssetHost.disable_cdn_for_source?(source) && CloudfrontAssetHost::Uploader.current_paths.include?(path)\n asset_id = if rewrite_path \n CloudfrontAssetHost.key_for_path(path) \n\n elsif File.exists?(path)\n (\"?\" + File.mtime(path).to_i.to_s)\n else\n ''\n end\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end",
"def timestamp_asset(path)\n return \"#{path}?t=#$app_build\"\n end",
"def rewrite_asset_path(source)\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def asset_key\n \"asset-uri:#{compressed_path}\"\n end",
"def cache_uid\n @cache_uid ||= (ENV['CACHE_UID'] || :v1).freeze\n end",
"def sprockets_js_erb_cache_bust\n do_sprockets_cache_bust(:time_stamp)\n end",
"def compile_asset_from_cache(asset_path, &block)\n # TODO(philc): We should not check the file's md5 more than once when we're running in production mode.\n contents = File.read(asset_path)\n md5 = Digest::MD5.hexdigest(contents)\n cached_asset = $compiled_cache[asset_path]\n if md5 != cached_asset[:md5]\n cached_asset[:contents] = block_given? ? block.yield(asset_path) : File.read(contents)\n cached_asset[:md5] = md5\n end\n cached_asset[:contents]\n end",
"def add_to_asset_ids_cache(source, asset_id)\n self.asset_ids_cache_guard.synchronize do\n self.asset_ids_cache[source] = asset_id\n end\n end",
"def asset_timestamp(file_path)\n return nil if file_path =~ /\\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)\n public_path = self.class.public_folder if self.class.respond_to?(:public_folder)\n public_path ||= Padrino.root(\"public\") if Padrino.respond_to?(:root)\n public_file_path = File.join(public_path, file_path) if public_path\n stamp = File.mtime(public_file_path).to_i if public_file_path && File.exist?(public_file_path)\n stamp ||= Time.now.to_i\n \"?#{stamp}\"\n end",
"def staging_cache_key\n \"#{url_path.gsub(/[^[:alnum:]]/, \"_\")}_#{slug}\"\n end",
"def asset_version path\n path = File.expand_path(File.join(public_dir, path))\n md5(path)\n end",
"def dependency_history_key\n \"asset-uri-cache-dependencies:#{compressed_path}:#{ @env.file_digest(filename) }\"\n end",
"def asset_digest(source)\n asset_paths.digest_for(source)\n end",
"def cached_poster\n File.join(Rails.root,\"posters\",Rails.env,\"img#{id}.jpg\")\n end",
"def cache_key\n \"me/#{object.id}-#{object.updated_at.utc.to_s(:number)}\"\n end",
"def asset_path(url)\n \"/assets/cb#{settings.cachebust}/#{url}\"\n end",
"def asset_file_id_to_copy; @asset_file_id_to_copy; end",
"def version_for_cache\n \"download_url:#{source[:url]}|#{digest_type}:#{checksum}\"\n end",
"def version_for_cache\n \"path:#{source_path}|shasum:#{destination_shasum}\"\n end",
"def rewrite_asset_path(source, path = nil)\n if path && path.respond_to?(:call)\n return path.call(source)\n elsif path && path.is_a?(String)\n return format(path, source)\n end\n\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n else\n source + \"?#{asset_id}\"\n end\n end",
"def asset_host; end",
"def asset_host; end",
"def set_asset_tag\n @asset_tag = AssetTag.find(params[:id])\n end",
"def cache_key\n \"#{self.class.cache_key_base}/#{self.id}\"\n end",
"def image_asset_id\n item_code_name_cd&.delete('IMG_').to_i\n end",
"def _precompiled_asset_metadata(file)\n CompiledAssetsHash.new.replace(super)\n end",
"def compute_asset_host(source)\n if host = ActionController::Base.asset_host\n if host.is_a?(Proc) || host.respond_to?(:call)\n case host.is_a?(Proc) ? host.arity : host.method(:call).arity\n when 2\n request = @controller.respond_to?(:request) && @controller.request\n host.call(source, request)\n else\n host.call(source)\n end\n else\n (host =~ /%d/) ? host % (source.hash % 4) : host\n end\n end\n end",
"def asset_url(path)\n path.sub!(%r[^(#{@mount_point})?/?], \"\")\n mounted_path = \"#{@mount_point}/#{path}\"\n\n # TODO: Change the real file behavior if I replace the use of Rack::File above\n return mounted_path if @watcher.find(path)\n\n return mounted_path unless @environment == \"production\"\n\n # Add on a checksum tag in production\n asset = find_asset(path)\n raise \"Error: no such asset available: #{path}\" unless asset\n mounted_path, dot, extension = mounted_path.rpartition(\".\")\n return mounted_path if dot.empty?\n \"#{mounted_path}-#{asset.checksum}.#{extension}\"\n end",
"def public_compute_asset_path(source, options = T.unsafe(nil)); end",
"def cache_file\n File.join(Rscons.application.build_dir, \".rsconscache\")\n end",
"def asset_url_for( filename )\n\n # get a host\n hostname = config.asset_host || root_url.gsub( /^\\//, '' )\n\n # blah\n suff = ( Rails.env.development? ? \"?#{Time.now.to_i}\" : '' )\n\n # return\n \"#{hostname}/#{Rails.application.config.assets[:url]}/#{versioned_filename_for( filename )}\".gsub( /(?<!:)\\/\\/+/, '/' ) + suff\n\n end",
"def rewrite_asset_path(source, dir)\n source = \"/#{dir}/#{source}\" unless source[0] == ?/\n path = config.asset_path\n\n if path && path.respond_to?(:call)\n return path.call(source)\n elsif path && path.is_a?(String)\n return path % [source]\n end\n\n asset_id = rails_asset_id(source)\n if asset_id.empty?\n source\n else\n \"#{source}?#{asset_id}\"\n end\n end",
"def compute_asset_host(source)\n if host = config.asset_host\n if host.respond_to?(:call)\n case host.is_a?(Proc) ? host.arity : host.method(:call).arity\n when 2\n request = controller.respond_to?(:request) && controller.request\n host.call(source, request)\n else\n host.call(source)\n end\n else\n (host =~ /%d/) ? host % (source.hash % 4) : host\n end\n end\n end",
"def manually_expire_asset(asset_name)\n asset = Rails.application.assets[asset_name]\n def asset.fresh?(env); false; end\nend",
"def ggl_cache_key\n # gets it into the YYYYMMDDHHMMSS form\n dua = course.cgdub_dependencies_updated_at.utc.to_s(:number)\n\n \"ggl/dua-#{dua}/u-#{id}\"\n end",
"def cache_key\n Digest::SHA1.hexdigest \"#{self.class.name}#{base_url}#{hashable_string_for(options)}\"\n end",
"def build_asset(path, pathname, options)\n # Memory cache\n key = cache_key_for(pathname, options)\n if @assets.key?(key)\n @assets[key]\n else\n @assets[key] = begin\n # Persisted cache\n cache_asset(key) do\n super\n end\n end\n end\n end",
"def version_guid\n \"path:#{source_path}\"\n end",
"def fetch_dynamic_asset(path)\n return yield unless cache_dynamic_assets\n\n mtime = File.mtime(path)\n cached_mtime, contents = @dynamic_asset_cache[path]\n\n if cached_mtime.nil? || mtime != cached_mtime\n @dynamic_asset_cache[path] = [mtime, yield]\n @dynamic_asset_cache[path][1]\n else\n contents\n end\n end",
"def asset_id(file)\n File.basename file, '.*'\n end",
"def set_asset_file\n @asset_file = AssetFile.find(params[:id])\n end",
"def set_asset_file\n @asset_file = AssetFile.find(params[:id])\n end",
"def cache_key\n end",
"def cache_key_with_version\n if version = cache_version\n \"#{cache_key}-#{version}\"\n else\n cache_key\n end\n end",
"def cache_key_with_version\n if version = cache_version\n \"#{cache_key}-#{version}\"\n else\n cache_key\n end\n end",
"def compute_asset_host(source)\n if host = config.asset_host\n if host.is_a?(Proc) || host.respond_to?(:call)\n case host.is_a?(Proc) ? host.arity : host.method(:call).arity\n when 2\n request = controller.respond_to?(:request) && controller.request\n host.call(source, request)\n else\n host.call(source)\n end\n else\n (host =~ /%d/) ? host % (source.hash % 4) : host\n end\n end\n end",
"def sass_cache_bust(file_name)\n require 'digest/md5'\n file_contents = Dir.glob(\"_sass/*\").map{|f| File.read(f) }.join\n file_name + '?' + Digest::MD5.hexdigest(file_contents)\n\n end",
"def cache_id\n \"#{self.class.name.underscore}:#{self.id}\"\n end",
"def asset(asset_id)\n get \"/video/v1/assets/##{asset_id}\"\n end",
"def compute_asset_path(source, options = T.unsafe(nil)); end",
"def cache_key\n if new_record?\n \"#{model_name.cache_key}/new\"\n else\n if cache_version\n \"#{model_name.cache_key}/#{id}\"\n else\n timestamp = max_updated_column_timestamp\n\n if timestamp\n timestamp = timestamp.utc.to_fs(cache_timestamp_format)\n \"#{model_name.cache_key}/#{id}-#{timestamp}\"\n else\n \"#{model_name.cache_key}/#{id}\"\n end\n end\n end\n end",
"def to_production_html\n \"<script type='text/javascript' src='%s?%s'></script>\" % [path, mtime.to_i]\n end",
"def cache_key\n name.to_s\n end",
"def asset_host=(_arg0); end",
"def asset_host=(_arg0); end",
"def asset_path(*args)\n path = args.join('/')\n page = sitemap[path]\n if production?\n raise \"Missing asset #{path}\" if page.blank?\n if page[:digest] == true\n raise \"Missing digest for #{path}\" if page[:digest_path].blank?\n path = page[:digest_path]\n end\n end\n asset_http_prefix + path\n end",
"def id_for_assets\n name\n end",
"def cache_key\n return \"#{model_key}/new\" if new_record?\n return \"#{model_key}/#{_id}-#{updated_at.utc.to_formatted_s(cache_timestamp_format)}\" if do_or_do_not(:updated_at)\n \"#{model_key}/#{_id}\"\n end",
"def render(context)\n return \"\" unless ENV[\"ENV\"] == \"production\"\n\n full_path = File.join(context[\"site\"][\"__directory\"], @path.strip)\n\n return @prefix + DIGEST_CACHE[full_path] if DIGEST_CACHE[full_path]\n\n digest = Digest::MD5.hexdigest(File.read(full_path))\n DIGEST_CACHE[full_path] = digest\n\n @prefix + digest\n end",
"def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end",
"def add_time_stamp(path)\n logger.debug \"sprockets cache busting: #{File.basename path}\"\n lines = File.readlines path\n lines.slice!(0) if lines.first.match(/^#=Timestamp/)\n lines = [\"#=Timestamp #{Time.now}\\n\"] + lines\n File.open(path, \"w\") do |f|\n lines.each{|l| f.write l}\n end\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def vary_cache_key_for(request)\n method = request.method.to_s\n Digest::SHA1.hexdigest(\"by_vary_index#{@cache_salt}#{method}#{request.url}\")\n end",
"def source_file_mtime; end",
"def site_asset_url(src)\n rewrite_asset_path(src.expand_url(\"#{account_site_assets_url}/\"))\n end",
"def asset_path(site, post_id)\n\n # post_id\n\n new_id = post_id.gsub(\"jekyll/update/\", \"\")\n\n site + \"post-assets/\" + new_id.gsub(\"/\", \"-\")[1..-1]\n\n # jekyll/update/2014/02/15/nyt-4th-down-bot-goes-back-in-the-box\n # post_id.gsub(\"jekyll/update/\", \"\").gsub(\"/\", \"-\")[1..-1]\n end",
"def compute_asset_host(source = T.unsafe(nil), options = T.unsafe(nil)); end",
"def precompile_assets=(_arg0); end",
"def precompiled_assets(clear_cache = T.unsafe(nil)); end",
"def precompiled_assets(clear_cache = T.unsafe(nil)); end",
"def asset_host_meta_tag\n \"<meta name='asset_host' content='#{ActionController::Base.asset_host}'/>\"\n end",
"def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end",
"def resolve_asset_path(path, allow_non_precompiled = T.unsafe(nil)); end",
"def id(source_file)\n Digest::SHA1.hexdigest(filename(source_file))\n end",
"def cache_file\n @cache_file ||= File.join cache_dir, \"#{full_name}.gem\"\n end",
"def action_cache_key(cache_key)\n \"views/#{cache_key.to_s}\"\n end",
"def rewrite_asset_path_with_cloudfront(source, path=nil)\n asset_id = rails_asset_id(source)\n if asset_id.blank?\n source\n elsif asset_id.starts_with?('?')\n source + asset_id\n else\n \"/#{asset_id}#{source}\"\n end\n end",
"def asset_path\n \"user/#{self.user_id}/assets/\"\n end",
"def set_asset\n @asset = @org.assets.find(params[:id])\n end",
"def cache_version_key\n \"#{Photo.hash_schema_version}.#{self.cache_version}\"\n end",
"def cl_asset\n self.asset.filename\n end",
"def set_ds_asset_tag\n @ds_asset_tag = DsAssetTag.find(params[:id])\n end",
"def compute_asset_path(path, options = {})\n digested = options.delete(:digested)\n digested = true if digested.nil?\n\n if (digest_path = asset_digest_path(path, options))\n path = digest_path if digested && digest_assets\n path += \"?body=1\" if options[:debug]\n File.join(assets_prefix || \"/\", path)\n else\n super\n end\n end",
"def cached_gemfile_md5_path\n File.join(tmp_path, 'git_copy_bundle_gemfile_lock.md5')\n end",
"def id(source_file)\n Digest::SHA1.hexdigest(source_file.filename)\n end",
"def lookup_debug_asset(path, options = T.unsafe(nil)); end",
"def lookup_debug_asset(path, options = T.unsafe(nil)); end",
"def cache_key\n if @collector.swimmer\n # \"RGB\" stands for \"RecordGridBuilder\", to uniquely identify this type of cache key\n \"RGB:#{I18n.locale}:#{@collector.swimmer.id}:#{@collector.collection.cache_key}\"\n else\n \"RGB:#{I18n.locale}:#{@collector.collection.cache_key}\"\n end\n end",
"def versioned_js(js)\n \"/javascripts/#{js}.js?\" + File.mtime(File.join(Sinatra.application.options.public, \"javascripts\", \"#{js}.js\")).to_i.to_s\n end",
"def path\n asset_source_path\n end",
"def path\n asset_source_path\n end",
"def prefix_vite_asset(path)\n File.join(\"/#{ config.public_output_dir }\", path)\n end",
"def asset_digest_path(path, options = T.unsafe(nil)); end",
"def asset_digest_path(path, options = T.unsafe(nil)); end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end"
] |
[
"0.8229946",
"0.80967784",
"0.767262",
"0.6382397",
"0.6202062",
"0.6140736",
"0.6091757",
"0.6080483",
"0.6036446",
"0.60274965",
"0.59639984",
"0.5930305",
"0.5925075",
"0.58463526",
"0.5827893",
"0.58017486",
"0.5710232",
"0.56980085",
"0.5689497",
"0.56597155",
"0.56327766",
"0.5619366",
"0.5596402",
"0.5596402",
"0.55688924",
"0.553357",
"0.55296934",
"0.5527619",
"0.5506415",
"0.55054957",
"0.55044776",
"0.5502979",
"0.5498701",
"0.5496767",
"0.5487054",
"0.5486996",
"0.5478516",
"0.54721284",
"0.54692346",
"0.5453324",
"0.5452543",
"0.54520166",
"0.54377127",
"0.54377127",
"0.542932",
"0.5426982",
"0.5426982",
"0.54188627",
"0.54135364",
"0.5408423",
"0.5398647",
"0.53830194",
"0.5380521",
"0.5377261",
"0.5371274",
"0.53503716",
"0.53503716",
"0.53472966",
"0.5338888",
"0.53336996",
"0.53323966",
"0.5307206",
"0.5294078",
"0.5282443",
"0.5282443",
"0.5282443",
"0.5282443",
"0.5272483",
"0.52691466",
"0.52612",
"0.5260045",
"0.5258195",
"0.5257798",
"0.5256613",
"0.5256613",
"0.5253613",
"0.524669",
"0.524669",
"0.5245964",
"0.5243645",
"0.52385575",
"0.52334917",
"0.52250284",
"0.5224962",
"0.52199423",
"0.5216131",
"0.5207288",
"0.520367",
"0.51858276",
"0.51812255",
"0.51804423",
"0.51801103",
"0.5176502",
"0.5175642",
"0.5173782",
"0.5173782",
"0.5171537",
"0.51706356",
"0.51706356",
"0.5163942"
] |
0.7859806
|
2
|
Sort talks in descending order by duraion Find number of tracks needed, since we know the total duraion exactly And intialize tracks As per the Best fit algorithm, Fill each tracks by looping through sorted talks Do this till available talks become empty
|
def schedule_talks
until available_talks.empty?
Track.all.each do |track|
schedule_talks_for_track(track)
# When a track didn't fill exactly
# Removing already scheduled last element from track and
# Again trying for a exact match on available talks
# Not a perfect solution, But, It produces better result
# Kind of backtracking
backtrack_and_schedule_talks_for_track(track)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pack_talks\n\n @tracks << Track.new() # create first [0] Track object\n x = 0 # first object @tracks[0]\n\n @talks.each do |talk|\n\n # if it's morning session, set limit to 180min, otherwise to 240min\n len = get_max_length(x)\n\n # if the sum of Track's total length + current talk's length is less\n # than y minutes\n if @tracks[x].total_length + talk.length.to_i <= len\n\n # append talk to current Track\n @tracks[x].talks << talk\n\n # add current talk's length to Track's total length\n @tracks[x].total_length += talk.length.to_i\n\n else\n available_tracks = @tracks.dup.reject{|k| k == x}\n available_tracks.each_with_index do |track, index|\n\n # if it's morning session, set limit to 180min, otherwise to 240min\n len = get_max_length(index)\n\n if track.total_length + talk.length.to_i <= len\n\n # append talk to current Track\n track.talks << talk\n\n # add current talk's length to Track's total length\n track.total_length += talk.length.to_i\n break\n else\n # append a new Track to the conference\n @tracks << Track.new()\n\n # set the last element of the array as the current one\n x = @tracks.size - 1\n\n # append talk to current track\n @tracks[x].talks << talk\n\n # add current talk's length to Track's total length\n @tracks[x].total_length += talk.length.to_i\n break\n end\n\n end\n\n end # @talks.each\n\n end\n @tracks\n end",
"def find_most_played_songs\n top_songs_with_play_count_pair = self.lib.songs.reject do |song|\n #this line is describing records it will get rid of\n (!song.metadata.has_key?('play_count')) or (song.metadata['play_count'] == nil)\n end\n\n top_songs_played_sorted = top_songs_with_play_count_pair.sort do |a, b| \n b.metadata['play_count'].to_i <=> a.metadata['play_count'].to_i\n end\n\n top_songs_played = top_songs_played_sorted.first(5)\n song_names_of_top_played = top_songs_played.collect {|song| song.metadata['name']} \n end",
"def prepare_tracks(tracks, starting_index, bonus)\n \n last_index = starting_index\n\n # loop through every song in the track list in order, normalizing their sequence numbers\n tracks.values.select{|val| val[\"bonus\"] == bonus.to_s}.sort_by{ |a| a[\"Seq\"].to_i }.each_with_index do |b, i|\n\n last_index = starting_index + i\n\n # sequence in 10s\n b[\"Seq\"] = (last_index * 10).to_s \n\n # if there's no override song name, add in the real song name\n if b[\"SONGID\"].present? \n b[\"Song\"] = Song.find(b[\"SONGID\"].to_i).full_name if b[\"Song\"].empty?\n end\n\n b[:VersionNotes] = nil if b[:VersionNotes].strip.empty?\n \n end\n\n starting_index\n\n end",
"def sort_by_popularity\n @song_data = @song_data.sort_by {|x| [-x[:plays], x[:index]] }\n end",
"def related_songs\n unless self.spotify_track_id.nil?\n related_artists = self.spotify_track.artists.first.related_artists\n\n related_artists.shuffle[0..4].map do |artist|\n artist.top_tracks('IE').shuffle.first\n end.flatten\n else\n Array.new\n end\n\n\n end",
"def top_songs(n = 3)\n top_list = @tracks.sort_by {|s| s.play_count}.reverse\n return top_list[0..n-1].compact\n end",
"def number_of_tracks(talks)\n @total_talks_time = Talk.computeTotalTime(talks)\n\n quotient = @total_talks_time / Track.maxTrackTime\n if @total_talks_time - (quotient * Track.maxTrackTime) >= Track.minTrackTime\n @number_of_tracks = quotient + 1\n else\n @number_of_tracks = quotient\n end\n end",
"def after_save\n songs = @song_groups.sort_by{ |group| cost_of group }.first\n\n # Sort em\n direction = final - initial > 0 ? :asc : :desc\n songs = songs.sort_by(&facet)\n songs = songs.reverse if direction == :desc\n\n songs.each_with_index do |song, position|\n MrEko::PlaylistEntry.create(:playlist_id => self.id, :song_id => song.id, :position => position)\n end\n end",
"def create_track(talks)\n self.number_of_tracks(talks)\n tracks_num = Array.new(@number_of_tracks) { |x| x+1 } # e.g. [1, 2]\n tracks_num.each do |track_num|\n @tracks_hash['Track ' + track_num.to_s] = Track.new\n end\n end",
"def randomize\n original_list = tracks\n song_count = original_list.size\n attempt_threshold = (song_count * 0.33).floor # so we don't spin forever\n new_list = [original_list.shift]\n idx = 0\n until original_list.empty? do\n attempts = 0\n until attempts >= attempt_threshold || (original_list[idx] && new_list.last.artist != original_list[idx].artist)\n idx = rand(song_count) \n attempts +=1\n end\n new_list << original_list[idx]\n original_list.delete_at(idx) \n end\n# clear\n new_list\n end",
"def get_trial_suggestions\n case @last_played.size\n when 0\n load_trials({\n 'San Francisco' => :very_easy,\n 'The Bunker' => :very_easy,\n 'Caravel Ships' => :easy,\n })\n when 1\n load_trials({\n 'San Francisco' => :very_easy,\n 'The Bunker' => :very_easy,\n 'Caravel Ships' => :easy,\n 'Tower in the Castle' => :medium,\n })\n when 2\n load_trials({\n 'San Francisco' => :very_easy,\n 'Caravel Ships' => :very_easy,\n 'Tower in the Castle' => :easy,\n 'Cat Mountain Climb' => :medium,\n 'Moonlit Woods' => :medium,\n })\n when 3\n load_trials({\n 'San Francisco' => :very_easy,\n 'Tower in the Castle' => :easy,\n 'Cat Mountain Climb' => :easy,\n 'Moonlit Woods' => :easy,\n 'Egypt Pyramid' => :medium,\n 'The Cave' => :medium,\n })\n when 4\n load_trials({\n 'Tower in the Castle' => :very_easy,\n 'Cat Mountain Climb' => :easy,\n 'Moonlit Woods' => :easy,\n 'Egypt Pyramid' => :medium,\n 'The Cave' => :medium,\n 'Cyberpunk Ruins' => :hard,\n 'Steamport Town' => :hard,\n })\n when 5\n load_trials({\n 'Cat Mountain Climb' => :very_easy,\n 'Moonlit Woods' => :easy,\n 'Egypt Pyramid' => :easy,\n 'The Cave' => :easy,\n 'Cyberpunk Ruins' => :medium,\n 'Steamport Town' => :medium,\n 'Find the Dragon' => :hard,\n 'Star Hopping' => :hard,\n })\n when 6\n load_trials({\n 'Cat Mountain Climb' => :very_easy,\n 'Moonlit Woods' => :very_easy,\n 'Egypt Pyramid' => :easy,\n 'The Cave' => :easy,\n 'Cyberpunk Ruins' => :medium,\n 'Steamport Town' => :medium,\n 'Find the Dragon' => :hard,\n 'Star Hopping' => :hard,\n 'Shadow of Valus' => :very_hard,\n 'The Cube' => :very_hard,\n })\n when 7\n load_trials({\n 'Tower in the Castle' => :easy,\n 'Moonlit Woods' => :very_easy,\n 'Egypt Pyramid' => :easy,\n 'The Cave' => :easy,\n 'Cyberpunk Ruins' => :medium,\n 'Steamport Town' => :medium,\n 'Find the Dragon' => :hard,\n 'Star Hopping' => :hard,\n 'Shadow of Valus' => :very_hard,\n 'The Cube' => :very_hard,\n 'Temple City' => :very_hard,\n })\n else\n nil # if user already played more than 6 games, then return nil (will get delegated to get_standard_suggestions)\n end\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 sorting()\n #makes sure that /a/ quarter is selected\n @quater = params[:quater]\n @quater == nil ? @quater = 'Q1' : @quater = @quater\n\n #REVIEW this is for clearing the teams not in the quater out of teams. Its done 7 times becuase for some reason it doesnt catch all the teams unless if its repeated\n 7.times {@teams.each {|team| team_in_quater(team, @quater) ? a=0 : @teams.delete(team)}}\n\n if params[:search]\n #REVIEW it does the same thing down here and for every time it iterates, half of the deletes are successful\n 7.times {search(@teams, params[:search])}\n end\n\n #finding the param that organizes team index by overall investment\n if params[:Investment] == 'ascending'\n team_investments = find_team_values()\n #sorts the teams hash from lowest to highest\n @teams.sort! {|x,y| team_investments[x.id] <=> team_investments[y.id] }\n #this does the same thing but ends up sorting from highest to lowest\n elsif params[:Investment] == 'descending'\n team_investments = find_team_values()\n @teams.sort! {|x,y| team_investments[y.id] <=> team_investments[x.id] }\n end\n\n #this finds the param for team name and sorts it (team 1 -> team 2 -> team 10 -> team 12 -> etc)\n if params[:Name] == 'ascending'\n @teams.sort! {|x,y| sorting_function(x.name, y.name) }\n elsif params[:Name] == 'descending'\n @teams.sort! {|x,y| sorting_function(y.name, x.name) }\n end\n\n if params[:Investment_f]\n team_investments = find_team_values()\n if params[:Investment_f].to_i > 100\n 7.times {@teams.each {|team,value| (100 < team_investments[team.id]) ? a = 0 : @teams.delete(team)}}\n else\n 7.times {@teams.each {|team,value| ((params[:Investment_f].to_i..params[:Investment_f].to_i+9).include? team_investments[team.id]) ? a = 0 : @teams.delete(team) }}\n end\n end\n\n #this paginates the teams into 15 per page\n @teams = @teams.paginate(:page => params[:page], :per_page => 15)\n end",
"def get_tracks!\n tracks = RSpotify::Track.search(self.keyword, limit: 50, offset: 0).sort_by(&:popularity)\n\n tracks.delete_if { |t| t.popularity < 45 }\n tracks = tracks.uniq { |t| t.artists.first.name } \n\n raise 'The playlist could not be generated' if tracks.size < 4\n return tracks.reverse\n end",
"def song_sorter(arr1, arr2, arr3)\n sorted_songs = {}\n\n (arr1 + arr2 + arr3).each do |classifier|\n song = classifier.song\n sorted_songs[song] ? sorted_songs[song] += 1 : sorted_songs[song] = 1\n end\n\n result = {\n first_recommendation: [],\n second_recommendation: [],\n third_recommendation: []\n }\n\n sorted_songs.each do |song, value|\n # TODO: Come back to this when you have async figured out\n # RecommendedSong.create(song_id: song.id,\n # recommendation_id: @recommendation.id)\n case value\n when 3\n result[:first_recommendation] << song\n when 2\n result[:second_recommendation] << song\n when 1\n result[:third_recommendation] << song\n end\n end\n\n result\n end",
"def best_song_from_en(songs)\n best_song = songs.first\n songs.each do |s|\n best_song = if s.tracks.size > best_song.tracks.size\n s\n else\n best_song\n end\n end\n best_song\n end",
"def prepare_setlist(setlist_songs, starting_index, encore)\n \n last_index = starting_index\n\n # loop through every song in the setlist in order (non-encore or encore), normalizing their sequence numbers\n setlist_songs.values.select{|val| val[\"Encore\"] == encore.to_s}.sort_by{|a| a[\"Chrono\"].to_i }.each_with_index do |b, i|\n\n last_index = starting_index + i\n\n # sequence in 10s\n b[\"Chrono\"] = (last_index * 10).to_s\n\n # if there's no override song name, add in the real song name\n if b[\"SONGID\"].present? \n b[\"Song\"] = Song.find(b[\"SONGID\"].to_i).full_name if b[\"Song\"].empty?\n end\n\n # empty text fields should be null in the database\n b[:MediaLink] = nil if b[:MediaLink].strip.empty?\n b[:VersionNotes] = nil if b[:VersionNotes].strip.empty?\n\n end\n\n last_index + 1\n\n end",
"def chapters_with_problems\n get_chapters.inject Hash.new do |chapters_with_sections,chapter|\n challenges = Dir[\"ch#{chapter}/challenge/*\"]\n chapters_with_sections[chapter] = challenges.map { |challenge| challenge[%r([^/]+?$)].to_i }.sort\n chapters_with_sections\n end\nend",
"def vexflow\n bars = []\n self.bars.times do |i|\n # assume 3 voices max\n voices = []\n voice1 = []\n voice2 = []\n voice3 = []\n\n # buffer for excess notes\n overflow1 = []\n overflow2 = []\n\n # voice1\n self.notes.where(:bar => i).select('beat, duration').distinct.order('beat ASC').each do |n|\n if !voice1.empty?\n if voice1.last[0].end_beat < n.beat # fill in gap\n # voice1 << [{:duration => n.beat - voice1.last[0].end_beat, :drum => -1}]\n voice1.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice1.last[0].end_beat > n.beat # overlap\n overflow_notes << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice1 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice1 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # overflow => voice2\n overflow1.each do |n|\n if !voice2.empty?\n if voice2.last[0].end_beat < n.beat # fill in gap\n # voice2 << [{:duration => n.beat - voice2.last[0].end_beat, :drum => -1}]\n voice2.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice2.last[0].end_beat > n.beat # overlap\n overflow2 << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice2 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice2 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # overflow2 => voice3\n overflow2.each do |n|\n if !voice3.empty?\n if voice3.last[0].end_beat < n.beat # fill in gap\n # voice3 << [{:duration => n.beat - voice3.last[0].end_beat, :drum => -1}]\n voice3.last.each do |m|\n m.assign_attributes({ :duration => n.beat - m.beat })\n end\n elsif voice3.last[0].end_beat > n.beat # overlap\n overflow2 << n\n next\n end\n else # leading rest\n if n.beat != 0\n voice3 << [{:duration => n.beat, :drum => -1}]\n end\n end\n voice3 << self.notes.where(:bar => i, :beat => n.beat, :duration => n.duration)\n end\n\n # add trailing rests\n if voice1.any? && voice1.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice1.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests[0] = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice1 << extraRests\n end\n # voice1 << [{:duration => self.meter_bottom - voice1.last[0].end_beat, :drum => -1}]\n end\n if voice2.any? && voice2.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice2.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests[0] = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice2 << extraRests\n end\n # voice2 << [{:duration => self.meter_bottom - voice2.last[0].end_beat, :drum => -1}]\n end\n if voice3.any? && voice3.last[0].end_beat != self.meter_bottom\n extraRests = []\n voice3.last.each do |m|\n if self.meter_bottom - m.beat > 1\n m.assign_attributes({ :duration => 1 })\n extraRests = {:duration => self.meter_bottom - m.end_beat, :drum => -1}\n else\n m.assign_attributes({ :duration => self.meter_bottom - m.beat })\n end\n end\n if extraRests.any?\n voice3 << extraRests\n end\n # voice3 << [{:duration => self.meter_bottom - voice3.last[0].end_beat, :drum => -1}]\n end\n\n # full measure rest\n if voice1.empty?\n voice1 << [{:duration => self.meter_bottom, :drum => -1}]\n end\n\n # add any voices to bar\n voices << voice1\n if voice2.any?\n voices << voice2\n end\n if voice3.any?\n voices << voice3\n end\n bars << voices\n end\n\n return bars\n end",
"def test_cards_are_unique_bubble\n \n\t #build a fresh deck to test\n\t @testDeck = Card.find(:all)\n\t\t\n\t\t#sort the suits\n\t\t\n\t\t#bubble sort the values\t\n\t\t@swapped=true\n\t\twhile @swapped != false\n\t\t\t@swapped=false\n\t\t\t@i=0\n\t\t\twhile @i < @testDeck.count-1 do\n\t\t\t\tif @testDeck[@i].value > @testDeck[@i+1].value \n\t\t\t\t\t@buff = @testDeck[@i]\n\t\t\t\t\t@testDeck[@i] = @testDeck[@i+1]\n\t\t\t\t\t@testDeck[@i+1] = @buff\n\t\t\t\t\t@swapped=true\n\t\t\t\tend #end if\n\t\t\t\t@i+=1\n\t\t\tend # while\n\t\tend # end outer while \n\t\t\n\t\t\t\n\t\t#sort by suit within each value\n\t\t@i=0\n\t\twhile @i < @testDeck.count-1 do\n\t\t\t#determine size of sub bubble\n\t\t\t@groupCt=1\n\n\t\t\twhile @testDeck[@i].value == @testDeck[@i+@groupCt].value do\n\t\t\t\t@groupCt+=1\n\t\t\t\tif @i+@groupCt > @testDeck.count-1\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend #end ct creation\n\n\t\t\t#bubble sort the suits\t\n\t\t\t@swapped=true\n\t\t\twhile @swapped != false\n\t\t\t\t@swapped=false\n\t\t\t\t@k=0\n\t\t\t\t\n\t\t\t\twhile @k < @groupCt-1 do\n\t\t\t\t\tif (@testDeck[@i+@k].suit <=> @testDeck[@i+@k+1].suit) == 1\n\t\t\t\t\t\t@buff = @testDeck[@i+@k]\n\t\t\t\t\t\t@testDeck[@i+@k] = @testDeck[@i+@k+1]\n\t\t\t\t\t\t@testDeck[@i+@k+1] = @buff\n\t\t\t\t\t\t@swapped=true\n\t\t\t\t\tend #end if\n\t\t\t\t\t@k+=1\n\t\t\t\t\n\t\t\t\tend # while\n\t\t\tend # end outer while\n\t\t\t\n\t\t\t@i+=@groupCt\n\t\tend\t\t\n\t\n\t\t#iterate through the sorted values and look for doubles\n\t\t@i=0\n\t\twhile @i < @testDeck.count-1 do\n\t\t\tif @testDeck[@i].value == @testDeck[@i+1].value && @testDeck[@i].suit == @testDeck[@i+1].suit\n\t\t\t\tassert false, \"A double card has been found\"\n\t\t\telse\n\t\t\t\tassert true\n\t\t\tend #end if\n\t\t\t@i+=1\n\t\tend\n\t\n\t\t#test output\n\t\t#@testDeck.each do |testCard|\n\t\t\t#puts testCard.value\n\t\t\t#puts testCard.suit\n\t\t#end\n\t\t\n end",
"def winning_results_frequency_for_each_nominee\n category_id = self.id\n results = Result.where({\"category_id\" => category_id})\n nominee_hash = Hash.new(0)\n\n results.each do |winner| \n winner = winner.loved_id\n if winner != nil\n nominee_hash[winner] +=1\n end\n end\n\n tallied_results = nominee_hash.sort_by{ |key, value| value}.reverse.to_h\n return tallied_results\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 one_week_wonders(songs)\n songs.select{ |song| no_repeats?(song, songs)}.uniq\nend",
"def test_speaker_list_generation\n s1 = FactoryGirl.create(:speaker, :last_name => \"Ttt\", :first_name => \"Sssss\")\n s2 = FactoryGirl.create(:speaker, :last_name => \"Zzz\", :first_name => \"Aaaaa\")\n\n a1 = 10.times.inject([]) { |a,x| a << FactoryGirl.create(:audio_message, :title => \"Message Title #{x}\", :subj => \"The Subject #{x}\", :speaker => s1) }\n a2 = 5.times.inject([]) { |a,x| a << FactoryGirl.create(:audio_message, :title => \"Message Title #{x}\", :subj => \"The Subject #{x}\", :speaker => s2) }\n\n speaker_list = generate_speaker_list_with_counts\n assert speaker_list.size >= 2,\"Speaker list should have at least two items\"\n a1_pos = -1\n a2_pos = -2\n speaker_list.each_with_index do |speaker,i|\n if speaker.last_name == \"Ttt\"\n assert_equal 10,speaker.active_message_count,\"Counts should be calculated for active messages of speaker 1\"\n a1_pos = i\n elsif speaker.last_name == \"Zzz\"\n assert_equal 5,speaker.active_message_count,\"Counts should be calculated for active messages of speaker 2\"\n a2_pos = i\n end\n end\n assert a1_pos >= 0,\"List must contain speaker 1\"\n assert a2_pos >= a1_pos,\"List must container speaker 2 after speaker 1\"\n end",
"def youtube_tracks_from_top_tracks(top_tracks)\n top_tracks.each do |top_track|\n title = top_track[\"name\"]\n\n top_track_url = top_track[\"url\"]\n html = self.class.get(top_track_url)\n youtube_urls = html.scan(/embed src=\\\"http:\\/\\/www.youtube.com\\/v\\/([-\\w\\.]+)?/)\n\n if youtube_urls.count > 0\n track_youtube_id = youtube_urls.first.first\n song = Song.new(@artist, title, track_youtube_id)\n @tracks.push(song)\n end\n end\n end",
"def group_slides(song)\n ordered = song[:order].dup\n skipped = []\n skipped.push(ordered.shift) while ordered.any? && ordered.first =~ /(title|blank) slide/\n unvisited = []\n unvisited.unshift(ordered.pop) while ordered.any? && ordered.last =~ /(title|blank) slide/\n\n infos = Hash.new { |h,k| h[k] = {:pre => Set.new, :post => Set.new} }\n ordered.each_cons(2) do |a,b|\n infos[a][:post] << b\n infos[b][:pre] << a\n end\n infos[ordered.first][:pre] << :first\n infos[ordered.last][:post] << :last\n\n groups = {}\n group_members = {}\n new_order = []\n ordered.each do |name|\n if group_name = group_members[name]\n if groups[group_name].first == name\n #puts \"REPEAT #{group_name} (#{name})\"\n new_order << group_name\n end\n else\n group_name = name\n new_order << group_name\n group = groups[group_name] = [name]\n group_members[name] = group_name\n cur = infos[name]\n #puts \"NEW GROUP #{name} #{cur}\"\n while cur && cur[:post].size == 1\n nxt_name = cur[:post].first\n nxt = infos[nxt_name]\n if nxt && nxt[:pre].size == 1 && !group.include?(nxt_name)\n #puts \" ... #{nxt_name} #{nxt}\"\n group << nxt_name\n group_members[nxt_name] = group_name\n cur = nxt\n else\n cur = nil\n end\n end\n end\n end\n [\"title slide\", \"blank slide\"].each do |n|\n if groups[n] && groups[n].size == 1\n groups.delete n\n end\n end\n\n new_parts = {}\n groups.each do |group_name, orig_part_names|\n new_parts[group_name] = orig_part_names.inject([]) { |a, name|\n slide = song[:parts][name]\n if slide.nil?\n if name == \"blank slide\"\n slide = [\"\"]\n else\n slide = [\"MISSING:#{name}\"]\n end\n end\n a + slide\n }\n end\n\n (song[:parts].keys - group_members.keys).each do |name|\n new_parts[name] = song[:parts][name]\n end\n\n {\n :parts => new_parts,\n :order => skipped + new_order + unvisited,\n :keywords => song[:keywords],\n }\nend",
"def prepare_group_sort(players)\n # We put the players in buckets by their groups\n buckets = players.group_by { |p| p.group }.values.sort_by { |a| -a.length }\n\n # And then we collect them across the buckets\n bucket = buckets.shift\n bucket.zip(*buckets).flatten.compact\n end",
"def initialize(questions)\n @playing_questions = questions.sample(NUMBER_OF_QUESTIONS)\n @points = 0\n @correct_answers = 0\n end",
"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 getRelatedPapers(curr_id, n)\n @article = Article.where('arxiv_id = ?', curr_id).first # get the article passed in from DB\n \n puts @article\n if @article == [] || @article.nil?\n puts 'articles NOT found'\n return nil\n end\n @valid_friends = []\n\n @friends = @article.friendships # this returns all 1 degree close articles\n\n # if they are in the same category, store in valid friends\n @friends.each do |friendship|\n friend = Article.find(friendship.friend_id)\n if friend.category == @article.category\n @valid_friends << friend\n end\n end\n\n # get all inwards edges for this artcle\n Friendship.find(:all, conditions: {friend_id: @article.id}).each do |cited_by|\n @valid_friends << Article.find(cited_by.article_id)\n puts 'ADDED CITED BY'\n end\n\n puts \"valid_friends\"\n puts @valid_friends\n\n if @valid_friends == []\n puts 'NO VALID FRIENDS'\n return nil\n end\n\n temp = Hash.new()\n\n # Make a hash for each of these filtered articles\n # the key for this hash the score, and value is the article\n\n @valid_friends.each do |friend|\n keywords = @article.keywords.split(',')\n friend_keywords = friend.keywords.split(',')\n score = get_score(keywords, friend_keywords)\n puts \"SCORE\"\n puts score\n\n if !temp[score]\n temp[score] = []\n end\n temp[score] << friend\n end\n\n @final_articles = []\n\n # puts \"TEMP SORT\"\n # ap temp\n\n sorted = temp.dup\n\n # sort based on the score and return the articles.\n\n sorted.sort.each do |score|\n\n\n temp[score[0]].each do |article|\n puts \"ARTICLE\"\n puts article\n if !@final_articles.include? article\n if article.id != @article.id\n @final_articles << article\n end\n end\n end\n\n end\n puts \"FINAL\"\n puts @final_articles\n\n\n if n == -1\n return @final_articles\n else \n return @final_articles.first(n)\n end\n\n end",
"def partition(tracks)\n track_count = tracks.size\n track_numbers = (0...track_count).to_a\n half = track_count / 2.0\n half_rounded = half.round\n range_one = 0...(half_rounded.pred)\n range_two = (half_rounded.pred)...(track_count.pred)\n [tracks.slice(range_one), tracks.slice(range_two)].reject(&:nil?)\n end",
"def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend",
"def one_week_wonders(songs)\n songs.select { |song| no_repeats?(song, songs) }.uniq\nend",
"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 show\n\n tempList = Array.new\n @course.knowledges.each do|k|\n tempList = tempList << k.id \n end\n \n @best_list = Array.new\n len = tempList.size\n for i in 0..len-1\n max = tempList[0];\n tempLen = tempList.size\n for j in 0..tempLen-1\n if Knowledge.find((tempList[j])).good > Knowledge.find(max).good\n max = tempList[j]\n end\n end\n @best_list = @best_list << Knowledge.find(max)\n tempList.delete(max)\n end\n\n end",
"def play_count_country_vice(country_lists,device_accesses,listen_medias,sorted_array = [])\n @device_accesses = device_accesses\n @listen_medias = listen_medias\n country_lists.each do |country_name|\n id_lists = @device_accesses.where(:access_country => country_name).map(&:id)\n add_count=[]\n id_lists.each do |id|\n add_count << @listen_medias.where(device_access_id: id).count\n end\n sorted_array << [country_name,add_count.sum]\n end\n sorted_array\n play_hash = Hash[*sorted_array.flatten]\n sorted_play_hash = play_hash.sort_by {|_key, value| value}.reverse\n end",
"def upset_test(limit = 1)\n puts\n (0..14).each do |skill|\n wins = [0,0,0]\n gamecount = 0\n until gamecount == limit\n newgame\n @players << skill\n @players << (skill + 1)\n reset_arrays\n playgame\n wins[0] += 1 if @game_scores[0][-1] > @game_scores[1][-1]\n wins[1] += 1 if @game_scores[0][-1] < @game_scores[1][-1]\n wins[2] += 1 if @game_scores[0][-1] == @game_scores[1][-1]\n gamecount += 1\n end\n print @players.inspect.rjust(8), \" \", wins.inspect, \"\\n\"\n end\nend",
"def make_guess(guess)\n @guesses_made << guess\n @guesses_made.sort!\n guess_list = Hash.new\t\t\n\n @active_list.each do |word|\n format = @pattern.dup\n @word_size.times{ |index| format[index] = guess if word[index] == guess }\n\n guess_list[format] = String.new if guess_list[format] == nil\n guess_list[format] << word\n guess_list[format] << ','\n end\n\n guess_list = guess_list.sort\n\n biggest = String.new\n second_biggest = String.new\n biggest_size = -1\n second_biggest_size = -1\n hold_list = Hash.new\n guess_list.each do |key, value|\n hold_list[key] = value.split(',')\t\n if biggest_size < hold_list.fetch(key).size\n biggest = key\n biggest_size = hold_list.fetch(key).size\n elsif biggest_size == hold_list.fetch(key).size\n first_reveal = 0\n second_reveal = 0\n @word_size.times do |index|\n first_reveal += 1 if biggest[index] == guess\t\t\t\t\t\n second_reveal += 1 if key[index] == guess\n end\n biggest = key if first_reveal > second_reveal\n end\n\n\n if second_biggest_size < hold_list.fetch(key).size && key != biggest \n second_biggest = key\n second_biggest_size = hold_list.fetch(key).size\n elsif biggest_size == hold_list.fetch(key).size && key != biggest\n first_reveal = 0\n second_reveal = 0\n @word_size.times do |index|\n first_reveal += 1 if second_biggest[index]== guess\t\t\t\t\t\n second_reveal += 1 if key[index] == guess\n end\n second_biggest = key if first_reveal > second_reveal\t\n end\n end\n\n output = Hash.new\n hold_list.each{ |key, value| output[key] = value.size }\n\n\n biggest = second_biggest if @diff_timer == 0 && second_biggest != String.new\n\t\t\t\n @active_list = hold_list.fetch(biggest)\n\n biggest == @pattern ? @guesses_left -= 1 : @pattern = biggest\n \n\n @diff_timer = @timer_max if @diff_timer == 0\n\t\t\t\n @diff_timer -= 1\n\t\t\n output\n end",
"def getMostCover records\n numset = []\n num = 0\n wArry=[];\n for i in 0...@maxloopnum do\n for j in 0...@parameters.paramsArr.length do\n for k in j+1 ...@parameters.paramsArr.length do\n for n in 0...@pairs.length do\n if @pairs[n].firstParam ==j and @pairs[n].secondParam ==k\n for m in 0...@pairs[n].pairsArr.length do\n if records.recordsArr[i].valuesArr[j] == @pairs[n].pairsArr[m].firstValue and records.recordsArr[i].valuesArr[k] ==@pairs[n].pairsArr[m].secondValue and @pairs[n].pairsArr[m].isVisited== false\n num+=1\n \n end\n end\n end\n end\n end\n end\n numset << num\n num =0\n end\n maxtag=0\n maxnum=0\n max = Array.new\n for i in 0...@maxloopnum do\n if numset[i] == maxnum\n max << i \n elsif numset[i] > maxnum\n maxnum = numset[i]\n max.clear\n max << i\n end \n end\n #addb by chuangye ----------------------start\n if @useweight==1\n for h in 0...max.length do\n weight=0\n for p in 0...@parameters.paramsArr.length do\n pos=records.recordsArr[max[h]].valuesArr[p]\n weight+=@parameters.paramsArr[p].elementsArr[pos].weight\n \n end\n wArry << [max[h],weight]\n end\n maxweight=wArry[0][1]\n maxArry=[]\n for x in 0... wArry.length do\n if wArry[x][1]==maxweight\n maxArry << wArry[x][0]\n elsif wArry[x][1]==maxweight\n maxArry.clear\n maxArry << wArry[x][0]\n end\n \n end\n tag= randchar(0,maxArry.length-1)\n return maxArry[tag]\n else \n #add by chuangye ------------------------end\n tag = randchar(0,max.length-1)\n return max[tag]\n end\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 process(n)\n foundpart = 0\n parts = []\n for i in 0..n-1 do # init participants ary\n parts.push 1\n end\n infolog {\"Starting, num-parts=#{n}\"}\n round = 0\n finished = false\n while !finished and round < @maxrounds\n round += 1\n numparts = parts.select{|it| it>0}.size\n infolog {\"ROUND ##{round}: num-parts=#{numparts}\"}\n deblog {\" parts=#{parts}\"}\n for i in 0..n-1 do\n if parts[i] > 0 and !finished\n for j in i+1..i+n do\n k = j % n\n #tracelog {\"k=#{k}\"}\n if parts[k] > 0\n parts[i] += parts[k]\n deblog {\"part##{i} steals from part#{k}: #{parts[k]} => #{parts[i]}\"}\n parts[k] = 0\n if parts[i] == n\n infolog {\"FINISHED at round##{round}, participant=#{i+1}\"}\n foundpart = i+1\n finished = true\n end\n break\n end\n end\n else\n tracelog {\"part##{i} has nothing, is skipped.\"} unless finished\n end\n end\n end\n foundpart\nend",
"def sort_kids(num_groups)\n kids = self.elemental_session_bookings.map(&:kid_id)\n total_kids = kids.count\n group_quorum = 10\n num_groups = 4\n categories = [\"age\"]\n match_points_arr = []\n\t\n\tif group_quorum < total_kids\n\t\t(0...kids.count).each do |i|\n\t\t\t(0...i).each do |j|\n\t\t\t\t match_points_arr.push({:kids[i]=> kids[j], :match_points => get_match_points(categories, kids[i], kids[j]) })\n\t\t\tend\n\t\tend\n\t\treturn get_best_groups(num_groups, match_points_arr.sort_by { |hash| hash[:match_points].reverse! })\n\tend\n end",
"def top_5\n count = @sentence.blips.group(:body).distinct.count\n percent = count.each {|k, v| count[k] = v / @sentence.blips_count.to_f }\n statistics = percent.sort_by { |k, v| v }.reverse[0..4].flatten.each { |k, v| puts \"#{k}: #{v}\" }\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 one_week_wonders(songs)\n array = []\n songs.each do |song|\n array << song if no_repeats?(song, songs) && array.include?(song) == false\n end\n array\nend",
"def one_week_wonders(songs)\n songs.select {|song| no_repeats?(song, songs)}.uniq\nend",
"def index\n if params[:smart] == \"true\"\n if ducks_yesno[:ducks_yes] && ducks_yesno[:ducks_no]\n yes = ducks_yesno[:ducks_yes]\n no = ducks_yesno[:ducks_no]\n \tgifts = Gift.bests(yes,no)[0..19] \n\n\t\tbest_pertinence = 0\n\n\t\t# parcours tous les cannards, pour chaque cannard calcul la\n\t\t# la pertinence de celui-ci\n\t\tducks = Duck.where.not(id: yes).where.not(id: no)\n\t\tbest_duck = ducks[0]\n\t\tducks.each do |d|\n\t\t\tecart_quadra = 0\n\t\t\tecart_reel = 0\n\t\t\tassociations = d.associations\n\t\t\tgifts.each do |g|\n\t\t\t\ta = associations.where(gift: g).first;\n\t\t\t\tif a \n\t\t\t\t\tecart_quadra += (50-a.value)**2\n\t\t\t\t\tecart_reel += 50-a.value\n\t\t\t\tend\n\t\t\tend\n\t\t\tif ecart_reel == 0\n\t\t\t\tecart_reel =1\n\t\t\tend\n\t\t\tpertinence = ecart_quadra/ecart_reel.abs;\n\t\t\tif pertinence > best_pertinence \n\t\t\t\tbest_duck = d\n\t\t\t\tbest_pertinence = pertinence\n\t\t\tend\n\t\tend\n\t\t@ducks=[]\n\t\t@ducks[0] = best_duck\n else\n if params[:number]\n @ducks = Duck.order(\"RANDOM()\").limit(Integer(params[:number]))\n else\n @ducks = Duck.order(\"RANDOM()\").limit(1)\n end\n end\n else\n @ducks = Duck.all\n end\n \n end",
"def arrangements(open_spots)\n arrangements = 0\n open_spots.each do |array|\n arrangements += array.permutation(5).to_a.size\n end\n arrangements\n end",
"def recursive_mixing(sorted_array, shuffled_array)\n if sorted_array == []\n puts shuffled_array\n elsif shuffled_array.any? && sorted_array != 0\n element_is_mixed = false # Dictates if mixing criteria is satisfied.\n try_counter = 0\n until element_is_mixed\n index = rand(sorted_array.length)\n prior_song = shuffled_array[-1]\n prior_genre = prior_song.split('/')[1]\n current_song = sorted_array[index]\n current_genre = current_song.split('/')[1]\n if prior_genre != current_genre || try_counter == 8 # num of times to try\n shuffled_array.push sorted_array[index]\n sorted_array.delete_at(index)\n recursive_mixing sorted_array, shuffled_array\n element_is_mixed = true\n else\n try_counter +=1\n end\n end\n else\n shuffled_array.push sorted_array[0]\n sorted_array.delete_at(0)\n recursive_mixing sorted_array, shuffled_array\n\n end\nend",
"def index\n @contests = Manage::Contest.order(is_deleted: :desc,id: :desc).to_a\n @contests.sort! do |a,b|\n if a.current_compete != 0\n if b.current_compete != 0\n # 如果两个比赛都有对应的正在进行的赛事,就按比赛数量逆序排列\n b.competes_count <=> a.competes_count\n else\n # 如果只有a有,那么a排前面\n -1\n end\n else\n if b.current_compete != nil\n # 如果只有b有,那么b排前面\n 1\n else\n # 如果都没有,也按照比赛数量逆序排序\n b.competes_count <=> a.competes_count\n end\n end\n end\n\n @competes = @contests[0].competes.order(start_time: :desc)\n if params[:contest]\n current = @contests.find_all {|x| x.id == params[:contest].to_i}\n if current.length > 0\n @current = current[0]\n end\n end\n @current ||= @contests[0]\n end",
"def leaderboard_cyclopeptide_sequencing(spectrum, n)\n # To be fair, a cut should include anyone who is tied with the Nth-place competitor.\n # Thus, Leaderboard should be trimmed down to the “N highest-scoring linear peptides including ties”, \n # which may include more than N peptides. Given a list of peptides Leaderboard, a spectrum Spectrum, \n # and an integer N, define Trim(Leaderboard, Spectrum, N) as the collection of the top N highest-scoring \n # linear peptides in Leaderboard (including ties) with respect to Spectrum.\n\n # Note that Score(Peptide, Spectrum) currently only scores Peptide against Spectrum if Peptide is cyclic. \n # However, to generalize this scoring function when Peptide is linear, we simply exclude those subpeptides\n # of Peptide that wrap around the end of the string, resulting in a function LinearScore(Peptide, Spectrum). \n # For example, if Spectrum is the experimental spectrum of NQEL, then you can verify that LinearScore(Peptide, Spectrum) = 8.\n\n # LEADERBOARDCYCLOPEPTIDESEQUENCING(Spectrum, N)\n # Leaderboard ← {empty peptide}\n # LeaderPeptide ← empty peptide\n # while Leaderboard is non-empty\n # Leaderboard ← Expand(Leaderboard)\n # for each Peptide in Leaderboard\n # if Mass(Peptide) = ParentMass(Spectrum)\n # if Score(Peptide, Spectrum) > Score(LeaderPeptide, Spectrum)\n # LeaderPeptide ← Peptide\n # else if Mass(Peptide) > ParentMass(Spectrum)\n # remove Peptide from Leaderboard\n # Leaderboard ← Trim(Leaderboard, Spectrum, N)\n # output LeaderPeptide \n\n leader_board = []\n leader_peptide = \"\"\n parent_mass = spectrum[-1]\n loop do\n leader_board = expand_peptides(leader_board)\n # puts leader_board.join(\" \")\n leader_board.dup.each do |peptide|\n # puts parent_mass.to_s + \" \" + peptide_mass(peptide).to_s\n if peptide_mass(peptide) == parent_mass\n if linearpeptide_score(peptide, spectrum) > linearpeptide_score(leader_peptide, spectrum)\n leader_peptide = peptide\n end\n elsif peptide_mass(peptide) > parent_mass\n leader_board.delete(peptide)\n end\n end\n # puts leader_board.join(\" \")\n leader_board = leaderboard_trim(leader_board, spectrum, n) \n break if leader_board.empty?\n end\n return peptide_to_mass(leader_peptide)\n end",
"def one_week_wonders(songs)\n songs.each_with_index do |el, index|\n if el == songs[index + 1]\n songs.delete(el)\n end\n end\n songs.uniq\nend",
"def rearrange_questions(questions)\n if (check_threshold)\n return questions\n end\n\n # Initialize local variables\n panel_questions=Hash.new\n panel_scores=Hash.new\n questions_response_count=Hash.new\n sorted_panel_questions=Array.new\n prev_topic=nil\n current_topic=nil\n primary_response_count=0\n sorted_questions=Array.new\n grouped_questions=Array.new\n\n # Loop through questions array and store in a hash with its response counts\n questions.each {\n |question|\n question_type=question.question_type\n current_topic = question_type.parameters.split(\"::\")[0]\n grouping_position= question_type.parameters.split(\"::\").length==1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[0]\n grouping_count= question_type.parameters.split(\"::\").length==1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[1].to_i\n # grouping_position > 1 implies secondary questions among questions grouped by 1|2 logic\n # we need to call to_i method on grouping_position if it is a string\n if grouping_position.to_i<=1\n # create new hash set for new accordion panel\n unless (!current_topic.nil? && (current_topic==prev_topic || prev_topic.nil?))\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic]=sorted_panel_questions\n panel_scores[prev_topic]=panel_score/sorted_panel_questions.length\n\n questions_response_count=Hash.new\n end\n # calculate response count when first checkbox type question comes\n # for the rest of the checkbox questions; assign the same calculated response count\n if question_type.q_type.eql? 'Checkbox'\n unless (!current_topic.eql? prev_topic)\n checkbox_questions=questions.select { |checkbox_question| checkbox_question.question_type.parameters.split(\"::\")[0].eql?(current_topic) }\n primary_response_count= find_number_of_responses_for_checkbox(checkbox_questions)\n end\n # calculate response count for corresponding comment for Rating type of questions\n elsif (question_type.q_type.eql? 'Rating') && (grouping_position.to_i==1)\n current_question_index=questions.index(question)\n curr_question=questions.fetch(current_question_index+1)\n primary_response_count= find_number_of_responses(curr_question)\n else # ungrouped questions\n primary_response_count= find_number_of_responses(question)\n end\n end\n questions_response_count[question.id]= primary_response_count\n prev_topic=current_topic\n }\n\n # Ensure last hash of questions is also included in the final rearranged question array\n unless (questions_response_count.empty?)\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic]=sorted_panel_questions\n panel_scores[prev_topic]=panel_score/questions_response_count.length\n end\n\n # Create final array of rearranged questions by sorting hash of each panel\n panel_scores=Hash[panel_scores.sort_by { |k, v| v }]\n panel_scores.each {\n |key, value|\n panel_questions.fetch(key).each { |question| sorted_questions << question }\n }\n return sorted_questions\n end",
"def prepare_game()\n @letters = @maxwords[rand(@maxwords.size-1)].shuffle\n @candidates = []\n @words.each { |w| @candidates << w if w.build_outof?(@letters) }\n @candidates = @candidates.uniq\t\t# this fixed duplicated entries\n @candidates = @candidates.sort {|x,y| x.length <=> y.length } \n @found_candidates = @candidates.collect { false }\n end",
"def collect_medians\n data = Hash.new\n @data.keys.each { |key|\n nums = @data[key].sort\n data[key] = [nums[nums.length/2]]\n }\n end",
"def one_week_wonders(songs)\n wonders = []\n (1...(songs.length - 1).each do |i|\n # two conditions must be satisfied\n # for it NOT to be a one week wonder\n # song this week is the song from previous week\n # or song this week is the song next week\n if songs[i - 1] == songs[i] or songs[i] == songs[i + 1]\n # if it's already in the not wonders, lets not repear ourselves\n if !not_wonders.include?(songs[i])\n not_wonders << songs[i]\n end\n end\n end\n\n wonders = []\n songs.each do |song|\n # if it is not in the not_wonders list then it is a wonder\n # we should add a song that is already in the wonders list\n if !not_wonders.include?(song) and !wonders.include?(song)\n wonders << song\n end\n end\n\n wonders\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 one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend",
"def one_week_wonders(songs)\n songs.uniq.select { |song| no_repeats?(song, songs) }\nend",
"def list_songs\n temp = Song.all.sort{|songA, songB| songA.name <=> songB.name} #sorting lab, refactor with .with_index(offset=1)?\n counter = 1\n temp.each do |song|\n puts \"#{counter}. #{song.artist.name} - #{song.name} - #{song.genre.name}\"\n counter += 1\n end\n end",
"def techno_percussion len\n self << len.Dist # bass drum\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n # max len is full, min quarter\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.11/h_num) \n\n self << len.Dist # snare\n mapee_last.clear_hits\n mapee_last << [0.25,0.75]\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len/h_num, len/h_num/2) \n \n self << len.Dist # hi\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n mapee_last.hits.move(0.125) # offbeats\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.666/h_num/2) \n \n self\n end",
"def print_tracks tracks\n\tindex = 0\n\twhile index < tracks.length\n\t\tprint_track tracks[index]\n\t\tindex += 1\n\tend\nend",
"def missing_chapters\n traces = @db.get_trace(@manga_data)\n if @todo.size != 0\n @todo = @todo.reject{|e| e[:page] != -1}\n end\n i = 0\n all_data = []\n @links.each do |link|\n all_data << Struct::Data.new(*@manga_data.extract_values_from_link(link), link)\n end\n Utils_misc::sort_chapter_list(all_data).each do |data|\n if traces.count{|_id, _manga_name, vol_value, chap_value| vol_value == data[:volume] && chap_value == data[:chapter]} == 0 &&\n @todo.count{|e| e[:chapter] == data[:chapter]} == 0\n prep_display = \" ( link #{i + 1} / #{@links.size} )\"\n chapter_link(data[:link], prep_display)\n end\n i += 1\n end\n @aff.dump\n end",
"def games_and_players(num1, num2)\n average = []\n total_viewers_for_streamers = 0\n total_viewers_for_games = 0\n #gets top num games from list\n games = Twitch.games.top(:limit => num1)\n games.each do |x|\n streamers = []\n streamer_display_names = []\n #get the top 5 streamers for each game\n x.streams(:limit => num2).each do |yy|\n streamers << yy.channel.display_name\n streamer_display_names << yy.channel.display_name\n #store display name here, use index later to call these names back\n end\n #output who top 5 are and their viewer count\n puts \"================= GAME - #{x.name} =====================\"\n puts \"#{x.name} has #{x.viewer_count} viewers on #{x.channel_count} channels\"\n puts \"That is an average of \" + (x.viewer_count/x.channel_count).to_s + \" per channel.\"\n puts \"The top 5 streamers of this game are currently: \"\n single_game_total = 0\n streamers.each_with_index do |y,i|\n streams = Twitch.streams.get(y)\n follows_hash = Scraper.new(y)\n percent_watching = (streams.viewer_count.to_f/x.viewer_count.to_f*100).round(2)\n puts \"#{i+1}. #{streamer_display_names[i]} with #{streams.viewer_count} viewers. \".ljust(40) + \"That's #{percent_watching}% of the total viewers of this game watching this channel.\".ljust(72) + \"This channel has #{follows_hash.follower_count} followers\"\n total_viewers_for_streamers += streams.viewer_count\n single_game_total += streams.viewer_count\n end\n total2 = (single_game_total.to_f/x.viewer_count.to_f*100).round(2)\n total_viewers_for_games += x.viewer_count\n puts \"\"\n puts \"\".rjust(45) + \"They account for #{total2}% of the game's total viewer count.\"\n 3.times do puts \"\" end\n end\n avg_percent = (total_viewers_for_streamers.to_f / total_viewers_for_games.to_f*100).round(2)\n puts \"That means for these games the top #{num1} streamers are responsible for\"\n puts \"an averge of #{avg_percent}% of the total viewership of their games.\"\n 3.times do puts \"\" end\nend",
"def determine_guess_results\n\t\tb_pegs = 0\n\t\tw_pegs = 0\n\t\tkey = answer.uniq\n\t\tkey.each_with_index do |letter|\n\t\t\tif answer.count(letter) == guess.count(letter)\n\t\t\t\tw_pegs += answer.count(letter)\n\t\t\telsif answer.count(letter) > guess.count(letter)\n\t\t\t\tw_pegs += guess.count(letter)\n\t\t\telsif answer.count(letter) < guess.count(letter)\n\t\t\t\tw_pegs += answer.count(letter)\n\t\t\tend\n\t\tend\n\t\t(0..3).each do |i|\n\t\t\tif answer[i] == guess[i]\t\n\t\t\t\tb_pegs += 1\n\t\t\t\tw_pegs -= 1\n\t\t\tend\n\t\tend\n\t\t[b_pegs, w_pegs]\n\tend",
"def games(meeting, record)\n meeting.each do |play|\n if play[:home_score].to_i > play[:away_score].to_i\n record[play[:home_team]][\"W\"] += 1\n record[play[:away_team]][\"L\"] += 1\n else play[:home_score].to_i < play[:away_score].to_i\n record[play[:away_team]][\"W\"] += 1\n record[play[:home_team]][\"L\"] += 1\n end\n end\n record\nend",
"def index\n drafted_players_list = Player.includes(:team).where(claimed_by: 1).order(\"claim_time asc\")\n drafted_players_size = drafted_players_list.size\n\n @bye_weeks = {}\n ::PlayersController.roster.each do |(k,v)|\n if (k != \"WR/TE\")\n @bye_weeks[k] = Set.new\n end\n end\n\n drafted_players_list.each do |player|\n @bye_weeks[player.position] << player.team.bye\n end\n\n @starting_players = []\n @benched_players = []\n\n starter_positions = []\n bench_positions = []\n\n ::PlayersController.roster.each do |(key,value)|\n count = 0\n (start_limit, _) = value\n drafted_players_list = drafted_players_list.reduce([]) {|dacc, player|\n if (match(key, player.position))\n count += 1\n if (count <= start_limit)\n @starting_players << player\n else\n dacc << player\n end\n else\n dacc << player\n end\n dacc\n }\n if (count < start_limit)\n starter_positions << key\n end\n end\n\n ::PlayersController.roster.each do |(key,value)|\n count = 0\n (start_limit, max_limit) = value\n if max_limit\n limit = max_limit - start_limit\n else\n limit = 0\n end\n drafted_players_list = drafted_players_list.reduce([]) {|dacc, player|\n if (match(key, player.position))\n count += 1\n if (count <= limit)\n @benched_players << player\n else\n raise \"bug\"\n end\n else\n dacc << player\n end\n dacc\n }\n if (count < limit)\n bench_positions << key\n elsif (count == limit)\n # we are at the max\n else\n raise \"#{key}: #{count} >= #{limit}\"\n end\n end\n\n unless (drafted_players_size == @starting_players.size + @benched_players.size)\n raise \"Ug! Bug!\"\n end\n if (drafted_players_list.size > 0)\n raise \"Ack! bug!\"\n end\n\n if (starter_positions.size > 0) \n valid_positions = starter_positions\n elsif (bench_positions.size > 0) \n valid_positions = bench_positions\n else\n valid_positions = []\n end\n\n order = params[:order] || 'proj'\n\n unless ['proj', 'stats'].include?(order)\n raise \"bad order\"\n end\n\n all_available_players = Player.includes(:team).where(claimed_by: nil).order(\"#{order} desc\")\n @highest_ranked = all_available_players\n \n starter_positions_dup = Set.new(starter_positions)\n starter_positions_dup.delete(\"D/ST\")\n starter_positions_dup.delete(\"K\")\n if (starter_positions_dup.empty?)\n @exclude_kicker_defense = select_players(all_available_players, bench_positions, 10)\n else\n @exclude_kicker_defense = []\n end\n\n @available_players = select_players(all_available_players, valid_positions, 10)\n\n @removed_players = Player.includes(:team).where(claimed_by: 0).order(\"claim_time asc\")\n end",
"def create_kob_playoffs\n playoffs = {}\n court = 100\n sorted_users = self.final_poolplay_rankings # returns Team objects\n until sorted_users.empty?\n teams = sorted_users.shift(4).map do |team|\n save_kob_team_to_database(team.user_id, team.team_name, court, true)\n end\n playoffs[court] = teams\n court += 1\n end\n # playoffs => {100: [Teamobjects], 101: [Team_objects]}\n ## => transform into { 100: [team_ids...], 101: [team_ids]}\n ###\n playoffs.keys.each do |court|\n playoffs[court].map! {|team| team.id}\n end\n # create new Team objects for playoffs\n # creates a hash with court ids as keys and array of team ids as values\n # playoffs = hash of team ids separated by court number\n self.save_kob_games_to_database(playoffs, \"playoff\")\n end",
"def followed_artist_tracks\n results = []\n follows.each do |follow|\n response = HTTParty.get(\"https://api.spotify.com/v1/artists/#{follow.artist_id}/top-tracks?country=US\")\n @hash_version = JSON.parse(response.body)\n @hash_version[\"tracks\"].each do |track|\n results << track[\"id\"]\n end\n end\n\n results.shuffle.join(\",\")\n end",
"def rearrange_questions(questions)\n return questions if check_threshold\n\n # Initialize local variables\n panel_questions = {}\n panel_scores = {}\n questions_response_count = {}\n sorted_panel_questions = []\n prev_topic = nil\n current_topic = nil\n primary_response_count = 0\n sorted_questions = []\n grouped_questions = []\n\n # Loop through questions array and store in a hash with its response counts\n questions.each do |question|\n question_type = question.question_type\n current_topic = question_type.parameters.split(\"::\")[0]\n grouping_position = question_type.parameters.split(\"::\").length == 1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[0]\n grouping_count = question_type.parameters.split(\"::\").length == 1 ? nil : question_type.parameters.split(\"::\").last.split(\"|\")[1].to_i\n # grouping_position > 1 implies secondary questions among questions grouped by 1|2 logic\n # we need to call to_i method on grouping_position if it is a string\n if grouping_position.to_i <= 1\n # create new hash set for new accordion panel\n unless !current_topic.nil? && (current_topic == prev_topic || prev_topic.nil?)\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic] = sorted_panel_questions\n panel_scores[prev_topic] = panel_score / sorted_panel_questions.length\n\n questions_response_count = {}\n end\n # calculate response count when first checkbox type question comes\n # for the rest of the checkbox questions; assign the same calculated response count\n if question_type.q_type.eql? 'Checkbox'\n if current_topic.eql? prev_topic\n checkbox_questions = questions.select {|checkbox_question| checkbox_question.question_type.parameters.split(\"::\")[0].eql?(current_topic) }\n primary_response_count = find_number_of_responses_for_checkbox(checkbox_questions)\n end\n # calculate response count for corresponding comment for Rating type of questions\n elsif (question_type.q_type.eql? 'Rating') && (grouping_position.to_i == 1)\n current_question_index = questions.index(question)\n curr_question = questions.fetch(current_question_index + 1)\n primary_response_count = find_number_of_responses(curr_question)\n else # ungrouped questions\n primary_response_count = find_number_of_responses(question)\n end\n end\n questions_response_count[question.id] = primary_response_count\n prev_topic = current_topic\n end\n\n # Ensure last hash of questions is also included in the final rearranged question array\n unless questions_response_count.empty?\n panel_score, sorted_panel_questions = process_panel(questions, questions_response_count)\n panel_questions[prev_topic] = sorted_panel_questions\n panel_scores[prev_topic] = panel_score / questions_response_count.length\n end\n\n # Create final array of rearranged questions by sorting hash of each panel\n panel_scores = Hash[panel_scores.sort_by {|_k, v| v }]\n panel_scores.each do |key, _value|\n panel_questions.fetch(key).each {|question| sorted_questions << question }\n end\n sorted_questions\n end",
"def add_players_to_list(player_list, team_name, eID) #Takes a player list to sort\n # player_list.each_with_index do |item, index| #item is androidID, since 1 androidid is a player\n # if index == 0\n # index+1\n # end\n # if index == 1\n # add_players_to_fb(android_id=item)\n # end\n # if index == 2\n # add_players_to_fb(android_id=item)\n # end\n # if index == 3\n # add_players_to_fb(android_id=item)\n # end\n # if index == 4\n # add_players_to_fb(android_id=item)\n # end\n #\n # end\n # TODO Check if sorting can be done with multiple teams\n player_list.each_with_index do |item, index|\n if index == 0\n add_players_to_fb(item, item, team_name, eID)\n end\n if index == 1\n add_players_to_fb(item, item, team_name, eID)\n end\n if index == 2\n add_players_to_fb(item, item, team_name, eID)\n end\n if index == 3\n add_players_to_fb(item, item, team_name, eID)\n end\n end\n end",
"def sent_proposals\n reversed_matches = Array.new(@group_size)\n @best_proposals.each_with_index do |e, i|\n reversed_matches[e] = i if e\n end\n reversed_matches\n end",
"def moveup\n papers = venue.papers.where(\"listorder < ?\",self.listorder).order(:listorder)\n \n if papers.length == 1\n self.listorder = papers[0].listorder - 1.0\n elsif papers.length > 1\n self.listorder = (papers[papers.length-1].listorder + papers[papers.length-2].listorder) / 2\n end\n end",
"def print_tracks tracks\n index = 0\n while index < tracks.length \n print_track tracks[index]\n index += 1\n end\nend",
"def best_matches(n,user)\n best = []\n connections = []\n\n self.similar_answers.each do |sa|\n best << Answer.find(sa)\n end\n\n best.sort_by! do |element|\n element.connections.where(target_answer_id:self.id).first.weight\n end\n\n best.reverse!\n\n if user.student? && (not user.admin?)\n best[0..n-1].keep_if { |a| a.user_id == user.id }\n else\n best[0..n-1]\n end\n\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 print_tracks tracks\n x = 0\n while x < tracks.length\n print_track(tracks[x])\n x += 1\n end\nend",
"def test_valid_parse\n test_songs, test_kits = SongParserTest.generate_test_data()\n \n assert_equal(120, test_songs[:no_tempo].tempo)\n assert_equal([:verse], test_songs[:no_tempo].flow)\n \n assert_equal(100, test_songs[:repeats_not_specified].tempo)\n assert_equal([:verse], test_songs[:repeats_not_specified].flow)\n \n # These two songs should be the same, except that one uses a kit in the song header\n # and the other doesn't.\n [:example_no_kit, :example_with_kit].each do |song_key|\n song = test_songs[song_key]\n assert_equal([:verse, :verse,\n :chorus, :chorus,\n :verse, :verse,\n :chorus, :chorus, :chorus, :chorus,\n :bridge,\n :chorus, :chorus, :chorus, :chorus],\n song.flow)\n assert_equal(99, song.tempo)\n assert_equal([\"bridge\", \"chorus\", \"verse\"], song.patterns.keys.map{|key| key.to_s}.sort)\n assert_equal(4, song.patterns[:verse].tracks.length)\n assert_equal(5, song.patterns[:chorus].tracks.length)\n assert_equal(1, song.patterns[:bridge].tracks.length)\n end\n \n song = test_songs[:example_with_empty_track]\n assert_equal(1, song.patterns.length)\n assert_equal(2, song.patterns[:verse].tracks.length)\n assert_equal(\"........\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/snare_mono_8.wav\"].rhythm)\n \n song = test_songs[:multiple_tracks_same_sound]\n assert_equal(2, song.patterns.length)\n assert_equal(7, song.patterns[:verse].tracks.length)\n assert_equal([\"agogo\", \"bass\", \"bass2\", \"bass3\", \"bass4\", \"hh_closed\", \"snare\"],\n song.patterns[:verse].tracks.keys.sort)\n assert_equal(\"X...............\", song.patterns[:verse].tracks[\"bass\"].rhythm)\n assert_equal(\"....X...........\", song.patterns[:verse].tracks[\"bass2\"].rhythm)\n assert_equal(\"........X.......\", song.patterns[:verse].tracks[\"bass3\"].rhythm)\n assert_equal(\"............X...\", song.patterns[:verse].tracks[\"bass4\"].rhythm)\n assert_equal(\"..............X.\", song.patterns[:verse].tracks[\"snare\"].rhythm)\n assert_equal(\"X.XXX.XXX.X.X.X.\", song.patterns[:verse].tracks[\"hh_closed\"].rhythm)\n assert_equal(\"..............XX\", song.patterns[:verse].tracks[\"agogo\"].rhythm)\n \n song = test_songs[:with_structure]\n assert_equal([:verse, :verse], song.flow)\n assert_equal(1, song.patterns.length)\n assert_equal(1, song.patterns[:verse].tracks.length)\n assert_equal(\"X...X...\", song.patterns[:verse].tracks[\"test/sounds/bass_mono_8.wav\"].rhythm)\n end",
"def print_tracks tracks\n i = 0\n for i in 0..tracks.length - 1 do\n\t puts '*********************************************'\n\t puts '**************** Track No. ' + (i + 1).to_s + ' ****************'\n\t print_track(tracks[i])\n\t puts ''\n end\nend",
"def tracks(query)\n s = \"\\nsearching for #{query}\\nwith maximum 200 items per pagination\\n\"\n pre = \"\"\n s.split(\"\\n\")[2].length.times{|i| pre << \"**\"}\n puts \"#{pre}#{s}#{pre}\"\n #Soundcloud API gets a limit\n # we need add some param to get next_href\n # so we will get all tracks\n #@total = 0 \n get_tracks(query) do |collection, track| \n filter_and_add_to collection, track\n end\n\n end",
"def scanSameNameWithDifferentSimilarTrackCount()\n problemCount = 0;\n SimilarTracksVersionControl.find(:all, :conditions => [\"version = ? and status = ? and similar_track_count > ?\" , 1, 1, 0]).each do |strack|\n puts \"track_id:\" + strack.track_id.to_s();\n \n\n scs = SimilarTracksVersionControl.find(:all, :order => \"similar_track_count desc\", :limit => 1, :conditions => [\"track_name = ? and track_artist_id = ? and track_id != ? and status = ? and similar_track_count > ?\", strack.track_name, strack.track_artist_id, strack.track_id, 1, 0]);\n status = 0;\n if (scs != nil and !scs.empty?)\n sc = scs.first;\n puts \"matched track_id:\" + sc.track_id.to_s();\n if (strack.similar_track_count < sc.similar_track_count)\n strack.same_name_with_different_similar_track_count_fix = sc.track_id;\n strack.status = 200;\n strack.save();\n puts \"need fix:\" + strack.similar_track_count.to_s + \" < \" + sc.similar_track_count.to_s;\n problemCount = problemCount + 1;\n end\n\n end\n \n \n end #end of loop\n puts \"total needs fix:\" + problemCount.to_s();\n \n end",
"def one_week_wonders(songs)\n uniq_songs = songs.uniq\n uniq_songs.select do |song|\n no_repeats?(song, songs)\n end\nend",
"def defender_autopicker team,limit\n\tpicked_squad = []\n\tplayers = team.source_team.source_players.where(position: 2).order(defending_ability: :desc)\n\ti = 0\n\twhile i < limit do\n\t\tpicked_squad.push players[i][:id]\n\t\ti += 1\n\tend\n\tpicked_squad\nend",
"def sample(option, limit = 3)\n if option == :tracks\n names = shared(:tracks).map{ |item| item.name }\n names.shuffle\n names[0...limit]\n else\n names = top_shared(option, (limit + 2)).map { |item| item[0].name }\n names.shuffle[0...limit]\n end\n end",
"def sample(option, limit = 3)\n if option == :tracks\n names = shared(:tracks).map{ |item| item.name }\n names.shuffle\n names[0...limit]\n else\n names = top_shared(option, (limit + 2)).map { |item| item[0].name }\n names.shuffle[0...limit]\n end\n end",
"def highest_score_from (words)\n highest_scores = []\n scores = []\n\n words.each do |word|\n # calling method above (called score_hash) to create a hash with the particular word and score of each word in the array\n score_hash = {\n words: word,\n scores: score_word(word)\n }\n # shovelling the hashes above into the highest_scores array\n highest_scores << score_hash\n # shoveeling the return of the score_word method above (which is the score) for each of the words in the array\n scores << score_word(word)\n end\n\n # sorts the scores from the scores array above and then makes the changes \"permanent\" with the ! so we can use it in the below iterations.\n sorted_scores = scores.sort!\n winners_room = []\n winner_hash = {}\n # Iterating our way through the above array of hashes\n highest_scores.each do |hash|\n # Iterating through each of those hashes. if the value of the score is equal to the highest member of the sorted_scores array (the largest), the word will then be shovelled into the winner array.\n\n if hash[:scores] == sorted_scores.last\n # putting all the winners with highest score to wait\n winners_room << hash[:words]\n\n end\n shortest_word = 11\n # going thru each player in the winners room to meet top winner\n actual_winner = []\n # actual_actual_winner = \"\"\n\n\n\n actual_actual_winner = []\n winners_room.each do |winner|\n if winner.length == 10\n actual_winner << winner\n\n\n elsif winner.length <= shortest_word\n shortest_word = winner.length\n actual_winner << winner\n\n end\n # actual_actual_winner = []\n actual_actual_winner << actual_winner[0]\n end\n # actual_actual_winner = ''\n # actual_actual_winner = actual_winner.first\n #itterate thru the winner array to account for tie stuff\n # binding.pry\n winner_hash = {\n word: actual_actual_winner[0],\n score: sorted_scores.last\n }\n end\n return winner_hash\nend",
"def sort_naively(players)\n players.group_by(&:rating).sort.reverse.map do |rb|\n rb[1].group_by(&:team_rating).sort.reverse.map do |tb|\n tb[1].group_by(&:conf_rating).sort.reverse.map do |cb|\n cb[1].group_by(&:id).sort.reverse.map do |ib|\n ib[1]\n end\n end.flatten\n end.flatten\n end.flatten\nend",
"def find_possible_solutions(number_of_spells_to_cast)\n self.solutions = {}\n\n start_time = Time.now\n test_spell_combos(number_of_spells_to_cast)\n end_time = Time.now\n\n p \"\"\n p \"Start: #{start_time}\"\n p \"End: #{end_time}\"\n p \"Possible Solutions\"\n pp self.solutions\n end",
"def convolution_cyclopeptide_sequencing(spectrum, n, m, integer_mass)\n convolution = spectral_convolution(spectrum)\n extended_alphabet = restrict(convolution, m)\n #puts extended_alphabet.join(' ')\n leaderboard = Set.new\n leader_peptide = []\n leaderboard << leader_peptide\n leader_score = 0\n mass_parent = spectrum.last.to_i\n puts \"mass_parent #{mass_parent}\"\n # due to consistency constraints, we can only expand by integer masses that appear\n # in the spectrum and in the extended alphabet\n expandables = extended_alphabet & integer_mass\n #puts expandables.join(' ')\n while !leaderboard.empty?\n leaderboard = expand(leaderboard, expandables)\n leaderboard.each do |peptide|\n mass_peptide = mass(peptide)\n if mass_peptide == mass_parent\n # score the peptide cyclospectrum with experimental spectrum\n pep_score = cyclopeptide_scoring(peptide, spectrum)\n if pep_score > leader_score\n leader_peptide = peptide\n leader_score = pep_score\n puts \"new leader with score #{pep_score}: #{leader_peptide.join(' ')}\"\n end \n elsif mass_peptide > mass_parent\n leaderboard.delete(peptide)\n end\n end\n leaderboard = trim(leaderboard.to_set, spectrum, n)\n end\n leader_peptide\nend",
"def dubstep_percussion len\n self << len.Dist # bass drum\n mapee_last.clear_hits\n mapee_last << [0.0]\n self << len.Dist # 2nd bass drum\n mapee_last.clear_hits\n mapee_last << [0.75, 0.875] #two last drum hits\n self << len.Dist # snare\n mapee_last.clear_hits\n mapee_last << [0.5] # third beat\n self << len.Dist # hi hat\n mapee_last.clear_hits\n mapee_last << [0.375,0.625] # off beats\n self << len.Dist # 2nd hi hat\n mapee_last.clear_hits\n mapee_last << [0.125,0.875] # offbeats\n self\n end",
"def one_week_wonders(songs)\n songs.uniq.select {|song|no_repeats?(song,songs)}\n\nend",
"def select_tweeters(followers)\n result = []\n start_time = Time.now\n result_quality = 0\n\n # do grouping\n # should end up with an array of arrays (or nil), where each n-th position in\n # main array represents the array of userids that have n followers.\n grouped_users = [];\n followers.each_with_index do |follower_list, userid|\n list = grouped_users[follower_list.length];\n\n if list.nil?\n list = []\n grouped_users[follower_list.length] = list\n end\n\n list << userid\n end\n top_users = grouped_users.flatten.compact.reverse\n\n # determine top-n users to inspect\n top_n = sqrt(top_users.length)\n top_n = top_users.length / 5 if top_n < 7 # 20%\n top_n = top_users.length / 2 if top_n < 7 # 50%\n top_n = top_users.length if top_n < 7 # 100%\n # top_n = 34\n\n top_users[0..top_n].combination(5) do |combi|\n # array style\n # obtain a list of ALL followers of the chosen users\n follower_list = []\n\n # use concat to avoid creating new arrays\n # or having to flatten the array later\n combi.each { |num| follower_list.concat(followers[num]) }\n\n # remove dupes\n follower_list.uniq!\n\n # remove the candidate users\n combi.each { |num| follower_list.delete(num) }\n\n # update tracker variables if necessary\n if follower_list.size > result_quality\n result = combi\n result_quality = follower_list.size\n end\n\n # if (Time.now - start_time) > 5.985 # 0.25 is the floor\n # break\n # end\n end\n\n return result\nend",
"def heal!(collection)\n memory = {}\n changed = false\n\n collection.select(&:sort_order).sort_by(&:sort_order).each do |item|\n\n if memory[1].nil?\n memory[1] = item\n item.update(sort_order: 1)\n next\n end\n\n # Found duplicate sort_item\n if memory[item.sort_order]\n memory.sort.each do |order, item|\n if not memory[order + 1].present?\n memory[order+1] = item\n item.update(sort_order: order + 1)\n changed = true\n next\n end\n end\n\n next\n end\n\n # Found gap of 1\n if memory[item.sort_order.to_i - 1].nil?\n s = item.sort_order.to_i - 1\n s.times do |n|\n if memory[n].nil?\n memory[n] = item\n item.update(sort_order: n)\n changed = true\n next\n end\n end\n end\n\n if memory[item.sort_order].nil?\n memory[item.sort_order] = item\n next\n end\n\n end\n\n heal! collection if changed\n end",
"def vote \n \t\n voters = Voter.voters_created\n \n politicians = Voter.voters_created.select {|voter| voter if voter.is_a? Politician}\n vote_count = Hash.new(0)\n who_voted_for_whom = Hash.new(0)\n #introduce an element of fairness by varying when candidates get to visit voters \n campaign_stops = politicians.product(voters).shuffle\n\n campaign_stops.each do |stump_speech|\n campaigner = stump_speech[0]\n campaignee = stump_speech[1]\n\n campaigner.stump(campaignee)\n \n #need way to cancel out votes \n\n if campaignee.cast_vote(campaigner)\n puts \"\\tYou bet!\"\n vote_count[campaigner.name] += 1\n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif campaignee.voted == true \n puts \"\\tSorry, I've already voted\"\n puts\n elsif campaignee.cast_vote(campaigner) && (campaigner == campaignee)\n puts \"\\tI am #{campaigner.name}, and I am voting for myself!\"\n vote_count[campaigner.name] += 1 \n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif ( !campaignee.cast_vote(campaigner) ) && ( !campaignee.is_a? Politician )\n puts \"\\tI am not persuded by your logic\"\n puts\n end \n end \n\n sorted_vote_count = vote_count.to_a.sort {|a,b| b[1] <=> a[1]}\n puts\n puts\n puts \"\\t\\tWINNER\"\n puts \"\\tAnd the winner is #{sorted_vote_count[0][0]}!\"\n puts \"\\t\\tWINNER\"\n puts\n puts \"\\tAnd because this is a transparent democracy, here's the vote totals:\"\n puts \n puts \"\\t#{vote_count}\"\n puts\n puts \"\\tAnd let's see who voted for whom so we can purge the disloyal.\"\n puts\n puts \"\\t#{who_voted_for_whom}\"\n\n Process.exit\n end",
"def vote \n \t\n voters = Voter.voters_created\n \n politicians = Voter.voters_created.select {|voter| voter if voter.is_a? Politician}\n vote_count = Hash.new(0)\n who_voted_for_whom = Hash.new(0)\n #introduce an element of fairness by varying when candidates get to visit voters \n campaign_stops = politicians.product(voters).shuffle\n\n campaign_stops.each do |stump_speech|\n campaigner = stump_speech[0]\n campaignee = stump_speech[1]\n\n campaigner.stump(campaignee)\n \n #need way to cancel out votes \n\n if campaignee.cast_vote(campaigner)\n puts \"\\tYou bet!\"\n vote_count[campaigner.name] += 1\n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif campaignee.voted == true \n puts \"\\tSorry, I've already voted\"\n puts\n elsif campaignee.cast_vote(campaigner) && (campaigner == campaignee)\n puts \"\\tI am #{campaigner.name}, and I am voting for myself!\"\n vote_count[campaigner.name] += 1 \n who_voted_for_whom[campaignee.name] = campaigner.name\n puts\n elsif ( !campaignee.cast_vote(campaigner) ) && ( !campaignee.is_a? Politician )\n puts \"\\tI am not persuded by your logic\"\n puts\n end \n end \n\n sorted_vote_count = vote_count.to_a.sort {|a,b| b[1] <=> a[1]}\n puts\n puts\n puts \"\\t\\tWINNER\"\n puts \"\\tAnd the winner is #{sorted_vote_count[0][0]}!\"\n puts \"\\t\\tWINNER\"\n puts\n puts \"\\tAnd because this is a transparent democracy, here's the vote totals:\"\n puts \n puts \"\\t#{vote_count}\"\n puts\n puts \"\\tAnd let's see who voted for whom so we can purge the disloyal.\"\n puts\n puts \"\\t#{who_voted_for_whom}\"\n\n voted_reset\n main_menu\n end",
"def appending_no_wins_to_nominee_winner_results_frequency\n winning_count = winning_results_frequency_for_each_nominee\n no_wins_arr = checking_for_no_wins_results_frequency_for_each_nominee\n\n no_wins_arr.each do |loser| \n if (loser != nil) && (loser != 0)\n winning_count[loser] = 0 \n end\n end\n\n return winning_count\n end",
"def birthdayCakeCandles(ar)\n ar.sort!\n biggest = ar[-1]\n ar.count(biggest)\nend",
"def shuffle_top_measures(measure_ranks, prng)\n max_num_checklist_measures = CAT1_CONFIG['number_of_checklist_measures']\n top = measure_ranks.pop(max_num_checklist_measures + 4).shuffle(random: prng)\n measure_ranks += top\n [measure_ranks, max_num_checklist_measures]\n end",
"def thoughtstream(username, count)\n thoughtstream = []\n self.users_followed_by(username).each do |user|\n thoughtstream.concat self.my_thoughts(user.username,count)\n end\n thoughtstream.sort{ |t1,t2| t2.timestamp <=> t1.timestamp }[0,count]\n end",
"def generate_top_tracks(year)\n weeklycharts = lastfm.user.get_weekly_chart_list(\"pulleasy\")\n weeklycharts.each do |weekly_chart|\n charts = []\n if weekly_chart[\"from\"] > year.to_time.to_i && weekly_chart[\"to\"] < year.next_year.to_time.to_i\n charts << weekly_chart\n end\n end\nend"
] |
[
"0.66730255",
"0.6115911",
"0.605454",
"0.5993541",
"0.5781465",
"0.5744241",
"0.5714921",
"0.569363",
"0.5466948",
"0.54645944",
"0.53755265",
"0.536268",
"0.5361759",
"0.532656",
"0.5316245",
"0.5231652",
"0.523097",
"0.52071446",
"0.51980644",
"0.5172707",
"0.5172007",
"0.51658916",
"0.5158544",
"0.5152086",
"0.5143077",
"0.5122367",
"0.5119551",
"0.510456",
"0.5100639",
"0.5079362",
"0.50758034",
"0.50673205",
"0.50673205",
"0.5066902",
"0.50665873",
"0.5056017",
"0.50514543",
"0.5049008",
"0.5039934",
"0.50385803",
"0.5034468",
"0.50344175",
"0.5027603",
"0.50273126",
"0.5015488",
"0.50047827",
"0.50017387",
"0.5000757",
"0.49990332",
"0.49879932",
"0.49871346",
"0.49776492",
"0.49642226",
"0.49640387",
"0.49633345",
"0.49557617",
"0.49539044",
"0.49533185",
"0.49533185",
"0.4952674",
"0.4952494",
"0.49524227",
"0.49450985",
"0.49410236",
"0.4936976",
"0.4927283",
"0.4926741",
"0.49138677",
"0.49081498",
"0.490643",
"0.49043262",
"0.49000856",
"0.4899758",
"0.48949164",
"0.48906416",
"0.48872992",
"0.48800254",
"0.4878291",
"0.48688316",
"0.48676687",
"0.485744",
"0.48549488",
"0.48505688",
"0.48423147",
"0.48423147",
"0.48255798",
"0.48066637",
"0.4804626",
"0.4792553",
"0.47920525",
"0.477688",
"0.47713977",
"0.47686055",
"0.4763917",
"0.4763917",
"0.47561613",
"0.4755679",
"0.47554392",
"0.47542685",
"0.47542152"
] |
0.617165
|
1
|
Function for logging the response of a stripe request
|
def stripe_handler
begin
result = yield
rescue Stripe::CardError, # Most common error, occurs when card cannot be charged
Stripe::RateLimitError, # Too many requests hit the API too quickly
Stripe::InvalidRequestError, # The request has invalid params
Stripe::AuthenticationError, # Failed to authenticate with stripes api
Stripe::APIConnectionError, # Failed to connect to stripes api
Stripe::StripeError => e # Generic stripe error
if e.json_body
error = {error: e.json_body[:error], status: e.http_status}
else
error = {error: e.message}
end
rescue => e
# Something else happened, completely unrelated to Stripe
Rails.logger.info "500 error"
Rails.logger.info e.message
Rails.logger.info e.backtrace
error = {error: "err_not_stripe"} # The error was not generated by stripe
end
# Return the result or error from the request
return result || error
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def log_response\n log \"SOAP response (status #{@response.code}):\"\n log @response.body\n end",
"def log_response_details(event)\n env = event.payload\n\n if env.response.nil?\n return error do\n \"[#{req_id(env)}] #{req_dest(env)} < #{res_result(env)}\"\n end\n end\n\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} < \" \\\n \"#{env.response_headers.sort.to_h.to_json}\"\n end\n end",
"def log_response response\n if config.logger\n message = config.log_formatter.format(response)\n config.logger.send(config.log_level, message)\n end\n nil\n end",
"def process_response\n LOGGER.debug \"WORLDCAT DISCOVERY - Response from target: #{@response_status}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Headers: #{@response_headers.collect{ |k,v| \"#{k} = #{v}\" }.join(', ')}\"\n #LOGGER.debug \"WORLDCAT DISCOVERY - Body: uncomment line!\"\n LOGGER.debug @response_body\n \n @response_body\n end",
"def log_response_debug(_env, resp, req_id)\n debug { \"{#{req_id}} [IN] #{resp.body}\" }\n end",
"def log_response_info(env, resp, req_id)\n info { \"{#{req_id}} [IN] #{resp.status} #{env.url.path} (#{resp.body&.size || 0})\" }\n end",
"def log(request, response)\n time = Time.new.strftime(\"%Y-%m-%d %H-%M-%S\")\n http_request = \"#{request.http_method} #{request.uri}\"\n http_response = \"#{response.code}\"\n @log_file.puts \"#{++@log_no} -- [#{time}] #{http_request} #{http_response}\"\n end",
"def log_request(request, response)\n puts \"\\nRequest Headers\"\n request.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Headers\"\n response.each {|head,val| puts \"#{head}: #{val}\"}\n puts \"\\nResponse Body\"\n puts response.body\n puts \"\\nResponse Type\"\n puts \"#{response.class} (#{response.code})\"\nend",
"def log_http_call(payload)\n logger.info \"Request[#{payload[:method]}]: #{payload[:uri].to_s}\"\n start_time = Time.now\n response = yield\n logger.info sprintf(\"Response[%s]: %s, Duration: %.3fs\", response.code,\n response.message, Time.now - start_time)\n response\n end",
"def filter_response(request, response)\n finished = \"======= [WebFinger] HTTP REQUEST FINISHED =======\"\n WebFinger.logger.info ['-' * 50, response.dump, finished].join(\"\\n\")\n end",
"def __log(method, path, params, body, url, response, json, took, duration)\n logger.info \"#{method.to_s.upcase} #{url} \" +\n \"[status:#{response.status}, request:#{sprintf('%.3fs', duration)}, query:#{took}]\"\n logger.debug \"> #{__convert_to_json(body)}\" if body\n logger.debug \"< #{response.body}\"\n end",
"def log_http_call(payload); end",
"def log_http_call(payload); end",
"def log_response(response)\n pop_outstanding_request\n super\n end",
"def request_log(request); end",
"def report_response_body(response)\n write_verbose_log(\"Response from Honeybadger: \\n#{response}\")\n end",
"def payment_succeeded\n # log_hook_notification\n order_state_changed_to_paid\n\n render nothing: true, status: 200 # answer to API\n rescue MangoPay::ResponseError => ex\n log_error = ex.message\n rescue => ex\n log_error = ex.message\n ensure\n MangopayLog.create(event: \"payment_succeeded\",\n mangopay_answer: \"Mangopay HOOK - EventType: #{params['EventType']},\n RessourceId: #{params['RessourceId']},\n Date: #{params['Date']}\",\n user_id: @user.id.to_i,\n error_logs: log_error)\n end",
"def log_request(url, headers, body)\n logger = @api.logger\n logger.debug(\"Report request to: '%s'\" % url)\n logger.debug('HTTP headers: [%s]' %\n (headers.map { |k, v| [k, v].join(': ') }.join(', ')))\n logger.debug(body)\n end",
"def log_http(response)\n resp_template = '[http] Response: %s (%s bytes in %s seconds)'\n log_status = (response.status || 0)\n log_total_time = response.total_time.truncate(3)\n\n Wgit.logger.debug(\"[http] Request: #{response.url}\")\n Wgit.logger.debug(\n format(resp_template, log_status, response.size, log_total_time)\n )\n end",
"def call(params)\n log_email(params[:logger], \"RESPONSE\", params[:response])\n end",
"def debug_info(address, body, response)\n puts \"Request: #{address}\"\n puts \"Body: #{body}\"\n puts \"Response: #{response.body}\"\n end",
"def on_complete(env)\n status = env[:status]\n\n logger.tagged(*tags) do\n log_response_status(status) { formatter.response(env) }\n logger.debug { formatter.response_body(env) }\n end\n end",
"def log_request\n \"#{request.ip} - #{session[:login] ? session[:login].name : '-'} [#{Time.now.strftime('%d/%m/%Y:%H:%M:%S %z')}] \\\"#{request.request_method} #{request.path} HTTP\\\" #{response.status} #{response.content_length} #{timer.stop(request.object_id).round(3)}\"\n end",
"def on_success(_request, response)\n response\n end",
"def log_invalid_stripe_request(exception)\n # logs stripe exception\n ActiveSupport::Notifications.instrument 'anyplace.stripe_action.failed', exception\n end",
"def successful_purchase_response\n end",
"def process_stripe_event(req, json)\n log.debug(\"type=data stripe_type=#{json['type']}\")\n case json['type']\n when 'customer.deleted' then stripe_customer_deleted(json, req)\n when 'customer.subscription.updated' then stripe_customer_subscription_updated(json, req)\n when 'customer.subscription.trial_will_end' then stripe_customer_trial_ending(json, req)\n when 'invoice.payment_failed' then stripe_invoice_payment_failed(json, req)\n end\n Rack::Response.new\n end",
"def debug_response(*objects)\n $stderr.puts \"BODY: #{response.body}\"\n $stderr.puts \"FLASH: #{flash.inspect}\"\n debug_objects(objects)\n end",
"def postContract_log( contract_id, date, payment_provider, response, success, amount, currency)\n params = Hash.new\n params['contract_id'] = contract_id\n params['date'] = date\n params['payment_provider'] = payment_provider\n params['response'] = response\n params['success'] = success\n params['amount'] = amount\n params['currency'] = currency\n return doCurl(\"post\",\"/contract_log\",params)\n end",
"def logs_response\n \"\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35272 ttl=52 time=36.9 ms\\n\\u0001\\u0000\\u0000\\u0000\\u0000\\u0000\\u0000]64 bytes from fra07s30-in-f6.1e100.net (173.194.112.102): icmp_req=35273 ttl=52 time=35.3 ms\\n\"\n end",
"def on_response( event )\n # You can access the response data being received using the event object:\n #\n # event.data.gsub!( 'SOMETHING', 'ELSE' )\n #\n #BetterCap::Logger.raw \"\\n#{BetterCap::StreamLogger.hexdump( event.data )}\\n\"\n BetterCap::Logger.info \"No response is working fine!\"\n end",
"def format_response(payload); end",
"def format_response(payload); end",
"def successful_purchase_response\n 'response=1&responsetext=SUCCESS&authcode=123456&transactionid=1869031575&avsresponse=N&cvvresponse=N&orderid=1&type=auth&response_code=100&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end",
"def log_request\n logger.info \"HTTP request received => #{request.fullpath} , params => #{params} \"\n end",
"def log_request_debug(env, req_id)\n debug { \"{#{req_id}} [OUT] #{env.body}\" }\n end",
"def log_request_details(event)\n env = event.payload\n debug do\n \"[#{req_id(env)}] #{req_dest(env)} > \" \\\n \"#{env.request_headers.sort.to_h.to_json}\"\n end\n end",
"def log_success(env, oauth_request)\n log :info, \"OAuthenticator authenticated an authentic request with Authorization: #{env['HTTP_AUTHORIZATION']}\"\n end",
"def log\n @client.get(\"#{path}/log\")\n end",
"def log_request\n result = super\n push_outstanding_request\n result\n end",
"def successful_capture_response\n '?({\"Status\":\"EmAnalise\",\"Codigo\":0,\"CodigoRetorno\":\"\",\"TaxaMoIP\":\"0.46\",\"StatusPagamento\":\"Sucesso\",\"Classificacao\":{\"Codigo\":999,\"Descricao\":\"Nao suportado no ambiente Sandbox\"},\"CodigoMoIP\":207695,\"Mensagem\":\"Requisicao processada com sucesso\",\"TotalPago\":\"1.00\"})'\n end",
"def on_request(env)\n logger.tagged(*tags) do\n logger.info { formatter.request(env) }\n logger.debug { formatter.request_body(env) }\n end\n end",
"def authnet_response\n Caboose.log(\"Authorize.net response for my account, order #{params[:id]}\")\n \n @resp = Caboose::StdClass.new\n @resp.success = true if params[:success]\n @resp.error = params[:error] if params[:error]\n \n # Go ahead and capture funds if the order only contained downloadable items\n @order = Order.find(params[:id])\n if !@order.has_shippable_items?\n capture_resp = @order.capture_funds\n if capture_resp.error\n @resp.success = false\n @resp.error = capture_resp.error\n end \n end \n render :layout => false\n end",
"def stripe_error_handler(stripe_error, status=nil)\n logger.debug(\"[Account] stripe error = #{stripe_error.message}\")\n errors[:customer_id] << stripe_error.message\n self.status = status if status\n return false\n end",
"def log_request\n # REQUEST_LOG.info( {\n # time: Time.now.to_s,\n # ip: request.remote_ip,\n # path: request.path,\n # site: request.host,\n # user_agent: request.user_agent,\n # params: (request.request_parameters.blank? ? request.query_parameters : request.request_parameters),\n # device: sub_group_type,\n # referer_header: referer,\n # current_page_header: current_page,\n # landing_url_header: land_url,\n # visitor_id_header: request.env['HTTP_VISITOR_ID'],\n # session_id_header: request.env['HTTP_SESSION_ID'],\n # visitor_id: visitor_id,\n # session_id: session_id,\n # params: params\n # } )\n end",
"def on_complete(env)\n if env[:body].respond_to?(:error) && env[:body].error?\n @logger.warn env[:raw_body] if WialonApi.log_errors?\n else\n @logger.debug env[:raw_body] if WialonApi.log_responses?\n end\n end",
"def got_response(response)\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 got_response(response)\n case dump_responses_to\n when :stderr, \"stderr\"\n $stderr.puts \"RegApi2.Response:\\n#{response}\"\n when :stdout, \"stdout\"\n $stdout.puts \"RegApi2.Response:\\n#{response}\"\n when Proc\n dump_responses_to.call(response)\n when nil\n ;\n else\n raise ArgumentError.new( \"Bad dump_responses_to field: #{dump_responses_to.inspect}\" )\n end\n nil\n end",
"def record_response(response)\n response[2] = create_recording_response(response[2])\n response\n end",
"def api_response\n {\n payment_nonce_uuid: @gateway_nonce_record.uuid,\n gateway_type: @gateway_type\n }\n end",
"def global_request_logging \n http_request_header_keys = request.headers.keys.select{|header_name| header_name.match(\"^HTTP.*\")}\n http_request_headers = request.headers.select{|header_name, header_value| http_request_header_keys.index(header_name)}\n logger.info \"Received #{request.method.inspect} to #{request.url.inspect} from #{request.remote_ip.inspect}. Processing with headers #{http_request_headers.inspect} and params #{params.inspect}\"\n begin \n yield \n ensure \n logger.info \"Responding with #{response.status.inspect} => #{response.body.inspect}\"\n end \n end",
"def formatted_response\n self.response\n end",
"def request(event)\n log_action_summary(event)\n log_request_details(event)\n log_response_details(event)\n end",
"def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end",
"def response_message(response)\n @last_response = response\n 'HTTP Response status: [' + response.code.to_s + '] ' + reason_phrase(response.code)\n end",
"def failed_purchase_response\n end",
"def _roda_after_90__common_logger(result)\n return unless result && result[0] && result[1]\n\n env = @_request.env\n\n qs = env[\"QUERY_STRING\"]\n query_string = \"?#{ qs }\" unless qs.empty?\n\n length = result[1][\"Content-Length\"]\n length = \"\" if length == \"0\"\n\n LOGGER.request \"#{ env['HTTP_X_FORWARDED_FOR'] || env['REMOTE_ADDR'] || '-' } - \\\"#{ env['REQUEST_METHOD'] } #{ env['SCRIPT_NAME'] }#{ env['PATH_INFO'] }#{ query_string } #{ env['HTTP_VERSION'] }\\\" #{ result[0] } #{ length }\\n\"\n end",
"def response_message(response)\n @last_response = response\n \"HTTP Response status: [#{response.code.to_s}] #{reason_phrase(response.code)}\"\n end",
"def log_request_response(exception = nil)\n super(exception) if exception.present?\n end",
"def _print_out data\n\t\tresponse << \"Someone said: #{data}\"\t\t\t\n\tend",
"def create\n\t\tStripe::WebhookService.new.instrument(params)\n\t\thead :ok\n\t# rescue StandardError\n\t\t# head :unauthorized\n\tend",
"def response\n payload\n rescue Net::OpenTimeout => e\n Rails.logger.debug(e)\n end",
"def log_error(response)\n if response.code.to_i >= 500\n @logger.error \"Request #{@uri} failed: #{response.code}\"\n end\n response\n end",
"def retrieve_payment_data(pay_key)\n api.execute(:PaymentDetails, pay_key: pay_key) do |response|\n if response.success?\n response.payment_info_list.payment_info.each do |payment|\n p \"Receiver: #{payment.receiver.email}\"\n p \"Amount: #{payment.receiver.amount.to_f}\"\n p \"Transaction status: #{payment.transaction_status}\".green\n end\n else\n p \"#{response.ack_code}: #{response.error_message}\".red\n end\n return response\n end\nend",
"def print_client(target_uri, access_token, method)\n return {} if target_uri.nil? || method.nil?\n\n uri = URI.parse(target_uri)\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n\n begin\n req = Net::HTTP::Post.new(uri.request_uri)\n req[\"Content-Type\"] = \"application/json; charset=utf8\"\n req[\"Authorization\"] = \"Bearer #{access_token}\"\n\n response = https.request(req)\n\n puts \"code -> #{response.code}\"\n puts \"body -> #{response.body}\"\n\n case response\n when Net::HTTPSuccess\n body = response.body\n JSON.parse(body)\n else\n puts [uri.to_s, response.value].join(\" : \")\n return nil\n end\n rescue => e\n logger.error [uri.to_s, e.class, e].join(\" : \")\n return nil\n end\n\n end",
"def capture_request(tid, total = nil)\n capture_request = Cielo::CaptureRequest.new\n response = send_request(capture_request.serialize(tid, total = nil, @affiliation, @affiliation_key))\n end",
"def stripe_hook(req)\n json = JSON.parse(req.body.read)\n log.debug(\"type=data stripe_event=#{json}\")\n if json['livemode'] == Lynr.config('app').stripe.live?\n process_stripe_event(req, json)\n else\n Rack::Response.new(\"Live modes do not match\")\n end\n end",
"def render_response_for_get(json_response, options)\n render_response(json_response, options, rest_object_key) do\n record = json_response[rest_object_key]\n print_h1 rest_label, [], options\n print cyan\n print_description_list(rest_column_definitions(options), record, options)\n # show log message settings...\n print_h2 \"Message\", options\n print cyan\n puts record['message']\n print reset,\"\\n\"\n end\n end",
"def log(env, status, header, began_at)\n now = Time.now\n length = extract_content_length(header)\n\n data =\n {\n :remote_ip => env['HTTP_X_FORWARDED_FOR'] || env[\"REMOTE_ADDR\"] || \"?\",\n :remote_user => env[\"REMOTE_USER\"] || \"\",\n :http_method => env[\"REQUEST_METHOD\"],\n :path => env[\"PATH_INFO\"],\n :query => env[\"QUERY_STRING\"].empty? ? \"\" : \"?\"+env[\"QUERY_STRING\"],\n :http_version => env[\"HTTP_VERSION\"],\n :http_status => status.to_s[0..3],\n :content_length => length,\n :duration => now - began_at\n }\n\n logger = @logger || env['rack.errors']\n #logger.write data\n end",
"def log_request_end(logger, status, headers, began_at)\n duration = (Time.now - began_at) * 1000\n\n content_length = if headers['Content-Length']\n headers['Content-Length'].to_s\n else\n '-'\n end\n\n params = [\n duration,\n status,\n content_length,\n ]\n\n logger.info %Q{Completed in %dms | %d | %s bytes} % params\n end",
"def retrieve_response\n session.post(url)\n end",
"def capture(account, merchant, transaction_id)\n url = \"/#{CGI::escape(account)}/transactions/#{transaction_id}/capture\"\n post_json url, {capture_request: {merchant: merchant}}\n expect_status! 'CAPTURED'\n # puts @response.inspect\n end",
"def log_request_info(env, req_id)\n query_string = \"?#{env.url.query}\" if env.url.query\n size = env.body.respond_to?(:size) ? env.body.size : env.request_headers['Content-Length']\n info { \"{#{req_id}} [OUT] #{env.method} #{env.url.path}#{query_string} (#{size || 0})\" }\n end",
"def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n currency: 'sgd',\n customer: params[:customer_id],\n source: params[:card_id]\n })\n\n json_response(charge, :created)\n\n rescue Stripe::InvalidRequestError => exception\n response = Hash.new\n response[:error] = exception.message\n\n json_response(response, :bad_request)\n end\n end",
"def log_response(receiver, response)\n unless response.instance_of? Net::HTTPOK\n LogPoint::write 'Cannot deliver to ' + receiver, 'slack_messages', Logger::WARN\n end\n LogPoint::write(\n sprintf('Processed %s with status %s.', receiver, response.to_s),\n 'inbound',\n Logger::INFO\n )\n\n self\n end",
"def failed_purchase_response\n 'response=2&responsetext=DECLINE&authcode=&transactionid=1869031793&avsresponse=N&cvvresponse=N&orderid=1&type=sale&response_code=200&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end",
"def capture(_, transaction_id, __)\n Response.parse self, api.payment.capture(transaction_id)\n end",
"def send_response(api_response, errors)\n api_response = create_response(api_response, errors)\n\n respond_to do |format|\n @logger.info \"#{Time.now} INFO ### #{request.path} ###\"\n if errors.length > 0\n @logger.info \"#{Time.now} EXCEPTION is: #{errors}\"\n end\n if request.host == 'localhost'\n @logger.info \"#{Time.now} response:#{api_response}\"\n end\n #TODO: Disable it later, enabled for now only\n if Rails.env == \"production\"\n @logger.info \"#{Time.now} INFO ### #{api_response} ###\"\n end\n format.html {\n \n }\n format.json { \n render :json => api_response.to_json, :callback => params[:callback], :content_type => \"text/html\"\n }\n format.js {\n \n }\n format.xml { \n @logger.info \"#{Time.now} #{api_response}\"\n render :xml => api_response\n }\n end\n end",
"def log_request(req)\n message = [req.remote_ip, req.command, req.args.join(' ')].join(' ')\n log.info(message)\n end",
"def log_request\n log \"SOAP request: #{@soap.endpoint}\"\n log soap_headers.merge(headers).map { |key, value| \"#{key}: #{value}\" }.join(\", \")\n log @soap.to_xml\n end",
"def print_results(response)\n puts response.to_json\nend",
"def message\n \"#{super}: #{response.body}\"\n end",
"def print_response_details(response)\n # Parse the mutate response to print details about the entities that\n # were created by the request.\n suffix = \"_result\"\n response.mutate_operation_responses.each do |result|\n result.to_h.select {|k, v| v }.each do |name, value|\n if name.to_s.end_with?(suffix)\n name = name.to_s.delete_suffix(suffix)\n end\n\n puts \"Created a(n) #{::Google::Ads::GoogleAds::Utils.camelize(name)} \" \\\n \"with #{value.to_s.strip}.\"\n end\n end\nend",
"def on_success(request, result)\n request.success(output(request, result))\n end",
"def do_GET(request, _response)\n log_request(request)\n end",
"def create_message(response)\n return if response.nil?\n\n message = \"#{response[:method].to_s.upcase} \"\n message << \"#{response[:url]}: \"\n message << \"#{@status} - #{format_response}\"\n message\n end",
"def relay_response\n sim_response = AuthorizeNet::SIM::Response.new(params)\n if sim_response.success?(AUTHORIZE_NET_CONFIG['api_login_id'], AUTHORIZE_NET_CONFIG['merchant_hash_value'])\n render :text => sim_response.direct_post_reply(\n url_for(:controller => self.controller_name, :action => 'receipt', :only_path => false, \n :gateway => OPTIONS[:gateways][:authorize_net]), \n :include => true)\n else\n # return back to purchase page - will display error message there\n render :text => sim_response.direct_post_reply(\n url_for(:controller => self.controller_name, :action => 'purchase', :only_path => false, \n :order_id => params[:x_invoice_num], :failure => true), \n :include => true)\n end\n end",
"def failed_capture_response\n '?({\"Codigo\":901,\"StatusPagamento\":\"Falha\",\"Mensagem\":\"Instituicao de pagamento invalida\"})'\n end",
"def record!\n if OhMyLog::Log.configuration.print_log\n p \"REQUEST\"\n p @request.to_s\n p \"RESPONSE\" unless @effects.empty?\n @effects.each {|effect| p effect.to_s}\n end\n\n print_into_log\n\n #we can record everything that happend (OPTIONALL)\n if OhMyLog::Log.configuration.record_history\n OhMyLog::Log.history << self\n end\n #We always save the last operation recorded\n OhMyLog::Log.last_recorded = self\n #save this string on file or upload it somewhere\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def info\n country = current_user.country || 'US'\n @success_flag = false\n if current_user.stripe_id.blank?\n begin\n stripe_account = current_user.create_stripe_account({ country: country, type: \"custom\" })\n current_user.update_attributes(stripe_id: stripe_account.id)\n @success_flag = true\n\n @agreement_accepted = Account.new(current_user.stripe_id).acceptance_status\n rescue Exception => e\n @success_flag = false\n end\n end\n respond_to do |format|\n format.js\n end\n end",
"def log\n @log_output.string\n end",
"def stripe_payment\n if params[:stripe_token].blank?\n @error = I18n.t('order.stripe_token_blank')\n render \"api/v1/shared/error\"\n return\n end\n\n begin\n if my_stripe_customer = StripeCustomer.where(:token => params[:stripe_token]).first\n my_stripe_customer.params = \"#{my_stripe_customer.params} , #{params.to_s}\"\n my_stripe_customer.save\n else\n stripe_customer = Stripe::Customer.create(\n :description => \"Customer for Pocket Prints: #{params[:name]}, email: #{params[:email]}, phone: #{params[:phone]}\",\n :card => params[:stripe_token]\n )\n\n stripe_customer_attr = {token: params[:stripe_token], stripe_id: stripe_customer.id, \n name: params[:name], email: params[:email], phone: params[:phone], customer_id: @customer.id,\n device_name: params[:device_name], os_version: params[:os_version], params: params.to_s\n }\n\n my_stripe_customer = StripeCustomer.create(stripe_customer_attr)\n\n #@customer.update_attributes({ name: params[:name], email: params[:email], phone: params[:phone] })\n end\n\n @charge = Stripe::Charge.create(\n :customer => my_stripe_customer.stripe_id,\n :amount => (params[:amount].to_f * 100).to_i,\n :description => \"Payment for Pocket Prints order of Customer: #{params[:name]}, email: #{params[:email]}, phone: #{params[:phone]}\",\n :currency => \"AUD\"\n )\n\n rescue Exception => e\n Airbrake.notify_or_ignore(e) if defined?(Airbrake) && Rails.env.production?\n @error = e.message\n my_stripe_customer.update_attributes({error: @error}) if my_stripe_customer\n @error_code = ERROR_CODES[:stripe_paypal_error]\n \n render \"api/v1/shared/error\"\n return\n end\n end",
"def response_body(response)\n case response\n when Net::HTTPSuccess\n return JSON.parse(response.body)[0]['translations'][0]['text']\n when Net::HTTPUnauthorized\n msg = 'invalid API key?'\n when Net::HTTPServerError\n msg = 'try again later?'\n end\n @progress.logMessage(\"ERROR: #{response.message}\")\n @progress.logMessage(msg) unless msg.nil?\n end",
"def response\n @response\n end",
"def response\n @response\n end",
"def handle_error_response(response)\n # Some errors come back under the `message` key while others are nested\n # under `error`\n error_message = response.body.dig('message') || response.body.dig('error', 'message')\n Rails.logger.error(\"SOLIDUS DRIP | #{error_message}\")\n end",
"def show\n pr params\n pr payu_verify_return\n # IF payed, push to queue - onl once\n # todo\n end"
] |
[
"0.6674754",
"0.6652176",
"0.6446578",
"0.6410689",
"0.64049375",
"0.6279385",
"0.625225",
"0.61161417",
"0.6113425",
"0.60278785",
"0.6017588",
"0.60124356",
"0.60124356",
"0.6006889",
"0.59678406",
"0.5931649",
"0.5894964",
"0.5890001",
"0.5889774",
"0.58886933",
"0.58577573",
"0.58083826",
"0.5768508",
"0.57510966",
"0.5747006",
"0.57126325",
"0.57043934",
"0.57008123",
"0.5661086",
"0.56532604",
"0.56510824",
"0.56001323",
"0.56001323",
"0.55832714",
"0.5577095",
"0.5554863",
"0.55457205",
"0.55349344",
"0.5528926",
"0.55273944",
"0.5486026",
"0.54838115",
"0.5473029",
"0.54549587",
"0.5442796",
"0.54243994",
"0.54070556",
"0.53951573",
"0.53795624",
"0.5353565",
"0.53530425",
"0.5351627",
"0.534865",
"0.53418285",
"0.5325556",
"0.5325556",
"0.5296869",
"0.5292615",
"0.52868915",
"0.5284796",
"0.5270601",
"0.52660793",
"0.5261399",
"0.52587783",
"0.5257883",
"0.5255603",
"0.52539134",
"0.5252255",
"0.5252123",
"0.5251853",
"0.5251048",
"0.5246775",
"0.5241936",
"0.5229744",
"0.5221673",
"0.5221248",
"0.5212229",
"0.5204529",
"0.5204222",
"0.51914114",
"0.5172686",
"0.51576954",
"0.5152684",
"0.51512605",
"0.51465446",
"0.5137958",
"0.5127186",
"0.51110095",
"0.51095754",
"0.51086575",
"0.510056",
"0.510056",
"0.5093887",
"0.5091686",
"0.5091498",
"0.5085614",
"0.5083464",
"0.5083464",
"0.5081681",
"0.5079182"
] |
0.5490677
|
40
|
Run a process ==== Exception Delayer::TooLate :: if already called run() ==== Return node
|
def run
unless @state == :stop
raise Delayer::StateError(@state), 'call twice Delayer::Procedure'
end
@state = :run
@proc&.call
@state = :done
@proc = nil
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def run(node)\n process(node)\n end",
"def run\n info \"Run on node: #{node}\"\n self.status = :running\n node.run self\n end",
"def call\n process\n end",
"def run() end",
"def process_node(node)\n debug \"Process node: #{node}\"\n node.poll\n return unless node.online?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n end",
"def run(_); end",
"def run(_); end",
"def run\n res = nil\n\n t = ::Process.times\n now = Time.now\n utime = t.utime\n stime = t.stime\n\n wall_clock_elapsed = now - last_run\n if wall_clock_elapsed < 0\n save_times(now, utime, stime)\n logger.info \"#{human_name}: Negative time elapsed. now: #{now}, last_run: #{last_run}, total time: #{wall_clock_elapsed}.\"\n return nil\n end\n\n utime_elapsed = utime - last_utime\n stime_elapsed = stime - last_stime\n process_elapsed = utime_elapsed + stime_elapsed\n\n # This can happen right after a fork. This class starts up in\n # pre-fork, records {u,s}time, then forks. This resets {u,s}time to 0\n if process_elapsed < 0\n save_times(now, utime, stime)\n logger.debug \"#{human_name}: Negative process time elapsed. utime: #{utime_elapsed}, stime: #{stime_elapsed}, total time: #{process_elapsed}. This is normal to see when starting a forking web server.\"\n return nil\n end\n\n # Normalized to # of processors\n normalized_wall_clock_elapsed = wall_clock_elapsed * num_processors\n\n # If somehow we run for 0 seconds between calls, don't try to divide by 0\n res = if normalized_wall_clock_elapsed == 0\n 0\n else\n ( process_elapsed / normalized_wall_clock_elapsed )*100\n end\n\n if res < 0\n save_times(now, utime, stime)\n logger.info \"#{human_name}: Negative CPU. #{process_elapsed} / #{normalized_wall_clock_elapsed} * 100 ==> #{res}\"\n return nil\n end\n\n save_times(now, utime, stime)\n\n logger.debug \"#{human_name}: #{res.inspect} [#{num_processors} CPU(s)]\"\n\n return res\n end",
"def run\n node = Node.new(:instance_type => Aws.instance_type, :instance_id => Aws.instance_id)\n node.save\n write_pid\n process_loop\n end",
"def run!\n @state = :running\n end",
"def start_run; end",
"def run(now=Time.now)\n t = nil\n begin\n t = process(now, t)\n end while active\n t\n end",
"def run\n while @running\n step\n end\n end",
"def run\n nil\n end",
"def run?\n return false unless @process\n return true\n end",
"def run\n assign_process_name!\n\n wrap_chain(:start) do\n STDOUT.sync = true\n\n logger.info(\"Engine \\##{id} Running\")\n \n switch_to_effective_user! if (self.class.user)\n\n @state = :running\n end\n end",
"def run\n @pid = fork {\n $0 = \"zeus spawner: #{@name}\"\n pid = Process.pid\n $w_pids.puts \"#{pid}:#{Process.ppid}\\n\"\n puts \"\\x1b[35m[zeus] starting spawner `#{@name}`\\x1b[0m\"\n trap(\"INT\") {\n puts \"\\x1b[35m[zeus] killing spawner `#{@name}`\\x1b[0m\"\n exit 0\n }\n\n @actions.each(&:call)\n\n $LOADED_FEATURES.each do |f|\n $w_features.puts \"#{pid}:#{f}\\n\"\n end\n\n pids = {}\n @stages.each do |stage|\n pids[stage.run] = stage\n end\n\n loop do\n begin\n pid = Process.wait\n rescue Errno::ECHILD\n raise \"Stage `#{@name}` has no children. All terminal nodes must be acceptors\"\n end\n if (status = $?.exitstatus) > 0\n exit status\n else # restart the stage that died.\n stage = pids[pid]\n pids[stage.run] = stage\n end\n end\n\n }\n end",
"def run!\n run\n die\n end",
"def runP()\n @device.runP() ;\n end",
"def run\n self.proc.call\n end",
"def spawn\n raise \"not yet implemented\"\n end",
"def process\n self\n end",
"def run_serial\n @task = Fiber.new do\n begin\n self.instance_exec(*content_arguments, &content)\n rescue Exception => e\n origin.send(:raise, e)\n raise\n end\n end\n end",
"def run()\n end",
"def process_node(node)\n method(:process).super_method.call(node)\n end",
"def run?\n return false unless @process\n return true\n end",
"def run_cmd(input)\n return @session.process(input,false)\n end",
"def process\n # no-op by default\n end",
"def process\n # no-op\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def run\n end",
"def process_command\n @fiber.resume get_result\n end",
"def process_node(node)\n debug \"Process node: #{node}\"\n hook 'pre_node', node\n return if node.skipped?\n node.poll\n hook 'internal_post_node_poll', node\n hook 'post_node_poll', node\n return unless node.ready?\n ready_task = node.ready_task\n return unless ready_task\n ready_task.run\n hook 'post_node', node\n end",
"def spawn_daemon(file,id)\nafile = File.open(file, \"r\")\nafile.each_line do |line|\n\tline.chomp!\n\t(nodeid, ip, lport, dport, sport)=line.split\n\tif(nodeid.to_i == id) # dont forget to convert to int\n\t\tputs \"./srouted -i #{id} -c #{file} -a 1 &\"\n\t system(\"./srouted -i #{id} -c #{file} -a 1 &> /dev/null &\")\n\t\treturn 1 \n\tend\nend\nend",
"def run_cmd(input)\n return self.process(input,false)\n end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def process; end",
"def running; end",
"def running; end",
"def process\n end",
"def start *args\n return self if attached? or running?\n @pid = ::Process.spawn Nutcracker.executable, *command\n Process.detach(@pid)\n sleep 2\n raise \"Nutcracker failed to start\" unless running?\n Kernel.at_exit { kill if running? }\n self\n end",
"def run\n while 1\n sleep(0.2)\n #puts \"bezim \"+@pid.to_s\n end\n end",
"def run\n raise \"Not implemented yet.\"\n end",
"def run\n @wait = 0\n @status = @@statuses[:running]\n while !@finished && @wait == 0 && @status != @@statuses[:error]\n begin\n execState\n rescue\n pp $!\n pp $@\n puts \"An error occured.\"\n @status = :error\n end\n end\n\n # The only way it exits the loop is if the task is finished or waiting.\n @status = @finished ? :finished : :waiting\n end",
"def running?; end",
"def start_run\n # Abstract\n end",
"def start_run\n # Abstract\n end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def child_process(result)\n end",
"def process\n return @args[:process]\n end",
"def run\n end",
"def run\n @hydra.run\n status\n end",
"def run\n @ply = 0\n @nodes = 0\n @root = nil\n start_time = Time.now\n search(-INF, INF, @height)\n return unless @root\n make_move(@root)\n Result.new(generate_fen, @root, @nodes, Time.now - start_time, board)\n end",
"def spawn_daemon(id)\nafile = File.open(\"cp3nodes.conf\", \"r\")\nafile.each_line do |line|\n\tline.chomp!\n\t(nodeid, ip, lport, dport, sport)=line.split\n\tif(nodeid.to_i == id) # dont forget to convert to int\n\t\tsystem(\"./srouted -i #{id} -c cp3nodes.conf &\")\n\t\treturn 1 \n\tend\nend\nend",
"def my_run(options={},&block)\n run_task(Xprobe2::Task.new(options,&block))\n end",
"def run\n @running = true\n begin\n while running?\n self.ir = decode(ram.read(self.pc))\n self.pc += 1\n exec(ir[0], ir[1])\n end\n end \n end",
"def start!\n process.start\n end",
"def run\n @state.run(self)\n end",
"def process(number, processor)\n puts 'STARTING PROCESSING'\n result = processor.call(number)\n puts 'END PROCESSING'\n result\nend",
"def run\n until halted?\n step\n end\n end",
"def run(&block); end",
"def run\n @job = Job.find(params[:id])\n @processing_node = ProcessingNode.find_by_ip_address(request.remote_ip) || ProcessingNode.find(params[:node])\n\n respond_to do |format|\n if @job.run(@processing_node)\n flash[:notice] = 'Job was successfully started.'\n format.html { redirect_to(@job.r_script) }\n format.xml { render :xml => @job.r_script }\n else\n format.html { render :action => \"show\" }\n format.xml { render :xml => @job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def run(&_block)\n return_value = nil\n\n command = catch(:breakout_nav) do # Throws from PryByebug::Commands\n return_value = allowing_other_threads { yield }\n {} # Nothing thrown == no navigational command\n end\n\n # Pry instance to resume after stepping\n @pry = command[:pry]\n\n perform(command[:action], command[:options])\n\n return_value\n end",
"def run!\n @running = true\n \n while @running and (@instruction_pointer < @code.length)\n execute!(fetch!)\n # printf(\"\\t:: %d\\t\", @instruction_pointer)\n end\n \n return nil\n end",
"def run\n @run ||= build_data\n end",
"def run\n \n end",
"def run\n \n end",
"def running=(_arg0); end",
"def run\n run_one_instruction while threads.length > 0\n end",
"def process(&block); end",
"def puppetd_run\n puppet_run_obsorver = TimeObserver.new(@puppet_start_timeout)\n puppet_run_obsorver.start\n\n while puppet_run_obsorver.enough_time?\n is_running = @puppet_mclient.run\n return true if is_running\n\n Astute.logger.debug \"Could not run puppet process \"\\\n \"#{task_details_for_log}. Left #{puppet_run_obsorver.left_time} sec\"\n sleep @puppet_start_interval\n end\n Astute.logger.error \"Problem with puppet start. Time \"\\\n \"(#{@puppet_start_timeout} sec) is over. #{task_details_for_log}\"\n false\n end",
"def run; new.run; end",
"def run\n Kernel.trap(\"CLD\") do \n pid = Process.wait\n remove_runner(pid)\n end\n \n until @finish\n deliveries = check_queue\n deliveries.each do |del|\n if slot_open?(del) && lock_delivery(del)\n puts \"Delivering #{del[\"class\"]}\\##{del[\"method\"]} at #{Time.now}\" unless quiet\n # Close our connection so that we don't get too many weird copies\n Candygram.connection = nil\n child = fork do\n # We're the runner\n set_status(del, 'running')\n package = Wrapper.unwrap(del[\"package\"])\n args = Wrapper.unwrap(del[\"arguments\"])\n result = package.send(del[\"method\"].to_sym, *args)\n finish_delivery(del, result)\n Candygram.connection = nil\n exit\n end\n # We're the parent\n add_runner del[\"class\"], child\n sleep(0.2) # Give connections time to wrap up\n end\n end\n sleep frequency\n end\n until @index.empty?\n sleep(0.1) # We trust our trap\n end\n end",
"def fork # :nodoc\n @cant_fork = true\n nil # important due #work\n end",
"def run(vm)\n while step(vm); end\n end",
"def run_one_instruction\n if paused\n @paused_counter -= 1\n parent.log.debug \"^ T#{id} C:#{parent.cycles} is paused for #{@paused_counter} cycles\"\n if @paused_counter <= 0\n parent.log.debug \"^ T#{id} is unpaused\"\n unpause\n end\n return\n end\n\n instruction = parent.instructions.get_instruction(position_x, position_y)\n parent.log.info \"T#{id} C:#{parent.cycles} Running #{instruction.class} @ #{position_x}, #{position_y} CV: #{instruction.color_value.to_s 16}\"\n instruction.run(self, instruction.color_value)\n parent.log.debug '^ Thread state:'\n parent.log.debug \"^ mw:#{memory_wheel.to_s}\"\n parent.log.debug \"^ s_1:#{stage_1}\"\n parent.log.debug \"^ s_2:#{stage_2}\"\n parent.log.debug \"^ d:#{direction}\"\n parent.log.debug '^ Machine state:'\n parent.log.debug \"^ static: #{parent.memory}\"\n parent.log.debug \"^ output: #{parent.output}\"\n parent.log.debug \"^ input: #{parent.input}\"\n\n #move unless we called here recently.\n move 1 unless instruction.class == Call\n end",
"def exec; end",
"def exec; end",
"def run\n if Process.respond_to?(:fork)\n fork {\n runner = Test::Runner.new(config)\n success = runner.run\n exit -1 unless success\n }\n Process.wait\n else\n runner = Test::Runner.new(config)\n success = runner.run\n exit -1 unless success\n end\n end",
"def run\n catch(:skip) { call }\n finish!\n rescue => e\n fail!\n raise e\n end"
] |
[
"0.71472347",
"0.671742",
"0.60097736",
"0.59764075",
"0.594567",
"0.5941387",
"0.5941387",
"0.5877264",
"0.58155787",
"0.5795012",
"0.57657444",
"0.5727921",
"0.5712136",
"0.5694673",
"0.56898296",
"0.56442374",
"0.5635464",
"0.5593424",
"0.5576404",
"0.5565107",
"0.5563955",
"0.5556297",
"0.5550852",
"0.5550753",
"0.5546498",
"0.5526741",
"0.55209196",
"0.550729",
"0.5504748",
"0.5497009",
"0.5496562",
"0.5496562",
"0.5496562",
"0.5496562",
"0.5496562",
"0.5496562",
"0.5496562",
"0.5485048",
"0.54819375",
"0.5474024",
"0.5457056",
"0.5455539",
"0.5455539",
"0.5455539",
"0.5455539",
"0.5455539",
"0.5455539",
"0.5455539",
"0.5455539",
"0.54468304",
"0.54468304",
"0.5434988",
"0.5427189",
"0.5426418",
"0.54205596",
"0.54202926",
"0.54136884",
"0.5400437",
"0.5400437",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5397624",
"0.5395632",
"0.5389088",
"0.53733724",
"0.536607",
"0.5358537",
"0.5357728",
"0.53525347",
"0.5350842",
"0.5349836",
"0.5337823",
"0.5328946",
"0.5327701",
"0.5324132",
"0.53194636",
"0.53102756",
"0.52975136",
"0.5293235",
"0.5285787",
"0.5285787",
"0.52852505",
"0.52844083",
"0.5282126",
"0.5281933",
"0.52815485",
"0.5270057",
"0.5268029",
"0.52607614",
"0.52555895",
"0.52454084",
"0.52454084",
"0.52450603",
"0.52434546"
] |
0.5646955
|
15
|
Cancel this job ==== Exception Delayer::TooLate :: if already called run() ==== Return self
|
def cancel
unless @state == :stop
raise Delayer::StateError(@state), 'cannot cancel Delayer::Procedure'
end
@state = :cancel
self
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cancel\n return unless incomplete?\n\n # Set the stop flag for all cases.\n self.stop = true\n\n # If the run has a delayed job and it hasn't been locked yet, or it\n # has failed, then we just remove it from the queue directly and\n # mark the run as cancelled.\n unless delayed_job.nil?\n delayed_job.with_lock do\n if delayed_job.locked_by.nil? || !delayed_job.failed_at.nil?\n delayed_job.destroy\n self.state = :cancelled\n self.status_message_key = \"cancelled\"\n end\n end\n end\n\n save\n end",
"def cancel\n to_run.clear\n reset\n current_self\n end",
"def cancel\n return unless @running\n @running = false\n end",
"def cancel\n self.class.cancel(self)\n end",
"def cancel\n @procedure&.cancel\n @cancel = true\n self\n end",
"def cancel\n self.solved(:abort)\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel\n @coordinator.cancel\n\n super\n end",
"def cancel\n throw(:abort)\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n\n get_expression_pool.cancel(@children[0]) if @applied_workitem\n\n unschedule_timeout(nil)\n\n trigger_on_cancel # if any\n\n #super\n @applied_workitem\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n\n unschedule_timeout(nil)\n\n cancel_participant\n\n trigger_on_cancel # if any\n\n @applied_workitem\n end",
"def cancel\n @client.call('unrecur', @jid)\n end",
"def cancel\n @error = :cancelled\n end",
"def cancel!; end",
"def cancel\n # Define this later\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n # TODO: That thing I'm claiming to do in the comments\n super\n end",
"def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end",
"def cancel; end",
"def cancel; end",
"def cancel\n self.break_condition = 1\n end",
"def cancel\n super\nend",
"def cancel\n end",
"def cancel\n end",
"def cancel\n @timers.cancel self\n end",
"def cancel\n @timers.cancel self\n end",
"def cancelled!\n @cancelled = true\n end",
"def cancel!\n # The simplest way to keep track of cancelled status is to nullify the\n # callback. This should also be optimal for garbage collection.\n @callback = nil\n end",
"def cancel(job, project=self.project)\n post('cancel.json', project: project, job: job)['prevstate']\n end",
"def cancel_job job_id, location: nil\n # The BigQuery team has told us cancelling is considered idempotent\n execute backoff: true do\n service.cancel_job @project, job_id, location: location\n end\n end",
"def cancel!\n\t\t\t\t# The simplest way to keep track of cancelled status is to nullify the\n\t\t\t\t# callback. This should also be optimal for garbage collection.\n\t\t\t\t@callback = nil\n\t\t\tend",
"def cancel\n self.update_status :cancelled\n end",
"def cancel\n adapter.delete(job_id) unless completed?\n @info = OodCore::Job::Info.new(id: job_id, status: :completed)\n # persist the session state\n update_cache_completed!\n true\n rescue ClusterNotFound, AdapterNotAllowed, OodCore::JobAdapterError => e\n errors.add(:delete, e.message)\n Rails.logger.error(e.message)\n false\n end",
"def cancel!\n update(request_cancelled: true)\n end",
"def cancel\n return unless pending?\n \n @cancelled = true\n @observers = []\n\n execute_pool.promise_cancelled(self)\n end",
"def cancel_multi ()\n raise Exception, 'not implemented'\n end",
"def cancel\n @queue.each {|action|\n action.stop\n }\n @queue.clear\n unless @current_action == nil\n @current_action.stop\n @current_action = nil\n end\n end",
"def cancelled?; end",
"def cancel\n @observer.cancel if @observer\n if @is_leader\n @timer.cancel\n @is_leader = false\n @client.delete(@path)\n end\n return\n end",
"def cancel_batch\n @batch = nil\n end",
"def cancel_associated_job!\n return unless respond_to?(:background_job_ref) && background_job_ref.present?\n\n ref_parts = background_job_ref.split('%')\n valid_ref_cns = ['delayed__backend__active_record__job'].freeze\n valid_ref_cn = valid_ref_cns.select { |s| s == ref_parts.first }.first\n return unless valid_ref_cn\n\n job = valid_ref_cn.ns_camelize.constantize.find(ref_parts.last.to_i)\n job&.delete\n end",
"def cancel\n @job = Job.find(params[:id])\n logger.debug( 'initiating background cluster termination...' ) \n @job.cancel!\n # Delayed::Job.enqueue ClusterTerminateJob.new(@job)\n flash[:notice] = 'Cancellation request submitted...'\n logger.debug( 'Cancellation request recieved for Job!...' ) \n\n respond_to do |format|\n format.html { redirect_to(jobs_url) }\n format.xml { render :xml => @job }\n format.json { render :json => @job }\n end\n end",
"def cancelJob( job )\n\t\t\t\tcancelled = false\n\t\t\t\t\n\t\t\t\tThread.exclusive {\n\t\t\t\t\tcancelled = ( @jobs.delete( job ) != nil )\n\t\t\t\t}\t\t\t\t\t\n\t\t\t\t\n\t\t\t\treturn cancelled\n\t\t\tend",
"def cancel\n @__status = TaskStatus::CANCELED\n TaskScheduler.remove_task(self)\n Process.kill('QUIT', @__pid) if @__pid&.positive?\n end",
"def cancel element\n element.perform :cancel\n end",
"def cancel\n @service.context.post(@control_path, :action => 'cancel')\n self\n end",
"def cancel!\n if charged && !canceled\n refund!\n recharge!\n end\n end",
"def cancel(id); end",
"def cancellor\n @cancellor ||= Cancellor.new(self)\nend",
"def cancel(encode)\n response = client.cancel_job(id: encode.id)\n build_encode(get_job_details(encode.id), encode.class) if response.successful?\n end",
"def cancel_job(job, error = false)\n report_success(job) if !error && job['on_success']\n report_error(job) if error && job['on_error']\n if JR.config[:remove_cancelled_jobs]\n storage.destroy(job)\n else\n job['status'] = 'cancelled'\n storage.save(job)\n end\n end",
"def cancel!\n # Context is already cleared in action_for_message\n end",
"def cancel!\n @callback = nil\n end",
"def cancel(id)\n response = client.cancel_job(id: id)\n build_encode(get_job_details(id)) if response.successful?\n end",
"def cancel\n # Context is already cleared in before_action\n end",
"def cancel\n @result = :cancel\n $game_system.se_play($data_system.cancel_se)\n end",
"def cancel ; @finished = true ; @buff = '' ; end",
"def on_cancel &b\n @cancel_proc = b\n self\n end",
"def cancel(_fei, flavour)\n # flavour will have 'kill' value if kill_process is invoked instead of cancel_process\n return if flavour\n\n wi = workitem\n params = get_params(wi)\n task_id, action, workflow, task, task_start, task_end = %w(task_id action workflow task task_start task_end).map { |k| params[k] }\n task.add_internal_guards!(workflow.guards[:internal])\n log_participant.canceling(task_id)\n delete_task_info(wi)\n reply_to_engine(wi)\n end",
"def cancel!\r\n return if [:cancel].include? m.status\r\n raise \"Invalid state: message must be new, retry, or fail to cancel!\" unless [:new, :retry, :fail].include? m.status\r\n self.status = :cancel\r\n self.save!\r\n end",
"def stop\n # TODO: can this be elsewhere?\n puts \"Stopping job #{@sandbox.job.id}\"\n\n @thread.kill\n ActiveRecord::Base.clear_active_connections!\n @mutex.synchronize { @thread_status.running = false }\n end",
"def cancel_cli\n generic_step(\"cancel\")\n end",
"def cancel \n unless self.status == 'canceled'\n ev = Event.create(\n :event_type => :subscription,\n :event_subtype => :cancel,\n :user => self.user,\n :detail_i1 => self.id\n ) \n \n Rails::logger.debug \"Calling chargify to cancel subscription ID #{self.chargify_id}\" \n Sherlock::Chargify.new.cancel(self.chargify_id) \n \n Rails::logger.debug \"Adjusting my own status to 'canceled'\" \n \n self.status = 'canceled'\n self.save\n \n ev.finish\n \n InfusionsoftUtils.update_contact(self)\n end\n \n end",
"def cancel_work\n rpc(:work_cancel, :hash).empty?\n end",
"def canceled?\n procedure = @procedure\n if procedure\n procedure.canceled?\n else\n @cancel\n end\n end",
"def cancel\n @active = false\n\t\t\t@timers.remove_sorted self\n end",
"def done_working\n super\n self.job = nil\n end",
"def cancel\n state_change(:cancel) if transition.trigger?(:cancel)\n add_cancel_notifications\n run\n clear_state_notifications\n end",
"def cancel\n\n close_node\n\n do_wrap_cancel_children ||\n pop_on_receive_last ||\n wrap_cancelled\n end",
"def cancel( event )\n result = false\n\n @queue_mutex.synchronize do\n result = self.delete(event)\n event.instance_exec { set_status( :cancelled ) } if result\n end\n\n if result\n @wait_thread.wakeup if self.length > 0 && self.first == event\n CFSM.logger.info \"Cancelled delayed event #{event.inspect}\"\n end\n\n result\n end",
"def _active_stop!\n # NOTHING.\n self\n end",
"def cancel(*args)\n commit('cancel', *args)\n end",
"def __cancel__(what, &blk)\n req = Request.new\n req.verb = Request::Verb::CANCEL\n req.id = what.tag\n\n # Hold on to the tag as unavaiable for reuse until the cancel succeeds.\n @cbx[what.tag] = nil\n\n send(req) do |res|\n # Do not send any more responses from the server to this request.\n @cbx.delete(what.tag)\n blk.call(res) if blk\n end\n end",
"def cancel!\n Bumbleworks.dashboard.cancel_expression(@fei)\n end",
"def cancel()\n @callback = nil\n @cancelled = true\n end",
"def attempt_to_stop\n recipe.schedule.clean_up_task_jobs\n self.stop_time = Time.now.to_datetime\n rhizomes.each do |r|\n r.batch = nil\n r.save!\n end\n stop!\n [:success, \"Stopped <strong>#{name.html_safe}</strong>!\"]\n end",
"def cancel\n\t\tself.status = 'Canceled'\n\t\tself.save(validate: false)\n\tend",
"def cancel!\n self.service.deleteObject()\n end"
] |
[
"0.7778178",
"0.73169965",
"0.7253018",
"0.71046746",
"0.6886759",
"0.6873432",
"0.68421346",
"0.6818729",
"0.6818729",
"0.68068725",
"0.6789899",
"0.674981",
"0.6724411",
"0.66926473",
"0.66926473",
"0.66926473",
"0.66580236",
"0.66544974",
"0.6647577",
"0.6620655",
"0.66133416",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.66035396",
"0.65582776",
"0.655666",
"0.6545724",
"0.6545724",
"0.65273535",
"0.6434538",
"0.6379408",
"0.6379408",
"0.6373409",
"0.6343043",
"0.6342958",
"0.6307501",
"0.6300869",
"0.62986237",
"0.62922657",
"0.6286442",
"0.6271373",
"0.6258348",
"0.62386715",
"0.62294376",
"0.6226617",
"0.6217773",
"0.621187",
"0.6195036",
"0.6172507",
"0.6167638",
"0.61493295",
"0.6119173",
"0.611579",
"0.61134166",
"0.6109879",
"0.6101041",
"0.607991",
"0.6076821",
"0.6027774",
"0.6020525",
"0.6004129",
"0.5960387",
"0.59446424",
"0.5939149",
"0.59390926",
"0.5914668",
"0.5906513",
"0.59003985",
"0.5900138",
"0.58837366",
"0.5882484",
"0.587719",
"0.58764625",
"0.58748263",
"0.5854877",
"0.5831879",
"0.5822979",
"0.5817381",
"0.58092767",
"0.57918006",
"0.5790473",
"0.5790149",
"0.57882154",
"0.5787423",
"0.578426",
"0.5777611"
] |
0.6975411
|
4
|
Return true if canceled this task ==== Return true if canceled this task
|
def canceled?
@state == :cancel
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def canceled?\n @__status == TaskStatus::CANCELED\n end",
"def cancelled?\n false\n end",
"def canceled?\n @current_state == Psc::ScheduledActivity::CANCELED\n end",
"def cancelled?\n return self.status == 'canceled'\n end",
"def rejected?\n self.status == Task::Status::CANCELLED\n end",
"def canceled?\n procedure = @procedure\n if procedure\n procedure.canceled?\n else\n @cancel\n end\n end",
"def cancelled?\n @cancelled\n end",
"def cancelled?\n @cancelled\n end",
"def cancelled?\n return @cancelled\n end",
"def cancelled?\n !@call.status.nil? && @call.status.code == Core::StatusCodes::CANCELLED\n end",
"def cancelled?\n @status == :cancelled\n end",
"def cancelled?\n status_code == 'ABORT'\n end",
"def pending?\n !self.canceled?\n end",
"def canceled?\n #if canceled_on && approved_on && canceled_on.to_time > approved_on.to_time\n if canceled_on != nil\n return true\n else\n return false\n end\n end",
"def cancellable?\n !cancelled? and !missed? and (start_time - Time.now) > CANCELLATION_DEADLINE\n end",
"def can_be_canceled?\n !self.lapsed? \n end",
"def cancel\n return unless @running\n @running = false\n end",
"def cancel?\n self.type == :cancel\n end",
"def cancelled?; end",
"def cancelled?\n (status == CANCELLED)\n end",
"def cancelled?\n\t\t@mutex.synchronize {\n\t\t\t@exception.is_a? Cancel\n\t\t}\n\tend",
"def cancellable?\n status.to_sym.in? [:pending]\n end",
"def can_cancel?\n !canceled? && reserve_start_at > Time.current && actual_start_at.nil? && actual_end_at.nil?\n end",
"def is_canceled?\n return self.status == Erp::Reservations::Reservation::STATUS_CANCELED\n end",
"def is_canceled?\n return self.status == Erp::QuickOrders::Order::STATUS_CANCELED\n end",
"def running?\n\t\t!cancelled?\n\tend",
"def canceled?\n (confirmations.last.try(:confirmed) == false)\n end",
"def ignore_complete?(task)\n !get_result(task).nil?\n end",
"def cancellation_pending?\n if self.state_changed?\n before_after_states = self.state_change.map { |st| st.nil? ? nil : st.to_sym }\n \n # It would be nice if Ruby could do pattern matching (like in Elixir and Scala).\n # We could sure use it here.\n if before_after_states[1] == :canceled\n true\n elsif (before_after_states[0] != :awaiting_sale_docs) && (before_after_states[1] == :ready_for_seller_billing)\n true\n else\n false\n end\n else\n false\n end\n end",
"def cancelled?\n !cancellation_date.nil? && cancellation_reason.present?\n end",
"def cancel? id\n result = false\n @cancel_semaphore.synchronize { result = @cancel.include? id }\n result\n end",
"def cancelled?\n Sidekiq.redis { |c| c.exists(\"cancelled-#{jid}\") }\n end",
"def canceled?\n special_message == \"This talk has been canceled/deleted\"\n end",
"def cancel?(id); end",
"def is_cancelled?\n\n if fe = fexp\n return fe.h.state == 'cancelling'\n else\n true\n end\n end",
"def cancelled!\n @cancelled = true\n end",
"def active?\n !canceled?\n end",
"def cancelled?\n @callback.nil?\n end",
"def cancel_work\n rpc(:work_cancel, :hash).empty?\n end",
"def cancelled?\n @callback.nil?\n end",
"def cancel_enabled?; handle?(:cancel); end",
"def cancelled?\n\t\t\t\t@callback.nil?\n\t\t\tend",
"def cancel\n @__status = TaskStatus::CANCELED\n TaskScheduler.remove_task(self)\n Process.kill('QUIT', @__pid) if @__pid&.positive?\n end",
"def canceled?\n ['canceled', 'unpaid'].include?(status)\n end",
"def cancel_tranzaction()\n\t\tself.tranzaction.reverse_completed_goals(self)\n\t\tself.tranzaction.disable_active_goals(self)\n\n\t\ttrue\n\tend",
"def cancelled?\r\n ['2', '3', '6', '7', '888'].include?(self['trans_status'])\r\n end",
"def canceled_by_user?\n cancel_reason == PAYMENT_CANCELED\n end",
"def cancel\n self.solved(:abort)\n end",
"def cancelled?\n # the establishment has been cancelled by the user\n request_cancelled?\n end",
"def cancel( event )\n result = false\n\n @queue_mutex.synchronize do\n result = self.delete(event)\n event.instance_exec { set_status( :cancelled ) } if result\n end\n\n if result\n @wait_thread.wakeup if self.length > 0 && self.first == event\n CFSM.logger.info \"Cancelled delayed event #{event.inspect}\"\n end\n\n result\n end",
"def cancelled\n !ends_at.nil?\n end",
"def concluded?\n state == :answered || state == :canceled\n end",
"def cancel\n if not @complete\n @complete = ::Libuv::Ext.cancel(@pointer) >= 0\n end\n @complete\n end",
"def ending?\n active? && !canceled_at.nil?\n end",
"def should_stop?\n @time_observer.time_is_up? &&\n FINAL_JOB_TASK_STATUSES.exclude?(@task_status)\n end",
"def cancel\r\n # @todo Emit a warning for attempts to cancel an action after it's been\r\n # executed\r\n @cancelled = true\r\n end",
"def cancel_work\n rpc(action: :work_cancel, param_name: :hash).empty?\n end",
"def destroy\n @collection = @task.collection\n if @task.can_cancel?\n @task.destroy\n success = true\n else\n success = false\n end\n\n respond_to do |format|\n if success\n format.html { redirect_back fallback_location: collection_tasks_path(@collection), notice: 'The task was successfully canceled.' }\n format.json { head :no_content }\n else\n format.html { redirect_back fallback_location: collection_tasks_path(@collection), alert: 'Sorry, the task cannot be canceled.' }\n format.json { head :no_content }\n end\n end\n end",
"def cancellable?\n status.to_sym.in? [StatusNotSent, StatusPending]\n end",
"def cancel\n @error = :cancelled\n end",
"def can_be_canceled?\n return true if actionable_date.nil?\n\n cancel_by = actionable_date - SolidusSubscriptions.configuration.minimum_cancellation_notice\n cancel_by.future? || cancel_by.today?\n end",
"def cancel!\n state_guard { modify_call 'Status' => 'cancelled' }\n end",
"def aborted?\n @aborted\n end",
"def cancel!; end",
"def cancel!\n update(request_cancelled: true)\n end",
"def cancel; end",
"def cancel; end",
"def cancel\n throw(:abort)\n end",
"def cancel\n self.update_status :cancelled\n end",
"def cancel\n end",
"def cancel\n end",
"def cancel\n return unless pending?\n \n @cancelled = true\n @observers = []\n\n execute_pool.promise_cancelled(self)\n end",
"def handle_activity_task_cancel_requested(event)\n activity_id = event.attributes[:activity_id]\n @decision_helper[activity_id].consume(:handle_cancellation_initiated_event)\n end",
"def cancel( event )\n CFSM.logger.info( \"#{namespace.to_s}: cancelling event #{event.inspect}\" )\n\n if event.status( namespace ) == :pending && @event_queue.delete( event )\n set_event_status(event, :cancelled)\n true\n else\n false\n end\n end",
"def complete?\n !pending?\n end",
"def cancel\n self.break_condition = 1\n end",
"def ignore_task?(task)\n why_ignore(task) != :execute\n end",
"def cancel\n # Define this later\n end",
"def cancel!\n if transfer.present? && transfer.complete?\n return!\n update cancelled_at: Time.current\n else\n transfer.destroy! if transfer.present?\n destroy!\n end\n order.update_shipped!\n end",
"def cancelable?\n eventbookingstatus.key != 'cancelled'\n end",
"def finished?\n @__status == TaskStatus::COMPLETED ||\n @__status == TaskStatus::FAULTED ||\n @__status == TaskStatus::CANCELED\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end",
"def cancel\n super\n end"
] |
[
"0.8562416",
"0.7738751",
"0.7672849",
"0.7612788",
"0.7597592",
"0.7509902",
"0.74425554",
"0.74425554",
"0.7420871",
"0.73126084",
"0.7265805",
"0.71293604",
"0.7126879",
"0.7091618",
"0.7024011",
"0.7016525",
"0.7013392",
"0.7001374",
"0.6988741",
"0.69690067",
"0.6925201",
"0.6912304",
"0.6899429",
"0.6864482",
"0.6810425",
"0.68016005",
"0.67988527",
"0.67880803",
"0.676163",
"0.6760219",
"0.6729824",
"0.67263883",
"0.6701683",
"0.66757476",
"0.66678077",
"0.66628563",
"0.6651101",
"0.66459054",
"0.6616174",
"0.65715706",
"0.654248",
"0.6523396",
"0.65047956",
"0.6484108",
"0.6457927",
"0.64553946",
"0.643408",
"0.64317846",
"0.63931555",
"0.638736",
"0.63811374",
"0.63338196",
"0.6321981",
"0.6286218",
"0.6276484",
"0.6270241",
"0.62651265",
"0.6250659",
"0.62202924",
"0.6209499",
"0.6208269",
"0.6207576",
"0.61457103",
"0.6140167",
"0.61314815",
"0.60635924",
"0.60635924",
"0.60360134",
"0.59962666",
"0.5993397",
"0.5993397",
"0.5987271",
"0.59794503",
"0.5964065",
"0.59397876",
"0.5938028",
"0.59326744",
"0.59267807",
"0.5922606",
"0.5921631",
"0.5899405",
"0.58916754",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5890683",
"0.5884451"
] |
0.7894771
|
1
|
insert node between self and self.next ==== Args [node] insertion ==== Return node
|
def break(node)
tail = @next
@next = node
node.next = tail
node
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def insert_after_node(node, to_insert)\n return unless node\n\n new_node = Node.new(to_insert, node, node.next)\n\n if node.next\n node.next.prev = new_node\n end\n\n if node == @tail\n @tail = new_node\n end\n\n node.next = new_node\n @length += 1\n return new_node\n end",
"def insert(node)\n @prv.nxt = node.first if @prv\n node.first.prv = @prv\n node.last.nxt = self\n node\n end",
"def insert(node)\n @tail.next = node\n @tail = @tail.next\n end",
"def insert(node, &block); end",
"def insert(node, &block); end",
"def insert(node)\n\t\t#this is how you link the nodes together\n\t\t@tail.pointer = node\n\t\t#the tail is now equal to the last node that was entered into the linked list\n\t\t@tail = @tail.pointer\n\tend",
"def insert(node)\n case @value <=> node.value\n when 1\n # alphabetically greater than, insert to left\n insert_into(:left, node)\n when 0\n # same value, so increase count of `self` node\n @count += 1\n when -1\n # alphabetically less than, insert to right\n insert_into(:right, node)\n end\n end",
"def insert(node, position)\n node_before_position = index(position-1)\n node_at_position = index(position)\n node_before_position.next = node\n node.next = node_at_position\n @size += 1\n node\n # returns inserted node\n end",
"def insert(node, identifier = nil)\n if identifier\n insert_after(node, identifier)\n else \n node.next = @first_node\n @first_node = node\n end\n end",
"def insert_node\n insert_node_helper(@root)\n end",
"def insertAfter(node, new_node)\n end",
"def insert(data)\n node = Node.new data\n\n if @head.nil?\n node.next_node = node\n else\n # the new node will have the same trailing node as old\n node.next_node = @head.next_node\n # the old head will become the tail\n @head.next_node = node\n end\n\n @head = node\n end",
"def insert(data)\n @head = Node.new(data, @head)\n end",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end",
"def insert_after(value)\n node = Node(value)\n @next = node\n node\n end",
"def insert_before_node(node, to_insert)\n return unless node\n\n new_node = Node.new(to_insert, node.prev, node)\n\n if node.prev\n node.prev.next = new_node\n end\n\n if node == @head\n @head = new_node\n end\n\n node.prev = new_node\n @length += 1\n return new_node\n end",
"def insert data\n\t\treturn insert_next(nil, data) if (self.length == 0)\n\t\treturn insert_next(self.head, data) if (self.length == 1)\n\n\t\t# We have to find the last node and insert the\n\t\t# new node right next to it.\n\t\tself.current = head\n\t\ti = 0;\n\t\twhile ((i += 1) < self.length)\n\t\t\tmove_next\n\t\tend\n\n\t\t# current == \"tail\".\n insert_next(self.current, data)\n\tend",
"def insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n\n end",
"def insert(value, after_node)\n # when insert is called with the tail node\n # then it's the same as append method\n if tail == after_node\n append(value)\n return\n end\n\n # otherwise, you just need to link up\n # the new node with the rest of the list\n after_node.next_node = Node.new(value, after_node.next_node)\n after_node.next_node\n end",
"def insert_tail(node)\n current_node = @root_node\n while current_node.has_next?()\n current_node = current_node.get_next()\n end\n current_node.set_next(node)\n node.set_prev(current_node)\n end",
"def insert(data)\n @head = Node.new(data, head)\n end",
"def insert(root, node)\n\t\tif node.nil?\n\t\t\tnil\n\t\telsif root.nil? \n\t\t\tself.root = node\n\t\telse\n\t\t\tgo_to_bottom(nil,node)\n\t\t\tparent_compare(node, node.parent)\n\t\tend\n\tend",
"def insert(root, node)\n\t\tif node.nil?\n\t\t\tnil\n\t\telsif root.nil? \n\t\t\tself.root = node\n\t\telse\n\t\t\tgo_to_bottom(nil,node)\n\t\t\tparent_compare(node, node.parent)\n\t\tend\n\tend",
"def insert_before(node)\n @prev_node = node.prev_node\n @next_node = node\n node.prev_node.next_node = self\n node.prev_node = self\n self\n end",
"def insert(node, root=nil, &block)\n return super(node, root) do | inserted_node | \n inserted_node.update_left_size(nil, 1) unless inserted_node.nil?\n block.call(inserted_node) if block\n end\n end",
"def insert(idx, node)\n if idx.zero?\n add_first(node)\n return\n end\n\n iterate do |curr_node, count|\n if count == idx - 1\n old_next = curr_node.next_node\n curr_node.next_node = node\n node.next_node = old_next\n old_next.prev_node = node unless old_next.nil?\n node.prev_node = curr_node\n\n return\n end\n end\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 insert(data)\n node = Node.new(data)\n if head.nil?\n @head = node\n else\n @head.push(node)\n end\n end",
"def insert(node)\n if(node.value < @value)\n unless @left==nil\n @left.insert(node)\n else\n @left=node\n @left.root=self\n end\n elsif(node.value >@value)\n unless @right==nil\n @right.insert(node)\n else\n @right=node\n @right.root=self\n end\n else\n @value = node.value\n end\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :after, self, &@match_value)\n self.head = @current if self.head.nil?\n self.tail = @current if self.tail.equal?(node)\n self.size += 1\n end",
"def insert(key, node = root)\n return node if node.data == key\n if child_count(node) == 0\n key < node.data ? node.left = Node.new(key) : node.right = Node.new(key)\n else\n insert(key, left_right(key, node))\n end\n end",
"def insert_head(node)\n if @root_node.nil?\n @root_node = node\n else\n @root_node.set_prev(node)\n node.set_next(@root_node)\n @root_node = node\n end\n current_node = @root_node.get_next()\n while current_node\n current_node = current_node.get_next()\n end\n end",
"def insert_after(value)\n node = DoublyLinkedListNode(value)\n\n # Need to implement this\n\n node\n end",
"def insert(value, node = root)\n return nil if value == node.data\n \n if value < node.data\n node.left.nil? ? node.left = Node.new(value) : insert(value, node.left)\n else\n node.right.nil? ? node.right = Node.new(value) : insert(value, node.right)\n end\n end",
"def insert_node(node)\n raise \"Node must be a leaf\" unless node.is_leaf?\n if (self.view) \n node.position = self.view.get_node_position(node)\n node.visible = self.view.get_node_visibility(node)\n node.search_value = self.view.get_node_search_value(node)\n end\n leafs << node\n end",
"def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end",
"def insert(x, node=self)\n if node.nil? \n node = Node.new(x, self)\n elsif node.val.nil?\n node.val = x\n elsif x < node.val\n if node.left.nil?\n node.left = Node.new(x, node)\n else\n node.left.val = x\n end\n elsif x > node.val\n if node.right.nil?\n node.right = Node.new(x, node)\n else\n node.right.val = x\n end\n end\n return node\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 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 insert(value)\n node = Node.new(value)\n current = @anchor.next_node\n while current != @anchor\n if @comparator.call(node.value, current.value)\n return node.insert_before(current)\n end\n current = current.next_node\n end\n node.insert_before(@anchor)\n end",
"def insert_node(index, word, definition)\n\n counter = 0\n current_node = @head\n previous_node = nil\n\n until counter == index do\n previous_node = current_node\n current_node = current_node.next\n counter += 1\n end\n\n # insert and point to node that was just bumped back\n new_node = Node.new(word, definition, current_node)\n # redirect previous node pointer to the inserted node\n previous_node.next = new_node\n\n end",
"def insert_after(value)\n node = LinkedListNode(value)\n\n node.next = self.next if self.next\n self.next = node\n\n node\n end",
"def insert data\n\t\tnode = Node.new data\n\t\tunless head\n\t\t\tself.head = node\n\t\telse\n\t\t\tnode.prev = self.tail\n\t\t\tself.tail.next = node\n\t\tend\n\t\tself.tail = node\n\t\tself.length += 1\n\tend",
"def insert(word)\r\n n = @root\r\n word.chars.each_with_index do |chr, i|\r\n if !n.next.has_key?(chr)\r\n n.next[chr] = Node.new\r\n end\r\n n = n.next[chr]\r\n end\r\n #puts \"insert n=#{n}\"\r\n\r\n n.is_end = true\r\n end",
"def insert_before(value)\n node = Node(value)\n node.next = self\n node\n end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n self.length += 1\n \n new_node\n\tend",
"def insert data\n\t\tnode = Node.new data\n\t\tunless head\n\t\t\tself.head = node\n\t\telse\n\t\t\tself.tail.next = node\n\t\tend\n\t\tself.tail = node\n\t\tself.length += 1\n\tend",
"def insert(data)\n node_to_insert = SinglyListNode.new(data, nil)\n if @head.nil? && @tail.nil?\n # both and head and tail is empty so make data both\n @head = node_to_insert\n @tail = @head\n else \n @tail.nextNode = node_to_insert\n @tail = node_to_insert\n end\n @length += 1\n end",
"def insert_after(idx, data)\n curr_node = node_at(idx)\n fail ArgumentError, \"index is out of range\" unless curr_node\n new_node = Node.new(data)\n new_node.next_node = curr_node.next_node\n curr_node.next_node = new_node\n end",
"def insert(value, node = @root)\n if node.nil?\n return Node.new(value)\n end\n\n if value > node.value\n node.right_node = insert(value, node.right_node)\n elsif value < node.value\n node.left_node = insert(value, node.left_node)\n end\n\n return node\n end",
"def insert(loc, data)\n if @head.data == nil\n @head = Node.new(data)\n else\n counter = 1\n node = @head\n until counter == loc\n node = node.next_node\n counter += 1\n end\n new_node = Node.new(data)\n new_node.next_node = node.next_node\n node.next_node = new_node\n end\n end",
"def insertHead(node)\n \n if !@head\n @head = node\n else\n node.next = @head\n @head = node\n end\n \n end",
"def insert_node(index, word, definition)\n node_before_index = find_node(index - 1)\n node_at_current_index = find_node(index)\n new_node = Node.new(word, definition, node_at_current_index)\n node_before_index.next_node = new_node\n @counter += 1\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(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value >= value \n\t\t\t@head = Node.new(value, current_node)\n\t\tend \n\t\tuntil current_node.next_node.value =< value \n\t\t\tbreak if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = Node.new(value, current_node.next_node)\n\tend",
"def insert(current_node = root, value)\n # compare nodes,decide if left or right \n return nil if value == current_node.value\n\n if value < current_node.value\n current_node.left.nil? ? current_node.left = Node.new(value) : insert(current_node.left, value)\n else\n current_node.right.nil? ? current_node.right = Node.new(value) : insert(current_node.right, value)\n end\n end",
"def insert (node, splice_position)\n _insert(node, splice_position)\n\n delete_old_nodes\n\n node\n end",
"def insert_after prev_node, new_data\n # 1. check if the given prev_node exists\n if prev_node == nil\n puts \"the given previous node cannot be NULL\"\n end\n # 2. Create new node\n # 3. Put in the data\n new_node = Node.new(new_data)\n # 4. Make next of new Node as next of prev_node\n new_node.next_node = prev_node.next_node\n # 5. make next of prev_node as new_node\n prev_node.next_node = new_node\n # 6. Make prev_node ass previous of new_node\n new_node.prev_node = prev_node\n # 7. Change previous of new_nodes's next node\n if new_node.next_node != nil\n new_node.next_node.prev_node = new_node\n end\n end",
"def insert(word)\n nodes_c = word.chars.map { |c| Node.new(c) }\n\n current = @root\n nodes_c.each do |node|\n existing_node = current.siblings.find { |s| s.val == node.val }\n\n if existing_node\n current = existing_node\n else\n current.siblings << node\n current = node\n end\n end\n\n current.end = true\n end",
"def insert_child\n insert_node('insert_child')\n end",
"def insert( data, node = @root, prev_node = nil, child = \"\" ) \n return prev_node.right_child = Node.new( data ) if node.nil? && child == 'right'\n return prev_node.left_child = Node.new( data ) if node.nil? && child == 'left'\n \n if node.data == data\n return node\n elsif data > node.data\n insert(data, node.right_child, prev_node = node, child = 'right')\n elsif data < node.data\n insert(data, node.left_child, prev_node = node, child = 'left')\n end \n end",
"def push_after(node, new_node)\n new_node.previous_node = node\n new_node.next_node = node.next_node\n node.next_node = new_node\n end",
"def insert_before(node, obj)\n obj = obj.value if obj.is_a?(Node)\n node = Node.new(obj)\n\n if @head == node\n @head = new_node\n new_node.next = node\n else\n previous = node.previous\n previous.next = new_node\n new_node.previous = previous\n new_node.next = node\n end\n self\n end",
"def insert_node(tree_node, value)\r\n\r\n # Base Case: Found a space\r\n if tree_node.nil?\r\n tree_node = Node.new(value)\r\n\r\n elsif tree_node.value == value\r\n tree_node.value = value\r\n elsif tree_node.value < value\r\n tree_node.right = insert_node(tree_node.right, value)\r\n else\r\n tree_node.left = insert_node(tree_node.left, value)\r\n end\r\n tree_node\r\n end",
"def node_insert(node, value)\n if value < node.value\n if node.left\n node_insert(node.left, value)\n else\n node.left = BSTNode.new(value, node)\n end\n else\n if node.right\n node_insert(node.right, value)\n else\n node.right = BSTNode.new(value, node)\n end\n end\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_after(key, to_insert)\n insert_after_node(find(key), to_insert)\n end",
"def insert(data)\n @nodes << data\n heapify_up\n end",
"def insert_node( word, definition, index )\n\n\t\tcount = 0\n\t\tcurrent_node = @head\n\t\tlast_node = nil\n\n\n\t\tlast_node, count = find_node( index )\n\t\tcurrent_node = last_node.next\n\n\t\tif last_node.next.nil?\n\n\t\t\tadd_node( word, definition )\n\n\t\telse\n\n\t\t\tnew_node = Node.new( word, definition )\n\t\t\tnew_node.next = current_node\n\t\t\tlast_node.next = new_node\n\n\t\t\tputs \"Inserted #{new_node.word} at index: #{count}\"\n\n\t\tend\n\n\tend",
"def insert node_data, current_node=@root\n # New node to be inserted\n new_node = Node.new(node_data)\n #BC recursion\n # Check for nil node or nil data\n if current_node.nil?\n current_node = new_node\n elsif current_node.data.nil?\n current_node.data = new_node.data\n end\n # Recursively find an empty branch of the tree\n # Where root node is less than or greater than new node\n # and insert it theres\n\n if new_node.data < current_node.data\n if current_node.left.nil?\n current_node.left = new_node\n current_node.left.data = new_node.data\n elsif current_node.left.data.nil?\n current_node.left.data = new_node.data\n else\n insert(node_data, current_node.left)\n end\n elsif new_node.data > current_node.data\n if current_node.right.nil?\n current_node.right = new_node\n current_node.right.data = new_node.data\n elsif current_node.right.data.nil?\n current_node.right.data = new_node.data\n else\n insert(node_data, current_node.right)\n end\n end\n end",
"def insert(new_value)\n if new_value > @value\n @right ? @right.insert(new_value) : (@right = Node.new(new_value))\n else\n @left ? @left.insert(new_value) : (@left = Node.new(new_value))\n end\n end",
"def insertar(value)\n insert(Node.new(value, nil, nil))\n end",
"def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end",
"def insert node, value= nil\n\t\t\tif value < node.value\n\t\t\t\tnode.left.nil? ? node.left = Node.new(value, node) : insert(node.left, value)\n\t\t\telsif value >= node.value\n\t\t\t\tnode.right.nil? ? node.right = Node.new(value, node) : insert(node.right, value)\n\t\t\tend\t\t\n\tend",
"def append(node)\n if next_node\n next_node.append(node)\n else\n next_node = node\n end\n end",
"def insert(element)\n i = element.hash % @table.size\n node = @table[i]\n while node\n if element == node.item\n node.item = element\n return element\n end\n node = node.next\n end\n @table[i] = Node.new(element,@table[i])\n @count += 1\n return element\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 insert_before(value)\n node = LinkedListNode(value)\n\n node.next = self\n\n node\n end",
"def insert(p0, p1) end",
"def insert_node_between(a, b, new_one)\n a.next = new_one\n new_one.prev = a\n new_one.next = b\n b.prev = new_one\n @length += 1\n end",
"def insert_at!(data, position)\n node, head, tail = set_insert_vars(data, position)\n\n # before: head -> position -> tail\n # after: head -> node -> tail\n head.tail = node if head\n node.tail = tail\n tail.head = node if tail\n node.head = head\n\n # set @tail for list or it will use old tail\n if position.tail?\n @tail = node\n end\n\n # orphan the old node\n position.head = nil\n position.tail = nil\n end",
"def insert(value)\n new_node = Node.new(value)\n @head.prev = new_node if @head\n new_node.next = @head\n @tail = new_node unless @tail\n @head = new_node\n @count += 1\n end",
"def add_node(node); end",
"def insert_next prev_node, data\n\t\tnew_node = Node.new data\n\t\tif self.length == 0\n\t\t\tself.head = new_node.next = new_node\n\t\telse\n\t\t\tnew_node.next = prev_node.next\n\t\t\tprev_node.next = new_node\n\t\tend\n\t\tself.length += 1\n self.hash[data] = new_node\n new_node\n\tend",
"def insert(data)\n if @data.nil?\n @data = data\n else\n if data < @data\n if @left.nil?\n @left = Node.new(data)\n else\n @left.insert(data)\n end\n elsif data > @data\n if @right.nil?\n @right = Node.new(data)\n else\n @right.insert(data)\n end\n end\n end\n end",
"def insert_at(index, insertion)\n prev = get_index(index)\n post = get_index(index+1)\n\n #if index of insertion is bigger than list size it will insert at the end\n if prev.nil?\n @tail.next_node = insertion\n @tail = insertion #problem alert\n @tail.next_node = nil\n else\n prev.next_node = insertion\n insertion.next_node = post\n end\n end",
"def insert_after(pr)\n unless pr.next.nil?\n nx = pr.next\n set_next(nx)\n nx.set_prev(self)\n end\n\n set_prev(pr)\n pr.set_next(self)\n end",
"def insert(position, surname)\n new_node = Node.new(surname)\n current = self[position-1] #self is [] method\n add_to_count\n saved_node = current.next_node\n current.next_node = new_node\n new_node.next_node = saved_node\n return new_node\n end",
"def insert_into(destination, node)\n var = destination.to_s\n\n eval(%Q{\n if @#{var}.nil?\n # not trying to insert into left or right\n @#{var} = node\n else\n # insert into left or right\n @#{var}.insert(node)\n end\n })\n end",
"def insert_by_end(value)\n\t\tif @head.nil?\n\t\t\t@head = @Node.new(value, nil, nil)\n\t\t\t@tail = @head\n\t\telse\n\t\t\t@tail[:next] = @Node.new(value, nil, @tail)\n\t\t\t@tail = @tail[:next]\n\t\tend\n end",
"def insert_at(index, node_value)\n if index == 0\n node = Node.new(node_value)\n node.next_node = @head\n @head = node\n else\n target = at(index)\n if target.nil?\n append(node_value)\n else\n node = Node.new(node_value)\n pre_target = at(index - 1)\n node.next_node = target\n pre_target.next_node = node\n end\n end\n\n node\n end",
"def insert new_value\n if new_value <= @value\n @left.nil? ? @left = Node.new(new_value) : @left.insert(new_value)\n elsif new_value > @value\n @right.nil? ? @right = Node.new(new_value) : @right.insert(new_value)\n end\n end",
"def after(node)\n @parent.insert_after(node, self)\n end",
"def insert(index, element)\n if index == 0\n insert_first(element)\n else\n node_before_index = get(index - 1)\n node_at_index = get(index)\n node_before_index.next_node = element\n element.next_node = node_at_index\n @size += 1\n end\n end",
"def insert(data)\n node = Node.new(data)\n\n if @size == 0\n @root = node\n else\n parent = @root\n\n loop do\n if data <= parent.value\n if !parent.left # found a leaf node\n parent.left = node # insert here\n break\n else\n parent = parent.left\n end\n else # data > node.value\n if !parent.right # found a leaf node\n parent.right = node # insert here\n break\n else\n parent = parent.right\n end\n end\n end\n end\n\n @size += 1\n end",
"def insert(value)\n if @tail\n @tail.next = Node.new(value, @tail)\n @tail = @tail.next\n else\n @head = Node.new(value)\n @tail = @head\n end\n @length += 1\n return @tail\n end",
"def sortedInsert(head, data)\n current_node = head\n new_node = DoublyLinkedListNode.new(data)\n \n if current_node.nil?\n return head = new_node\n elsif current_node.data > data\n new_node.next = current_node\n current_node.prev = new_node\n return head = new_node\n end\n \n while !current_node.next.nil?\n if current_node.next.data > data\n new_node.next = current_node.next\n current_node.next.prev = new_node\n current_node.next = new_node\n new_node.prev = current_node\n return head\n else\n current_node = current_node.next\n end\n end\n \n current_node.next = new_node\n new_node.prev = current_node\n head\nend",
"def insert(index, value)\n if index == @size\n append(value)\n else\n assert_in_range(index)\n \n current, previous = get_node(index)\n inserted = LinkedListNode.new(:successor => current, :value => value)\n previous.successor = inserted if previous\n \n @head = inserted if current == @head \n @size += 1\n end\n end",
"def insert_after(node_or_range, content)\n range = to_range(node_or_range)\n @source_rewriter.insert_after(range, content)\n end",
"def sortedInsert(head, data)\n new_node = DoublyLinkedListNode.new(data)\n return new_node if head.nil?\n\n current_node = head\n \n if current_node.data > new_node.data\n new_node.next = current_node\n current_node.prev = new_node\n return new_node\n end\n\n while current_node.next && current_node.next.data < data\n head = head.next\n end\n\n new_node.next = current_node.next\n new_node.prev = current_node\n current_node.next = new_node\n new_node.next.prev = new_node if new_node.next\n\n head\nend",
"def insert_node(new_node_val)\n new_node = Node.new(new_node_val)\n @nodes << new_node\n @_node_map[new_node_val] = new_node\n new_node\n end"
] |
[
"0.7488942",
"0.7483634",
"0.74735194",
"0.7460311",
"0.7460311",
"0.7416949",
"0.71785975",
"0.71664536",
"0.71119",
"0.70905745",
"0.7068291",
"0.7030186",
"0.6966358",
"0.6958689",
"0.69403976",
"0.6927717",
"0.69160783",
"0.69002104",
"0.68977463",
"0.6720663",
"0.6717468",
"0.67104816",
"0.67104816",
"0.6707804",
"0.6684346",
"0.6660746",
"0.6653803",
"0.66379696",
"0.6629505",
"0.6628988",
"0.6600035",
"0.6592439",
"0.6578416",
"0.65635145",
"0.6562694",
"0.65394944",
"0.65298486",
"0.65249944",
"0.6522257",
"0.6516985",
"0.6516464",
"0.6499041",
"0.6487347",
"0.6465052",
"0.64518994",
"0.6446924",
"0.6438451",
"0.6426536",
"0.64065385",
"0.6392437",
"0.63635147",
"0.6351729",
"0.63479245",
"0.63476104",
"0.63465077",
"0.63450366",
"0.6340402",
"0.63308173",
"0.63299835",
"0.6319876",
"0.6316038",
"0.6310073",
"0.6304069",
"0.62825304",
"0.6267749",
"0.6265861",
"0.6241222",
"0.62225103",
"0.6219795",
"0.62055564",
"0.62052286",
"0.61956364",
"0.6194652",
"0.61907583",
"0.61725456",
"0.617052",
"0.6166159",
"0.61511326",
"0.61494553",
"0.61465406",
"0.61465037",
"0.6145509",
"0.6140291",
"0.61325717",
"0.6123377",
"0.61226594",
"0.61185735",
"0.6105802",
"0.610045",
"0.6093309",
"0.6088621",
"0.6083213",
"0.60684955",
"0.60675526",
"0.60652196",
"0.6057041",
"0.605124",
"0.60437894",
"0.6040408",
"0.6034331",
"0.60321987"
] |
0.0
|
-1
|
A getter for `gradle_task`, returning 'spotbugsRelease' if value is nil.
|
def gradle_task
@gradle_task ||= 'spotbugsRelease'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def gradle_task\n @gradle_task ||= \"ktlintCheck\"\n end",
"def get_task(task_name)\n if using_rake? and task_defined?(task_name)\n Rake::Task[task_name]\n end\n end",
"def release\n @release ||= ENV[\"RELEASE\"] || \"1\"\n end",
"def get_release(project)\n info = get_github_api(project, \"releases\")\n release = 'master'\n if info.length > 0\n unpublishedDraftLimit = 5\n x = 0\n release = info[x]['tag_name']\n # Unpublished drafts need to be skipped.\n while (unpublishedDraftLimit > x) && info[x]['draft']\n release = info[x]['tag_name']\n x += 1\n end\n end\n release\n end",
"def gradle_version\n @gradle_version ||= begin\n version = Licensed::Shell.execute(@executable, \"--version\").scan(/Gradle [\\d+]\\.[\\d+]/).last.split(\" \").last\n Gem::Version.new(version)\n end\n end",
"def sonar_task_id\n @sonar_task_id ||= task_id(@options['sonar_task_name'] || 'Sonar Plugin')\n end",
"def task_get(task_name)\n tasks.fetch prepare_key(task_name), nil\n end",
"def task_title\n return @task_title if @task_title\n task.nil? ? \"\" : task.title \n end",
"def current_task_name\n return nil unless enabled?\n self.class.current_task_name\n end",
"def getTaskName\r\n\t\t\t\t\treturn @taskName\r\n\t\t\t\tend",
"def rake_task_name\n ENV['RAKE_TASK'].to_s.sub(/(?:r?spec|cucumber):?(.*)/, '\\1').upcase\n end",
"def taskNull \n \"taskNull\" \n end",
"def task\n return @task\n end",
"def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end",
"def task\n @keys[:task]\n end",
"def jenkins_task_id\n @jenkins_task_id ||= task_id(@options['jenkins_task_name'] || 'jenkins sync')\n end",
"def project_name\n return project.nil? ? \"nil\" : project.name\n end",
"def getTaskURL\r\n\t\t\t\t\treturn @taskUrl\r\n\t\t\t\tend",
"def ignore_project?(task)\n task == :taxonomy && project.option(:ref_project).nil?\n end",
"def determine(distro, release)\n return distro_releases[[distro, release]] if distro_releases.has_key? [distro, release]\n return distros[distro] if distros.has_key? distro\n default\n end",
"def task_name\n @default_options.fetch(:name, nil)\n end",
"def skip_gradle_task\n @skip_gradle_task ||= false\n end",
"def skip_gradle_task\n @skip_gradle_task ||= false\n end",
"def project_slug\n DeliveryGolang::Helpers.project_slug(node)\n end",
"def get_last_release\n r = api_get(\"/releases\")\n\n return r[0]['tag_name']\nend",
"def project_slug\n DeliveryTruck::Helpers.project_slug(node)\n end",
"def gradle_task(options)\n \tgradle(\n \t\ttask: \":#{ENV[\"SCHEME\"]}:#{options[:task]}\",\n \t\tprint_command_output: true\n \t)\n end",
"def get_task_ref(task)\n Chef::Log.debug \"Waiting on task #{task}\"\n wait_on_task(task)\n status_ = xapi.task.get_status(task)\n\n case status_\n when 'success'\n puts \"#{h.color \"#{status_}\", :green }\"\n # xapi task record returns result as <value>OpaqueRef:....</value>\n # we want the ref. this way it will work if they fix it to return jsut the ref\n ref = xapi.task.get_result(task).match(/OpaqueRef:[^<]+/).to_s\n\n # cleanup our task\n xapi.task.destroy(task)\n return ref\n else\n ui.msg(\"#{h.color \"#{status_}\", :red } \")\n ui.msg(\"#{h.color 'ERROR:', :red } #{xapi.task.get_error_info(task)}\")\n end\n end",
"def get_latest_build_number(project)\n raise \"#{self.class}#get_latest_build_number not implemented\"\n end",
"def project_name\n DeliveryGolang::Helpers.project_name(node)\n end",
"def task\n @task ||= default_task # rubocop:disable ThreadSafety/InstanceVariableInClassMethod\n end",
"def get_release_version_type\n number = prompt \"What type of release is this?\\n1) Major\\n2) Minor\\n3) Patch\\nSelect option number: \"\n bump_version({\"1\" => \"major\", \"2\" => \"minor\", \"3\" => \"patch\"}[number])\n end",
"def project\n self.format.try(:project)\n end",
"def get_latest_release_tag\n\trooturl = get_svn_repo_root()\n\treleaseurl = rooturl + \"/#{SVN_RELEASES_DIR}\"\n\t\n\ttags = svn_ls( releaseurl ).grep( RELEASE_VERSION_PATTERN ).sort_by do |tag|\n\t\ttag[RELEASE_VERSION_PATTERN].split('.').collect {|i| Integer(i) }\n\tend\n\treturn nil if tags.empty?\n\n\treturn releaseurl + '/' + tags.last\nend",
"def getTaskId\r\n\t\t\t\t\treturn @taskId\r\n\t\t\t\tend",
"def get_task_ref(task)\n wait_on_task(task)\n case xapi.task.get_status(task) \n when \"success\"\n # xapi task record returns result as <value>OpaqueRef:....</value> \n # we want the ref. this way it will work if they fix it to return jsut the ref\n ref = xapi.task.get_result(task).match(/OpaqueRef:[^<]+/).to_s\n #cleanup our task\n xapi.task.destroy(task)\n return ref\n else \n ui.msg( \"#{h.color 'ERROR:', :red } Task returned: #{xapi.task.get_result(task)}\" )\n return nil\n end\n end",
"def external_task\n output[:task]\n end",
"def release\n warn 'Rhino does not yet support --release' if options[:release]\n 'rhino1_7R2'\n end",
"def get_name(task_name)\n @view.get_name(task_name)\n end",
"def get_build_type(site, product_id, product_version)\n if is_stable_version(product_version)\n return :stable\n elsif is_nightly_version(product_version)\n return :nightly\n else\n return :development\n end\n end",
"def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end",
"def task_name\n raise \"This Stage has not been bound to a name\" if @name.nil?\n name.name\n end",
"def find_legacy_scheduling_type\n strong_memoize(:find_legacy_scheduling_type) do\n needs.exists? ? :dag : :stage\n end\n end",
"def StripReleaseNo(pkg_name)\n build_no_pos = Builtins.findlastof(pkg_name, \"-\") # find trailing build no.\n\n if build_no_pos != nil && Ops.greater_than(build_no_pos, 0)\n # cut off trailing build no.\n pkg_name = Builtins.substring(pkg_name, 0, build_no_pos)\n end\n\n pkg_name\n end",
"def get_build_type(site, product_id, product_version)\n if is_nightly_version(product_version)\n return :nightly\n elsif is_unreleased_version(site, product_id, product_version)\n return :unreleased\n elsif is_stable_version(product_version)\n return :stable\n else\n return :development\n end\n end",
"def repository_name\n @repository_name ||= \"#{project_name}-boshrelease\"\n end",
"def description\n value = super\n if value.blank? and package_branch.present? and package_branch.version_tracker.present?\n package_branch.version_tracker.description\n else\n value\n end\n end",
"def get_last_task_name\n line = ''\n IO.popen(\"tail -n 1 #{TRACK_FILE}\") { |f| line = f.gets }\n if line == nil\n return false\n end\n\n line = line.split \"\\t\"\n if running_task?\n line.pop\n else\n line.pop 2\n end\n line.join \"\\t\"\n end",
"def project_name\n self.project ? self.project.name : NOT_SET\n end",
"def getRakeTarget\n initialize_RakeProcesses(:LstDeliverableNames => @LstDeliverableNames)\n generateRakeFor_Deliver\n\n return :Deliver\n end",
"def release\n warn 'Envjs does not yet support --release' if options[:release]\n 'edge'\n end",
"def name\n\t\t\t@task\n end",
"def get_app_version_name()\n return get_version_code(\n #app_folder_name:\"project\"\n gradle_file_path:\"build.gradle\",\n ext_constant_name:\"versionName\"\n )\nend",
"def force_task?(task)\n !!metadata[\"run_#{task}\"]\n end",
"def what_task\n if running_task?\n puts \"Current task: \" + get_last_task_name + \", #{(Time.now.to_i - get_last_task_stime.to_i).duration}\"\n else\n puts \"No task running!\"\n end\n end",
"def release_to\n unless @release_to\n value = (Buildr.settings.user['repositories'] && Buildr.settings.user['repositories']['release_to']) \\\n || (Buildr.settings.build['repositories'] && Buildr.settings.build['repositories']['release_to'])\n @release_to = Hash === value ? value.inject({}) { |hash, (key, value)| hash.update(key.to_sym=>value) } : { :url=>Array(value).first }\n end\n @release_to\n end",
"def resolve_tag\n version = extract_version\n tag = Release.tag_name || version\n tag = tag.call(version) if Proc === tag\n tag\n end",
"def resolve_tag\n version = extract_version\n tag = Release.tag_name || version\n tag = tag.call(version) if Proc === tag\n tag\n end",
"def find_task(name)\n name = name.to_sym unless name.nil?\n @tasks[name]\n end",
"def get_version(project)\n branch = get_release(project)\n build_file = get_github_file(project, branch, \"build-dkan.make\")\n version = build_file.scan(/\\[tag\\] = (.+)/)\n if version.to_a.length == 0\n version = build_file.scan(/\\[branch\\] = (.+)/)\n end\n version\n end",
"def _get_task_by_name(task_name)\n @tasks.each do |t|\n return t if t.name == task_name\n end\n raise \"Unknown Task!\" # couldn't find it. boo.\n end",
"def get_identifier\n return @task_arn\n end",
"def project\n threaded[:project]\n end",
"def get_build_number()\n return ENV['DOCS_BUILD_NUMBER'] || \"HEAD\"\n end",
"def require_release_build\n if ENV[\"BUILD_STYLE\"] != 'Release'\n log_message(\"Deployment target requires 'Release' build style\")\n exit\n end\n end",
"def release_name\n return nil unless @data['name'] && @data['version']\n [ dashed_name, @data['version'] ].join('-')\n end",
"def task_defined?(task_name) \n lookup(task_name) != nil\n end",
"def value\n val = @thread.value\n unset_thread_task\n val\n end",
"def get_task_type_name(id=false)\n if id == 1\n \"Document\"\n elsif id == 2\n \"Discussion\"\n elsif id == 3\n \"Charting\"\n elsif id == 4\n \"Off-line\"\n else\n \"None\"\n end\n end",
"def ignore_task?(task)\n return true unless is_active?\n return !metadata[\"run_#{task}\"] unless metadata[\"run_#{task}\"].nil?\n return true if task==:taxonomy and project.metadata[:ref_project].nil?\n pattern = [true, false]\n ( [@@_EXCLUDE_NOREF_TASKS_H[task], is_ref? ]==pattern or\n [@@_ONLY_MULTI_TASKS_H[task], is_multi? ]==pattern or\n [@@_ONLY_NONMULTI_TASKS_H[task], is_nonmulti?]==pattern )\n end",
"def get_build_type_label(site, product_id, product_version)\n stream = site.products[product_id].streams.select{|stream_id, versions| versions[product_version] != nil}.values.first\n build_type_label = nil\n unless stream.nil?\n info = stream.select{|build_version, build_info| build_version == product_version}.values.first\n build_type_label = info[:build_type] unless (info[:archived] == true)\n #puts \" #{product_id} #{product_version} build type: '#{build_type_label}'\"\n end\n return build_type_label\n end",
"def task\n Camunda::Task.find_by_business_key_and_task_definition_key! business_key, task_key\n end",
"def getReleaseTag(release)\n return sh(\"git rev-parse qa | xargs git tag --points-at | egrep -v 'qa|prod' | tr -d '\\n'\")\nend",
"def get_build_type_label(site, product_id, product_version, build_type, archived)\n if has_higher_version(site, product_id, product_version, build_type)\n build_type_label = nil\n # puts \" No specific build type for #{product_id} #{product_version} since it is archived or outdated.\"\n else\n build_type_label = build_type\n # puts \" Build type for #{product_id} #{product_version}: '#{build_type_label}'\"\n end\n return build_type_label\n end",
"def task_class\n task_class_name.safe_constantize.tap do |klass|\n raise Camunda::MissingImplementationClass, task_class_name unless klass\n end\n end",
"def resolve_task(name)\n name = name.to_s\n @tasks.each do |task|\n return task if task.name == name\n end\n @salticid.tasks.each do |task|\n return task if task.name == name\n end\n nil\n end",
"def pdb_get_os_major_release(facts)\n if facts.is_a?(Hash) && !facts['operatingsystemmajrelease'].nil? && !facts['operatingsystemmajrelease']['value'].nil?\n os_major_release = facts['operatingsystemmajrelease']['value']\n Puppet.info(\"#{log_prefix} puppet os major release for node is: os major release=#{os_major_release}\")\n os_major_release\n else\n \"Unknown\"\n end\n end",
"def rake_task task_name\n @rake.invoke_task task_name\n end",
"def label(task)\n label = task.label if task.respond_to?(:label)\n label || task.class.to_s.gsub(CLASS_NAME_REGEXP, '')\n end",
"def build_number\n @build_number ||= history['builds'].first['build_number'].to_s\n end",
"def task_class_name\n \"#{process_definition_key}::#{activity_id}\"\n end",
"def help_task(task)\n package, name = Bee::Util::get_package_name(task)\n if not @packages[package]\n @packages[package] = Bee::Task::PackageManager.load_package(package, @build)\n end\n help = {}\n if name == '?'\n methods = @packages[package].class.public_instance_methods(false)\n for method in methods\n help[method] = @packages[package].class.method_info(method).comment\n end\n return help\n else\n error \"Task '#{name}' not found in package '#{package}'\" if\n not @packages[package].respond_to?(name)\n help[task] = @packages[package].class.method_info(name).comment\n end\n return help\n end",
"def project_name(node)\n node['delivery']['change']['project'] if is_change_loaded?(node)\n end",
"def get_archive_from_release_info(release_info, use_zip)\n use_zip ? release_info['zipball_url'] : release_info['tarball_url']\nend",
"def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end",
"def latest_tag\n releases_url = 'https://github.com/david942j/one_gadget/releases/latest'\n @latest_tag ||= url_request(releases_url).split('/').last\n end",
"def task_warning( task )\n warn \"WARNING: '#{task}' tasks are not defined. Please run 'rake develop'\"\n end",
"def getSubtaskUrl\r\n\t\t\t\t\r\n\t\t\t\t\treturn @subtaskUrl\r\n\t\t\t\t\r\n\t\t\t\tend",
"def gcp_project_number\n ENV['GOOGLE_PROJECT_NUMBER']\n end",
"def selected_project\n if @task and @task.project_id.to_i > 0\n selected_project = @task.project_id\n else\n selected_project = current_user.projects.find(:first, :order => 'name').id\n end\n \n\n return selected_project\n end",
"def version_without_build\n version.split('-')[0]\n end",
"def task_for_configuration(config_name)\n \"#{@project_name}:#{config_name}\"\n end",
"def get_rake\n fetch(:resque_worker_rake, fetch(:rake, \"rake\"))\n end",
"def task_definition_id\n return @task_definition_id\n end",
"def project_number\n return @project_number\n end",
"def session_release\n session[:release_id] ? PfitmapRelease.find_by_id(session[:release_id]) : PfitmapRelease.find_current_release\n end",
"def to_s\n release.to_s\n end",
"def task=(value)\n @task = value\n end",
"def file_name\n \"#{task_name}.rake\"\n end",
"def get_pkg_name(candidate_tag=nil, distro=nil)\n prod_name = self.task.prod\n\n # FIXME: stop that hardcoding... one day!\n pkg_name = self.name\n\n distro = self.task.distros[0] if distro.nil?\n\n is_scl_package = MeadSchedulerService.is_scl_package?(prod_name, self.name)\n # different naming convention for different products\n if prod_name == \"eap6\" && distro == 'el7' && is_scl_package\n pkg_name = \"#{prod_name}-\" + pkg_name.sub(/-#{prod_name}$/, '')\n\n # Only enable scl thing for RHEL distros, aka when distro = el_\n elsif is_scl_package && distro.match(/^el/)\n pkg_name = \"#{prod_name}-\" + pkg_name.sub(/-#{prod_name}$/, '')\n end\n pkg_name\n end"
] |
[
"0.65598345",
"0.59358203",
"0.5737082",
"0.57256067",
"0.56674534",
"0.56023943",
"0.54701036",
"0.54523665",
"0.5441252",
"0.5330394",
"0.5264861",
"0.5240344",
"0.5227098",
"0.5202696",
"0.5185519",
"0.5168148",
"0.5163548",
"0.51371855",
"0.5109742",
"0.50849926",
"0.5075057",
"0.5049896",
"0.5049896",
"0.5044933",
"0.5043922",
"0.50058883",
"0.49790817",
"0.49321315",
"0.4931184",
"0.49227133",
"0.49112236",
"0.48874915",
"0.48818773",
"0.4863681",
"0.4854003",
"0.4838043",
"0.4813342",
"0.48106098",
"0.48070022",
"0.48062798",
"0.47986647",
"0.47957242",
"0.47894427",
"0.4785922",
"0.4784606",
"0.47781688",
"0.477709",
"0.47770345",
"0.47726268",
"0.47687644",
"0.47633532",
"0.47588247",
"0.47566736",
"0.4755812",
"0.47543502",
"0.47489038",
"0.4748483",
"0.4748483",
"0.4725942",
"0.4716584",
"0.47156096",
"0.47131625",
"0.47086346",
"0.47023642",
"0.46846178",
"0.468378",
"0.4670747",
"0.4661125",
"0.46610636",
"0.4655465",
"0.46547848",
"0.46521327",
"0.46453106",
"0.46375507",
"0.4631538",
"0.46206474",
"0.46161887",
"0.46050522",
"0.45876282",
"0.45788294",
"0.45769295",
"0.457301",
"0.45670104",
"0.45651203",
"0.45557806",
"0.45524362",
"0.4546432",
"0.45385262",
"0.45361584",
"0.45346767",
"0.45234492",
"0.45221898",
"0.45142794",
"0.4511315",
"0.45094356",
"0.45090687",
"0.4507303",
"0.45067853",
"0.45048222",
"0.4502482"
] |
0.838925
|
0
|
A getter for `skip_gradle_task`, returning false if value is nil.
|
def skip_gradle_task
@skip_gradle_task ||= false
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ignore_force?(task)\n !(metadata[\"run_#{task}\"].nil? || metadata[\"run_#{task}\"])\n end",
"def ignore_task?(task)\n return true if metadata[\"run_#{task}\"] == false\n\n !clade? && @@INCLADE_TASKS.include?(task) && metadata[\"run_#{task}\"] != true\n end",
"def should_skip\n @skip = process_exist? if @skip.nil?\n @skip\n end",
"def skip?\n @skip\n end",
"def skip?\n @skip\n end",
"def skip?\n @skip\n end",
"def ignore_task?(task)\n why_ignore(task) != :execute\n end",
"def skip?\n @skip\n end",
"def skip?\n !!@skip\n end",
"def skip?\n @result.equal?(:skip)\n end",
"def should_skip\n if @needed.nil?\n @needed = prerequisite_tasks.empty? || \\\n input_files.since(@last_executed).any? || \\\n @force\n\n # We also make sure that if the rakefile was modified since last\n # execution, we force reexecution\n if @application.rakefile\n @needed ||= File.mtime(@application.rakefile) > @last_executed\n end\n end\n !@needed\n end",
"def ignore_task?(task)\n return true unless is_active?\n return !metadata[\"run_#{task}\"] unless metadata[\"run_#{task}\"].nil?\n return true if task==:taxonomy and project.metadata[:ref_project].nil?\n pattern = [true, false]\n ( [@@_EXCLUDE_NOREF_TASKS_H[task], is_ref? ]==pattern or\n [@@_ONLY_MULTI_TASKS_H[task], is_multi? ]==pattern or\n [@@_ONLY_NONMULTI_TASKS_H[task], is_nonmulti?]==pattern )\n end",
"def skipped?\n !!skipped\n end",
"def skipped?\n !!@skipped\n end",
"def skipped?\n @skipped\n end",
"def skipped?\n @skipped\n end",
"def force_task?(task)\n !!metadata[\"run_#{task}\"]\n end",
"def ignore_project?(task)\n task == :taxonomy && project.option(:ref_project).nil?\n end",
"def isJunkTask(task)\n return false\n end",
"def skip_comments?\n @skip_comments\n end",
"def gradle_task\n @gradle_task ||= \"ktlintCheck\"\n end",
"def skip?\n false \n end",
"def ignore_complete?(task)\n !get_result(task).nil?\n end",
"def skipped?\n\t\t@skipped\n\tend",
"def has_pre_tasks?\n !@pre_tasks.empty?\n end",
"def has_task?(task_name)\n !self[task_name.to_s].nil?\n end",
"def rake_task?\n defined?(::Rake) && !Rake.application.top_level_tasks.empty?\n end",
"def is_for_project?\n not self.project.nil?\n end",
"def skip?\n raise NotImplementedError\n end",
"def never?\n !skipped? && coverage.nil?\n end",
"def with_tasks?\n options[:with_tasks]\n end",
"def skipped?\n status == :skipped\n end",
"def skipped?\n status == :skipped\n end",
"def task_defined?(task_name) \n lookup(task_name) != nil\n end",
"def no_pending_tasks?\n if not @record.experiment.supervised\n simulation_run = record.experiment.simulation_runs.where(sm_uuid: record.sm_uuid, to_sent: false, is_done: false).first\n simulation_run.nil? and not @record.experiment.has_simulations_to_run?\n else\n # we assume that in supervised experiment, there are always tasks pending\n false\n end\n end",
"def ignore_empty?(_task)\n first_preprocessing.nil?\n end",
"def project?\n ! @project.nil?\n end",
"def excluded?(project_name)\n @excluded_projects.has_key?(project_name)\n end",
"def gradle_task\n @gradle_task ||= 'spotbugsRelease'\n end",
"def exclude_target?\n @exclude_target.nil? ? self.auto? : !!@exclude_target\n end",
"def task_present?(task_name)\n tasks.key? prepare_key(task_name)\n end",
"def skipable_empty_value?(_value)\n false\n end",
"def skip_pin?\n skip = false\n if @skip_flag == true\n @skip_flag = false\n skip = true\n end\n skip\n end",
"def disable_rake_compiler?\n\t\treturn self.disable_rake_compiler ? true :false\n\tend",
"def skip!\n @skip ||= true\n end",
"def auto_exclude?\n @auto_exclude\n end",
"def skip?\n return false unless has_group?\n return true if group.any_true?(skip_if)\n return true unless group.all_true?(only_if)\n false\n end",
"def has_task?(task)\n self.project_tasks.each do |project_task|\n return true if project_task.task == task\n end\n false\n end",
"def skip?\n !value_of(entity.only_if)\n end",
"def disable?\n strategy = APP_CONFIG[\"background\"][\"sync\"][\"strategy\"]\n if strategy == \"initial\" || strategy == \"on-start\"\n @executed\n else\n false\n end\n end",
"def tasks_remain?\n\t\ttasks.any?{ |t| t.completed.nil? }\n\tend",
"def skip\n return 0 unless ENV['SKIP']\n ENV['SKIP'].to_s.to_i\n end",
"def ignore_noref?(task)\n ignore_by_type?(task, :noref)\n end",
"def has_delayed_default?\n has_default? && TaskArguments.delayed_argument?(default)\n end",
"def ignore?\n @should_ignore\n end",
"def ignore_inactive?(_task)\n !active?\n end",
"def skip?(logger)\n false\n end",
"def optional?\n return config[:optional]\n end",
"def disabled?\n @disabled ||= (user_configuration_from_key('disabled') || false)\n end",
"def has_tasks?\n return true unless session_tasks.empty?\n false\n end",
"def disabled?\n host.nil?\n end",
"def skip_pub_task_and_post_process_only?\n !pub_options['push_metadata'] && !pub_options['push_files']\n end",
"def not_completed?\n tasks.any? { |task| task.done != 100 }\n end",
"def depends_on?(other_task)\n depends_on.include?(other_task)\n end",
"def explain_false(task); end",
"def ignore?\n !!@ignore\n end",
"def ignore_upstream?(task)\n self.class.PREPROCESSING_TASKS.index(task) <\n self.class.PREPROCESSING_TASKS.index(first_preprocessing)\n end",
"def ignore_task_error val = nil\n puts \"ignore_task_error:\"\nend",
"def disabled?\n @disabled ||= (user_configuration_from_key('disabled') || false)\n end",
"def needed_if_relevant?\n false\n end",
"def skip_wait=(setting)\n @skip_wait = setting\n end",
"def disabled?\n \n return ! @enabled\n\n end",
"def is_project_disabled(proj)\n ## check project\n return true if proj.nil?\n\n ## check proj custom field\n proj_cf = ProjectCustomField.find_by_name(\"Hangouts Chat Webhook Disabled\")\n return true if proj_cf.nil?\n\n ## check proj custom value\n proj_cv = proj.custom_value_for(proj_cf)\n\n ## proj_cv is null\n return false if proj_cv.nil?\n\n return false if proj_cv.value == '1'\n\n return false\n end",
"def needed_if_relevant?\n false\n end",
"def required?\n config[:required]\n end",
"def skip_value?(value); end",
"def are_there_self_override_tasks?\n return (self[:all][:self] || self[:command_only][:self] || self[:identifier_only][:self])\n end",
"def pending_tasks?\n hash = pending_tasks\n return nil unless hash.key? \"tasks\"\n hash[\"tasks\"].length > 0\n end",
"def enabled\n !false?(configuration[:enabled])\n end",
"def disabled?\n @disabled == true\n end",
"def defered?\n !!@defer\n end",
"def project?; @is_project || false; end",
"def is_skippable?\n return true if @label.include? 'coverblank'\n end",
"def disabled?\n \n return ! @enabled\n \n end",
"def disabled?\n @disabled\n end",
"def compatible_state?(task)\n finished? || !(running? ^ task.running?)\n end",
"def disabled?\n self.disabled || self.account.blank? || Rails.env.development?\n end",
"def tasks?\n tasks.summary.items?\n end",
"def disabled?\n !github_repository.on_github? || !github_user.on_github?\n end",
"def ignored?\n !!ignored\n end",
"def ignore_nonmulti?(task)\n ignore_by_type?(task, :nonmulti)\n end",
"def compatible_state?(task)\n\t finished? || !(running? ^ task.running?)\n\tend",
"def ignored?\n @ignored\n end",
"def skip?\n $game_switches[CP::VICTORY::SKIP_SWITCH]\n end",
"def should_stop?\n @time_observer.time_is_up? &&\n FINAL_JOB_TASK_STATUSES.exclude?(@task_status)\n end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end",
"def skipped?; end"
] |
[
"0.6518595",
"0.64784586",
"0.62998265",
"0.6292668",
"0.6292668",
"0.6292668",
"0.6290563",
"0.62690115",
"0.62614036",
"0.61823386",
"0.61674595",
"0.61668545",
"0.61337686",
"0.6125552",
"0.60769284",
"0.6057696",
"0.6050467",
"0.601239",
"0.59567827",
"0.594658",
"0.59313655",
"0.58700234",
"0.58692116",
"0.5847651",
"0.5830673",
"0.58192056",
"0.58166844",
"0.56823814",
"0.5667355",
"0.5656465",
"0.56424385",
"0.5631694",
"0.5631694",
"0.5620597",
"0.55973077",
"0.5572446",
"0.5554617",
"0.5526188",
"0.5522487",
"0.55105674",
"0.55071676",
"0.5496118",
"0.5483543",
"0.54733825",
"0.54615873",
"0.54349285",
"0.54311794",
"0.54268336",
"0.5392202",
"0.5376527",
"0.53729355",
"0.5352513",
"0.5336073",
"0.53132904",
"0.5300728",
"0.5270548",
"0.52428883",
"0.5224364",
"0.51969445",
"0.5195104",
"0.51942205",
"0.51838493",
"0.5180049",
"0.5175829",
"0.51738113",
"0.51566523",
"0.51400894",
"0.5126071",
"0.5120451",
"0.51200145",
"0.51145744",
"0.51047736",
"0.50965375",
"0.50937665",
"0.50908375",
"0.5086395",
"0.5085057",
"0.5082808",
"0.5082312",
"0.50610495",
"0.50530034",
"0.50482076",
"0.50436044",
"0.50378454",
"0.5033246",
"0.5026808",
"0.5026456",
"0.501979",
"0.501838",
"0.50177675",
"0.50163627",
"0.5005017",
"0.4996435",
"0.49924952",
"0.49920762",
"0.49897382",
"0.49897382",
"0.49897382",
"0.49897382"
] |
0.82654464
|
1
|
A getter for `root_path`, returning result of `git revparse showtoplevel` if value is nil.
|
def root_path
@root_path ||= `git rev-parse --show-toplevel`.chomp
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def repository_root\n return unless available?\n root = Licensed::Shell.execute(\"git\", \"rev-parse\", \"--show-toplevel\", allow_failure: true)\n return nil if root.empty?\n root\n end",
"def root(value = nil)\n if value\n @root = value\n else\n Utils::Kernel.Pathname(@root || Dir.pwd).realpath\n end\n end",
"def get_path_root\n return self if @path.nil?\n @path.get_path_root\n end",
"def root_path\n @root_path ||= File.expand_path(File.join('.', '../..'))\n end",
"def raw_toplevel\n\t\t\twith_dir do\n\t\t\t\treturn Pathname.new(%x/git rev-parse --show-toplevel/.chomp)\n\t\t\tend\n\t\tend",
"def root\n return \".\".expand_path unless app_file?\n return @root if @root\n @guessed_root ||= begin\n dir = app_file.expand_path.dirname\n if dir.basename == \"lib\" and not (dir / \"lib\").directory?\n dir.dirname\n else\n dir\n end\n end\n end",
"def lookup_root\n root = nil\n Dir.ascend(Dir.pwd) do |path|\n check = Dir[ROOT_GLOB].first\n if check\n root = path \n break\n end\n end\n root || Dir.pwd\n end",
"def root\n @root ||= Pathname.new(\"#{__dir__}/../../../..\").cleanpath\n end",
"def git_root_till_home\n Pathname.new(Dir.pwd).ascend do |dir_pathname|\n return dir_pathname if File.directory?(\"#{dir_pathname}/.git\")\n return nil if dir_pathname.to_s == home_dir\n end\n end",
"def root\n @root ||= Pathname.new(File.expand_path(\"..\", __dir__))\n end",
"def top_level\n git.git_dir.chomp(GIT_DIR)\n end",
"def get_root_directory\n return @@root_directory\n end",
"def get_root_directory\n return @@root_directory\n end",
"def repo_root\n @repo_root ||=\n begin\n result = execute(%w[git rev-parse --show-toplevel])\n unless result.success?\n raise Overcommit::Exceptions::InvalidGitRepo,\n 'Unable to determine location of GIT_DIR. ' \\\n 'Not a recognizable Git repository!'\n end\n result.stdout.chomp(\"\\n\")\n end\n end",
"def root\n @root ||= Pathname.new(__FILE__).dirname.dirname.expand_path.to_s\n end",
"def top_level\n git.git_dir.chomp(GIT_DIR)\n end",
"def root_path\n environment.paths.detect { |path| pathname.to_s[path] }\n end",
"def root\n case parent\n when Pathname then parent\n when FileStore then parent.root\n else nil\n end\n end",
"def find_control_repo_root(strict_check = false)\n environment_conf_path = PDK::Util.find_upwards('environment.conf')\n path = if environment_conf_path\n File.dirname(environment_conf_path)\n elsif control_repo_root?(Dir.pwd)\n Dir.pwd\n else\n nil\n end\n return path if path.nil? || !strict_check\n PDK::Bolt.bolt_project_root?(path) ? nil : path\n end",
"def find_root(path)\n path = File.expand_path('..', path) if root?(path) == false\n find_root(path) if root?(path) == false\n return path if root?(path) == true\n end",
"def root\n File.expand_path(options[:root] || Dir.pwd)\n end",
"def getRoot\n @path[0]\n end",
"def root_path\n return @root_path if defined?(@root_path)\n\n root_finder = lambda do |path|\n # Note: To remain compatible with Ruby 1.8, we have to use\n # a `find` here instead of an `each`.\n found = vagrantfile_name.find do |rootfile|\n File.exist?(File.join(path.to_s, rootfile))\n end\n\n return path if found\n return nil if path.root? || !File.exist?(path)\n root_finder.call(path.parent)\n end\n\n @root_path = root_finder.call(cwd)\n end",
"def root path = nil\n if path && configurable?\n @root = normalize_path(path)\n # resetting path to an empty string cause root should be an absolute path to templates.\n @path, @setup[:path] = nil\n path ''\n end\n @setup[:root] ||= @root ||\n (@controller.ctrl.slice.view.root if @controller) ||\n Presto::App.root\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../../', __FILE__))\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../../', __FILE__))\n end",
"def root(path = nil)\n base = File.expand_path(File.dirname(__FILE__))\n path ? File.join(base, path) : base\n end",
"def root\n @root ||= Pathname.new(File.expand_path(\"../../\", __FILE__))\n end",
"def find_git_root(path)\n\n git_path = nil\n path = Pathname.new(path)\n while( path && !git_path ) do\n current_path = File.join(path,\".git\")\n if File.directory? current_path\n git_path = path\n end\n path = path.parent\n end\n\n return git_path\n end",
"def root\n self.config[:root] || Dir.pwd rescue Dir.pwd\n end",
"def get_root\n return File.join('/root/path', SETTINGS[:project])\n end",
"def get_root\n return self if tag == :root || parent.nil?\n parent.get_root\n end",
"def root\n @root ||= Pathname.new(File.expand_path('../../', __FILE__))\n end",
"def lookup_root\n pwd = File.expand_path(Dir.pwd)\n home = File.expand_path('~')\n while pwd != '/' && pwd != home\n return pwd if ROOT_INDICATORS.any?{ |r| File.exist?(File.join(pwd, r)) }\n pwd = File.dirname(pwd)\n end\n return nil\n end",
"def root?; path == '' end",
"def root path\n File.dirname(find_dotjam(path))\n end",
"def root\n @root || Merb::Config[:merb_root] || File.expand_path(Dir.pwd)\n end",
"def root\n return @root if @root\n @root = dir = Dir.pwd\n begin\n dir = File.dirname(dir)\n return @root = dir if File.exist?(File.join(dir, \"#{BASENAME}.rb\"))\n end while dir != '/'\n\n @root\n end",
"def project_root\n @project_root ||= find_project_root\n end",
"def project_root\n @project_root ||= find_project_root\n end",
"def root_path\n path = File.join(File.dirname(__FILE__), '../')\n Pathname.new(path).realpath\nend",
"def root\n @root ||= Pathname.new('.')\nend",
"def root_path\n return @root_path if @root_path\n\n @root_path = @sftp.root_path\n unless @root_path == ''\n if @root_path == '/'\n @root_path = ''\n else\n @root_path = '/' + @root_path unless @root_path.match(/\\A\\//)\n @root_path = @root_path.sub(/\\/\\z/, '') if @root_path.match(/\\/\\z/)\n end\n end\n @root_path\n end",
"def root?\n is_root?(@path)\n end",
"def project_root()\n return @project_root_path if @project_root_path\n \n @project_root_path = Common::find_root_of(\"tiapp.xml\", Common::project_path)\n end",
"def repo_path\n @config.get_value('GIT_REPO_ROOT')\n end",
"def root\n File.expand_path(File.dirname(File.dirname(File.dirname(__dir__))))\n end",
"def root\n find_single_directory || @app_dir\n end",
"def root\n Dir.pwd\n end",
"def pristine_dir_parent\n if subpath.empty?\n pristine_dir_root\n else\n File.join pristine_dir_root, subpath\n end\n end",
"def root?\n !self.hier? || self.path == '/' || self.path.to_s.empty?\n end",
"def root_path\n ENV['TM_PROJECT_DIRECTORY'] || File.join(ENV['TM_DIRECTORY'], \"..\")\n end",
"def root_path\n Pathname.new(File.expand_path(File.join(__dir__, '..', '..')))\nend",
"def root=(value)\n @root = Utils::Kernel.Pathname(value).realpath\n end",
"def is_root?()\n @rootpath == @path\n end",
"def root() @root || Merb::Config[:merb_root] || Dir.pwd end",
"def root\n if @root.nil?\n root = ENV['PWD']\n until File.exists?(\"#{root}/Eulerfile.rb\") || File.expand_path(root) == '/' do\n root = File.dirname(root)\n end\n if not File.exists?(\"#{root}/Eulerfile.rb\")\n raise Euler::EulerFileNotFoundError.new \"Unable to find an Eulerfile.rb in any of the parent directories.\"\n end\n @root = root\n end\n @root\n end",
"def root?\n !!@root || app_file?\n end",
"def project_root\n if server_environment\n server_environment['project-root'] || ''\n end\n end",
"def root?\n #%r{\\A/+\\z} =~ @path ? true : false\n @absolute and @path.empty?\n end",
"def root; Pathname(__dir__).parent; end",
"def root_path\n RUBYCOCOA_ROOT.to_s\n end",
"def root\n if self.root?\n self\n else\n self.parent.root\n end\n end",
"def tree_root\n if (root_id = visibility_path_ids.first)\n return content_model::Page.get(root_id)\n end\n nil\n end",
"def repo_root(directory = nil)\n directory = File.expand_path('.') if directory.nil?\n return nil unless repository?(directory)\n\n previous_dir = File.expand_path('.')\n Dir.chdir(directory)\n output = command_stdout('git root')\n Dir.chdir(previous_dir)\n output\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end",
"def root\n @root ||= (parent ? parent.root : self)\n end",
"def root(config = Pantry.config)\n Pathname.new(config.root_dir)\n end",
"def root_dir\n is_rails? ? Rails.root.to_s : Dir.pwd.to_s\n end",
"def root_path\n attributes.fetch(:rootPath)\n end",
"def root\n application && application.config.root\n end",
"def root\n return self if root?\n (root_relation_enabled? && root_ancestor) || ancestors.first\n end",
"def find_root_path(path)\n return nil if path.nil?\n filepath = File.expand_path(path)\n\n if dir_exist?(filepath)\n directory = filepath\n elsif file_exist?(filepath)\n directory = File.dirname(filepath)\n else\n return nil\n end\n\n until directory.nil?\n break if file_exist?(File.join(directory, 'metadata.json')) || file_exist?(File.join(directory, 'environment.conf'))\n parent = File.dirname(directory)\n # If the parent is the same as the original, then we've reached the end of the path chain\n if parent == directory\n directory = nil\n else\n directory = parent\n end\n end\n\n directory\n end",
"def root \n parent.nil? ? self : parent.root\n end",
"def relroot\n Pathname.new(File.expand_path(path)).\n relative_path_from(Pathname.new(File.expand_path(root))).to_s\n end",
"def root_path(path) File.join(root, path) end",
"def is_root?\n @path == '/' || @path == ''\n end",
"def root\n @root_address ? @cache.get(@root_address) : nil\n end",
"def root\n Pathname.new(ENV[\"RAILS_ROOT\"] || Dir.pwd)\n end",
"def root\n Pathname.new(File.dirname(__dir__))\n end",
"def root\n File.expand_path '../../..', __FILE__\n end",
"def root_project\n self.projects.first.root\n end",
"def lookup_root(dir)\n root = nil\n Dir.ascend(dir || Dir.pwd) do |path|\n check = Dir[ROOT_GLOB].first\n if check\n root = path \n break\n end\n end\n root || Dir.pwd\n end",
"def root\n root? ? self : parent.root\n end",
"def root\n return self if is_root?\n ancestors.select { |category| category.is_root? }.first\n end",
"def root_path \n @root_path\n end",
"def caller_root_path(caller_info)\n caller_dirname = File.expand_path(File.dirname(caller_info[0]))\n if (test_dir_pos = caller_dirname.index(TEST_REGEX)) > 0\n root_dir = caller_dirname[0..(test_dir_pos-1)]\n end\n end",
"def root?\n self[tree_parent_id_field].nil?\n end",
"def search_root(package)\n return if package.nil?\n\n # search root choices:\n # 1. module directory if using go modules and directory is available\n module_dir = package.dig(\"Module\", \"Dir\")\n return module_dir if module_dir\n\n # 2. vendor folder if package is vendored\n parts = vendored_path_parts(package)\n return parts[:vendor_path] if parts\n\n # 3. package root value if available\n return package[\"Root\"] if package[\"Root\"]\n\n # 4. GOPATH if the package directory is under the gopath\n return gopath if package[\"Dir\"]&.start_with?(gopath)\n\n # 5. nil\n nil\n end",
"def get_context_root\n unless @doc.nil?\n element = @doc.elements['/web-ext/context-root']\n return element.attributes['uri'] unless element.nil?\n end\n nil\n end",
"def rootDir\n if @workflow[:root_dir]\n OpenStudio.toPath(@workflow[:root_dir])\n else\n OpenStudio.toPath(@osw_dir)\n end\n end",
"def talia_root(path = '')\n File.join('..', '..', '..', '..', path)\n end",
"def root\n return @notes.find { |note| note.part == :root } || self.low_note\n end",
"def root_path\n defined?(Rails) && Rails.root ||\n defined?(Sinatra::Application) && Pathname.new(Sinatra::Application.root) ||\n defined?(ROOT_DIR) && Pathname.new(ROOT_DIR)\n end",
"def repository_root\n File.expand_path(@repo.path + \"/../\")\n end",
"def root\n Pathname.new File.expand_path('../../', File.dirname(__FILE__))\n end",
"def root\n # search upward for a file called \".version50\"\n path = Pathname.new(Dir.pwd)\n while path.to_s != '/'\n # check if file exists in this directory\n if path.children(false).select { |e| e.to_s == '.version50' }.length > 0\n return path.to_s\n end\n\n # continue to traverse upwards\n path = path.parent\n end\n\n # .version50 file not found\n return false\n end",
"def tree_root\n repo.tree\n end"
] |
[
"0.73593134",
"0.694649",
"0.6865729",
"0.6700843",
"0.66957176",
"0.6623494",
"0.6591485",
"0.6579465",
"0.6552028",
"0.6532682",
"0.64187455",
"0.6401191",
"0.6401191",
"0.6364244",
"0.6355525",
"0.634226",
"0.632569",
"0.6322528",
"0.6319492",
"0.6288777",
"0.6264779",
"0.6238893",
"0.62359565",
"0.6227164",
"0.62191874",
"0.62099195",
"0.6175603",
"0.61699855",
"0.61628723",
"0.6153677",
"0.61332095",
"0.6116024",
"0.61093634",
"0.6093345",
"0.607888",
"0.606052",
"0.6028689",
"0.6011308",
"0.599674",
"0.59779227",
"0.59779227",
"0.59411335",
"0.59397036",
"0.5935513",
"0.59261197",
"0.59228367",
"0.59154755",
"0.59049916",
"0.59040946",
"0.58890474",
"0.58878976",
"0.5887693",
"0.5879701",
"0.58772516",
"0.5852346",
"0.5835093",
"0.58327967",
"0.58158326",
"0.58139133",
"0.58058727",
"0.5798727",
"0.5789939",
"0.57886904",
"0.57785726",
"0.5765173",
"0.57530284",
"0.5746894",
"0.5746894",
"0.57433176",
"0.5742678",
"0.57343477",
"0.57261676",
"0.57230085",
"0.57207316",
"0.5718954",
"0.57188845",
"0.5718342",
"0.57085425",
"0.56988084",
"0.56978923",
"0.5695395",
"0.56854343",
"0.5684411",
"0.5676125",
"0.5676112",
"0.5672618",
"0.5663359",
"0.5659157",
"0.5637284",
"0.5631569",
"0.56262255",
"0.5619767",
"0.56194025",
"0.56113636",
"0.5610074",
"0.5606239",
"0.5602463",
"0.5598456",
"0.5596254",
"0.5591701"
] |
0.79346144
|
0
|
A getter for `report_file`, returning 'app/build/reports/spotbugs/release.xml' if value is nil.
|
def report_file
@report_file ||= 'app/build/reports/spotbugs/release.xml'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end",
"def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end",
"def report_file\n @report_file || 'app/build/reports/ktlint/ktlintSourceSetCheck.json'\n end",
"def test_connection\n if !File.file?(@report_file)\n return \"Can't find path to report file: #{@report_file}\"\n end\n nil\n end",
"def report_file\n File.join(@report_dir, \"#{@id}.json\")\n end",
"def spotbugs_report(report_file)\n require 'oga'\n Oga.parse_xml(File.open(report_file))\n end",
"def report?\n report = parent_report.report?\n run_report = report && report[\"runs\"] && report[\"runs\"][stage_path]\n return nil if run_report && run_report[\"url\"] != build.url\n run_report\n end",
"def report\n @report_file || \"kacl_report.json\"\n end",
"def last_report_file_name(branch = proj_branch)\n ls_report_dir(branch).last\n end",
"def release_path\n @release_path ||= Pathname.new(source_dir).join(data['release_path'] || './release').to_s\n end",
"def reports_path; end",
"def reports_path; end",
"def project_file\n if fetcher && fetcher.is_a?(NetFetcher)\n log.deprecated(log_key) do\n \"project_file (DSL). This is a property of the NetFetcher and will \" \\\n \"not be publically exposed in the next major release. In general, \" \\\n \"you should not be using this method in your software definitions \" \\\n \"as it is an internal implementation detail of the NetFetcher. If \" \\\n \"you disagree with this statement, you should open an issue on the \" \\\n \"Omnibus repository on GitHub an explain your use case. For now, \" \\\n \"I will return the path to the downloaded file on disk, but please \" \\\n \"rethink the problem you are trying to solve :).\"\n end\n\n fetcher.downloaded_file\n else\n log.warn(log_key) do\n \"Cannot retrieve a `project_file' for software `#{name}'. This \" \\\n \"attribute is actually an internal representation that is unique \" \\\n \"to the NetFetcher class and requires the use of a `source' \" \\\n \"attribute that is declared using a `:url' key. For backwards-\" \\\n \"compatability, I will return `nil', but this is most likely not \" \\\n \"your desired behavior.\"\n end\n\n nil\n end\n end",
"def html_report_path_for_attribute(attribute)\n attribute = 'default' if attribute.nil?\n File.join($output_dir, \"#{attribute}.html\")\nend",
"def report_path(report_path)\n @report_path = report_path\n end",
"def report_file\n File.join(@params[\"SS_output_dir\"], \"report_data.json\")\nend",
"def bug_report_url()\n LibDrizzle.drizzle_bugreport\n end",
"def file\n @file ||= find_version_file\n end",
"def getReport(filename)\n result = @driver.GetGeneratedReports(:ApiKey => @apikey)\n if result.getGeneratedReportsResult.errorCode == \"0\" then\n response = result.getGeneratedReportsResult.items.apiResponseItem\n @reportlist = Hash.new\n response.each do |res|\n @reportlist.update(res.filename => res.fullPath)\n end\n output = @reportlist[filename]\n else\n output = result.getGeneratedReportsResult.errorMessage\n end\n return output\n end",
"def report_file_download(report)\n\t\t\tpost= { \"token\" => @token, \"report\" => report }\n\t\t\tfile = nil\n\t\t\tfile=nessus_http_request('file/report/download', post)\n\t\t\tif file.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\treturn file\n\t\tend",
"def reporter_path(filename)\n File.join(File.dirname(__FILE__), 'reporter', filename)\n end",
"def report\n @report ||= \"#{RESULTS_DIR}/#{GROUP_NAME}-#{Time.now.strftime \"%d-%m-%Y-%H%M\"}.yaml\"\nend",
"def external_report\n return external_reports.first\n end",
"def csp_report_uri\n return unless initialized?\n configuration.csp_report_uri\n end",
"def log_file\n return @log_file\n end",
"def file_path\n @file_path ||= lookup_file_path\n end",
"def file_name\n return unless @file\n\n @file.absolute_name\n end",
"def response_file\n @notifier_engine.response_file\n end",
"def report_files\n @report_files ||= [report_file]\n end",
"def file\n @file ||= find_file\n end",
"def write!\n puts \"\\nOutputting file...\"\n verify_file_path(report_filename)\n if File.open(report_filename, \"wb\") { |f| f.write @pdf.render }\n return report_filename\n else\n raise \"ERROR\"\n nil\n end\n end",
"def getReportUrl()\n url = nil\n webdriver = @perfectoExecutionContext.webdriver\n\n begin\n url = webdriver.capabilities['testGridReportUrl']\n rescue Exception => e\n raise ReportiumException.new e.message\n end\n\n return url\n end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def file # :nodoc:\n return @file if @file\n\n if default_file && File.exist?(default_file)\n @file = default_file\n end\n end",
"def file # :nodoc:\n return @file if @file\n\n if default_file && File.exist?(default_file)\n @file = default_file\n end\n end",
"def gemspec_file\n gemspec_file_system || gemspec_file_local\n end",
"def xml_report\n @xml_report ||= parse\n end",
"def report_base_path\n @report_base_path ||= \"knapsack\"\n end",
"def source_file\n @source_file || get_source_file\n end",
"def report_filename_for(title, variant=nil)\n return File.join(@reports_dir, \"#{title}#{variant ? '_'+variant.to_s : ''}_with_#{@tag}.log\")\n end",
"def release_path\n ::File.join(install_path, artifact_name, artifact_version)\n end",
"def file_path\n \"studio/#{type}/#{id}.xml\"\n end",
"def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end",
"def file\n if glob = file_map['vclog']\n Dir.glob(glob).first\n else\n Dir.glob(DEFAULT_GLOB).first\n end\n end",
"def write_report_file\n raise FileNotFoundException.new 'There is no report file path specified' if report_path.blank?\n\n report = build_report\n\n if append_report.present? && File.exist?(report_path)\n f = File.open(report_path)\n existing_xml = Nokogiri::XML(f)\n f.close\n\n report = existing_xml.root << Nokogiri::XML(report).at('testsuite')\n\n # formatting\n report = format_xml report.to_xml\n end\n\n File.write report_path, report\n report\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end",
"def report=(value)\n @report = value\n end",
"def file\n @pathname.to_s\n end",
"def show_report(file_name = nil, branch = proj_branch)\n file_name ||= last_report_file_name(branch)\n report = proj.show(report_branch, File.join(report_path(branch), file_name))\n report_file = Tempfile.new([report_name, report_extension])\n report_file.write(report)\n `open #{report_file.path}`\n sleep 3\n end",
"def file\n @file ||= File.basename(link)\n end",
"def report\n return @report\n end",
"def file\n @files.first ? @files.first[0] : nil\n end",
"def file\n @files.first ? @files.first[0] : nil\n end",
"def report_name\n @report_name ||= ENV[\"CI_JOB_NAME\"].split(\" \").first.tr(\":\", \"-\")\n end",
"def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end",
"def download_report\n logger.debug(\"Downloading latest knapsack report for '#{report_name}' to '#{report_path}'\")\n file = client.get_object(BUCKET, report_file)\n File.write(report_path, file[:body])\n rescue StandardError => e\n ENV[\"KNAPSACK_REPORT_PATH\"] = FALLBACK_REPORT\n logger.warn(\"Failed to fetch latest knapsack report: #{e}\")\n logger.warn(\"Falling back to '#{FALLBACK_REPORT}'\")\n end",
"def get_survey_path(f)\n filename = f\n filename ||= 'NO_DATAFILE_GIVEN' # For display in errors later\n filename.gsub!(/[^0-9A-Z.-]/i, '_') # Sanitize input (should only be a filename)\n filename << DOTJSON if not filename.end_with?(DOTJSON)\n # test\n begin\n return File.join(ASF::SVN[get_survey_root(true)], filename)\n rescue Exception => _e\n return \"ERROR-NO-OFFICERS_SURVEYS-CHECKOUT\" # Improve error display in browser\n end\nend",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def source_file\n return @source_file\n end",
"def path\n return if @file.blank?\n if is_path?\n File.expand_path(@file)\n elsif @file.respond_to?(:path) && !@file.path.blank?\n File.expand_path(@file.path)\n end\n end",
"def log_file\n get_value :logfile\n end",
"def file\n File.join(directory, @file)\n end",
"def path\n @file\n end",
"def file\n @file\n end",
"def request_file\n @notifier_engine.request_file\n end",
"def log_filename\n log_file.nil? || log_file.empty? || log_file == '-' ? nil : log_file\n end",
"def path\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def file\n @file\n end",
"def getRepositoryFile\n return @REPOSITORYFILEORFIELD\n end",
"def output_file(file = nil)\n if file\n output_filename = file.name\n if !@output_filename.nil? && @files.length == 1\n output_filename = @output_filename\n end\n else\n output_filename = Time.now.to_s.split(' ').join('_')\n output_filename = @files.last.name if @files.length == 1 || @merge\n output_filename = @output_filename unless @output_filename.nil?\n end\n\n ::File.join(output_dir, \"#{output_filename}.pdf\")\n end",
"def gemfile_path\n @gemfile_path ||= begin\n path = ::File.expand_path(new_resource.path)\n if ::File.file?(path)\n # We got a path to a real file, use that.\n path\n else\n # Walk back until path==dirname(path) meaning we are at the root\n while path != (next_path = ::File.dirname(path))\n possible_path = ::File.join(path, 'Gemfile')\n return possible_path if ::File.file?(possible_path)\n path = next_path\n end\n end\n end\n end",
"def version_file\n version_rb_file = File.dirname(Buildr.application.buildfile.to_s) + '/version.rb'\n return version_rb_file if File.exists?(version_rb_file)\n return Buildr.application.buildfile.to_s\n end",
"def filename\n return @filename if @filename\n\n # Pre-conditions\n raise ArgumentError.new(\"No document root set\") if @path_is_absolute && @document_root.nil?\n raise ArgumentError.new(\"No hosts served from document root\") if @path_has_host && @hosts.empty?\n\n path = strip_host(@path)\n raise ArgumentError.new(\"No matching host found for #{@path}\") if path =~ @@scheme_pattern\n\n dir = @path_is_absolute ? document_root : base\n @filename = File.expand_path(File.join(dir, path))\n end",
"def filepath\n groupId = @groupId.gsub('.', '/')\n artifactId = @artifactId.gsub('.', '/')\n return \"#{groupId}/#{artifactId}/#{@version}/#{artifactId}-#{@version}\"\n end",
"def report_filename(extension = \"pdf\")\n basename = \"ProceedingsTex.\" + extension.to_s\n File.join(RAILS_ROOT, \"files\", \"proceedings_report\", @offering.id.to_s, basename)\n end",
"def file\n f = nil\n if self.asset_clone_id.present?\n x = self.asset_clone\n f = x.asset if x.present?\n else\n f = self.asset\n end\n return f\n end",
"def report_file1_download(report)\n\t\t\tpost= { \"token\" => @token, \"report\" => report, \"v1\" => \"true\" }\n\n\t\t\tfile=nessus_http_request('file/report/download', post)\n\n\t\t\treturn file\n\t\tend",
"def get_file_path\n @path\n end",
"def file\n @file\n end",
"def create_report\n dir = Dir.pwd\n file_name = \"#{@name}.log\"\n reports_dir = dir + \"/spec/reports\"\n if File.directory? reports_dir\n @spec_report_file = File.open(reports_dir + \"/\" + file_name, 'w')\n @spec_report_file.puts \"WatirmarkLog: \" + @name\n else\n #spec/Reports directory does not exits\n @spec_report_file = nil\n end\n end",
"def set_show_file\n possible_files = @issues_directory.children(false).select { |files| files.to_s.index(/\\d.*show/) }\n show_file = possible_files.sort { |x, y| y <=> x }.find do |file|\n version = file.to_s[0..4]\n version == @current_version || version < @current_version\n end\n\n @show_file = @issues_directory.join show_file unless show_file.nil?\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def latest_report\n @latest_report ||= AedUtils.latest_published_analysis\n end",
"def gem_path\n @path || downloaded_gem_path\n end",
"def spec_file\n return @spec_file if defined?(@spec_file)\n return @spec_file = nil unless loaded_from && File.file?(loaded_from)\n @spec_file = begin\n file = { name: File.basename(loaded_from), dir: File.dirname(loaded_from) }\n Licensee::ProjectFiles::PackageManagerFile.new(File.read(loaded_from), file)\n end\n end",
"def path\n if @file\n @file.name\n elsif @path\n @path.to_s\n elsif @stream.is_a?(File)\n @stream.path\n end\n end",
"def path\n begin\n file_path = @assignment.path\n rescue StandardError\n file_path = nil\n end\n file_path\n end",
"def file\n return \"(unknown)\" unless self.method\n method.file\n end",
"def try_file(filename)\n return file(filename)\n rescue FileMissing\n return nil\n end",
"def try_file(filename)\n return file(filename)\n rescue FileMissing\n return nil\n end",
"def downloaded_file\n filename = source[:cached_name] if source[:cached_name]\n filename ||= File.basename(source[:url], \"?*\")\n File.join(Config.cache_dir, filename)\n end",
"def path\n @path ||= @filename ? pathname.to_s : nil\n end",
"def get_canvas_user_report_file\n get_report = Proc.new {\n filename = \"#{@export_dir}/canvas-#{DateTime.now.strftime('%F_%H-%M-%S')}-users-report.csv\"\n csv_table = Canvas::UsersReport.new.get_csv\n headers = csv_table.headers.join(',')\n file = CSV.open(filename, 'wb', { :headers => headers, :write_headers => true})\n logger.warn(\"Performing user update checks on #{csv_table.count} provisioned user accounts\")\n csv_table.each do |row|\n file << row\n end\n file.close\n file.path\n }\n @canvas_user_report_file_path ||= get_report.call\n end",
"def latest_report\n @latest_report || fetch_api_data\n end"
] |
[
"0.7797677",
"0.71298295",
"0.6664475",
"0.6060904",
"0.6012322",
"0.58259284",
"0.5654273",
"0.56019944",
"0.55606997",
"0.55336714",
"0.54858345",
"0.54858345",
"0.5479988",
"0.54769075",
"0.5468726",
"0.54221344",
"0.5403788",
"0.5374407",
"0.5364477",
"0.5328036",
"0.5310147",
"0.5288835",
"0.5225094",
"0.5210832",
"0.5204606",
"0.5188242",
"0.5143251",
"0.51385987",
"0.5135524",
"0.51067305",
"0.5081689",
"0.5079506",
"0.50300384",
"0.50300384",
"0.5024345",
"0.5024345",
"0.5017141",
"0.50045025",
"0.4991133",
"0.49395925",
"0.4932074",
"0.49312237",
"0.49150628",
"0.4903912",
"0.4902325",
"0.48919243",
"0.4890306",
"0.4890306",
"0.4869548",
"0.4867211",
"0.4863628",
"0.48626843",
"0.4860358",
"0.48514",
"0.48514",
"0.48437193",
"0.48433104",
"0.4827862",
"0.4824885",
"0.48024818",
"0.48024818",
"0.4802433",
"0.47875693",
"0.47815648",
"0.47753176",
"0.47747406",
"0.47744146",
"0.47708097",
"0.4767697",
"0.47659466",
"0.47606674",
"0.47606674",
"0.47606674",
"0.47606674",
"0.4747026",
"0.4729557",
"0.4721457",
"0.47201657",
"0.47135854",
"0.4713205",
"0.46898845",
"0.46850905",
"0.4683833",
"0.46837157",
"0.46748593",
"0.4666548",
"0.46616685",
"0.46592388",
"0.46577466",
"0.46561986",
"0.46561864",
"0.4647018",
"0.46439096",
"0.46407714",
"0.4626951",
"0.4626951",
"0.46258324",
"0.46239626",
"0.46237874",
"0.46184623"
] |
0.84897304
|
0
|
A getter for `report_files`, returning ['app/build/reports/spotbugs/release.xml'] if value is nil.
|
def report_files
@report_files ||= [report_file]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def report_file\n @report_file ||= 'app/build/reports/spotbugs/release.xml'\n end",
"def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end",
"def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end",
"def files\n @exported_pr_dir ? Dir.glob(@exported_pr_dir) : []\n end",
"def ls_report_dir(branch = proj_branch)\n files = proj.show(report_branch, report_path(branch)).split(\"\\n\")\n files.shift(2)\n files\n end",
"def files\n filenames || []\n end",
"def report_file\n @report_file || 'app/build/reports/ktlint/ktlintSourceSetCheck.json'\n end",
"def test_files # :nodoc:\n # Handle the possibility that we have @test_suite_file but not\n # @test_files. This will happen when an old gem is loaded via\n # YAML.\n if defined? @test_suite_file\n @test_files = [@test_suite_file].flatten\n @test_suite_file = nil\n end\n if defined?(@test_files) and @test_files\n @test_files\n else\n @test_files = []\n end\n end",
"def files\n { 'branches_without_pulls.md' => { content: report } }\n end",
"def files\n return @files\n end",
"def files\n @files ||= []\n end",
"def files\n sheet_variables.with_files.select { |o| o.response_file.size > 0 }.collect do |sheet_variable|\n [\n \"FILES/sheet_#{id}/#{sheet_variable.variable.name}/#{sheet_variable[:response_file]}\",\n sheet_variable.response_file.path\n ]\n end\n end",
"def get_report_uris(report_filter)\n return [] if report_filter == NONE_REPORT_FILTER\n\n interpolate_local_report_uris(@config.report_uris)\n end",
"def getFileReports(array)\n\t\t\thashes = array\n\t\t\t# Get multiple file reports\n\t\t\ti = 0\n\t\t\thashes = hashes.uniq\n\t\t\twhile i < hashes.size\n\t\t\t\t4.times do\n\t\t\t\t\tif hashes == nil\n\t\t\t\t\t\tbreak\n\t\t\t\t\telse\n\t\t\t\t\t\tputs \"[*] Fetching file report for #{hashes[i].slice(0)} (#{i+1}/#{hashes.size})\"\n\t\t\t\t\t\thashes[i] << VirusTotal.new.get_file_report(hashes[i].slice(0))\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\ti += 1\n\t\t\tend\n\t\t\tif i >= (hashes.size - 4)\n\t\t\t\tputs \"[*] Skipping 4.times loop, i am all done..\"\n\t\t\t\treturn hashes\n\t\t\telse\n\t\t\t\tputs \"[*] Sleeping 65 seconds.\"\n\t\t\t\tsleep(65)\n\t\t\tend\n\t\tend",
"def reports\n # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]\n x = Puppet[:reports].gsub(/(^\\s+)|(\\s+$)/, '').split(/\\s*,\\s*/)\n end",
"def getReport(filename)\n result = @driver.GetGeneratedReports(:ApiKey => @apikey)\n if result.getGeneratedReportsResult.errorCode == \"0\" then\n response = result.getGeneratedReportsResult.items.apiResponseItem\n @reportlist = Hash.new\n response.each do |res|\n @reportlist.update(res.filename => res.fullPath)\n end\n output = @reportlist[filename]\n else\n output = result.getGeneratedReportsResult.errorMessage\n end\n return output\n end",
"def files\n directory.files\n\n #@files ||= (\n # files = []\n # Dir.recurse(directory.to_s) do |path|\n # next if IGNORE_FILES.include?(File.basename(path))\n # files << path.sub(directory.to_s+'/','')\n # end\n # files.reject{ |f| File.match?(CONFIG_FILE) }\n #)\n end",
"def files\n self.assets.reject{ |asset| asset.image? }\n end",
"def files\n @@files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n end",
"def files\n @files ||= FILE_RANGE.map(&:to_sym)\n end",
"def getOutputFiles\n if (self.getCompleted)\n file_list = JSON.parse(@client[\"/StatsDownloadUrls?loadTestId=#{@test_id}\"].get)['outputFiles']\n if (file_list && file_list.length == @server_cnt)\n file_list\n end\n end\n end",
"def files\n result = []\n @my_files.each do |f|\n result << f.fname if FileTest.file?(f.fname)\n end\n result\n end",
"def filenames\n @filenames ||= files.map(&:to_s)\n end",
"def files\n info[\"Files\"].to_a\n end",
"def getInstalledFiles\n warning \"This dependency (#{@Name}) doesn't support getting file list for \" \\\n 'precompiled binary'\n false\n end",
"def files\n @files.values\n end",
"def files\n return get_result('files')\n end",
"def files\n entries.map(&:filepath)\n end",
"def all_filenames\n\n\n # This checks for it being an array and not nil!\n # return @filenames if @filenames && !@filenames.empty?\n\n # This means we can add files to the output\n return $filenames if $filenames && $filenames.size > 5 # I guess that small numbers are errors too\n \n if @directory\n @output_directory ||= File.join(@directory, 'Build')\n $filenames = Dir.glob(File.join(@directory, \"**/*\")).map {|file|\n next if file.start_with?(@output_directory)\n next if File.directory?(file)\n file.gsub(@directory+\"/\", \"\")\n }.compact\n else\n []\n end\n end",
"def reports_path; end",
"def reports_path; end",
"def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end",
"def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end",
"def uncommitted_files\n files = nil\n p4 (['change','-o']).each do |line|\n files << line.strip if files\n files = [] if line.start_with?('Files:')\n end\n files ||= []\n end",
"def spotbugs_issues(report_file)\n spotbugs_report = spotbugs_report(report_file)\n\n source_dirs = spotbugs_report.xpath('//BugCollection//SrcDir').map(&:text)\n\n spotbugs_report.xpath('//BugCollection//BugInstance').map do |bug_instance|\n BugInstance.new(root_path, source_dirs, bug_instance)\n end\n end",
"def dependent_files\n processed.map(&:abs_path).compact.select { |fn| File.exist?(fn) }\n end",
"def file_list\n @file_list\n end",
"def issues\n @issues ||=\n output\n .fetch(:files, [])\n .flat_map { |file| create_issues_from(file) }\n end",
"def get_report_types\n \n LOGGER.info \"list all report types\"\n Reports::ReportFactory::REPORT_TYPES.collect{ |t| get_uri(t) }.join(\"\\n\")\n end",
"def report_types\n return TrendReport.all_reports\n end",
"def files\n file_sets.map{|fs| fs.files }.flatten\n end",
"def reports?\n !reports.empty?\n end",
"def files\n files_equivs = \"\"\n @package.documents.each do |file|\n ActiveRecord::Base.logger.info(\"#{file.attach_file_name} #{file.install_path}\")\n files_equivs += \"#{file.attach_file_name} #{file.install_path}\\n\\t\"\n end\n files_equivs\n end",
"def files\n FileUtils.cd(@ruhoh.paths.theme) {\n return Dir[\"**/*\"].select { |filepath|\n next unless self.is_valid_asset?(filepath)\n true\n }\n }\n end",
"def files\n if @array_of_ltfsfiles.empty? then parse(@filedata) else @array_of_ltfsfiles end\n end",
"def submitted_files(path = self.path)\n files = []\n files = files(path) if directory_num\n files\n end",
"def files\n @files_array = Dir.entries(self.path).select {|f| !File.directory? f}\n # This returns:\n # [\"Action Bronson - Larry Csonka - indie.mp3\",\n # \"Real Estate - Green Aisles - country.mp3\",\n # \"Real Estate - It's Real - hip-hop.mp3\",\n # \"Thundercat - For Love I Come - dance.mp3\"]\n end",
"def files\n Outpost::Config.instance.files\n end",
"def file_path_list\n @file_path_list ||= self.class.default_file_path_list\n end",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def files\n [@nuspec_file, @changelog_file, @readme_file]\n end",
"def files\n files = []\n Dir.new(self.path).each do |file|\n files << file if file.length > 4\n end\n files\n end",
"def files()\n children.select { |c| c.file? }\n end",
"def files\n @files ||= preferred_sources([@path])\n end",
"def all_reports\n reports = []\n bookings.each do |booking|\n reports << booking.report unless booking.report.nil?\n end\n reports.reverse\n end",
"def download_paths\n if @download.nil?\n raise \"File must be downloaded\"\n else\n @download.paths\n end\n end",
"def files\n file_sets.map(&:original_file)\n end",
"def get_file_specs\n\n\t\t\tproj_dir = ENV['TM_PROJECT_DIRECTORY']\n\t\t\tfile_specs = ENV['TM_FLEX_FILE_SPECS']\n\n\t\t\tif proj_dir && file_specs\n\t\t\t\tfile_specs = proj_dir + '/' + file_specs\n\t\t\t\treturn file_specs if File.exist?(file_specs)\n\t\t\tend\n\n\t\t\tif proj_dir\n\t\t\t\tfile_specs = guess_file_specs(proj_dir)\n\t\t\t\treturn file_specs unless file_specs.nil? \n\t\t\tend\n\n\t\t\tfile_specs = ENV['TM_FILEPATH']\n\n\t\tend",
"def files\n @files ||= full_files.map {|file| relative(file) }\n end",
"def files\n if !@files\n files = Dir.glob(\"#{working_dir}/*\").map {|f| f.split(working_dir)[1][1..-1]}\n files.delete config_file\n @files = files\n end\n return @files\n end",
"def messages\n reports.map { |r| r.to_s }\n end",
"def list_of_directories\n Dir.entries(\"./inspections\").select {|d| !d.start_with?(\".\") }\n end",
"def output_files\n @output_files ||= Fileset.new\n end",
"def output_files\n @output_files ||= Fileset.new\n end",
"def LoadedProjectFiles\n @LoadedProjectFilesList\n end",
"def related_files\n []\n end",
"def check_for_inexistent_files\n inexistent_files = []\n @files.each do |file|\n inexistent_files << file unless File.exists? file\n end\n\n inexistent_files\n end",
"def decide_files(file)\n return file if file\n spec_files\n end",
"def decide_files(file)\n return file if file\n spec_files\n end",
"def files\n @files = Dir[File.join(root(:site), '**', '*')].inject([]) do |a, match|\n # Make sure its the canonical name\n path = File.expand_path(match)\n file = path.gsub /^#{Regexp.escape root(:site)}\\/?/, ''\n ext = File.extname(file)[1..-1]\n \n if ignored_files.include?(path) or File.directory?(match)\n # pass\n elsif not get_renderer(ext).nil? # Has a renderer associated\n fname = file.chomp(\".#{ext}\")\n fname += get_renderer(ext).default_ext unless File.basename(fname).include?('.')\n a << fname\n else\n a << file\n end\n a\n end\n end",
"def output_files\n @output_files ||= Fileset.new()\n end",
"def get_report_list\n res=api_call('GetReportList')[:data]\n end",
"def files\n return @files if @files and not @files.empty?\n\n @files = []\n\n each_zip_entry do |entry|\n @files << entry.name\n end\n\n @files\n end",
"def tracked_files\n all_files.reject { |f| ignore_matcher.matched?(f) }\n end",
"def files\n @files ||= Dir.glob(File.join(@root, '**/*'), GLOB_FLAGS).select do |path|\n File.file?(path) && path !~ IGNORE_REGEX\n end\n end",
"def reporters\n raw_data['reporters']\n end",
"def files\n templates.map(&:filename)\n end",
"def attachments_for_export\n []\n end",
"def described_datafiles\n if sip_descriptor\n sip_paths = sip_descriptor_datafile_info.keys\n\n cached_datafiles.inject([]) do |acc, df|\n sp = df['sip-path']\n acc << df if sip_descriptor_datafile_info.has_key? sp\n acc\n end\n\n else\n []\n end\n end",
"def helper_files\n source_dir = File.join(Dir.pwd, \"lib/drydock/jobs\", helper_source_dir)\n if Dir.exists?(source_dir)\n Dir[source_dir + \"/*\"]\n else\n []\n end\n end",
"def filenames\n files.map(&:filename)\n end",
"def filenames\n files.map(&:filename)\n end",
"def filenames\n files.map(&:filename)\n end",
"def test_connection\n if !File.file?(@report_file)\n return \"Can't find path to report file: #{@report_file}\"\n end\n nil\n end",
"def screenshots_dir\n File.join(@report_dir, \"screenshots\")\n end",
"def testfiles(is_refresh = false)\n return @test_files if @test_files and not is_refresh\n return @test_files =[ name ] if name =~ /\\.xlw$/ # TO-DO implement better listing of xlw files\n @test_files, error_array = List.testfiles(self.name)\n error_array.each {|e| errors.add('Name:',e)}\n return @test_files\n end",
"def read_failing_log()\n failed_files = []\n\n # Read in the file\n file = File.readlines(@failing_log)\n\n # Get lines which begin with rspec\n file.each do |line|\n if line =~ /rspec \\.\\//\n # Get the file name only\n failed_files << get_error_info(line)\n end\n end\n\n return failed_files\n end",
"def report?\n report = parent_report.report?\n run_report = report && report[\"runs\"] && report[\"runs\"][stage_path]\n return nil if run_report && run_report[\"url\"] != build.url\n run_report\n end",
"def files\n return [] unless meta?\n filename = meta['path'] + '/' + meta['filename']\n [\n Inch::Utils::CodeLocation.new('', filename, meta['lineno'])\n ]\n end",
"def fix_reports(reports)\n # list all files, even if not tracked by Coverband (0% coverage)\n tracked_glob = Coverband.configuration.tracked_search_paths\n filtered_report_files = {}\n\n reports.each_pair do |report_name, report_data|\n filtered_report_files[report_name] = {}\n report_files = Coverband::Utils::Result.add_not_loaded_files(report_data, tracked_glob)\n\n # apply coverband filters\n report_files.each_pair do |file, data|\n next if Coverband.configuration.ignore.any? { |i| file.match(i) }\n\n filtered_report_files[report_name][file] = data\n end\n end\n filtered_report_files\n end",
"def extract_reports\n #puts \" Document.extract_reports\"\n # consider changing this to use split on a raw array to split by \\f then by \\n\n @raw_reports = []\n pending_report = true\n lines # read all the lines in the document file\n \n @pages = []\n collect_pages\n #puts \" collect_pages returned #{@pages}\"\n # We now have all the lines of the file and an array of the sets of pages in the file\n # Now determine where a report ends and collect those pages.\n r = Report.new()\n @pages.each_with_index do |page, i|\n r.add_page(@lines[page.first_line..page.last_line])\n pending_report = true\n current_line = page.first_line\n while current_line <= page.last_line\n if @lines[current_line].end_of_report?\n @raw_reports << r\n r = Report.new()\n pending_report = false\n break #report was added to array of reports \n end \n current_line += 1 \n end\n \n end\n if pending_report\n @raw_reports << r\n end \n @raw_reports\n end",
"def reports\n collection(\"reports\")\n end",
"def decide_files(file)\n return file if file\n spec_files\n end",
"def strings(report_keys)\n if report_keys and report_keys.respond_to?(:first) and report_keys.first.is_a?(ReportKey)\n report_keys.map{|r| r.code}\n else\n [\"\"]\n end\n end",
"def get_files_to_keep\n return @resource[:files_to_keep]\n end",
"def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end",
"def list_other_files\n\n list = []\n\n Dir[\"#{@directory_path}/*\"].each do |entry|\n\n raise PackageError, \"Found subdirectory '#{entry}' in package\" if File.directory?(entry)\n raise PackageError, \"Found unreadable file '#{entry}' in package\" unless File.readable?(entry)\n\n filename = File.basename entry\n next if [ '.', '..', 'manifest.xml', 'marc.xml', 'mets.xml', \"#{directory_name}.xml\" ].include? filename\n list.push filename\n end\n\n return list\n end",
"def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end",
"def report_file\n File.join(@report_dir, \"#{@id}.json\")\n end",
"def rpm_ghost_files\n @ghost_files.to_a\n end"
] |
[
"0.6313074",
"0.6047547",
"0.5837352",
"0.5810982",
"0.5669092",
"0.56635225",
"0.56498194",
"0.5579815",
"0.5519284",
"0.54893845",
"0.54874134",
"0.54189825",
"0.54014516",
"0.53965956",
"0.53937376",
"0.53611314",
"0.53464466",
"0.53372395",
"0.53268003",
"0.5320092",
"0.5266953",
"0.5266281",
"0.523993",
"0.5191109",
"0.51684964",
"0.516167",
"0.5159344",
"0.5154345",
"0.5144726",
"0.5112736",
"0.5112736",
"0.5110245",
"0.5110245",
"0.5082356",
"0.50816363",
"0.5073735",
"0.5031612",
"0.50243205",
"0.5022552",
"0.50127316",
"0.50058675",
"0.5002134",
"0.4990313",
"0.4988466",
"0.4988136",
"0.49757263",
"0.49690506",
"0.49682805",
"0.4961551",
"0.4960296",
"0.4960296",
"0.4943321",
"0.49424803",
"0.4940333",
"0.4927463",
"0.49251574",
"0.4922753",
"0.49224073",
"0.4919378",
"0.49120766",
"0.49117583",
"0.4893844",
"0.48880342",
"0.48880342",
"0.48878807",
"0.48832998",
"0.48746943",
"0.48618641",
"0.48618641",
"0.48615202",
"0.48556495",
"0.48528194",
"0.48465708",
"0.48404017",
"0.483627",
"0.4836228",
"0.48314682",
"0.48194075",
"0.4791331",
"0.47901493",
"0.47806323",
"0.47806323",
"0.47806323",
"0.47786054",
"0.47681525",
"0.47645393",
"0.4758679",
"0.4757654",
"0.47573218",
"0.47504136",
"0.47473207",
"0.47445238",
"0.47406173",
"0.47322297",
"0.4731166",
"0.47188717",
"0.47136876",
"0.47135282",
"0.47132838",
"0.4705929"
] |
0.75638413
|
0
|
Calls SpotBugs task of your Gradle project. It fails if `gradlew` cannot be found inside current directory. It fails if `report_file` cannot be found inside current directory. It fails if `report_files` is empty.
|
def report(inline_mode: true)
unless skip_gradle_task
raise('Could not find `gradlew` inside current directory') unless gradlew_exists?
exec_gradle_task
end
report_files_expanded = Dir.glob(report_files).sort
raise("Could not find matching SpotBugs report files for #{report_files} inside current directory") if report_files_expanded.empty?
do_comment(report_files_expanded, inline_mode)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lint\n unless gradlew_exists?\n fail(\"Could not find `gradlew` inside current directory\")\n return\n end\n\n unless SEVERITY_LEVELS.include?(severity)\n fail(\"'#{severity}' is not a valid value for `severity` parameter.\")\n return\n end\n\n system \"./gradlew #{gradle_task || 'lint'}\"\n\n unless File.exists?(report_file)\n fail(\"Lint report not found at `#{report_file}`. \"\\\n \"Have you forgot to add `xmlReport true` to your `build.gradle` file?\")\n end\n\n issues = read_issues_from_report\n filtered_issues = filter_issues_by_severity(issues)\n\n message = message_for_issues(filtered_issues)\n markdown(message) unless filtered_issues.empty?\n end",
"def spotbugs_issues(report_file)\n spotbugs_report = spotbugs_report(report_file)\n\n source_dirs = spotbugs_report.xpath('//BugCollection//SrcDir').map(&:text)\n\n spotbugs_report.xpath('//BugCollection//BugInstance').map do |bug_instance|\n BugInstance.new(root_path, source_dirs, bug_instance)\n end\n end",
"def spotbugs_report(report_file)\n require 'oga'\n Oga.parse_xml(File.open(report_file))\n end",
"def report_file\n @report_file ||= 'app/build/reports/spotbugs/release.xml'\n end",
"def report\n ktlint_report_file_complete = \"#{Dir.pwd}/#{ktlint_report_file}\"\n detekt_report_file_complete= \"#{Dir.pwd}/#{detekt_report_file}\"\n\n check_file_integrity(ktlint_report_file_complete)\n check_file_integrity(detekt_report_file_complete)\n\n ktlint_issues = read_issues_from_report(ktlint_report_file)\n detekt_issues = read_issues_from_report(detekt_report_file)\n\n report_issues(ktlint_issues)\n report_issues(detekt_issues)\n end",
"def lint(inline_mode: false)\n unless skip_gradle_task\n return fail(\"Could not find `gradlew` inside current directory\") unless gradlew_exists?\n end\n\n unless skip_gradle_task\n if use_staged_file_only\n targets = target_files(git.added_files + git.modified_files)\n system \"./gradlew #{gradle_task} -PinternalKtlintGitFilter=\\\"#{targets.join('\\n')}\\\"\" #todo make it work\n else\n system \"./gradlew #{gradle_task}\"\n end\n end\n\n json_files = report_file.split(',')\n results = []\n json_files.each do |jsonFile|\n unless File.exists?(jsonFile)\n next\n end\n results += JSON.parse(File.read(jsonFile))\n end\n if results.empty?\n print(\"Skipping ktlinting because no report files available\")\n end\n\n if inline_mode\n send_inline_comments(results)\n else\n send_markdown_comment(results)\n end\n end",
"def do_comment(report_files, inline_mode)\n spotbugs_issues = []\n\n report_files.each do |report_file|\n spotbugs_issues(report_file).each do |bug_instance|\n next unless target_files.include? bug_instance.relative_path\n\n spotbugs_issues.push(bug_instance)\n\n send_comment(bug_instance, inline_mode)\n end\n end\n\n spotbugs_issues\n end",
"def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end",
"def run_all\n fail \"no scanner opts (start not called?)!\" if @scanner_opts.nil?\n tracker.run_checks\n ::Brakeman.filter_warnings tracker, @scanner_opts\n print_failed\n throw :task_has_failed if tracker.filtered_warnings.any?\n end",
"def write_report!\n notify.critical_error(\"Must run `test!` before writing a report\") if test.status.nil?\n in_test_dir do\n self.writer = GitTest::Writer.new(:path => report_path,\n :name => report_name,\n :report => test.report )\n in_report_branch do\n writer.save!\n commit_to_test_proj!\n end\n end\n end",
"def check(file)\n rhino_jar = rhino\n js_file = locate_lib\n\n raise FileNotFoundError.new(\"Unable to locate Rhino jar '#{rhino_jar}'\") if !rhino_jar || !File.exists?(rhino_jar)\n raise FileNotFoundError.new(\"Unable to locate JsLint '#{js_file}'\") if !js_file || !File.exists?(js_file)\n raise FileNotFoundError.new(\"Unable to locate input file '#{file}'\") unless File.exists?(file)\n\n lines = execute(\"-jar\", rhino, locate_lib, file).split(\"\\n\")\n return Report.new if lines.length == 1 && lines[0] =~ /jslint: No problems/\n\n report = Report.new\n lines = lines.reject { |line| !line || \"#{line}\".strip == \"\" }\n report.add_error(lines.shift, lines.shift) while lines.length > 0\n\n return report\n end",
"def test_connection\n if !File.file?(@report_file)\n return \"Can't find path to report file: #{@report_file}\"\n end\n nil\n end",
"def run\n print \"Checking markdown files...\"\n\n load_files\n load_releases\n check\n check_releases\n report\n\n exit(1) if errors.any? && exit_on_errors\n end",
"def bug_report\n raise BakerError, <<-EOS\n Bug reporting has not yet been implimented.\n Manually send a bug report to #{@maintainer}.\n EOS\n end",
"def all_site_report(ticket_repository, options, helper,\n historical_scan_file = File.join(File.dirname(__FILE__), \"#{options[:file_name]}\"))\n log_message('First time run, generating full vulnerability report.') if @first_time\n log_message('No site(s) specified, generating full vulnerability report.') if options[:sites].empty?\n all_delta_vulns = ticket_repository.all_vulns(severity: options[:severity])\n log_message('Preparing tickets.')\n tickets = helper.prepare_create_tickets(all_delta_vulns)\n helper.create_tickets(tickets)\n log_message(\"Done processing, updating historical CSV file #{historical_scan_file}.\")\n ticket_repository.save_last_scans(historical_scan_file)\n log_message('Done updating historical CSV file, service shutting down.')\n end",
"def gradle_task\n @gradle_task ||= 'spotbugsRelease'\n end",
"def report_file\n @report_file || 'app/build/reports/ktlint/ktlintSourceSetCheck.json'\n end",
"def files_with_tasks_to_run\n\n # load all tasks into self.all_tasks\n get_tasks_from_rakefiles\n\n set_and_log_tasks_already_ran(self.all_tasks)\n set_and_log_duplicate_tasks(self.all_tasks_not_previously_run)\n\n close_log_if_this_created_it(log)\n\n rakefiles_with_tasks_to_run\n\n rescue => error\n log.error(\"Error during #{self.class.name} #{__method__}! #{error}\") unless log.nil?\n raise error\n end",
"def start\n setup_files\n create_report\nend",
"def create_report\n dir = Dir.pwd\n file_name = \"#{@name}.log\"\n reports_dir = dir + \"/spec/reports\"\n if File.directory? reports_dir\n @spec_report_file = File.open(reports_dir + \"/\" + file_name, 'w')\n @spec_report_file.puts \"WatirmarkLog: \" + @name\n else\n #spec/Reports directory does not exits\n @spec_report_file = nil\n end\n end",
"def perform(*reports)\n reports.each do |report|\n run_report(report)\n rescue StandardError => e\n report.update status: 'error'\n raise e\n end\n end",
"def report_check_run_failure\n data = params\n check_run = data[:check_run]\n check_run_status = check_run[:status]\n sha = check_run[:head_sha]\n workflow_name = check_run[:name]\n conclusion = check_run[:conclusion]\n check_run_url = check_run[:html_url]\n check_suite = check_run[:check_suite]\n app_name = check_run[:app][:name]\n details_url = check_run[:details_url]\n pull_requests = check_suite[:pull_requests]\n pull_request = pull_requests[0]\n branch = check_suite[:head_branch]\n repository = data[:repository]\n repo_name = repository[:name]\n repo_url = repository[:html_url]\n sender_login = data[:sender][:login]\n pr_number = pull_request[:number] if pull_request.present?\n branch_path = ''\n branch_path = \"/tree/#{branch}\" if branch != 'master'\n\n # We are only interested in completed non-success\n return if check_run_status != 'completed' || conclusion == 'success'\n\n message = \"[ [#{repo_name}](#{repo_url}) ]\"\n message += if app_name == 'GitHub Actions'\n \" GitHub Action workflow [#{workflow_name}](#{check_run_url}):\"\n else\n \" Check run [#{workflow_name}](#{check_run_url}):\"\n end\n message += if pull_request.present?\n \" [#{conclusion}](#{repo_url}/pull/#{pr_number}/checks?sha=#{sha})\"\n else\n \" [#{conclusion}](#{details_url})\"\n end\n message += \" on [#{sha.first(7)}](#{repo_url}/commit/#{sha.first(10)})\"\n message += \" by #{sender_login}\" if sender_login.present?\n message += \" in the [#{branch}](#{repo_url}#{branch_path}) branch\" if branch.present?\n message += \" for [PR ##{pr_number}](#{repo_url}/pull/#{pr_number})\" if pull_request.present?\n\n # We don't want to send more than one message for this workflow & sha with the same conclusion within 20 minutes.\n # This counter expires from Redis in 20 minutes.\n ci_counter = Redis::CI.new(\"check_run_#{workflow_name}_#{conclusion}_#{sha}\")\n ci_counter.sucess_count_incr\n ActionCable.server.broadcast 'smokedetector_messages', message: message if ci_counter.sucess_count == 1\n end",
"def update_bug_reports(bugs, build_number)\n puts \"Updating bug reports...\"\n # update bugzilla reports\n bugs.each do |bug|\n bug_data = find_bug_by_id(bug[:task_num])\n if (bug_data)\n # bug was found, update comments and status\n update_bug(bug_data, bug, build_number)\n # set bug title in task object\n bug[:task_name] = bug_data['internals']['short_desc']\n else\n # unknown bug, notify author of commit\n @email_reporter.notify_bug_id_not_found(bug)\n end\n end\n end",
"def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end",
"def task_warning( task )\n warn \"WARNING: '#{task}' tasks are not defined. Please run 'rake develop'\"\n end",
"def run!(salus_report:, required:, pass_on_raise:, reraise:)\n @@mutex.synchronize do\n @salus_report = salus_report\n salus_report.add_scan_report(@report, required: required)\n @builds = @salus_report&.builds\n end\n\n begin\n @report.record do\n Timeout.timeout(scanner_timeout) { run }\n end\n\n update_report_status(pass_on_raise) if @report.errors.any?\n rescue Timeout::Error\n error_message = \"Scanner #{name} timed out after #{scanner_timeout} seconds\"\n timeout_error_data = {\n message: error_message,\n error_class: ScannerTimeoutError\n }\n\n update_report_status(pass_on_raise)\n record_error(timeout_error_data)\n bugsnag_notify(error_message)\n\n # Propagate this error if desired\n raise ScannerTimeoutError, timeout_error_data[:message] if reraise\n rescue StandardError => e\n error_data = {\n message: \"Unhandled exception running #{name}: #{e.class}: #{e}\",\n error_class: e.class,\n backtrace: e.backtrace.take(5)\n }\n\n update_report_status(pass_on_raise)\n\n # Record the error so that the Salus report captures the issue.\n record_error(error_data)\n\n raise if reraise\n ensure\n @@mutex.synchronize do\n Salus::PluginManager.send_event(:scan_executed, { salus_report: @salus_report,\n scan_report: @report })\n end\n end\n end",
"def create_xml(config)\n info \"Running findbugs with results written to xml output file\"\n config.ant.findbugs :home=>config.findbugs_home,\n :output => \"xml\",\n :outputFile => config.findbugs.output_file,\n :effort => config.effort,\n :failOnError => config.fail_on_error do\n if config.aux_classpath != nil\n config.ant.auxClasspath :path => config.aux_classpath\n end\n config.ant.sourcePath :path => config.src_path\n config.ant.method_missing :class, :location => config.class_location\n end\n end",
"def lint_files(files = nil)\n # Installs a prose checker if needed\n system 'pip install --user proselint' unless proselint_installed?\n\n # Check that this is in the user's PATH after installing\n raise \"proselint is not in the user's PATH, or it failed to install\" unless proselint_installed?\n\n # Either use files provided, or use the modified + added\n markdown_files = get_files files\n\n proses = {}\n to_disable = disable_linters || [\"misc.scare_quotes\", \"typography.symbols\"]\n with_proselint_disabled(to_disable) do\n # Convert paths to proselint results\n result_jsons = Hash[markdown_files.to_a.uniq.collect { |v| [v, get_proselint_json(v)] }]\n proses = result_jsons.select { |_, prose| prose['data']['errors'].count > 0 }\n end\n\n # Get some metadata about the local setup\n current_slug = env.ci_source.repo_slug\n\n # We got some error reports back from proselint\n if proses.count > 0\n message = \"### Proselint found issues\\n\\n\"\n proses.each do |path, prose|\n git_loc = \"\"\n if defined? @dangerfile.github\n git_loc = \"/#{current_slug}/tree/#{github.branch_for_head}/#{path}\"\n elsif defined? @dangerfile.gitlab\n git_loc = \"/#{current_slug}/tree/#{gitlab.branch_for_head}/#{path}\"\n else\n raise \"This plugin does not yet support bitbucket, would love PRs: https://github.com/dbgrandi/danger-prose/\"\n end\n\n message << \"#### [#{path}](#{git_loc})\\n\\n\"\n\n message << \"Line | Message | Severity |\\n\"\n message << \"| --- | ----- | ----- |\\n\"\n\n prose['data']['errors'].each do |error|\n message << \"#{error['line']} | #{error['message']} | #{error['severity']}\\n\"\n end\n end\n\n markdown message\n end\n end",
"def start_reporting!\n return unless registered? && configured?\n\n self.behavior = :notify\n\n queue.start! do |e|\n unless self.reporter.has_access?\n warn \"couldn't access issues for #{self.config[:repo]}, check your configuration\"\n reset!\n end\n\n begin\n self.reporter.submit_issue!(e)\n rescue => e\n warn \"error submitting issue: #{e.class} #{e.message}\"\n reset!\n end\n end\n end",
"def send_comment(results)\n dir = \"#{Dir.pwd}/\"\n results.each do |r|\n filename = results[\"filePath\"].gsub(dir, \"\")\n fail(\"File not formatted with Prettier\", file: filename, line: 0)\n end\n end",
"def report_exploit(opts={})\n return if not db\n opts = {\n :workspace => myworkspace,\n :task => mytask\n }.merge(opts)\n framework.db.report_exploit(opts)\n end",
"def run\n @report = Report.new\n @report.plugin = self\n build_report\n rescue Exception => e\n @report.error e\n ensure\n return @report\n end",
"def send(reports)\n tagmail_conf = self.class.instance_variable_get(:@tagmail_conf)\n # Run the notification process in a new non-blocking thread\n\n # Starting a new thread has been commented out as it causes conflict with IO.popen, where the thread just dies\n # after the first run.\n # Thread.new {\n if tagmail_conf[:smtpserver] && tagmail_conf[:smtpserver] != 'none'\n begin\n Net::SMTP.start(tagmail_conf[:smtpserver], tagmail_conf[:smtpport], tagmail_conf[:smtphelo]) do |smtp|\n reports.each do |emails, messages|\n smtp.open_message_stream(tagmail_conf[:reportfrom], *emails) do |p|\n p.puts \"From: #{tagmail_conf[:reportfrom]}\"\n p.puts \"Subject: Puppet Report for #{host}\"\n p.puts 'To: ' + emails.join(', ')\n p.puts \"Date: #{Time.now.rfc2822}\"\n p.puts\n p.puts messages\n end\n end\n end\n rescue StandardError => detail\n message = \"Could not send report emails through smtp: #{detail}\"\n Puppet.log_exception(detail, message)\n raise Puppet::Error, message, detail.backtrace\n end\n else\n begin\n reports.each do |emails, messages|\n email = Tempfile.new('tagmail')\n begin\n email.write(\"From: #{tagmail_conf[:reportfrom]}\\n\")\n email.write(\"Subject: Puppet Report for #{host}\\n\")\n email.write(\"To: #{emails.join(', ')}\\n\\n\")\n email.write(messages)\n email.rewind\n Puppet::Util::Execution.execute(\"#{tagmail_conf[:sendmail]} #{emails.join(' ')} < #{email.path}\")\n ensure\n email.close\n email.unlink\n end\n end\n rescue StandardError => detail\n message = \"Could not send report emails via sendmail: #{detail}\"\n Puppet.log_exception(detail, message)\n raise Puppet::Error, message, detail.backtrace\n end\n end\n # }\n end",
"def make_sourcery_wxs_file_task\n return if Rake::FileTask.task_defined? 'wix/Sourcery.wxs'\n sourcery = Rake::FileTask.define_task 'wix/Sourcery.wxs' do |t|\n if File.directory? 'wix/src'\n args = []\n args << '-nologo' # Skip printing of the WiX logo\n args << '-sfrag' # Suppress fragments\n args << '-srd' # Don't harvest the root directory e.g. wix\\src\n args << '-ag' # Auto generate GUIDs\n args << '-template fragment'\n args << '-dr INSTALLDIR'\n args << '-var var.Source'\n args = args.join(' ')\n wix_run 'heat', \"dir wix/src #{args} -out #{t.name}\"\n end\n end\n sourcery.comment = 'Create the Sourcery.wxs file'\n sourcery.enhance ['wix']\n sourcery.enhance @files.values\n end",
"def skip_gradle_task\n @skip_gradle_task ||= false\n end",
"def skip_gradle_task\n @skip_gradle_task ||= false\n end",
"def gradle_task\n @gradle_task ||= \"ktlintCheck\"\n end",
"def report_fixes(files, marker=nil)\n glist = check_for_fixes(files, marker)\n unless glist.empty?\n puts \"\\nYou may need to fix the occurances of missing information in the following files:\\n\\n\"\n glist.each do |file|\n puts \" #{file}\"\n end\n puts\n end\n end",
"def lint\n return if target_files.empty?\n\n bin = textlint_path\n result_json = run_textlint(bin, target_files)\n errors = parse(result_json)\n send_comment(errors)\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n Salus::PluginManager.send_event(:report_warn, { type: type, message: message })\n if @builds\n scanner = @report.scanner_name\n message = \"#{scanner} warning: #{type}, #{message}, build: #{@builds}\"\n end\n bugsnag_notify(message)\n end",
"def email_report(project_name, build_number, msg)\n email_message(\"#{project_name} build #{build_number}\", msg, @notify_list, true)\n end",
"def check_for_required_files(opts={})\n missing_files = 0\n $generated_files.each do |f|\n if !File.exists?(f)\n puts \"Required file missing: #{f}\"\n missing_files +=1\n end\n end\n if missing_files > 0\n error = \"#{missing_files} required files not found. Run `rake build` before deploying.\"\n if opts[:warning] then puts error else fail error end\n end\nend",
"def send_report\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"The report you requested.\"\n end",
"def run(failed_files = [])\n real_flaky_tests = []\n\n if ENV['NO_FLAKY'] == \"true\"\n heading(\"Skipping flaky tests\")\n else\n heading(\"Rerunning failing tests in single thread!\")\n\n sleep 2\n system(\"sync\")\n \n # Run all failing tests separately with '--format doc' on the end.\n failed_files.each do |failed_file|\n status = system(\"rspec --format doc #{failed_file[:filename]}\")\n\n # This is a flaky test only, so record it\n real_flaky_tests << form_data(failed_file) if status == true\n end\n end\n\n return real_flaky_tests\n end",
"def show_report(file_name = nil, branch = proj_branch)\n file_name ||= last_report_file_name(branch)\n report = proj.show(report_branch, File.join(report_path(branch), file_name))\n report_file = Tempfile.new([report_name, report_extension])\n report_file.write(report)\n `open #{report_file.path}`\n sleep 3\n end",
"def make_reports(opts)\n # Get the gcovr version number.\n gcovr_version_info = get_gcovr_version()\n\n # Build the common gcovr arguments.\n args_common = args_builder_common(opts)\n\n if ((gcovr_version_info[0] == 4) && (gcovr_version_info[1] >= 2)) || (gcovr_version_info[0] > 4)\n # gcovr version 4.2 and later supports generating multiple reports with a single call.\n args = args_common\n args += args_builder_cobertura(opts, false)\n args += args_builder_sonarqube(opts, false)\n args += args_builder_json(opts, true)\n # As of gcovr version 4.2, the --html argument must appear last.\n args += args_builder_html(opts, false)\n\n print \"Creating gcov results report(s) in '#{GCOV_ARTIFACTS_PATH}'... \"\n STDOUT.flush\n\n # Generate the report(s).\n run(args)\n else\n # gcovr version 4.1 and earlier supports HTML and Cobertura XML reports.\n # It does not support SonarQube and JSON reports.\n # Reports must also be generated separately.\n args_cobertura = args_builder_cobertura(opts, true)\n args_html = args_builder_html(opts, true)\n\n if args_html.length > 0\n print \"Creating a gcov HTML report in '#{GCOV_ARTIFACTS_PATH}'... \"\n STDOUT.flush\n\n # Generate the HTML report.\n run(args_common + args_html)\n end\n\n if args_cobertura.length > 0\n print \"Creating a gcov XML report in '#{GCOV_ARTIFACTS_PATH}'... \"\n STDOUT.flush\n\n # Generate the Cobertura XML report.\n run(args_common + args_cobertura)\n end\n end\n\n # Determine if the gcovr text report is enabled. Defaults to disabled.\n if is_report_enabled(opts, ReportTypes::TEXT)\n make_text_report(opts, args_common)\n end\n end",
"def report\r\n if Post.exists?(params[:id])\r\n if params[:reports]\r\n @new_report = Report.create_new(params, @usr)\r\n if @new_report.errors.empty?\r\n unless Configs.get_config('mailing_list').blank?\r\n Configs.get_config('mailing_list').split(',').each do |email|\r\n ReportMailer.deliver_email(@new_report.user.name, email.strip, @new_report, request.env['HTTP_HOST'])\r\n end\r\n end\r\n redirecting t(:redir), session[:last_page]\r\n return\r\n end\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end",
"def report_errors\n yield\n rescue Exception => e\n puts \"Exception occured while running sketch #{File.basename SKETCH_PATH}:\"\n puts e.to_s\n puts e.backtrace.join(\"\\n\")\n end",
"def create_text(config)\n info \"Running findbugs with results printed to stdout\"\n config.ant.findbugs :home=>config.findbugs_home,\n :output => \"text\",\n :debug => config.debug,\n :effort => config.effort,\n :failOnError => config.fail_on_error do\n # puts \"attributes: #{config.ant.inspect}\"\n #puts \"auxclasspath: #{config.aux_classpath}, #{config.aux_classpath == nil}\"\n if config.aux_classpath != nil\n config.ant.auxClasspath :path => config.aux_classpath\n end\n config.ant.sourcePath :path => config.src_path\n config.ant.method_missing :class, :location => config.class_location\n end\n end",
"def report_service(opts={})\n return if not db\n opts = {\n :workspace => myworkspace,\n :task => mytask\n }.merge(opts)\n framework.db.report_service(opts)\n end",
"def gradle_task(options)\n \tgradle(\n \t\ttask: \":#{ENV[\"SCHEME\"]}:#{options[:task]}\",\n \t\tprint_command_output: true\n \t)\n end",
"def find_or_create_report(opts)\n\t\treport_report(opts.merge({:wait => true}))\n\tend",
"def run_linter\n fail NotImplementedError\n end",
"def run\n @file_paths.each do |path|\n process_file(path)\n end\n @report\n end",
"def findbugs_home(*dir)\n if dir.empty?\n @findbugs_home ||= project.path_to(:findbugs)\n else\n raise \"Invalid findbugs home dir '#{dir.join(', ')}\" unless dir.size == 1\n @findbugs_home = dir[0]\n self\n end\n end",
"def report!(msg = \"\")\n puts(\"#{caller.first}: #{msg}\")\n end",
"def run_warned; end",
"def run_rails_tests\n message \"Running tests. This may take a minute or two\"\n \n in_directory install_directory do\n if system_silently(\"rake -s test\")\n message \"All tests pass. Congratulations.\"\n else\n message \"***** Tests failed *****\"\n message \"** Please run 'rake test' by hand in your install directory.\"\n message \"** Report problems to #{@@support_location}.\"\n message \"***** Tests failed *****\"\n end\n end\n end",
"def _write_failed_paths_in_tmp\n FileUtils.mkdir_p('tmp')\n File.open('./tmp/rspec_guard_result','w') do |f|\n f.puts _failed_paths.join(\"\\n\")\n end\n rescue\n # nothing really we can do, at least don't kill the test runner\n end",
"def check_report_for_errors(report)\n @report_errors = report.logs.reject { |x| x.level != :err }.map { |x| x.message }\n if @report_errors.length > 0\n @errors << \"report contains #{@report_errors.length} errors\"\n end\n end",
"def report_host(opts)\n return if not db\n opts = {\n :workspace => myworkspace,\n :task => mytask\n }.merge(opts)\n framework.db.report_host(opts)\n end",
"def run_report_safely(run_status)\n run_report_unsafe(run_status)\n rescue Exception => e\n Chef::Log.error(\"Report handler #{self.class.name} raised #{e.inspect}\")\n Array(e.backtrace).each { |line| Chef::Log.error(line) }\n ensure\n @run_status = nil\n end",
"def execute\n Parallel.each(Dir[\"#{ENV['STAGE']}_files/*\"], progress: \"Progress by files\", in_process: 8) do |file|\n users = Concurrent::Array.new\n sessions = Concurrent::Array.new\n\n fill_data(file, users, sessions)\n ReportGenerator.new(users, sessions, file).execute\n end\n\n ReportJoiner.new(ENV[\"REPORT_FILE_PATH\"]).execute\n end",
"def send_comment(results)\n dir = \"#{Dir.pwd}/\"\n results['messages'].each do |r|\n filename = results['filePath'].gsub(dir, '')\n method = r['severity'] > 1 ? 'fail' : 'warn'\n send(method, r['message'], file: filename, line: r['line'])\n end\n end",
"def lint\n lint_results\n .reject { |r| r.nil? || r['messages'].length.zero? }\n .reject { |r| r['messages'].first['message'].include? 'matching ignore pattern' }\n .map { |r| send_comment r }\n end",
"def report_broken\n \"Broken\"\n end",
"def fast_and_slow_test_files_to_run\n test_files_to_run = all_test_files_to_run\n\n if adapter_class == KnapsackPro::Adapters::RSpecAdapter && KnapsackPro::Config::Env.rspec_split_by_test_examples?\n require 'rspec/core/version'\n unless Gem::Version.new(::RSpec::Core::Version::STRING) >= Gem::Version.new('3.3.0')\n raise 'RSpec >= 3.3.0 is required to split test files by test examples. Learn more: https://github.com/KnapsackPro/knapsack_pro-ruby#split-test-files-by-test-cases'\n end\n\n slow_test_files = get_slow_test_files\n\n KnapsackPro.logger.info(\"Generating RSpec test examples JSON report for slow test files to prepare it to be split by test examples (by individual 'it's. Thanks to that a single slow test file can be split across parallel CI nodes). Analyzing #{slow_test_files.size} slow test files.\")\n\n # generate RSpec JSON report in separate process to not pollute RSpec state\n cmd = [\n 'RACK_ENV=test',\n 'RAILS_ENV=test',\n KnapsackPro::Config::Env.rspec_test_example_detector_prefix,\n 'rake knapsack_pro:rspec_test_example_detector',\n ].join(' ')\n unless Kernel.system(cmd)\n raise \"Could not generate JSON report for RSpec. Rake task failed when running #{cmd}\"\n end\n\n # read JSON report\n detector = KnapsackPro::TestCaseDetectors::RSpecTestExampleDetector.new\n test_file_example_paths = detector.test_file_example_paths\n\n KnapsackPro::TestFilesWithTestCasesComposer.call(test_files_to_run, slow_test_files, test_file_example_paths)\n else\n test_files_to_run\n end\n end",
"def report(failure_message)\n puts failure_message\n end",
"def report(failure_message)\n puts failure_message\n end",
"def fail_without_prereqs(packer_yaml, simp_conf_yaml, vars_json)\n raise \"ERROR: Test dir not found at '#{@test_dir}'\" unless File.directory?(@test_dir)\n\n if @verbose\n warn(\n '', \"Contents of test_dir (#{@test_dir}):\",\n Dir[\"#{@test_dir}/*\"].map { |x| \" #{File.basename(x)}\\n\" }.join, ''\n )\n end\n # TODO: we shouldn't handle these files, we should accept data\n raise \"ERROR: packer.yaml not found at '#{packer_yaml}'\" unless File.file?(packer_yaml)\n raise \"ERROR: simp.conf.yaml not found at '#{simp_conf_yaml}'\" unless File.file?(simp_conf_yaml)\n raise \"ERROR: vars.json not found at '#{vars_json}'\" unless File.file?(vars_json)\n end",
"def run_and_handle_errors\n begin\n @report.run\n return true\n rescue Report::ReportError, Search::ParseError\n @report.errors.add(:base, $!.to_s)\n return false\n end\n end",
"def report_client(opts={})\n return if not db\n opts = {\n :workspace => myworkspace,\n :task => mytask\n }.merge(opts)\n framework.db.report_client(opts)\n end",
"def send_report\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"Daily report for #{Time.now}\"\n end",
"def run_report_safely(run_status)\n run_report_unsafe(run_status)\n end",
"def testMissingComment\n setupTest do |iTasksFileName, iTicketsFileName|\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end",
"def report\n report_metrics\n report_resources\n if run_status.failed?\n report_backtrace\n end\n end",
"def run!\n begin\n found = Project.find(@dir)\n rescue MissingProject\n ask_questions!\n make_directories!\n create_config!\n copy_sources!\n say color(\"Your project was created\", :green)\n say Montage::Commands::BLANK\n else\n raise Montage::ProjectExists, <<-ERROR.compress_lines\n A Montage project exists in a parent directory at\n `#{found.paths.root}'\n ERROR\n end\n end",
"def process_rb_project(filename, output_path)\n fail 'This feature is under development'.red\nend",
"def report_error\n mail to: 'mail@fishmarkt.ru', subject: '[Test] Error report'\n end",
"def report_failure\n @report.fail\n end",
"def report_failure\n @report.fail\n end",
"def buildwise_run_sequential_build_target(build_id, task_name) \r\n begin\r\n FileUtils.rm_rf(\"spec/reports\") if File.exist?(\"spec/reports\")\r\n Rake::Task[task_name].invoke\r\n ensure\r\n puts \"Finished: Notify build status\"\r\n sleep 2 # wait a couple of seconds to finish writing last test results xml file out\r\n puts \"[Rake] finish the build\"\r\n buildwise_finish_build(build_id)\r\n end\r\nend",
"def check_for_sass_files!(compiler)\n if compiler.sass_files.empty?\n message = \"Nothing to compile. If you're trying to start a new project, you have left off the directory argument.\\n\"\n message << \"Run \\\"compass -h\\\" to get help.\"\n raise Compass::Error, message\n end\n end",
"def bug_report_url()\n LibDrizzle.drizzle_bugreport\n end",
"def call\n # Only check this ONCE during a test run\n return if self.class.has_been_run\n\n # Be sure we don't do this again.\n self.class.has_been_run = true\n\n stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files\n\n # All done if no stale files!\n return if stale_gen_files.empty?\n\n # Inform the developer that we're ensuring gen assets are ready.\n puts_start_compile_check_message(stale_gen_files)\n\n hot_running = webpack_process_checker.hot_running?\n client_running = webpack_process_checker.client_running?\n server_running = webpack_process_checker.server_running?\n already_compiled_client_file = false\n\n # Check if running \"hot\" and not running a process to statically compile the client files.\n if hot_running && !client_running\n puts \"Appears you're running hot reloading and are not rebuilding client files \"\\\n \"automatically. We'll try rebuilding only your client files first.\"\n webpack_assets_compiler.compile_client(stale_gen_files)\n already_compiled_client_file = true\n\n stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files\n\n # Return if we're all done!\n return if stale_gen_files.empty?\n end\n\n loop_count = 0\n if (already_compiled_client_file && server_running) ||\n (!already_compiled_client_file && client_running)\n puts \"Waiting #{SECONDS_TO_WAIT} for webpack watch processes to compile files\"\n loop do\n sleep 1\n stale_gen_files = webpack_assets_status_checker.stale_generated_webpack_files\n loop_count += 1\n break if loop_count == SECONDS_TO_WAIT || stale_gen_files.empty?\n end\n end\n\n final_compilation_check(already_compiled_client_file, client_running, server_running, stale_gen_files)\n end",
"def comments_notify(report_id, report_comemnts, task_comments)\n @report = Report.find(report_id)\n @report_comments = report_comemnts\n @task_comments = task_comments\n\n mail(to: ADMIN_EMAILS, subject: t('.subject'))\n end",
"def testMissingTasks\n setupTest do |iTasksFileName, iTicketsFileName|\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--ticketsfile', iTicketsFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end",
"def detekt(inline_mode: false)\n unless skip_gradle_task || gradlew_exists?\n fail(\"Could not find `gradlew` inside current directory\")\n return\n end\n\n unless SEVERITY_LEVELS.include?(comment_level)\n fail(\"'#{comment_level}' is not a valid value for `comment_level` parameter.\")\n return\n end\n\n unless SEVERITY_LEVELS.include?(fail_level)\n fail(\"'#{fail_level}' is not a valid value for `fail_level` parameter.\")\n return\n\n fail_level = [fail_level, comment_level].max\n end\n\n system \"./gradlew #{gradle_task || 'detekt'}\" unless skip_gradle_task\n\n unless File.exist?(report_file)\n fail(\"Detekt report not found at `#{report_file}`. \"\\\n \"Have you forgot to add `xmlReport true` to your `build.gradle` file?\")\n end\n\n issues = read_issues_from_report\n filtered_issues = filter_issues_by_severity(issues, comment_level)\n\n if inline_mode\n # Report with inline comment\n send_inline_comment(filtered_issues)\n else\n message = message_for_issues(filtered_issues)\n markdown(\"### Detekt found issues\\n\\n\" + message) unless message.to_s.empty?\n end\n end",
"def testMissingTickets\n setupTest do |iTasksFileName, iTicketsFileName|\n executeProcess(\n [\n '--user', 'ReleaseUser',\n '--branch', 'BranchName',\n '--comment', 'ReleaseComment',\n '--version', '0.0.1.20100317',\n '--tasksfile', iTasksFileName,\n '--svnco', 'MySVNRep',\n '--deliver', 'deliver %{DeliverablesDir}'\n ],\n :Error => WEACE::MissingVariableError\n )\n end\n end",
"def build(project_name, auto_install, proxy_option)\n # On lance la generation\n puts \" Building tests report...\"\n if File.exist?(\"#{Continuous4r::WORK_DIR}/tests-run.html\")\n File.delete(\"#{Continuous4r::WORK_DIR}/tests-run.html\")\n end\n tests_report = File.open(\"#{Continuous4r::WORK_DIR}/tests-run.html\", \"w\")\n if Dir.glob(\"test/**/*_test.rb\").length > 0 or Dir.glob(\"test/**/*.rb\").length > 0\n html = TestsFormatter.new.to_html\n elsif Dir.glob(\"spec/**/*_spec.rb\").length > 0\n html = RspecFormatter.new.to_html\n end\n tests_report.write(html)\n tests_report.close\n end",
"def check_stray_specs\n all_paths = Pathname.glob(source.repo + '**/*.podspec{,.json}')\n stray_specs = all_paths - report.analyzed_paths\n stray_specs.each do |path|\n report.add_message(:error, 'Stray spec', path)\n end\n end",
"def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end",
"def notify_bug_id_not_found(task)\n str = <<eos\nHi, this is the Git reporting script. You committed a fix for bug %s but I can't find that bug in Bugzilla.\nPlease review your Git commit and update bugzilla as appropriate.\neos\n str = sprintf(str, task[:task_num]) + printable_commit_data(task)\n email_message(\"ACTION REQUIRED - invalid bug ID\", str, task[:commits].last[:author_email])\n end",
"def run_lint()\n swiftlint.binary_path = './Pods/SwiftLint/swiftlint'\n swiftlint.verbose = true\n swiftlint.lint_all_files = false\n swiftlint.lint_files\nend",
"def test_trace_bug\n rakefile_dryrun\n\n rake\n\n FileUtils.rm_f \"temp_one\"\n\n rake \"--trace\"\n\n refute_match(/No such file/, @out)\n end",
"def lint\n ProgressBar.progress_loop(javascript_files.length) do |bar, total|\n javascript_files.each.with_index do |file, index|\n bar.print(index + 1, total)\n\n errors[file] = system \"#{jshint_path} #{file}\"\n end\n end\n end",
"def send_reports(type, reports)\n dir = File.join(\"/tmp\", type, \"#{@start_date.strftime(\"%Y-%m\")}_to_#{@end_date.strftime(\"%Y-%m\")}\")\n FileUtils.mkdir_p dir\n reports.each do |name, report|\n file = File.join(dir, name)\n File.write(file, CounterReporterService.csv(report))\n Rails.logger.info(\"[ROYALTY REPORTS] wrote #{file}\")\n end\n rescue StandardError => e\n \"[ROYALTY REPORTS] Error: #{e}\\n#{e.backtrace.join(\"\\n\")}\"\n end",
"def reporter_path(filename)\n File.join(File.dirname(__FILE__), 'reporter', filename)\n end",
"def report(context, repo, dir)\n raise \"No report(context, repo, dir) function defined by report subclass\"\n end",
"def check_spelling(files = nil)\n # Installs my fork of the spell checker if needed\n # my fork has line numbers + indexes\n system \"npm install -g orta/node-markdown-spellcheck\" unless mdspell_installed?\n\n # Check that this is in the user's PATH after installing\n raise \"mdspell is not in the user's PATH, or it failed to install\" unless mdspell_installed?\n\n markdown_files = get_files files\n\n arguments = [\"-r\"]\n skip_words = ignored_words || []\n\n arguments.push(\"-n\") if ignore_numbers\n arguments.push(\"-a\") if ignore_acronyms\n arguments.push(\"--#{language}\")\n\n File.write(\".spelling\", skip_words.join(\"\\n\"))\n result_texts = Hash[markdown_files.to_a.uniq.collect { |md| [md, `mdspell #{md} #{arguments.join(\" \")}`.strip] }]\n spell_issues = result_texts.select { |path, output| output.include? \"spelling errors found\" }\n File.unlink(\".spelling\")\n\n # Get some metadata about the local setup\n current_slug = env.ci_source.repo_slug\n\n if spell_issues.count > 0\n message = \"### Spell Checker found issues\\n\\n\"\n spell_issues.each do |path, output|\n if defined? @dangerfile.github\n git_loc = \"/#{current_slug}/tree/#{github.branch_for_head}/#{path}\"\n elsif defined? @dangerfile.gitlab\n git_loc = \"/#{current_slug}/tree/#{gitlab.branch_for_head}/#{path}\"\n else\n raise \"This plugin does not yet support bitbucket, would love PRs: https://github.com/dbgrandi/danger-prose/\"\n end\n\n message << \"#### [#{path}](#{git_loc})\\n\\n\"\n\n message << \"Line | Typo |\\n\"\n message << \"| --- | ------ |\\n\"\n\n output.lines[1..-3].each do |line|\n index_info = line.strip.split(\"|\").first\n index_line, index = index_info.split(\":\").map { |n| n.to_i }\n\n file = File.read(path)\n\n unknown_word = file[index..-1].split(\" \").first\n\n error_text = line.strip.split(\"|\")[1..-1].join(\"|\").strip\n error = error_text.gsub(unknown_word, \"**\" + unknown_word + \"**\")\n\n message << \"#{index_line} | #{error} | \\n\"\n end\n markdown message\n end\n end\n end"
] |
[
"0.62935215",
"0.52596444",
"0.5257605",
"0.5242235",
"0.5207904",
"0.51342595",
"0.5102762",
"0.5047541",
"0.5025417",
"0.502484",
"0.4963007",
"0.49560726",
"0.49040627",
"0.48541266",
"0.4853064",
"0.48441255",
"0.48112792",
"0.48043206",
"0.47878724",
"0.47822118",
"0.47688067",
"0.47406623",
"0.4720957",
"0.47118694",
"0.47056937",
"0.46786803",
"0.46618935",
"0.46397212",
"0.46195745",
"0.46140182",
"0.46043205",
"0.4600895",
"0.45898575",
"0.45864195",
"0.45809305",
"0.45809305",
"0.45692158",
"0.45680645",
"0.45641473",
"0.45520055",
"0.45436355",
"0.45416608",
"0.45335394",
"0.45304942",
"0.45285565",
"0.45174518",
"0.4512757",
"0.45127535",
"0.45123556",
"0.4485684",
"0.44827917",
"0.4477673",
"0.44699544",
"0.445555",
"0.445378",
"0.4453257",
"0.44519994",
"0.44454917",
"0.44390303",
"0.44285357",
"0.4420832",
"0.44136453",
"0.4408509",
"0.44009435",
"0.4399538",
"0.43994358",
"0.43954864",
"0.43880823",
"0.43880823",
"0.43786556",
"0.43757078",
"0.4369377",
"0.4366501",
"0.4363194",
"0.43569368",
"0.43505663",
"0.43282804",
"0.43186808",
"0.43120232",
"0.43116778",
"0.43116778",
"0.43028143",
"0.42961547",
"0.42944664",
"0.4291608",
"0.42890617",
"0.42841777",
"0.42829084",
"0.4277937",
"0.4270368",
"0.42698067",
"0.4265839",
"0.42647287",
"0.4263035",
"0.4254531",
"0.42470327",
"0.4242303",
"0.4239655",
"0.42123926",
"0.42117056"
] |
0.712252
|
0
|
Check gradlew file exists in current directory.
|
def gradlew_exists?
!`ls gradlew`.strip.empty?
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_env_sample_exists\n assert(File.file?('./.env_sample'))\n end",
"def current_folder_has_souffle_config?\n File.exists? \"#{Dir.pwd}/souffle.json\"\n end",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def gemfile_exists? \n File.exists? \"Gemfile\"\nend",
"def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end",
"def exists?\n factory.system.dir_exists?(@path)\n end",
"def file_exists?(path)\n run(\"test -f #{path}\").success?\n end",
"def config_exists?(path)\n File.exist?(path)\n end",
"def installed?\n File.exist?(swiftlint_path)\n end",
"def gradlew\n @gradlew ||= begin\n gradlew = config.dig(\"gradle\", \"gradlew\")\n config.root.join(gradlew || \"gradlew\").to_s\n end\n end",
"def directory_exists?(path)\n run(\"test -d #{path}\").success?\n end",
"def checkFileExists()\n if(File.exist?(@fileName_vars))\n return\n else\n abort(\"Error: could not find the config file. Please make sure it is in the root of the application folder.\")\n end\n end",
"def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end",
"def installed?\n File.exists?(@path)\n end",
"def exists?\n File.exists?(File.join(@root))\n end",
"def resource_exists?\n path_exists? install_dir\nend",
"def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend",
"def python?\n exist? 'requirements.txt'\n end",
"def folder_reachable?\n Dir.exists? folder_path\n end",
"def stow_path_bin_exists?\n ::File.exist?(\"#{stow_path}/../bin/stow\")\n end",
"def exists?(name)\n File.exists?(settings_path(name))\n end",
"def check_config(config_path)\n if File.exists?(config_path)\n check_config_format(config_path)\n return true\n else\n puts \"No configuration found. Please configure which apps to start in #{config_path}\"\n exit 1\n end\nend",
"def exists?\n File.exists? dir\n end",
"def exist?\n ruby_gems_fetcher.started?\n end",
"def exists?\n conf_file.successful?\n end",
"def exists?\n conf_file.successful?\n end",
"def ready?\n File.exist?(desktop_path) && \n File.directory?(libs_path)\n end",
"def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end",
"def stow_target_bin_exists?\n ::File.exist?(\"#{stow_target}/bin/stow\")\n end",
"def check_directory_and_config_file(dir = '', config = '')\n if !Dir.exist?(dir) || !File.exist?(config)\n raise \"Can't find the _config.yml or the _site directory! Please create these files it!\"\n end\n end",
"def config_directory_exists?\n File.exist?(config_directory) && File.directory?(config_directory)\n end",
"def ruby?\n exist? 'Gemfile'\n end",
"def is_up?\n\t\tFile.exists?(@file)\n\tend",
"def is_working_dir path\n File.exist? File.expand_path \".git\", path\n end",
"def exist?\n ::File.exist?(file_path)\n end",
"def exist?\n File.exist?(@path)\n end",
"def lockfile_exists?\n File.exist?(lockfile_name)\n end",
"def exists?\n folder_location.present?\n end",
"def bundle_exists?\n File.exists? self.bundle_dir\n end",
"def check_terraform_applied\n raise Kite::Error, 'Did you terraform apply? terraform.tfstate is missing!' unless File.file? \"terraform/terraform.tfstate\"\n end",
"def file_exists?\n !!file_path\n end",
"def file_exists?\n !!file_path\n end",
"def file_exists?\n\tdirectory_name = \"db/seed_files\"\n\tunless File.exist?(directory_name)\n\t\tputs \"Created folder 'db/seed_files'\"\n\t\tDir.mkdir(directory_name)\n\tend\nend",
"def check_gitignore\n gitignore = File.join(`git rev-parse --show-toplevel`.strip, \".gitignore\")\n\n if !File.exist?(gitignore) ||\n File.open(gitignore).read.match(/^#{@options[:config_file]}/i).nil?\n puts \"Remember to add #{@options[:config_file]} to your .gitignore.\"\n false\n else\n true\n end\n end",
"def assert_file_exists(path)\n assert File.exists?(\"#{APP_ROOT}/#{path}\"),\"The file '#{path}' should exist\"\n end",
"def dir_exists?(name)\n # Does it exist?\n end",
"def exists?\n File.exist? file_path\n end",
"def exists?\n File.exist? @src_path\n end",
"def exists?\n FileTest.exists?(@file)\n end",
"def exist?\n filepath.file? and filepath.readable?\n end",
"def detect\n File.exist?('/tmp/ruby')\n end",
"def config_file?\n return false unless fetched?\n\n return File.exist? \"#{working_dir}/#{config_file}\"\n end",
"def checkfile()\n if not File.file?(@file)\n abort(\"File #{@file} does not exist. Aborting...\")\n end\n end",
"def path_exists?(path)\n ::File.exist?(::File.join(path, 'ts3server_startscript.sh'))\nend",
"def exists?\n File.exists? path\n end",
"def exists?\n File.exist?(@path)\n end",
"def exists?\n File.exists?(path)\n end",
"def first_run?\n not File.exists? '/boot/config/.boxcar'\n end",
"def exists?\n File.exists?(path)\n end",
"def exists?\n File.exist?(path)\n end",
"def exists?\n ::File.directory? self.path\n end",
"def feed_exists?\n if @site.respond_to?(:in_source_dir)\n File.exists? @site.in_source_dir(path)\n else\n File.exists? Jekyll.sanitized_path(@site.source, path)\n end\n end",
"def exist?\n File.exist?(index_file)\n end",
"def file_exists?\r\n File.file?(full_path)\r\n end",
"def exists?\n File.exists? vmx_path\n end",
"def directory_exists?(path)\n end",
"def exists?\n File.exists?(path)\n end",
"def assert_file_exists(path)\n assert File.exist?(\"#{RAILS_ROOT}/#{path}\"),\n \"The file '#{RAILS_ROOT}/#{path}' should exist\"\n end",
"def assert_file_exists(path)\n assert File.exist?(\"#{RAILS_ROOT}/#{path}\"),\n \"The file '#{RAILS_ROOT}/#{path}' should exist\"\n end",
"def exist?\n File.exist? fullpath\n end",
"def storage_exists?\n File.exists?(file_path)\n end",
"def exists?\n File.exists?(File.join(@repo_dir, '.git'))\n end",
"def gem_path?(file); end",
"def check_if_work_dir_excluded\n File.open('.git/info/exclude').each_line.any? do |line|\n line ==\"#{work_dir(true)}\\n\"\n end\n end",
"def integrated\n File.exist?(gemfile)\n end",
"def filecheck\n return file.nil? ? false : File.exist?(file)\n end",
"def check_in_executable_dir(filename, constant_name)\n dir = Pathname.new(filename).dirname\n unless File.executable?(dir)\n raise MarkUsConfigError(\"The setting #{constant_name} with path #{dir} is not executable.\")\n end\n end",
"def exist?\n @local_path and @local_path.exist?\n end",
"def check_for_executable; end",
"def running?\n File.exist?(@lock_file)\n end",
"def filecheck\n file.nil? ? false : File.exist?(file)\n end",
"def exists?\n file.exists?\n end",
"def exist?\n FileTest.exist?(to_s)\n end",
"def local_file_exists?(full_path)\n File.exists?(full_path)\nend",
"def file_exists?(file)\n false\n end",
"def exists?\n validate_directory_structure\n end",
"def feed_exists?(path)\n File.exist?(path)\n end",
"def valid?\n File.exist?(fullpath)\n end",
"def validnn?()\n return dir_exists?(\"/\") ? true : false\n end",
"def exists?\n return true if File.directory?(@path)\n false\n end",
"def exist?\n workspace_info.exist?\n end",
"def file_fixture_exists?(filename, step = '')\n return true if File.exist?(Rails.root.join(UPLOADED_FILES_DIR, filename))\n\n raise \"ERROR in step: '#{step}'\\n\" +\n \" The file #{filename}\\n\" +\n \" must exist in #{UPLOADED_FILES_DIR}\\n\" +\n \" but it doesn't. Either correct the file name to a file that does exist in that directory\\n\" +\n \" or create a file and put it in that directory.\\n\"\nend",
"def exists?(path)\n eval(EXISTS_CHECK, binding, __FILE__, EXISTS_CHECK_LINE)\n nil\nend",
"def local_configuration_repo_exists?\n unless Dir.exist?(Services.ci_config_git_repo_path)\n logger.debug(\"local configuration repo doesn't exist\")\n return false\n end\n\n return true\n end",
"def file_exist?(file_path)\n File.exist?(file_path)\n end",
"def exist; File.exist?(@fname); end",
"def exist?\n File.directory? @full_path\n end",
"def cd_into_test?\n !File.exist?(\"app\") && File.exist?(\"test\") &&\n (File.exist?(\"main.tf\") || File.exist?(\"main.rb\"))\n end",
"def file?\n File.exist?(path) && File.directory?(path)\n end",
"def file_exists?(path)\n end"
] |
[
"0.64557767",
"0.6333179",
"0.6217829",
"0.6217829",
"0.6056618",
"0.605368",
"0.6046435",
"0.6035463",
"0.6017085",
"0.5952188",
"0.5914218",
"0.5913326",
"0.5906898",
"0.5899916",
"0.58908534",
"0.5886532",
"0.5880113",
"0.58728504",
"0.5856368",
"0.5851407",
"0.5849155",
"0.5820297",
"0.5770608",
"0.57659394",
"0.57648414",
"0.57648414",
"0.5762",
"0.57573956",
"0.5754774",
"0.5727523",
"0.5690435",
"0.5685807",
"0.56737375",
"0.56702477",
"0.5649365",
"0.5645994",
"0.5629885",
"0.5628549",
"0.5626572",
"0.5617981",
"0.56162983",
"0.56157213",
"0.5590506",
"0.55867547",
"0.5582868",
"0.5572593",
"0.5568957",
"0.5568501",
"0.5567541",
"0.55670416",
"0.5564806",
"0.55605555",
"0.55588436",
"0.5555251",
"0.55519456",
"0.5545597",
"0.55439925",
"0.55401987",
"0.5530062",
"0.55274343",
"0.55269223",
"0.55210125",
"0.5517506",
"0.5506407",
"0.5504395",
"0.5501107",
"0.5500873",
"0.5498248",
"0.5498248",
"0.5497542",
"0.54932207",
"0.54894686",
"0.5481095",
"0.5471987",
"0.5465178",
"0.5461049",
"0.5458247",
"0.5453992",
"0.54517496",
"0.5449762",
"0.5449152",
"0.54486555",
"0.54323906",
"0.5431351",
"0.54174274",
"0.54153633",
"0.5413601",
"0.54122806",
"0.541014",
"0.54098463",
"0.54070467",
"0.54058003",
"0.54043955",
"0.5403001",
"0.5401199",
"0.5400948",
"0.54004264",
"0.5394932",
"0.53947395",
"0.5394735"
] |
0.8407961
|
0
|
A getter for `spotbugs_report`, returning SpotBugs report.
|
def spotbugs_report(report_file)
require 'oga'
Oga.parse_xml(File.open(report_file))
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def report_file\n @report_file ||= 'app/build/reports/spotbugs/release.xml'\n end",
"def report\n return @report\n end",
"def bug_report_url()\n LibDrizzle.drizzle_bugreport\n end",
"def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end",
"def get_bug(id)\n get_bugs(id).first\n end",
"def spotbugs_issues(report_file)\n spotbugs_report = spotbugs_report(report_file)\n\n source_dirs = spotbugs_report.xpath('//BugCollection//SrcDir').map(&:text)\n\n spotbugs_report.xpath('//BugCollection//BugInstance').map do |bug_instance|\n BugInstance.new(root_path, source_dirs, bug_instance)\n end\n end",
"def index\n @bugs = @project.bugs\n end",
"def get_bugs(params={})\n rpc_call :get_bugs, params\n end",
"def _findBugs\n @metric.return_scope\n end",
"def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end",
"def set_bugreport\n @bugreport = Bugreport.find(params[:id])\n end",
"def index\n @bugs = Project.find(params[:project_id]).bugs.all\n end",
"def external_report\n return external_reports.first\n end",
"def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end",
"def index\n @bugs = @project.bugs.all\n end",
"def show\n @bug = @project.bugs.build\n end",
"def report\n @report || @schedule\n end",
"def reports\n @reports ||= EbanqApi::Reports.new(self)\n end",
"def contador_bugs\n total = find(:css, '#buglist > tbody > tr:nth-child(1) > td > span:nth-child(1)').text\n valor = total.scan(/\\w+/)\n @bug = valor[3]\n end",
"def find_bug_by_id(bug_id)\n bugproxy = @server.proxy('Bug')\n bug = nil\n begin\n data = bugproxy.get({:ids => bug_id})\n if (data)\n bug = data['bugs'][0]\n end\n rescue XMLRPC::FaultException => e\n puts \"no match for bug #{bug_id} in bugzilla\"\n end\n bug\n end",
"def report(id)\n get(\"reports/#{id}\")\n end",
"def index \n render :json => Project.find(11).bug_tracker.bugs\n end",
"def get_testrun_bugs(testrun_id)\n return self.call('TestRun.get_bugs', Integer(testrun_id))\n end",
"def report(report_id)\n return unless (r = get(\"reports/#{report_id}\")['Reports'])\n Report.new(r.first['Url'], party: self, details: r.first)\n end",
"def index\n @bugreports = Bugreport.all\n end",
"def get_caserun_bugs(caserun_id)\n return self.call('TestCaseRun.get_bugs', Integer(caserun_id))\n end",
"def report\n @logger\n end",
"def report_file\n return @report_file || 'app/build/reports/lint/lint-result.xml'\n end",
"def index\n @bugs = Bug.where(project_id: params[:project_id])\n @project = params[:project_id]\n end",
"def get_smtp_report(opts = {})\n data, _status_code, _headers = get_smtp_report_with_http_info(opts)\n data\n end",
"def get_report(id, opts = {})\n data, _status_code, _headers = get_report_with_http_info(id, opts)\n data\n end",
"def report_get id\n call! report_get, id\n end",
"def show\n @bug_tickets = @bug_ticket.versions\n end",
"def report_file\n return @report_file || \"build/reports/detekt/detekt.xml\"\n end",
"def getBuglog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tbuglogs_array = timeLogs_json[\"timelogs\"][\"buglogs\"]\r\n\t\t\t\treturn jsonToBuglog(buglogs_array[0])\r\n\t\t\tend",
"def index\n p1=Project.find_by(id: params[:project_id])\n @project_bugs = p1.project_bugs\n end",
"def show\n @aggregation_dimensions = Occurrence::AGGREGATING_FIELDS.\n map { |field| [Occurrence.human_attribute_name(field), field.to_s] }.\n unshift(['', nil])\n\n # We use `duplicate_of_number` on the view and `duplicate_of_id` in the\n # backend, so we need to copy between those values.\n @bug.duplicate_of_number = @bug.duplicate_of.try!(:number)\n\n @new_issue_url = Service::JIRA.new_issue_link(summary: t('controllers.bugs.show.jira_link.summary',\n class_name: @bug.class_name,\n file_name: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n locale: @bug.environment.project.locale),\n environment: @environment.name,\n description: t('controllers.bugs.show.jira_link.description',\n class_name: @bug.class_name,\n file: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n message: @bug.message_template,\n revision: @bug.revision,\n url: project_environment_bug_url(@project, @environment, @bug),\n locale: @bug.environment.project.locale),\n issuetype: 1)\n\n respond_with @project, @environment, @bug.as_json.merge(watched: current_user.watches?(@bug))\n end",
"def get_report(params = {})\n values = params.slice(:vendor_number, :report_type, :report_sub_type, :date_type, :date).values\n if params[:version]\n values << params[:version]\n end\n\n fetch(@config[:sales_path], (['Sales.getReport'] + [values.join(',')]).join(', '))\n end",
"def reports\n # LAK:NOTE See http://snurl.com/21zf8 [groups_google_com]\n x = Puppet[:reports].gsub(/(^\\s+)|(\\s+$)/, '').split(/\\s*,\\s*/)\n end",
"def report\n\t\tReport.where(match_id: self.id)\n\tend",
"def get(ids =[])\n return call('Bug.get', ids)\n end",
"def snow_report\n this = self\n # refactor this later after snow report is saved daily\n return SnowReport.new({report_id: this.report_id})\n end",
"def get(bug_ids, params = {})\n bug_ids = Array(bug_ids)\n raise ArgumentError, \"bug_ids must be all Numeric\" unless bug_ids.all? { |id| id.to_s =~ /^\\d+$/ }\n\n params[:ids] = bug_ids\n\n results = execute('Bug.get', params)['bugs']\n return [] if results.nil?\n results\n end",
"def get(udid)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'udid', udid)\n\t\t\tclient.queue_service_action_call('report', 'get', 'KalturaReport', kparams)\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil\n\t\t\tend\n\t\t\treturn client.do_queue()\n\t\tend",
"def get_report_info(options = {})\n options = argument_cleaner(required_params: %i( reportid ), optional_params: %i( ), options: options )\n authenticated_get cmd: \"getreportinfo\", **options\n end",
"def index\n respond_with(@bugs = Bug.active)\n end",
"def show\n @other_reports = Report.where(yelp_business_id: @report.spot.yelp_business_id)\n end",
"def report_broken\n \"Broken\"\n end",
"def to_s\n @smells.map {|smell| smell.report}.join(\"\\n\")\n end",
"def set_bug\n @bug = Project.find(params[:project_id]).bugs.find(params[:id])\n end",
"def bug_report\n raise BakerError, <<-EOS\n Bug reporting has not yet been implimented.\n Manually send a bug report to #{@maintainer}.\n EOS\n end",
"def get_report_instance(id, instance, opts = {})\n data, _status_code, _headers = get_report_instance_with_http_info(id, instance, opts)\n data\n end",
"def report=(value)\n @report = value\n end",
"def latest_report\n @latest_report || fetch_api_data\n end",
"def bugs_in_play?; self.list_bugs(true); end",
"def report_data\n ReportMailer.report_data\n end",
"def report(inline_mode: true)\n unless skip_gradle_task\n raise('Could not find `gradlew` inside current directory') unless gradlew_exists?\n\n exec_gradle_task\n end\n\n report_files_expanded = Dir.glob(report_files).sort\n raise(\"Could not find matching SpotBugs report files for #{report_files} inside current directory\") if report_files_expanded.empty?\n\n do_comment(report_files_expanded, inline_mode)\n end",
"def report_range\n return @report_range\n end",
"def index\n @bugs = Bug.all\n project_id = params[:id]\n @project = Project.find_by(id: project_id)\n end",
"def latest_report\n @report_history.last\n end",
"def bug?\n @issue_type.casecmp('bug') == 0\n end",
"def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end",
"def get_bugs(*ids)\n params = {}\n params[:ids] = normalize_ids ids\n\n bugs = []\n ret = @client.call('Bug.get', params)\n handle_faults(ret)\n ret['bugs'].each do |bug_data|\n bugs << Bug.new(self, bug_data)\n end\n bugs\n end",
"def issues\n return @issues\n end",
"def report_to_json(report)\n cleaned = cleaner.clean_object(report.as_json)\n trimmed = Bugsnag::Helpers.trim_if_needed(cleaned)\n\n ::JSON.dump(trimmed)\n end",
"def get_report(report_id, params = {})\n response = get(\"/\", {\"Action\" => \"GetReport\", \"ReportId\" => report_id})\n # TODO format response\n end",
"def reports\n (@reports ||= Conversocial::Resources::QueryEngines::Report.new self).clear\n end",
"def warnings\n @tracker.warnings\n end",
"def getReportUrl()\n url = nil\n webdriver = @perfectoExecutionContext.webdriver\n\n begin\n url = webdriver.capabilities['testGridReportUrl']\n rescue Exception => e\n raise ReportiumException.new e.message\n end\n\n return url\n end",
"def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end",
"def repository\n @report.repository\n end",
"def set_bugs_history\n @bugs_history = BugsHistory.find(params[:id])\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].include?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def series_issue(field = nil)\n find_record_value(field, clean: false) if field\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].start_with?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def report\r\n if Post.exists?(params[:id])\r\n if params[:reports]\r\n @new_report = Report.create_new(params, @usr)\r\n if @new_report.errors.empty?\r\n unless Configs.get_config('mailing_list').blank?\r\n Configs.get_config('mailing_list').split(',').each do |email|\r\n ReportMailer.deliver_email(@new_report.user.name, email.strip, @new_report, request.env['HTTP_HOST'])\r\n end\r\n end\r\n redirecting t(:redir), session[:last_page]\r\n return\r\n end\r\n end\r\n else\r\n redirect_to_info_page\r\n end\r\n end",
"def get_report_list\n res=api_call('GetReportList')[:data]\n end",
"def show\n @user = get_current_user\n @project = Project.find_by_permalink(params[:project_id])\n @bug = @project.bugs.find_by_id(params[:id])\n @users = User.all\n @comments = @bug.comments.order(\"created_at DESC\")\n @watchers = @bug.watchers\n @watcher = @bug.watchers.find_by_id(@user.id)\n\n respond_to do |format|\n if @project and @bug and @project.users.exists?(@user)\n format.html # show.html.erb\n format.xml { render :xml => @bug }\n else\n format.html { redirect_to(projects_url, :notice => 'Specified bug does not exist') }\n end\n end\n end",
"def report\n (@state.first || NO_ROBOT_PLACED).to_s\n end",
"def show\n respond_with(@bug = Bug.find(params[:id]) )\n end",
"def ga_get_tracker\n return GoogleAnalytics::get_instance(@context).new_tracker(@property_id)\n end",
"def generate_bug_link( bug_id )\n # For bugzilla, assume url is base URL plus show by bug ID\n if Setting.value(\"Ticket System\") == 'Bugzilla'\n url = Setting.value('Ticket System Url') + 'show_bug.cgi?id=' + bug_id.to_s\n # For mantis, base url plus view id\n elsif Setting.value(\"Ticket System\") == 'Mantis'\n url = Setting.value('Ticket System Url') + 'view.php?id=' + bug_id.to_s\n # For Jira, we strip the API part of url that starts with rest/api...\n elsif Setting.value(\"Ticket System\") == 'Jira'\n url = Setting.value('Ticket System Url').split('rest/')[0] + 'browse/' + bug_id.to_s\n #If we're not sure what it is, return a blank url\n elsif Setting.value(\"Ticket System\") == 'Redmine'\n url = Setting.value('Ticket System Url') + 'issues/' + bug_id.to_s\n else\n url = \"\"\n end\n \n #Return the URL\n url\n end",
"def scoped_tickets\n return @sprint.assigned_tickets if @sprint\n return @project.tickets if @project\n end",
"def reports\n collection(\"reports\")\n end",
"def bug_url(bug_id)\n \"https://bugzilla.blurb.com/show_bug.cgi?id=#{bug_id}\"\n end",
"def text\n @text || @report\n end",
"def get_reports(opts = {})\n data, _status_code, _headers = get_reports_with_http_info(opts)\n data\n end",
"def bug(color, id); $game.bugs[color].each{|bug| return bug if bug.id == id }; end",
"def update_bug_reports(bugs, build_number)\n puts \"Updating bug reports...\"\n # update bugzilla reports\n bugs.each do |bug|\n bug_data = find_bug_by_id(bug[:task_num])\n if (bug_data)\n # bug was found, update comments and status\n update_bug(bug_data, bug, build_number)\n # set bug title in task object\n bug[:task_name] = bug_data['internals']['short_desc']\n else\n # unknown bug, notify author of commit\n @email_reporter.notify_bug_id_not_found(bug)\n end\n end\n end",
"def show\n @voucher = Voucher.find(params[:id])\n @issues = @voucher.issues\n\n end",
"def report?\n report = parent_report.report?\n run_report = report && report[\"runs\"] && report[\"runs\"][stage_path]\n return nil if run_report && run_report[\"url\"] != build.url\n run_report\n end",
"def reports(wspace=workspace)\n\t\twspace.reports\n\tend",
"def serve_report(id)\n\t\t\tkparams = {}\n\t\t\t# - the requested id\n\t\t\tclient.add_param(kparams, 'id', id);\n\t\t\tclient.queue_service_action_call('livereports', 'serveReport', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def issue(issue_key)\n @tracker.getIssue(issue_key)\n end",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def get_report_locations()\n locations = Location.where(company_id: self.id)\n\n return locations\n end",
"def show\n @report = Report.find(params[:id])\n end",
"def get_report(params = {})\n fetch(@config[:finance_path], (['Finance.getReport'] + [params.slice(:vendor_number, :region_code, :report_type, :fiscal_year, :fiscal_period).values.join(',')]).join(', '))\n end",
"def get_report_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_report ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ReportApi.get_report\"\n end\n # resource path\n local_var_path = '/api/3/reports/{id}'.sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json;charset=UTF-8'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(: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 => 'Report')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_report\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end"
] |
[
"0.6322081",
"0.6055198",
"0.57680035",
"0.5750877",
"0.5711777",
"0.564839",
"0.5594099",
"0.5476167",
"0.5461613",
"0.5418667",
"0.5367439",
"0.5357381",
"0.53265905",
"0.5320875",
"0.52858853",
"0.5255507",
"0.51931953",
"0.517406",
"0.5171568",
"0.51465553",
"0.5144168",
"0.5132092",
"0.5130245",
"0.5126084",
"0.5121875",
"0.50962526",
"0.5086146",
"0.50226796",
"0.5019908",
"0.5011418",
"0.49870023",
"0.49777594",
"0.49732172",
"0.49625596",
"0.4950908",
"0.4936611",
"0.49167347",
"0.4913415",
"0.48908466",
"0.4865529",
"0.48607683",
"0.48575598",
"0.48109403",
"0.48109308",
"0.48090568",
"0.4805683",
"0.48051938",
"0.48009294",
"0.48009142",
"0.47930092",
"0.47795382",
"0.47779125",
"0.47725564",
"0.47655186",
"0.47638726",
"0.47608036",
"0.47590765",
"0.47511047",
"0.47482684",
"0.47411335",
"0.47323766",
"0.4716299",
"0.4712052",
"0.47111422",
"0.47057515",
"0.46944553",
"0.4689901",
"0.46879527",
"0.46824944",
"0.46779215",
"0.46736208",
"0.46730042",
"0.4649319",
"0.46443444",
"0.46326366",
"0.46325558",
"0.46289438",
"0.46235168",
"0.46192792",
"0.4610054",
"0.4608934",
"0.46007797",
"0.45997193",
"0.4586082",
"0.45802867",
"0.45774058",
"0.4569131",
"0.4565556",
"0.45504424",
"0.45473096",
"0.45471135",
"0.4541699",
"0.45312274",
"0.45224243",
"0.4506261",
"0.4506261",
"0.4506261",
"0.44986755",
"0.44986668",
"0.44977194"
] |
0.61145806
|
1
|
A getter for current updated files.
|
def target_files
@target_files ||= (git.modified_files - git.deleted_files) + git.added_files
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def changed_files\n # FIXME: Implement properly once changed detection is available.\n files\n end",
"def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end",
"def modified_files; end",
"def modified_files\n diff = git.diff(local_branch, remote_branch(local_branch))\n diff.stats[:files].keys\n end",
"def files\n return @files\n end",
"def currently_changed_files\n `git status --porcelain`.split(\"\\n\").map{ |file| file.split.last }\n end",
"def updatedb_file_ls(file)\n updatedb[file]\n end",
"def modified_files\n file_stats.count { |file| file.status == :modified }\n end",
"def git_modified_files_info()\n modified_files_info = Hash.new\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each {|file|\n modified_lines = git_modified_lines(file)\n modified_files_info[File.expand_path(file)] = modified_lines\n }\n modified_files_info\n end",
"def modified_files\n remote_details = @container.list_objects_info\n same_files.reject do |file|\n (remote_details[file][:last_modified] <=> File.mtime(CloudfileAsset::Local.make_absolute(file))) == 1\n end\n end",
"def mtime\n File.mtime(file)\n end",
"def files; changeset.all_files; end",
"def tracked_files; end",
"def files\n @files.values\n end",
"def last_modification\n File.mtime(File.new(self.file_path, 'r'))\n end",
"def last_modified\n stat.mtime\n end",
"def changed_files\n DeliveryTruck::Helpers.changed_files(\n DeliveryTruck::Helpers.pre_change_sha(node),\n node['delivery']['change']['sha'],\n node\n )\n end",
"def file_list\n @file_list\n end",
"def altered_files; raw_changeset.files; end",
"def modified_files\n `git diff --cached --name-only --diff-filter=ACM --ignore-submodules=all`.split \"\\n\"\n end",
"def previously_changed_files\n `git show --pretty=\"format:\" --name-only`.split(\"\\n\")\n end",
"def latest_version_file\n sorted_files.first\n end",
"def mtime\n File.mtime(path)\n end",
"def source_file_mtime\n File.mtime(path)\n end",
"def last_modified\n @file_stat ? file_stat.mtime : nil\n end",
"def modified_files\n staged = squash?\n refs = 'HEAD^ HEAD' if merge_commit?\n @modified_files ||= Overcommit::GitRepo.modified_files(staged: staged, refs: refs)\n end",
"def files\n return get_result('files')\n end",
"def local_mtime\n File.stat(@resource[:path]).mtime\n end",
"def immutable_files\n @attributes[:immutable_files]\n end",
"def show\n @file_update_from_file_package = []\n @file_to_update_file_package = FileToUpdateFilePackage.where(file_package_id: @file_package.id)\n @file_to_update_file_package.each do |file_update_file_package|\n @file_update_from_file_package << file_update_file_package.file_to_update.name\n end\n end",
"def modified_at\n @modified_at ||= @path.pathname.mtime\n end",
"def updated?\n !ignore? && !removed? && mtime != File.mtime(path)\n end",
"def updated_at\r\n File.stat(\"#{RAILS_ROOT}/public/games/container.swf\").mtime\r\n end",
"def last_modified\n @file_stat ? file_stat.mtime.to_s : 'Unknown'\n end",
"def files\n info[\"Files\"].to_a\n end",
"def target_files\n @target_files ||= git.modified_files + git.added_files\n end",
"def file_details\n return @file_details\n end",
"def mod_time\n File.mtime(@filepath)\n end",
"def changed_files\n @files.each do |file, stat|\n if new_stat = safe_stat(file)\n if new_stat.mtime > stat.mtime\n @files[file] = new_stat\n yield(file)\n end\n end\n end\n end",
"def current\n entries = Dir.glob(\"#{self.ftp_upload_directory}/*.jpg\")\n # File.mtime is modified time.\n res = entries.max_by {|f| File.mtime(f)}\n if (res == nil)\n raise NoPictureException.new(\"No Latest Picture\")\n end\n return res\n end",
"def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at]\n timestamps.sort.last\n end",
"def git_modified_files_info\n modified_files_info = {}\n updated_files = (git.modified_files - git.deleted_files) + git.added_files\n updated_files.each do |file|\n modified_lines = git_modified_lines(file)\n modified_files_info[file] = modified_lines\n end\n modified_files_info\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def GetModified\n @modified\n end",
"def file_history_current\n file_history = $file_history.to_h\n file_history.each_pair do |index, file_name|\n return file_name unless file_name == \"\"\n end\n end",
"def updated\n watchers.find_all(&:updated?)\n end",
"def file\n @file ||= find_version_file\n end",
"def get_updated_files(days)\n FileAsset.\n select(\"CONCAT( servers.httpurl, '/', files.filename ) AS 'link', files.filelang AS 'flang', files.filetype AS 'ftype', files.filesize AS 'fsize', files.updated AS 'updated', lessonfiles.lessonid AS 'lessonid'\").\n where(:'files.updated' => days.days.ago.to_s(:db)..0.days.ago.to_s(:db)).\n joins(:server, :lessons).\n order(:lessonid, :ftype).\n all.group_by { |x| x['lessonid'] }\n end",
"def current_snapshot\n Filewatcher::Snapshot.new(\n expand_directories(@unexpanded_filenames) -\n expand_directories(@unexpanded_excluded_filenames)\n )\n end",
"def file\n files.first\n end",
"def file\n files.first\n end",
"def source_file_mtime; end",
"def files\n @files ||= full_files.map {|file| relative(file) }\n end",
"def current_file_path\n current_file.to_path\n end",
"def files\n @files ||= []\n end",
"def working_files\n files.map {|f| working_file f}\n end",
"def get_files_by_mtime dir='*'\n gfb dir, :mtime\nend",
"def get_file_path\n @path\n end",
"def files\n file_sets.map(&:original_file)\n end",
"def last_updated\n f = Folder.where(:id => params['id']).first\n render json: f.nil? ? \"unknown\" : f.updated_at\n end",
"def stamp\n files.map { |f| File.mtime(path(f)) }.max.to_i\n end",
"def files_hash\n @files_hash\n end",
"def changes_file\n files = Dir.glob(\"#{@changes_directory}/*.changes\")\n raise \"Found not exactly one changes: #{files}\" if files.size != 1\n\n files[0]\n end",
"def file\n return @file\n end",
"def file\n return @file\n end",
"def date\n t, tz = changeset.date\n begin\n return [FileUtils.lstat(@repo.join(@path)).mtime, tz]\n rescue Errno::ENOENT\n return [t, tz]\n end\n end",
"def files\n @files ||= {}\n end",
"def current_path\n file.try(:path)\n end",
"def watchable_files; end",
"def getNotModifiedSince(path)\n # // get the date in milliseconds\n # // current file\n now = Time.now\n later = File.mtime(path)\n diff = later - now\n (diff / (24 * 60 * 60)).to_i\n end",
"def updated_source_file?; end",
"def last_update\n folder = ( params[:id].nil? ? session[:user].root_folder : XFile.get(params[:id]) )\n raise RequestError.new(:file_not_found, \"Folder not found\") if folder.nil?\n raise RequestError.new(:bad_access, \"No access\") unless folder.users.include? session[:user] \n @result = { last_update: folder.last_update, success: true }\n end",
"def last_modified\n rails_root_mtime = Time.zone.at(::File.new(\"#{Rails.root}\").mtime)\n timestamps = [rails_root_mtime, self.updated_at] + self.page.elements.collect{|e| e.last_modified}\n timestamps.sort.last\n end",
"def last_modified_time\n mtime\n end",
"def file_stats\n @stats = @ff.get_stats\n end",
"def last_modified_in dir\n Dir.glob( File.join( dir,'*' ) ).\n select {|f| File.file? f }.\n sort_by {|f| File.mtime f }.\n last\nend",
"def get_modification_timestamp(path)\n File.mtime(path)\n end",
"def mtime_for(file)\n File.mtime(file)\n end",
"def latest_modified_time\n tmp = Dir.glob(\"#{@dir}/**/*\").max_by do |file|\n File.mtime(file)\n end\n File.mtime(tmp)\n end",
"def all\n @files\n end",
"def modified_files\n @modified_files ||= begin\n @modified_files = []\n\n rewritten_commits.each do |rewritten_commit|\n refs = \"#{rewritten_commit.old_hash} #{rewritten_commit.new_hash}\"\n @modified_files |= Overcommit::GitRepo.modified_files(refs: refs)\n end\n\n filter_modified_files(@modified_files)\n end\n end",
"def updated_source_file; end",
"def update\n @mtime = File.mtime(path)\n end",
"def mtime() File.mtime(path) end",
"def data\n @data ||= file? ?\n repos.file(fs_path, revision) :\n repos.dir(fs_path, revision)\n end",
"def LoadedProjectFiles\n @LoadedProjectFilesList\n end",
"def path\n @file.path\n end",
"def last_modified\n @resource.last_modified\n end",
"def file_hash\n return @file_hash\n end",
"def path\n @file\n end",
"def file_path\n dir\n end",
"def updated?\n @changed_files.clear()\n start_size = @file_cache.size\n listen_for_changes\n end_size = @file_cache.size\n start_size != end_size || !@changed_files.empty?\n end",
"def path\n @file.path\n end",
"def existing_files\n metadata_files if @existing_files.nil?\n @existing_files\n end",
"def paths_to_add()\n (self[:files_added]||[]).map{|r|r[:path]} + (self[:files_renamed]||[]).map{|r|r[:new_path]}\n end",
"def get_files_to_keep\n return @resource[:files_to_keep]\n end",
"def get_latest_mtime\n return @sources.collect{ |s| File.mtime(\"#{@asset_path}/#{s}.#{@extension}\") }.max\n end"
] |
[
"0.7069",
"0.7058835",
"0.68692845",
"0.6556569",
"0.65085495",
"0.64837146",
"0.64715886",
"0.6424989",
"0.63360256",
"0.62922543",
"0.6271411",
"0.6270139",
"0.62439066",
"0.6198547",
"0.6198386",
"0.6193268",
"0.61928463",
"0.61876255",
"0.6177017",
"0.61762935",
"0.6147879",
"0.61462873",
"0.6140261",
"0.6082183",
"0.60790163",
"0.60774344",
"0.60696846",
"0.6053381",
"0.6051884",
"0.60325015",
"0.6029432",
"0.6018833",
"0.60120034",
"0.60073066",
"0.59967166",
"0.59565544",
"0.5947012",
"0.5937178",
"0.5936044",
"0.593493",
"0.5930823",
"0.5926363",
"0.5922219",
"0.5922219",
"0.5922219",
"0.5922219",
"0.5922219",
"0.5920368",
"0.5918362",
"0.5916706",
"0.5909018",
"0.59085405",
"0.5901611",
"0.5901611",
"0.58952236",
"0.5893647",
"0.5870383",
"0.58687127",
"0.5859694",
"0.58475244",
"0.5844461",
"0.58430785",
"0.5839829",
"0.58387107",
"0.58384216",
"0.5837613",
"0.5835359",
"0.5835359",
"0.5832564",
"0.58222896",
"0.580643",
"0.580631",
"0.57878596",
"0.5770797",
"0.5766341",
"0.5760488",
"0.57576334",
"0.57515585",
"0.5746642",
"0.5745962",
"0.5745529",
"0.57418233",
"0.57244706",
"0.57209724",
"0.5715652",
"0.5711361",
"0.5711092",
"0.57042664",
"0.57002467",
"0.56993645",
"0.5693888",
"0.5691133",
"0.5687088",
"0.56865805",
"0.56849927",
"0.56811446",
"0.567932",
"0.56661576",
"0.56641775",
"0.56622887"
] |
0.5951104
|
36
|
A getter for SpotBugs issues, returning SpotBugs issues.
|
def spotbugs_issues(report_file)
spotbugs_report = spotbugs_report(report_file)
source_dirs = spotbugs_report.xpath('//BugCollection//SrcDir').map(&:text)
spotbugs_report.xpath('//BugCollection//BugInstance').map do |bug_instance|
BugInstance.new(root_path, source_dirs, bug_instance)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def issues\n return @issues\n end",
"def issues\n Sifter.\n get(api_issues_url).\n fetch(\"issues\", []).\n map { |i| Sifter::Issue.new(i) }\n end",
"def actual_issues\n @actual_issues ||= issues.select { |i| i[:pull_request].nil? }\n end",
"def issues()\n\t\tissues = []\n\t\tif self.highschool.blank?\n\t\t\tissues << self.name + \" has no highschool assigned.\"\n\t\tend\n\t\tif self.mentor.blank?\n\t\t\tissues << self.name + \" has no mentor.\"\n\t\tend\n\t\treturn issues\n\tend",
"def issues=(value)\n @issues = value\n end",
"def open_issues\n project.source.open_issues\n end",
"def unreleased_issues\n @unreleased_issues ||= JIRA.search(\n project: 'COOK',\n resolution: 'Fixed',\n status: 'Fix Committed',\n component: cookbook.name,\n )['issues']\n end",
"def issues(reload = false)\n @issues = load_issues.collect {|issue| Issue.new(self, issue)} if reload || @issues.nil?\n return @issues\n end",
"def issues\n @issues ||= @commit.issues.includes(translation: { key: :project }).order_default\n end",
"def get_issues( url, label )\n\t\tissues = @git.client.issues( url, :per_page => 100 )\n\t\tcleaned_issues = parse_issue_array( issues, label )\n\t\tputs cleaned_issues.inspect\n\t\treturn cleaned_issues\n\tend",
"def project_issues(project)\n Issue.where(:project_id=>project.id)\n end",
"def issues(report)\n\n\t\t# gather insanities and transform into :issue_insanity\n\t\tissues = (report.insanities.collect do |insanity| \n\t\t\t(\"issue_\" + insanity.to_s).to_sym if insanity\n\t\tend).compact\n\n\t\t# check for shitty months\n\t\t# (persistent diarrhea)\n\t\tissues << :issue_diarrhea if report.persistent_diarrhea?\n\n\t\treturn issues \n\tend",
"def problems\n\t\t\treturn nil\n\t\tend",
"def issues\n @_issues ||= item.active_issues.includes(translation: { key: [{ section: { article: :project } }, :project] }).order_default\n end",
"def issues\n if @issues.nil?\n @issues = {}\n max_result = 3\n jql = \"/rest/api/2/search?jql=project=\\\"#{name}\\\" AND issuetype NOT IN (Epic, Sub-task)&expand=changelog&maxResults=#{max_result}\"\n #r = nil\n #without_cache{ r = self.class.get(\"#{jql}&startAt=0\") }\n r = self.class.get(\"#{jql}&startAt=0\")\n pages = (r['total'] / max_result)\n (0..pages).each do |current_page|\n begin\n # If you can get the latest version of the last page, do so, otherwise load the cached version\n query = \"#{jql}&startAt=#{(current_page * max_result)}\"\n if current_page == pages\n #without_cache{ r = self.class.get(query) }\n # else\n r = self.class.get(query)\n end\n r['issues'].each do |issue|\n # Cast raw response to Issue(), passing project reference into constructor\n issue['project'] = self\n @issues[issue['key']] = Issue.new(issue)\n end\n # rescue => exception\n # puts \"#{exception.message} (#{exception.class})\"\n # pp exception.backtrace\n end\n end\n end\n @issues\n end",
"def my_issues\n object.stances.map do |s|\n v = s.view\n i = v.issue\n {issue:{id: i.id, title: i.title, category: i.category}, view: {id: v.id, description: v.description, attitude: v.attitude}, stance: {importance: s.importance}}\n end\n end",
"def get_github_issues\n @github_issues = octokit_client.issues(repo_name).each_with_object({}) { |issue, issues|\n issues[issue[\"number\"]] = issue\n }\n end",
"def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end",
"def issues(status=nil, prioirty=nil)\n\n issues = []\n\n # Build filter string\n filters = \"&s=#{status}\" if status\n filters.to_s << \"&p=#{priority}\" if prioirty\n \n # Inital request url\n issues_url = api_issues_url + \"?page=1&per_page=100\" + filters\n \n while issues_url do # while next_page_url is not nil add issues to the list \n page = Sifter.get(issues_url + filters.to_s)\n \n issues += page.fetch(\"issues\", []).map { |p| Sifter::Issue.new(p) }\n issues_url = page.fetch(\"next_page_url\")\n end\n\n issues\n end",
"def get_github_issues github_uri\n user,project = get_github_user_project(github_uri)\n url = \"http://github.com/legacy/issues/search/#{user}/#{project}/open/number\"\n $stderr.print url,\"\\n\"\n issues = JSON.parse(Http::get_http_body(url))\n if issues == nil or issues == {}\n $stderr.print \"\\nWARNING: issues link not working!\\n\"\n issues = {\"issues\"=>[]} \n end\n $stderr.print issues['issues'].size, \"\\n\" \n issues['issues']\n end",
"def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end",
"def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end",
"def issue(issue_key)\n @tracker.getIssue(issue_key)\n end",
"def fetch_issues()\n\n # fetch last created date\n last_creation = @kv.get(@last_creation_k) # || \"2015-05-11T16:37:21Z\"\n\n # request Redmine issues\n issues = @redmine_api.issues(created_on: \">=#{last_creation}\", limit:200, sort:\"created_on\")['issues']\n puts issues if self.verbose\n \n # filter issues to include only certain projects, avoid certain users, avoid self tickets\n issues = issues.select do |issue|\n Utils.project_whitelisted? issue and Utils.user_not_blacklisted? issue and not Utils.ticket_to_self? issue\n end\n\n # no issues\n if issues.empty?\n puts \"#{Utils.human_timestamp} No new issues since #{last_creation}.\"\n return\n end\n\n # post issues\n issues.each do |issue|\n post_issue(issue)\n end\n\n # store the created data of the last ticket + 1 second\n last_creation = issues.last[\"created_on\"]\n last_creation_plus = (Time.parse(last_creation)+1).iso8601\n @kv.put(@last_creation_k, last_creation_plus)\n \n puts \"#{Utils.human_timestamp}: Posted #{issues.length} issues. Last created #{@kv.get(@last_creation_k)}\"\n\n end",
"def version_issues(project, version,issues)\n issues.select {|issue| issue.fixed_version == version}\n end",
"def get(bug_ids, params = {})\n bug_ids = Array(bug_ids)\n raise ArgumentError, \"bug_ids must be all Numeric\" unless bug_ids.all? { |id| id.to_s =~ /^\\d+$/ }\n\n params[:ids] = bug_ids\n\n results = execute('Bug.get', params)['bugs']\n return [] if results.nil?\n results\n end",
"def issues\n @issues ||=\n output\n .fetch(:files, [])\n .flat_map { |file| create_issues_from(file) }\n end",
"def fetch_issues(jql)\n issues = []\n max_result = config.jira.max_results.to_i\n query_options = {\n :fields => [],\n :start_at => 0,\n :max_results => max_result\n }\n begin \n temp_issues = []\n temp_issues = client.Issue.jql(jql, query_options)\n while (temp_issues.length > 0)\n issues += temp_issues\n query_options[:start_at] += max_result\n temp_issues = client.Issue.jql(jql, query_options)\n end\n rescue JIRA::HTTPError => e\n issues = nil\n log.error('JIRA HTTPError')\n end\n return issues\n end",
"def get(ids =[])\n return call('Bug.get', ids)\n end",
"def ensure_issues(owner, repo)\n currepo = ensure_repo(owner, repo)\n if currepo.nil?\n warn \"Could not find repo #{owner}/#{repo} for retrieving issues\"\n return\n end\n\n issues = db[:issues].filter(:repo_id => currepo[:id]).all\n raw_issues = retrieve_issues(owner, repo).reduce([]) do |acc, x|\n if issues.find { |y| y[:issue_id] == x['number'] }.nil?\n acc << x\n else\n acc\n end\n end\n\n raw_issues.map { |x| save { ensure_issue(owner, repo, x['number']) } }.select { |x| !x.nil? }\n end",
"def get_domain_issues(opts = {})\n data, _status_code, _headers = get_domain_issues_with_http_info(opts)\n data\n end",
"def index\n @issues = current_user.issues\n end",
"def issue_numbers\n github_issues.keys\n end",
"def github_closed_issues(user, repo, milestone)\n issues = Github::Client::Issues.new(user: user, repo: repo)\n mid = github_milestone_for(issues, user, repo, milestone)\n\n return nil if mid == -1\n\n options = { user: user, repo: repo, milestone: mid.to_s, state: 'closed', per_page: 100 }\n\n full_list = []\n 1.upto(1_000_000) do |i|\n options[:page] = i\n page = issues.list(options).map do |issue|\n ['#' + issue.number.to_s, issue.title, issue.html_url]\n end\n return full_list if page.size == 0\n full_list.concat page\n end\n full_list\nend",
"def sub_issues\n MatterIssue.all(:conditions => [\"parent_id = ?\", self.id])\n end",
"def jira_issues\n @jira_issues ||= Hash.new\nend",
"def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end",
"def _findBugs\n @metric.return_scope\n end",
"def index\n @issues = Issue.all\n end",
"def index\n @issues = Issue.all\n end",
"def index\n @issues = Issue.all\n end",
"def index\n @issues = Issue.all\n end",
"def index\n @issues = Issue.all\n end",
"def list_issues(owner,repo, options = {})\n Issues.get(\n \"/repos/#{owner}/#{repo}/issues\",\n :headers => @auth,\n :body => options.to_json\n )\n end",
"def issues_by_jql jql\n @access_client.Issue.jql(jql, self.basic_query_params)\n end",
"def bugs_in_play?; self.list_bugs(true); end",
"def issues_text\n if (issues.count > 0)\n r = \"\"\n issues.each do |issue|\n r += \", \"\n r += issue.description\n end\n r[2,r.length-2] # lose starting comma-space\n else\n \"No issues yet\"\n end\n end",
"def has_issues?\n !!issues\n end",
"def get_bugs(*ids)\n params = {}\n params[:ids] = normalize_ids ids\n\n bugs = []\n ret = @client.call('Bug.get', params)\n handle_faults(ret)\n ret['bugs'].each do |bug_data|\n bugs << Bug.new(self, bug_data)\n end\n bugs\n end",
"def version_issues(proj_id, version_id)\n proj = Project.find(proj_id)\n Issue.cross_project_scope(proj, 'descendants')\n .where(\"#{SQL_COM} AND fixed_version_id = ? \", version_id)\n end",
"def find_all_issues\n version_id_sql = \"project_id =\\\"#{@project.id}\\\" \" + \\\n \"AND name = \\\"#{@version}\\\"\"\n # obtaining the unique ID from the chosen project version\n version = Version.all(conditions: [version_id_sql]).at(0).id.to_s \\\n if Version.all(conditions: [version_id_sql]) != []\n issues_sql = \"project_id = \\\"#{@project.id}\\\" \" + \\\n \"AND fixed_version_id = \\\"#{version}\\\"\"\n populate_issues_array(issues_sql)\n end",
"def project_issues(proj)\n Issue.cross_project_scope(proj, 'descendants')\n .where(\"#{SQL_COM}\")\n end",
"def unresolved_issue_count\n self.class.unresolved_issue_count(self.version_key).issuesUnresolvedCount\n end",
"def bug?\n @issue_type.casecmp('bug') == 0\n end",
"def issues\n repositories.map do |r|\n octokit.repository(r)['open_issues_count']\n end.inject(&:+)\n end",
"def effects\n Issue.find_by_sql \"\n select id, title, permalink, description, short_url, wiki_url\n from issues\n where id in (\n select issue_id\n from relationships\n where cause_id = #{id} AND relationship_type IS NULL)\"\n end",
"def issues\n issue_link = document.at_css('a[highlight=\"issues\"] .counter')\n return nil unless issue_link\n issue_link.text[/\\d+/].to_i\n end",
"def admin_issues_stats\n get_admin_stats \"issues\"\n end",
"def fetch_closed_issues_and_pr\n print \"Fetching closed issues...\\r\" if @options[:verbose]\n issues = []\n page_i = 0\n count_pages = calculate_pages(@client, \"issues\", closed_pr_options)\n\n iterate_pages(@client, \"issues\", closed_pr_options) do |new_issues|\n page_i += PER_PAGE_NUMBER\n print_in_same_line(\"Fetching issues... #{page_i}/#{count_pages * PER_PAGE_NUMBER}\")\n issues.concat(new_issues)\n break if @options[:max_issues] && issues.length >= @options[:max_issues]\n end\n print_empty_line\n Helper.log.info \"Received issues: #{issues.count}\"\n\n # separate arrays of issues and pull requests:\n issues.map { |issue| stringify_keys_deep(issue.to_hash) }\n .partition { |issue_or_pr| issue_or_pr[\"pull_request\"].nil? }\n end",
"def issue_types\n issue_types = Backlogjp.base._command \"getIssueTypes\", self.id\n issue_types.map {|hash| IssueType.new(hash)}\n end",
"def severity issue\n assert_issue(issue)\n @severities[issue]\n end",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].include?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def get_comments()\n return self.get_all_comments()\n #issues = @issues\n #issues.each do |issue|\n # puts \"Processing issue #{issue['number']}...\"\n # comments = client.issue_comments( REPO, issue.number ) \n # num = issue['number']\n # @comments[num] = comments\n # issue[\"comments\"] = comments\n #end\n #return @comments\n end",
"def stories(options = {})\n stories = if options[:id]\n [@project.client.Issue.find(options[:id])]\n else\n @project.client.Issue.jql(jql_query)\n end\n\n stories.map { |s| Issue.new(s, @project) }\n end",
"def get_jira_issues (code, type)\n if type == \"branch\"\n jira_issues = code.scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n elsif type == \"pull_request\"\n issues_in_branch = code[\"head\"][\"ref\"].scan(/(?:|^)([A-Za-z]+-[0-9]+)(?=|$)/)\n issues_in_pull_request_title = code[\"title\"].scan(/(?:\\s|^)([A-Za-z]+-[0-9]+)(?=\\s|$)/)\n # if there are more tickets in the branch than in the pull request, use the tickets in the branch, else use pr tickets\n if issues_in_branch.length > issues_in_pull_request_title.length\n jira_issues = issues_in_branch\n else\n jira_issues = issues_in_pull_request_title\n end\n end\n\n return jira_issues\nend",
"def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].start_with?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend",
"def reload_issues!\n issues(true)\n end",
"def readable_closed_issues(issues, user)\n issues.select { |i| i.can_read?(user) && !i.open? } \n end",
"def index\n @jira_issues = JiraIssue.all\n end",
"def query_issues(jql)\n response = RestClient.get(@search_url + URI.escape(jql))\n unless response.code == 200\n fail \"Response code: #{response.code}\"\n end\n JSON.parse(response.body)['issues']\n end",
"def readable_open_issues(issues, user)\n issues.select { |i| i.can_read?(user) && i.open? }\n end",
"def security_release_issues\n issues = GitlabClient\n .issues(PUBLIC_PROJECT, labels: ROOT_ISSUE_LABEL, state: OPENED)\n .auto_paginate\n\n # Ignoring issues without a due date could lead to security releases\n # being overlooked, so instead we error if we find an issue without a\n # due date.\n issues.each do |issue|\n next if issue.due_date\n\n raise \"The issue #{issue.web_url} does not have a due date set\"\n end\n\n issues.sort do |a, b|\n Date.strptime(a.due_date, DUE_DATE_FORMAT) <=>\n Date.strptime(b.due_date, DUE_DATE_FORMAT)\n end\n end",
"def issues(jql, opts = { max_results: 50, fields: nil, expand: nil })\n raw do |jira|\n start = 0\n tickets = []\n total = jira.Issue.jql(jql, max_results: 0)\n @log.debug \"Found #{total} ticket(s) in '#{jql}'\"\n loop do\n tickets.concat(jira.Issue.jql(jql, opts.merge(start_at: start))\n .map { |i| Lazylead::Issue.new(i, jira) })\n @log.debug \"Fetched #{tickets.size}\"\n start += opts.fetch(:max_results, 50).to_i\n break if start > total\n end\n tickets\n end\n end",
"def get_issue(number)\n github.issues.get(*github_org_repo, number)\n end",
"def get_bug(id)\n get_bugs(id).first\n end",
"def list_bugs_in_errata(advisory)\n errata = find_errata(advisory)\n bugids = FiledBug.connection.select_values(\"select bug_id from filed_bugs where errata_id = #{errata.id}\")\n return bugids.collect { |b| b.to_i }\n end",
"def project_versions(project,issues)\n issues.collect(&:fixed_version).compact.uniq\n end",
"def scoped_tickets\n return @sprint.assigned_tickets if @sprint\n return @project.tickets if @project\n end",
"def get_issue(num)\n @issues = Octokit.issues \"LingduoKong/final\",:state => \"open\"\n @issues.each do |issue|\n if issue.number == num\n @issue = issue\n return @issue\n end\n end\nend",
"def problems\n @link_collector.problems\n end",
"def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end",
"def get_all_incident_issues\n response = Octokit.list_issues(\"department-of-veterans-affairs/appeals-support\", direction: \"asc\", state: \"open\")\n response.reject { |v| v[:created_at] >= 10.days.ago }\n end",
"def _get_comments_from_gh()\n comments = []\n page = 1\n done = false\n until done\n puts \"Comment Page #{page}\"\n newcomments = self.client.issues_comments( REPO, { :page => page} )\n comments += newcomments\n done = newcomments == []\n page = page + 1\n end\n return comments\n end",
"def milestone_issues(project, milestone, options = {})\n get(\"/projects/#{url_encode project}/milestones/#{milestone}/issues\", query: options)\n end",
"def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend",
"def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend",
"def issues(options = {})\n ensure_mandatory_parameters options\n labels = options[:labels]\n\n opened = issues_with_state(labels, :open)\n closed = issues_with_state(labels, :closed)\n opened + closed\n end",
"def index\n @local_issues = LocalIssue.all\n end",
"def index\n @bugs = @project.bugs\n end",
"def list(options=nil, params={})\n path = if options && options[:user] && options[:repo]\n \"/repos/#{options[:user]}/#{options[:repo]}/issues\"\n else\n '/issues'\n end\n\n @connection.get(path, params).map do |issue_data|\n GitHubV3API::Issue.new(self, issue_data)\n end\n end",
"def show\n @voucher = Voucher.find(params[:id])\n @issues = @voucher.issues\n\n end",
"def get_issue(issue_id)\n issue_resource.find_by_id(issue_id, expand: \"renderedFields\")\n end",
"def issue\n @issue ||= Issue.get_for_commit(message)\n end",
"def issue\n @issue = Issue.find(params[:id])\n end",
"def series_issue(field = nil)\n find_record_value(field, clean: false) if field\n end",
"def closed_issues(board)\n client.\n issues(board.github_id, state: :closed, since: 2.month.ago.iso8601).\n reject { |issue| issue.closed_at < board.created_at }\n end",
"def show\n @bug_tickets = @bug_ticket.versions\n end",
"def issue\n @issue ||= Gitmine::Issue.get_for_commit(message)\n end",
"def upcoming_security_issues_and_merge_requests\n if (release_issue = security_release_issues[0])\n security_issues_and_merge_requests_for(release_issue.iid)\n else\n []\n end\n end",
"def warnings\n @tracker.warnings\n end"
] |
[
"0.7769867",
"0.71680766",
"0.679394",
"0.6620497",
"0.64704466",
"0.63909864",
"0.6301553",
"0.61398476",
"0.61043245",
"0.60802215",
"0.6016841",
"0.59586143",
"0.59374195",
"0.5931796",
"0.59255105",
"0.5925111",
"0.5909187",
"0.5893545",
"0.58911854",
"0.5882012",
"0.58750874",
"0.58026165",
"0.5787213",
"0.57789433",
"0.5768842",
"0.5713615",
"0.5666651",
"0.5659648",
"0.5647753",
"0.56399566",
"0.563974",
"0.5633937",
"0.556768",
"0.5567005",
"0.55494815",
"0.55463547",
"0.5542832",
"0.5540351",
"0.5536919",
"0.5536919",
"0.5536919",
"0.5536919",
"0.5536919",
"0.5526148",
"0.55257964",
"0.55190355",
"0.55161375",
"0.5490615",
"0.5487486",
"0.54874045",
"0.546263",
"0.5456394",
"0.54528946",
"0.54517716",
"0.54501885",
"0.54260296",
"0.54167134",
"0.541172",
"0.540515",
"0.5391595",
"0.5382427",
"0.53721094",
"0.53688025",
"0.5365755",
"0.5356724",
"0.5348211",
"0.53346723",
"0.5330902",
"0.5319693",
"0.5276331",
"0.5266041",
"0.52567303",
"0.5253726",
"0.5247388",
"0.5224556",
"0.52237856",
"0.52230626",
"0.5217878",
"0.52159166",
"0.5206737",
"0.52060765",
"0.52060765",
"0.52038264",
"0.5198703",
"0.5192584",
"0.5190669",
"0.5175416",
"0.517426",
"0.51707345",
"0.5158653",
"0.5153503",
"0.51433825",
"0.514338",
"0.51404244",
"0.51393914",
"0.5136506",
"0.5133556",
"0.5131649",
"0.5127907",
"0.5119319"
] |
0.5862719
|
21
|
Generate report and send inline comment with Danger's warn or fail method.
|
def do_comment(report_files, inline_mode)
spotbugs_issues = []
report_files.each do |report_file|
spotbugs_issues(report_file).each do |bug_instance|
next unless target_files.include? bug_instance.relative_path
spotbugs_issues.push(bug_instance)
send_comment(bug_instance, inline_mode)
end
end
spotbugs_issues
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def generate_report\n @notices << \"#{ActionController::Base.helpers.pluralize(@batch_ids.count, 'Item')} clearanced into batch #{batch.id}\" if batch.id\n @errors << \"#{ActionController::Base.helpers.pluralize(@errors.count, 'id')} raised errors and were not clearanced\" if errors.any?\n @errors << \"No new clearance batch was added\" unless batch.id\n @errors << \"No Item or CSV passed\" if !@item_id && !@file\n end",
"def send_comment(results)\n dir = \"#{Dir.pwd}/\"\n results['messages'].each do |r|\n filename = results['filePath'].gsub(dir, '')\n method = r['severity'] > 1 ? 'fail' : 'warn'\n send(method, r['message'], file: filename, line: r['line'])\n end\n end",
"def report_body; end",
"def report_body; end",
"def report(failure_message)\n puts failure_message\n end",
"def report(failure_message)\n puts failure_message\n end",
"def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report; end",
"def report(inline_mode: true)\n unless skip_gradle_task\n raise('Could not find `gradlew` inside current directory') unless gradlew_exists?\n\n exec_gradle_task\n end\n\n report_files_expanded = Dir.glob(report_files).sort\n raise(\"Could not find matching SpotBugs report files for #{report_files} inside current directory\") if report_files_expanded.empty?\n\n do_comment(report_files_expanded, inline_mode)\n end",
"def report_broken\n \"Broken\"\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def report\n raise \"#{self.class} should implement #report\"\n end",
"def create_report()\n report = <<STR_END\n#### STEPS TO REPRODUCE BUG ####\n\n#{@list_steps_text.get_value}\n\n\n#### DESCRIPTION OF BUG ####\n\n#{@description_text.get_value}\n\n--#{@reproduce_check.get_value}\n--#{@past_check.get_value}\n\n\n#### SESSION LOG ####\n\n#{@parent.log_text.get_value}\n\n\n--------------------------------------------------------------------------------\n#{IO.readlines($attr[:name]).join(\"\\n\") if $attr[:name]}\nSTR_END\n \n fname = \"bugs/#{Time.now.to_s.split(\" \").join(\"_\")}_#{$attr[:name].split(/[\\/\\\\]/).join(\"_\") if $attr[:name]}_bug\"\n File.open(fname, 'w') {|fout| fout.write(report)}\n prompt = MessageDialog.new(self, \"Bug report saved to file: #{fname}\\nPlease email this file to the developer!\",\n \"Bug Report Created\", OK)\n exit_dlg() if prompt.show_modal == ID_OK\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n end",
"def report_warn(type, message)\n @report.warn(type, message)\n Salus::PluginManager.send_event(:report_warn, { type: type, message: message })\n if @builds\n scanner = @report.scanner_name\n message = \"#{scanner} warning: #{type}, #{message}, build: #{@builds}\"\n end\n bugsnag_notify(message)\n end",
"def report_failure\n @report.fail\n end",
"def report_failure\n @report.fail\n end",
"def report\n message = [identification]\n\n message.concat(make_report('Original-Source', :original_source))\n message.concat(make_report('Generated-Source', :generated_source))\n message.concat(make_report('Original-Node', :original_node))\n message.concat(make_report('Generated-Node', :generated_node))\n message.concat(node_diff_report)\n\n message.join(\"\\n\")\n end",
"def write_report\n\n end",
"def report\n \n end",
"def complain something\n puts angry_dude_format something\n end",
"def report\n @comment = Comment.find(params[:id])\n @comment.report\n flash[:success] = 'Comment reported!' if @comment.save\n\n redirect_to request.referer || root_url\n end",
"def output_report(report)\n # Create markdown\n report_markdown = report.markdown_value\n\n # Send markdown\n markdown(report_markdown)\n\n # Notify failure if minimum coverage hasn't been reached\n threshold = Xcov.config[:minimum_coverage_percentage].to_i\n if !threshold.nil? && (report.coverage * 100) < threshold\n fail(\"Code coverage under minimum of #{threshold}%\")\n end\n end",
"def nice_comment\n @res.write THANK_YOU_COMMENT\n end",
"def warning(text); end",
"def warning(text); end",
"def report\n\t\tend",
"def report_by_text(text, inline_mode = true)\n raise \"Please specify xml text.\" if text.empty?\n errors = parse(text)\n\n send_comment(errors, inline_mode)\n end",
"def report(message)\n puts message unless quiet? #or trial?\n end",
"def report!(msg = \"\")\n puts(\"#{caller.first}: #{msg}\")\n end",
"def send_comment(results)\n dir = \"#{Dir.pwd}/\"\n results.each do |r|\n filename = results[\"filePath\"].gsub(dir, \"\")\n fail(\"File not formatted with Prettier\", file: filename, line: 0)\n end\n end",
"def send_inline_comments(results)\n results.each do |result|\n result[\"errors\"].each do |error|\n file = result[\"file\"]\n message = error[\"message\"]\n line = error[\"line\"]\n fail(message, file: file, line: line)\n end\n end\n end",
"def report\n deprecations = @messages.select { |m| m[:kind] == :deprecation }\n\n if deprecations.any?\n puts\n puts \"Deprecations:\"\n puts\n\n messages = deprecations.map { |m| m[:message] }\n puts messages.join(\"\\n---\\n\\n\")\n puts\n end\n\n # code blocks in chef report callbacks are expected to yield true\n true\n end",
"def generate_report(_callback_data)\n text_report = OrderReport.new.generate\n\n respond_with :message, text: text_report, parse_mode: :Markdown\n answer_callback_ok\n end",
"def run_warned; end",
"def warn\n\n end",
"def complain\n\n end",
"def comments_notify(report_id, report_comemnts, task_comments)\n @report = Report.find(report_id)\n @report_comments = report_comemnts\n @task_comments = task_comments\n\n mail(to: ADMIN_EMAILS, subject: t('.subject'))\n end",
"def rude_comment\n @res.write GO_AWAY_COMMENT\n @res.status = 404\n end",
"def warn(msg)\n #This is a stub, used for indexing\n end",
"def report(output)\n end",
"def bold_warning(*args); end",
"def report\n entity_class = params[:entity].camelize.constantize\n entity = entity_class.find(params[:id])\n message = params[:reason]\n user = current_filmmaker.blank? ? current_client.blank? ? nil : current_client : current_filmmaker\n UserMailer.delay.report_entity_mail(user, entity, message)\n render :text => true\n end",
"def report_generated\n @greeting = \"Hi\"\n\n mail :to => \"to@example.org\"\n end",
"def report_error\n mail to: 'mail@fishmarkt.ru', subject: '[Test] Error report'\n end",
"def format_compile_warning(file_name, file_path, reason,\n line, cursor); EMPTY; end",
"def warned; end",
"def post_fail_message; end",
"def report_nothing_to_generate\n report \"Nothing to generate.\"\n end",
"def output_to_report_file message\n @spec_report_file.puts message\n end",
"def send_inline_comment (results, method)\n dir = \"#{Dir.pwd}/\"\n results.each do |r|\n\tfilename = r['file'].gsub(dir, \"\")\n\tsend(method, r['reason'], file: filename, line: r['line'])\n end\n end",
"def subject\n 'Report a problem'.freeze\n end",
"def generate_warning_text\n @warnings\n end",
"def report(description, response)\n code, result = *response\n case code\n when :pass then\n @passes += 1\n pass(description, result)\n when :fail then\n @failures += 1\n message, line, file = *response[1..-1]\n fail(description, message, line, file)\n when :error, :setup_error then\n @errors += 1\n error(description, result)\n end\n end",
"def warn message\n @options.warn make_message message\n end",
"def report(handler)\n raise NotImplementedError\n end",
"def feed_warning\r\n render\r\n end",
"def reporting\n # STUB\n end",
"def warning! opts = nil\n NOCH.evaluate_for \"warning\", opts\n end",
"def report\n entity_class = params[:entity].camelize.constantize\n entity = entity_class.find(params[:id])\n message = params[:reason]\n UserMailer.report_entity_mail(current_user, entity, message).deliver\n render :text => true\n end",
"def bug_report\n raise BakerError, <<-EOS\n Bug reporting has not yet been implimented.\n Manually send a bug report to #{@maintainer}.\n EOS\n end",
"def report!(captcha_id)\n raise NotImplementedError\n end",
"def report_error!(hash)\n report = ErrorReport.create!(hash.merge(:api_key => api_key))\n report.save\n report.generate_notice!\n end",
"def alert_warning(statement, question = nil)\n ui.alert_warning statement, question\n end",
"def do_not_edit_notice(options={})\n message = options[:message]\n char = (options[:char] || '#')\n notice = Array.new\n\n notice << char\n notice << \"#{char} WARNING: AUTOMATICALLY GENERATED FILE; DO NOT EDIT!\"\n if !message.nil?\n notice << char\n notice << \"#{char} #{message}\"\n end\n notice << char\n notice << \"#{char} Generated @ #{Time.now.utc}\"\n notice << char\n\n notice.join(\"\\n\") + \"\\n\"\n end",
"def send_notification\n AdminMailer.delay.new_report(self)\n end",
"def report_run(command)\n super do |report|\n @report = report\n yield report\n end\n end",
"def report_dependency(dependency)\n super do |report|\n result = yield report\n report[:dependency] = dependency\n result\n end\n end",
"def inspector_successfully_recieved_report(report, inspector)\n warn \"[DEPRECATION] `inspector_successfully_recieved_report` is deprecated. Please use `inspector_successfully_received_report` instead.\"\n inspector_successfully_received_report(report, inspector)\n end",
"def build_report_message\n message = \"[url=%s]%s[/url] has reported a post.\\n\\n\"\n message << \"Reason:[quote]%s[/quote]\\n\"\n message << \"Post: [url=%s]%s[/url]\\n\"\n message << \"Forum: [url=%s]%s[/url]\\n\\n\"\n message << \"Posted by: [url=%s]%s[/url]\\n\"\n message << \"Original Content: [quote]%s[/quote]\\n\"\n message = message % [user_url(current_user), current_user.username, params[:report][:reason],\n post_url, @topic.title, forum_url(@topic.forum), (@topic.forum.title),\n user_url(@post.user), @post.user.username, @post.content]\n end",
"def report(information)\n @keeper.report(information)\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 rude_comment\n @res.write GO_AWAY_COMMENT\n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def warning text\n print_red(\"WARNING: #{text}\") \n end",
"def diagnostic; end",
"def warning(string); end",
"def warning(string); end",
"def create_new_report!; end",
"def create_new_report!; end",
"def consecutive_sad_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n mail to: @user.email,\n subject: \"[bootcamp] #{@report.user.login_name}さんが#{User::DEPRESSED_SIZE}回連続でsadアイコンの日報を提出しました。\"\n end",
"def report(context, repo, dir)\n raise \"No report(context, repo, dir) function defined by report subclass\"\n end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def failure_message; end",
"def send_report\n @greeting = \"Hi\"\n\n mail to: \"to@example.org\", subject: \"The report you requested.\"\n end",
"def generate_report_impressions\n\t\t## we don't do this at the moment.\n\t\t## now for verification.\n=begin\n\t\tself.reports.each do |report|\n\t\t\tif report.impression.blank?\n\t\t\t\treport.impression = \"\"\n\t\t\t\treport.tests.each do |test|\n\t\t\t\t\treport.impression += (\" \" + (test.display_comments_or_inference || \"\"))\n\t\t\t\tend\n\t\t\tend\n\t\tend\n=end\n\tend",
"def user_send_report\n\t\t# send report issue to the admin\n\t\tif UserMailer.report_issue(current_user,params[:report_text]).deliver_now\n\t\t# response to the JSON\n \t render json: { success: true, message: \"Report has sent successfully\" },:status=> 200\n\t else\n\t render :json=> { success: false, message: \"problem with sending report\" },:status=> 203\n\t end\t\n\tend",
"def report_success\n @report.pass\n end",
"def report_success\n @report.pass\n end",
"def report_title; end",
"def report_title; end",
"def modeler_description\n return 'The main gist is to figure out how to correctly write to the reports/ directory'\n end"
] |
[
"0.63580245",
"0.6348315",
"0.6310321",
"0.6310321",
"0.6279741",
"0.6279741",
"0.6181128",
"0.6136799",
"0.6136799",
"0.6136799",
"0.6136799",
"0.6136799",
"0.60452014",
"0.60393983",
"0.6013868",
"0.6013868",
"0.59600747",
"0.5933462",
"0.5912518",
"0.5901414",
"0.5901414",
"0.5878531",
"0.5868325",
"0.5857462",
"0.58404535",
"0.5834817",
"0.5828357",
"0.58211",
"0.57999974",
"0.57999974",
"0.57836527",
"0.57779825",
"0.5758233",
"0.57426393",
"0.573881",
"0.56824946",
"0.56820714",
"0.5681926",
"0.5676677",
"0.5675229",
"0.5670793",
"0.563791",
"0.56330454",
"0.5626793",
"0.56221646",
"0.56017286",
"0.558674",
"0.55853546",
"0.5573477",
"0.5566555",
"0.55620104",
"0.55480987",
"0.55359185",
"0.55254006",
"0.55167186",
"0.55162245",
"0.5511911",
"0.5499964",
"0.5484745",
"0.54782313",
"0.54460233",
"0.54442924",
"0.5409849",
"0.540814",
"0.5393091",
"0.5377946",
"0.53697985",
"0.53675115",
"0.5363433",
"0.53632474",
"0.53599286",
"0.5353671",
"0.53519934",
"0.5346382",
"0.5336254",
"0.5335398",
"0.5329564",
"0.53293157",
"0.53293157",
"0.53267574",
"0.532573",
"0.532573",
"0.53208315",
"0.53208315",
"0.5314109",
"0.53132546",
"0.5311905",
"0.5311905",
"0.5311905",
"0.5311905",
"0.5311905",
"0.5311905",
"0.5311905",
"0.5308107",
"0.53047425",
"0.52986056",
"0.5290964",
"0.5290964",
"0.52901024",
"0.52901024",
"0.5282462"
] |
0.0
|
-1
|
Builds the max heap.
|
def build_heap
unless @elements.empty?
i = (@elements.size-1)/2
while i>=0
heapify(i)
i -= 1
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def build_maxheap\n\t\ti = @heap.length/2\n\t\twhile i >= 0\n\t\t\tn_heapify(@max, i)\n\t\t\ti -= 1\n\t\tend\n\tend",
"def build_heap\n @heap_size = length\n (length / 2).floor.downto(1) do |i| \n heapify_downward i \n end\n end",
"def buildMaxHeap(start = (@heapsize/2-1),finish = 0)\r\n\t\t#why count down and not up? (count up would be like 7 + 5 +3 +2 +1, up would be like 1 + 1 +2 +1 + 2 ? )\r\n\t\t(start).downto(finish) do |index|\r\n\t\t\tmaxHeapify(index)\r\n\t\tend\r\n\tend",
"def create_max_heap\n (0..@heap_size/2-1).to_a.reverse.each do |indx|\n fix_one_error(indx)\n end\n end",
"def build_minheap\n\t\ti = @heap.length/2\n\t\twhile i >= 0\n\t\t\tminheapify(i)\n\t\t\ti -= 1\n\t\tend\n\tend",
"def create_max_heap(unsorted_array)\r\n (unsorted_array.length / 2).downto(1) do |node_num|\r\n fix_max_heap(node_num, unsorted_array)\r\n end\r\nend",
"def max_heapify(index)\n if self.left_i(index) > (self.size - 1) && self.right_i(index) > (self.size - 1)\n self.max_heapify_bottom_up(index)\n else\n self.max_heapify_top_down(index)\n end\n end",
"def heap_maximum()\n\t\t@heap[0]\n\tend",
"def build_heap(array)\n first_parent_index = (array.length - 2) / 2\n (first_parent_index..0).each do |current_index|\n sift_down(current_index, array.length - 1, array)\n end\n end",
"def heap_extract_max()\n\t\tif @heap.length < 0\n\t\t\treturn nil\n\t\tend\n\t\tmax = @heap[0]\n\t\t@heap[0] = @heap[@heap.length-1]\n\t\t@heap.pop()\n\t\tn_heapify(@max)\n\t\treturn max\n\tend",
"def max_heapify(arr, arr_len, parent)\n\n largest = parent # Assume the largest is the root of the subtree\n left_child = 2 * parent + 1 # left child's index\n right_child = 2 * parent + 2 # right child's index\n\n if left_child < arr_len && @data[left_child] > @data[largest] # Check bounds and if left child's index is new largest\n\n largest = left_child\n end\n\n if right_child < arr_len && @data[right_child] > @data[largest] # Check bounds and if right child's index is new largest\n\n largest = right_child\n end\n\n if largest != parent # If the largest isn't the root, then we have to swap to maintain the max heap property and re-max-heapify\n swap(arr, largest, parent) # Put the largest element which is the root at the end because it is now in the right place\n\n max_heapify(arr, arr_len, largest) # Going to have to max heapify after switching the root and last element\n end\n end",
"def max_heapify!(i)\n l = left(i)\n r = right(i)\n\n if l < self.heapsize && self[l] > self[i]\n largest = l\n else\n largest = i\n end\n\n if r < self.heapsize && self[r] > self[largest]\n largest = r\n end\n\n if largest != i\n exchange(i, largest)\n max_heapify!(largest)\n end\n\n return self\n end",
"def remove_max\n\n if @max_heap.length == 1\n return @max_heap.pop\n end\n\n # Replace the first element with the last element\n last_node = @max_heap.pop\n max_node = @max_heap.shift\n @max_heap.unshift(last_node)\n\n parent_idx = 0\n\n # Sink down the current first node to its correct position\n while parent_idx < @max_heap.length\n left_child_idx = (parent_idx * 2) + 1\n right_child_idx = (parent_idx * 2) + 2\n\n # Compare the values if the right and left child are in the correct index\n swap = nil\n if left_child_idx < @max_heap.length\n swap = left_child_idx if @max_heap[left_child_idx] > @max_heap[parent_idx]\n end\n\n if right_child_idx < @max_heap.length\n if swap.nil? && @max_heap[right_child_idx] > @max_heap[parent_idx] || swap != nil? && @max_heap[right_child_idx] > @max_heap[left_child_idx]\n swap = right_child_idx\n end\n end\n\n break if swap.nil?\n\n @max_heap[parent_idx], @max_heap[swap] = @max_heap[swap], @max_heap[parent_idx]\n\n parent_idx = swap\n\n end\n\n max_node\nend",
"def build_heap(array)\n first_parent_idx = (array.length - 1) / 2\n (first_parent_idx).downto(0).each { |current_idx| \n self.sift_down(current_idx, array.length - 1, array)\n }\n return array\n end",
"def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\n end",
"def extract_maximum!\n raise \"Heap Underflow - The heap is empty\" if self.heapsize < 1\n\n max_value = self[0]\n self[0] = self[self.heapsize - 1]\n self.heapsize = self.heapsize - 1\n self.max_heapify!(0)\n\n return max_value\n end",
"def setup_heap\n @heap = BinaryMinHeap.new\n @thread_queues.each do |queue|\n @heap.push(queue.shift)\n end\n end",
"def get_heap\n @heap\n end",
"def ruby_gc_heap_growth_max_factor\n 0\n end",
"def construct_by_down_heap(ary)\n n = ary.size\n k = n/2 - 1\n k.downto(0).each do |k|\n down_heap(ary, k, n)\n end\nend",
"def initialize(&block)\n # We default to a priority queue that returns the largest value\n block ||= lambda { |x, y| (x <=> y) == 1 }\n @heap = Containers::Heap.new(&block)\n end",
"def find_kth_largest(nums, k)\n max_heap = MaxHeap.new()\n \n nums.each {|val| max_heap.insert(val)}\n\n i=1\n while i<k\n heap.delete_max()\n i+=1\n end\n \n heap.delete_max()\nend",
"def heapsort(array)\r\n\t#create a heap from an array\r\n\theap = MaxHeap.new(array)\r\n\theap.buildMaxHeap\r\n\t\r\n\t#puts heap.array\r\n\t#puts \"_____\"\r\n\t#puts \"array size = #{heap.arraysize}\"\r\n\t\r\n\t(heap.arraysize).downto(2) do |i|\r\n\t\t#exchange of largest data point with end of the array\r\n\t\ttemp = heap.array[0]\r\n\t\theap.array[0] = heap.array[i-1]\r\n\t\theap.array[i-1] = temp\r\n\t\t\r\n\t\t#decrement size of the heap so that the last value stays in the array, but does not get sorted\r\n\t\theap.heapsize -=1\r\n\t\theap.maxHeapify(0)\r\n\t\t#puts \"**____**\"\r\n\t\t#puts \"i is equal to #{i}\"\r\n\t\r\n\t\t#puts heap.array\r\n\t\t#puts \"**_~~_**\"\r\n\tend\r\n\tputs heap.array\r\nend",
"def heapify!\n (length / 2).downto(1) { |i| sink(i) }\n end",
"def heapify(num)\n left = num * 2\n right = num * 2 + 1\n\n if left <= @heapSize && @heap[left] > @heap[num]\n largest = left\n else\n largest = num\n end\n\n if right <= @heapSize && @heap[right] > @heap[largest]\n largest = right\n end\n\n if(largest != num)\n tmp = @heap[num]\n @heap[num] = @heap[largest]\n @heap[largest] = tmp\n heapify(largest)\n end\n end",
"def heapify\n for i in (0..(@ary.size-1)).to_a.reverse\n upheap(i)\n downheap(i)\n end\n end",
"def sort\n\n arr_len = @data.length\n start_build_idx = arr_len / 2 - 1 # The last half of the array is just leaves\n\n for i in (start_build_idx).downto(0)\n\n max_heapify(@data, arr_len, i) # Build the heap from the array\n end\n\n for i in (arr_len-1).downto(0)\n\n swap(@data, i, 0) # Move the current root to the end of the array\n max_heapify(@data, i, 0) # Heapify the remaining part of the array excluding the root which was just sorted to the end\n end\n\n puts(@data)\n end",
"def windowed_max_range_v2(arr,w)\n stack = MinMaxStackQueue.new\n \n\nend",
"def largest_area\n @heights = []\n @positions = []\n @max_size = 0\n\n @temp_pos = nil\n @temp_height = nil\n @temp_size = nil\n\n @store.each_with_index do |height, index|\n if @heights.empty? || height > @heights.last\n @heights.push(height)\n @positions.push(index)\n elsif height < @heights.last\n while !@heights.empty? && height < @heights.last\n pop_stacks(index)\n end\n\n @heights.push(height)\n @positions.push(@temp_pos)\n end\n end\n\n while !@heights.empty?\n pop_stacks(@store.length)\n end\n\n @max_size\n end",
"def max_heapify_top_down(index, last_index = nil)\n last_index ||= self.size - 1\n if self.right_i(index) <= last_index\n if self[self.right_i(index)] > self[index]\n larger_i = self.right_i(index)\n else\n larger_i = index\n end\n else\n larger_i = index \n end\n\n\n if self.left_i(index) <= last_index\n if self[self.left_i(index)] > self[larger_i]\n larger_i = self.left_i(index)\n end\n end\n\n if larger_i != index\n self.swap(larger_i, index)\n max_heapify_top_down(larger_i, last_index)\n else\n return\n end\n \n end",
"def max_heap_insert(key)\n\t\t@heap.push(-1)\n\t\theap_incease_key(@heap.length-1, key)\n\tend",
"def max_heapify_bottom_up(index)\n if parent_i(index) && self[parent_i(index)] < self[index] \n self.swap(parent_i(index), index)\n max_heapify_bottom_up(parent_i(index))\n end\n end",
"def heapify(queue)\n (queue.length - 1).downto(1) do |i|\n if queue[i].value > queue[i-1].value\n queue[i], queue[i-1] = queue[i-1], queue[i]\n else\n break\n end\n end\n end",
"def extract_max\n return if is_empty?\n if size == 1\n @size = 0\n value = @root.val\n @root = nil\n return value\n end\n maximum = @root.val\n @size -= 1\n node = @leaf_set.get\n replaced_value = node.val\n @leaf_set.delete(node)\n @incomplete_set.delete(node)\n parent = node.parent\n parent.left == node ? parent.left = nil : parent.right = nil\n @leaf_set.delete(parent)\n @incomplete_set.delete(parent)\n node = nil\n @incomplete_set.insert(parent) if parent.is_incomplete?\n @leaf_set.insert(parent) if parent.is_leaf?\n\n @leaf_set.delete(@root)\n @incomplete_set.delete(@root)\n @root.val = replaced_value\n @incomplete_set.insert(@root) if @root.is_incomplete?\n @leaf_set.insert(@root) if @root.is_leaf?\n heapify(@root)\n return maximum\n end",
"def max\n puts 'Queue id empty' and return if @root.nil?\n q = QueueWithLinkedList.new\n q.enqueue(@root)\n max = 0\n while !q.isEmpty?\n node = q.dequeue\n max = node.data if node.data > max\n q.enqueue(node.left) if node.left\n q.enqueue(node.right) if node.right\n end\n return max\n end",
"def pop_max()\n return nil if @stack.empty?\n\n max_val = peek_max\n tmp_stack = []\n\n while top != max_val\n val = pop\n tmp_stack.push(val)\n end\n pop\n\n while !tmp_stack.empty?\n val = tmp_stack.pop\n push(val)\n end\n\n max_val\n end",
"def windowed_max_range_queue(array, window_size)\n # debugger\n mq = MinMaxStackQueue.new\n (0...array.length).each { |i| mq.enqueue(array[i]) }\n \n window = MinMaxStackQueue.new\n (0...window_size).each { |i| window.enqueue(mq.dequeue) }\n diff = window.max - window.min\n current_max = diff \n until mq.empty?\n \n window.dequeue\n window.enqueue(mq.dequeue)\n diff = window.max - window.min\n current_max = diff if diff > current_max\n end\n current_max\nend",
"def default_max_size\n [Setting[:histsize], self.size].min\n end",
"def heapify!(array)\n @data = array\n (0..(@data.size / 2 - 1)).to_a.reverse.each { |i| percolate_down i }\n return self\n end",
"def push_max(value)\n last_val = max\n if @maxes.empty? || (!last_val.nil? && (value > last_val))\n @maxes.push(MaxStackValue.new(value))\n elsif last_val == value\n @maxes.last.inc\n end\n end",
"def heap_down(sub_root, last_pos, list)\n max_child = max_child(right_child(sub_root, last_pos), left_child(sub_root, last_pos), list)\n while max_child && list[max_child] > list[sub_root]\n swap(sub_root, max_child, list)\n sub_root = max_child\n max_child = max_child(right_child(sub_root, last_pos), left_child(sub_root, last_pos), list)\n end\nend",
"def minheapify(i=0)\n\t\tn_heapify(@min, i)\n\t\t@heap\n\tend",
"def windowed_max_range(array, w)\n queue = MinMaxStackQueue.new\n max = 0\n\n array.each do |num|\n queue.enqueue(num)\n end\n queue.max\nend",
"def heapsort_inPlace(list)\n return list if list.length <= 1\n\n puts \"\\nSTARTING with #{list}\"\n\n # build a max heap\n list.length.times do |i|\n heap_up(list, i)\n puts \"\\tlist = #{list}\"\n end\n\n puts \"\\nREADY to pluck out Max and put start populating from end of list\"\n last = list.length - 1\n\n # pop off the top of the heap\n # place it in the last unsorted slot\n # re-heap the unsorted list\n list.length.times do |i|\n swap(list, 0, last)\n puts \"\\tpost swap,\\tlist = #{list}\"\n heap_down(list, 0, last)\n puts \"\\t\\t\\t adj = #{list}\"\n\n last -= 1\n end\n\n return list\nend",
"def heap_sort(list)\n length = list.length \n build_max_heap(list)\n\n last_el = length - 1\n while last_el > 0 do \n swap(list, 0, last_el)\n heapify(list, last_el, 0)\n last_el -= 1\n end \n\n return list\nend",
"def heapsort()\n\t\tbuild_minheap()\n\t\ti = @heap.length-1\n\t\twhile i >= 1\n\t\t\ttemp = @heap[i]\n\t\t\t@heap[i] = @heap[0]\n\t\t\t@heap[0] = temp\n\t\t\tminheapify_heapsort(i)\n\t\t\ti -= 1\n\t\tend\n\t\t@heap\n\tend",
"def maximize; end",
"def k_largest_elements2(array, k) \n result = BinaryMinHeap.new\n k.times do\n result.push(array.pop)\n end\n until array.empty?\n result.push(array.pop)\n result.extract\n end\n result.store\nend",
"def get_index_of_biggest_child index\n childs = []\n left_index = child_index_left(index)\n right_index = child_index_right(index)\n for i in left_index..right_index\n childs << @heap[i]\n end\n childs.index(childs.max)+left_index\n end",
"def heapsort(list)\n sorted_arr = []\n heap = MinHeap.new()\n list.each do |value|\n heap.add(value, value)\n end \n\nlist.length.times do |i|\n min = heap.remove()\n sorted_arr.push(min)\nend \nreturn sorted_arr\nend",
"def max\n @max ||= begin\n maxes = []\n options[:max].times { |t| maxes << dup_for(max: nil, change: nil, series: nil, extend_cache_life: options[:max] - t, period: period.prev(t + 1)).compute }\n maxes.max\n end if options[:max]\n end",
"def heapify(list, sub_root, counter = 0)\n max_child = max_child(right_child(sub_root, list.length), left_child(sub_root, list.length), list)\n if max_child && list[max_child] > list[sub_root]\n swap(max_child, sub_root, list)\n heapify(list, max_child, counter + 1)\n elsif max_child\n heapify(list, sub_root - 1, counter + 1)\n end \n return \nend",
"def initialize(max_value)\n self.count, self.store = 0, Array.new(max_value, false)\n end",
"def better_windowed_max_range(arr,w)\n current_max_range=0\n queue=MinMaxStackQueue.new\n \n (0...w).each do |i|\n \n queue.enqueue(arr[i])\n end\n max=queue.max\n min=queue.min\n current_max_range = max-min if max-min > current_max_range\n (w...arr.length-w+1).each do\n queue.dequeue\n queue.enqueue(arr[])\n end\n current_max_range\nend",
"def windowed_max_range_stacks(arr, w)\n queue = Queue.new\n\n w.times do |idx|\n queue.enqueue(arr[idx])\n end\n maximum = queue.max - queue.min\n\n\n arr[w..-1].each do |el|\n queue.enqueue(el)\n queue.dequeue\n maximum = queue.max - queue.min if maximum < (queue.max - queue.min)\n end\n maximum\nend",
"def heapify(**val)\n val.each do |k, v|\n insert(k, v)\n end\n val.length\n end",
"def max_size=(_arg0); end",
"def heapsort(list)\n array = []\n myHeap = MinHeap.new()\n #return myHeap.store\n list.each do |item|\n myHeap.add(item)\n puts item \n end\n\n until myHeap.empty?\n array << myHeap.remove()\n end\n return array\nend",
"def largestsize\n self.optimize\n sizes = Hash.new(0)\n @h.each { |_,v| sizes[v] += 1 }\n result = sizes.sort{ |a,b| a[1] <=> b[1] }.reverse\n s = \"\"\n result.each { |_,v| s += v.to_s + \" \" }\n s\n end",
"def construct_max_value_table(max_capacity)\n @max_value_items_table = []\n\n items.each_with_index do |item, i|\n @max_value_items_table.push([])\n for current_capacity in 1..max_capacity\n j = current_capacity - 1\n if item[:weight] == current_capacity && item[:value] > (items_value_calc(above_items(i, j)))\n @max_value_items_table[i].push([item])\n elsif item[:weight] < current_capacity\n remainder = j - item[:weight]\n if (items_value_calc([item] + above_items(i, remainder)) > (items_value_calc(above_items(i, j))))\n @max_value_items_table[i].push([item] + above_items(i, remainder))\n else\n @max_value_items_table[i].push(above_items(i, j))\n end\n else\n @max_value_items_table[i].push(above_items(i, j))\n end\n end\n end\n\n return @max_value_items_table\n end",
"def remove_max(list, last_pos)\n removed = list[0]\n list[0] = list[last_pos] \n list[last_pos] = removed\n heap_down(0, last_pos - 1, list)\nend",
"def max_window_stack_queues(array, w)\n num_times = array.length\n que = array.shift(w)\n current_max_range = 0\n best_max_range = 0\n until array.empty?\n p que\n # shift to get rid of first, push to add to end\n first_num = que.shift\n last_num = que.last\n current_max_range = last_num - first_num\n if current_max_range > best_max_range\n best_max_range = current_max_range\n end\n que << array.shift unless array.empty?\n end\n\n best_max_range\nend",
"def max_mem\n @max_mem ||= defaults[:max_mem]\n end",
"def largest_length\n @executor.getLargestPoolSize\n end",
"def heapify(key = 0)\n # Assume left and right children follow heap property\n value = get(key)\n return if value == nil\n\n larger_child_key = larger_child(key)\n larger_value = get(larger_child_key)\n\n if larger_value != nil && larger_value > value\n @data[key] = @data[larger_child_key]\n @data[larger_child_key] = key\n heapify(larger_child_key)\n end\n end",
"def heap_sort(list)\n heap_sort = MinHeap.new()\n\n list.each do |number|\n heap_sort.add(number, number)\n end\n\n sorted = Array.new\n until heap_sort.empty?\n sorted << heap_sort.remove\n end\n\n return sorted\nend",
"def windowed_max_range(array,window)\n greatest_max_range = nil\n stack_queue = MinMaxStackQueue.new\n (array.length).times do\n if stack_queue.size == window\n stack_queue.dequeue\n end\n stack_queue.enqueue(array.shift)\n if stack_queue.size == window\n current_max_range = stack_queue.max - stack_queue.min\n greatest_max_range = current_max_range if greatest_max_range.nil? || current_max_range > greatest_max_range\n end\n end\n greatest_max_range\nend",
"def max\n max = @storage[0]\n @size.times do |i|\n if @storage[i] > max\n max = @storage[i]\n end\n\n end\n return max\n end",
"def get_max()\n return @maxs_stack.peek()\n end",
"def initialize(size=10, max_height=5)\n if !size.positive?\n raise ArgumentError, \"Board size must be greater than zero!\"\n else\n @size = size\n @max_height = max_height\n @min_word_length = 2\n @grid = Hash.new do |h, (row, col)|\n if row < 0 || col < 0 || num_rows <= row || num_columns <= col\n raise IllegalMove, \"#{row}, #{col} is out of bounds!\"\n else\n h[[row, col]] = [] # Initialize with empty array\n end\n end\n end\n end",
"def delete_max_locator\n return nil if empty?\n use_max\n loc = mode_call(:find_max_loc)\n @heapsize = mode_call(:delete_loc, loc)\n loc\n end",
"def windowed_max_range_mmsq(array, window_size)\n max_range = nil\n queue = My_Stack_Queue.new\n array.each { |num| queue.enqueue(num) }\n window = My_Min_Max_Stack_Queue.new\n (window_size - 1).times { window.enqueue(queue.dequeue) } #O(n) b/c the dequeue operation is now O(1)\n\n until queue.empty? #O(n)\n window.enqueue(queue.dequeue) #O(1)\n range = window.max - window.min #O(1)\n max_range ||= range #O(1)\n max_range = range if max_range < range #O(1)\n window.dequeue #O(1)\n end\n\n max_range\nend",
"def heap!(list)\n\t\tlen = list.length-1\n\t\t#heapify\n\t\t((len)/2).downto(0) { |b| heapify(list, b, list.length-1) }\n\n\t\t(len).downto(1) do |e|\n\t\t\tlist[0], list[e] = list[e], list[0]\n\t\t\theapify(list, 0, e-1)\n\t\tend\n\tend",
"def heap_sort(array)\n @array = array\n heap = build_heap(@array)\n sorted = []\n (0..(@array.size - 1)).each do |i|\n sorted << heap.delete_max\n end\n sorted\n end",
"def sort_heaped_list(list)\n last_pos = list.length - 1\n while last_pos > 0\n remove_max(list, last_pos)\n last_pos -= 1\n end\nend",
"def optimized_max_range(array, window_size)\n stack = StackQueue.new\n highest_difference = nil\n\n until stack.size == window_size\n stack.enqueue(array.shift)\n end\n\n until array.empty?\n if highest_difference.nil? || (stack.max - stack.min) > highest_difference\n highest_difference = stack.max - stack.min\n end\n\n stack.dequeue\n stack.enqueue(array.shift)\n end\n\n if (stack.max - stack.min) > highest_difference\n highest_difference = stack.max - stack.min\n end\n\n highest_difference\nend",
"def initialize(max_size)\n @head = nil\n @max_size = max_size\n @current_size = 0\n end",
"def max_windowed_range(array, window_size)\n byebug\n window = MinMaxStackQueue.new\n i = 0\n window_size.times do\n window.enqueue(array[i])\n i += 1\n end\n\n current_max_range = window.max - window.min\n\n (array.length - window_size).times do\n window.enqueue(array[i])\n window.dequeue\n range = window.max - window.min\n current_max_range = range if range > current_max_range\n i += 1\n end\n\n current_max_range\nend",
"def heap_sort (list)\r\n sl = []\r\n heap = build_heap(list)\r\n heap.size.times do\r\n sl << heap.shift\r\n heap = heapify(heap, 0)\r\n end\r\n sl.reverse\r\nend",
"def windowed_max_range(array, window_size)\n current_max_range = nil\n queue = MinMaxStackQueue.new\n\n array.each_with_index do |el, i|\n queue.enqueue(el)\n queue.dequeue if queue.size > window_size\n\n if queue.size == window_size\n range = queue.max - queue.min\n current_max_range = range if current_max_range.nil? || current_max_range < range\n end\n end\n\n current_max_range\nend",
"def height_of_heap(start_node_index, end_node_index)\n height = 0\n while end_node_index >= start_node_index \n height++\n end_node_index = parent_index(end_node_index)\n end\n height\n end",
"def size\n @heap.size\n end",
"def size\n @heap.size\n end",
"def initialize\n\t @items, @max = [], []\n\tend",
"def windowed_max_range(array, window_size)\n stack = StackQueue.new\n\n array[0...window_size].each do |el|\n stack.enqueue(el)\n end\n\n range = stack.max - stack.min\n\n array[window_size..-1].each do |el|\n # require 'byebug'; debugger\n stack.dequeue\n stack.enqueue(el)\n current_max_range = stack.max - stack.min\n range = current_max_range if current_max_range > range\n end\n\n range\nend",
"def median_maintain(array)\n max_heap = []\n min_heap = []\n if array[0] > array[1]\n max_heap = [array[1]]\n min_heap = [array[0]]\n else\n max_heap = [array[0]]\n min_heap = [array[1]]\n end\n m = [array[0], max_heap[0]]\n (2..array.count - 1).each do |i|\n if array[i] > max_heap[0]\n min_heap << array[i]\n balance_min(min_heap, min_heap.count - 1)\n if min_heap.count > max_heap.count + 1\n max_heap << min_heap[0]\n extract_min(min_heap)\n balance_max(max_heap, max_heap.count - 1)\n end\n else\n max_heap << array[i]\n balance_max(max_heap, max_heap.count - 1)\n if max_heap.count > min_heap.count + 1\n min_heap << max_heap[0]\n extract_max(max_heap)\n balance_min(min_heap, min_heap.count - 1)\n end\n end\n m << if max_heap.count == min_heap.count\n max_heap[0]\n elsif max_heap.count > min_heap.count\n max_heap[0]\n else\n min_heap[0]\n end\n end\n sum = 0\n (0..m.count - 1).each do |i|\n sum += m[i]\n end\n sum % 10_000\nend",
"def ruby_gc_malloc_limit_max\n 32 * MEGABYTE\n end",
"def heap_sort(arr)\n 2.upto(arr.length - 1).each do |heap_size|\n BinaryMinHeap.heapify_up(arr, heap_size - 1, heap_size)\n end\n\n arr.length.downto(2).each do |heap_size|\n arr[heap_size - 1], arr[0] = arr[0], arr[heap_size - 1]\n BinaryMinHeap.heapify_down(arr, 0, heap_size - 1)\n end\n\n arr.reverse\nend",
"def initialize(root, max_size = DEFAULT_MAX_SIZE, logger = self.class.default_logger)\n @root = root\n @max_size = max_size\n @gc_size = max_size * 0.75\n @logger = logger\n end",
"def heap(list)\n\t\tcopy = []\n\t\t(list).each do |v|\n\t\t\tcopy << v\n\t\tend\n\t\theap!(copy)\n\t\tcopy\n\tend",
"def buildFibbs(fibbs, max)\n while fibbs[fibbs.length-1] < max do\n fibbs.push(fibbs[fibbs.length-1] + fibbs[fibbs.length-2])\n end\n fibbs\nend",
"def max\n maxes = []\n\n maxes << @in.max unless @in.empty?\n maxes << @out.max unless @out.empty?\n\n maxes.max\n end",
"def heapsort(list)\n return list if list.length <= 1\n\n heap = MinHeap.new\n list.each do |e|\n heap.add(e)\n end\n \n result = heap.store.map! { |e| e = e.value }\n\n return result\nend",
"def ruby_gc_heap_free_slots\n 4096\n end",
"def max=(value)\r\n @max = value\r\n shift while @store.length > @max\r\n end",
"def heapify(array, heap_size, index)\n return if index >= heap_size\n\n l = index * 2 + 1\n r = index * 2 + 2\n\n largest = index\n\n largest = l if l < heap_size && array[l] > array[largest]\n largest = r if r < heap_size && array[r] > array[largest]\n\n if largest != index\n swap(array, index, largest)\n\n # propogate change on subtree\n heapify(array, heap_size, largest)\n end\n\n array\nend",
"def heapsort(list)\n heap = MinHeap.new()\n list.each do |num|\n heap.add(num)\n end\n res = []\n list.length.times do \n res << heap.remove()\n end\n return res\nend",
"def max_mem\n @max_mem ||= 1024 * 1024\n end",
"def extract_max # works according to VisualAlgo\n max = @values[0]\n tail = @values.pop()\n @values[0] = tail\n index = 0\n element = @values[index]\n while true do \n swapped = nil\n left = 2 * index + 1\n right = 2 * index + 2\n if left < @values.length \n if @values[left] > element\n swapped = left\n end\n end\n if right < @values.length\n if (!swapped && @values[right] > element) || (!!swapped && @values[right] > @values[left])\n swapped = right\n end\n end\n break if !swapped\n @values[index] = @values[swapped]\n @values[swapped] = element\n index = swapped\n end\n return max\n end",
"def max_windowed_range_fast(arr, window_size)\n in_stack = MinMaxStackQueue.new \n best_range = 0\n\n arr.each do |ele|\n in_stack.enqueue(ele)\n debugger \n in_stack.dequeue if in_stack.size > window_size\n\n if in_stack.size == window_size\n range = (in_stack.max - in_stack.min)\n best_range < range ? best_range = range : best_range\n end \n end \n p best_range\nend"
] |
[
"0.89116496",
"0.789719",
"0.75883394",
"0.7538729",
"0.7379855",
"0.701705",
"0.67564446",
"0.6732569",
"0.6526662",
"0.64928097",
"0.6401017",
"0.637071",
"0.63546556",
"0.63532704",
"0.6315817",
"0.6292672",
"0.60577893",
"0.60311806",
"0.5996245",
"0.5971777",
"0.5901051",
"0.589476",
"0.5864076",
"0.58562636",
"0.58282936",
"0.58240104",
"0.5817542",
"0.5816105",
"0.5807929",
"0.5799294",
"0.57897675",
"0.57894367",
"0.57514155",
"0.57312936",
"0.5670303",
"0.5667723",
"0.5643355",
"0.5627155",
"0.56204665",
"0.5585971",
"0.5580377",
"0.55502194",
"0.5539403",
"0.5538307",
"0.55286956",
"0.55283743",
"0.5519474",
"0.5515048",
"0.5496196",
"0.5466358",
"0.5454641",
"0.5441966",
"0.5435612",
"0.5429591",
"0.5390957",
"0.5369919",
"0.5358883",
"0.53452146",
"0.5339743",
"0.5331314",
"0.5278527",
"0.52775604",
"0.5271104",
"0.5264994",
"0.5262404",
"0.52608055",
"0.5249904",
"0.5240703",
"0.52402645",
"0.5235392",
"0.52261746",
"0.5209476",
"0.51976115",
"0.519082",
"0.51791203",
"0.51760775",
"0.51700276",
"0.5167575",
"0.5163983",
"0.51408386",
"0.5133556",
"0.5130696",
"0.5130696",
"0.5130237",
"0.5116745",
"0.5113918",
"0.5108452",
"0.51062006",
"0.51031154",
"0.51016504",
"0.50943816",
"0.5089592",
"0.5085598",
"0.5085118",
"0.5078068",
"0.5072232",
"0.5068133",
"0.5061899",
"0.5053076",
"0.5052831"
] |
0.74222594
|
4
|
Returns the number of elements.
|
def size
@elements.size
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def length\r\n elements.length\r\n end",
"def count\n elements.count\n end",
"def size\n @elements.length\n end",
"def size\n Integer.new.tap do |count|\n each { |element| count += 1 }\n end\n end",
"def size\n @elements.size\n end",
"def count_elements\nend",
"def size\n\t\t\t@elements.size\n\t\tend",
"def length\n @elements.length\n #@elements.size \n end",
"def element_count()\n return 1\n end",
"def size\n \t@array.count\n end",
"def size!\n @elements.values.map(&:size!).inject(0) {|total,size| total + size}\n end",
"def length\n each.count\n end",
"def getNodeElementCount\n return @nodeElements.size\n end",
"def count\n underlying_array.length\n end",
"def nitems\n count = 0\n i = 0\n lim = self.__size\n while i < lim\n count += 1 unless self.__at(i)._equal?(nil)\n i += 1\n end\n count\n end",
"def length\n array_list.length\n end",
"def element_size\n end",
"def quantityFields\n return @elements.length\n end",
"def number_of_elements_in_collection\n # collection here refers to the collection that is set with the initialize method\n # collection() is a private accessor method at the bottom of this class that accesses @collection\n collection.count\n end",
"def size\n @ordered_elements.size\n end",
"def size\n return @array.size\n end",
"def nnz; @elements.size end",
"def size\n if head.nil?\n return 0\n else\n count = 1 # remember, array with indexes 0,1,2,3 is size 4 !\n x = @head\n until x.next_node.nil? #problem alert\n count += 1\n x = x.next_node\n end\n\n return count\n end\n end",
"def test_array_number_of_elements\n num_of_elem = nil\n array = [1,2,3,4]\n num_of_elem = array.count\n assert_equal 4, num_of_elem\n end",
"def element_count(array)\n\nend",
"def size\n as_array ? as_array.length : 0\n end",
"def size\n as_array ? as_array.length : 0\n end",
"def count\n each.size\n end",
"def size\n @array.length\n end",
"def count_elements(array)\n\nend",
"def count\n to_a.size\n end",
"def count\n to_a.size\n end",
"def child_element_count\n num = 0\n self.each_child_node do |n|\n if n.node_type == ELEMENT_NODE then\n num += 1\n end\n end\n return num\n end",
"def size\n @count\n end",
"def size\n @count\n end",
"def length; count end",
"def size\n counter = 0\n @items.each do |item|\n if item.nil?\n counter += 1\n else\n counter += item.length - 1\n end\n end\n counter\n end",
"def size\n return 0 if @head.nil?\n\n n = 0\n self.each { n += 1}\n return n\n end",
"def length\n return @list.length\n end",
"def count\n values.inject(0){|m, v| m + v.length}\n end",
"def length\n count\n end",
"def size\n return @items.length\n end",
"def length\r\n @list.length\r\n end",
"def count\r\n items.size\r\n end",
"def length\n @items.count do |item|\n !item.nil?\n end\n end",
"def count()\n @list_of_positions.length\n end",
"def size\n @value.inject(0) {|acc, it| acc + it.size}\n end",
"def length\n @array_specs.spec_count\n end",
"def n\n x.size\n end",
"def size\n # return 0 if empty list\n if head.nil?\n return 0\n end\n current = @head\n elements = 1\n\n until current.next_node.nil?\n # loop thru list to end\n # increment\n elements += 1\n # advance to next node\n current = current.next_node\n end\n puts elements\n end",
"def size\n list.size\n end",
"def size\n @lists.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 size\n return @items.length\n end",
"def size\n @list.size\n end",
"def size\n @list.size\n end",
"def size\n counter = 0\n each { |node| counter += 1 }\n return counter\n end",
"def count\n all.size\n end",
"def length_of_array (array)\n array.size\nend",
"def length\n # calculates the length of the list\n end",
"def size\n @items.length\n end",
"def count\n to_a.size\n end",
"def size\n @items.count\n end",
"def size\n @items.count\n end",
"def item_count\n @items.length\n end",
"def count; @value.size; end",
"def size\n\t\treturn @items.size\n end",
"def size\n @n\n end",
"def size\n @n\n end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size() end",
"def size\n\n @items.size\n end",
"def length\n @count\n end",
"def size\n count = 0\n visit_nodes do\n count += 1\n end\n count\n end",
"def length\n @driver_instance.count_list_value(@key)\n end",
"def size()\n #This is a stub, used for indexing\n end",
"def count_items(elective_array)\n return elective_array.length\nend",
"def length()\n # If there are no items, return 0 for the length.\n if (!@tag.exists)\n return 0\n end\n\n # The number of items one less than the number of tags in the list.\n return @tag.length - 1\n end",
"def size()\n #This is a stub, used for indexing\n end",
"def size()\n #This is a stub, used for indexing\n end",
"def size\n @list.map { |bin| bin.size }.reduce(0, :+)\n end",
"def count_items\n @items.size\n end",
"def num_boxes\n num_elements(\".navbox\")\n end",
"def length\n array.first.size\n end",
"def my_count\n if block_given?\n num = 0\n self.my_each{|item| num += 1 if yield(item)}\n num\n else\n # if no block given return size of array\n self.length\n end\n end",
"def size\n return @items.size\n end",
"def length\n count = 0\n each { count += 1 }\n count\n end",
"def size\n return @items.size\n end",
"def size\n\t\tlengths.reduce(&:*)\n\tend",
"def size\n items.size\n end",
"def size\n items.size\n end"
] |
[
"0.853207",
"0.8495818",
"0.84003276",
"0.8316746",
"0.8215376",
"0.81923026",
"0.8152281",
"0.80540985",
"0.79713565",
"0.779896",
"0.77745265",
"0.77620244",
"0.771393",
"0.76703143",
"0.7658091",
"0.76379055",
"0.7618548",
"0.75843835",
"0.7580884",
"0.7577447",
"0.7573529",
"0.7561181",
"0.7552014",
"0.75493175",
"0.7547839",
"0.7519916",
"0.7519916",
"0.75014263",
"0.7485758",
"0.7446687",
"0.7442079",
"0.7442079",
"0.7419618",
"0.74115497",
"0.74115497",
"0.73753923",
"0.7363549",
"0.7348557",
"0.7318248",
"0.7317363",
"0.7314178",
"0.72975314",
"0.72921705",
"0.72730744",
"0.7270608",
"0.7267463",
"0.7263942",
"0.72582704",
"0.7256486",
"0.7246488",
"0.72322226",
"0.7213752",
"0.7210497",
"0.7210497",
"0.7210497",
"0.7210497",
"0.7210497",
"0.7210497",
"0.7210497",
"0.7205541",
"0.7205541",
"0.72005785",
"0.7188874",
"0.7188558",
"0.7171594",
"0.7167273",
"0.7165475",
"0.7164975",
"0.7164975",
"0.71590036",
"0.7156321",
"0.7147728",
"0.7144852",
"0.7144852",
"0.71446055",
"0.71446055",
"0.71446055",
"0.71446055",
"0.71446055",
"0.71446055",
"0.7144556",
"0.71422565",
"0.71346056",
"0.7126062",
"0.71234906",
"0.7119213",
"0.71190345",
"0.7111696",
"0.7111696",
"0.7111579",
"0.71098214",
"0.7109567",
"0.71063524",
"0.710579",
"0.7095227",
"0.7088828",
"0.7084729",
"0.7083807",
"0.7079399",
"0.7079399"
] |
0.82552713
|
4
|
First element on the heap. If not element, returns +nil+.
|
def first
@elements.empty? ? nil : @elements[0]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def peek\n return nil if empty?\n\n @heap[0]\n end",
"def peek\n return self.heap[0]\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 return nil if @elements.length == 0\n tmp = @elements.shift\n @elements.unshift @elements.pop\n heapify_down\n return tmp\n end",
"def peek_first\n raise 'No such element' if @size == 0\n @head.value\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 pop\n peek.tap do |result|\n last = @nodeset.pop\n unless size.zero? # Replace the root of the heap with the last element and heapify-down\n @nodeset[1] = last\n heapify_down 1\n end\n end\n end",
"def peek\n empty? ? nil : @head.value\n end",
"def peek\n raise 'No such element' if @elements.length == 0\n @elements[-1]\n end",
"def peek\n @head ? @head.value : nil\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 shift\n if @elements.empty?\n return nil\n end\n\n swap(0,@elements.size-1)\n ele = @elements.pop\n heapify(0)\n ele\n end",
"def first\n @current = self.head if self.head\n @current.value rescue nil\n end",
"def pop;\n\t\t@heap.empty? and\n\t\t\treturn;\n\t\t_remove 0;\n\tend",
"def peek()\n @head.nil? ? nil : @head.val\n end",
"def pop\n @heap.pop\n end",
"def next\n @heap.next\n end",
"def peek\n if empty?\n nil\n else\n @stack.first\n end\n end",
"def peek_first_item\n stack = []\n node, stack = *first_below(@root, stack)\n return nil unless node\n return node, stack\n end",
"def peek()\n if @items.empty?\n return nil\n end\n return @items[-1]\n end",
"def remove\n swap(0, self.heap.length-1, self.heap)\n value_to_remove = self.heap.pop\n self.sift_down(0, self.heap.length-1, heap)\n return value_to_remove\n end",
"def peek\n item = pop\n push(item)\n item\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 remove()\n return nil if @store.empty? \n swap(0, @store.length - 1)\n result = @store.pop.value\n \n heap_down(0) unless @store.empty?\n return result \n end",
"def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\n end",
"def remove()\n return nil if empty? \n swap(0, @store.length - 1) # swap last element with root, O(n) to calc length\n old_top = @store.pop() # remove former root with O(1) time\n\n heap_down(0) unless empty?# bubble down new top element so lowest element in 0 index\n\n return old_top.value # return old min's value\n end",
"def peek()\n return nil if @items.empty?\n return @items[-1]\n end",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def insert_into_min_heap(heap, element)\n heap << element\n current_index = heap.length\n\n while current_index > 1 && element < heap[(current_index / 2) - 1]\n larger_element = heap[(current_index / 2) - 1]\n\n heap[(current_index / 2) - 1] = element\n heap[current_index - 1] = larger_element\n\n current_index = (current_index / 2)\n end\n\n heap\nend",
"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()\n @q.first\n end",
"def first\n # return value if head node is set\n if !@head.nil?\n @head.value\n else\n # otherwise raise an exception\n raise \"List is empty\"\n end\n end",
"def peek()\n @queue.first\n end",
"def remove()\n return nil if !@store\n\n swap(0, @store.length - 1)\n nope = @store.pop\n\n heap_down(0)\n return nope.value\n end",
"def remove_at index\n return nil if empty?\n removed_value = @heap[index]\n last_item_index = size - 1\n swap_values_at(index, last_item_index)\n\n # Remove the actual value off the heap,\n # now that it's at the end/bottom of the heap\n @heap.pop\n remove_from_map(removed_value, last_item_index)\n\n # Return now, if this item was the last item already\n return removed_value if index == last_item_index\n\n # redefine our interested item, post-swap\n new_item_at_index = @heap[index]\n # Try to sink the item we moved, which now exists at `index`\n sink(index)\n # Otherwise try to swim it up, if it could not sink,\n # thus the \n swim(index) if @heap[index] == new_item_at_index\n\n return removed_value\n end",
"def peek\n raise QueueUnderflow if empty?\n @info[0]\n end",
"def remove\n swap(0, @heap.length - 1, @heap)\n value_to_remove = @heap.pop\n sift_down(0, @heap.length - 1, @heap)\n value_to_remove\n end",
"def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend",
"def push(el)\n if @largests.empty?\n @largests.push(el)\n elsif el >= @largests.peek # Should this be greater-than-or-equal?\n @largests.push(el)\n end\n super\n end",
"def peek\n\t\t@queue.first\n\tend",
"def pop\n if empty?\n nil\n else\n @q.remove\n @stack.shift\n end\n end",
"def get_front()\n if @queue.size > 0\n return @queue[0]\n end\n -1\n end",
"def top()\n return @pop_queue.first\n end",
"def remove()\n return if @store.empty?\n \n # swap last item in heap with smallest value\n swap(0, -1)\n\n # remove smallest value\n removedNode = @store.pop\n\n # maintain heap structure\n heap_down() if @store.length > 1\n \n return removedNode.value\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 heap_extract_max()\n\t\tif @heap.length < 0\n\t\t\treturn nil\n\t\tend\n\t\tmax = @heap[0]\n\t\t@heap[0] = @heap[@heap.length-1]\n\t\t@heap.pop()\n\t\tn_heapify(@max)\n\t\treturn max\n\tend",
"def peek\n\t return nil if self.curr == 0\n\t self.arr[self.curr - 1]\n end",
"def extract_min\n @nodes.shift.tap do\n # Move the last node to the root position and then heapify down\n @nodes.unshift @nodes.pop unless @nodes.size.zero?\n heapify_down\n end\n end",
"def first\n return @front.head unless @front.empty?\n @rear.last # memoize?\n end",
"def get_first\n current = @head\n return nil if current.nil?\n \n return @head.data\n end",
"def extract\n # 1. Extract root (guaranteed minimum value)\n root = @nodes.shift\n return root if empty? || size == 1\n\n # 2. Move last node to be new root\n @nodes.unshift(@nodes.pop)\n # Keep track of new root index so we can move it down\n new_r_i = 0\n \n # 3. Satisfy heap property (bubble-down):\n # Move the new root down the tree as long as it is\n # larger than its parent(s), making sure along the way\n # that we have not reached any terminating leaves\n while min_child(new_r_i) && \n @compare_fn[@nodes[min_child(new_r_i)][:value], @nodes[new_r_i][:value]]\n temp_i = min_child(new_r_i)\n swap(new_r_i, temp_i)\n new_r_i = temp_i\n break unless new_r_i\n end\n root\n end",
"def get_first\n return head ? head.data : nil\n end",
"def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end",
"def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end",
"def peek; @queue[-1] end",
"def get_first\r\n return @head ? @head.data : nil\r\n end",
"def head\n if @head.nil?\n nil\n else\n at_index(0)\n end\n end",
"def peek\r\n @arr[0]\r\n end",
"def peek\n self.head\n end",
"def peek\n raise IndexError.new if @data.size == 0\n return @data[0]\n end",
"def get_heap\n @heap\n end",
"def extract_maximum!\n raise \"Heap Underflow - The heap is empty\" if self.heapsize < 1\n\n max_value = self[0]\n self[0] = self[self.heapsize - 1]\n self.heapsize = self.heapsize - 1\n self.max_heapify!(0)\n\n return max_value\n end",
"def top()\n return @head ? @head.val : nil\n end",
"def get_first\n @head == nil ? nil : @head.data\n end",
"def peek\n first.nil? ? nil : first.data\n end",
"def get_first\n if @head == nil\n return nil\n else\n return @head.data\n end\n end",
"def get_first\n return nil if head.nil?\n return head.data\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 remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def get_first\n return @head ? @head.data : nil\n end",
"def remove()\n \n swap(0, @store.length - 1)\n removed = @store.pop()\n \n heap_down(0) unless @store.empty?\n \n return removed.value\n end",
"def first\n @head.lru_next\n end",
"def remove()\n return if @store.empty?\n last = @store.length - 1\n curr = 0\n swap(last, curr)\n removed = @store.pop\n heap_down(curr)\n return removed.value\n end",
"def remove() # removes the element at the first position (root) of the array\n return nil if @store.empty?\n last_index = @store.length - 1\n # First, swap the last leaf & the root node\n swap(0, last_index)\n\n # Delete the last leaf (last item in the array)\n result = @store.pop\n\n # Then heap-down the new root, to reestablish the heap property\n # start heap_down with the root (index 0)\n heap_down(0) \n return result.value\n end",
"def get_first\n @head.nil? ? nil : @head.data\n end",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def get_first\n return @head.nil? ? nil : @head.data\n end",
"def first_child\n children.min_by { |x| x.position}\n end",
"def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end",
"def peek\n raise \"Stack Underflow - The stack is empty\" if self.is_empty?\n @store[top]\n end",
"def get_first\n return nil if !@head\n return @head.data\n end",
"def higher_item\n return nil unless in_list?\n higher_items(1).first\n end",
"def heap_maximum()\n\t\t@heap[0]\n\tend",
"def get_first\n return nil if @head.nil?\n return @head.data\n end",
"def remove()\n removed = @store[0].value\n swap(0, @store.length - 1)\n @store.pop\n heap_down(0)\n return removed\n end",
"def top\n return nil if empty?\n @que.last\n end",
"def get_first\r\n if @head \r\n return @head.data\r\n else \r\n return nil\r\n end\r\n end",
"def pop\n if @data\n top = @data.value\n @data = @data.next_node\n return top\n else\n return 'nil'\n end\n end",
"def front\n return -1 if self.is_empty\n @q[@tail]\n end",
"def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end",
"def heapify(queue)\n (queue.length - 1).downto(1) do |i|\n if queue[i].value > queue[i-1].value\n queue[i], queue[i-1] = queue[i-1], queue[i]\n else\n break\n end\n end\n end",
"def pop\r\n if @data\r\n top_value = @data.value\r\n @data = @data.next_node\r\n else\r\n top_value = nil\r\n end\r\n return top_value\r\n end",
"def first\n\t\traise \"ContainerEmpty\" if @head.nil?\n\t\t@head\n\tend",
"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 front()\n self.is_empty ? -1 : @queue[@front]\n end",
"def extract_min\n extract_key = peek_min.key\n min_head = new_heap_from_children\n remove_min_from_heap\n\n # Union\n @head = union(self, BinomialHeap.new(min_head))\n h_next = head.sibling\n consolidate(head, h_next)\n # get new @min\n\n extract_key\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end",
"def get_first\n return nil if @head.nil?\n\n return @head.data\n end"
] |
[
"0.83486813",
"0.7708462",
"0.7455249",
"0.73558366",
"0.7290299",
"0.7234285",
"0.7048272",
"0.6877498",
"0.67974323",
"0.67726624",
"0.67687786",
"0.67599976",
"0.6741429",
"0.6740202",
"0.6739138",
"0.66896886",
"0.6675783",
"0.6666046",
"0.6585268",
"0.656704",
"0.65602106",
"0.6551637",
"0.6532324",
"0.6532324",
"0.6498025",
"0.6492313",
"0.6423215",
"0.6406796",
"0.63917184",
"0.63825494",
"0.6364679",
"0.63602436",
"0.6358859",
"0.6356464",
"0.63550526",
"0.6275711",
"0.6269996",
"0.62646705",
"0.6248394",
"0.62322736",
"0.62309545",
"0.6211617",
"0.6195614",
"0.6192338",
"0.61897534",
"0.61838585",
"0.61815804",
"0.6174527",
"0.61666703",
"0.6166307",
"0.61599576",
"0.61401445",
"0.61369413",
"0.61278254",
"0.6126708",
"0.6104309",
"0.6095514",
"0.6094082",
"0.6094026",
"0.6091233",
"0.6090901",
"0.60872656",
"0.60849124",
"0.60774404",
"0.60771114",
"0.607517",
"0.6073505",
"0.60726666",
"0.60708654",
"0.6066539",
"0.60562277",
"0.60398126",
"0.60363746",
"0.6035062",
"0.60307723",
"0.6030528",
"0.6013668",
"0.60078233",
"0.60078233",
"0.60061246",
"0.60009485",
"0.5989037",
"0.59841037",
"0.5983024",
"0.59686184",
"0.5951455",
"0.59419394",
"0.5937564",
"0.59331745",
"0.59313977",
"0.5930916",
"0.5928362",
"0.5922933",
"0.5921878",
"0.5921616",
"0.59164166",
"0.59156156",
"0.5911469",
"0.5908915",
"0.5908915"
] |
0.64795375
|
26
|
Returns the first element and removes it from the heap. Returns +nil+ if the heap is empty. It will rearrange the other elements to keep the heap properties.
|
def shift
if @elements.empty?
return nil
end
swap(0,@elements.size-1)
ele = @elements.pop
heapify(0)
ele
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pop\n return nil if @elements.length == 0\n tmp = @elements.shift\n @elements.unshift @elements.pop\n heapify_down\n return tmp\n end",
"def remove\n swap(0, self.heap.length-1, self.heap)\n value_to_remove = self.heap.pop\n self.sift_down(0, self.heap.length-1, heap)\n return value_to_remove\n end",
"def remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def remove\n swap(0, @heap.length - 1, @heap)\n value_to_remove = @heap.pop\n sift_down(0, @heap.length - 1, @heap)\n value_to_remove\n end",
"def pop;\n\t\t@heap.empty? and\n\t\t\treturn;\n\t\t_remove 0;\n\tend",
"def pop\n @heap.pop\n end",
"def pop\n peek.tap do |result|\n last = @nodeset.pop\n unless size.zero? # Replace the root of the heap with the last element and heapify-down\n @nodeset[1] = last\n heapify_down 1\n end\n end\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 remove()\n return nil if @store.empty? \n swap(0, @store.length - 1)\n result = @store.pop.value\n \n heap_down(0) unless @store.empty?\n return result \n end",
"def remove()\n return if @store.empty?\n \n # swap last item in heap with smallest value\n swap(0, -1)\n\n # remove smallest value\n removedNode = @store.pop\n\n # maintain heap structure\n heap_down() if @store.length > 1\n \n return removedNode.value\n end",
"def remove_at index\n return nil if empty?\n removed_value = @heap[index]\n last_item_index = size - 1\n swap_values_at(index, last_item_index)\n\n # Remove the actual value off the heap,\n # now that it's at the end/bottom of the heap\n @heap.pop\n remove_from_map(removed_value, last_item_index)\n\n # Return now, if this item was the last item already\n return removed_value if index == last_item_index\n\n # redefine our interested item, post-swap\n new_item_at_index = @heap[index]\n # Try to sink the item we moved, which now exists at `index`\n sink(index)\n # Otherwise try to swim it up, if it could not sink,\n # thus the \n swim(index) if @heap[index] == new_item_at_index\n\n return removed_value\n end",
"def remove()\n removed = @store[0].value\n swap(0, @store.length - 1)\n @store.pop\n heap_down(0)\n return removed\n end",
"def remove()\n return if @store.empty?\n last = @store.length - 1\n curr = 0\n swap(last, curr)\n removed = @store.pop\n heap_down(curr)\n return removed.value\n end",
"def remove()\n return nil if !@store\n\n swap(0, @store.length - 1)\n nope = @store.pop\n\n heap_down(0)\n return nope.value\n end",
"def remove()\n \n swap(0, @store.length - 1)\n removed = @store.pop()\n \n heap_down(0) unless @store.empty?\n \n return removed.value\n end",
"def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\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 remove()\n return nil if empty? \n swap(0, @store.length - 1) # swap last element with root, O(n) to calc length\n old_top = @store.pop() # remove former root with O(1) time\n\n heap_down(0) unless empty?# bubble down new top element so lowest element in 0 index\n\n return old_top.value # return old min's value\n end",
"def remove\n\n if @store.empty?\n raise ArgumentError, 'There are no nodes to remove'\n end\n\n # keep track of the element we're removing so we can return it\n removed = @store[0].value\n\n # swap root and last node in heap ... \n @store[0], @store[@store.length - 1] = @store[@store.length - 1], @store[0]\n\n # ... then delete last node (this is more efficient than removing first node)\n @store.delete_at(@store.length - 1)\n\n # we're done if there's only one node left after deletion\n return removed if @store.length == 1\n\n # if there's more than one node left, call the recursive heap down method to \n # re-order the remaining nodes, starting at the top\n heap_down(0)\n return removed\n\n end",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def remove() # removes the element at the first position (root) of the array\n return nil if @store.empty?\n last_index = @store.length - 1\n # First, swap the last leaf & the root node\n swap(0, last_index)\n\n # Delete the last leaf (last item in the array)\n result = @store.pop\n\n # Then heap-down the new root, to reestablish the heap property\n # start heap_down with the root (index 0)\n heap_down(0) \n return result.value\n end",
"def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def peek\n return nil if empty?\n\n @heap[0]\n end",
"def remove()\n return if @store.empty?\n\n swap(0, @store.length - 1)\n banished = @store.pop\n heap_down(0)\n\n return banished.value\n end",
"def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end",
"def remove()\n return nil if self.empty?\n\n # swap root node and last leaf node (swap head and rear of internal array) and pop it\n last_index = @store.length - 1\n swap(0, last_index)\n removed = @store.pop\n\n # ensure heap property via calling heap_down\n heap_down(0)\n return removed.value\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 pop\n delete_at(0)\n end",
"def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end",
"def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end",
"def remove()\n root = @store[0]\n new_root = @store[@store.length - 1]\n\n @store[@store.length - 1] = root\n @store[0] = new_root\n\n removed = @store.pop\n\n heap_down(0)\n return removed.value\n end",
"def pop\n if empty?\n nil\n else\n @q.remove\n @stack.shift\n end\n end",
"def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end",
"def pop\n return nil if size.zero?\n\n temp = first\n self.last = nil if first == last\n self.first = first.next\n self.size -= 1\n temp.val\n end",
"def delete(elem)\n deleted = @elements.delete(elem)\n build_heap unless deleted.nil?\n deleted\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n else\n # send to garbage collector\n @head.prev_node = nil\n end\n\n return data\n end",
"def remove_first\n raise 'Cannot remove element from an empty list.' if empty?\n\n # Extract the data off of the head node\n # Move the head to the next node\n data = @head.data\n @head = @head.next_node\n @size -= 1\n\n # removes the same element from @tail, if it was final element/node\n if empty?\n @tail = nil\n end\n\n return data\n end",
"def pop\n @insert_point -= 1\n if (@insert_point < 0)\n return nil\n end\n check = @items[0]\n\n rc = pop_sync(check)\n new_head = @items[@insert_point]\n new_head.index = 0\n @items[0] = new_head\n @items[@insert_point] = nil\n\n # Rearrange the neighbor nodes and recalculate their attribs\n check.next_link.prev_link = check.prev_link\n check.prev_link.next_link = check.next_link\n check.next_link.recalculate\n check.prev_link.recalculate\n\n # Rearrange the heap\n heapify(0)\n heapify(check.next_link.index)\n heapify(check.prev_link.index)\n\n return rc\n end",
"def pop\n return unless @head\n popped = @head\n \n if @head.to\n new_head = @head.to\n new_head.from = nil\n @head = new_head\n size += 1\n else\n empty!\n end\n\n popped.obj\n end",
"def peek\n return self.heap[0]\n end",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def pop\n # if Stack is empty, cannot remove anything\n if empty?\n nil\n else\n # popped set equal to last element in @store array\n popped = @store[@top]\n # sets last element in @store array to nil\n @store[@top] = nil\n # sets @top equal to @top - 1 (so -2 the first time through, then -3, etc.) - there is still an empty slot in @store at index -1, but no actual element there\n @top = @top.pred #@top--\n # returns the element that was removed from @store/popped from Stack\n popped\n end\n end",
"def pop\n return nil if head.nil?\n\n curr = head\n if curr.next.nil?\n @head = nil\n return curr\n end\n curr = curr.next until curr.next.next.nil?\n last = curr.next\n curr.next = nil\n last.value\n end",
"def pop\n return nil unless @head && @tail\n\n old_head = @tail.head\n old_data = @tail.data\n @tail = @tail.head\n @tail.tail = nil if @tail\n\n @size -= 1\n\n old_data\n end",
"def pop\n return nil unless @tail\n\n popped = @tail\n @tail = @tail.head # remove tail\n @size -= 1\n\n popped.data\n end",
"def pop\n return nil if empty?\n\n node = top\n self.top = node.previous\n\n return node\n end",
"def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\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 delete(value)\n # Find the element to delete\n index = index(value)\n not_final = index < @heap.length - 1\n # Unless it's the final leaf, replace the value to be deleted with the final leaf\n @heap[index] = @heap[-1] if not_final\n # Delete the final leaf (either what we want to delete, or a duplicate now)\n @heap.pop\n # If necessary, bubble down\n bubble_down(index) if not_final\n end",
"def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end",
"def pop\n # assume head of @store is top of stack\n return @store.remove_first()\n end",
"def pop\n\t\t\t\tif @length == 0\n\t\t\t\t\traise RuntimeError.new(\"Cannot pop from empty list.\")\n\t\t\t\telse\n\t\t\t\t\tif @tail.prev == nil\n\t\t\t\t\t\t# there is only one element\n\t\t\t\t\t\t@head = nil\n\t\t\t\t\t\t@tail = nil\n\t\t\t\t\telse\n\t\t\t\t\t\t@tail.prev.next = nil\n\t\t\t\t\t\t@tail = @tail.prev\n\t\t\t\t\tend\n\t\t\t\t\t@length -= 1\n\t\t\t\tend\n\t\t\tend",
"def pop\n node = @head\n if @size > 1\n node = node.link until node.link.link.nil?\n node.link = nil\n else \n @head = nil\n end\n @size -= 1\n end",
"def pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end",
"def pop\n\t\treturn nil if @q1.empty?\n\t\t@q1.pop # Dequeue element from queue and return the same \n\tend",
"def pop\n raise IndexError.new if @data.size == 0\n ret = @data[0]\n @data[0] = @data[@data.size - 1]\n @data = @data.take(@data.size - 1)\n percolate_down\n return ret\n end",
"def pop\n return nil unless @tail\n value = @tail[:data].pop\n @tail = @tail[:forward] while @tail and @tail[:data].size == 0\n @set.delete(value)\n value\n end",
"def pop\n if @head == nil\n return nil\n elsif @tail == @head\n @tail = nil\n @head = nil\n else\n aux = @tail\n @tail = aux.prev\n @tail.next = nil\n return aux\n end\n\n end",
"def pop_first\n @driver_instance.pop_list_first(@key)\n end",
"def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end",
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n if @items.empty?\n return nil\n end\n return @items.pop()\n end",
"def pop()\n \n return nil if @head.nil?\n \n result = @head\n \n @head.next_node.nil? ? @head = nil : @head = @head.next_node \n \n result.val\n end",
"def pop\n last = size\n at(last - 2).next_node = nil\n end",
"def pop\n raise(UnderflowError, \"There is no element to remove from the stack\") if empty?\n store.pop\n end",
"def pop\n if @length == 0\n return nil\n elsif @length == 1\n node = @head\n @head = nil\n @tail = nil\n @length -= 1\n return node.value\n else\n node = @tail\n @tail = node.previous\n @length -= 1\n return node.value\n end\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 pop\n if size == 1\n @head.next_node = nil\n else\n current = @head.next_node\n previous = @head\n\n while current.next_node != nil\n current = current.next_node \n previous = previous.next_node\n end\n\n previous.next_node = nil\n end\n end",
"def pop\n return nil if @head.nil? || self.size == 0\n current_node = @head\n prev_node = nil\n (self.size - 1).times do\n prev_node = current_node\n current_node = current_node.next\n end\n current_node = nil\n @tail = prev_node\n end",
"def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend",
"def pop()\n # if the stack is empty, return nil\n # (it would also be reasonable to throw an exception)\n if @items.empty?\n return nil\n end\n return @items.pop()\n end",
"def pop\n raise \"Stack Underflow - The stack is empty\" if self.is_empty?\n top_element = @store.pop\n @top -= 1\n top_element\n end",
"def pop()\n @min_stack.pop if @min_stack[-1] == @stack[-1]\n @stack.pop; nil \n end",
"def pop\n\t\tlocation = @head.next_node\n\t\twhile location.next_node.next_node != nil\n\t\t\tlocation = location.next_node\n\t\tend\n\t\tlast = location.next_node\n\t\tlocation.next_node = nil\n\t\treturn last\n\t\tlocation = @head\n\tend",
"def extract\n # 1. Extract root (guaranteed minimum value)\n root = @nodes.shift\n return root if empty? || size == 1\n\n # 2. Move last node to be new root\n @nodes.unshift(@nodes.pop)\n # Keep track of new root index so we can move it down\n new_r_i = 0\n \n # 3. Satisfy heap property (bubble-down):\n # Move the new root down the tree as long as it is\n # larger than its parent(s), making sure along the way\n # that we have not reached any terminating leaves\n while min_child(new_r_i) && \n @compare_fn[@nodes[min_child(new_r_i)][:value], @nodes[new_r_i][:value]]\n temp_i = min_child(new_r_i)\n swap(new_r_i, temp_i)\n new_r_i = temp_i\n break unless new_r_i\n end\n root\n end",
"def pop\n first.next.prev = @head\n @head.next = first.next\n end",
"def pop()\n self.min_stack.pop\n return self.stack.pop\n end",
"def pop\n\t\tif @length==1\n\t\t\t@last = nil\n\t\t\t@first = nil\n\t\telse \n\t\t\t@last = @last.back\n\t\t\t@last.front = nil\n\t\t\t@first = @last if @length==2\n\t\tend\n\t\t@length-=1\n\tend",
"def remove_front\n value = self.head # save the first element\n self.head = value.next # the second element becomes the new first element\n value.next = nil # no longer in the list, so no next\n return value\n end",
"def pop\n @data.delete_at @data.length - 1 if @data.length > 0\n end",
"def pop\n old = @tail\n if @tail == nil\n return nil\n else\n prev = @tail\n @tail = @tail.prev_value\n @length -= 1\n return prev.value\n end\n end",
"def heapsort(list)\n new_heap = MinHeap.new\n return list if list.nil? || list.length == 1\n\n until list.empty?\n new_heap.add(list.pop)\n end\n\n index = 0\n until new_heap.empty?\n list[index] = new_heap.remove()\n index += 1\n end\n\n \n return list\n \n\nend",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def pop\n value = @head.value\n @head = @head.next_node\n if isEmpty?\n @tail = nil\n end\n value\n end",
"def del_min\n min_elt = @head.value\n @size -= 1\n if not @head.left\n @head = nil\n return min_elt\n end\n merge_pairs(@head.left)\n return min_elt\n end",
"def pop\r\n @arr.shift\r\n end",
"def pop_front\n return nil if @size.zero?\n\n temp = @head.data\n @head = if @size == 1\n @tail = nil\n else\n @head.next\n end\n @size -= 1\n temp\n end",
"def pop\n #if the stack is already empty do nothing\n if empty?\n nil\n else\n #set popped equal to the element at index @top, which isthe top of the stack\n popped = @store[@top]\n #set the value at the top of the stack to nil\n @store[@top] = nil\n # subtract 1 from the value of @top\n @top = @top.pred #@top--\n #returns the value that was popped\n popped\n end\n end",
"def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end",
"def pop\n front, rear = @front, @rear\n\n if rear.empty?\n return self.class.empty if front.empty?\n front, rear = EmptyList, front.reverse\n end\n\n self.class.alloc(front, rear.tail)\n end",
"def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end",
"def pop\n if @tail != nil\n ret = @tail\n @tail = @tail.previous\n if @tail != nil\n @tail.next_node = nil\n end\n @length -= 1\n if @head == ret\n @head = nil\n end\n return ret.value\n elsif @head\n ret = @head\n @head = nil\n @length -= 1\n return ret.value\n else\n return nil\n end\n end",
"def pop\n node = last\n last = node.prv\n last.nxt = nil\n node.prv = nil\n node\n end",
"def peek\n item = pop\n push(item)\n item\n end",
"def pop\n if @size == 0\n return @tail\n elsif @size == 1\n @head = nil\n @tail = nil\n @size = 0\n else\n search_index = @head\n while search_index.next_node != @tail\n search_index = search_index.next_node\n end\n @tail = search_index\n @tail.next_node = nil\n @size -= 1\n end\n @tail\n end",
"def pop()\n @q.shift\n end",
"def pop\n if data\n element = data\n @data = data.next_node\n return element.value\n else\n return nil\n end\n end",
"def pop\n last_node = self.tail\n self.at(self.size - 2).next_node = nil\n return last_node\n end"
] |
[
"0.83089435",
"0.78305835",
"0.7769467",
"0.770924",
"0.7654978",
"0.7638512",
"0.7621822",
"0.7616807",
"0.74841624",
"0.73663616",
"0.7361335",
"0.7354278",
"0.7274189",
"0.7259886",
"0.72552484",
"0.72482526",
"0.7234324",
"0.7233444",
"0.7225526",
"0.7205226",
"0.71977735",
"0.7195111",
"0.71655357",
"0.7152534",
"0.71304667",
"0.7027633",
"0.7013648",
"0.69733286",
"0.6932392",
"0.69309825",
"0.6929627",
"0.6872564",
"0.68565166",
"0.68195367",
"0.67529",
"0.67357254",
"0.6717626",
"0.6713655",
"0.6686574",
"0.66569203",
"0.665295",
"0.66130805",
"0.6527611",
"0.6527611",
"0.65067387",
"0.64815414",
"0.64649343",
"0.6431351",
"0.64061975",
"0.64013785",
"0.6392538",
"0.6368954",
"0.63617724",
"0.63617706",
"0.6361127",
"0.63556063",
"0.63492936",
"0.6342316",
"0.633213",
"0.6329304",
"0.63148546",
"0.6286716",
"0.62842023",
"0.6276839",
"0.62659603",
"0.6264844",
"0.6264165",
"0.62102956",
"0.62089646",
"0.62050414",
"0.6197952",
"0.6191886",
"0.61829954",
"0.6175885",
"0.61704624",
"0.6163481",
"0.61602694",
"0.6160216",
"0.6159701",
"0.6156886",
"0.61527306",
"0.6150945",
"0.6150097",
"0.61486906",
"0.6141246",
"0.61383957",
"0.613689",
"0.6126118",
"0.61213017",
"0.6119121",
"0.611678",
"0.6115324",
"0.6110992",
"0.6110992",
"0.61039776",
"0.60929877",
"0.60903466",
"0.6090229",
"0.608981",
"0.608211"
] |
0.7445012
|
9
|
Adds a new +element+ to this max heap, and maintains the heap properties.
|
def add(elem)
@elements << elem
i = @elements.size-1
pa = parent(i)
while i>0 and @comparator.call(@elements[i],@elements[pa]) > 0
swap(i,pa)
i = pa
pa = parent(pa)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add(el)\n @heap.add(el)\n self\n end",
"def add(element)\n\t\t@size += 1\n\t\t@data.push(element)\n\t\telement\n\tend",
"def add(el)\n\t\tif(@elements.length < @size)\n\t\t\t@elements.push(el)\n\t\t\tbubble_up()\n\t\telsif el[@orderBy] < max\n\t\t\t# remove the max\n\t\t\tbubble_down()\n\t\t\t# add the new element\n\t\t\t@elements.push(el)\n\t\t\tbubble_up()\n\t\tend\n\tend",
"def add(element)\n @entries << element\n element.parent = self\n end",
"def push(element)\n @store.push(element)\n @top += 1\n end",
"def push(element)\n @data[@data.length] = element\n end",
"def add value\n raise 'Cannot add nil values to the heap.' if value.nil?\n # push onto the end of the @heap array\n @heap.push(value)\n new_item_index = @heap.size - 1\n # add it to our map\n map_add(value, new_item_index)\n # swim it upward (\"bubble up\") to where it belongs\n swim(new_item_index)\n end",
"def push(el)\n if @largests.empty?\n @largests.push(el)\n elsif el >= @largests.peek # Should this be greater-than-or-equal?\n @largests.push(el)\n end\n super\n end",
"def push(new_element)\n @collection.push(new_element)\n end",
"def add(element)\n @push_stack.push(element)\n end",
"def <<(element)\n @elements << element\n self\n end",
"def append(element)\n updated(@children + [element])\n end",
"def push(element)\r\n # IMPLEMENTME!\r\n end",
"def add(key, value = key)\n # always add element to back to bubble up\n @store << HeapNode.new(key, value) \n\n heap_up((@store.length - 1))\n end",
"def push(element); end",
"def push(element)\n @store.push(element)\n self\n end",
"def push(element)\n @top = LinkedListNode.new(element.value, @top)\n end",
"def push(element)\n @data = LinkedListNode.new(element, data)\n end",
"def push(element)\n @data = LinkedListNode.new(element, @data)\n end",
"def add(val)\n @heap.push_and_get(val)\n end",
"def add element\n add_last(element)\n end",
"def add element\n add_last(element)\n end",
"def add(key, value = key)\n # New node is added to the end (last element of the array)\n @store << HeapNode.new(key, value)\n last_index = @store.length - 1\n heap_up(last_index) #Using heap_up helper method \n end",
"def insert_into_min_heap(heap, element)\n heap << element\n current_index = heap.length\n\n while current_index > 1 && element < heap[(current_index / 2) - 1]\n larger_element = heap[(current_index / 2) - 1]\n\n heap[(current_index / 2) - 1] = element\n heap[current_index - 1] = larger_element\n\n current_index = (current_index / 2)\n end\n\n heap\nend",
"def push(element)\n # add element to the head of @store\n @store.add_first(element)\n end",
"def push(element)\n @data.push(element)\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 add(element)\n @element_list << element\n end",
"def <<(element)\n if element.nil?\n pair = [0,NilClass]\n else\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n end\n index = @size\n @map[index] = @added.size\n @added << pair\n #@commands << [:append, pair]\n @size += 1\n end",
"def add(key, value = key)\n @store << HeapNode.new(key, value)\n\n heap_up(@store.length - 1)\n end",
"def add(key, value = key)\n @store << HeapNode.new(key, value)\n\n heap_up(@store.length - 1)\n end",
"def build_heap\n unless @elements.empty?\n i = (@elements.size-1)/2\n while i>=0\n heapify(i)\n i -= 1\n end\n end\n end",
"def add(key, value = key)\n # create a new node and add to the rear of the array (last leaf node)\n @store << HeapNode.new(key, value)\n\n # ensure heap property via calling heap_up\n last_index = @store.length - 1\n heap_up(last_index)\n end",
"def push(element)\n @store << element #putting the element into the array, thereby putting it into the stack\n end",
"def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length - 1) unless self.empty?\n end",
"def add(key, value = key)\n # insert new node to the bottom of the heap \n # by placing it at the end of the array\n @store.push(HeapNode.new(key, value))\n\n heap_up(@store.length - 1) if @store.length > 1 \n end",
"def insert(value)\n @heap << value\n perc_up(@heap.length - 1)\n end",
"def push(element)\n \t@data = LinkedListNode.new(element, @data)\n \tend",
"def push(node)\n new_index = (@nodeset << node).length - 1\n heapify_up new_index\n self\n end",
"def add(element)\n if cache.include?(element)\n cache.delete(element)\n elsif cache.size >= max_cache_size\n cache.shift\n end\n\n cache << element\n nil\n end",
"def push(elt)\n @elements << elt\n end",
"def insert(element)\n insertindex=@store.length\n\n @store[@store.length]=element\n return if insertindex==1\n\n #For even inserts parent index is insertedindex/2-1 otherwise its juts insertedindex/2\n\n parentindex=insertindex/2\n\n #Incase it does not fit in(violating Heap Property)\n while insertindex!=1 && @store[parentindex] > @store[insertindex]\n swap(parentindex,insertindex)\n insertindex=parentindex\n parentindex=insertindex/2\n end\n\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 add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n\n heap_up(@store.length - 1)\n end",
"def push(element)\n # IMPLEMENT ME!\n end",
"def push(val)\n @store << val\n idx = count - 1\n @store = BinaryMinHeap.heapify_up(@store, idx, &prc)\n end",
"def push(element)\n\t if element.is_a?(Numeric)\n\t\t@elements.push Spacer.new(element)\n\t elsif element.is_a?(Spacer)\n\t\t@elements.push element\n\t else\n\t\t@elements.push Spacer.new(spacing) if spacing && !(elements.empty? || elements.last.is_a?(Spacer))\n\t\t@elements.push element\n\t end\n\n\t self\n\tend",
"def push(element)\r\n if @data.nil?\r\n element.next_node = LinkedListNode.new(nil)\r\n else\r\n element.next_node = @data\r\n end\r\n @data = element\r\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 add(key, value = key)\n @store.append(HeapNode.new(key, value))\n curr = @store.length - 1\n\n curr = heap_up(curr)\n end",
"def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n heap_up(@store.size-1)\n end",
"def add(key, value = key)\n new_node = HeapNode.new(key, value)\n @store << new_node\n heap_up(@store.length-1)\n end",
"def push(ele)\n stack.stack.push({\n max: empty? ? ele : [max, ele].max,\n min: empty? ? ele : [min, ele].min,\n ele: ele\n })\n end",
"def add(key, value = key)\n # add the new node to the end of the array\n @store << HeapNode.new(key, value)\n # call recursive heap up method with the index of the node we just added \n return heap_up(@store.length - 1)\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(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 enqueue(element)\n @items.push(element)\n nil\n end",
"def add(key, value = key)\n node = HeapNode.new(key, value)\n @store << node\n heap_up(@store.length - 1)\n end",
"def add(element)\n temp_list = array_list\n @array_list = FixedArray.new(length + 1)\n (length - 1).times do |index|\n @array_list.set(index, temp_list.get(index))\n end\n @array_list.set(length - 1, element)\n end",
"def enqueue(element)\n raise 'Queue is full' if self.full?\n\n @queue[@tail] = element\n\n # Check to see if the queue was first initialized\n if @head.nil?\n @head = 0\n end\n\n # Check to see if tail is the first element\n if @tail == @length - 1\n @tail = 0\n else\n @tail += 1\n end\n end",
"def insert(value)\n @heap.append(value)\n self.sift_up(@heap.length - 1, @heap)\n end",
"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 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 add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def push(element)\n # get the current length of array\n # because we will be using it several times\n current_length = @items.length\n\n # check if stack is empty\n if @count == 0\n # if so create array with size 1\n @items = Array.new(1)\n elsif @count == current_length\n # if stack is not empty then double size of array\n new_array = Array.new(current_length * 2)\n\n # copy old array onto new array\n @items.each_with_index do |item, i|\n new_array[i] = item\n end\n\n # set items to new_array\n @items = new_array\n end\n\n # set last element to element added\n @items[@count] = element\n\n # add 1 to the count\n @count += 1\n end",
"def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def add(element)\n synchronize do\n @queue.push element\n @cond.signal\n end\n end",
"def << elem\n unless @element_type.nil? or elem.is_a?(@element_type)\n raise TypeError.new(\"Cannot add element of type #{elem.class}\")\n end\n self[@hash.call(elem)] = elem\n end",
"def <<(elem)\r\n self.add elem\r\n end",
"def push(value)\n @count += 1\n new_element = RubyDS::StackQueue::Element.new(value)\n if @head.nil?\n @head = new_element\n else\n new_element.next = @head\n @head = new_element\n end\n end",
"def add(key, value = key)\n newNode = HeapNode.new(key, value)\n @store << newNode\n \n # compare up from this newNode\n heap_up(@store.length-1)\n end",
"def enqueue(element)\n #if the array is already at the max length @size, or if the elemennt we are trying to add is nil, do nothing\n if full? or element.nil?\n nil\n else\n #subtracts 1 from @tail\n @tail = @tail.pred\n #sets the value of the element at the tail of the array to the value of element.\n @store[@tail] = element\n #returns it self\n self\n end\n end",
"def insert(value)\n self.heap.append(value)\n self.sift_up(self.heap.length-1, self.heap)\n end",
"def add(element)\n # set element id\n element.id = @next_id\n # push element into elements\n @elements << element\n # save changes\n save_csv\n # increment next_id\n @next_id += 1\n end",
"def add(key, value = key)\n new_node = HeapNode.new(key, value)\n new_node_index = @store.length\n @store.push(new_node)\n heap_up(@store.length - 1)\n \n return new_node\n end",
"def enqueue(element)\n @queue.insert(@queue.length, element)\n @head = @queue.first\n @tail = @queue.last\n end",
"def enqueue(el)\n @maxqueue.push(el) if @maxqueue.length.zero?\n\n @store.push(el)\n while @maxqueue[0] < el\n @maxqueue.pop\n break if @maxqueue.length.zero?\n end\n @maxqueue.push(el)\n end",
"def max_heap_insert(key)\n\t\t@heap.push(-1)\n\t\theap_incease_key(@heap.length-1, key)\n\tend",
"def add(elem)\n TstLog(\"Sequence add: #{elem}\")\n @elements.push elem\n @length += elem.length\n self\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 insert_last(element)\n if @first_node == nil\n insert_first(element)\n else\n old_last_node = find_last_node\n old_last_node.insert_after(element)\n @size += 1\n end\n end",
"def add(ele)\n # Just need to add the element to the cache if the cache is not full\n if count < max_storage\n underlying_array << ele\n return ele\n end\n\n # 1. Check if the element already exists inside of the cache\n # 2. Remove the first element if it exists, otherwise delete it from the cache\n # 3. Append the element to the back of the cache\n search_idx = underlying_array.index(ele)\n search_idx.nil? ? underlying_array.shift : underlying_array.delete_at(search_idx)\n underlying_array.push(ele)\n end",
"def push element\n lpush(@key, encode(element))\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(object, priority)\n @heap.push(priority, object)\n end",
"def insert(key, value = key)\n raise ArgumentError, 'Heap keys must not be nil' unless key\n n = Hash[key: key, value: value]\n # 1. Append to end\n @nodes << n\n # We need to keep track of inserted node's index\n # so that when we bubble up we adjust it and not keep\n # looking for it\n ins_i = size - 1\n \n # 2. Satisfy the heap property (bubble-up):\n # Move the newly inserted node up the tree as long as\n # it is smaller than its parent\n unless size == 1\n while @compare_fn[@nodes[ins_i][:value], @nodes[parent(ins_i)][:value]]\n swap(parent(ins_i), ins_i)\n ins_i = parent(ins_i)\n break if ins_i == 0\n end\n end\n # Return the final index of the inserted element after re-ordering\n ins_i\n end",
"def push(el)\n @ivar << el \n end",
"def insert(elem)\n @vector.push(elem)\n end",
"def push(el)\n @head = LinkedListNode.new(el.value, @head)\n end",
"def insert(elem)\n @vector.push(elem)\n \n end",
"def push(v)\n @que << v\n reheap(@que.size-1)\n self\n end",
"def delete(elem)\n deleted = @elements.delete(elem)\n build_heap unless deleted.nil?\n deleted\n end",
"def push(val)\n resize! if self.length == self.capacity\n self.length += 1 \n self[length - 1] = val \n nil \n end",
"def add(elem)\n raise 'element name conflicts' if @rules[elem.name]\n @elements = nil\n @rules[elem.name] = elem\n elem\n end",
"def insert(element)\n node = Node.new(element)\n @size += 1\n if @root.nil?\n @root = node\n @root.level = 1\n @level = 1\n @leaf_set.insert(node)\n return\n end\n unless @incomplete_set.is_empty?\n parent_node = @incomplete_set.get\n @incomplete_set.delete(parent_node)\n if parent_node.left.nil?\n node.parent = parent_node\n node.level = parent_node.level + 1\n parent_node.left = node\n @level = node.level if node.level > @level\n bubble_up(node)\n return\n end\n if parent_node.right.nil?\n node.parent = parent_node\n node.level = parent_node.level + 1\n parent_node.right = node\n @level = node.level if node.level > @level\n bubble_up(node)\n return\n end\n end\n\n unless @leaf_set.is_empty?\n parent_node = @leaf_set.get\n @leaf_set.delete(parent_node)\n node.parent = parent_node\n node.level = parent_node.level + 1\n parent_node.left = node\n @level = node.level if node.level > @level\n bubble_up(node)\n return\n end\n end",
"def insert(index,element)\n return nil if index < 0 || index > @size\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n @map.keys.sort.reverse.each do |key|\n if key >= index\n value = @map.delete(key)\n @map[key+1] = value\n end\n end\n @map[index] = @added.size\n @added << pair\n #@commands << [:insert,pair]\n @size += 1\n self\n end",
"def enqueue(element)\n # check if queue is full \n raise ArgumentError, \"Queue is full\" if (@back + 1) % MAX_BUFFER == @front \n # check if queue is empty\n # empty queue\n if @front < 0\n @front = @back = 0\n # overflow to wrap around\n elsif @back == MAX_BUFFER - 1 # raise block will check for a full queue\n @back = 0\n @store[@back] = element\n # okay to just add\n else \n @back += 1\n end \n @store[@back] = element\n end",
"def enqueue(element)\n @in.push(element)\n end",
"def add_elem(elem)\n # (native code)\n end",
"def add_elem(elem)\n # (native code)\n end"
] |
[
"0.74941945",
"0.7209935",
"0.71950823",
"0.699894",
"0.69802713",
"0.6931484",
"0.68147993",
"0.6787134",
"0.67707264",
"0.6746616",
"0.6729355",
"0.67134434",
"0.6691495",
"0.6684873",
"0.66762626",
"0.66752535",
"0.66625756",
"0.6617913",
"0.65601695",
"0.65470266",
"0.6544239",
"0.6544239",
"0.6522864",
"0.6519387",
"0.6517225",
"0.6497009",
"0.6483868",
"0.64755124",
"0.6474476",
"0.6453253",
"0.6453253",
"0.64493835",
"0.64491105",
"0.6439619",
"0.6437596",
"0.6434003",
"0.6423803",
"0.6421832",
"0.6421021",
"0.6378841",
"0.63527936",
"0.6350893",
"0.6342221",
"0.63413805",
"0.63368505",
"0.6323353",
"0.6322826",
"0.63122326",
"0.6308952",
"0.6303782",
"0.6291279",
"0.6283358",
"0.6274473",
"0.6274006",
"0.62551117",
"0.62551117",
"0.62238896",
"0.620718",
"0.6197956",
"0.61877304",
"0.6173381",
"0.6165097",
"0.61563843",
"0.6154723",
"0.6146339",
"0.6142147",
"0.6142147",
"0.6126465",
"0.6118082",
"0.6114071",
"0.6097181",
"0.609583",
"0.608495",
"0.60589504",
"0.6058776",
"0.60578626",
"0.60128415",
"0.59932363",
"0.5969391",
"0.596661",
"0.59603333",
"0.5959569",
"0.5932221",
"0.5932043",
"0.5920412",
"0.59027165",
"0.58679163",
"0.58526736",
"0.58368003",
"0.5830265",
"0.5821012",
"0.58157057",
"0.5802702",
"0.5792633",
"0.57913125",
"0.5785947",
"0.5776672",
"0.577654",
"0.5762622",
"0.5762622"
] |
0.6722712
|
11
|
Returns +ture+ if the element is included in _self_.
|
def include?(elem)
@elements.include?(elem)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def include?(element)\n @elements.include? element\n end",
"def include?(value)\n element.include? value\n end",
"def include?(other)\n `#{@el}.contains(#{DOM::NODE.get_element(other)})` || other == self\n end",
"def not_include?(element)\n !self.include?(element)\n end",
"def include?(element)\n @element_list.include? element\n end",
"def include?(element)\n @ary.include? element\n end",
"def includes item\n msg = \"#{self} did not include #{item}\"\n check_if self.include?(item), msg\n end",
"def include?(element)\n @que.include?(element)\n end",
"def include? item\n @succ.include? item\n end",
"def include?(element)\n !find_element(element).nil?\n end",
"def include?(el)\n list.include?(el)\n end",
"def include?(item)\n return true\n end",
"def include?(item)\n return false if item.nil?\n return true\n end",
"def include?(elem)\n if elem.is_a? Liquor::Drop\n @source.include? elem.source\n else\n false\n end\n end",
"def include?(item)\n return item != nil\n end",
"def include?(item)\n ! get(item).nil?\n end",
"def include?(el)\n store.include?(el)\n end",
"def include?(item)\n self.__contains__(item).rubify\n end",
"def include? item\n return index_of(item) != nil\n end",
"def include?(el)\n @cache.include?(el)\n end",
"def include?(item)\n end",
"def is_prior_to(elem)\n return nil if self == elem\n elem.higher_priority_elements << self\n self.lower_priority_elements << elem\n true\n end",
"def can_contain?(element)\n false\n end",
"def include?(member)\n @self_is_object = self[0].respond_to?(:name) && self[0].class != Symbol unless defined?(@self_is_object)\n\n if @self_is_object\n any? { |s| s.name == member }\n else\n super\n end\n end",
"def include?(member)\n `self.hasOwnProperty(member)`\n end",
"def include?(obj)\n false\n end",
"def include?(item)\n return false if item.nil?\n return include_recipebook?(item) if item.recipebook?\n return false\n end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def include?(p0) end",
"def using_include(array, element)\n\tarray.include?(element)\nend",
"def has_elements?\n self.each_element{ |e| return true }\n return false\n end",
"def include?(other)\n `return self.indexOf(other) == -1 ? Qfalse : Qtrue;`\n end",
"def include?(other)\n `return self.indexOf(other) == -1 ? Qfalse : Qtrue;`\n end",
"def not_include?(element)\n !include?(element)\n end",
"def included?\n @_included\n end",
"def trueish?\n %w(1 t).include? self\n end",
"def has_elements?; end",
"def used_by?(element)\n end",
"def used_by?(element)\n end",
"def include?(item)\n @queue.include?(item)\n end",
"def include?(val)\n self.each {|item|\n if item.equal?(val)\n return true\n end\n }\n return false\n end",
"def include?(something); end",
"def include?(sym)\n `c$Element.prototype.m$has_class_bool.call(#{@element},sym)`\n end",
"def include?(*args)\n args.inject(true) {|val, x| val = self.single_include?(x)}\n end",
"def include?(entry)\n holding? && any? && results.key?(entry.label)\n end",
"def include?(key)\n\t\t\t\tsuper || @l2.include?(key)\n\t\t\tend",
"def include?(item)\r\n $game_party.usable?(item)\r\n end",
"def include?(needle)\n\t\t\tself.each do |item|\n\t\t\t\treturn true if needle.equal?(item)\n\t\t\tend\n\t\t\t\n\t\t\treturn false\n\t\tend",
"def include?(name)\n includes?(name)\n end",
"def in?(object)\n object.include?(self)\n end",
"def in?(object)\n object.include?(self)\n end",
"def being_included?\n @being_included || false\n end",
"def contains\n \t\tfalse\n\tend",
"def element_present?(name)\n collection.include?(name)\n end",
"def contains?(_other)\n true\n end",
"def contained?(other)\n other.contains?(self)\n end",
"def __empty?\n return false unless super\n __elements.values.all?(&:__empty?)\n end",
"def contains?(element)\n raise NotImplementedError\n end",
"def include_gadget?(gadget)\n if self.size < gadget.size\n false\n else\n inject(true) { |b, element| b &= gadget.include? element }\n end\n end",
"def include_variable?\n @elements.any?{|elt| elt.include_variable?}\n end",
"def include?(arr, include_item)\n arr.each { |item| return true if item == include_item }\n false\nend",
"def include?(position); end",
"def contains\n @row_elements\n end",
"def include?(object)\n each {|item| return true if item == object }\n false\n end",
"def include?(name)\n self.each { |c| return true if (c == name) }\n false\n end",
"def included(descendant); end",
"def included(descendant); end",
"def include?(value)\n !get(value).nil?\n end",
"def include?\n @options[:include]\n end",
"def rinclude\n -> v, x { x.include?(v) }.curry\n end",
"def include?(key)\n @item.key?(key)\n end",
"def include?(key)\n @item.key?(key)\n end",
"def contains?(element)\n self.each do |node| \n return true if node.value == element\n end\n return false\n end",
"def include?(arg_)\n _get_objdata(arg_) ? true : false\n end",
"def include?(name)\n ! self[name].nil?\n end",
"def include?(item)\n return false if item == nil\n return false unless item.is_a?(RPG::EquipItem)\n return false if @slot_id < 0\n return false if item.etype_id != @actor.equip_slots[@slot_id]\n return @actor.equippable?(item)\n end",
"def include?(name)\n items.include?(coerce_name(name))\n end",
"def include?(arr, target)\n arr.any?{ |ele| ele == target} ? true : false\nend",
"def element?\n node_type == ELEMENT_NODE\n end",
"def include?(obj)\n n = 0\n lim = self.__size\n while n < lim\n if self.__at(n) == obj\n return true\n end\n n += 1\n end\n false\n end",
"def include?(local_object)\n siblings_by_local_object_id.has_key?(local_object.droby_id)\n end",
"def include?(point)\n self.points.include? point\n end",
"def include?( object )\n has_node?( object ) ||\n has_edge?( object )\n end",
"def include?(x)\n inf <= x && x <= sup\n end",
"def include?(item)\n return true if item == nil\n if @equip_type == 0\n return false unless item.is_a?(RPG::Weapon)\n else\n return false unless item.is_a?(RPG::Armor)\n return false unless item.kind == @equip_type - 1\n end\n return @actor.equippable?(item)\n end",
"def include?(o)\n @mut.synchronize{@array.include?(o)}\n end",
"def add?(o)\n if include?(o)\n nil\n else\n add(o)\n end\n end",
"def add?(o)\n if include?(o)\n nil\n else\n add(o)\n end\n end",
"def element?; end",
"def element?; end",
"def include?(obj)\n self.each{|*val|\n return true if val.__svalue == obj\n }\n false\n end",
"def include?(item)\r\r\n item[:discovered]\r\r\n end",
"def include? object\n !!find(object)\n end",
"def includes() return @includes end",
"def includes_all?(other)\n leftovers = other.dup\n leftovers.delete_elements!(self)\n leftovers.empty?\n end",
"def include_all?(*items)\n items = items.first if items.length == 1 && items.first.kind_of?(Array)\n (items - self).empty?\n end"
] |
[
"0.72627753",
"0.71385694",
"0.7083272",
"0.7056407",
"0.7012274",
"0.6885466",
"0.68645346",
"0.67983544",
"0.67871845",
"0.67210245",
"0.66604084",
"0.64970434",
"0.649515",
"0.6487864",
"0.6472129",
"0.64663243",
"0.64399916",
"0.63391",
"0.6243539",
"0.62222195",
"0.62113047",
"0.6196788",
"0.6183332",
"0.6076691",
"0.60544854",
"0.6054122",
"0.6053736",
"0.60385305",
"0.60381097",
"0.60381097",
"0.60381097",
"0.60381097",
"0.60381097",
"0.60148793",
"0.60080165",
"0.59908706",
"0.59908706",
"0.59730333",
"0.59710526",
"0.5950635",
"0.5948021",
"0.59108615",
"0.59108615",
"0.59042275",
"0.5878156",
"0.5875544",
"0.5856211",
"0.58420587",
"0.5835083",
"0.5834129",
"0.58236384",
"0.5820731",
"0.58054084",
"0.58042353",
"0.58042353",
"0.58037424",
"0.5785129",
"0.57846725",
"0.5783806",
"0.5732994",
"0.57255214",
"0.57181597",
"0.57140636",
"0.5697156",
"0.5685362",
"0.5675524",
"0.5660268",
"0.56590587",
"0.56451297",
"0.56236166",
"0.56236166",
"0.5615013",
"0.5614065",
"0.56135887",
"0.56092364",
"0.56092364",
"0.56060356",
"0.5602145",
"0.55929434",
"0.55808514",
"0.55800337",
"0.55684865",
"0.5568184",
"0.5561627",
"0.5561274",
"0.5554584",
"0.55537564",
"0.55531025",
"0.55475944",
"0.55449474",
"0.5542611",
"0.5542611",
"0.55172706",
"0.55172706",
"0.5516396",
"0.5516167",
"0.55070555",
"0.54894793",
"0.54847366",
"0.54847306"
] |
0.7206876
|
1
|
Deletes the +element+ from this max heap, and maintains the heap properties. If the element is not found, return +nil+.
|
def delete(elem)
deleted = @elements.delete(elem)
build_heap unless deleted.nil?
deleted
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def pop;\n\t\t@heap.empty? and\n\t\t\treturn;\n\t\t_remove 0;\n\tend",
"def remove_max\n return nil if heap.empty?\n deleted = @heap.delete_at 0\n last_one = @heap.pop\n if last_one #ei ole false tai nil\n @heap.insert 0, last_one\n heapify_down 0\n end\n deleted\n end",
"def remove\n swap(0, self.heap.length-1, self.heap)\n value_to_remove = self.heap.pop\n self.sift_down(0, self.heap.length-1, heap)\n return value_to_remove\n end",
"def remove()\n return nil if @store.empty? \n swap(0, @store.length - 1)\n result = @store.pop.value\n \n heap_down(0) unless @store.empty?\n return result \n end",
"def remove\n unless self.empty?\n swap(0, @store.length - 1)\n removed_node = @store.pop\n\n heap_down(0)\n\n return removed_node.value\n end\n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def delete element\n self.delete_at index_of(element) \n end",
"def pop\n @heap.pop\n end",
"def remove_at index\n return nil if empty?\n removed_value = @heap[index]\n last_item_index = size - 1\n swap_values_at(index, last_item_index)\n\n # Remove the actual value off the heap,\n # now that it's at the end/bottom of the heap\n @heap.pop\n remove_from_map(removed_value, last_item_index)\n\n # Return now, if this item was the last item already\n return removed_value if index == last_item_index\n\n # redefine our interested item, post-swap\n new_item_at_index = @heap[index]\n # Try to sink the item we moved, which now exists at `index`\n sink(index)\n # Otherwise try to swim it up, if it could not sink,\n # thus the \n swim(index) if @heap[index] == new_item_at_index\n\n return removed_value\n end",
"def remove\n swap(0, @heap.length - 1, @heap)\n value_to_remove = @heap.pop\n sift_down(0, @heap.length - 1, @heap)\n value_to_remove\n end",
"def remove\n # Can you delete any other node besides the root?\n return nil if @store.empty?\n\n swap(0, @store.length - 1)\n target = @store.pop\n\n heap_down(0)\n return target.value\n end",
"def remove()\n \n swap(0, @store.length - 1)\n removed = @store.pop()\n \n heap_down(0) unless @store.empty?\n \n return removed.value\n end",
"def remove()\n return nil if !@store\n\n swap(0, @store.length - 1)\n nope = @store.pop\n\n heap_down(0)\n return nope.value\n end",
"def delete(element)\n synchronize do\n @queue.delete(element)\n end\n end",
"def remove() # removes the element at the first position (root) of the array\n return nil if @store.empty?\n last_index = @store.length - 1\n # First, swap the last leaf & the root node\n swap(0, last_index)\n\n # Delete the last leaf (last item in the array)\n result = @store.pop\n\n # Then heap-down the new root, to reestablish the heap property\n # start heap_down with the root (index 0)\n heap_down(0) \n return result.value\n end",
"def delete(element)\n i = element.hash % @table.size\n return unless @table[i]\n if @table[i].item == element\n result = @table[i].item\n @table[i] = @table[i].next\n @count -= 1\n return result\n end\n node = @table[i]\n while node.next\n if element == node.next.item\n result = node.next.item\n node.next = node.next.next\n @count -= 1\n return result\n end\n node = node.next\n end\n return nil\n end",
"def remove()\n return if @store.empty?\n last = @store.length - 1\n curr = 0\n swap(last, curr)\n removed = @store.pop\n heap_down(curr)\n return removed.value\n end",
"def delete(element)\n synchronize do\n @queue.delete(element)\n end\n end",
"def delete(element)\n synchronize do\n @queue.delete(element)\n end\n end",
"def remove\n\n if @store.empty?\n raise ArgumentError, 'There are no nodes to remove'\n end\n\n # keep track of the element we're removing so we can return it\n removed = @store[0].value\n\n # swap root and last node in heap ... \n @store[0], @store[@store.length - 1] = @store[@store.length - 1], @store[0]\n\n # ... then delete last node (this is more efficient than removing first node)\n @store.delete_at(@store.length - 1)\n\n # we're done if there's only one node left after deletion\n return removed if @store.length == 1\n\n # if there's more than one node left, call the recursive heap down method to \n # re-order the remaining nodes, starting at the top\n heap_down(0)\n return removed\n\n end",
"def delete(value)\n # Find the element to delete\n index = index(value)\n not_final = index < @heap.length - 1\n # Unless it's the final leaf, replace the value to be deleted with the final leaf\n @heap[index] = @heap[-1] if not_final\n # Delete the final leaf (either what we want to delete, or a duplicate now)\n @heap.pop\n # If necessary, bubble down\n bubble_down(index) if not_final\n end",
"def remove()\n return if @store.empty?\n\n swap(0, @store.length - 1)\n banished = @store.pop\n heap_down(0)\n\n return banished.value\n end",
"def remove()\n return if @store.empty?\n \n # swap last item in heap with smallest value\n swap(0, -1)\n\n # remove smallest value\n removedNode = @store.pop\n\n # maintain heap structure\n heap_down() if @store.length > 1\n \n return removedNode.value\n end",
"def pop\n return nil if @elements.length == 0\n tmp = @elements.shift\n @elements.unshift @elements.pop\n heapify_down\n return tmp\n end",
"def remove()\n removed = @store[0].value\n swap(0, @store.length - 1)\n @store.pop\n heap_down(0)\n return removed\n end",
"def remove()\n return nil if self.empty?\n\n # swap root node and last leaf node (swap head and rear of internal array) and pop it\n last_index = @store.length - 1\n swap(0, last_index)\n removed = @store.pop\n\n # ensure heap property via calling heap_down\n heap_down(0)\n return removed.value\n end",
"def remove()\n root = @store[0]\n new_root = @store[@store.length - 1]\n\n @store[@store.length - 1] = root\n @store[0] = new_root\n\n removed = @store.pop\n\n heap_down(0)\n return removed.value\n end",
"def remove()\n return nil if empty? \n swap(0, @store.length - 1) # swap last element with root, O(n) to calc length\n old_top = @store.pop() # remove former root with O(1) time\n\n heap_down(0) unless empty?# bubble down new top element so lowest element in 0 index\n\n return old_top.value # return old min's value\n end",
"def delete_element(element); end",
"def remove()\n return if @store.empty?\n if @store.size == 1\n return @store.pop\n end\n # swap the first and the last element in the underlying array\n @store[-1], @store[0] = @store[0], @store[-1]\n removed = @store.pop\n heap_down(0)\n return removed.value\n end",
"def delete(element); end",
"def pop\n peek.tap do |result|\n last = @nodeset.pop\n unless size.zero? # Replace the root of the heap with the last element and heapify-down\n @nodeset[1] = last\n heapify_down 1\n end\n end\n end",
"def pop\n @insert_point -= 1\n if (@insert_point < 0)\n return nil\n end\n check = @items[0]\n\n rc = pop_sync(check)\n new_head = @items[@insert_point]\n new_head.index = 0\n @items[0] = new_head\n @items[@insert_point] = nil\n\n # Rearrange the neighbor nodes and recalculate their attribs\n check.next_link.prev_link = check.prev_link\n check.prev_link.next_link = check.next_link\n check.next_link.recalculate\n check.prev_link.recalculate\n\n # Rearrange the heap\n heapify(0)\n heapify(check.next_link.index)\n heapify(check.prev_link.index)\n\n return rc\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 delete(root, data)\n # finds the data to be deleted and stores as element\n element = find(root, data)\n if element\n # if data was found\n # store what will be the new last index\n last_index = @tree.length - 1\n # store last_index's parent's index\n parent = last_index / 2\n # delete end of tree and store in last_element\n last_element = @tree.pop\n\n # determine if it was a left or right child\n popped_node_was_a_left_child = @tree[parent] && last_index % 2 == 0\n popped_node_was_a_right_child = @tree[parent] && last_index % 2 != 0\n\n # set appropriate child as nil\n if popped_node_was_a_left_child\n @tree[parent].left = nil\n elsif popped_node_was_a_right_child\n @tree[parent].right = nil\n end\n\n # re-set the 'deleted' element's title and rating,\n # effectively removing it and replacing it with what was the last node\n element.title = last_element.title\n element.rating = last_element.rating\n else\n # data was not found, return nil\n return nil\n end\n\n # filter the newly placed node up or down to where it should be in the heap\n filter_down(element)\n filter_up(element)\n end",
"def pop\n node = remove_node(head)\n return nil unless node\n self.size -= 1\n node.data\n end",
"def delete(priority)\n @heap.delete(priority)\n end",
"def shift\n if @elements.empty?\n return nil\n end\n\n swap(0,@elements.size-1)\n ele = @elements.pop\n heapify(0)\n ele\n end",
"def pop\n return nil if empty?\n @anchor.prev_node.delete\n end",
"def pop\n\t\tif (!@head) then return nil end\n\t\ttemp = @head\n\t\t@head = @head.get_next()\n\t\tif (@head) then @head.set_prev(nil)\n\t\telse @tail = nil\n\t\tend\n\t\t@size -= 1\n\t\treturn temp.get_item()\n\tend",
"def pop\n raise 'No such element' if @elements.length == 0\n @elements.slice!(-1)\n end",
"def pop\n node = self.double_link_linked_list.delete_tail\n node ? node.value : nil\n end",
"def pop\n return nil if @count == 0\n\n # get the index of the las titem\n @store.store.reverse.each_with_index do |ele, i|\n if ele != nil \n @last_ele = capacity() - (i+1) \n break\n end\n end\n #val = @store.store.delete_at(@last_ele)\n val = @store.store[@last_ele]\n @store.store[@last_ele] = nil\n @count -= 1\n return val\n end",
"def delete(key)\r\n\t\t# If key does not exist then return nil otherwise delete node from list\r\n\t\t# and decrease total number of items in Hashmap by 1\r\n\t\treturn nil if key == nil || !get(key)\r\n\t\tindex = key.hash % @size\r\n\t\t@total -= 1\r\n\t\treturn @arr[index].delete(key)\r\n\tend",
"def remove_last\n raise 'No such element' if @size == 0\n elt = @tail.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @tail = @tail.previous\n @tail.next.previous = nil\n @tail.next = nil\n end\n @size -= 1\n return elt\n end",
"def heap_extract_max()\n\t\tif @heap.length < 0\n\t\t\treturn nil\n\t\tend\n\t\tmax = @heap[0]\n\t\t@heap[0] = @heap[@heap.length-1]\n\t\t@heap.pop()\n\t\tn_heapify(@max)\n\t\treturn max\n\tend",
"def clear\n @heap.clear\n end",
"def pop\n if empty?\n nil\n else\n @q.remove\n @stack.shift\n end\n end",
"def delete!\n graph.remove_vertex element\n end",
"def delete(val)\n count = self.lrem(0, val)\n if count > 0\n val\n else\n nil\n end\n end",
"def delete(element)\n indices = []\n self.each.with_index{|e,i| indices << i if e == element}\n if indices.empty?\n if block_given?\n return yield\n else\n return nil\n end\n end\n #@commands << [:delete,indices]\n indices.each.with_index do |index,offset|\n self.delete_at(index-offset)\n end\n element\n end",
"def pop\n node = @head\n if @size > 1\n node = node.link until node.link.link.nil?\n node.link = nil\n else \n @head = nil\n end\n @size -= 1\n end",
"def remove_max\n\n if @max_heap.length == 1\n return @max_heap.pop\n end\n\n # Replace the first element with the last element\n last_node = @max_heap.pop\n max_node = @max_heap.shift\n @max_heap.unshift(last_node)\n\n parent_idx = 0\n\n # Sink down the current first node to its correct position\n while parent_idx < @max_heap.length\n left_child_idx = (parent_idx * 2) + 1\n right_child_idx = (parent_idx * 2) + 2\n\n # Compare the values if the right and left child are in the correct index\n swap = nil\n if left_child_idx < @max_heap.length\n swap = left_child_idx if @max_heap[left_child_idx] > @max_heap[parent_idx]\n end\n\n if right_child_idx < @max_heap.length\n if swap.nil? && @max_heap[right_child_idx] > @max_heap[parent_idx] || swap != nil? && @max_heap[right_child_idx] > @max_heap[left_child_idx]\n swap = right_child_idx\n end\n end\n\n break if swap.nil?\n\n @max_heap[parent_idx], @max_heap[swap] = @max_heap[swap], @max_heap[parent_idx]\n\n parent_idx = swap\n\n end\n\n max_node\nend",
"def remove_first\n raise 'No such element' if @size == 0\n elt = @head.value\n if @size == 1\n @head = nil\n @tail = nil\n else\n @head = @head.next\n @head.previous.next = nil\n @head.previous = nil\n end\n @size -= 1\n return elt\n end",
"def remove_max(list, last_pos)\n removed = list[0]\n list[0] = list[last_pos] \n list[last_pos] = removed\n heap_down(0, last_pos - 1, list)\nend",
"def delete(el)\n store.delete(el)\n end",
"def pop\n if data\n element = data\n @data = data.next_node\n return element.value\n else\n return nil\n end\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 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 removed(node)\n\t\t\t@size -= 1\n\t\t\treturn node\n\t\tend",
"def peek\n return nil if empty?\n\n @heap[0]\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 pop\n return nil if @head.nil?\n\n to_remove = @head\n @head = @head.next\n to_remove.next = nil\n @count -= 1\n\n to_remove.value\n end",
"def pop\n # if Stack is empty, cannot remove anything\n if empty?\n nil\n else\n # popped set equal to last element in @store array\n popped = @store[@top]\n # sets last element in @store array to nil\n @store[@top] = nil\n # sets @top equal to @top - 1 (so -2 the first time through, then -3, etc.) - there is still an empty slot in @store at index -1, but no actual element there\n @top = @top.pred #@top--\n # returns the element that was removed from @store/popped from Stack\n popped\n end\n end",
"def pop\n return default if (node = @tree.maximum).nil? \n @tree.delete node\n node.to_a\n end",
"def pop\n return nil if @head.nil?\n if self.size > 1\n @tail = self.at(self.size-1) \n @tail.next = nil\n else # only 1 node\n @tail = @head = nil\n end\t\n end",
"def delete!\n graph.removeVertex element\n end",
"def pop\n raise(UnderflowError, \"There is no element to remove from the stack\") if empty?\n store.pop\n end",
"def delete!\n graph.remove_edge element\n end",
"def delete!\n graph.remove_edge element\n end",
"def delete(value)\n found_node = self.find(value)\n return nil if found_node.nil?\n\n if found_node == root\n self.root = nil\n return found_node\n end\n\n #first case, deleted node has no children\n right_empty = found_node.right.nil?\n left_empty = found_node.left.nil?\n\n if right_empty && left_empty #must take parent and delete its pointer to deleted node\n direct_parent = parent(found_node)\n if direct_parent.value < found_node.value\n direct_parent.right = nil\n else\n direct_parent.left = nil\n end\n elsif right_empty #deleted node has one child\n child = found_node.left\n direct_parent = parent(found_node)\n if direct_parent.value < found_node.value\n direct_parent.right = child\n else\n direct_parent.left = child\n end\n elsif left_empty #deleted node has one child\n child = found_node.right\n direct_parent = parent(found_node)\n if direct_parent.value < found_node.value\n direct_parent.right = child\n else\n direct_parent.left = child\n end\n else #deleted node has two children. I'm choosing the left side maximum\n #of the deleted node for a replacement.\n\n left_child = found_node.left\n right_child = found_node.right\n max = maximum(left_child)\n child_of_max = max.left #max's child will always be on the left!!!\n parent_of_max = parent(max)\n parent_of_deleted = parent(found_node)\n\n if parent_of_deleted.value < found_node.value\n parent_of_deleted.right = max\n else\n parent_of_deleted.left = max\n end\n\n parent_of_max.right = child_of_max #reconnecting the holes caused by extracting max\n max.left = left_child #replacing the deleted node with the max\n max.right = right_child #replacing the deleted node with the max\n end\n\n found_node\n end",
"def delete_at(index)\n return nil if index >= @size || index < 0\n element = self[index]\n if direct_index = @map[index]\n @added.delete_at(direct_index)\n @map.delete(index)\n @map.keys.sort.each do |key|\n if key > index\n value = @map.delete(key)\n value -= 1 if value > direct_index\n @map[key-1] = value\n else\n if (value = @map[key]) > direct_index\n @map[key] -= 1\n end\n end\n end\n else\n lazy_index = lazy_index(index)\n position = @deleted.bsearch_upper_boundary{|e| e <=> lazy_index }\n @deleted.insert(position,lazy_index)\n @map.keys.sort.each do |key|\n if key > index\n @map[key-1] = @map.delete(key)\n end\n end\n end\n #@commands << [:delete,[index]]\n @size -= 1\n element\n end",
"def pop\n\t\t\t\tif @length == 0\n\t\t\t\t\traise RuntimeError.new(\"Cannot pop from empty list.\")\n\t\t\t\telse\n\t\t\t\t\tif @tail.prev == nil\n\t\t\t\t\t\t# there is only one element\n\t\t\t\t\t\t@head = nil\n\t\t\t\t\t\t@tail = nil\n\t\t\t\t\telse\n\t\t\t\t\t\t@tail.prev.next = nil\n\t\t\t\t\t\t@tail = @tail.prev\n\t\t\t\t\tend\n\t\t\t\t\t@length -= 1\n\t\t\t\tend\n\t\t\tend",
"def remove(value)\n\t\t\telement = self.head\n\t\t\tprevious_element = @head\n\t\t\twhile element.value != value\n\t\t\t\tif element.next.nil?\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tprevious_element = element\n\t\t\t\t\telement = element.next\n\t\t\t\tend\n\t\t\tend\n\n\t\t\tprevious_element.next = element.next\n\t\t\telement\n\t\tend",
"def delete!\n graph.removeEdge element\n end",
"def pop\n delete_at(0)\n end",
"def pop\n return nil unless @head && @tail\n\n old_head = @tail.head\n old_data = @tail.data\n @tail = @tail.head\n @tail.tail = nil if @tail\n\n @size -= 1\n\n old_data\n end",
"def remove_top\n return raise EMPTY_HEAP_EXCEPTION if @root.nil?\n\n new_root = remove_node\n value = @root.value\n if root?(new_root)\n @root = nil\n @size = 0\n return value\n end\n if relationship(new_root.parent, new_root) == BinaryNodeRelationship::LEFT_CHILD\n new_root.parent.left = nil\n else\n new_root.parent.right = nil\n end\n new_root.parent = nil\n new_root.left = @root.left\n new_root.right = @root.right\n\n current = new_root\n did_swap = false\n until leaf?(current)\n # Because of the insertion strategy,\n # it is impossible for the left child to not exist if the current is not a leaf.\n left_priority = priority(current.left, current)\n right_priority = current.right.nil? ? nil : priority(current.right, current)\n\n if right_priority.nil? # There is only a left child.\n break unless left_priority.negative?\n\n swap(current, current.left)\n else # Both children exist.\n # Node is in the correct position.\n break if priority(current, current.left).negative? && priority(current, current.right).negative?\n\n # Otherwise, keep bubbling.\n left_right_priority = priority(current.left, current.right)\n # Bubble towards the smaller priority.\n swap(current, left_right_priority.negative? ? current.left : current.right)\n end\n did_swap = true\n end\n # New root was immediately placed in the correct position, swap pointers manually.\n # This can only occur when deleting from a heap of size 3 (resulting in size 2).\n unless did_swap\n @root = new_root\n @root.parent = nil\n # No need to check the right child, since it cannot exist in a heap of size 3.\n @root.left.parent = @root unless @root.left.nil?\n end\n @size -= 1\n value\n end",
"def pop\r\n removed_item = @data\r\n @data = @data.next_node\r\n removed_item.next_node = nil\r\n removed_item\r\n end",
"def pop\n old = @tail\n if @tail == nil\n return nil\n else\n prev = @tail\n @tail = @tail.prev_value\n @length -= 1\n return prev.value\n end\n end",
"def delete(value)\n index = find(value)\n return false if index == -1\n @inner[index] = @inner[@inner.length - 1]\n @inner.delete_at(@inner.length - 1)\n return true\n end",
"def pop\n return nil if size.zero?\n\n temp = first\n self.last = nil if first == last\n self.first = first.next\n self.size -= 1\n temp.val\n end",
"def pop\n item = @first.val\n @first = @first.next\n @last = nil if(@first == nil)\n @size -= 1\n item\n end",
"def deq\n\t\tremove(0)\n\tend",
"def leave(p)\n ix = @array.bsearch_index { |ele| ele >= p }\n @array.delete_at(ix)\n nil\n end",
"def delete_one(object)\n position = index(object)\n position ? delete_at(position) : nil\n end",
"def removePiece\n\t\tif(@piece == nil)\n\t\t\treturn nil;\n\t\telse\n\t\t\tremovedPiece = @piece;\n\t\t\t@piece = nil;\n\t\t\treturn removedPiece;\n\t\tend\n\tend",
"def pop() #delete last element in the LL\n return nil if @head == nil #if list is empty return nil\n return @head = nil if self.list_size == 1 #list has 1 element(head) assign head to nil\n temp_node = @head #if list has more then 1 element, travres till last element\n #stop conditon is when second element from current link to nil, means that first\n #from current is last element in the list\n until temp_node.link.link == nil \n temp_node = temp_node.link\n end\n temp_node.link = nil #cat the link with last element by assigning previous link to nil\n end",
"def remove_at_head\n\t\t\treturn nil if self.empty?\n\t\t\telement = self.head\n\t\t\t@head.next = nil || element.next\n\t\t\telement\n\t\tend",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def pop\n if empty?\n nil\n else\n popped = @store[@top]\n @store[@top] = nil\n #decrement top\n @top = @top.pred\n popped\n end\n end",
"def delete\n raise \"Bad Things\" if @size == 0\n # @storage[@size-1] = 0 <-- don't need this since it doesn't matter whether the value is 0 or something else\n @size -= 1\n end",
"def pop\n return nil unless @tail\n value = @tail[:data].pop\n @tail = @tail[:forward] while @tail and @tail[:data].size == 0\n @set.delete(value)\n value\n end",
"def pop\n return unless @head\n popped = @head\n \n if @head.to\n new_head = @head.to\n new_head.from = nil\n @head = new_head\n size += 1\n else\n empty!\n end\n\n popped.obj\n end",
"def pop\n return nil unless @tail\n\n popped = @tail\n @tail = @tail.head # remove tail\n @size -= 1\n\n popped.data\n end",
"def delete_key key\n # decrease that key to new minimum, and extract it out.\n decrease_key key, min.key - 1\n extract_min\n print_heap\n end",
"def pop\n return nil unless self.length > 0\n \n self.head = self.head.next\n self.tail = nil if self.length == 1\n self.length -= 1\n end",
"def delete(value)\n\t \n if @root == nil \n return false\n end\n \n #Obtenemos el nodo a remover\n\t toRemove = selectElement(value,@root)\n \n ## Mandamos a buscar al padre del nodo\n father = getFather(value,@root,toRemove)\n \n if !isLeaft(toRemove,father) ## remueve elemento al encontrarlo y sea hoja\n promote(toRemove,father) ##Verificamos si es hijo unico\n end\n \n return true\n end",
"def pop()\n head = @head\n if head == nil then\n return nil\n end\n @head = head.prev\n return head.val\n end",
"def pop\n\t\t\t@storage.pop\n\t\tend"
] |
[
"0.6819025",
"0.68113655",
"0.66549516",
"0.66510993",
"0.6562311",
"0.65469515",
"0.65469515",
"0.65193224",
"0.65153104",
"0.650952",
"0.6493301",
"0.6486128",
"0.6463992",
"0.6453655",
"0.6442046",
"0.6412629",
"0.640591",
"0.63867676",
"0.63867676",
"0.63826007",
"0.6363436",
"0.63545793",
"0.6342488",
"0.6341542",
"0.6332846",
"0.629027",
"0.6235504",
"0.6202454",
"0.6186372",
"0.61764854",
"0.60983324",
"0.5998337",
"0.5983003",
"0.5958852",
"0.5879772",
"0.5839514",
"0.5800981",
"0.5692841",
"0.5679568",
"0.5656315",
"0.56426656",
"0.55967355",
"0.5572359",
"0.5543947",
"0.5533395",
"0.5529519",
"0.54980934",
"0.54883546",
"0.5487751",
"0.5472402",
"0.5448427",
"0.54440445",
"0.5443487",
"0.54430073",
"0.54415375",
"0.5440499",
"0.54355526",
"0.54323393",
"0.5430877",
"0.54191",
"0.5414267",
"0.5412241",
"0.5389247",
"0.5383479",
"0.53574115",
"0.5345596",
"0.5336793",
"0.53128225",
"0.53118074",
"0.53118074",
"0.5300733",
"0.5293138",
"0.5289352",
"0.52802116",
"0.52786744",
"0.5272686",
"0.526959",
"0.5269356",
"0.525855",
"0.5253379",
"0.5253135",
"0.52530867",
"0.5234436",
"0.52225935",
"0.52190053",
"0.5218905",
"0.5207184",
"0.52043355",
"0.52021825",
"0.5192541",
"0.5192541",
"0.51864046",
"0.5177495",
"0.5168554",
"0.5158347",
"0.51525825",
"0.5151261",
"0.514772",
"0.5127292",
"0.5125488"
] |
0.75875956
|
0
|
Returns the elements in an +Array+ object.
|
def to_a
@elements.clone
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_a\n array\n end",
"def to_a\n Array(each)\n end",
"def to_a\n @arr\n end",
"def get_items\r\n @arr.to_a\r\n end",
"def get_elements(array)\n\n elements = []\n if array != nil\n elements = array.to_a\n end\n return elements\n\nend",
"def get_array(path='.')\n Element.get_array(@element, path)\n end",
"def to_a; [Array]; end",
"def get_array(path=\"\")\n Element.get_array(@element, path)\n end",
"def to_a\n Array.wrap(self)\n end",
"def array\n @array\n end",
"def to_array\n array = []\n self.each { |x| array.push x }\n return array\n end",
"def array\n @@array\n end",
"def array\n raise \"Not implemented\"\n end",
"def array()\n\t\t@array\n\tend",
"def array\n self.allObjects\n end",
"def to_a\n result = []\n self.each do |item|\n result << item\n end\n return result\n end",
"def to_a; Array(force) end",
"def get_array(element, path='.')\n return unless element\n \n result = element/path\n if (result.is_a? Nokogiri::XML::NodeSet) || (result.is_a? Array)\n result.collect { |item| self.get(item) }\n else\n [self.get(result)]\n end\n end",
"def Array(type)\n Strict(::Array).of(type)\n end",
"def to_a\n each.to_a\n end",
"def to_a\n each.to_a\n end",
"def array\n\t\t#create an array of\n\t\tarray = [0, 1, 2, 3, 4, 5, 6, 7, 8]\n\tend",
"def arrayed(object) # :doc:\n (object.is_a?(Array) ? object : [object])\n end",
"def to_a\n\t\tarr = []\n\t\teach {|valor| arr << valor}\n\t\tarr\n\tend",
"def to_ary\n\t\t\treturn @elements.to_ary\n\t\tend",
"def to_a\n out = []\n\n each { |e| out << e }\n\n out\n end",
"def to_a\n array = all\n array.each_with_index do |value, i|\n array[i] = value.to_a if value.is_a?(RedisArray)\n end\n end",
"def to_a\n x = []\n self.each do |it|\n x << it\n end\n x\n end",
"def to_a\n result = []\n size.times { |i| result << self[i] }\n result\n end",
"def Array(p0) end",
"def to_a\n results = []\n traverse { |value| results << value }\n results\n end",
"def array(*args)\n args_ = (args.size == 1) && (args[0].is_a? ::Array) ? args[0] : args\n args_.each_with_object(newObject('Array')) do |val, obj|\n obj.add val\n end\n end",
"def sequence_to_array_objects\n @sequence = Array.new if @sequence.nil?\n\n array = []\n if !@sequence.empty?\n @sequence.each { |element|\n downcaseElement = element.downcase\n if instance_attribute_defined?(downcaseElement)\n object = get(downcaseElement)\n if object.kind_of?(Array)\n array.concat object\n else\n array << object\n end\n end\n }\n else\n if !@objects.nil?\n @objects.each { |o|\n array << o\n }\n end\n end\n return array;\n end",
"def to_a\n each.force\n end",
"def _array(obj)\n obj.map { |v| _renc(v) }\n end",
"def to_a\n a = []\n each { |item|\n a.push(item)\n }\n a\n end",
"def elements\n return @elements\n end",
"def to_a\n array.map do |item|\n if item.is_a?(SpecViewArray)\n item.to_a\n else\n item\n end\n end\n end",
"def get_elements_array\n element_names\n end",
"def to_a\n\t\t\tflat = []\n\t\t\t\n\t\t\tflatten_to_array(flat)\n\t\t\t\n\t\t\treturn flat\n\t\tend",
"def as_array(thing)\n [ thing ].flatten\n end",
"def to_ary\n self.map{|result| result}\n end",
"def get_items\n\t\t@arr\n\tend",
"def arrayize(object)\n return [] if object.nil?\n return object.is_a?(Array) ? object : [object]\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 array(object)\n case object\n when Array\n object\n when String\n object.present? ? [object] : []\n when NilClass\n []\n else\n [object]\n end\n end",
"def __array__; self; end",
"def to_a()\n a = []\n for i in 0..size()-1\n a << self[i]\n end\n a\n end",
"def array(before: Pass.instance, each: Pass.instance, after: Pass.instance)\n ArrayV.new before: before, each: each, after: after\n end",
"def to_a\n map { |e| e.data}\n end",
"def to_a\n [self]\n end",
"def to_a\n [self]\n end",
"def to_a\n [x, y, z]\n end",
"def _getarray\n if @document.nil?\n return @list\n else\n return @document.native_text\n end\n end",
"def to_a\n [ x, y, z ]\n end",
"def to_ary\n each.to_a\n end",
"def arrays\n @vectors\n end",
"def to_array(a)\n a.map { |i| i }\nend",
"def to_array(a)\n a.map { |i| i }\nend",
"def to_a\n [ self ]\n end",
"def build_array\n arr = []\n yield(arr)\n arr \n end",
"def rows\n @array\n end",
"def put_in_array(elem)\n array = []\n elem.each {|e| array << e.text}\n return array\nend",
"def to_a\n @array ||= [name, depth]\n end",
"def to_a\n array = [@value]\n \n list = self\n while list.next != nil\n list = list.next\n array << list.value\n end\n \n array\n end",
"def entries\n return Array(@entries)\n end",
"def to_a\n super.map{|v| Array === v ? v.to_a : v}\n end",
"def to_ary\n\t\t@data.flatten\n\tend",
"def to_a\n @elements.dup\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 array(value)\n value.respond_to?(:to_ary) ? value : [value]\n end",
"def elements; end",
"def elements; end",
"def elements; end",
"def ary\n @ary ||= rule.sep('[').maybe(elements).sep(']')\n end",
"def getify_array(array_of_records)\n return array_of_records.map{|r| r.get}\n end",
"def array(field_name, opts = {}, &block)\n if opts[:type] == :object\n object(field_name, array: true, &block)\n else\n field(field_name, opts, &block)\n end\n end",
"def to_a\n return @results\n end",
"def getMembersAsArray() \n ret = []\n it = self.getIterator() \n while(it.hasMoreResources())\n ret << it.nextResource().getContentAsREXML()\n end\n \n return ret\n end",
"def as_array\n @fm.dup\n end",
"def calls_array\n a = return_array\n a[1]\n end",
"def to_a; [self] end",
"def to_a; [self] end",
"def to_a\n [ self ]\n end",
"def to_a\n @rep.map { |l| l }\n end",
"def to_a\n @rep.map { |l| l }\n end",
"def to_ary \n\t\t\treturn @elem.to_ary\n\t\tend",
"def to_a\n data.all\n end",
"def array(opts = {})\n data, _status_code, _headers = array_with_http_info(opts)\n data\n end",
"def objects_to_array(collection, key_method, value_method)\n returnArray = collection.map do |element|\n [get_value_for(element, key_method), get_value_for(element, value_method)]\n end\n end",
"def to_a\n a = Array.new(stop)\n self.each { |i,v| a[i] = v }\n return a\n end",
"def to_flat_array\n ary = Array.new(self.size)\n self.each.with_index { |v,i| ary[i] = v }\n ary\n end",
"def values\n @array.transpose[1]\n end",
"def to_a\n a = []\n while (item = self.next)\n a << item.item\n end\n a\n end",
"def to_array\n @array ||= begin\n array = to_hash.kind_of?(Array) ? to_hash : [to_hash]\n array.compact\n end\n end",
"def to_a\n array = []\n rows.times do |row|\n col_array = []\n cols.times do |col|\n col_array << self.value_at(row,col)\n end\n array << col_array\n end\n\n return array\n end",
"def to_a; [x, y, z] end",
"def to_array\n self.collect{|k,v| v}\n end",
"def array_result\n [@result['results']].flatten\n end",
"def array(name, options={})\n param(:array, name, options)\n end"
] |
[
"0.7426894",
"0.73324",
"0.7218192",
"0.7153268",
"0.7101872",
"0.70424175",
"0.7023875",
"0.7003615",
"0.7000537",
"0.698376",
"0.6982483",
"0.69784325",
"0.69342333",
"0.69193715",
"0.68129015",
"0.6773325",
"0.6726881",
"0.66971076",
"0.66956264",
"0.66901094",
"0.66901094",
"0.6685277",
"0.66849065",
"0.6645085",
"0.65988785",
"0.6592695",
"0.6566327",
"0.65581095",
"0.6550497",
"0.65425235",
"0.64663565",
"0.6450592",
"0.6446048",
"0.64439386",
"0.6434159",
"0.6429489",
"0.6423833",
"0.6397658",
"0.6395678",
"0.63816965",
"0.63596857",
"0.63571775",
"0.63558733",
"0.6355813",
"0.6354848",
"0.63531",
"0.6350076",
"0.63320625",
"0.63249767",
"0.6312112",
"0.62809646",
"0.62633836",
"0.6242737",
"0.62323207",
"0.6231681",
"0.62309635",
"0.6225044",
"0.619311",
"0.619311",
"0.61846995",
"0.6158989",
"0.61486673",
"0.6146438",
"0.6145133",
"0.6140274",
"0.613159",
"0.6131132",
"0.61283547",
"0.61266214",
"0.6124601",
"0.6118393",
"0.61163646",
"0.61163646",
"0.61163646",
"0.6113017",
"0.6096607",
"0.60960317",
"0.6089571",
"0.6088839",
"0.60849017",
"0.6081031",
"0.6074272",
"0.6074272",
"0.6065893",
"0.6043202",
"0.6043202",
"0.603193",
"0.602233",
"0.60133016",
"0.6012646",
"0.60089016",
"0.6001901",
"0.6001415",
"0.5997551",
"0.5991707",
"0.59799975",
"0.59789884",
"0.5977966",
"0.59734154",
"0.59712404"
] |
0.6233045
|
53
|
Returns the parent index of the element at +i+.
|
def parent(i)
(i-1)/2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def parent_index(i)\n (i / 2).floor\n end",
"def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend",
"def parent(index)\n case index\n when 0\n INVALID_INDEX\n else\n (index - 1) / 2\n end\n end",
"def parent(i); (i-1)/2; end",
"def idx_children(parent_i)\n [parent_i * 2 + 1, parent_i * 2 + 2]\n end",
"def left_child_index(i)\n i * 2\n end",
"def parent(index)\n (index.to_f / 2).ceil - 1\n end",
"def parent_child_index(parent) #:nodoc:\n duck = parent[:builder].instance_variable_get('@nested_child_index')\n\n if duck.is_a?(Hash)\n child = parent[:for]\n child = child.first if child.respond_to?(:first)\n duck[child].to_i + 1\n else\n duck.to_i + 1\n end\n end",
"def right_child_index(i)\n (i * 2) + 1\n end",
"def parent(node_index)\n return -1 if (node_index < 0) || (node_index > @count)\n return (node_index - 1)/2\n end",
"def parent_index( local_index, parent_array = parent_array( local_index ), local_parent_map = nil )\n \n parent_index = nil\n \n if parent_array\n local_parent_map ||= local_parent_map( parent_array )\n parent_index = local_parent_map[ local_index ]\n end\n \n return parent_index\n \n end",
"def position\n self.parent.children.index(self)\n end",
"def own_child_index\n return nil if parent.nil? # self is root\n own_index = nil\n parent.children.each_with_index { |c,i|\n if self == c\n own_index = i\n break\n end\n }\n own_index\n end",
"def part_position\n return self.parent.children.index(self) rescue nil\n end",
"def left_child(parent_index)\n left = 2 * parent_index + 1\n return -1 if left > (@array.size - 1)\n left\n end",
"def where_am_i?\n return @where_am_i if @where_am_i\n\n raise \"not parented\" if not parent\n\n parent.each_with_index do |o, i|\n if o == self\n @where_am_i = i\n return i\n end\n end\n nil\n end",
"def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end",
"def cfei_at(i)\n\n children.find { |cfei| Ruote.extract_child_id(cfei) == i }\n end",
"def get_child_index\n return 0\n end",
"def position\n root? ? 0 : parent.children.index(self)\n end",
"def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end",
"def each_child_index\n end",
"def parent_child_index(parent) # @private\n # Could be {\"post[authors_attributes]\"=>0} or { :authors => 0 }\n duck = parent[:builder].instance_variable_get('@nested_child_index')\n \n # Could be symbol for the association, or a model (or an array of either, I think? TODO)\n child = parent[:for]\n # Pull a sybol or model out of Array (TODO: check if there's an Array)\n child = child.first if child.respond_to?(:first)\n # If it's an object, get a symbol from the class name\n child = child.class.name.underscore.to_sym unless child.is_a?(Symbol)\n \n key = \"#{parent[:builder].object_name}[#{child}_attributes]\"\n\n # TODO: One of the tests produces a scenario where duck is \"0\" and the test looks for a \"1\" \n # in the legend, so if we have a number, return it with a +1 until we can verify this scenario.\n return duck + 1 if duck.is_a?(Fixnum)\n \n # First try to extract key from duck Hash, then try child\n (duck[key] || duck[child]).to_i + 1\n end",
"def left_child(indx)\n 2*indx + 1\n end",
"def right_child(parent_index)\n right = 2 * parent_index + 2\n return -1 if right > (@array.size - 1)\n right\n end",
"def local_index( parent_array, parent_index, \n parent_local_map = parent_local_map( parent_array ) )\n\n size = @array_instance.size\n if local_index = parent_local_map[ parent_index ]\n local_index = size if local_index > size\n else\n # local index is after last parent element in array\n this_parent_index = parent_index - 1\n while this_parent_index >= 0\n break if local_index = parent_local_map[ this_parent_index ]\n this_parent_index -= 1\n end\n if parent_index >= parent_local_map.size\n local_index = local_index ? local_index + 1 : size\n end\n end\n \n return local_index\n \n end",
"def find(index)\n x = index\n while @parent_array[x] != 0\n x = @parent_array[x]\n end\n return x\n end",
"def each_child_with_index\n end",
"def get_parent(k)\n parent = (k - 1) / 2\n parent if parent >= 0\nend",
"def [](i)\n\t @children[i]\n\tend",
"def last_sibling_index(parent)\n return -1 if groups.empty?\n\n if parent.nil?\n parent_index = 0\n sibling_level = 1\n else\n parent_index = groups.find_index(parent)\n sibling_level = parent.level + 1\n end\n\n raise \"Could not find group #{parent.name}\" if parent_index.nil?\n\n (parent_index..(header.groups_count - 1)).each do |i|\n break i unless groups[i].level == sibling_level\n end\n end",
"def parent(child)\n if info = info_from_index(child)\n if info.parent && info.parent != root_info\n return create_index(info.parent.row, 0, info.parent.id)\n end\n end\n Qt::ModelIndex.new\n end",
"def index(row, column, parent)\n if info = info_from_index(parent)\n if child_info = info.children[row]\n return create_index(row, column, child_info.id)\n end\n end\n Qt::ModelIndex.new\n end",
"def find_element_parent(el_depth, index, ordering)\n\t\ti = index - 1\n\t\twhile i >= 0 #until the beginning\n\t\t\tif ordering[i].model == \"Node\" #if it's a node, not just a note\n\t\t\t\tcurr_node = Node.find(ordering[i].id)\n\t\t\t\tif el_depth > curr_node.depth #if curr_node has a lesser depth, it's its parent\n\t\t\t\t\treturn curr_node\n\t\t\t\tend\n\t\t\tend\n\t\t\ti = i-1\n\t\tend\n\t\treturn nil #if no parent found\n\tend",
"def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend",
"def parent\n map do |q|\n q.get_parent_element\n end\n end",
"def next_child_index (returning_fei)\n\n next_id = if returning_fei.is_a?(Integer)\n returning_fei + 1\n elsif returning_fei == self.fei\n 0\n else\n returning_fei.child_id.to_i + 1\n end\n\n loop do\n\n break if next_id > raw_children.length\n\n raw_child = raw_children[next_id]\n\n return next_id \\\n if raw_child.is_a?(Array) or raw_child.is_a?(FlowExpressionId)\n\n next_id += 1\n end\n\n nil\n end",
"def index_of(child)\n children.index(child)\n end",
"def find_prev_in(parent, index)\n while index >= 0\n c = parent.blocks[index]\n if c.context == :section\n return c if c.level == @chunk_level\n\n parent = c\n index = c.blocks.length\n end\n index -= 1\n end\n # index was for the first section in the parent so the previous page\n # *is* the parent.\n parent\n end",
"def left_child(index)\n left = index * 2 + 1\n if left >= @tree.length\n return INVALID_INDEX\n else\n return left\n end\n end",
"def parent_id\n self[self.nested_set_options[:parent_column]]\n end",
"def index(i=nil)\n temp = nil\n if i == nil\n if @index < 0\n temp = @indexes[0]\n else\n temp = @index\n end\n else\n temp = (i < 0 ? nil : @indexes[i])\n end\n return temp\n end",
"def parent_at_rank(rank)\n return self if self.rank == rank\n p = @parent\n i = 0\n while !p.nil?\n return p if p.rank == rank\n p = p.parent\n raise NameError, \"Loop detected among parents fo [#{self.display_name}]\" if i > 75 \n end\n nil \n end",
"def parent_id\n parent_ids.last\n end",
"def parent_id\r\n return nil unless ar_object\r\n ar_object[ar_p]\r\n end",
"def parent\n tree.parent_for(parent_id).first\n end",
"def nesting\n @parent ? @parent.nesting + 1 : 1\n end",
"def child(n)\n if n < 0\n raise Exceptions::ZipperError,\n \"child index cannot be negative\"\n end\n\n cursor = down\n until n.zero?\n cursor = cursor.next\n n -= 1\n end\n cursor\n end",
"def parent_set_without_child_set( parent_array, parent_index, \n parent_local_map = parent_local_map( parent_array ) )\n \n parent_index = parent_index < 0 ? parent_array.size + parent_index : parent_index\n \n if parent_index < parent_array.size\n parent_local_map[ parent_index ] = nil \n else\n parent_insert_without_child_insert( parent_array, parent_index, 1, parent_local_map )\n end\n \n return parent_index\n\n end",
"def parent\n self.parents.where('forestify_level = ?', self.forestify_level - 1).first\n end",
"def get_node(i=0)\n nodes.select {|a| a.number == i.to_i}.first\n end",
"def left_child_node(index)\n index * 2 + 1\n end",
"def visual_index\n row = @current_index\n row - @prow\n end",
"def parent_id\n object[\"parent_id\"]\n end",
"def child_index_left index\n [@d * index + 1, @heap.length-1].min\n end",
"def min_child(index)\n left_child_index = left_child(index)\n right_child_index = right_child(index)\n min_child_index = left_child_index\n if right_child_index != INVALID_INDEX && @tree[right_child_index] < @tree[left_child_index]\n min_child_index = right_child_index\n end\n return min_child_index\n end",
"def get_parent_id(position)\n if position.kind_of? Integer\n routes = @routes.reverse\n if routes.length > position\n return routes[position]\n elsif routes.count > 0\n return get_parent_id(position-1)\n end\n else\n return position != nil ? position : @routes.first\n end\n end",
"def at(i)\n return nil if @map.length == 0\n if i == 0\n left = 0\n else\n left = @map[i-1][0]+1\n end\n\n [@map[i][1],left,@map[i][0]]\n end",
"def parent_id\n data[:parent_id]\n end",
"def parent(node_id)\n node_id >> 1 # node_id / 2\n end",
"def parent_controls_parent_index?( parent_array, parent_index, \n parent_local_map = parent_local_map( parent_array ), \n local_parent_map = local_parent_map( parent_array ) )\n \n parent_controls_parent_index = false\n \n # when local takes control of a parent index, parent => local index mapping does not cease\n # instead, we track where it moves so that we can insert at precisely that point later if needed \n if @local_index_to_parent_map and\n local_index = parent_local_map[ parent_index ] and\n @local_index_to_parent_map[ local_index ].equal?( parent_array ) and\n parent_index == local_parent_map[ local_index ]\n\n parent_controls_parent_index = true\n\n end\n \n return parent_controls_parent_index\n \n end",
"def parent_id\n @values.fetch('ai.operation.parentId') { \n @values['ai.operation.parentId'] = nil\n }\n end",
"def getChildrenIdx(idx)\n [2 * idx + 1, 2 * idx + 2]\n end",
"def get_index(i)\n i/BITS_PER_ITEM\n end",
"def parent_notebook\n return @parent_notebook\n end",
"def parent_notebook\n return @parent_notebook\n end",
"def parent_notebook\n return @parent_notebook\n end",
"def parent_of( page )\n dir = page.directory\n\n loop do\n if @db.has_key? dir\n parent = @db[dir].find {|p| p.filename == 'index'}\n return parent unless parent.nil? or parent == page\n end\n\n break if dir.empty?\n dir = ::File.dirname(dir)\n dir = '' if dir == '.'\n end\n\n return\n end",
"def parent_set( parent_array, parent_index, \n parent_local_map = parent_local_map( parent_array ), \n local_parent_map = local_parent_map( parent_array ) )\n \n local_index = nil\n\n if parent_index >= parent_local_map.size\n local_index = parent_insert( parent_array, parent_index, 1, nil, parent_local_map, local_parent_map )\n elsif parent_controls_parent_index?( parent_array, parent_index, parent_local_map, local_parent_map )\n local_index = local_index( parent_array, parent_index, parent_local_map )\n @requires_lookup[ local_index ] = true\n end\n \n return local_index\n \n end",
"def parent_insert_without_child_insert( parent_array, parent_index, count, \n parent_local_map = parent_local_map( parent_array ), \n local_parent_map = local_parent_map( parent_array ) )\n \n # Insert new parent index correspondences.\n parent_index = parent_index < 0 ? parent_array.size + parent_index : parent_index\n count.times { |this_time| parent_local_map.insert( parent_index + this_time, nil ) }\n \n # Update any correspondences whose parent indexes are above the insert.\n local_parent_map.renumber_mapped_indexes_for_insert( parent_index, count )\n\n return parent_index\n\n end",
"def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def find_next_in(parent, index)\n loop do\n while (c = parent.blocks[index])\n return c if c.context == :section && c.level <= @chunk_level\n\n index += 1\n end\n return unless parent.parent\n return unless (index = parent.parent.blocks&.find_index parent)\n\n parent = parent.parent\n index += 1\n end\n end",
"def get_child(index)\n @children[index]\n end",
"def parent_id\n self.tagvalues[\"is_a\"].first\n end",
"def get_level\n level = 1\n p = parent\n while !p.nil?\n level += 1\n p = p.parent\n end\n \n return level\n end",
"def swim index\n parent_index = (index - 1) / 2\n\n # continue to bubble upward while we have not reached the root,\n # and while we are less than the parent element\n while (index > 0 && less_than?(index, parent_index))\n \n # swap the two values\n swap_values_at(index, parent_index)\n index = parent_index\n # set new parent index based on the bubble up\n parent_index = (index - 1) / 2\n end\n end",
"def parent\n\t\treturn parent_of @current_node\n\tend",
"def parent_id\n self.parent._id.to_s\n end",
"def get_child_positions\n @children.map { |x| x.idx }\n end",
"def level_index\n @level_index || 0\n end",
"def level_index\n @level_index || 0\n end",
"def parent_id\n return @values['ai.operation.parentId'] if @values.key?('ai.operation.parentId')\n @defaults['ai.operation.parentId']\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def rowCount(parent)\n if info = info_from_index(parent)\n info.children.size\n else 0\n end\n end",
"def parent(child)\n return (child - 1) / 2\nend",
"def parent_tag\n return nil unless within_open_tag?\n\n @tags_list.last\n end",
"def parent\n parents.empty? ? nil : parents[0]\n end",
"def parent\n\t\tself.residue_at_position(@parent_position)\n\tend",
"def get_child(index)\n \t@children[index]\n end",
"def ind=(i)\n\t\traise if i < 0\n\t\tindlevel=(i)\n\tend",
"def parent_list\n self.parent_lists[0]\n end",
"def heap_incease_key(i, key)\n\t\tif @heap.length <= i\n\t\t\treturn nil\n\t\tend \n\t\t@heap[i] = key\n\t\twhile i > 0 and parent(i) < @heap[i]\n\t\t\ttemp = @heap[i]\n\t\t\t@heap[i] = parent(i)\n\t\t\t@heap[parent_index(i)] = temp\n\t\t\ti = parent_index(i)\n\t\tend\n\t\t@heap\n\tend",
"def parent_id\n\n h.parent_id ?\n Ruote::FlowExpressionId.new(h.parent_id) :\n nil\n end",
"def level\n return 0 if root?\n\n @parent.level + 1\n end",
"def seq_index(seq)\n self.sliding_groups_of(seq.size).index(seq)\n end",
"def parent_document\n pi = parent_item\n return if pi == nil\n pi_id = pi.id\n return if pi_id == nil\n DocumentRepository.find(pi_id)\n end",
"def TreeView_GetParent(hwnd, hitem) TreeView_GetNextItem(hwnd, hitem, TreeViewGetNextItem[:PARENT]) end",
"def parent_position\n _response_word.fetch(\"parentPosition\", nil)\n end"
] |
[
"0.7558149",
"0.73898953",
"0.71897817",
"0.7093185",
"0.70867866",
"0.7070461",
"0.7049022",
"0.70467985",
"0.69362235",
"0.6783529",
"0.67319983",
"0.665753",
"0.66359806",
"0.6612102",
"0.6599606",
"0.65568405",
"0.6493102",
"0.6480639",
"0.63854927",
"0.62796384",
"0.62338525",
"0.60992956",
"0.6077879",
"0.60467064",
"0.6036805",
"0.598268",
"0.5925137",
"0.5884237",
"0.5866269",
"0.58604324",
"0.5845496",
"0.58379775",
"0.5827894",
"0.58112574",
"0.57860065",
"0.5721627",
"0.5709497",
"0.5671909",
"0.56383336",
"0.5614912",
"0.5589123",
"0.55860513",
"0.55830246",
"0.55125135",
"0.5484616",
"0.5469037",
"0.546816",
"0.5466699",
"0.5458709",
"0.5453018",
"0.545194",
"0.5430025",
"0.54183877",
"0.54029614",
"0.53899914",
"0.5385024",
"0.5375576",
"0.5370386",
"0.536878",
"0.536482",
"0.5352747",
"0.5344401",
"0.53413045",
"0.5333496",
"0.53191537",
"0.53191537",
"0.53191537",
"0.5311157",
"0.5310517",
"0.53056514",
"0.5299499",
"0.52936107",
"0.52931476",
"0.5267263",
"0.5266982",
"0.52398634",
"0.5238922",
"0.5234193",
"0.5225499",
"0.5221925",
"0.5221754",
"0.5221754",
"0.52204186",
"0.52183896",
"0.52183896",
"0.52059186",
"0.52024734",
"0.5182454",
"0.5157833",
"0.51499957",
"0.5149639",
"0.51337934",
"0.5129529",
"0.5129054",
"0.51230747",
"0.5120319",
"0.51116467",
"0.5102899",
"0.51003736",
"0.51002556"
] |
0.7501852
|
1
|
Returns the right child index of element at +i+.
|
def right(i)
i*2+2
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def right_child_index(i)\n (i * 2) + 1\n end",
"def left_child_index(i)\n i * 2\n end",
"def right_child_node(index)\n index * 2 + 2\n end",
"def right_child(index)\n right = index * 2 + 2\n if right >= @tree.length\n return INVALID_INDEX\n else\n return right\n end\n end",
"def right_child(parent_index)\n right = 2 * parent_index + 2\n return -1 if right > (@array.size - 1)\n right\n end",
"def get_child_index\n return 0\n end",
"def parent_index(i)\n (i / 2).floor\n end",
"def idx_children(parent_i)\n [parent_i * 2 + 1, parent_i * 2 + 2]\n end",
"def each_child_with_index\n end",
"def each_child_index\n end",
"def cfei_at(i)\n\n children.find { |cfei| Ruote.extract_child_id(cfei) == i }\n end",
"def [](i)\n\t @children[i]\n\tend",
"def index_of(child)\n children.index(child)\n end",
"def left_child(indx)\n 2*indx + 1\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def each_child_with_index(&block) # :yields: child_node, index\n children.each_with_index(&block)\n nil\n end",
"def left_child_node(index)\n index * 2 + 1\n end",
"def get_child(index)\n @children[index]\n end",
"def own_child_index\n return nil if parent.nil? # self is root\n own_index = nil\n parent.children.each_with_index { |c,i|\n if self == c\n own_index = i\n break\n end\n }\n own_index\n end",
"def child_index_right index\n [@d*index+@d, @heap.length-1].min\n end",
"def [](i)\n @elem[i]\n end",
"def get_child(index)\n \t@children[index]\n end",
"def [](i)\n\t\t\t@elements[i]\n\t\tend",
"def child(n)\n if n < 0\n raise Exceptions::ZipperError,\n \"child index cannot be negative\"\n end\n\n cursor = down\n until n.zero?\n cursor = cursor.next\n n -= 1\n end\n cursor\n end",
"def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend",
"def left_child(index)\n left = index * 2 + 1\n if left >= @tree.length\n return INVALID_INDEX\n else\n return left\n end\n end",
"def getChildrenIdx(idx)\n [2 * idx + 1, 2 * idx + 2]\n end",
"def next_child_index (returning_fei)\n\n next_id = if returning_fei.is_a?(Integer)\n returning_fei + 1\n elsif returning_fei == self.fei\n 0\n else\n returning_fei.child_id.to_i + 1\n end\n\n loop do\n\n break if next_id > raw_children.length\n\n raw_child = raw_children[next_id]\n\n return next_id \\\n if raw_child.is_a?(Array) or raw_child.is_a?(FlowExpressionId)\n\n next_id += 1\n end\n\n nil\n end",
"def left_child(parent_index)\n left = 2 * parent_index + 1\n return -1 if left > (@array.size - 1)\n left\n end",
"def [](index)\n children[index]\n end",
"def elem(i)\r\n @elemek[i]\r\n end",
"def child(index)\n @children[index]\n end",
"def part_position\n return self.parent.children.index(self) rescue nil\n end",
"def find_end_of_node_path(i)\n left_index = left_child_index(i)\n right_index = right_child_index(i)\n \n if left_index > @heap_size && right_index > @heap_size\n i\n elsif right_index > @heap_size\n left_index\n else\n max_child_index = -1\n left_child_value = self[left_index - 1]\n right_child_value = self[right_index - 1]\n if right_child_value && left_child_value > right_child_value\n max_child_index = left_index\n else\n max_child_index = right_index\n end\n find_end_of_node_path max_child_index\n end\n end",
"def index(i=nil)\n temp = nil\n if i == nil\n if @index < 0\n temp = @indexes[0]\n else\n temp = @index\n end\n else\n temp = (i < 0 ? nil : @indexes[i])\n end\n return temp\n end",
"def parent(i)\n (i-1)/2\n end",
"def at(i)\n return nil if @map.length == 0\n if i == 0\n left = 0\n else\n left = @map[i-1][0]+1\n end\n\n [@map[i][1],left,@map[i][0]]\n end",
"def position\n self.parent.children.index(self)\n end",
"def get_index(i)\n i/BITS_PER_ITEM\n end",
"def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend",
"def [](idx)\r\n to_a[idx] || element_class.new(@parent, :index => idx)\r\n end",
"def position\n root? ? 0 : parent.children.index(self)\n end",
"def get_node(i=0)\n nodes.select {|a| a.number == i.to_i}.first\n end",
"def [](i)\n @elements[i]\n end",
"def index(element); end",
"def parent(index)\n (index.to_f / 2).ceil - 1\n end",
"def [](index)\n @children[index]\n end",
"def [](index)\n elements.fetch(index, :left)\n end",
"def min_child(index)\n left_child_index = left_child(index)\n right_child_index = right_child(index)\n min_child_index = left_child_index\n if right_child_index != INVALID_INDEX && @tree[right_child_index] < @tree[left_child_index]\n min_child_index = right_child_index\n end\n return min_child_index\n end",
"def index_of_child child\n found = nil\n node_id = child.node_id\n each_with_index do |child, idx|\n next unless child.respond_to?(:node_id)\n if child.node_id == node_id\n found = idx\n break\n end\n end\n if ! found\n fail(\"no child of mine: (##{child.node_id} is not in #{node_id}\")\n end\n found\n end",
"def parent(index)\n case index\n when 0\n INVALID_INDEX\n else\n (index - 1) / 2\n end\n end",
"def parent_child_index(parent) #:nodoc:\n duck = parent[:builder].instance_variable_get('@nested_child_index')\n\n if duck.is_a?(Hash)\n child = parent[:for]\n child = child.first if child.respond_to?(:first)\n duck[child].to_i + 1\n else\n duck.to_i + 1\n end\n end",
"def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end",
"def [](i)\n return @structure if depth == 0\n @structure[i]\n end",
"def right_sibling\n list.first(:position.gt => position)\n end",
"def child_index_left index\n [@d * index + 1, @heap.length-1].min\n end",
"def element i=0\n @array[i]\n end",
"def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end",
"def child number\n unless @node.send(@children).nil?\n @node = ( ( @node.send(@children) ).at(number) )\n end\n end",
"def min_child(index)\n ch_e = (index + 1) * 2\n ch_o = (index * 2) + 1\n\n if @nodes[ch_e] && @nodes[ch_o]\n @compare_fn[@nodes[ch_e][:value], @nodes[ch_o][:value]] ? ch_e : ch_o\n elsif @nodes[ch_e]\n ch_e\n elsif @nodes[ch_o]\n ch_o\n else\n nil\n end\n end",
"def sink index\n loop do\n # define all other relevant index values\n last_item_index = size - 1\n l_child = 2 * index + 1\n r_child = 2 * index + 2\n # default to L in case of tie\n smaller_child = l_child\n # set smaller_child to right_child if that is a valid index and it is less than the left\n smaller_child = r_child if (r_child < last_item_index && less_than?(r_child, l_child))\n # if we are outside the bounds of our tree\n # or if we cannot sink item at `index` anymore\n break if (l_child >= last_item_index || less_than?(index, smaller_child))\n # otherwise, swap the values, \"bubbling\" the item down\n swap_values_at(smaller_child, index)\n # set the new index to the positions we've just moved to\n index = smaller_child\n end\n end",
"def parent(i); (i-1)/2; end",
"def parent_child_index(parent) # @private\n # Could be {\"post[authors_attributes]\"=>0} or { :authors => 0 }\n duck = parent[:builder].instance_variable_get('@nested_child_index')\n \n # Could be symbol for the association, or a model (or an array of either, I think? TODO)\n child = parent[:for]\n # Pull a sybol or model out of Array (TODO: check if there's an Array)\n child = child.first if child.respond_to?(:first)\n # If it's an object, get a symbol from the class name\n child = child.class.name.underscore.to_sym unless child.is_a?(Symbol)\n \n key = \"#{parent[:builder].object_name}[#{child}_attributes]\"\n\n # TODO: One of the tests produces a scenario where duck is \"0\" and the test looks for a \"1\" \n # in the legend, so if we have a number, return it with a +1 until we can verify this scenario.\n return duck + 1 if duck.is_a?(Fixnum)\n \n # First try to extract key from duck Hash, then try child\n (duck[key] || duck[child]).to_i + 1\n end",
"def find(index)\n x = index\n while @parent_array[x] != 0\n x = @parent_array[x]\n end\n return x\n end",
"def get_child_positions\n @children.map { |x| x.idx }\n end",
"def right_child(root, length)\n child = root * 2 + 2\n if child < length\n return child\n end\n return\nend",
"def find_right_entry\n maze[maze.length - 1].each_with_index do |value, index|\n return index if value == open_value\n end\n end",
"def position_to_index(position)\n position - 1\n end",
"def ele_index(class_name, index)\n raise 'Index must be >= 1' unless index == 'last()' || (index.is_a?(Integer) && index >= 1)\n\n elements = tags(class_name)\n\n if index == 'last()'\n result = elements.last\n else\n # elements array is 0 indexed\n index -= 1\n result = elements[index]\n end\n\n raise _no_such_element if result.nil?\n\n result\n end",
"def rightChild\r\n children[1]\r\n end",
"def getChildNode(xml, index)\n\n #puts \"XML -- \\n\\n#{xml}\"\n\t childCount = 0\n if(xml != nil && xml[\"childCount\"] != nil)\n\n childCount = xml[\"childCount\"].to_i\n \t\tif(index >= 0 && index < childCount)\n \t\t return xml[index]\n \t\tend\n end\n\t return nil\n\tend",
"def ele_index tag_name, index\n # XPath index starts at 1.\n raise \"#{index} is not a valid xpath index. Must be >= 1\" if index <= 0\n find_element :xpath, \"//#{tag_name}[#{index}]\"\n end",
"def elems_in_level(index)\n\treturn (Math.sqrt(2*(index+1)-1)-0.5).to_i + 1\nend",
"def [](index)\n get_node(index).element\n end",
"def node_by_index(index)\n subject.to_xml.to_a[index]\nend",
"def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end",
"def last_sibling_index(parent)\n return -1 if groups.empty?\n\n if parent.nil?\n parent_index = 0\n sibling_level = 1\n else\n parent_index = groups.find_index(parent)\n sibling_level = parent.level + 1\n end\n\n raise \"Could not find group #{parent.name}\" if parent_index.nil?\n\n (parent_index..(header.groups_count - 1)).each do |i|\n break i unless groups[i].level == sibling_level\n end\n end",
"def right(i)\n\treturn 2 * i + 2\nend",
"def match parser, index\r\n raise \"multiple element child not set\" unless child\r\n raise \"multiple element range not set\" unless range\r\n count = 0\r\n while count < range.last\r\n found = child.match parser, index\r\n break unless found\r\n index = found\r\n count += 1\r\n end\r\n report range === count ? index : NO_MATCH\r\n end",
"def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end",
"def indices(i)\n [(i/WIDTH),(i-1) % (WIDTH)]\n end",
"def index(element)\n each_with_index { |e, index| return index if e == element }\n nil\n end",
"def [](i)\n i = i + size if i < 0\n i >= size || i < 0 ? nil : @elements[i]\n end",
"def left(i)\n i*2+1\n end",
"def direction(find_index, current_index)\n # if the current key is less than the current key we need to select the \n # left hand track to traverse down\n if current_index > find_index\n return 'left_child'\n else\n # we travese down the right hand side\n return 'right_child'\n end\n end",
"def first_child\n child 0\n end",
"def node_at(index)\n if index >= self.size\n puts \"index out of range.\"\n else\n each_with_index do |node, i|\n return node if index == i \n end\n end\n end",
"def ind=(i)\n\t\traise if i < 0\n\t\tindlevel=(i)\n\tend",
"def getElem(i,j)\r\n #elindulunk az adott oszlop elso elemetol\r\n tempo=@oindex[j]\r\n #ha ez az eleme eleve rossz, vagy nem lehet ritka elem, ezt hamar visszateritjuk\r\n if i>=@m || j>=@n then return -999 end\r\n if tempo==-1 then return 0 end\r\n #kulonben keressuk a sorindexet\r\n (@oindex[j]...@nnn).each do |x|\r\n if @sor[x]==i then return @ertek[x] end\r\n end\r\n return 0\r\n\r\n end",
"def parent(node_index)\n return -1 if (node_index < 0) || (node_index > @count)\n return (node_index - 1)/2\n end",
"def right_child(node_id)\n (node_id << 1) | 1 # node_id * 2 + 1\n end",
"def last_element_child\n n = self.last_child\n while n do\n if n.node_type == ELEMENT_NODE then\n break\n end\n n = n.previous_sibling\n end\n return n\n end",
"def test_index # Test the [] method\n assert_raise(ArgumentError) {@root[nil]}\n\n @root << @child1\n @root << @child2\n assert_equal(@child1.name, @root['Child1'].name, \"Child 1 should be returned\")\n assert_equal(@child1.name, @root[0].name, \"Child 1 should be returned\")\n assert_equal(@child1.name, @root[-2].name, \"Child 1 should be returned\") # Negative access also works\n assert_equal(@child1.name, @root[-(@root.children.size)].name, \"Child 1 should be returned\") # Negative access also works\n\n assert_equal(@child2.name, @root['Child2'].name, \"Child 2 should be returned\")\n assert_equal(@child2.name, @root[1].name, \"Child 2 should be returned\")\n assert_equal(@child2.name, @root[-1].name, \"Child 2 should be returned\") # Negative access also works\n\n assert_nil(@root['Some Random Name'], \"Should return nil\")\n assert_nil(@root[99], \"Should return nil\")\n assert_nil(@root[-(@root.children.size+1)], \"Should return nil\")\n assert_nil(@root[-3], \"Should return nil\")\n end",
"def my_index(arg)\n self.each_with_index do |ele,idx|\n if ele == arg\n return idx\n end\n end\n return nil\n end",
"def [](i)\n case\n when i > 0\n return self.fetch(i)\n when i < 0\n return -self[-i]\n end\n end",
"def swim index\n parent_index = (index - 1) / 2\n\n # continue to bubble upward while we have not reached the root,\n # and while we are less than the parent element\n while (index > 0 && less_than?(index, parent_index))\n \n # swap the two values\n swap_values_at(index, parent_index)\n index = parent_index\n # set new parent index based on the bubble up\n parent_index = (index - 1) / 2\n end\n end",
"def get_index_of_biggest_child index\n childs = []\n left_index = child_index_left(index)\n right_index = child_index_right(index)\n for i in left_index..right_index\n childs << @heap[i]\n end\n childs.index(childs.max)+left_index\n end",
"def index_at(element)\n find_element(element, :index)\n end",
"def child_index=(idx)\n move_to_child_with_index(parent, idx.to_i) unless new_record?\n end",
"def [](i)\n case i\n when Fixnum then self.content[i]\n else super(i)\n end\n end"
] |
[
"0.8359343",
"0.7713796",
"0.70983934",
"0.7077139",
"0.694932",
"0.66142154",
"0.66010356",
"0.65927094",
"0.6537299",
"0.65241504",
"0.6516412",
"0.6501256",
"0.6467879",
"0.6342492",
"0.6287001",
"0.6287001",
"0.62674755",
"0.6220796",
"0.6219898",
"0.6175682",
"0.61755466",
"0.6143386",
"0.6071368",
"0.60501087",
"0.6047716",
"0.60220397",
"0.60189706",
"0.5988138",
"0.5961976",
"0.5957714",
"0.59506184",
"0.5890288",
"0.5841629",
"0.5806585",
"0.57703197",
"0.5751023",
"0.5736991",
"0.5730711",
"0.57243365",
"0.56998813",
"0.5692243",
"0.5684097",
"0.5682209",
"0.56359977",
"0.5627357",
"0.56233615",
"0.56222004",
"0.55992234",
"0.55915",
"0.5582234",
"0.5574518",
"0.55698586",
"0.5557021",
"0.55459183",
"0.55266273",
"0.54846746",
"0.54524326",
"0.54268235",
"0.5424362",
"0.5402977",
"0.5401045",
"0.53801996",
"0.537276",
"0.536952",
"0.5369442",
"0.53554314",
"0.5330484",
"0.5314655",
"0.5309539",
"0.53082025",
"0.5282953",
"0.5276247",
"0.5266228",
"0.5225369",
"0.5218744",
"0.521375",
"0.52111286",
"0.52020913",
"0.5184017",
"0.5179825",
"0.5179825",
"0.517482",
"0.5174133",
"0.51735294",
"0.51647395",
"0.51244646",
"0.51197493",
"0.51184267",
"0.5109363",
"0.51056695",
"0.5085404",
"0.508147",
"0.5074863",
"0.5065449",
"0.5062867",
"0.5056619",
"0.5053922",
"0.50431186",
"0.5010587",
"0.50060546"
] |
0.53131205
|
68
|
Returns the left child index of element at +i+.
|
def left(i)
i*2+1
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def left_child_index(i)\n i * 2\n end",
"def left_child(index)\n left = index * 2 + 1\n if left >= @tree.length\n return INVALID_INDEX\n else\n return left\n end\n end",
"def left_child(parent_index)\n left = 2 * parent_index + 1\n return -1 if left > (@array.size - 1)\n left\n end",
"def left_child(indx)\n 2*indx + 1\n end",
"def right_child_index(i)\n (i * 2) + 1\n end",
"def left_child_node(index)\n index * 2 + 1\n end",
"def left_sibling\n list.reverse.first(:position.lt => position)\n end",
"def left(index)\r\n\t\t2*index + 1\r\n\tend",
"def left(i)\n\treturn 2*i + 1\nend",
"def child_index_left index\n [@d * index + 1, @heap.length-1].min\n end",
"def parent_index(i)\n (i / 2).floor\n end",
"def left\n row, col = @position\n return [row, col - 1] unless col - 1 < 0\n []\n end",
"def [](index)\n elements.fetch(index, :left)\n end",
"def at(i)\n return nil if @map.length == 0\n if i == 0\n left = 0\n else\n left = @map[i-1][0]+1\n end\n\n [@map[i][1],left,@map[i][0]]\n end",
"def left\n self.position[:x]\n end",
"def leftChild\r\n children.first\r\n end",
"def left_sibling\n siblings.\n where( arel[position_column].lt(self[position_column]) ).\n reorder( arel[position_column].desc ).\n first\n end",
"def position\n root? ? 0 : parent.children.index(self)\n end",
"def left_child(root, length)\n child = root * 2 + 1\n if child < length\n return child\n end\n return\nend",
"def getWidgetLeft(w)\n checkWidgetParent(w)\n return DOM.getAbsoluteLeft(w.getElement) - DOM.getAbsoluteLeft(getElement())\n end",
"def part_position\n return self.parent.children.index(self) rescue nil\n end",
"def min_child(index)\n left_child_index = left_child(index)\n right_child_index = right_child(index)\n min_child_index = left_child_index\n if right_child_index != INVALID_INDEX && @tree[right_child_index] < @tree[left_child_index]\n min_child_index = right_child_index\n end\n return min_child_index\n end",
"def left\n return @left\n end",
"def left\n return @left\n end",
"def left\n self[self.nested_set_options[:left_column]] || 0\n end",
"def left\n position.x\n end",
"def left(i); 2*i+1; end",
"def get_child_index\n return 0\n end",
"def left_child(node_id)\n node_id << 1 # node_id * 2\n end",
"def getAbsoluteLeft\n DOM.getAbsoluteLeft(@element)\n end",
"def parent(i)\n (i-1)/2\n end",
"def right_child_node(index)\n index * 2 + 2\n end",
"def left(n = 1)\n @cursor = [0, @cursor - n].max\n end",
"def left(n = 1)\n @cursor = [0, @cursor - n].max\n end",
"def right_child(parent_index)\n right = 2 * parent_index + 2\n return -1 if right > (@array.size - 1)\n right\n end",
"def position\n self.parent.children.index(self)\n end",
"def left_sibling\n higher_items.last\n end",
"def left_cell_x(x = @x); self.class.left_cell_x_at(x); end",
"def parent(i)\n\treturn ((i+1)/2).floor-1 #could be simpler\nend",
"def find_left_entry\n maze[0].each_with_index do |value, index|\n return index if value == open_value\n end\n end",
"def left_siblings\n siblings.where( table[tree.columns.position].lteq(position) )\n end",
"def first_child\n child 0\n end",
"def idx_children(parent_i)\n [parent_i * 2 + 1, parent_i * 2 + 2]\n end",
"def min_left_child(node)\n if node.left_child.nil?\n return node\n end\n\n return min_left_child(node.left_child)\n end",
"def left_position\n if page_number.even?\n bounds.left + layout.margin.outer\n else\n bounds.left + layout.margin.inner\n end\n end",
"def left_sibling\n siblings.filter(self.class.qualified_left_column < left).order(self.class.qualified_left_column.desc).first\n end",
"def first_child\n children.min_by { |x| x.position}\n end",
"def left_sibling\n base_class.first scoped(parent_column_name => _parent_id, left_column_name => { '$lt' => left }, :order => \"#{left_column_name} DESC\")\n end",
"def child_index_right index\n [@d*index+@d, @heap.length-1].min\n end",
"def right_child(index)\n right = index * 2 + 2\n if right >= @tree.length\n return INVALID_INDEX\n else\n return right\n end\n end",
"def left_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col-1, cell.row)}\n end",
"def parent(index)\n case index\n when 0\n INVALID_INDEX\n else\n (index - 1) / 2\n end\n end",
"def left\n @ole.Left\n end",
"def left\n @ole.Left\n end",
"def parent(i); (i-1)/2; 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 each_child_with_index\n end",
"def parent_relative_left\n left - (parent.try(:left) || 0)\n end",
"def sel_left\n [sel_x, pos_x].min\n end",
"def move_left\n move_to_left_of left_sibling\n end",
"def min_child(index)\n ch_e = (index + 1) * 2\n ch_o = (index * 2) + 1\n\n if @nodes[ch_e] && @nodes[ch_o]\n @compare_fn[@nodes[ch_e][:value], @nodes[ch_o][:value]] ? ch_e : ch_o\n elsif @nodes[ch_e]\n ch_e\n elsif @nodes[ch_o]\n ch_o\n else\n nil\n end\n end",
"def each_child_index\n end",
"def cursor_left(wrap)\n if @index % 10 > 0\n @index -= 1\n elsif wrap\n @index += 9\n end\n end",
"def getLeft\n return @x\n end",
"def left(i)\n return 2*i\nend",
"def left_child\n # Returns left_child unless it's nil\n return @left_child unless @left_child.nil?\n\n # If passed the guard, left_child was not calculated yet, so generates it,\n # stores a ref and return the node\n @left_child = calculate_left_child\n @left_child\n end",
"def left_right(key, node)\n case child_count(node)\n when 1\n node.left.nil? ? node.right : node.left\n when 2\n node.data > key ? node.left : node.right\n end\n end",
"def parent(index)\n (index.to_f / 2).ceil - 1\n end",
"def own_child_index\n return nil if parent.nil? # self is root\n own_index = nil\n parent.children.each_with_index { |c,i|\n if self == c\n own_index = i\n break\n end\n }\n own_index\n end",
"def [](i)\n\t @children[i]\n\tend",
"def left\n @x\n end",
"def index(i=nil)\n temp = nil\n if i == nil\n if @index < 0\n temp = @indexes[0]\n else\n temp = @index\n end\n else\n temp = (i < 0 ? nil : @indexes[i])\n end\n return temp\n end",
"def scroll_left\n self.scroll[:x]\n end",
"def top_left\n row, col = @position\n return [row - 1, col - 1] unless row - 1 < 0 || col - 1 < 0\n []\n end",
"def parent(node_index)\n return -1 if (node_index < 0) || (node_index > @count)\n return (node_index - 1)/2\n end",
"def right_sibling\n list.first(:position.gt => position)\n end",
"def scrollLeft\n `#{@el}.scrollLeft`\n end",
"def left\n @x_min\n end",
"def calculate_left_child\n # Guard condition for movement not possible\n return nil if blank_x + 1 == size\n\n # Make the movement\n new_state = swap_left\n\n # Avoids loop\n parents_array = parent_states(3)\n return nil if parents_array.include?(new_state)\n\n # Returns new node\n Node.new(new_state, self, blank_x + 1, blank_y)\n end",
"def left\n @widget.margins.left + @widget.borders.left\n end",
"def topleft; return self[0,2].to_a; end",
"def left\n index = FACES.find_index(@face)\n if index > MIN_LEFT\n @face = FACES[index-1]\n else\n @face = FACES[3]\n end\n end",
"def left_child?(node_id)\n (node_id & 1) == 0 # node_id % 2 == 0\n end",
"def move_left\n self.move_to_left_of(self.left_sibling)\n end",
"def level_index\n @level_index || 0\n end",
"def level_index\n @level_index || 0\n end",
"def leftClicked\n\t\t@first.leftClicked\n\tend",
"def parent(index)\n # Ruby automatically floors integers\n return (index - 1) / 2 if index.even?\n index / 2 \n end",
"def cfei_at(i)\n\n children.find { |cfei| Ruote.extract_child_id(cfei) == i }\n end",
"def bisect_left(a, e, l = 0, u = a.length)\n while l < u\n m = l + (u-l).div(2)\n\n if a[m] > e\n l = m+1\n else\n u = m\n end\n end\n\n return l\n end",
"def find_min_element_iterative(root)\n return nil if !root\n while root.left_child\n root = root.left_child\n end\n root\nend",
"def left()\n @view__.left\n end",
"def part_of_row_left(starting, ending)\n row(starting[1])[(ending[0] + 1)..(starting[0] -1)]\n end",
"def get_index(i)\n\t\tif (!@head || @size < i+1)then return false end\n\t\tcurrent = this.head\n\t\tcount = 0\n\t\twhile (count < i) #go to the index\n\t\t\tcurrent = current.get_next()\n\t\t\tcount+=1\n\t\tend\n\t\treturn current.get_item()\n\tend",
"def bisect_left(a, e, l = 0, u = a.length)\n while l < u\n m = l + (u-l).div(2)\n \n if a[m] > e\n l = m+1\n else\n u = m\n end\n end\n \n return l\n end",
"def get_node(i=0)\n nodes.select {|a| a.number == i.to_i}.first\n end",
"def getParentIdx(idx)\n (idx-1)/2.0.floor if (idx > 0)\n end",
"def get_child_positions\n @children.map { |x| x.idx }\n end",
"def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end",
"def nodes_except_self_leftward\n LinkEnumerator.new :left, self\n end"
] |
[
"0.7992498",
"0.75561506",
"0.73425823",
"0.7250473",
"0.72252685",
"0.71124744",
"0.6747664",
"0.6571397",
"0.6561146",
"0.6510751",
"0.6406521",
"0.6373032",
"0.62634426",
"0.6245162",
"0.6222734",
"0.6217514",
"0.62061405",
"0.6140762",
"0.612902",
"0.6113794",
"0.60877943",
"0.59903425",
"0.59881043",
"0.59881043",
"0.59863275",
"0.5967793",
"0.5952844",
"0.59465873",
"0.5944125",
"0.59400886",
"0.59057575",
"0.5857254",
"0.5850181",
"0.5850181",
"0.58219975",
"0.58160084",
"0.5799572",
"0.57644415",
"0.5731399",
"0.5730384",
"0.5730058",
"0.5697806",
"0.56951135",
"0.56941974",
"0.56864506",
"0.56863683",
"0.56460565",
"0.5634808",
"0.56207055",
"0.56166476",
"0.56092644",
"0.56066227",
"0.56064796",
"0.56064796",
"0.55868286",
"0.5574827",
"0.55379754",
"0.5536497",
"0.55259",
"0.55222404",
"0.5521067",
"0.5511468",
"0.54755765",
"0.5461623",
"0.54610497",
"0.5459008",
"0.5411362",
"0.5401599",
"0.539315",
"0.53856444",
"0.53676695",
"0.5356879",
"0.535558",
"0.53553134",
"0.53509843",
"0.53481513",
"0.53423434",
"0.53420997",
"0.5339153",
"0.5287724",
"0.528448",
"0.5242322",
"0.5226931",
"0.5205965",
"0.52034575",
"0.52034575",
"0.519726",
"0.51965106",
"0.5190897",
"0.5187112",
"0.518052",
"0.5178546",
"0.51776063",
"0.5165821",
"0.5159305",
"0.5157692",
"0.51506823",
"0.5148432",
"0.5142375",
"0.51324207"
] |
0.6891426
|
6
|
Heapifies the element at position +i+.
|
def heapify(i)
left = left(i)
right = right(i)
target = i
if left < @elements.size and @comparator.call(@elements[i],@elements[left]) < 0
target = left
end
if right < @elements.size and @comparator.call(@elements[target],@elements[right]) < 0
target = right
end
unless target == i
swap(target,i)
heapify(target)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def minheapify(i=0)\n\t\tn_heapify(@min, i)\n\t\t@heap\n\tend",
"def heap_up(i)\n return if i == 0\n\n pnode = (i-1) / 2\n if @store[i].key < @store[pnode].key\n swap(i, pnode)\n heap_up(pnode)\n end\n end",
"def heapify\n for i in (0..(@ary.size-1)).to_a.reverse\n upheap(i)\n downheap(i)\n end\n end",
"def max_heapify!(i)\n l = left(i)\n r = right(i)\n\n if l < self.heapsize && self[l] > self[i]\n largest = l\n else\n largest = i\n end\n\n if r < self.heapsize && self[r] > self[largest]\n largest = r\n end\n\n if largest != i\n exchange(i, largest)\n max_heapify!(largest)\n end\n\n return self\n end",
"def minheapify_heapsort(p, i = 0)\n\t\tn_heapify_heapsort(@min, p, i)\n\tend",
"def heapify(index)\n item = @items[index]\n parent = parent(index)\n left_child = left_child(index)\n right_child = right_child(index)\n if (parent && parent.attrib > item.attrib)\n swap(parent.index, index)\n elsif (left_child && right_child && left_child.attrib < item.attrib &&\n right_child.attrib < item.attrib)\n if (left_child.attrib < right_child.attrib)\n swap(index, left_child.index)\n else\n swap(index, right_child.index)\n end\n elsif (left_child && left_child.attrib < item.attrib)\n swap(index, left_child.index)\n elsif (right_child && right_child.attrib < item.attrib)\n swap(index, right_child.index)\n end\n end",
"def build_heap\n unless @elements.empty?\n i = (@elements.size-1)/2\n while i>=0\n heapify(i)\n i -= 1\n end\n end\n end",
"def heap_incease_key(i, key)\n\t\tif @heap.length <= i\n\t\t\treturn nil\n\t\tend \n\t\t@heap[i] = key\n\t\twhile i > 0 and parent(i) < @heap[i]\n\t\t\ttemp = @heap[i]\n\t\t\t@heap[i] = parent(i)\n\t\t\t@heap[parent_index(i)] = temp\n\t\t\ti = parent_index(i)\n\t\tend\n\t\t@heap\n\tend",
"def heapify(queue)\n (queue.length - 1).downto(1) do |i|\n if queue[i].value > queue[i-1].value\n queue[i], queue[i-1] = queue[i-1], queue[i]\n else\n break\n end\n end\n end",
"def heapify!\n (length / 2).downto(1) { |i| sink(i) }\n end",
"def heapify_downward(i)\n #find the lowest node index that the node i could fall to\n end_node_index = find_end_of_node_path(i)\n \n #stash the value of node i for later\n start_node_value = self[i - 1] \n\n #search for the eventual final index where node i will fall\n swap_node_index = search_path_for_insert_position(i, end_node_index, start_node_value)\n \n #Move all parent nodes from the swap node index, up one level\n traversing_node_index = swap_node_index \n swap_node_value = self[traversing_node_index - 1]\n parent_value = self[parent_index(traversing_node_index) - 1]\n while traversing_node_index != i \n traversing_node_index = parent_index(traversing_node_index)\n self[traversing_node_index - 1] = swap_node_value\n swap_node_value = parent_value\n parent_value = self[parent_index(traversing_node_index) - 1]\n end\n \n #finally set the swap node index value to be our initial value \n self[swap_node_index - 1] = start_node_value \n end",
"def sift_up(i)\n parent = (i - 1) / 2\n if parent >= 0 and @heap[parent] > @heap[i]\n @heap[parent], @heap[i] = @heap[i], @heap[parent]\n sift_up(parent)\n end\n end",
"def max_heapify(index)\n if self.left_i(index) > (self.size - 1) && self.right_i(index) > (self.size - 1)\n self.max_heapify_bottom_up(index)\n else\n self.max_heapify_top_down(index)\n end\n end",
"def build_minheap\n\t\ti = @heap.length/2\n\t\twhile i >= 0\n\t\t\tminheapify(i)\n\t\t\ti -= 1\n\t\tend\n\tend",
"def build_heap\n @heap_size = length\n (length / 2).floor.downto(1) do |i| \n heapify_downward i \n end\n end",
"def insert_into_min_heap(heap, element)\n heap << element\n current_index = heap.length\n\n while current_index > 1 && element < heap[(current_index / 2) - 1]\n larger_element = heap[(current_index / 2) - 1]\n\n heap[(current_index / 2) - 1] = element\n heap[current_index - 1] = larger_element\n\n current_index = (current_index / 2)\n end\n\n heap\nend",
"def heapify(array, heap_size, index)\n return if index >= heap_size\n\n l = index * 2 + 1\n r = index * 2 + 2\n\n largest = index\n\n largest = l if l < heap_size && array[l] > array[largest]\n largest = r if r < heap_size && array[r] > array[largest]\n\n if largest != index\n swap(array, index, largest)\n\n # propogate change on subtree\n heapify(array, heap_size, largest)\n end\n\n array\nend",
"def sift_down(i)\n child = (i * 2) + 1\n return if child >= @heap.length\n child += 1 if child + 1 < @heap.length and @heap[child] > @heap[child+1]\n if @heap[i] > @heap[child]\n @heap[child], @heap[i] = @heap[i], @heap[child]\n sift_down(child)\n end\n end",
"def heapify(**val)\n val.each do |k, v|\n insert(k, v)\n end\n val.length\n end",
"def push(val)\n @store << val\n idx = count - 1\n @store = BinaryMinHeap.heapify_up(@store, idx, &prc)\n end",
"def heapify(index)\n #Assume the left and right subroots are already valid heaps\n\n return if(leftChild(index)==nil && rightChild(index)==nil)\n\n if leftChild(index)!=nil && @store[index]<leftChild(index) then\n mini=index\n else\n mini=2*index\n end\n\n if rightChild(index)!=nil && @store[mini]>rightChild(index) then\n mini=2*index+1\n end\n\n if mini!=index then\n swap(index,mini)\n #call heapfiy recursively on minindex\n heapify(mini) \n end\n end",
"def heapify!(array)\n @data = array\n (0..(@data.size / 2 - 1)).to_a.reverse.each { |i| percolate_down i }\n return self\n end",
"def heapsort(list)\n array = []\n myHeap = MinHeap.new()\n #return myHeap.store\n list.each do |item|\n myHeap.add(item)\n puts item \n end\n\n until myHeap.empty?\n array << myHeap.remove()\n end\n return array\nend",
"def heap!(list)\n\t\tlen = list.length-1\n\t\t#heapify\n\t\t((len)/2).downto(0) { |b| heapify(list, b, list.length-1) }\n\n\t\t(len).downto(1) do |e|\n\t\t\tlist[0], list[e] = list[e], list[0]\n\t\t\theapify(list, 0, e-1)\n\t\tend\n\tend",
"def max_heapify_bottom_up(index)\n if parent_i(index) && self[parent_i(index)] < self[index] \n self.swap(parent_i(index), index)\n max_heapify_bottom_up(parent_i(index))\n end\n end",
"def heapify(index)\n left = @tree[left(index)]\n right = @tree[right(index)]\n current = @tree[index]\n if !left && !right # if no children exist nothing to compare with\n nil\n elsif left && !right\n if left.rating < current.rating\n temp = @tree[index]\n @tree[index] = @tree[left]\n @tree[left] = temp\n #no need to heapify at a leaf\n end\n elsif left.rating < current.rating || right.rating < current.rating\n if @tree[left].rating <= @tree[right].rating\n temp = @tree[index] #current index and left swap if it's the smaller of two children\n @tree[index] = @tree[left]\n @tree[left] = temp\n heapify(left(index))\n elsif @tree[right].rating < @tree[left].rating\n temp = @tree[index] #current index and left swap if it's the smaller of two children\n @tree[index] = @tree[right]\n @tree[right] = temp\n heapify(right(index))\n end\n end\n end",
"def heapsort()\n\t\tbuild_minheap()\n\t\ti = @heap.length-1\n\t\twhile i >= 1\n\t\t\ttemp = @heap[i]\n\t\t\t@heap[i] = @heap[0]\n\t\t\t@heap[0] = temp\n\t\t\tminheapify_heapsort(i)\n\t\t\ti -= 1\n\t\tend\n\t\t@heap\n\tend",
"def heap_sort(list)\n heap = MinHeap.new\n\n list.each do |int|\n heap.add(int)\n end\n\n i = 0 \n \n until i == list.length\n list[i] = heap.remove\n i += 1\n end\n\n return list;\nend",
"def heap_up(index)\n until index == 0 || @store[index].key >= @store[((index - 1) / 2)].key\n parent = (index - 1) / 2\n swap(parent, index) if @store[parent].key > @store[index].key\n index = parent\n end\n end",
"def heapsort(list)\n sorted_arr = []\n heap = MinHeap.new()\n list.each do |value|\n heap.add(value, value)\n end \n\nlist.length.times do |i|\n min = heap.remove()\n sorted_arr.push(min)\nend \nreturn sorted_arr\nend",
"def build_heap(array)\n first_parent_index = (array.length - 2) / 2\n (first_parent_index..0).each do |current_index|\n sift_down(current_index, array.length - 1, array)\n end\n end",
"def heap_sort(arr)\n (arr.length - 1).downto(1).each do |i|\n p \"i = #{i},arr[i] = #{arr[i]},arr[0] is #{arr[0]},arr = #{arr}\"\n # 打乱顺序\n # 然后上一轮的最小值\n # 就永远回不去顶端了\n # 因为 i 值不断缩小\n # 比较的范围越来越小\n arr[i], arr[0] = arr[0], arr[i]\n p \"---arr = #{arr}\"\n min_heap_fixdown(arr, 0, i)\n p \"===arr = #{arr}\"\n end\n arr\nend",
"def heap_up(index)\n parent_index = (index - 1) / 2\n\n unless @store[parent_index].key < @store[index].key || index <= 0 \n swap(parent_index, index)\n heap_up(parent_index)\n end\n end",
"def insert(element)\n insertindex=@store.length\n\n @store[@store.length]=element\n return if insertindex==1\n\n #For even inserts parent index is insertedindex/2-1 otherwise its juts insertedindex/2\n\n parentindex=insertindex/2\n\n #Incase it does not fit in(violating Heap Property)\n while insertindex!=1 && @store[parentindex] > @store[insertindex]\n swap(parentindex,insertindex)\n insertindex=parentindex\n parentindex=insertindex/2\n end\n\n end",
"def heap_up(index)\n puts to_s\n parent_index = find_parent(index)\n if @store[parent_index].key <= @store[index].key || index == 0\n return\n end \n if @store[parent_index].key > @store[index].key\n # puts @store[index].value\n swap(parent_index, index)\n index = parent_index\n heap_up(index)\n end\n end",
"def insert(value)\n @heap << value\n perc_up(@heap.length - 1)\n end",
"def build_heap(array)\n first_parent_idx = (array.length - 1) / 2\n (first_parent_idx).downto(0).each { |current_idx| \n self.sift_down(current_idx, array.length - 1, array)\n }\n return array\n end",
"def heap_down(index)\n n = @store.size\n while index * 2 + 1 < n\n j = index * 2 + 1\n\n j += 1 if j < n - 1 && @store[j + 1].key < @store[j].key\n\n break if @store[index].key <= @store[j].key\n\n @store[index], @store[j] = @store[j], @store[index]\n index = j\n end\n end",
"def min_heapify(idx)\n l = left(idx)\n r = right(idx)\n smaller = idx\n smaller = l if l <= @size && elem(l) < elem(idx)\n smaller = r if r <= @size && elem(r) < elem(smaller)\n swap(smaller, idx) if smaller != idx\n min_heapify(smaller) if smaller != idx\n end",
"def max_heap_insert(key)\n\t\t@heap.push(-1)\n\t\theap_incease_key(@heap.length-1, key)\n\tend",
"def heap_down(index)\n puts 'heap down'\n puts to_s\n child_index = 2*index + 1\n if index >= @store.length - 1 || child_index >= @store.length - 1\n return\n end\n if @store[child_index].key >= @store[index].key\n return\n end \n if @store[child_index].key < @store[index].key\n swap(child_index, index)\n index = child_index\n heap_down(index)\n end\n end",
"def heapify(min_heap, hash_table, index)\n smallest = index\n left_child = 2 * index + 1\n right_child = 2 * index + 2\n if (left_child < min_heap.length) && (min_heap[left_child][1] < min_heap[smallest][1])\n smallest = left_child\n end\n if (right_child < min_heap.length) && (min_heap[right_child][1] < min_heap[smallest][1])\n smallest = right_child\n end\n if smallest != index\n hash_table[min_heap[index][0] - 1][1] = smallest\n hash_table[min_heap[smallest][0] - 1][1] = index\n min_heap[smallest], min_heap[index] = min_heap[index], min_heap[smallest]\n heapify(min_heap, hash_table, smallest)\n end\nend",
"def heap_up(index)\n # get parent index based on child's position\n parent_index = (index - 1) / 2\n\n # return the array if there's no parent, or parent is less than or equal to child\n return @store if parent_index < 0 || @store[index].key >= @store[parent_index].key\n\n swap(parent_index, index)\n\n # call recursively on child's new position\n heap_up(parent_index)\n end",
"def heapify(key = 0)\n # Assume left and right children follow heap property\n value = get(key)\n return if value == nil\n\n larger_child_key = larger_child(key)\n larger_value = get(larger_child_key)\n\n if larger_value != nil && larger_value > value\n @data[key] = @data[larger_child_key]\n @data[larger_child_key] = key\n heapify(larger_child_key)\n end\n end",
"def swap_values_at i, j\n value_i = @heap[i]\n value_j = @heap[j]\n\n @heap[i] = value_j\n @heap[j] = value_i\n\n map_swap(value_i, value_j, i, j)\n end",
"def heapsort(array)\r\n\t#create a heap from an array\r\n\theap = MaxHeap.new(array)\r\n\theap.buildMaxHeap\r\n\t\r\n\t#puts heap.array\r\n\t#puts \"_____\"\r\n\t#puts \"array size = #{heap.arraysize}\"\r\n\t\r\n\t(heap.arraysize).downto(2) do |i|\r\n\t\t#exchange of largest data point with end of the array\r\n\t\ttemp = heap.array[0]\r\n\t\theap.array[0] = heap.array[i-1]\r\n\t\theap.array[i-1] = temp\r\n\t\t\r\n\t\t#decrement size of the heap so that the last value stays in the array, but does not get sorted\r\n\t\theap.heapsize -=1\r\n\t\theap.maxHeapify(0)\r\n\t\t#puts \"**____**\"\r\n\t\t#puts \"i is equal to #{i}\"\r\n\t\r\n\t\t#puts heap.array\r\n\t\t#puts \"**_~~_**\"\r\n\tend\r\n\tputs heap.array\r\nend",
"def insert(value)\n @heap.append(value)\n self.sift_up(@heap.length - 1, @heap)\n end",
"def heapsort(list)\n heap = MinHeap.new\n list.each do |number|\n # apply the .add instance method \n heap.add(number)\n end\n\n list.each_with_index do |number, index|\n list[index] = heap.remove()\n end \n return list\nend",
"def heap_up(index)\n # base case\n parent_index = (index - 1) / 2\n return if parent_index < 0 || @store[index].key >= @store[parent_index].key\n\n # swap\n @store[index], @store[parent_index] = @store[parent_index], @store[index]\n # recursive case\n heap_up(parent_index)\n end",
"def insert(key, value = key)\n raise ArgumentError, 'Heap keys must not be nil' unless key\n n = Hash[key: key, value: value]\n # 1. Append to end\n @nodes << n\n # We need to keep track of inserted node's index\n # so that when we bubble up we adjust it and not keep\n # looking for it\n ins_i = size - 1\n \n # 2. Satisfy the heap property (bubble-up):\n # Move the newly inserted node up the tree as long as\n # it is smaller than its parent\n unless size == 1\n while @compare_fn[@nodes[ins_i][:value], @nodes[parent(ins_i)][:value]]\n swap(parent(ins_i), ins_i)\n ins_i = parent(ins_i)\n break if ins_i == 0\n end\n end\n # Return the final index of the inserted element after re-ordering\n ins_i\n end",
"def heapify(num)\n left = num * 2\n right = num * 2 + 1\n\n if left <= @heapSize && @heap[left] > @heap[num]\n largest = left\n else\n largest = num\n end\n\n if right <= @heapSize && @heap[right] > @heap[largest]\n largest = right\n end\n\n if(largest != num)\n tmp = @heap[num]\n @heap[num] = @heap[largest]\n @heap[largest] = tmp\n heapify(largest)\n end\n end",
"def heap_up(index)\n parent = (index - 1) / 2\n bottom = @store[index]\n\n if index > 0 && @store[parent].key > bottom.key \n swap(index, parent)\n heap_up(parent)\n end \n end",
"def heap_up(index)\n # base case: index is 0 \n if index > 0 \n # we need to subtract 1 from index to account for 0-indexing\n parent_i = (index - 1)/2\n\n # make sure its sibling isn't smaller, else swap them\n # i think technically you can just change which index\n # index is compared to, but the test got mad at me when i tried\n # that and i'm not sure how to avoid that, so i just swapped them \n # so i wouldn't have to change parent_i\n if @store[parent_i + 1].key < @store[parent_i].key \n swap(parent_i + 1, parent_i) \n end\n\n # check if swap needs to happen\n if @store[index].key < @store[parent_i].key\n swap(index, parent_i) \n heap_up(parent_i) # recursive call to keep bubbling up \n end\n\n # don't need to recursive call if reaches here; at correct position\n end\n end",
"def insert(value)\n self.heap.append(value)\n self.sift_up(self.heap.length-1, self.heap)\n end",
"def heap_down(index)\n until (index * 2 + 1) > @store.length - 1\n left = index * 2 + 1\n right = index * 2 + 2\n if right > @store.length - 1\n child = left\n else\n child = @store[left].key < @store[right].key ? left : right\n end\n @store[index].key > @store[child].key ? swap(index, child) : return\n end\n return\n end",
"def create_max_heap\n (0..@heap_size/2-1).to_a.reverse.each do |indx|\n fix_one_error(indx)\n end\n end",
"def shift\n if @elements.empty?\n return nil\n end\n\n swap(0,@elements.size-1)\n ele = @elements.pop\n heapify(0)\n ele\n end",
"def heap_up(index)\n\n # formula for determining parent index of a given element's index -- \n # parentheses are crucial!\n parent_index = (index - 1) / 2\n \n # BASE CASES\n # stop if the element we're looking at is at the root of the tree\n return if index == 0\n # since this is a min heap, we're done if the parent's key is less than (or \n # equal to) the key of the element we're looking at\n return if @store[parent_index].key <= @store[index].key\n\n # RECURSIVE CASE: swap element with parent ...\n @store[parent_index], @store[index] = @store[index], @store[parent_index]\n # ... and make parent the new element we're heaping up\n return heap_up(parent_index)\n end",
"def heap_down(index)\n # base case 1, can't reach any more child nodes\n # ^ meaning heap node has reached deepest depth of heap\n if 2 * (index + 1) - 1 < @store.length - 1\n child_i = 2 * (index + 1) - 1 # (index + 1) to account for zero index\n \n swap(child_i, child_i + 1) if @store[child_i].key > @store[(child_i + 1)].key\n\n if @store[child_i].key < @store[index].key\n swap(index, child_i)\n heap_down(child_i) \n end\n # base case 2, index is not last element\n elsif index < @store.length - 1\n swap(index, index + 1) if @store[index].key > @store[index + 1].key\n end\n # note that add will reorder the heap through swap\n end",
"def heapify(node)\n parent = node.parent\n left_child = parent.left\n right_child = parent.right\n until node.rating > parent.rating\n if ![left_child, right_child].include?(nil)\n if left_child.rating < right_child.rating\n swap_node(parent, left_child)\n else\n swap_node(parent, right_child)\n end\n else\n swap_node(parent, right_child) if left_child.nil?\n swap_node(parent, left_child) if right_child.nil?\n end\n heapify(parent) unless parent.id == 1\n end\n end",
"def mm_upheap(j, upper)\n while true\n return if j <= 0\n i = (j-1) >> 1\n return if upper.call(i, j)\n swap(j, i)\n j = i\n end\n end",
"def heap_up(index)\n return if index == 0\n parent = (index - 1 ) / 2\n # Compare the new node with it's parent\n # If they are out of order swap and heap-up\n if @store[parent].key > @store[index].key\n #swap\n swap(index, parent)\n #continue heap-up\n heap_up(parent)\n end\n \n end",
"def heap_sort arr, last_el_pos\n if last_el_pos > 0\n def order_heap father_index, arr, last_el_pos\n largest_i = father_index\n left_i = 2*father_index + 1\n right_i = 2*father_index + 2\n if (left_i <= last_el_pos && arr[largest_i] < arr[left_i])\n largest_i = left_i\n end\n if (right_i <= last_el_pos && arr[largest_i] < arr[right_i]) \n largest_i = right_i\n end\n if largest_i != father_index\n arr[largest_i], arr[father_index] = arr[father_index], arr[largest_i] \n end\n end\n n = last_el_pos + 1\n last_father_index = n/2-1 #index of the father of the last element of the arry\n \n while last_father_index >= 0 do\n order_heap last_father_index, arr, last_el_pos\n last_father_index -= 1\n end\n arr[last_el_pos], arr[0] = arr[0], arr[last_el_pos]\n last_el_pos-=1 \n heap_sort(arr, last_el_pos)\n end\nend",
"def build_maxheap\n\t\ti = @heap.length/2\n\t\twhile i >= 0\n\t\t\tn_heapify(@max, i)\n\t\t\ti -= 1\n\t\tend\n\tend",
"def check_heap_at!(idx)\n value = @a[idx]\n unless idx <= 0\n pidx = (idx - 1) / 2\n pval = @a[pidx]\n raise \"@a[#{idx}] == #{value}, #{pval} > #{value}\" if pval > value\n end\n value\n end",
"def push(node)\n new_index = (@nodeset << node).length - 1\n heapify_up new_index\n self\n end",
"def heap_up(index)\n # base case to exit recursion\n return if index == 0\n \n parentIndex = (index - 1) / 2\n\n if @store[parentIndex].key > @store[index].key\n swap(index, parentIndex)\n heap_up(parentIndex)\n end\n end",
"def heap_sort(arr)\n\tbuild_max_heap(arr)\n\t#Put the largest (first) item at the end, put that value at the front, rebuild the heap, and repeat\n\t#Invariant:\n\t# => any element in the sorted subsequence arr[i+1...end] >= any element in arr[0..i]\n\tfor i in (arr.length-1).downto(1)\n\t\tarr[0], arr[i] = arr[i], arr[0] #Swap first element with smallest sorted element\n\t\tarr.heap_size += -1\n\t\tmax_heapify(arr, 0)\n\tend\nend",
"def heap_down(index=0)\n return if @store.empty?\n\n while ((2 * index) + 1) < @store.length # so long as we have a left child, continue to swap\n rightIndex = (2 * index) + 2\n leftIndex = (2 * index) + 1\n smallerIndex = leftIndex\n if (rightIndex < @store.length) && (@store[rightIndex].key < @store[leftIndex].key)\n smallerIndex = rightIndex\n end\n\n if @store[index].key < @store[smallerIndex].key\n break\n else\n swap(index, smallerIndex)\n end\n index = smallerIndex\n end\n end",
"def heapsort(list)\n new_heap = MinHeap.new\n return list if list.nil? || list.length == 1\n\n until list.empty?\n new_heap.add(list.pop)\n end\n\n index = 0\n until new_heap.empty?\n list[index] = new_heap.remove()\n index += 1\n end\n\n \n return list\n \n\nend",
"def push(v)\n @que << v\n reheap(@que.size-1)\n self\n end",
"def heap_sort(list)\n #add elements to a heap\n #remove elements from heap one-by one, placing them in order\n sort_heap = MinHeap.new\n sorted = []\n list.each{|element| sort_heap.add(element)}\n list.length.times{|i| sorted.push(sort_heap.remove)}\n return sorted\nend",
"def []=(i, val) \n # resize array if inserting into index thats greater than length of array\n if i > capacity()\n resize!() until i <= capacity()\n end\n \n # when inserting using negative indexes\n if i < 0\n return nil if i < -(@count)\n self[@count + i] = val\n @count += 1\n return\n else\n @store[i] = val\n @count += 1\n end\n end",
"def add value\n raise 'Cannot add nil values to the heap.' if value.nil?\n # push onto the end of the @heap array\n @heap.push(value)\n new_item_index = @heap.size - 1\n # add it to our map\n map_add(value, new_item_index)\n # swim it upward (\"bubble up\") to where it belongs\n swim(new_item_index)\n end",
"def heapsort(list)\n return list if list.length < 2\n\n heap = MinHeap.new\n\n i = 0\n list.each do\n heap.add(list[i])\n i += 1\n end\n\n i = 0\n until i == list.length\n list[i] = heap.remove\n i += 1\n end\n\n return list\nend",
"def heap_up(idx)\n parent_idx = (idx - 1) / 2\n return if idx <= 0 || @store[parent_idx].key <= @store[idx].key\n swap(parent_idx, idx)\n heap_up(parent_idx)\n end",
"def heap_sort(array) \n size = array.length\n #Adding an empty element at beginning of array to be the root\n root_array = [nil] + array \n \n i = size / 2 \n while i > 0 do\n heapify(root_array, i, size) \n i -= 1 \n end \n\n while size > 1 do\n root_array[1], root_array[size] = root_array[size], root_array[1] \n size -= 1 \n heapify(root_array, 1, size) \n end \n root_array.shift #getting rid of the initial nil\n root_array \nend",
"def heapsort(list)\n heap = MinHeap.new\n sorted_list = []\n\n list.each do |item|\n heap.add(item)\n end\n\n list.length.times do \n sorted_list << heap.remove()\n end\n\n return sorted_list\nend",
"def heap_sort2(a)\r\n size = a.length\r\n temp = 0\r\n i = (size/2)-1\r\n\r\n while i >= 0\r\n sift_down(a,i,size)\r\n i-=1\r\n end\r\n\r\n i=size-1\r\n while i >= 1\r\n a[0], a[1] = a[1], a[0]\r\n sift_down(a, 0, i-1)\r\n i-=1\r\n end\r\n return a\r\nend",
"def push(el)\n if @largests.empty?\n @largests.push(el)\n elsif el >= @largests.peek # Should this be greater-than-or-equal?\n @largests.push(el)\n end\n super\n end",
"def pop\n @heap.pop\n end",
"def pop\n return nil if @elements.length == 0\n tmp = @elements.shift\n @elements.unshift @elements.pop\n heapify_down\n return tmp\n end",
"def heap_up(new_index)\n return if new_index == 0\n parent_index = (new_index - 1) / 2\n\n if @store[new_index].key < @store[parent_index].key\n swap(new_index, parent_index)\n heap_up(parent_index)\n end\n end",
"def up_heap(ary, k)\n p = (k - 1)/2\n down = ary[k]\n while (k-1)/2 >= 0 and ary[(k-1)/2] < down\n ary[k] = ary[(k-1)/2]\n k = (k-1).abs/2\n break if k == 0 \n end\n ary[k] = down\nend",
"def heapsort(list)\n heap = MinHeap.new()\n list.each do |num|\n heap.add(num)\n end\n res = []\n list.length.times do \n res << heap.remove()\n end\n return res\nend",
"def heap_sort(arr)\n 2.upto(arr.length - 1).each do |heap_size|\n BinaryMinHeap.heapify_up(arr, heap_size - 1, heap_size)\n end\n\n arr.length.downto(2).each do |heap_size|\n arr[heap_size - 1], arr[0] = arr[0], arr[heap_size - 1]\n BinaryMinHeap.heapify_down(arr, 0, heap_size - 1)\n end\n\n arr.reverse\nend",
"def sift_up(current_index, heap)\n parent_index = (current_index - 1) / 2\n while current_index > 0 && heap[current_index] < heap[parent_index]\n self.swap(current_index, parent_index, heap)\n current_index = parent_index\n parent_index = (current_index - 1) / 2\n end\n end",
"def reheapify(given_value)\n\t\tif parent(given_value) != 0\n\t\t\tif @array[given_value] > @array[parent(given_value)] #This is will not \n#attempt to reheapify on the root as parent() will return 0 if given 1/2. Otherwise, if the child is larger than the parent\n#reheapify will run, then call itself again.\n\t\t\thold_parent = @array[parent(given_value)]\n\t\t\t@array[parent(given_value)] = @array[given_value]\n\t\t\t@array[given_value] = hold_parent\n\t\t\treheapify(parent(given_value))\n\t\t\tend\n\t\tend\n\tend",
"def heap_down(index)\n left_index = index * 2 + 1\n right_index = index * 2 + 2\n\n if right_index < @store.length\n min_child = @store[left_index].key < @store[right_index].key ? left_index : right_index\n if @store[index].key > @store[min_child].key\n swap(index, min_child)\n heap_down(min_child)\n end\n elsif left_index < @store.length\n if @store[index].key > @store[left_index].key\n swap(index, left_index)\n end\n end\n end",
"def heap_sort(list)\n heap_sort = MinHeap.new()\n\n list.each do |number|\n heap_sort.add(number, number)\n end\n\n sorted = Array.new\n until heap_sort.empty?\n sorted << heap_sort.remove\n end\n\n return sorted\nend",
"def heap_up(index)\n parent_index = (index - 1) / 2\n\n # base case: index at root or if current node is greater than parent node\n return if index == 0\n return if @store[index].key > @store[parent_index].key\n \n # recursive case: swap and run again\n swap(index, parent_index)\n heap_up(parent_index)\n end",
"def heapify_up(custom_start_index = nil)\n current_index = custom_start_index.nil? ? (self.heap_container.length - 1) : custom_start_index \n while(self.has_parent(current_index) && \n self.pair_is_in_correct_order(current_index, self.get_parent_index(current_index)))\n \n self.swap(current_index, self.get_parent_index(current_index))\n current_index = self.get_parent_index(current_index)\n end\n end",
"def heap_sort (list)\r\n sl = []\r\n heap = build_heap(list)\r\n heap.size.times do\r\n sl << heap.shift\r\n heap = heapify(heap, 0)\r\n end\r\n sl.reverse\r\nend",
"def heapsort(list)\n min_heap = MinHeap.new()\n list.each do |item|\n min_heap.add(item)\n end\n empty_arr = []\n\n list.length.times do\n empty_arr << min_heap.remove()\n end\n return empty_arr\nend",
"def heap_down(index)\n # calculate index of (possible) children\n child_L = index * 2 + 1\n child_R = index * 2 + 2\n\n # base case #1 - if current node has no children at all\n return if child_L >= @store.length \n # base case #2 - if a child exists and current node is smaller than min_child\n min_child = child_L\n if child_R < @store.length\n min_child = @store[child_L].key < @store[child_R].key ? child_L : child_R\n end\n\n return if @store[index].key < @store[min_child].key\n\n # recursive case: swap and run again\n swap(index, min_child)\n heap_down(min_child)\n end",
"def sift_up(current_idx, heap)\n parent_idx = (current_idx - 1) / 2\n while current_idx > 0 && heap[current_idx] < heap[parent_idx]\n self.swap(current_idx, parent_idx, heap)\n current_idx = parent_idx\n parent_idx = (current_idx - 1) / 2\n end\n end",
"def sort\n\n arr_len = @data.length\n start_build_idx = arr_len / 2 - 1 # The last half of the array is just leaves\n\n for i in (start_build_idx).downto(0)\n\n max_heapify(@data, arr_len, i) # Build the heap from the array\n end\n\n for i in (arr_len-1).downto(0)\n\n swap(@data, i, 0) # Move the current root to the end of the array\n max_heapify(@data, i, 0) # Heapify the remaining part of the array excluding the root which was just sorted to the end\n end\n\n puts(@data)\n end",
"def heapsort(list)\n heapify(list, parent(list.length - 1)) if list.length > 1\n sort_heaped_list(list)\n return list\nend",
"def sort_heaped_list(list)\n last_pos = list.length - 1\n while last_pos > 0\n remove_max(list, last_pos)\n last_pos -= 1\n end\nend",
"def heapify_up\n # Swap the current_node (starting with last child) with it's parent if it is smaller\n previous_current_node = nil\n current_node = @nodes.size - 1\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == current_node\n previous_current_node = current_node\n parent_node = parent(current_node)\n \n # Bounds check for when the current_node is the root\n break if current_node.zero? \n\n # Swap with the parent if the parent is bigger\n if @nodes[current_node] < @nodes[parent_node]\n @nodes[current_node], @nodes[parent_node] = @nodes[parent_node], @nodes[current_node]\n current_node = parent_node\n end\n end\n end"
] |
[
"0.7694692",
"0.73285645",
"0.7035773",
"0.699259",
"0.67716455",
"0.6696808",
"0.6610182",
"0.6593232",
"0.6411324",
"0.6297163",
"0.6227078",
"0.6164906",
"0.6147106",
"0.607659",
"0.6042002",
"0.60286844",
"0.60099924",
"0.59845155",
"0.59745103",
"0.59721166",
"0.59661084",
"0.59464943",
"0.591168",
"0.58865714",
"0.5858599",
"0.5827298",
"0.58099747",
"0.57867134",
"0.57760835",
"0.57353455",
"0.5729817",
"0.5715701",
"0.57152736",
"0.57108676",
"0.57074827",
"0.5699022",
"0.56738615",
"0.5670163",
"0.56573105",
"0.56391084",
"0.56343997",
"0.5634216",
"0.56336576",
"0.5624037",
"0.5623225",
"0.5614473",
"0.5594027",
"0.5581003",
"0.5575321",
"0.5554788",
"0.55434173",
"0.5526114",
"0.55184454",
"0.5494443",
"0.547247",
"0.54669595",
"0.54554766",
"0.54540503",
"0.5453989",
"0.54271346",
"0.5418632",
"0.54185444",
"0.541223",
"0.5402019",
"0.53934443",
"0.53502834",
"0.5329527",
"0.53254807",
"0.53179973",
"0.5302409",
"0.52999866",
"0.52992696",
"0.52883005",
"0.52773744",
"0.52756274",
"0.5250629",
"0.52284527",
"0.5218065",
"0.52165234",
"0.52136725",
"0.5212317",
"0.52108973",
"0.5210297",
"0.52070475",
"0.5204512",
"0.52037805",
"0.5200827",
"0.5181382",
"0.5168743",
"0.5160314",
"0.5156366",
"0.5155847",
"0.5144635",
"0.5134111",
"0.51332",
"0.512611",
"0.5122904",
"0.5098066",
"0.50840884",
"0.50792503"
] |
0.8124133
|
0
|
account for File System Redirector
|
def servermanagercmd
@servermanagercmd ||= begin
locate_sysnative_cmd("servermanagercmd.exe")
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def redirects; end",
"def follow_redirection(&block); end",
"def redirect_ok=(_arg0); end",
"def follow_get_redirection(&block); end",
"def filter_redirect=(_arg0); end",
"def filter_redirect=(_arg0); end",
"def follow_symlinks=(_arg0); end",
"def public_file_server=(_arg0); end",
"def public_file_server=(_arg0); end",
"def redirection_history=(_arg0); end",
"def redirect?; end",
"def follow_symlinks; end",
"def redirect_ok=(follow); end",
"def redirection_limit=(_arg0); end",
"def restore_permissions; end",
"def restore_permissions; end",
"def redirection_history; end",
"def rescue_can_can(exception)\n if User.stanford_generic_user.ability.can?(:access, current_file) && !current_user.webauth_user?\n redirect_to auth_file_url(file_params.to_h.symbolize_keys)\n else\n super\n end\n end",
"def set_redirect_location\n @redirect_location = @shareable\n end",
"def auth_user_file\n \t\treturn @htaccess_hash['AuthUserFile']\n \tend",
"def redirect(uri, verb = T.unsafe(nil)); end",
"def redirection_limit; end",
"def redirection_limit; end",
"def filter_redirect; end",
"def filter_redirect; end",
"def manage_files\n redirect_to wip_path()\n end",
"def realm(uri); end",
"def redirect_recorders(outfilename = @outfilename)\n out_base ||= File.basename outfilename, EXT\n find_by_class(['recorder', 'collector', 'multi_recorder', 'group_recorder', 'fault_check']).each do |r|\n prop = r[:class] == 'fault_check' ? :output_filename : :file\n dirname, filename = File.split(r[prop])\n if dirname.include?(File::SEPARATOR) || !filename.start_with?(dirname)\n raise \"'#{r[prop]}' isn't a recorder path I can redirect\"\n end\n r[prop].gsub! dirname, out_base\n end\n end",
"def stash_user_file(file,path)\n users = get_all_over500_users\n users.each_key do |u|\n puts \"copying files to #{u}\\'s home at #{path}.\"\n system \"ditto -V #{file} #{get_homedir(u)}/#{path}/#{File.basename(file)}\"\n FileUtils.chown_R(\"#{u}\", nil, \"#{get_homedir(u)}/#{path}/#{File.basename(file)}\")\n end\n end",
"def redirect_output!; end",
"def redirect_path\n if @bank_dup.present?\n latest_ofxes_path\n elsif session[:current_acct].present?\n account_path(session[:current_acct])\n else\n account_path(@entry.splits.order(:id).first.account)\n end\n end",
"def dir_alias()\n #This is a stub, used for indexing\n end",
"def restore_permissions=(_arg0); end",
"def restore_permissions=(_arg0); end",
"def public_file_server; end",
"def public_file_server; end",
"def follow_redirect?; end",
"def mount_path; end",
"def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end",
"def with_redirection\n ensure_files!\n redirect_stdio!\n yield\n restore_stdio!\n rescue Exception => exception\n fatal! exception.to_s_mri\n end",
"def hook_path; end",
"def set_return_path\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} params = #{params.inspect}\")\n op = request.original_fullpath\n # if we headed for the login page, should remember PREVIOUS return to.\n if op.include?('logins') && !session[:cuwebauth_return_path].blank? \n op = session[:cuwebauth_return_path] \n end\n op.sub!('/range_limit','')\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} original = #{op.inspect}\")\n refp = request.referer\n refp =\"\"\n refp.sub!('/range_limit','') unless refp.nil?\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} referer path = #{refp}\")\n session[:cuwebauth_return_path] =\n if (params['id'].present? && params['id'].include?('|'))\n '/bookmarks'\n elsif (op.include?('/book_bags/email'))\n \"/book_bags/email\"\n elsif (params['id'].present? && op.include?('email'))\n \"/catalog/#{params[:id]}\"\n elsif (params['id'].present? && op.include?('unapi'))\n refp\n else\n op\n end\n Rails.logger.info(\"es287_debug #{__FILE__}:#{__LINE__} return path = #{session[:cuwebauth_return_path]}\")\n return true\n end",
"def protected_transfer\n transfer\n end",
"def copy_access\n authorize! :edit, curation_concern\n CopyPermissionsJob.perform_later(curation_concern)\n redirect_to [main_app, curation_concern], notice: I18n.t('sufia.upload.change_access_flash_message')\n end",
"def redirect_folder(folder,dir)\n\n w=WinReg.new(@file)\n w.debug=@debug\n\n w.write_key(FOLDERS_BASE+'\\\\'+folder,dir)\n\n end",
"def owner_of_model_file\n redirect_to root_path unless current_member.owns?(ModelFile.find(params[:id]))\n end",
"def accessible_real_file(uid)\n UserFile.real_files.accessible_by(@context).find_by!(uid: uid)\n end",
"def file_utils=(_arg0); end",
"def login_first\n redirect_to account_login_path(dest: (params[:dest] || request.path))\n end",
"def remember_host!; end",
"def access_control\n \n end",
"def redirect_ok; end",
"def redirect_ok; end",
"def redirect_url; end",
"def getUser ()\n return self.directory.user \n end",
"def redirected?\r\n self.Mode > 31\r\n end",
"def mount_path=(_arg0); end",
"def store_location\n \tsession[:forwarding_url] = request.original_url if request.get?\n\tend",
"def file_utils; end",
"def redirect_folders(dir)\n\n w=WinReg.new(@file)\n w.debug=@debug\n FOLDER_DEFAULTS.each do |key|\n w.write_key(FOLDERS_BASE+'\\\\'+key[:name],dir+'\\\\'+key[:dir])\n end\n end",
"def redir\n redirect_to facility_path_for(@listing), :status => 301\n end",
"def lock_path; end",
"def redirect_internal() redirect_to \"/nothing\"; end",
"def add_default_file_realm(domain, realm)\n add_file_realm(domain, realm, '${com.sun.aas.instanceRoot}/config/keyfile')\n end",
"def follow_redirects\n return nil unless self.exist?\n absolutepath.linkpath\n end",
"def xssf_process_attacker_request(req, res)\n\t\t\t\tbegin\n\t\t\t\t\tcase req.path\t\t\t\t\t\n\t\t\t\t\t\t# Victim log page is asked\n\t\t\t\t\t\twhen /^#{self.serverURI + VICTIM_GUI}/\n\t\t\t\t\t\t\tbuild_log_page(req, res)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telse # Other page is asked by a victim : redirect to known file or active module (This part needs cookie to be activated) \n\t\t\t\t\t\t\tif ((v = victim_tunneled) && (req.request_method =~ /^(GET|POST)$/i))\n\t\t\t\t\t\t\t\txssf_tunnel_request(req, res, v)\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tXSSF_404(res)\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tXSSF_404(res) \n\t\t\t\t\tprint_error(\"Error 27: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\tend",
"def auth_process\n\t\tif @auth_file.authorization.nil?\n \t\t\tmake_auth\n\t\telse\n\t\t\t@client.authorization = @auth_file.authorization\n\t\tend\n\tend",
"def store_last_location\r\n session[:return_to] = request.referer unless URI(request.referer).path == \"/passwords\"\r\n end",
"def directory; end",
"def directory; end",
"def proxy_user; end",
"def original_fullpath; end",
"def on_other_file; end",
"def unix_perms=(_arg0); end",
"def store_location!\n session[:\"#{scope}_return_to\"] = attempted_path if request.get? && !http_auth?\n end",
"def after_commit_redirect_path\n resource.fabric ? edit_fabric_path(resource.fabric) : fabrics_path\n end",
"def store_location\n session[:forwarding_url] = request.original_fullpath if request.get?\n end",
"def store_location\n\t session[:forwarding_url] = request.original_url if request.get?\n\tend",
"def store_location\n\t\tsession[ :forwarding_url ] = request.original_url if request.get?\n\tend",
"def permission_denied_path\n root_path\n end",
"def proxy_pass; end",
"def store_location\n session[:forwarding_url]=request.fullpath if request.get?\n end",
"def actual_uri\n redirects_to or uri\n end",
"def index_redir(base)\n oputs <<-eos\n if (-f $request_filename) { break; }\n if (-d $request_filename) { break; }\n rewrite ^(.+)$ #{base}$1 last;\n eos\nend",
"def after_magic_link_authentication\n end",
"def redirected?\r\n @Out.redirected?\r\n end",
"def access_file_name\n end",
"def store_forwarding_loc\n session[:forwarding_url] = request.original_url if request.get?\n end",
"def file_watcher=(_arg0); end",
"def file_watcher=(_arg0); end",
"def redirect_to(args={})\n # use an url if specified\n @redirect = args[:url] if args[:url]\n # or build up an action if specified\n @redirect = File.join(\"/#{@workingpath[1..-1].join('/')}\",args[:action].to_s) if args[:action]\n logmsg \"base_controller::redirect_to() setting redirect to #{@redirect}\" if @@debug\n end",
"def manage_symlink_access?\n false\n end",
"def manage_symlink_access?\n false\n end",
"def save_redirection_information(what = :current_request)\n\t\tcase what\n\t\twhen :current_request\n\t\t\tflash[:_redirection_information] =\n\t\t\t\tredirection_information_for_current_request.marshal(true, false)\n\t\t\tlogger.debug(\"Auto-Redirection: saving redirection information \" <<\n\t\t\t\t\"for: #{controller_path}/#{action_name} (#{request.method})\")\n\t\twhen :passed\n\t\t\tinfo = get_redirection_information\n\t\t\tflash[:_redirection_information] = info.marshal(true, false)\n\t\t\tlogger.debug(\"Auto-Redirection: saving redirection information \" <<\n\t\t\t\t\"for: #{info.path} (#{request.method})\")\n\t\telse\n\t\t\traise ArgumentError\n\t\tend\n\tend",
"def store_location\n session[:forwarding_url] = request.original_url if request.get?\nend",
"def store_redirect_for(name, redirectable)\n # we never want to redirect a user to an xhr url, so disallow at this level\n store_redirect_url_for(name, redirects_for(redirectable)) unless request.xhr?\n end",
"def store_location\n\t\tsession[:forwarding_url]=request.original_url if request.get?\n\tend",
"def unicast_redirect_state\n super\n end",
"def provider_full_path(userfile) #:nodoc:\n basename = userfile.name\n subid,visid = named_according_to_LORIS_convention!(userfile)\n Pathname.new(remote_dir) + subid + visid\n end",
"def script_settings_files_def\n {\n 'adjust_permissions.dirs' => {\n :uid => sftp_user_uid,\n :gid => group_gid,\n :reject_mmask => 0007 }\n }\nend",
"def file_uri_scheme=(_arg0); end"
] |
[
"0.60034186",
"0.57965726",
"0.5679674",
"0.5635606",
"0.5547101",
"0.5547101",
"0.5516242",
"0.54984534",
"0.54984534",
"0.5479617",
"0.54660094",
"0.5464046",
"0.5442541",
"0.54375845",
"0.5420232",
"0.5420232",
"0.537118",
"0.53553826",
"0.535462",
"0.53241646",
"0.5317913",
"0.53166884",
"0.53166884",
"0.5308734",
"0.5308734",
"0.52934396",
"0.528172",
"0.5252055",
"0.52483505",
"0.5217764",
"0.52016413",
"0.51920795",
"0.51831204",
"0.51823395",
"0.5182326",
"0.5182326",
"0.51614267",
"0.5149103",
"0.513719",
"0.5135016",
"0.5123588",
"0.5120511",
"0.50981015",
"0.5073925",
"0.5073012",
"0.5065342",
"0.5060495",
"0.5057365",
"0.5053334",
"0.50458765",
"0.50393164",
"0.5037718",
"0.5037718",
"0.50339264",
"0.5028448",
"0.50278884",
"0.5021308",
"0.5020607",
"0.5017733",
"0.5017384",
"0.5011644",
"0.5006583",
"0.50046945",
"0.500359",
"0.5002361",
"0.50002223",
"0.49995396",
"0.49959198",
"0.49786505",
"0.49786505",
"0.4971794",
"0.49674606",
"0.4966339",
"0.4945725",
"0.49344674",
"0.49311593",
"0.49262217",
"0.491939",
"0.49174774",
"0.49154314",
"0.4914036",
"0.49130753",
"0.49121916",
"0.490976",
"0.4906618",
"0.49032778",
"0.4901315",
"0.49009863",
"0.4897118",
"0.4897118",
"0.48965454",
"0.4894884",
"0.4894884",
"0.48936862",
"0.48912045",
"0.48878556",
"0.48847935",
"0.48832518",
"0.4882229",
"0.4879798",
"0.48771825"
] |
0.0
|
-1
|
def total_cash(hash) start_sum = 0 for p in hash[:pets][:price] return start_sum += hash[:pets][:price] end end 2
|
def total_cash(instance)
return instance[:admin][:total_cash]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def food_stand(hash)\n sum = 0\n hash.each do |k, v|\n # hash[k] = v\n sum += v\n end\n return sum\nend",
"def calcular_total hash\n p hash.inject(0) { |sum, tuple| sum += tuple[1] }\n end",
"def hash_sum\n total = 0\n places_hash.each do |k, v|\n total = total + v\n end\n return total\nend",
"def print_item_sums hash1, hash2\n sum = hash1[:price] + hash2[:price]\n p sum\nend",
"def print_item_sums hash1, hash2 \n\thash1[:price] + hash2[:price]\nend",
"def print_item_sums hash1, hash2\n\thash1[:price] + hash2[:price]\nend",
"def sum(hash)\n result = 0\n hash.each do |k, v|\n result += k * v\n end\n result\n end",
"def meal_price\n price = 0\n PRIX.each do |k, v|\n v.each do |key, value|\n price = value + price\n end\n end\n return price\nend",
"def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend",
"def print_item_sums hash1, hash2 \n one = print_price hash1 \n two = print_price hash2 \nsums= one + two \nputs sums \nend",
"def total_money(people) #function\n money = 0\n\n for person in people\n money += person[:monies]\n #person[:monies] = 0\n end\n\n return money\n \n\nend",
"def hash_sum(hash)\n return 0 if hash.empty?\n hash.values.inject(&:+)\nend",
"def find_total_pay(rides)\n moneys = 0\n rides.each do |key, value|\n moneys += key[:cost]\n end\n return moneys\nend",
"def total_money(people)\n total = 0\n for person in people\n total += person[:monies]\n end\n return total\nend",
"def total_money(people)\n total = 0\n for person in people\n total += person[:monies]\n end\n return total\nend",
"def total_price(list)\r\n price = list[\"cocktail\"]*22 + list[\"beer\"]*12 + list[\"water\"]*6\r\n return price\r\nend",
"def total_price\n hash[\"TotalPrice\"]\n end",
"def total_cash(petshop)\n return petshop[:admin][:total_cash]\n end",
"def print_item_sums(hash_a, hash_b)\n print_price(hash_a) + print_price(hash_b)\nend",
"def total\n # extracts all of the values from the hash and sums them up\n cost = @products.values.sum\n # add 7.5% tax and round to two decimal places\n return (cost * 1.075).round(2)\n end",
"def total_money( people)\n total_money = 0\n\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend",
"def count_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\nend\nreturn total_money\nend",
"def total_cash(sum)\n return sum[:admin][:total_cash]\nend",
"def add_or_remove_cash(pet_shop_hash,cash)\n return pet_shop_hash[:admin][:total_cash] += cash\nend",
"def total_price\n sum = 0\n line_items.to_a.sum do |check|\n check.total_price.to_i\n end\n\t\nend",
"def sum_all_the_prices(products)\n sum = 0\n products.each do |product|\n sum = sum + ( product[:price] * product[:quantity])\n end\n sum\nend",
"def total_cash\n services.select{|i| i[:btype] && i[:btype] == CASH_BILLING}.sum{|s| s[:fee]} rescue 0\n end",
"def total_students(hash)\n\ttotal = 0\n\thash.each { |key, value| total += value }\n\treturn total\nend",
"def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend",
"def total(prices)\n amount = 0\n prices.each do |price|\n amount += price\n end\n amount\nend",
"def total_price\n total = 0\n self.transactions.each do |t|\n total += t.price\n end\n total\n end",
"def money_spent\n self.purchases.map { |p| p.price }.sum\n end",
"def total_price\n items.map(&:price).sum\n end",
"def total_everyone_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\n end\n return total_money\nend",
"def balance\n sum = 0\n @money.each do |k, v|\n sum += k * v\n end\n sum\n end",
"def money(trips)\n revenue_array = []\n\n trips.each do |trip|\n revenue_array << trip[:cost]\n end\n\n total_money = revenue_array.sum\n return total_money\nend",
"def total(bill)\n sum=0.0\n bill.items.each do |i|\n sum += i.price\n end\n return sum\n end",
"def sum_prices(vending_mapping)\n sum = 0\n\n vending_mapping.each do |location, food_item|\n sum += food_item['price']\n end\n\n return sum\nend",
"def total_price(cart)\n cart.sum {|item| item.price} \n end",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def total_cash(pet_shop)\n return pet_shop[:admin][:total_cash]\nend",
"def cost \n\n \ttotal=@costItems.reduce(0) do |sum,hm|\n \t\tsum+=hm \n end\n puts total\n end",
"def total_stock_value(drinks)\n drinks.reduce(0) { |sum, drink| sum + drink[:price] }\nend",
"def money_made(rideshare)\n # initilaize an empty hash to store the total earned\n total_earned = {}\n total = 0\n # itirate through the values throught the first hash\n rideshare.each do |driver, trips| \n #itirate through the second hash\n trips.each do |trip| \n total += trip[:cost]\n total_earned[driver] = total \n end\n total = 0\n end\n return total_earned\nend",
"def total\n\t\tprices = line_items.map {|li| li.price}\n\t\tprices.reduce(0) {|it0, it1| it0+it1}\n\tend",
"def total_vat_amount\n hash[\"TotalDutiesPrice\"]\n end",
"def account_cash_balance(investor)\n cash_balance = 0\n @hash_row_array.each do |hash|\n price = hash[\"TXN_PRICE\"]\n price[0] = ''\n price_float = price.to_f\n cash_total = price_float * hash[\"TXN_SHARES\"].to_f\n if hash[\"INVESTOR\"] == investor && hash[\"TXN_TYPE\"] == \"BUY\"\n cash_balance += cash_total\n end\n end\n return cash_balance.round(2)\nend",
"def items_total_cost(i)\n i[:count] * i[:price]\nend",
"def running_total\n sum = 0.00\n @items.each { |item| sum += item[\"price\"] }\n return sum\n end",
"def total_cost(list)\r\n cost = list[\"cocktail\"]*8 + list[\"beer\"]*3 + list[\"water\"]*0.15\r\n return cost\r\nend",
"def put_inside!(money_hash)\n money_hash.each do |k, v|\n @money[k] += v\n end\n save!\n end",
"def return_sum\n @money = 0\n @transactions.each do |t|\n if t.get_action == 'buy'\n @money = @money + t.get_value\n elsif t.get_action == 'sell'\n @money = @money - t.get_value\n end\n end\n total_value_of_shares - @money\n end",
"def total_sales toy\n\t$total_amount = toy[\"purchases\"].inject(0) {|sales_total, sale| sales_total + sale[\"price\"]}\nend",
"def add_or_remove_cash(pet_shop, cash)\n pet_shop[:admin][:total_cash] += cash\n # total_cash += cash\n # return total_cash\nend",
"def total_base_price\n tickets.map(&:base_price).sum\n end",
"def total(prices)\n amount = 0\n #From this:\n #index = 0\n #while index < prices.length\n # amount+= prices[index]\n # index += 1\n #end\n #To this:\n prices.each do |price|\n amount += price\n end\n amount\nend",
"def total_price\n self.ice_cream_orders.map { |ico| ico.ice_cream.price }.inject(:+)\n end",
"def current_coin_total\n @coins.map(&:value).reduce { |sum, num| sum += num }\n end",
"def all_milkshakes_price\n\t\ttotal_price_of_all_milkshakes = 0\n\t\t@milkshakes.each do |milkshake|\n\t\t\ttotal_price_of_all_milkshakes += milkshake.price_of_milkshake\n\tend\n\t#Puts total price of all milkshakes\n\t\tputs \"Total price of all milkshakes is #{total_price_of_all_milkshakes} €\"\n\tend",
"def total_cash(pet_shop_total_cash)\n return pet_shop_total_cash[:admin][:total_cash]\nend",
"def calculated_price\n recipe_ingredients.map(&:price).sum\n end",
"def increase_pets_sold(pet_shop_hash,sold)\n return pet_shop_hash[:admin][:pets_sold] += sold\nend",
"def add_or_remove_cash(pet_shop, cost)\n pet_shop[:admin][:total_cash] += cost\nend",
"def total(rows)\n rows.map { |row| row[\"Money we made\"].to_i }.reduce(:+)\nend",
"def calc_total(prices, shoppingList)\n filtered = shoppingList.split.select { |item| prices.has_key?(item) }\n \"%.2f\" % filtered.inject(0.00) { |total, item| prices[item] + total } \nend",
"def summ\n result = 0.0\n self.propose_items.each do |item|\n result += item.price\n end\n return result\n end",
"def add_or_remove_cash(pet_shop, amount)\n pet_shop[:admin][:total_cash] += amount\nend",
"def calc_sum_of_exp(expenses)\n prices = []\n expenses.each do |num|\n prices << num['price'].to_f\n end\n return prices.inject(0, :+)\nend",
"def transaction_total_price\n hash[\"TransactionTotalPrice\"]\n end",
"def customer_total_cash(customer)\n return customer[:cash]\nend",
"def get_income(rides)\n income = 0\n rides.each do |ride|\n income += ride[:cost]\n end\n return income\nend",
"def total_duties_price\n hash[\"TotalDutiesPrice\"]\n end",
"def sum_prices(price_mapping)\n sum = 0\n\n price_mapping.each do |name, price|\n sum += price\n end\n\n return sum\nend",
"def get_total_sales(toy)\n\ttotal_sales = 0\n\ttoy['purchases'].each do |purchase|\n\t\ttotal_sales += purchase['price']\n\tend\n\treturn total_sales\nend",
"def total_calories(macdo, sandwich, drink, side)\n macdo[sandwich] + macdo[drink] + macdo[side]\nend",
"def customer_cash(customer_hash)\n return customer_hash[:cash]\nend",
"def total_goods(discount_goods)\n #total_info = Hash.new\n total_info = {'total_cost'=>0,'total_discount'=>0}\n discount_goods.each do |item|\n total_info['total_cost'] += item['total_price']\n total_info['total_discount'] += item['discount']\n end\n total_info\n end",
"def customer_cash(customers_hash)\n return customers_hash[:cash]\nend",
"def total_cash(total)\n return total[:admin][:total_cash]\nend",
"def total(prices)\n total = 0\n i = 0\n while i < prices.length\n total += prices[i]\n i += 1\n end\n total\nend",
"def total\n return 0 if @products.empty?\n total = (@products.sum { |name, price| price } * 1.075).round(2)\n return total\n end",
"def add_or_remove_cash(pet_shop, cash)\n return total_cash = pet_shop[:admin][:total_cash] += cash\nend",
"def get_total(type, pick)\n if @bets[type][pick].nil? \n return 0\n else\n return (@bets[type][pick].map{ |bet| bet.amount}).inject &:+\n end\n end",
"def getCounts (coins, sums, array, hash)\n for a in array\n if coins.include? a\n hash[a] == nil ? hash[a] = 1 : hash[a] += 1\n else\n otherCoins = sums[a][0]\n getCounts(coins, sums, otherCoins, hash)\n end\n end\nend",
"def add_or_remove_cash(pet_shop, num) \n return pet_shop[:admin][:total_cash] += num \nend",
"def add_or_remove_cash(pet_shop,cash)\n return pet_shop[:admin][:total_cash] +=cash\nend",
"def value\n @contents.reduce(0){|sum,pizza| sum + pizza.price }\n end",
"def cart_before_tax\n#go into our array\n#get product price before tx\n#sum the array\nsum_base_price = []\n\n @@shopping_cart.each do |product|\n sum_base_price << product.base_price\n end\n\nreturn sum_base_price.sum\n\n\nend",
"def computeGoldCoinsValue(t)\n\t\tvalue = 0\n\t\tfor treasure in t\n\t\t\tvalue = value + treasure.goldCoins\n\t\tend\n\t\treturn value*2\n\tend",
"def change_player_money(hash,amount)\n return hash[:money] += amount\nend",
"def add_or_remove_cash(petshop,cash) \n petshop[:admin][:total_cash] += cash\n end",
"def add_or_remove_cash(pet_shop, amount_cash)\n pet_shop[:admin][:total_cash] += amount_cash\nend",
"def total\n total = 0\n @products.values.each do |price|\n total += price\n end\n total += (0.075 * total).round(2)\n end",
"def total\n if @products == {}\n return 0 \n else\n m = 0\n @products.values.each do |v|\n m += v\n end\n\n sum = (m + (m * 0.075)).round(2)\n return sum\n end\n end",
"def sum_cookies(order)\n order[\"products\"].map{ |product| product[\"title\"] == \"Cookie\" ? product[\"amount\"] : 0}.inject(:+)\nend",
"def balance_hash\n @money\n end",
"def subtotal\n items.map(&:price).reduce(&:+)\n end",
"def profit_cal(items)\r\n profit = 0\r\n items.item.each do |h|\r\n profit += h[:num]*(h[:price] - h[:cost])\r\n end\r\n #profit = '%.2f' % profit\r\n puts \"The total profit is $#{'%.2f' % profit}\"\r\n return nil\r\nend"
] |
[
"0.776944",
"0.75251144",
"0.7444795",
"0.7365551",
"0.7202929",
"0.71748936",
"0.7166093",
"0.71222293",
"0.7121704",
"0.71095383",
"0.7102669",
"0.70723635",
"0.70578",
"0.6960724",
"0.6960724",
"0.6955277",
"0.6954052",
"0.69459796",
"0.6936525",
"0.6920396",
"0.6911237",
"0.6894563",
"0.68872935",
"0.68826115",
"0.6819775",
"0.6818909",
"0.67905164",
"0.6762427",
"0.673064",
"0.6722143",
"0.6689793",
"0.6689292",
"0.6645603",
"0.6642079",
"0.66371286",
"0.66227525",
"0.66091585",
"0.6590949",
"0.657537",
"0.6535355",
"0.6535355",
"0.6535355",
"0.6535355",
"0.6535355",
"0.65341395",
"0.6530873",
"0.65254354",
"0.6521588",
"0.6521103",
"0.6520952",
"0.6516111",
"0.6506272",
"0.65015686",
"0.6489027",
"0.64880323",
"0.6477328",
"0.6466841",
"0.6445809",
"0.6437309",
"0.6431511",
"0.64278144",
"0.6419207",
"0.64188963",
"0.6418418",
"0.64066905",
"0.6405518",
"0.63979405",
"0.63915753",
"0.63837653",
"0.63834333",
"0.63774717",
"0.63702023",
"0.63695306",
"0.63663524",
"0.63626355",
"0.63593775",
"0.6356573",
"0.63498455",
"0.63486266",
"0.6341431",
"0.6336002",
"0.6332007",
"0.633194",
"0.632072",
"0.63194937",
"0.63158345",
"0.63137454",
"0.63076735",
"0.62942326",
"0.62914646",
"0.628154",
"0.6277048",
"0.62683964",
"0.62657964",
"0.6253755",
"0.6249907",
"0.62428886",
"0.62423337",
"0.6223077",
"0.62171406",
"0.6216681"
] |
0.0
|
-1
|
12 Almost there? def remove_pet_by_name(pet_shop, name) for pet in pet_shop[:pets] if pet[:name] == name return pet_shop[:pets] pet[:name] end end end 12 Emily helped solution
|
def remove_pet_by_name(pet_shop, name)
for pet in pet_shop[:pets]
if pet[:name] == name
p pet_shop[:pets].delete(pet)
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def remove_pet_by_name(shop, name)\n for pet in shop[:pets]\n return pet.delete(:name) if name == pet[:name]\n end\nend",
"def remove_pet_by_name (pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet_name == pet[:name]\n pet[:name].delete!(pet_name)\n end\n end\nend",
"def remove_pet_by_name(pet_shop,name)\n return pet_shop[:pets].delete_if { |h| h[:name] == name }\n # return\n # for pet in pet_shop[:pets]\n # if pet[:name] == name\n # return pet_shop[:pets].delete( pet )\n # end\n # end\n # return nil\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n pet_shop[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n pet_shop[:pets].delete(pet) if pet[:name] == pet_name\n end\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n for item in pet_shop[:pets]\n if item[:name] == pet_name\n pet_shop[:pets].delete(item)\n end\n end\nend",
"def remove_pet_by_name(pet_shop, supplied_name)\n for pet in pet_shop[:pets]\n pet_shop[:pets].delete(pet) if supplied_name == pet[:name]\n end\nend",
"def remove_pet_by_name(pet_shop, name)\n pet = nil\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop[:name] == name\n pet = pet_shop[:pets].index(l_pet_shop)\n end\n end\n pet_shop[:pets].delete_at(pet)\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n\n for remove_pet in pet_shop[:pets]\n if remove_pet[:name] == pet_name\n pet_shop[:pets].delete(remove_pet)\n # Needs to look at :pets within pet_shop to delete.\n end\n end\nend",
"def remove_pet_by_name(shop, pet_name)\n shop[:pets].delete_if{|pet_info|pet_info[:name] == pet_name}\nend",
"def remove_pet_by_name(pet_shop, name)\n pet_shop[:pets].each do |pet|\n pet_shop[:pets].delete(pet) if pet[:name] == name\n end\n end",
"def remove_pet_by_name(pet_shop_hash, pet_name)\n pet_shop_hash[:pets].each_with_index { | pet, index | pet_shop_hash[:pets].delete_at(index) if pet[:name] == pet_name }\nend",
"def remove_pet_by_name(pet_shop_hash, name_of_pet)\n\tfor pet in pet_shop_hash[:pets]\n\t\tif pet[:name] == name_of_pet\n\t\t\tpet.delete(:name)\n\t\t\treturn nil\n\t\tend\n\tend\t\nend",
"def remove_pet_by_name(pets, name)\n return pets[:pets].delete_if {|pets| name == name }\nend",
"def remove_pet_by_name(shops, animal)\n for pet in shops[:pets]\n if pet[:name] == animal\n shops[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pets, name)\n # return pets[:pets].delete_at if pets[:pets][1][:name] == name\n return pets[:pets].delete_if {|pets| name == name }\nend",
"def remove_pet_by_name(pet_shop, name)\n pet_to_be_removed = find_pet_by_name(pet_shop, name)\n pet_shop[:pets].delete(pet_to_be_removed)\nend",
"def remove_pet_by_name(animal, past_animal)\n for pet in animal[:pets]\n if pet[:name] == past_animal\n return animal[:pets].delete(pet)\n end\n end\nend",
"def remove_pet_by_name(pets, pet_to_remove)\n pets[:pets].delete_if { |name| name[:name] == pet_to_remove }\nend",
"def remove_pet_by_name(pet_shop, pet_name)\n pet_to_delete = find_pet_by_name(pet_shop, pet_name)\n pet_shop[:pets].delete(pet_to_delete)\nend",
"def remove_pet_by_name(pet_shop, name_remove)\n pet_remove = find_pet_by_name(pet_shop, name_remove)\n pet_shop[:pets].delete(pet_remove)\n end",
"def remove_pet_by_name(pet_shop, pet_name)\n\n pet_array = pet_shop[:pets]\n pet_to_delete = find_pet_by_name(pet_shop, pet_name)\n pet_array.delete(pet_to_delete)\n\nend",
"def find_pet_by_name(pet_shop, name)\n pets = pets\n for pet in pet_shop[:pets]\n if pet[:name] == name\n pets = pet\n nil\n end\n end\n return pets\nend",
"def remove_pet(pet_name)\n index_position = 0\n @pet_arr.each do |animal|\n if pet_name == animal.name_str\n index_position = @pet_arr.index(animal)\n end\n end\n @pet_arr.delete_at(index_position)\n end",
"def find_pet_by_name(pet_shop, pet_name)\n\n for pets in pet_shop[:pets]\n\n if pets[:name] == pet_name\n\n\n return pets\n\n end\n end\n\n return\n end",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet\n return pet\n else return nil\n end\nend\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n # else\n # return nil\n end\n end\n return\nend",
"def find_pet_by_name(pet_shop, name)\n pet_by_name = nil #this set the bucket as empty until the arguement\n #is returned as true.\n for pet in pet_shop[:pets]\n pet_by_name = pet if pet[:name]==name\n end\nreturn pet_by_name\n\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(petshop, name)\n for pet in petshop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n return pet if pet[:name] == pet_name\n end\n return nil\nend",
"def find_pet_by_name(shop, pet_name)\n for name in shop[:pets]\n if name[:name] == pet_name\n return name\n end\n end\n return\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, pet_name)\n for pet in pet_shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(shop, name)\n\n for pet in shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\n\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n pet = nil\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop[:name] == name\n pet = l_pet_shop\n end\n end\n return pet\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n for pet in pet_shop[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop,name)\n # name_hash = Hash.new\n for pet in pet_shop[:pets]\n if pet[:name] == name \n return pet\n end\n end\n\n return nil\nend",
"def find_pet_by_name(shop,name)\n pet_name = nil ##sets pet_name to nil to ensure nil is returned if pet name is not found. (Ruby will return nil anyway if not found, but good practice to ensure it's correct)\n for pet in shop[:pets]\n if pet[:name] == name\n pet_name = pet\n end\n end\n return pet_name\nend",
"def find_pet_by_name(shop, pet_name)\n for pet in shop[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, pet_name)\n\n for found_pet in pet_shop[:pets]\n if found_pet[:name] == pet_name\n #puts \"I found #{found_pet[:name]}.\"\n return found_pet\n end\n end\n return nil\n # if this is in the loop, it kills the process after only\n # checking the first one.\nend",
"def find_pet_by_name(shop, name)\n\n pets = shop[:pets]\n for pet in pets\n if pet[:name] == name\n return pet\n end\n end\n nil\nend",
"def find_pet_by_name(pet_shop, supplied_name)\n for pet in pet_shop[:pets]\n return pet if supplied_name == pet[:name]\n end\n return nil\nend",
"def find_pet_by_name(petshop,pet_name)\n petshop[:pets].each do \n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n return nil\n end",
"def find_pet_by_name(pet_shop, pet_name)\n for item in pet_shop[:pets]\n if item[:name] == pet_name\n return item\n end\n end\n return nil\nend",
"def find_pet_by_name (shop,pet_name)\n for pet in shop[:pets]\n if pet[:name] == pet_name\n return pet\n # else\n end\n end\nend",
"def find_pet_by_name(pet_shop, name)\n pet_shop[:pets].each do |pet|\n return pet if pet[:name] == name\n end\n return nil\n end",
"def find_pet_by_name(pet_shop, name)\n\n for animal in pet_shop[:pets]\n if animal[:name] == name\n p animal[:name]\n end\n end\n\nend",
"def find_pet_by_name(petshop,pet_name)\n for pet_hash in petshop[:pets] do \n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n return nil\n end",
"def find_pet_by_name(pets, pet_name)\n for pet in pets[:pets]\n if pet[:name] == pet_name\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop,pet_name)\n #if pet matches a name in the hash\n #return the hash of information\n match = nil\n for pet in pet_shop[:pets]\n match = pet if(pet[:name] == pet_name)\n end\n return match\n end",
"def find_pet_by_name(shop_hash, name_of_pet)\n for pet in shop_hash[:pets]\n if (pet[:name] == name_of_pet)\n return pet\n end\n end\n return nil\nend",
"def find_pet_by_name(pet_shop, name)\n return pet_shop[:pets][3]\nend",
"def find_pet_by_name(shop_hash, pet_name)\n for pet_hash in shop_hash[:pets]\n if pet_hash[:name] == pet_name\n return pet_hash\n end\n end\n # if no matches, we expect a program to return nil.\n return nil\nend",
"def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend",
"def find_pet_by_name(find_pet_array, name)\n for pet in find_pet_array[:pets]\n return pet if name == pet[:name]\n end\nend",
"def sell_pets \n self.dogs.each do |dog|\n dog.owner = nil\n dog.mood = \"nervous\"\n self.dogs.delete(dog)\n end \n self.cats.each do |cat|\n cat.owner = nil\n cat.mood = \"nervous\"\n self.cats.delete(cat)\n end\n end",
"def sell_pet_to_customer(pet_shop, pet, customer)\n pet_shop[:admin][:pets_sold] += pet\n customer[:pets] += pet\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n pet_shop[:pets].delete(pet)\nend",
"def find_pet_by_name(section, name)\n for pet in section[:pets]\n if pet[:name] == name\n return pet\n end\n end\n return nil\nend",
"def sell_pet_to_customer(shop, pet, customer)\n for animal in shop[:pets]\n if animal == pet && customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop,1)\n add_pet_to_customer(customer, pet)\n remove_pet_by_name(shop, pet)\n end\n end\nend",
"def find_pet_by_name(find_pet_array, name)\n for pet in find_pet_array[:pets]\n return pet if name == pet[:name]\n end\n return nil\nend",
"def remove_item(list, item_name)\n\t{|list| list.delete(\"mangoes\")}\nend",
"def turnover_pet\n selected_pet = choose_pet()\n @pets.delete(selected_pet.name.to_sym) # remove the pet from clients pet list\n\n return selected_pet\n end",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet) == true\n for animal in shop[:pets]\n if animal[:name] == pet[:name]\n amount = pet[:price]\n add_pet_to_customer(customer,pet)\n customer_pet_count(customer)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer,amount)\n add_or_remove_cash(shop,amount)\n end\n end\n end\nend",
"def mediterranean_ingredients\n\n mediterranean_list = shopping_list.select {|key, value| [:protein, :dairy, :fruits, :vegetables, :grains].include? key}\n mediterranean_list[:protein][:meat].pop\n mediterranean_list[:protein][:other] = [\"nuts\"]\n mediterranean_list[:dairy].delete(\"milk\")\n mediterranean_list\nend",
"def sell_pets\n pets.each do |species, pet_array| #enumerate through pets hash...\n pet_array.each do |pet_object| #then enumerate through pet_array within pets hash...\n #binding.pry\n pet_object.mood = \"nervous\" #set each pet_object's mood to \"nervous\"\n end\n end #end loop\n self.pets.clear #and reset Owner instance .pets to an empty array, that is returned\n end",
"def pets_by_breed(pet_shop, supplied_breed)\n saved_breeds = []\n for pet in pet_shop[:pets]\n saved_breeds.push(pet) if pet[:breed] == supplied_breed\n end\n return saved_breeds\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop == pet\n if customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n end\n end\n end\nend",
"def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend",
"def remove_product(name)\n @cart_items = @cart_items.select do |item|\n item.name != name\n end\n end",
"def pets_by_breed(petshop,breed)\n pets=[]\n petshop[:pets].each do\n |pet| \n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end",
"def find_pet_by_name(pet_shop_hash, pet_name)\n name_count = nil\n pet_shop_hash[:pets].each { | pet | name_count = pet if pet[:name] == pet_name}\n return name_count\nend",
"def remove_by_name(name)\n p = get_by_name(name)\n if (p != nil)\n return remove(p)\n end \n end",
"def pets_by_breed(shop, breed)\n matched_breeds = {}\n matched_breeds = shop[:pets].keep_if{|shop_pets| shop_pets[:breed] == breed}\n return matched_breeds\nend",
"def remove_by_name(list, item_to_remove)\n list.each do |current_item|\n if current_item[\"productName\"] == item_to_remove[\"productName\"]\n list.delete current_item\n end\n end\n end",
"def pets_by_breed(pet_shop,pet_breed)\n breeds = []\n for pet in pet_shop[:pets]\n if pet[:breed].include?(pet_breed)\n breeds.push(pet[:breed])\n end\n end\n return breeds\nend",
"def adopt_pet_from_shelter(animal_name, animal_instance_name, shelter_instance_name)\n @number_of_pets = @number_of_pets + 1\n @pets[animal_name] = animal_instance_name\n shelter_instance_name.animals.delete(animal_name)\n end",
"def pets_by_breed(pet_shop, breed)\n pets = [] # reminding myself again that the empty array will include the amount it has counted when searched\n for pet in pet_shop[:pets]\n if pet[:breed] == breed \n pets << pet\n end \n end\n #two ends because you are closing out the for and if\n return pets\nend",
"def sell_pets\n all_animals = self.pets.values\n\n all_animals.each do |species|\n species.each {|pet| pet.mood = \"nervous\"}\n species.clear\n end\n end",
"def pets_by_breed(pet_shop, breed)\n all_breed = []\n for l_breed in pet_shop[:pets]\n if l_breed[:breed] == breed\n all_breed.push(l_breed[:name])\n end\n end\n return all_breed\nend",
"def for_adoption(animal)\n @pets_list.pop(animal)\n end",
"def my_hash_deletion_method(source, thing_to_delete)\n p\tsource.delete_if { |pets| pets.to_s.include?(thing_to_delete) }\nend",
"def pets_by_breed(petshop,breed)\n pets=[]\n for pet in petshop[:pets] do\n if pet[:breed] == breed\n pets.push(breed) \n end\n end\n return pets\n end",
"def pets_by_breed(shop, type)\n pets = []\n for pet in shop[:pets]\n if pet[:breed] == type\n pets.push(pet)\n end\n end\n return pets\nend",
"def remove_from_grocery_list(grocery_list, item_name)\n # steps: remove item from hash\n grocery_list.delete(item_name.to_sym)\n # output: explicit return updated hash\n grocery_list\nend",
"def sell_pet_to_customer(shop, pet, customer)\n if find_pet_by_name(shop, pet) != nil\n then\n if customer_can_afford_pet(customer, pet)\n then\n add_pet_to_customer(customer, pet)\n # remove_pet_by_name(shop, pet)\n increase_pets_sold(shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\nend\nend\nend",
"def pets_by_breed(pet_shop, breed)\n pets_of_type_breed = []\n for pet in pet_shop[:pets]\n pets_of_type_breed << pet[:name] if pet[:breed] == breed\n end\n return pets_of_type_breed\nend",
"def sell_pets\n#this makes them all nervous\n pets.each do |species, animals|\n animals.each do |animal|\n animal.mood = \"nervous\"\n end\n animals.clear\n end\n end",
"def pets_by_breed(shop, breed_name)\n breed_name_array = []\n for pet in shop[:pets]\n if pet[:breed] == breed_name\n breed_name_array.push(pet)\n end\n end\n return breed_name_array\nend",
"def player_stats(player_n)\n # binding.pry\n game_hash.map do |location,team| \n team[:players].map do |player|\n if player[:player_name] == player_n\n #binding.pry\n # return player.delete_if {|stats, value| == player[:player_name]}\n return player.delete_if { |stat, value| [:player_name].include?(stat)}\n end \n end \n end \n return \"you idiot, your numbers are wrong\"\nend",
"def remove_item(list, item_name)\n if list.has_key?(item_name)\n list.delete(item_name)\n end\n list\nend",
"def pets_by_breed(shop, breed)\n pet_breed = []\n pets = shop[:pets]\n for pet in pets\n if pet[:breed] == breed\n pet_breed.push(pet)\n end\n end\n return pet_breed\nend",
"def pets_by_breed(pet_shop, breed)\n # breeds = []\n # for pet in @pet_shop[:pets]\n # if breed == pet[:breed]\n # breeds.push(pet)\n # end\n # end\n # return breeds\n #need to refactor this tonight\nend",
"def remove_item(hash, item_name)\r\n hash.delete(item_name)\r\n hash\r\nend",
"def remove_item(list, name)\r\n# create remove method with name arguments\r\n# check if item is in the hash\r\n if list[name] != nil\r\n# remove item if present\r\n list.delete(name)\r\n end\r\n# output: print \"your item has been deleted from the hash\"\r\n return list\r\nend"
] |
[
"0.9184563",
"0.9174257",
"0.91589785",
"0.91375655",
"0.91375655",
"0.91314197",
"0.9120993",
"0.90534735",
"0.9050981",
"0.8964858",
"0.8941127",
"0.88858527",
"0.8855327",
"0.8779129",
"0.87577677",
"0.870927",
"0.870882",
"0.8651011",
"0.8648881",
"0.8623571",
"0.85577404",
"0.85073596",
"0.845459",
"0.84064895",
"0.81416476",
"0.7736321",
"0.75855243",
"0.7552099",
"0.75167215",
"0.7485443",
"0.7421362",
"0.7419566",
"0.7411689",
"0.73737246",
"0.7355421",
"0.7355421",
"0.7350762",
"0.7343254",
"0.73310375",
"0.7324506",
"0.7322472",
"0.7322472",
"0.7307765",
"0.730488",
"0.7279822",
"0.7243967",
"0.7232201",
"0.7216607",
"0.7200878",
"0.7200037",
"0.7192223",
"0.71832734",
"0.71229154",
"0.708203",
"0.6954843",
"0.68893707",
"0.6886394",
"0.67198366",
"0.6710122",
"0.6606788",
"0.6585682",
"0.6577864",
"0.6572389",
"0.6571904",
"0.65420294",
"0.65403634",
"0.65077883",
"0.6433924",
"0.64056516",
"0.6371107",
"0.6340621",
"0.62608296",
"0.62491167",
"0.6248664",
"0.62434685",
"0.6235173",
"0.6235012",
"0.6221383",
"0.62209153",
"0.6206137",
"0.6170484",
"0.6166427",
"0.61629874",
"0.6135772",
"0.6135343",
"0.61271393",
"0.6123869",
"0.61233735",
"0.6084912",
"0.60776067",
"0.60774684",
"0.607696",
"0.607673",
"0.6076345",
"0.60514045",
"0.60423726",
"0.6032245",
"0.6028881",
"0.6019861",
"0.5998592"
] |
0.9138939
|
3
|
16 def customer_pet_count(customer) return customer[0].to_i end <omg i effed up here which is why i couldn't get 17 for ages i didn't realise, i over complicated things, i should just write functions to make the test pass rather than think of future possibilities urgh
|
def customer_pet_count(customer)
return customer[:pets].count
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def test_customer_pet_count\n count = customer_pet_count(@customers[0])\n assert_equal(0, count)\n end",
"def customer_pet_count(customer)\n return customer[:pets].count()\n # return customer[:pets].length()\n # return customer[:pets].size()\n end",
"def customer_pet_count(supplied_customer)\n return supplied_customer[:pets].length\nend",
"def customer_pet_count (customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(customers)\n return customers[:pets].count()\nend",
"def customer_pet_count(customer)\n customer[:pets].count\nend",
"def customer_pet_count(customer)\n customer[:pets].length()\nend",
"def customer_pet_count(number)\n return number[:pets].count\nend",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend",
"def customer_pet_count(customer_array)\n customer_array[:pets].count\nend",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n customer[:pets].count\n pet_shop[:admin][:pets_sold]\n customer[:cash]\n pet_shop[:admin][:total_cash]\nend",
"def sell_pet_to_customer(hash, pet, customer)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(hash, 1) #interger too specific why not pet.count.to_i?\n remove_customer_cash(customer, 900)\n add_or_remove_cash(hash, 900)\nend",
"def test_sell_pet_to_customer__pet_found\n customer = @customers[0]\n pet = find_pet_by_name(@pet_shop,\"Arthur\")# pre-exising function #9\n\n sell_pet_to_customer(@pet_shop, pet, customer)# need to define this function\n\n assert_equal(1, customer_pet_count(customer))#pre-existing\n assert_equal(1, pets_sold(@pet_shop))#pre-existing\n assert_equal(100, customer_cash(customer))#pre-existing\n assert_equal(1900, total_cash(@pet_shop))#pre-existing\n end",
"def test_sell_pet_to_customer__pet_found\n customer = @customers[0]\n pet = find_pet_by_name(@pet_shop,\"Arthur\")\n\n sell_pet_to_customer(@pet_shop, pet, customer)\n\n assert_equal(1, customer_pet_count(customer)) #checks the customer pet count so we need to add the pet into the :pets array\n assert_equal(1, pets_sold(@pet_shop)) #checks the pet is sold so we need to add 1 to admin: pets_sold:\n assert_equal(100, customer_cash(customer)) #checks the cash has been deducted from the customers cash e.g. customer cash should = customer cash - cost of the pet\n assert_equal(1900, total_cash(@pet_shop)) #checks the price of the pet is added to the total total cash\n end",
"def sell_pet_to_customer(petshop,pet,customer)\n\n if (customer[:cash] >= pet[:price]) #&& (petshop[:pets][:name] == pet[:name])\n customer[:pets].push(pet[:name])\n end\n # return customer[:pets].count()\n end",
"def sell_pet_to_customer(pet_shop, pet, customer)\n # the customer pet count increases by 1\n if pet != nil\n customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def add_pet_to_customer(customer,new_pet)\n customer[:pets].push(new_pet[:pet_type])\n return customer[:pets].count()\n end",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n else\n p \"Not enough dough :( \"\n end\n customer[:pets] << pet\n pet_shop[:admin][:pets_sold] += [:pets].count()\nend",
"def sell_pet_to_customer(shop,the_pet,the_customer)\n if the_pet != nil\n add_pet_to_customer(the_customer,the_pet)\n shop[:admin][:pets_sold] +=1\n remove_customer_cash(the_customer,the_pet[:price])\n add_or_remove_cash(shop,the_pet[:price])\n # else\n # shop[:admin][:pets_sold] +=1\n end\nend",
"def get_product_sales_count(toy_name,sales_sum,purchase_price_sum,product_purchase_cnt)\n\ttoy_name[\"purchases\"].each do |purchase_num|\n sales_sum = sum(sum: purchase_num[\"price\"] , sum1: purchase_num[\"shipping\"] , sum2: sales_sum)\n purchase_price_sum = sum(sum: purchase_num[\"price\"] ,sum1: purchase_price_sum)\n product_purchase_cnt += 1\n end\n return sales_sum,purchase_price_sum,product_purchase_cnt\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n\n\n if pet != nil && customer_can_afford_pet(customer, pet)\n\n add_pet_to_customer(customer, pet)\n customer_pet_count(customer)\n\n\n increase_pets_sold(pet_shop, customer_pet_count(customer))\n pets_sold(pet_shop)\n\n\n remove_customer_cash(customer, pet[:price])\n customer_cash(customer)\n\n add_or_remove_cash(pet_shop, pet[:price])\n total_cash(pet_shop)\n\n end\n\nend",
"def owner_pet_count(owner)\n return owner[:pets].length()\nend",
"def count_customers\n return customers().length\n end",
"def stock_count(pet_shop_pet_count)\n return pet_shop_pet_count[:pets].length\nend",
"def customers_count()\n return customers().length()\n end",
"def sell_pet_to_customer(shop, pet, customer)\n if find_pet_by_name(shop, pet) != nil\n then\n if customer_can_afford_pet(customer, pet)\n then\n add_pet_to_customer(customer, pet)\n # remove_pet_by_name(shop, pet)\n increase_pets_sold(shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\nend\nend\nend",
"def count_pet\n pets.count\n end",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet) == true\n for animal in shop[:pets]\n if animal[:name] == pet[:name]\n amount = pet[:price]\n add_pet_to_customer(customer,pet)\n customer_pet_count(customer)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer,amount)\n add_or_remove_cash(shop,amount)\n end\n end\n end\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count()\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count()\nend",
"def sell_pet_to_customer(shop, pet, customer)\n return if (pet == nil)\n if customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop,pet[:price])\nend\n\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet && customer_can_afford_pet(customer, pet) \n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if ((pet != nil) && customer_can_afford_pet(customer, pet))\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, customer[:pets].count())\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def stock_count(pet_shop)\nreturn pet_shop[:pets].length\nend",
"def stock_count(pet_shop)\n pet_shop[:pets].count()\nend",
"def num_of_customers()\n customers.size\nend",
"def count_drinks_customer()\n @drinks.count\n end",
"def stock_count(stock_number)\n return stock_number [:pets].count\nend",
"def sell_pet_to_customer(pet_shop, supplied_pet, supplied_customer)\n if supplied_pet != nil && customer_can_afford_pet(supplied_customer, supplied_pet) == true\n increase_pets_sold(pet_shop, 1)\n add_pet_to_customer(supplied_customer,supplied_pet)\n add_or_remove_cash(pet_shop, supplied_pet[:price])\n customer_pet_count(supplied_customer)\n remove_pet_by_name(pet_shop, supplied_pet[:name])\n end\nend",
"def sell_pet_to_customer(section, pet, customer)\n if pet && customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(section, 1)\n add_or_remove_cash(section, pet[:price])\n end\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\n customer[:pets].count\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def stock_count(count)\n return count[:pets].count\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer[:cash] >= pet[:price]\n customer[:pets].push(pet)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n end\nend",
"def sell_pet_to_customer(shop_name, sold_pet, customer)\n #p find_pet_by_name(shop_name, sold_pet) != nil\n if sold_pet != nil\n if customer_can_afford_pet(customer, sold_pet) == true\n add_pet_to_customer(customer, sold_pet)\n increase_pets_sold(shop_name, 1)\n remove_customer_cash(customer, sold_pet[:price])\n add_or_remove_cash(shop_name, sold_pet[:price])\n end\n end\nend",
"def sell_pet_to_customer(shop, pet, customer)\n customer[:cash] -= pet[:price]\n shop[:admin][:total_cash] += pet[:price]\n shop[:admin][:pets_sold] += 1\n customer[:pets] << shop[:pets][3]\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def customer_count()\n customers().count()\nend",
"def pet_count\n pets.count\n end",
"def stock_count(petshop)\n return petshop[:pets].size()\n end",
"def stock_count(pet_shop)\n return pet_shop[:pets].length\nend",
"def total_visit\n pet_histories.count\n end",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet)#this result returns true anyway and so my ==true in my version was not needed\n add_pet_to_customer(customer,pet)\n remove_pet_by_name(shop,pet)\n remove_customer_cash(customer,pet[:price])\n add_or_remove_cash(shop,pet[:price])\n increase_pets_sold(shop,1)\n end\nend",
"def test_customer_cash\n cash = customer_cash(@customers[0])#posion 0 in array = Alice = 1000\n assert_equal(1000, cash)\n end",
"def money_total(people)\n count = 0\n people.each do |person|\n count += person[:monies] \nend\nreturn count\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer_can_afford_pet(customer, pet)\n remove_pet_by_name(pet_shop, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def get_brand_revenue_count(brand_key_details,brand_revenue,brand_purchase_cnt)\n\tbrand_key_details[\"purchases\"].each do |purchase_brand|\n brand_purchase_cnt += 1\n brand_revenue = sum(sum: brand_revenue , sum1: purchase_brand[\"price\"] , sum2: purchase_brand[\"shipping\"] )\n end\n return brand_revenue , brand_purchase_cnt\nend",
"def count_money(people)\n total_money = 0\n for person in people\n total_money += person[:monies]\nend\nreturn total_money\nend",
"def sell_pet_to_customer__pet_found(customer_cash, pets)\n result = pet_found(\"Arthur\")\n assert_equal([:names] ,pets)\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop == pet\n if customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n end\n end\n end\nend",
"def sell_pet_to_customer(shop, pet, customer)\n if pet != nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop, 1)\n remove_pet_by_name(shop, pet[:name])\n customer[:cash] -= pet[:price]\n end\n end\nend",
"def test_it_can_count_invoices_per_id\n assert_equal 475, @sa.invoice_count_per_merchant_id.count\n end",
"def number_of_sales\n array_sales = sales\n num_sales = array_sales.length\n puts \"#{num_sales} #{name} were sold\"\n return num_sales\n end",
"def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend",
"def sell_pet_to_customer(shop, pet, customer)\n for animal in shop[:pets]\n if animal == pet && customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop,1)\n add_pet_to_customer(customer, pet)\n remove_pet_by_name(shop, pet)\n end\n end\nend",
"def stock_count(stock_count_array)\n stock_count_array[:pets].count\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n\n return if pet == nil\n # As the pet is not found, a nil value is returned\n # Thus the previous function, breaks producing anouther nil.\n # By returning the above, it meets a criteria and allows the\n # function to run.\n\n buying = customer_can_afford_pet(customer, pet)\n\n if buying\n customer[:pets].push(pet)\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:pets_sold] += 1\n remove_pet_by_name(pet_shop, pet[:name])\n end\nend",
"def total_no_customer()\n @@no_of_customer+=1\n puts \"The total number of customer is #{@@no_of_customer} \"\n puts \" \"\n end",
"def pet_count\n return @pets.count\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n return if pet == nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def sell_pet_to_customer(pet_store, bought_pet, customer)\n if bought_pet != nil && (customer[:cash] >= bought_pet[:price])\n add_pet_to_customer(customer, bought_pet)\n increase_pets_sold(pet_store, 1)\n remove_customer_cash(customer, bought_pet[:price])\n add_or_remove_cash(pet_store, bought_pet[:price])\n end\nend",
"def customer_can_afford_pet(customer, pet)\n return customer[:cash] >= pet[:price]\nend",
"def total_pets\n pets.count\n end",
"def customer_can_afford_pet(customer, pet)\n if customer[:cash] == pet[:price]\n end\n return true\nend",
"def stock_count(shop)\n return shop[:pets].length\nend",
"def stock_count(shop)\n return shop[:pets].length\nend",
"def how_many_customers?()\n customers_booked = customers()\n return customers.length()\n end",
"def number_of_customers()\n sql = 'SELECT title, SUM(CASE WHEN customer_id is NULL then 0 else 1 END) FROM tickets FULL OUTER JOIN screenings on tickets.screening_id = screenings.id FULL OUTER JOIN films on screenings.film_id = films.id WHERE films.id = $1 group by films.title'\n values = [@id]\n result = SqlRunner.run(sql, values)[0]['sum'].to_i\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def stock_count(shop)\n return shop[:pets].length\nend",
"def customer_can_afford_pet(customer, desired_pet)\n customer[:cash] >= desired_pet[:price]\nend",
"def calories_counter(orders)\n # TODO: return number of calories for a less constrained order\n total_calories = 0\n orders.each do |order|\n # if it returns a value = number, get the number;\n # otherwise run the method poor_calories_counter passing each item as an argument\n total_calories += MENU[order].is_a?(Fixnum) ? MENU[order] : poor_calories_counter(*MENU[order])\n # *MENU[order] es lo mismo que MENU[order][0], MENU[order][1], MENU[order][2]\n end\n p total_calories\nend",
"def customer_can_afford_pet(customer, pet)\n customer[:cash] >= pet[:price]\nend",
"def find_pet_by_name(pet_shop_hash, pet_name)\n name_count = nil\n pet_shop_hash[:pets].each { | pet | name_count = pet if pet[:name] == pet_name}\n return name_count\nend",
"def customer_can_afford_pet(customer, pet)\n if customer[:cash] >= pet[:price]\n return true\n else\n return false\n end\nend",
"def stock_count(shop)\n shop[:pets].length \nend",
"def customer_can_afford_pet(customer,new_pet)\n customer_cash=customer[:cash]\n @pet_shop[:pets].push(new_pet)\n for pet in @pet_shop[:pets] do\n if customer_cash >= pet[:price] \n return true\n else\n return false\n end\n end\n end",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= 100\n return true\n else\n return false\n end\nend",
"def countTheOranges\n\t\treturn @fruit_num\n\tend",
"def count_eggs(chicken_array)\n total_eggs = 0\n for chicken in chicken_array\n total_eggs += chicken[:eggs]\n end\n return total_eggs\nend",
"def total_review_character_count\n review_character_counts.inject(:+)\n end",
"def get_total_purchases(toy)\n\treturn toy['purchases'].length\nend"
] |
[
"0.82387346",
"0.82265157",
"0.79986286",
"0.79607755",
"0.7902534",
"0.78877056",
"0.78877056",
"0.7819954",
"0.7819954",
"0.78148544",
"0.7801166",
"0.77277195",
"0.7726995",
"0.7523292",
"0.7493414",
"0.73684174",
"0.7283029",
"0.7119066",
"0.6959188",
"0.6906957",
"0.6794097",
"0.6643656",
"0.66151357",
"0.6589169",
"0.65825737",
"0.65693724",
"0.65659535",
"0.65621775",
"0.6536359",
"0.6496976",
"0.648111",
"0.64518386",
"0.6442452",
"0.6431004",
"0.6375463",
"0.6375463",
"0.63691217",
"0.6332239",
"0.6295075",
"0.62884456",
"0.6270836",
"0.62674713",
"0.6252436",
"0.62484956",
"0.62422514",
"0.62376153",
"0.62370175",
"0.6232621",
"0.62324154",
"0.62324154",
"0.6222548",
"0.62223005",
"0.6219769",
"0.6213942",
"0.621235",
"0.6204768",
"0.6200394",
"0.61942",
"0.61937517",
"0.61903226",
"0.61800605",
"0.6165328",
"0.6163283",
"0.61151326",
"0.61047655",
"0.60948205",
"0.60848725",
"0.6068961",
"0.60522264",
"0.60298157",
"0.6022279",
"0.60219985",
"0.6015537",
"0.60068303",
"0.6004964",
"0.60005355",
"0.5993116",
"0.59910053",
"0.59700835",
"0.5966841",
"0.59433985",
"0.59419817",
"0.59359515",
"0.59359515",
"0.5934508",
"0.5932673",
"0.592583",
"0.5924353",
"0.59123933",
"0.59092116",
"0.5905317",
"0.5892722",
"0.5884057",
"0.58820057",
"0.588151",
"0.58809805",
"0.5867923",
"0.58581656",
"0.5857679",
"0.5856233"
] |
0.78623503
|
7
|
17 def add_pet_to_customer(customer, new_pet_hash) pet_count = customer[:pets].count for new_pet in new_pet_hash return pet_count.push(new_pet) end return pet_count.count end
|
def add_pet_to_customer(customer, new_pet_hash)
customer[:pets] << (new_pet_hash)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\n customer[:pets].count\nend",
"def add_pet_to_customer(customer,new_pet)\n customer[:pets].push(new_pet[:pet_type])\n return customer[:pets].count()\n end",
"def customer_pet_count (customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\n # return customer[:pets].length()\n # return customer[:pets].size()\n end",
"def customer_pet_count(customers)\n return customers[:pets].count()\nend",
"def add_pet_to_customer(customer_hash, new_pet)\n return customer_hash[:pets] << new_pet\nend",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(supplied_customer)\n return supplied_customer[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n else\n p \"Not enough dough :( \"\n end\n customer[:pets] << pet\n pet_shop[:admin][:pets_sold] += [:pets].count()\nend",
"def add_pet_to_customer(customer,new_pet)\n customer[:pets] << new_pet\n return\nend",
"def add_pet_to_customer(customers, new_pet)\n return customers[:pets] << new_pet\nend",
"def sell_pet_to_customer(petshop,pet,customer)\n\n if (customer[:cash] >= pet[:price]) #&& (petshop[:pets][:name] == pet[:name])\n customer[:pets].push(pet[:name])\n end\n # return customer[:pets].count()\n end",
"def customer_pet_count(customer)\n customer[:pets].length()\nend",
"def customer_pet_count(number)\n return number[:pets].count\nend",
"def add_pet_to_customer(supplied_customer, new_pet)\n supplied_customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n return customer[:pets].push(new_pet)\nend",
"def customer_pet_count(customer_array)\n customer_array[:pets].count\nend",
"def add_pet_to_customer(customer, new_pet)\n \n customer[:pets] << new_pet\n\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets] << new_pet\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\ncustomer[:pets].push(new_pet)\nend",
"def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n customer[:pets].count\n pet_shop[:admin][:pets_sold]\n customer[:cash]\n pet_shop[:admin][:total_cash]\nend",
"def add_pet_to_stock (pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n pet_to_be_added = stock_count(pet_shop)\n #return pet_shop.count\nend",
"def add_pet_to_customer(customer, pet)\n customer[:pets].push(pet)\nend",
"def add_pet_to_customer(customer, pet)\n customer[:pets].push(pet)\nend",
"def add_pet_to_stock(count, new_pet)\n count[:pets].push(new_pet)\n return count[:pets].length\nend",
"def sell_pet_to_customer(hash, pet, customer)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(hash, 1) #interger too specific why not pet.count.to_i?\n remove_customer_cash(customer, 900)\n add_or_remove_cash(hash, 900)\nend",
"def add_pet_to_stock (shop, new_pet)\n @pet_shop[:pets] << @new_pet\n def stock_count(shop)\n return @pet_shop [:pets].count\n end\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].count()\nend",
"def add_pet_to_customer(customer, new_friend)\n customer[:pets] << new_friend\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets] << new_pet\n return pet_shop[:pets].length\nend",
"def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend",
"def sell_pet_to_customer(shop, pet, customer)\n customer[:cash] -= pet[:price]\n shop[:admin][:total_cash] += pet[:price]\n shop[:admin][:pets_sold] += 1\n customer[:pets] << shop[:pets][3]\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer[:cash] >= pet[:price]\n customer[:pets].push(pet)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n end\nend",
"def increase_pets_sold(pet_shop_hash,sold)\n return pet_shop_hash[:admin][:pets_sold] += sold\nend",
"def increase_pets_sold(pet_shop_hash, new_pets)\n\tcurrent_number_pets = pet_shop_hash[:admin][:pets_sold]\n\tupdated_total_pets = current_number_pets + new_pets\n\tpet_shop_hash[:admin][:pets_sold] = updated_total_pets\nend",
"def increase_pets_sold(pet_shop, number_of_pets_sold)\n pet_shop[:admin][:pets_sold] += number_of_pets_sold\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count()\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count()\nend",
"def stock_count(pet_shop)\n pet_shop[:pets].count()\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].count\nend",
"def add_item_counts(cart:[])\n cart.each do |item|\n item.map { |food_item, info| info[:count] = count_item(food_item, cart) }\n end\nend",
"def add_pet_to_stock(pet_shop,new_customer)\n pet_shop[:pets]<<new_customer\n return\nend",
"def test_customer_pet_count\n count = customer_pet_count(@customers[0])\n assert_equal(0, count)\n end",
"def increase_pets_sold(increase, total)\n return increase[:admin][:pets_sold] += total\nend",
"def increase_pets_sold(pet_shop, amount_pets_sold)\n pet_shop[:admin][:pets_sold] += amount_pets_sold\nend",
"def increase_pets_sold(pet_shop, quantity)\n pet_shop[:admin][:pets_sold] += quantity\nend",
"def increase_pets_sold(pet_shop, increase)\n pet_shop[:admin][:pets_sold] += increase\nend",
"def count_pet\n pets.count\n end",
"def stock_count(count)\n return count[:pets].count\nend",
"def increase_pets_sold(pet_shop, pets_sold)\n pet_shop[:admin][:pets_sold] += pets_sold\nend",
"def increase_pets_sold(pet_shop, pets_sold)\n pet_shop[:admin][:pets_sold] += pets_sold\nend",
"def sell_pet_to_customer(shop,the_pet,the_customer)\n if the_pet != nil\n add_pet_to_customer(the_customer,the_pet)\n shop[:admin][:pets_sold] +=1\n remove_customer_cash(the_customer,the_pet[:price])\n add_or_remove_cash(shop,the_pet[:price])\n # else\n # shop[:admin][:pets_sold] +=1\n end\nend",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet) == true\n for animal in shop[:pets]\n if animal[:name] == pet[:name]\n amount = pet[:price]\n add_pet_to_customer(customer,pet)\n customer_pet_count(customer)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer,amount)\n add_or_remove_cash(shop,amount)\n end\n end\n end\nend",
"def add_pet_to_customer(name, pet_to_be_added)\n \nend",
"def find_pet_by_name(pet_shop_hash, pet_name)\n name_count = nil\n pet_shop_hash[:pets].each { | pet | name_count = pet if pet[:name] == pet_name}\n return name_count\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n # the customer pet count increases by 1\n if pet != nil\n customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def stock_count(pet_shop)\nreturn pet_shop[:pets].length\nend",
"def pet_count\n pets.count\n end",
"def stock_count(pet_shop_pet_count)\n return pet_shop_pet_count[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n pet_shop[:admin][:pets_sold] += pet\n customer[:pets] += pet\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n pet_shop[:pets].delete(pet)\nend",
"def sell_pet_to_customer(pet_shop_hash, new_pet, customer_hash)\n if new_pet != nil\n if customer_can_afford_pet(customer_hash, new_pet)\n remove_pet_by_name(pet_shop_hash, new_pet[:name])\n add_pet_to_customer(customer_hash, new_pet)\n remove_customer_cash(customer_hash, new_pet[:price])\n increase_pets_sold(pet_shop_hash, 1)\n add_or_remove_cash(pet_shop_hash,new_pet[:price])\n end\n end\nend",
"def stock_count(pet_shop)\n return pet_shop[:pets].length\nend",
"def increase_pets_sold(pets_sold_number, amount)\n return pets_sold_number[:admin][:pets_sold] += amount\nend",
"def number_of_pets\n @pets.keys.count\n end",
"def owner_pet_count(owner)\n return owner[:pets].length()\nend",
"def stock_count(petshop)\n return petshop[:pets].size()\n end",
"def increase_pets_sold(shop, number_sold)\n shop[:admin][:pets_sold] += number_sold\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n num_of_pets = pet_shop[:pets].length\n if num_of_pets < 7\n pet_shop[:pets] << {\n name: \"Seventh One\",\n pet_type: :elephant,\n breed: \"Big eared one\",\n price: 500\n }\n end\nend",
"def add_pet_to_stock(pet_shop_hash, new_pet)\n pet_shop_hash[:pets] << new_pet\nend",
"def total_visit\n pet_histories.count\n end",
"def pet_count\n return @pets.count\nend",
"def customer_can_afford_pet(customer,new_pet)\n customer_cash=customer[:cash]\n @pet_shop[:pets].push(new_pet)\n for pet in @pet_shop[:pets] do\n if customer_cash >= pet[:price] \n return true\n else\n return false\n end\n end\n end",
"def add_pet_to_owner(owner, pet_to_add)\n owner[:pets].push(pet_to_add)\nend",
"def add_item(grocery_hash, new_item)\n new_item.each do |i|\n grocery_hash[i] += 1\n end\n grocery_hash\nend",
"def add_pet_to_stock(pet_shop_hash, new_pet_hash)\n\tpet_shop_hash[:pets].push(new_pet_hash)\nend",
"def increase_pets_sold(petshop,sold)\n petshop[:admin][:pets_sold]+=sold\n end",
"def increase_pets_sold(shop, sold_amount)\n shop[:admin][:pets_sold] += sold_amount\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if ((pet != nil) && customer_can_afford_pet(customer, pet))\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, customer[:pets].count())\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop == pet\n if customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n end\n end\n end\nend",
"def count_drinks_customer()\n @drinks.count\n end",
"def add_pet_to_stock(shop_hash, new_pet_hash)\n shop_hash[:pets].push(new_pet_hash)\nend",
"def addPet\n\t\tnPets = @pets.to_i\n\t\tnPets = nPets + 1\n\t\t@pets = nPets.to_s\n\tend",
"def total_pets\n pets.count\n end",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet && customer_can_afford_pet(customer, pet) \n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def stock_count(stock_count_array)\n stock_count_array[:pets].count\nend"
] |
[
"0.90553266",
"0.8698751",
"0.8384979",
"0.8365112",
"0.83562917",
"0.83540976",
"0.83540976",
"0.83428615",
"0.82892483",
"0.8226913",
"0.8202133",
"0.81318766",
"0.8095511",
"0.8086703",
"0.8086703",
"0.80545545",
"0.8009464",
"0.7921758",
"0.7884926",
"0.78743595",
"0.7869786",
"0.7834533",
"0.7832915",
"0.78190607",
"0.7816121",
"0.78002965",
"0.77951586",
"0.77949935",
"0.77949935",
"0.77949935",
"0.7792449",
"0.7742585",
"0.7730785",
"0.7725424",
"0.7702462",
"0.7702462",
"0.7641006",
"0.7575039",
"0.7556932",
"0.75306165",
"0.74751574",
"0.74073744",
"0.7330293",
"0.7320886",
"0.72662276",
"0.7252564",
"0.72159255",
"0.7019033",
"0.69713223",
"0.6966382",
"0.69578254",
"0.69578254",
"0.6953801",
"0.6948564",
"0.6948564",
"0.6928268",
"0.6920525",
"0.68890715",
"0.68667406",
"0.6865365",
"0.685158",
"0.68367374",
"0.6820137",
"0.6819629",
"0.68123037",
"0.68123037",
"0.6794847",
"0.67622584",
"0.6753193",
"0.67445153",
"0.6742945",
"0.67214453",
"0.67136985",
"0.66963005",
"0.6685897",
"0.6684573",
"0.66834277",
"0.66505486",
"0.66399664",
"0.6635676",
"0.6629973",
"0.66060394",
"0.65845776",
"0.6566154",
"0.65598464",
"0.6550595",
"0.653385",
"0.64936537",
"0.6491712",
"0.6479552",
"0.64721483",
"0.64695543",
"0.64631945",
"0.64596844",
"0.64565593",
"0.6453397",
"0.6436731",
"0.64339834",
"0.64120185",
"0.640709"
] |
0.80319065
|
16
|
17 draft def add_pet_to_customer(customer, new_pet_hash) pet_count = [] for new_pet in new_pet_hash return pet_count.push(new_pet) end return pet_count.count end 18 & 19 this actually only took me a minute with new mindset. do minimum to pass, then change function to fit future possibilities. also step back and pay attention to the arguments given to the test.
|
def customer_can_afford_pet(customer, new_pet_hash)
if customer[:cash] > new_pet_hash[:price]
return true
else
return false
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\n customer[:pets].count\nend",
"def add_pet_to_customer(customer,new_pet)\n customer[:pets].push(new_pet[:pet_type])\n return customer[:pets].count()\n end",
"def add_pet_to_customer(customer_hash, new_pet)\n return customer_hash[:pets] << new_pet\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n else\n p \"Not enough dough :( \"\n end\n customer[:pets] << pet\n pet_shop[:admin][:pets_sold] += [:pets].count()\nend",
"def sell_pet_to_customer(hash, pet, customer)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(hash, 1) #interger too specific why not pet.count.to_i?\n remove_customer_cash(customer, 900)\n add_or_remove_cash(hash, 900)\nend",
"def add_pet_to_customer(customer, new_pet_hash)\n customer[:pets] << (new_pet_hash)\nend",
"def add_pet_to_customer(supplied_customer, new_pet)\n supplied_customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer,new_pet)\n customer[:pets] << new_pet\n return\nend",
"def sell_pet_to_customer(petshop,pet,customer)\n\n if (customer[:cash] >= pet[:price]) #&& (petshop[:pets][:name] == pet[:name])\n customer[:pets].push(pet[:name])\n end\n # return customer[:pets].count()\n end",
"def add_pet_to_customer(customers, new_pet)\n return customers[:pets] << new_pet\nend",
"def add_pet_to_customer(customer, new_pet)\n \n customer[:pets] << new_pet\n\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets] << new_pet\nend",
"def sell_pet_to_customer(pet_shop, pet_to_sell, customer)\n for pet_for_sale in pet_shop[:pets]\n if pet_for_sale[:name] == pet_to_sell\n customer[:pets].push(pet_to_sell)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet_to_sell[:price]\n pet_shop[:admin][:total_cash] += pet_to_sell[:price]\n end\n end\nend",
"def add_pet_to_customer(customer, new_pet)\n return customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\n customer[:pets].push(new_pet)\nend",
"def add_pet_to_customer(customer, new_pet)\ncustomer[:pets].push(new_pet)\nend",
"def sell_pet_to_customer(shop, pet, customer)\n customer[:cash] -= pet[:price]\n shop[:admin][:total_cash] += pet[:price]\n shop[:admin][:pets_sold] += 1\n customer[:pets] << shop[:pets][3]\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer[:cash] >= pet[:price]\n customer[:pets].push(pet)\n pet_shop[:admin][:pets_sold] += 1\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n end\nend",
"def sell_pet_to_customer(pet_shop_hash, new_pet, customer_hash)\n if new_pet != nil\n if customer_can_afford_pet(customer_hash, new_pet)\n remove_pet_by_name(pet_shop_hash, new_pet[:name])\n add_pet_to_customer(customer_hash, new_pet)\n remove_customer_cash(customer_hash, new_pet[:price])\n increase_pets_sold(pet_shop_hash, 1)\n add_or_remove_cash(pet_shop_hash,new_pet[:price])\n end\n end\nend",
"def add_pet_to_customer(customer, pet)\n customer[:pets].push(pet)\nend",
"def add_pet_to_customer(customer, pet)\n customer[:pets].push(pet)\nend",
"def add_pet_to_customer(customer, new_friend)\n customer[:pets] << new_friend\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n customer[:pets].count\n pet_shop[:admin][:pets_sold]\n customer[:cash]\n pet_shop[:admin][:total_cash]\nend",
"def customer_can_afford_pet(customer,new_pet)\n customer_cash=customer[:cash]\n @pet_shop[:pets].push(new_pet)\n for pet in @pet_shop[:pets] do\n if customer_cash >= pet[:price] \n return true\n else\n return false\n end\n end\n end",
"def sell_pet_to_customer(petshop,name,customer)\n for pet in petshop[:pets]\n if pet[:name] == name\n customers[:pets].push(pet)\n petshop[:admin][:pets_sold].push(pet)\n sold[:admin][:total_cash] += amount\n end\n end\n return nil\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n # the customer pet count increases by 1\n if pet != nil\n customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def test_sell_pet_to_customer__pet_found\n customer = @customers[0]\n pet = find_pet_by_name(@pet_shop,\"Arthur\")\n\n sell_pet_to_customer(@pet_shop, pet, customer)\n\n assert_equal(1, customer_pet_count(customer)) #checks the customer pet count so we need to add the pet into the :pets array\n assert_equal(1, pets_sold(@pet_shop)) #checks the pet is sold so we need to add 1 to admin: pets_sold:\n assert_equal(100, customer_cash(customer)) #checks the cash has been deducted from the customers cash e.g. customer cash should = customer cash - cost of the pet\n assert_equal(1900, total_cash(@pet_shop)) #checks the price of the pet is added to the total total cash\n end",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].count\nend",
"def customer_pet_count (customer)\n return customer[:pets].count\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].count()\nend",
"def add_pet_to_stock (pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n pet_to_be_added = stock_count(pet_shop)\n #return pet_shop.count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count\nend",
"def customer_pet_count(customer)\n customer[:pets].count\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\n # return customer[:pets].length()\n # return customer[:pets].size()\n end",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet) == true\n for animal in shop[:pets]\n if animal[:name] == pet[:name]\n amount = pet[:price]\n add_pet_to_customer(customer,pet)\n customer_pet_count(customer)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer,amount)\n add_or_remove_cash(shop,amount)\n end\n end\n end\nend",
"def customer_pet_count(customer)\n return customer[:pets].count()\nend",
"def add_pet_to_customer(name, pet_to_be_added)\n \nend",
"def sell_pet_to_customer(shop,the_pet,the_customer)\n if the_pet != nil\n add_pet_to_customer(the_customer,the_pet)\n shop[:admin][:pets_sold] +=1\n remove_customer_cash(the_customer,the_pet[:price])\n add_or_remove_cash(shop,the_pet[:price])\n # else\n # shop[:admin][:pets_sold] +=1\n end\nend",
"def customer_pet_count(supplied_customer)\n return supplied_customer[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet && customer_can_afford_pet(customer, pet) \n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def sell_pet_to_customer(shop_hash, wanted_pet_hash, customer_hash)\n # does the shop have the right pet? (BY PET HASH NOT NAME - we have no pre-defined function for this...)\n if shop_hash[:pets].include?(wanted_pet_hash)\n # nested if - if pet available, does customer have sufficient money?\n if customer_can_afford_pet?(customer_hash, wanted_pet_hash)\n # add pet to customer's pets list:\n add_pet_to_customer(customer_hash, wanted_pet_hash)\n # increment pets_sold count\n increase_pets_sold(shop_hash, 1)\n # customer spends cash:\n remove_customer_cash(customer_hash, wanted_pet_hash[:price])\n # shops earns cash:\n add_or_remove_cash(shop_hash, wanted_pet_hash[:price])\n else\n # insufficient funds\n end\n else\n # pet not found\n end\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets] << new_pet\n return pet_shop[:pets].length\nend",
"def add_pet_to_stock(count, new_pet)\n count[:pets].push(new_pet)\n return count[:pets].length\nend",
"def increase_pets_sold(pet_shop_hash, new_pets)\n\tcurrent_number_pets = pet_shop_hash[:admin][:pets_sold]\n\tupdated_total_pets = current_number_pets + new_pets\n\tpet_shop_hash[:admin][:pets_sold] = updated_total_pets\nend",
"def add_pet_to_stock(pet_shop,new_customer)\n pet_shop[:pets]<<new_customer\n return\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if ((pet != nil) && customer_can_afford_pet(customer, pet))\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, customer[:pets].count())\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def test_sell_pet_to_customer__pet_found\n customer = @customers[0]\n pet = find_pet_by_name(@pet_shop,\"Arthur\")# pre-exising function #9\n\n sell_pet_to_customer(@pet_shop, pet, customer)# need to define this function\n\n assert_equal(1, customer_pet_count(customer))#pre-existing\n assert_equal(1, pets_sold(@pet_shop))#pre-existing\n assert_equal(100, customer_cash(customer))#pre-existing\n assert_equal(1900, total_cash(@pet_shop))#pre-existing\n end",
"def customer_pet_count(customer_hash)\n return customer_hash[:pets].length\nend",
"def customer_pet_count(customers)\n return customers[:pets].count()\nend",
"def sell_pet_to_customer(pet_shop_details, wanted_pet, customer)\n return if wanted_pet == nil || !can_customer_afford_pet?(customer, wanted_pet)\n add_pet_to_owner(customer, wanted_pet)\n remove_customer_cash(customer, wanted_pet[:price])\n add_or_remove_cash(pet_shop_details, wanted_pet[:price])\n remove_pet_by_name(pet_shop_details, wanted_pet[:name])\n pet_shop_details[:admin][:sold_pets].push(wanted_pet)\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n pet_shop[:admin][:pets_sold] += pet\n customer[:pets] += pet\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:total_cash] += pet[:price]\n pet_shop[:pets].delete(pet)\nend",
"def add_pet_to_stock (shop, new_pet)\n @pet_shop[:pets] << @new_pet\n def stock_count(shop)\n return @pet_shop [:pets].count\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n for l_pet_shop in pet_shop[:pets]\n if l_pet_shop == pet\n if customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n end\n end\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n\n\n if pet != nil && customer_can_afford_pet(customer, pet)\n\n add_pet_to_customer(customer, pet)\n customer_pet_count(customer)\n\n\n increase_pets_sold(pet_shop, customer_pet_count(customer))\n pets_sold(pet_shop)\n\n\n remove_customer_cash(customer, pet[:price])\n customer_cash(customer)\n\n add_or_remove_cash(pet_shop, pet[:price])\n total_cash(pet_shop)\n\n end\n\nend",
"def sell_pet_to_customer(shop, pet, customer)\n if find_pet_by_name(shop, pet) != nil\n then\n if customer_can_afford_pet(customer, pet)\n then\n add_pet_to_customer(customer, pet)\n # remove_pet_by_name(shop, pet)\n increase_pets_sold(shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\nend\nend\nend",
"def sell_pet_to_customer(section, pet, customer)\n if pet && customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(section, 1)\n add_or_remove_cash(section, pet[:price])\n end\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n pet_shop[:pets].push(new_pet)\n return pet_shop[:pets].length\nend",
"def increase_pets_sold(pet_shop_hash,sold)\n return pet_shop_hash[:admin][:pets_sold] += sold\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def customer_pet_count(customer)\n return customer[:pets].length\nend",
"def sell_pet_to_customer(pet_shop, supplied_pet, supplied_customer)\n if supplied_pet != nil && customer_can_afford_pet(supplied_customer, supplied_pet) == true\n increase_pets_sold(pet_shop, 1)\n add_pet_to_customer(supplied_customer,supplied_pet)\n add_or_remove_cash(pet_shop, supplied_pet[:price])\n customer_pet_count(supplied_customer)\n remove_pet_by_name(pet_shop, supplied_pet[:name])\n end\nend",
"def sell_pet_to_customer(shop, pet, customer)\n return if (pet == nil)\n if customer_can_afford_pet(customer, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(shop,1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop,pet[:price])\nend\n\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n\n return if pet == nil\n # As the pet is not found, a nil value is returned\n # Thus the previous function, breaks producing anouther nil.\n # By returning the above, it meets a criteria and allows the\n # function to run.\n\n buying = customer_can_afford_pet(customer, pet)\n\n if buying\n customer[:pets].push(pet)\n pet_shop[:admin][:total_cash] += pet[:price]\n customer[:cash] -= pet[:price]\n pet_shop[:admin][:pets_sold] += 1\n remove_pet_by_name(pet_shop, pet[:name])\n end\nend",
"def test_customer_pet_count\n count = customer_pet_count(@customers[0])\n assert_equal(0, count)\n end",
"def sell_pet_to_customer(pet_shop, pet, customer)\n if pet != nil && customer_can_afford_pet(customer, pet)\n remove_pet_by_name(pet_shop, pet)\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def add_pet_to_stock(pet_shop, new_pet)\n num_of_pets = pet_shop[:pets].length\n if num_of_pets < 7\n pet_shop[:pets] << {\n name: \"Seventh One\",\n pet_type: :elephant,\n breed: \"Big eared one\",\n price: 500\n }\n end\nend",
"def customer_pet_count(customer)\n customer[:pets].length()\nend",
"def sell_pet_to_customer(shop, pet, customer)\n for animal in shop[:pets]\n if animal == pet && customer_can_afford_pet(customer, pet) == true\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop,1)\n add_pet_to_customer(customer, pet)\n remove_pet_by_name(shop, pet)\n end\n end\nend",
"def sell_pet_to_customer(shop, pet, customer)\n if pet != nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n add_or_remove_cash(shop, pet[:price])\n increase_pets_sold(shop, 1)\n remove_pet_by_name(shop, pet[:name])\n customer[:cash] -= pet[:price]\n end\n end\nend",
"def sell_pet_to_customer(pet_shop, pet, customer)\n return if pet == nil\n if customer_can_afford_pet(customer, pet) == true\n add_pet_to_customer(customer, pet)\n increase_pets_sold(pet_shop, 1)\n remove_customer_cash(customer, pet[:price])\n add_or_remove_cash(pet_shop, pet[:price])\n end\nend",
"def increase_pets_sold(pet_shop, number_of_pets_sold)\n pet_shop[:admin][:pets_sold] += number_of_pets_sold\nend",
"def sell_pet_to_customer(shop_name, sold_pet, customer)\n #p find_pet_by_name(shop_name, sold_pet) != nil\n if sold_pet != nil\n if customer_can_afford_pet(customer, sold_pet) == true\n add_pet_to_customer(customer, sold_pet)\n increase_pets_sold(shop_name, 1)\n remove_customer_cash(customer, sold_pet[:price])\n add_or_remove_cash(shop_name, sold_pet[:price])\n end\n end\nend",
"def sell_pet_to_customer(pet_store, bought_pet, customer)\n if bought_pet != nil && (customer[:cash] >= bought_pet[:price])\n add_pet_to_customer(customer, bought_pet)\n increase_pets_sold(pet_store, 1)\n remove_customer_cash(customer, bought_pet[:price])\n add_or_remove_cash(pet_store, bought_pet[:price])\n end\nend",
"def add_pet_to_stock(pet_shop_hash, new_pet)\n pet_shop_hash[:pets] << new_pet\nend",
"def customer_pet_count(customer_array)\n customer_array[:pets].count\nend",
"def sell_pet_to_customer(shop,pet,customer)\n if pet != nil && customer_can_afford_pet(customer,pet)#this result returns true anyway and so my ==true in my version was not needed\n add_pet_to_customer(customer,pet)\n remove_pet_by_name(shop,pet)\n remove_customer_cash(customer,pet[:price])\n add_or_remove_cash(shop,pet[:price])\n increase_pets_sold(shop,1)\n end\nend",
"def increase_pets_sold(pet_shop, amount_pets_sold)\n pet_shop[:admin][:pets_sold] += amount_pets_sold\nend",
"def customer_pet_count(number)\n return number[:pets].count\nend",
"def customer_can_afford_pet(customer, new_pet)\n customer[:cash] >= new_pet[:price]\nend",
"def increase_pets_sold(pet_shop, quantity)\n pet_shop[:admin][:pets_sold] += quantity\nend",
"def customer_can_afford_pet(customer,new_pet)\n customer[:cash] >= new_pet[:price]\nend",
"def increase_pets_sold(increase, total)\n return increase[:admin][:pets_sold] += total\nend",
"def increase_pets_sold(pet_shop, increase)\n pet_shop[:admin][:pets_sold] += increase\nend",
"def customer_can_afford_pet (customer,new_pet)\n if customer[:cash] < new_pet[:price]\n return false\n else\n return true\n end\n end",
"def increase_pets_sold(pets_sold_number, amount)\n return pets_sold_number[:admin][:pets_sold] += amount\nend",
"def customer_can_afford_pet(customers, new_pet)\n if customers[:cash] >= new_pet[:price]\n return true\n else\n return false\n end\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def add_item(grocery_hash, new_item)\n new_item.each do |i|\n grocery_hash[i] += 1\n end\n grocery_hash\nend",
"def add_pet_to_stock(pet_shop_hash, new_pet_hash)\n\tpet_shop_hash[:pets].push(new_pet_hash)\nend",
"def increase_pets_sold(pet_shop, pets_sold)\n pet_shop[:admin][:pets_sold] += pets_sold\nend",
"def increase_pets_sold(pet_shop, pets_sold)\n pet_shop[:admin][:pets_sold] += pets_sold\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n return true\n end\n return false\nend",
"def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n true\n else\n false\n end\nend",
"def customer_can_afford_pet(custo, new_pet)\n custo[:cash] > new_pet[:price]\nend",
"def customer_can_afford_pet(customer_hash, pet)\n if customer_hash[:cash] >= pet[:price]\n return true\n else\n return false\n end\nend"
] |
[
"0.8437562",
"0.82346445",
"0.7966029",
"0.7920524",
"0.78519315",
"0.785171",
"0.77273715",
"0.7685846",
"0.76098126",
"0.7587711",
"0.75509024",
"0.75497115",
"0.75424784",
"0.75359094",
"0.7519772",
"0.7519772",
"0.7519772",
"0.7490877",
"0.73833287",
"0.738042",
"0.73731357",
"0.7334399",
"0.7334399",
"0.7215396",
"0.7214602",
"0.70888597",
"0.7070762",
"0.70626944",
"0.7026712",
"0.69610244",
"0.69499785",
"0.6938997",
"0.6908072",
"0.6899492",
"0.6899492",
"0.6898246",
"0.6897637",
"0.6895262",
"0.68892854",
"0.68885064",
"0.6886115",
"0.68757343",
"0.6865811",
"0.68484545",
"0.6822593",
"0.6821008",
"0.68208224",
"0.68153244",
"0.6808364",
"0.68042976",
"0.6778271",
"0.67782277",
"0.6761649",
"0.67584133",
"0.6750532",
"0.674613",
"0.674453",
"0.67333645",
"0.67259586",
"0.6707722",
"0.6699286",
"0.6686075",
"0.6679263",
"0.6679263",
"0.66273654",
"0.6607245",
"0.65497994",
"0.65484524",
"0.6547351",
"0.65365237",
"0.64921546",
"0.64915204",
"0.649086",
"0.6489156",
"0.6403192",
"0.6378252",
"0.635117",
"0.63408864",
"0.63351095",
"0.632978",
"0.6327236",
"0.631484",
"0.6298846",
"0.62910795",
"0.6259339",
"0.6257913",
"0.6255362",
"0.625394",
"0.62498057",
"0.624453",
"0.6228262",
"0.6228262",
"0.62277865",
"0.6227155",
"0.6226221",
"0.6226221",
"0.6212854",
"0.6192916",
"0.61928",
"0.61845386"
] |
0.65980977
|
66
|
Checks if this numeric range intersects with another
|
def intersect?(o)
self.class == o.class && !(@to < o.numeric_from || o.numeric_to < @from)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def in_range?\n return self.range.include?([@x, @y])\n end",
"def covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def overlap? range\n !(self & range).nil?\n end",
"def within?(other)\n range_within_other?(self,other)\n end",
"def include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def intersection(range)\n int_a = (self.to_a & range.to_a) \n int_a.empty? ? nil : Range.new(int_a.min, int_a.max)\n end",
"def vt_intersects?(*args)\n vt_range.intersects?(*args)\n end",
"def touching?(range)\n range.end == self.start || self.end == range.start\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def overlaps?(range)\n !(completely_left_of?(range) || completely_right_of?(range))\n end",
"def tt_intersects?(*args)\n tt_range.intersects?(*args)\n end",
"def intersects?(other)\n raise \"NOT A CUBOID\" unless other.is_a? Cuboid \n self_range = range_finder\n other_range = other.range_finder\n\n self_range.each do |k,_|\n return false unless overlap?(self_range[k], other_range[k])\n end \n\n true \n end",
"def ==(other)\r\n @range == other.range\r\n end",
"def intersects?(other)\n @origin.keys.each do |axis|\n return false unless min_lte_max(axis, other) && max_gte_min(axis, other)\n end\n true\n end",
"def test_overlaping\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end",
"def range_intersect?(s1, s2)\n s1range = s1.to_a.min..s1.to_a.max\n s2range = s2.to_a.min..s2.to_a.max\n return s1range.include?(s2range.first) || s2range.include?(s1range.first)\nend",
"def included_in?(other_rect)\n self == self.intersects(other_rect)\n end",
"def subsume?(other)\n range_within_other?(other,self)\n end",
"def meets?(*args)\n other = coerce_range(*args)\n self.begin == other.end or other.begin == self.end\n end",
"def crossing?(other)\n return false unless overlaps?(other)\n (@begin_pos <=> other.begin_pos) * (@end_pos <=> other.end_pos) == 1\n end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def overlaps?(other); end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def intersect? (range1,range2)\n if range1.begin < range2.begin\n if range1.end < range2.begin\n nil\n else\n (range2.begin..range1.end)\n end\n else\n if range2.end < range1.begin\n nil\n else\n (range1.begin..range2.end)\n end\n end\nend",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def ==(other)\n (other.is_a? Interval) && (@start == other.start && @end == other.end)\n end",
"def merge(other)\n if include?(other.begin) || other.include?(self.begin)\n cmp = self.begin <=> other.begin\n if cmp < 0\n min = self.begin\n excl_begin = exclude_begin?\n elsif cmp > 0\n min = other.begin\n excl_begin = other.exclude_begin?\n else\n min = self.begin\n excl_begin = exclude_begin? && other.exclude_begin?\n end\n\n cmp = self.end <=> other.end\n if cmp > 0\n max = self.end\n excl_end = self.exclude_end?\n elsif cmp < 0\n max = other.end\n excl_end = other.exclude_end?\n else\n max = self.end\n excl_end = exclude_end && other.exclude_end?\n end\n\n MinMaxRange.create(excl_begin ? GtRange.new(min) : GtEqRange.new(min), excl_end ? LtRange.new(max) : LtEqRange.new(max))\n elsif exclude_end? && !other.exclude_begin? && self.end == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif other.exclude_end? && !exclude_begin? && other.end == self.begin\n # Adjacent, other before self\n from_to(other, self)\n elsif !exclude_end? && !other.exclude_begin? && self.end.next(:patch) == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif !other.exclude_end? && !exclude_begin? && other.end.next(:patch) == self.begin\n # Adjacent, other before self\n from_to(other, self)\n else\n # No overlap\n nil\n end\n end",
"def overlaps?(other)\n \t((start_date - other.end_date) * (other.start_date - end_date)) >= 0\n \tend",
"def intersects?(other)\n return false if self.xMax < other.xMin\n return false if self.xMin > other.xMax\n return false if self.yMax < other.yMin\n return false if self.yMin > other.yMax\n return false if self.zMax < other.zMin\n return false if self.zMin > other.zMax\n true\n end",
"def in_range?\n self > LOWER_BOUND && self <= UPPER_BOUND\n end",
"def intersect?(range1,range2)\nif range1.begin < range2.begin\n if range1.end < range2.begin\n nil\n else\n (range2.begin..range1.end)\n end\nelse\n if range2.end < range1.begin\n nil\n else\n (range1.begin..range2.end)\n end\nend\nend",
"def overlapInterval (array1, array2)\n\t@answer = false\n\t@a = array1[0] <= array2[0]\n\t@b = array1[1] > array2[0]\n\t@c = array1[0] > array2[0]\n\t@d = array1[0] < array2[1]\n\tif ((@a&&@b)||(@c&&@d))\n\t\t@answer = true\n\tend\n\t@answer\n\t\nend",
"def overlaps?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#overlaps? not defined.\"\n end",
"def overlaps?(another)\n (start_date - another.end_date) * (another.start_date - end_date) >= 0\n end",
"def within?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if other_range.include?(self.start) and other_range.include?(self.stop)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def intersection(range)\n cmp = self.begin <=> range.end\n if cmp > 0\n nil\n elsif cmp == 0\n exclude_begin? || range.exclude_end? ? nil : EqRange.new(self.begin)\n else\n cmp = range.begin <=> self.end\n if cmp > 0\n nil\n elsif cmp == 0\n range.exclude_begin? || exclude_end? ? nil : EqRange.new(range.begin)\n else\n cmp = self.begin <=> range.begin\n min = if cmp < 0\n range\n elsif cmp > 0\n self\n else\n self.exclude_begin? ? self : range\n end\n\n cmp = self.end <=> range.end\n max = if cmp > 0\n range\n elsif cmp < 0\n self\n else\n self.exclude_end? ? self : range\n end\n\n if !max.upper_bound?\n min\n elsif !min.lower_bound?\n max\n else\n MinMaxRange.new(min, max)\n end\n end\n end\n end",
"def intersects?(other)\n return false if self.equal?(other)\n !(above?(other) || below?(other) || right_of?(other) || left_of?(other) || behind?(other) || in_front_of?(other))\n end",
"def intersects?(other)\n !!intersection_with(other)\n end",
"def eql?(range)\n return false if range.nil? || low.nil? || range.low.nil? || high.nil? || range.high.nil?\n \n return low.value == range.low.value && low.inclusive? == range.low.inclusive? &&\n high.value == range.high.value && high.inclusive? == range.high.inclusive?\n end",
"def included?(range, number)\n if range.exclude_end?\n number >= range.begin && number < range.end\n else\n number >= range.begin && number <= range.end\n end\nend",
"def within?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if other_range.include?(self.start) and other_range.include?(self.stop)\n return true\n else\n return false\n end\n end",
"def overlaps?(other)\n (self.check_in - other.check_out) * (other.check_in - self.check_out) >= 0\n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def <=>(other) range_start <=> other.range_start end",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def during?(other)\n if other.is_a? Numeric\n other_begin = other_end = other\n else\n other_begin, other_end = other.begin, other.end\n end\n\n self_begin, self_end = self.begin, self.end\n\n # Check if either of the two items begins during the\n # span of the other\n other_begin <= self_begin && self_begin <= other_end ||\n self_begin <= other_begin && other_begin <= self_end\n end",
"def overlap(first_rect, second_rect)\n a1 = first_rect[0]\n a2 = first_rect[1]\n b1 = second_rect[0]\n b2 = second_rect[1]\n\n if b1[0] < a2[0] && b1[1] < a2[1]\n return true\n else \n return false\n end\n\nend",
"def range_include?(zelf, other)\n # 1...10 includes 1..9 but it does not include 1..10.\n operator = zelf.exclude_end? && !other.exclude_end? ? :< : :<=\n zelf.include?(other.first) && other.last.send(operator, zelf.last)\nend",
"def overlaps?(other)\n\t\tself.start_date < other.end_date && other.start_date < self.end_date\n\tend",
"def overlap?(input_range)\n a = self.start_date >= input_range.end_date\n b = self.end_date <= input_range.start_date\n return a || b ? false : true \n end",
"def overlaps?(other)\n start <= other.end_date && other.start <= self.end_date\n end",
"def test_disjoint\n x = IntegerRange.new(1, 2)\n y = IntegerRange.new(4, 5)\n\n assert_equal(x.mergeable?(y), false)\n assert_equal(y.mergeable?(x), false)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def overlaps?(other)\n !disjoint?(other)\n end",
"def test_range_overlap_for_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(1.0, segment.send(:range_overlap, 2.0..4.0))\n end",
"def overlaps?(other_slice)\r\n if ! other_slice.class == Slice\r\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\r\n end\r\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\r\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\r\n end\r\n\r\n self_range = self.start .. self.stop\r\n other_range = other_slice.start .. other_slice.stop\r\n\r\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def overlap?(rect)\n return false unless rect.is_a? Rectangle\n\n return (@x1 <= rect.x2 && \n @x2 >= rect.x1 && \n @y1 <= rect.y2 && \n @y2 >= rect.y1)\n end",
"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 intersection(other)\n raise ArgumentError, \"value must be a #{self.class.name}\" unless other.is_a?(VersionRange)\n result = @ranges.map { |range| other.ranges.map { |o_range| range.intersection(o_range) } }.flatten\n result.compact!\n result.uniq!\n result.empty? ? EMPTY_RANGE : VersionRange.new(result, nil)\n end",
"def overlaps?(other_slice)\n if ! other_slice.class == Slice\n raise RuntimeError, \"The Slice#overlaps? method takes a Slice object as its arguments.\"\n end\n if self.seq_region.coord_system != other_slice.seq_region.coord_system\n raise RuntimeError, \"The argument slice of Slice#overlaps? has to be in the same coordinate system, but were \" + self.seq_region.coord_system.name + \" and \" + other_slice.seq_region.coord_system.name\n end\n\n self_range = self.start .. self.stop\n other_range = other_slice.start .. other_slice.stop\n\n if self_range.include?(other_slice.start) or other_range.include?(self.start)\n return true\n else\n return false\n end\n end",
"def intersects?(other)\n return false if separate? other\n return false if contained? other\n return false if coincident? other\n true\n end",
"def test_range_overlap_for_non_intersecting_ranges\n segment = basic_segment\n segment.instance_variable_set(:@start_time, 1.0)\n segment.instance_variable_set(:@end_time, 3.0)\n\n assert_in_delta(0.0, segment.send(:range_overlap, 4.0..5.0))\n end",
"def intersects?(other)\n horizontal_intersection = self.horizontal_intersection?(other)\n vertical_intersection = self.vertical_intersection?(other)\n within_z_index_range = self.within_z_index_range?(other)\n\n return within_z_index_range && vertical_intersection && horizontal_intersection\n\n end",
"def intersects?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#intersects? not defined.\"\n end",
"def contains?(other)\n (other.begin_pos <=> @begin_pos) + (@end_pos <=> other.end_pos) >= (other.empty? ? 2 : 1)\n end",
"def intersect(other)\n begin_at = self.begin >= other.begin ? self.begin : other.begin\n end_at = self.end <= other.end ? self.end : other.end\n\n begin_at <= end_at ? self.class.new(begin_at..end_at) : nil\n end",
"def overlap(compare)\n if((@start <= compare.end && @start >= compare.start) ||\n (@end <= compare.end && @end >= compare.start) ||\n (compare.end <= @end && compare.end >= @start) ||\n (compare.start <= @end && compare.start >= @start))\n return true\n else\n return false\n end\n end",
"def inside_rect?(point1, point2)\n lats = [point1.lat, point2.lat].sort\n lons = [point1.lon, point2.lon].sort\n la = self.lat\n lo = self.lon\n\n (la >= lats[0] && la <= lats[1] && lo >= lons[0] && lo <= lons[1])\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def same?(other)\n (from_end == other.from_end and\n to_end == other.to_end and\n overlap == other.overlap)\n end",
"def test_merge_overlaping_1\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (1..10).to_a)\n end",
"def range_cover?(outer, inner)\n outer.cover?(inner.begin) && outer.cover?(inner.end)\nend",
"def check_non_overlapping?(indexes, range)\n return true if indexes.empty?\n\n indexes.each do |val|\n return false if val.cover?(range.begin) || val.cover?(range.end)\n end\n true\n end",
"def overlaps(first, second)\n return first.start.between?(second.start, second.end) ||\n first.end.between?(second.start, second.end) ||\n second.start.between?(first.start, first.end) ||\n second.end.between?(first.start, first.end)\nend",
"def in_range\n\t\trange = Set[1, 2, 3, 4, 5,\n\t\t\t\t\t\t\t\t6, 7, 8, 9, 10,\n\t\t\t\t\t\t\t 11, 12, 13, 14, 15,\n\t\t\t\t\t\t\t\t16, 17, 18, 19, 20,\n\t\t\t\t\t\t\t\t21, 22, 23, 24, 25,\n\t\t\t\t\t\t\t\t26, 27, 28, 29, 30]\n\n\t\tif @landmarks.subset?(range)\n\t\t\treturn true\n\t\tend\n\n\t\treturn false\n\tend",
"def & other_range\n case other_range\n when Range\n intersection = []\n each do |i|\n intersection << i if other_range.include? i\n end\n result = intersection.to_ranges\n case result[0]\n when Integer\n return (result[0])..(result[0])\n when Range, nil\n return result[0]\n end\n else\n raise \"unsupported type\"\n end\n end",
"def intersection(range)\n # Return self if nil (the other range has no restrictions) or if it matches the other range (they are equivalent)\n return self.clone if range.nil?\n return self.clone if eql?(range)\n\n # Figure out which range starts later (the more restrictive one)\n if low <= range.low\n earlier_start = self\n later_start = range\n else\n earlier_start = range\n later_start = self\n end\n \n # Return nil if there is no common time (the two ranges are entirely disjoint)\n return nil unless later_start.contains?(earlier_start.high)\n \n # Figure out which ranges ends earlier (the more restrictive one)\n if high >= range.high\n earlier_end = self\n later_end = range\n else\n earlier_end = range\n later_end = self\n end\n\n Range.new(\"TS\", later_start.low.clone, earlier_end.high.clone, nil)\n end",
"def intersect? rect\n rect.is_a?(Rectangle) && !(@x + @width < rect.x || rect.x + rect.width < @x || @y + @height < rect.y || rect.y + rect.height < @y)\n end",
"def intersection_of(range_a, range_b)\n range_a, range_b = [range_a, range_b].sort_by(&:begin)\n return if range_a.end < range_b.begin\n heads_and_tails = [range_a.begin, range_b.begin, range_a.end, range_b.end].sort\n middle = heads_and_tails[1..-2]\n middle[0]..middle[1]\n end",
"def e123_include_intersect (n, min, max)\n end",
"def intersects?(other)\n if origin <= other.origin\n vertices.each { |vertex| return true if vertex > other.origin }\n else\n other.vertices.each { |vertex| return true if vertex > origin }\n end\n false\n end",
"def in_ranges?(num, ranges)\n result = false\n ranges.each do |range|\n if range.include?(num)\n result = true\n end\n end\n return result\nend",
"def intersection(*args)\n other = coerce_range(*args)\n sorted = [self, other].sort\n\n return nil if self.class.compare(sorted[0].end, sorted[1].begin) < 0\n\n ARange[sorted[1].begin, self.class.min(sorted[1].end, sorted[0].end)]\n end",
"def test_abutting\n x = IntegerRange.new(1, 2)\n y = IntegerRange.new(3, 4)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end",
"def test_identical\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(1, 5)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end",
"def intersects?(other)\n (@x <= other.x_max && other.x <= @x_max) &\n (@y <= other.y_max && other.y <= @y_max) &\n (@z <= other.x_max && other.z <= @z_max)\n end",
"def within?(another_geometry)\n raise Error::UnsupportedOperation, \"Method Geometry#within? not defined.\"\n end",
"def between?(x,y) end",
"def >=(other_list)\n return false if self.list.empty?\n return true if other_list.list.empty?\n\n return (\n self.min_item[1] >= other_list.min_item[1] &&\n self.max_item[1] >= other_list.max_item[1]\n )\n end",
"def arel_intersect(start_column, end_column, start_or_instant_or_range=nil, range_end=nil)\n table = self.arel_table\n if range_end\n table[start_column].lt(range_end).and(table[end_column].gt(start_or_instant_or_range))\n elsif Range === start_or_instant_or_range\n table[start_column].lt(start_or_instant_or_range.db_end).and(table[end_column].gt(start_or_instant_or_range.db_begin))\n else\n start_or_instant_or_range ||= InfinityLiteral\n table[start_column].lteq(start_or_instant_or_range).and(table[end_column].gt(start_or_instant_or_range))\n end\n end",
"def between?(min, max)\n #This is a stub, used for indexing\n end",
"def date_range_overlap?(start_date_one, end_date_one, start_date_two, end_date_two)\n if start_date_one < end_date_two && start_date_two < end_date_one\n return true\n else\n return false\n end\n end",
"def intersects?(other)\n other.vertices.each do |vertex|\n return true if interior?(vertex)\n end\n false\n end",
"def valid_range?\n (0..@max_num).cover?(@number)\n end",
"def valid?(range)\n range[0] < range[1]\nend",
"def checkCollision?(other)\n refresh()\n other.refresh()\n \n xMin = @center_left[X]\n xMax = @center_right[X]\n yMin = @center_bottom[Y]\n yMax = @center_top[Y]\n\n xMax > other.center_left[X] && xMin < other.center_right[X] && \n yMin > other.center_top[Y] && yMax < other.center_bottom[Y]\n end"
] |
[
"0.7757763",
"0.73951113",
"0.72122",
"0.7132891",
"0.712935",
"0.7093643",
"0.70667654",
"0.7037788",
"0.7002646",
"0.6988205",
"0.6983293",
"0.6955906",
"0.69552076",
"0.69027674",
"0.68826234",
"0.68679166",
"0.6837399",
"0.6806454",
"0.6787957",
"0.677411",
"0.6744015",
"0.6724929",
"0.6724929",
"0.6724929",
"0.6711917",
"0.6688434",
"0.6676612",
"0.6645687",
"0.66211456",
"0.66007257",
"0.6589929",
"0.6589788",
"0.65763605",
"0.65583515",
"0.65405685",
"0.65332264",
"0.65315557",
"0.6531432",
"0.65257955",
"0.6514013",
"0.6509908",
"0.650437",
"0.6502127",
"0.64686984",
"0.6447054",
"0.6442466",
"0.64173067",
"0.63877386",
"0.6355362",
"0.63481885",
"0.63115495",
"0.6307868",
"0.63052213",
"0.62992597",
"0.6277621",
"0.62775445",
"0.62698495",
"0.62698495",
"0.6253611",
"0.62524223",
"0.6246718",
"0.6241816",
"0.62412965",
"0.62286586",
"0.62228936",
"0.6194093",
"0.6193881",
"0.6192094",
"0.61912477",
"0.6190796",
"0.61902344",
"0.6172342",
"0.61719954",
"0.61719954",
"0.61649585",
"0.616442",
"0.61544216",
"0.6146141",
"0.61418504",
"0.61382675",
"0.61209387",
"0.61029243",
"0.6085586",
"0.6061541",
"0.60545874",
"0.60522413",
"0.6037438",
"0.6033391",
"0.6031034",
"0.60165954",
"0.6013156",
"0.60083365",
"0.59946424",
"0.59795123",
"0.59751886",
"0.5975147",
"0.59695566",
"0.59661293",
"0.59575933",
"0.59573543"
] |
0.74312043
|
1
|
Returns the lower bound of the numeric range or `nil` if no lower bound is set.
|
def from
@from == -Float::INFINITY ? nil : @from
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def lower_bound_inclusive\n lower_bound\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def range_low_or_nil\n return nil unless respond_to?(:range) && respond_to?(:range_low)\n range_low unless range == I18n.t('comparables.missing')\n end",
"def min\r\n @range.min\r\n end",
"def low\n @range_low\n end",
"def lower_bound(data)\n return (q1(data) - (1.5 * iqr(data))).to_f\n end",
"def min\n @range.begin\n end",
"def search_lower_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) < 0\n lower = mid\n else \n upper = mid\n end\n end\n return upper\n end",
"def lower_bound\n self.class.lower_bound(@obs, z_value)\n end",
"def get_min\n @min ||= calculate_min\n end",
"def min\n @min || 0;\n end",
"def bsearch_lower_boundary(range = 0...length, &block)\n bsearch_boundary(true, range, &block)\n end",
"def lower_bound\n return 0 if total == 0\n \n (\n phat + dist_sq/(2*total) - dist * Math.sqrt((phat*(1-phat)+dist_sq/(4*total))/total)\n ) / (\n 1+dist_sq/total\n )\n end",
"def set_min( min )\n if IntegerOption.bounds_ok?( min, @max )\n @min = min\n else\n @min = nil\n raise \"invalid lower bound: #{ min.to_s }\"\n end\n end",
"def _lower_bound(array,value,l,r)\r\n return l if r==l\r\n ind=(r+l)/2\r\n return value<=array[ind] ? _lower_bound(array,value,l,ind) : _lower_bound(array,value,ind+1,r)\r\nend",
"def bound(min, max)\n self < min ? min : (self > max ? max : self)\n end",
"def min\n return @t_min\n end",
"def get_min()\n @min\n end",
"def least\n nil\n end",
"def get_min()\n end",
"def lower_left\n @lower_left ||= world.point(x_min, y_min)\n end",
"def find_min\n loc = find_min_locator and loc.value\n end",
"def get_min\n @min\n end",
"def min_point\n # generate the bounding box if not already done\n bounding_box\n # return the min\n @min\n end",
"def find_min()\r\n self.min\r\n end",
"def get_min()\n @min \n end",
"def min; end",
"def min; end",
"def get_min()\n @data.min\n end",
"def min() end",
"def lower_right\n @lower_right ||= world.point(x_max, y_min)\n end",
"def left\n @x_min\n end",
"def restrict_to_bounds(value, lower = 1, upper = nil)\n value_i = value.to_i\n\n value_i = upper if !upper.blank? && value_i > upper\n value_i = lower if !lower.blank? && value_i < lower\n\n value_i\n end",
"def minmax\n [min, unbounded? ? INFINITY : max]\n end",
"def minimum\n return @minimum\n end",
"def origin\n range.low\n end",
"def min\n to_a.min\n end",
"def smallest_range_i(a, k)\n result = a.max - a.min - 2 * k\n result >= 0 ? result : 0\nend",
"def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\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 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 min\n MSPhysics::Newton::Hinge.get_min(@address)\n end",
"def min()\n return stack.stack.last[:min]\n end",
"def find_lower_bound(string)\n @cache.bsearch_lower_boundary {|x| x[:search_term] <=> string}\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 min(a,b)\n a >= b ? a : b\nend",
"def range\n @range ||= set_range\n end",
"def minimum\n object.minimum.to_f\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend",
"def min(field)\n determine(field, :<=)\n end",
"def bsearch_first (range = 0 ... self.length, &block)\n boundary = bsearch_lower_boundary(range, &block)\n if boundary >= self.length || yield(self[boundary]) != 0\n return nil\n else \n return boundary\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 min\n end",
"def min\n end",
"def min\n return super if super.nil?\n (numeric_type == 'Integer') ? super.to_i : super.to_f\n end",
"def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end",
"def range_lower_alphas\n [ range(:lower_alphas) ]\n end",
"def bsearch_first (range = 0 ... self.length, &block)\r\n boundary = bsearch_lower_boundary(range, &block)\r\n if boundary >= self.length || yield(self[boundary]) != 0\r\n return nil\r\n else \r\n return boundary\r\n end\r\n end",
"def min( value )\n if value < self\n value\n else\n self\n end\n end",
"def bsearch_first(range = 0...length, &block)\n boundary = bsearch_lower_boundary(range, &block)\n if boundary >= length || yield(self[boundary]) != 0\n return nil\n else\n return boundary\n end\n\n end",
"def minimum_value\n @minimum_value || store.min\n end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def acceptable_min\n return unless min_max_validator\n\n min_max_validator.options[:in]&.min || type_related_acceptable_min\n end",
"def min(a,b)\n\tif !a.nil? and !b.nil?\n\t\treturn a if a <= b\n\t\treturn b\n\tend\t\n\t\n \treturn a if !a.nil? \n\n\treturn b if !b.nil?\nend",
"def min (row_num)\n row = @rows[row_num]\n min = row[0]\n row.each do |num|\n if min == 0 then\n min = num\n end\n if (num < min) && (num != 0) then\n min = num\n end\n end\n return min\n end",
"def get_applicable_normal_range\n\t\t\n\t\tres = self.ranges.select{|c|\n\t\t\tif k = c.get_picked_tag\n\t\t\t\tk.is_normal?\n\t\t\telse\n\t\t\t\tfalse\n\t\t\tend\n\t\t}\n\n\t\tif res.blank?\n\t\t\tnil\t\n\t\telse\n\t\t\tres[0]\n\t\tend\n\n\tend",
"def lbound(bound); end",
"def min(a,b)\n a < b ? a : b\n end",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend",
"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 get_minimum_number\n\t start = 0\n\t last = @src_array.length-1\n\n\t\twhile(@src_array[start] > @src_array[last])\n\t\t\tmid = start + (last-start)/2\n\t\t\tif (@src_array[mid] > @src_array[last])\n\t\t\t\tstart = mid+1\n\t\t\telse\n\t\t\t\tlast = mid\n\t\t\tend\n\t\tend\n\t\treturn @src_array[start]\n\tend",
"def min\n @v.compact.min\n rescue\n nil\n end",
"def get_min()\n # O(1) time\n @min.last\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!(greater_than_me)\n order_by_position(conditions).first\n end",
"def get_min()\n @min_stack[-1]\n end",
"def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"def smallest_number(num1, num2)\n\t[num1, num2].min\nend",
"def local_min(arr)\n mid = arr.length/2\n min = arr[mid]\n upper = arr.length-1\n lower = 0\n\n while !(arr[mid+lower+1] > min && arr[mid+lower-1] > min)\n # byebug\n #Calculate a new mid point and upper and lower bound.\n if arr[mid+1] < min \n lower = mid\n else\n upper = mid\n end\n mid = ((upper - lower) / 2) \n min = arr[mid + lower] \n end\n min\nend",
"def smallest_number(num1, num2)\n result = [num1, num2].min\n return result\nend",
"def &(range)\n return nil unless overlaps?(range) || touching?(range)\n PosRange.new [@start, range.start].max, [@end, range.end].min\n end",
"def min(x, s) \n\tif x < s\n\t\treturn x\n\tend\n \t\n\treturn s\nend",
"def probability_lower_than(value)\n probability_for_sides(:<, value)\n end",
"def smallest_number num1,num2\n\t[num1, num2].min\nend",
"def get_min()\n return self.min_stack[-1]\n end",
"def min x,y\n\t\treturn x if x < y\n\t\treturn y\n\tend",
"def casted_minimum\n minimum.blank? ? nil : (qtype_name == \"decimal\" ? minimum : minimum.to_i)\n end",
"def minimum\n Minimum.new(self)\n end",
"def sequence_lower(startp = sequence, endp = nil)\n change_sequences_to_negative(startp, endp, 1)\n change_sequences_to_positive(-startp + 1)\n end",
"def validation_min\n validation = validations? && validations.find do |validation|\n validation.kind == :numericality\n end\n\n if validation\n # We can't determine an appropriate value for :greater_than with a float/decimal column\n raise IndeterminableMinimumAttributeError if validation.options[:greater_than] && column? && [:float, :decimal].include?(column.type)\n\n if validation.options[:greater_than_or_equal_to]\n return (validation.options[:greater_than_or_equal_to].call(object)) if validation.options[:greater_than_or_equal_to].kind_of?(Proc)\n return (validation.options[:greater_than_or_equal_to])\n end\n\n if validation.options[:greater_than]\n return (validation.options[:greater_than].call(object) + 1) if validation.options[:greater_than].kind_of?(Proc)\n return (validation.options[:greater_than] + 1)\n end\n end\n end",
"def lower_item\n return nil unless in_list?\n\n conditions = scope_condition.merge!( greater_than_me )\n order_by_position(conditions).first\n end",
"def get_min()\n @min_stack[-1]\n end",
"def minvalue\n MINVALUE\n end",
"def bound(n,options={})\n min=(options[:min]||1).to_i\n max=(options[:max]||5).to_i\n default=(options[:default]||min).to_i\n [[(n||default).to_i,min].max,max].min\n end",
"def odb_min\n \"min(#{to_s})\"\n end",
"def min_of(a, b)\r\n return a <= b ? a : b\r\n end",
"def search_first(array, range=nil, &block)\n boundary = search_lower_boundary(array, range, &block)\n if boundary >= array.length || yield(array[boundary]) != 0\n return nil\n else \n return boundary\n end\n end"
] |
[
"0.70864326",
"0.6940991",
"0.6940991",
"0.6919367",
"0.68336606",
"0.682945",
"0.6618475",
"0.65854645",
"0.6330474",
"0.62928593",
"0.6227219",
"0.6217121",
"0.6120659",
"0.6094969",
"0.6069114",
"0.6019181",
"0.59719056",
"0.59341025",
"0.59183425",
"0.5891816",
"0.58531076",
"0.5841631",
"0.58378446",
"0.58289564",
"0.58096516",
"0.57739615",
"0.5750558",
"0.5728885",
"0.5728885",
"0.57204527",
"0.57023376",
"0.5685314",
"0.5684291",
"0.5677697",
"0.5640686",
"0.5636117",
"0.5615837",
"0.5596866",
"0.55917794",
"0.5589697",
"0.5586868",
"0.5586868",
"0.5546135",
"0.5526754",
"0.55160505",
"0.5501319",
"0.54915",
"0.548565",
"0.54820836",
"0.54688466",
"0.5459497",
"0.5459497",
"0.54571486",
"0.5454408",
"0.54472387",
"0.5443751",
"0.54411304",
"0.54411304",
"0.5431972",
"0.5430638",
"0.5426342",
"0.5424442",
"0.5422292",
"0.54182875",
"0.5394838",
"0.53714603",
"0.53632987",
"0.5363282",
"0.53376114",
"0.5336357",
"0.5332415",
"0.53179145",
"0.5313378",
"0.5312027",
"0.52886987",
"0.5284787",
"0.52822155",
"0.52543324",
"0.524703",
"0.5241511",
"0.52409625",
"0.5232214",
"0.5221511",
"0.52199876",
"0.52116966",
"0.52102137",
"0.520891",
"0.52076375",
"0.5207349",
"0.5203726",
"0.52000004",
"0.51987827",
"0.5186749",
"0.51820934",
"0.5177256",
"0.516701",
"0.5167",
"0.5165931",
"0.51642805",
"0.5161612",
"0.51581264"
] |
0.0
|
-1
|
Returns the upper bound of the numeric range or `nil` if no upper bound is set.
|
def to
@to == Float::INFINITY ? nil : @to
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_upper_limit_of(range)\n range.max\nend",
"def get_upper_limit_of(range)\n range.last\nend",
"def get_upper_limit_of(range)\n range.max\nend",
"def upper_bound; end",
"def get_upper_limit_of(range)\n range.end\nend",
"def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\n end",
"def upper_bound\n self.class.upper_bound(@obs, z_value)\n end",
"def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end",
"def get_max_range\n return @maxRange\n end",
"def max(upper_bound, inclusive = nil)\n @max = upper_bound\n @max_inclusive = inclusive\n end",
"def max(upper_bound, inclusive = nil)\n @max = upper_bound\n @max_inclusive = inclusive\n end",
"def search_upper_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) <= 0\n lower = mid\n else \n upper = mid\n end\n end\n return lower + 1 # outside of the matching range.\n end",
"def upper_bound(data)\n return (q3(data) + (1.5 * iqr(data))).to_f\n end",
"def max\n @range.end\n end",
"def bsearch_last (range = 0 ... self.length, &block)\r\n # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.\r\n boundary = bsearch_upper_boundary(range, &block) - 1\r\n\r\n if (boundary <= -1 || yield(self[boundary]) != 0)\r\n return nil\r\n else\r\n return boundary\r\n end\r\n end",
"def get_upper_limit_of(range)\n\tn = 1..20\n\tn.last\nend",
"def max\r\n @range.max\r\n end",
"def bsearch_upper_boundary (range = 0 ... self.length, &block)\r\n lower = range.first() -1\r\n upper = if range.exclude_end? then range.last else range.last + 1 end\r\n while lower + 1 != upper\r\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\r\n if yield(self[mid]) <= 0\r\n lower = mid\r\n else\r\n upper = mid\r\n end\r\n end\r\n return lower + 1 # outside of the matching range.\r\n end",
"def high\n @range_high\n end",
"def ubound(bound)\n self > bound ? bound : self\n end",
"def max\n if @end.nil?\n ::Kernel.raise ::RangeError, 'cannot get the maximum of endless range'\n elsif block_given?\n super\n elsif !@begin.nil? && (@begin > @end ||\n @excl && @begin == @end)\n nil\n else\n `#{@excl} ? #{@end} - 1 : #{@end}`\n end\n end",
"def bsearch_last(range = 0...length, &block)\n # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.\n boundary = bsearch_upper_boundary(range, &block) - 1\n (boundary <= -1 || yield(self[boundary]) != 0) ? nil : boundary\n end",
"def effective_maximum\n maximum_bound ? maximum_bound.value : Infinity\n end",
"def search_last(array, range=nil, &block)\n # `- 1' for canceling `lower + 1' in bsearch_upper_boundary.\n boundary = search_upper_boundary(array, range, &block) - 1\n\n if (boundary <= -1 || yield(array[boundary]) != 0)\n return nil\n else\n return boundary\n end\n end",
"def restrict_to_bounds(value, lower = 1, upper = nil)\n value_i = value.to_i\n\n value_i = upper if !upper.blank? && value_i > upper\n value_i = lower if !lower.blank? && value_i < lower\n\n value_i\n end",
"def range_upper_alphas\n [ range(:upper_alphas) ]\n end",
"def bounds\n Bounds.none\n end",
"def range_low_or_nil\n return nil unless respond_to?(:range) && respond_to?(:range_low)\n range_low unless range == I18n.t('comparables.missing')\n end",
"def bounds(arr)\n min, max = arr.min(), arr.max()\n range = max - min\n # how many figures in the range\n range_digits = Math.log10(range).ceil()\n range_scale = 10.0**(range_digits-1)\n min_bound = ((min / range_scale) - 1) * range_scale\n max_bound = ((max / range_scale) + 1) * range_scale\n return min_bound, max_bound, range_scale\n end",
"def bound(min, max)\n self < min ? min : (self > max ? max : self)\n end",
"def empty?\n return false if @upper_bound.nil?\n @lower_bound > @upper_bound\n end",
"def in_range?\n self > LOWER_BOUND && self <= UPPER_BOUND\n end",
"def increment_upper\n Range.new(self.begin, self.end + 1)\n end",
"def upper_bound(key)\n # Return traversal stack to key\n leaf, stack = walk_towards_key(key)\n\n # Pop the stack until empty\n until stack.empty?\n node, node_id = *stack.last\n\n # If current item is leaf, return if\n # item.key > key\n if node.leaf?\n if node.item.key.to_bn > key.to_bn\n return node.item\n end\n\n # If inner node, select next higher\n # branch to traverse\n else\n branch = nil\n if v2?\n if node.common_prefix?(key)\n branch = node_id.select_branch(key) + 1\n elsif key.to_bn < node.common.to_bn\n branch = 0\n else\n branch = 16\n end\n else\n branch = node_id.select_branch(key) + 1\n end\n\n # Start traversal from selected branch\n # on up, returning first node below\n # non-empty branches\n inner = node\n branch.upto(15) { |b|\n next if inner.empty_branch?(b)\n node = descend_throw inner, b\n leaf, stack = first_below node, stack, b\n raise Error::MissingNode unless leaf\n return leaf.item\n }\n end\n\n stack.pop\n end\n\n # If no items > this one, return map_end\n map_end\n end",
"def max\n @max ||= define_min_and_max && @max\n end",
"def bottom\n @x_max\n end",
"def range\n @range ||= set_range\n end",
"def get_bounds\n [ @min, @max ]\n end",
"def maximum (value = nil)\n\t\tif value\n\t\t\traise_if_error C.glyr_opt_number(to_native, value)\n\t\telse\n\t\t\tto_native[:number]\n\t\tend\n\tend",
"def last\n @range.last\n end",
"def upper_right\n @upper_right ||= world.point(x_max, y_max)\n end",
"def minmax\n [min, unbounded? ? INFINITY : max]\n end",
"def range\n @range ||= 0.upto(@limit)\n end",
"def max\n\t\t@max || nil\n\tend",
"def search_lower_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) < 0\n lower = mid\n else \n upper = mid\n end\n end\n return upper\n end",
"def get_max\n @max ||= calculate_max\n end",
"def ymax\n compound.ymax\n end",
"def set_max( max )\n if IntegerOption.bounds_ok?( @min, max )\n @max = max\n else\n @max = nil\n raise \"invalid upper bound: #{ max.to_s }\"\n end\n end",
"def bounds\n @bounds ||= Bounds.from_grpc @grpc\n end",
"def max_range(array)\r\n\r\n array.max - array.min # max and min methods used\r\nend",
"def range\n DEFAULT_RANGE\n end",
"def range\n DEFAULT_RANGE\n end",
"def range\n DEFAULT_RANGE\n end",
"def bounds(metric)\n (metric.respond_to?(:bounds) && metric.bounds) || [nil, nil]\n end",
"def out_of_bound?(value, min, max)\n return value > max || value < min\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def height\n bounds[:bottom] - bounds[:top]\n end",
"def bottom_value\n @relevant_data ? points.minimum_value : nil\n end",
"def unbounded?(unbounded_type = nil)\n return false unless numeric?\n\n unboundedness = case unbounded_minimum | unbounded_maximum\n when 3 then :infinite\n when 2 then :maximum\n when 1 then :minimum\n end\n\n return unbounded_type && unboundedness ? ( unboundedness == :infinite ) || ( unboundedness == unbounded_type ) : unboundedness\n end",
"def bounds(values)\n q1 = values.percentile(25)\n q3 = values.percentile(75)\n iqr = q3 - q1\n lower = q1 - (iqr * 1.5)\n upper = q3 + (iqr * 1.5)\n inrange = values.select { |v| v >= lower && v <= upper }\n lower = [lower, inrange.min].max\n upper = [upper, inrange.max].min\n belowrange = values.select { |v| v < lower }\n aboverange = values.select { |v| v > upper }\n [belowrange, lower, upper, aboverange]\nend",
"def lower_bound_inclusive\n lower_bound\n end",
"def price_at_maximum\n qty = breaks.last.minimum\n qty -= 1 unless breaks.empty?\n brk = breaks.last.marginal.nil? ? breaks[-2] : breaks[-1]\n return nil unless brk\n brk.price_at(qty)\n end",
"def range\n object.range + DEFAULT_MAX_DISTANCE\n end",
"def windowed_max_range(arr, range)\n current_max_range = nil\n\n arr.each_index do |idx|\n idx2 = idx + range\n break if idx2 > (arr.length - 1)\n window = arr[idx..idx2]\n p diff = window.max - window.min\n current_max_range = diff if current_max_range.nil? || diff > current_max_range\n end\n current_max_range\nend",
"def ymax\n @opened ? @ymax : nil\n end",
"def filter_upper_than(input_hash, bound)\n return input_hash.select { |k, v| v > bound}\n end",
"def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end",
"def last_row_num_in_group(grp_num)\n if grp_num > boundaries.size || grp_num < 0\n raise ArgumentError, \"group number #{grp_num} out of bounds\"\n else\n boundaries[grp_num]\n end\n end",
"def allocation_range\n (@iprange or @subnet).to_range\n end",
"def max_tb_rangeE; @max_se; end",
"def get_max\n @max\n end",
"def upper_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = (0.25*(3*sorted_array.length))\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n return sample+((sample1-sample)*(u-u.truncate))\n end\n end",
"def bounds(shape)\n check_pre((\n (shape?(shape))\n ))\n\n if comp_shape?(shape)\n b1 = bounds(shape.left)\n b2 = bounds(shape.right)\n\n return bounding_range(b1, b2)\n elsif prim_shape?(shape)\n return shape\n else\n check_pre(false)\n end\nend",
"def highest_height\n i = acc.reverse.find_index{|i|!i.nil?}\n i ||= 0\n acc.length - i\n end",
"def upper_level_bounds\n {\n x: G.current_level.pixel_width - width / 2,\n y: G.current_level.pixel_height - height / 2\n }\n end",
"def max\n empty? ? -Float::INFINITY : @list.head.value[2]\n end",
"def bounds\n end",
"def range_to_value\n return nil if range.nil?\n if val = self.ranges[range.to_sym]\n val.value.call\n else\n raise TypeError, \"invalid range #{range}. Please define it.\"\n end\n end",
"def bound a, upper, lower\n size = a.size1 * a.size2\n\n size.times do |i|\n value = a[i] \n if upper and value > upper\n a[i] = upper\n elsif lower and value < lower\n a[i] = lower\n end\n end\n \n a\n end",
"def get_max\n return if is_empty?\n return @root.val\n end",
"def max\n if valid?\n max_value\n end\n end",
"def span\r\n if @range.none?\r\n 0\r\n else\r\n @range.max - @range.min + 1\r\n end\r\n end",
"def range(arr)\n arr.max - arr.min\nend",
"def range(arr)\n arr.max - arr.min\nend",
"def max\n [self.begin, self.end].max\n end",
"def end\n @ranges.size == 1 ? @ranges[0].end : nil\n end",
"def max_range(array)\n \nend",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def between(expected, upper = nil)\n if expected.kind_of?(Range)\n set_relativity(:between, expected)\n elsif upper.nil?\n raise ArgumentError,\n 'You must supply an upper boundary for the collection size'\n else\n set_relativity(:between, (expected..upper))\n end\n end",
"def max_point\n # generate the bounding box if not already done\n bounding_box\n # return the max\n @max\n end",
"def upper_address\n return @upper_address\n end",
"def get_max()\n end",
"def bound(n,options={})\n min=(options[:min]||1).to_i\n max=(options[:max]||5).to_i\n default=(options[:default]||min).to_i\n [[(n||default).to_i,min].max,max].min\n end",
"def random_number(lower_bound, upper_bound)\r\n check_bounds(lower_bound, upper_bound)\r\n return Random.rand(lower_bound..upper_bound)\r\n end",
"def range(arr)\narr.max - arr.min\nend",
"def low\n @range_low\n end",
"def max; end",
"def max; end",
"def bounds\n \t@data['bounds']\n end",
"def range(data)\n return (minimum(data)..maximum(data))\n end"
] |
[
"0.7003224",
"0.6996898",
"0.6988062",
"0.694209",
"0.6913337",
"0.6880352",
"0.64768565",
"0.6392105",
"0.63720334",
"0.6326327",
"0.6326327",
"0.6283211",
"0.62788314",
"0.6253783",
"0.6228228",
"0.61970323",
"0.61684996",
"0.6139089",
"0.6065292",
"0.60475487",
"0.60424936",
"0.5961694",
"0.58992547",
"0.58327967",
"0.5797786",
"0.5641378",
"0.56398576",
"0.56381315",
"0.5515371",
"0.546619",
"0.54660225",
"0.5417769",
"0.5412866",
"0.54018897",
"0.5396528",
"0.53908336",
"0.5389089",
"0.537747",
"0.5365452",
"0.53650403",
"0.53536385",
"0.5341315",
"0.53230715",
"0.531072",
"0.5268614",
"0.52281624",
"0.52232313",
"0.5222959",
"0.5210835",
"0.5205951",
"0.5177187",
"0.5177187",
"0.5177187",
"0.51653486",
"0.51587576",
"0.5150068",
"0.5150068",
"0.51360023",
"0.5134967",
"0.5113728",
"0.51112926",
"0.510962",
"0.51016855",
"0.50904274",
"0.5076806",
"0.5057232",
"0.5051728",
"0.50501645",
"0.50478715",
"0.5047293",
"0.5045168",
"0.50433064",
"0.50415987",
"0.50405234",
"0.5027958",
"0.5020019",
"0.5015516",
"0.50127804",
"0.50121963",
"0.5007652",
"0.5004533",
"0.50043166",
"0.49967608",
"0.49967608",
"0.49949175",
"0.49899772",
"0.49663302",
"0.4964534",
"0.4964534",
"0.49576187",
"0.4957168",
"0.4954921",
"0.4954821",
"0.49544767",
"0.4939661",
"0.49353695",
"0.493212",
"0.4919429",
"0.4919429",
"0.49140683",
"0.49060658"
] |
0.0
|
-1
|
Same as from but will return `Float::Infinity` instead of `nil` if no lower bound is set.
|
def numeric_from
@from
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def from\n @from == -Float::INFINITY ? nil : @from\n end",
"def lower_bound\n self.class.lower_bound(@obs, z_value)\n end",
"def lower_bound(data)\n return (q1(data) - (1.5 * iqr(data))).to_f\n end",
"def lower_bound_inclusive\n lower_bound\n end",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\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 low\n @range_low\n end",
"def minmax\n [min, unbounded? ? INFINITY : max]\n end",
"def range_low_or_nil\n return nil unless respond_to?(:range) && respond_to?(:range_low)\n range_low unless range == I18n.t('comparables.missing')\n end",
"def lower_bound\n return 0 if total == 0\n \n (\n phat + dist_sq/(2*total) - dist * Math.sqrt((phat*(1-phat)+dist_sq/(4*total))/total)\n ) / (\n 1+dist_sq/total\n )\n end",
"def to\n @to == Float::INFINITY ? nil : @to\n end",
"def bound(min, max)\n self < min ? min : (self > max ? max : self)\n end",
"def min\r\n @range.min\r\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def minimum\n object.minimum.to_f\n end",
"def ∞ℂ; ::Float::INFINITY_COMPLEX; end",
"def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\n end",
"def to_f\n if isFloat? then\n value = exp.to_f\n return value\n elsif exp == \"Infinity\" then return @@MAX_VALUE\n elsif exp == \"-Infinity\" then return @@MIN_VALUE\n else\n raise \"Non-float conversion in expression: \" + exp\n end\n end",
"def infinity\n @infinity ||= Point.new(self, :infinity)\n end",
"def bottom_value\n @relevant_data ? points.minimum_value : nil\n end",
"def min\n to_a.min\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 origin\n range.low\n end",
"def min\n @min || 0;\n end",
"def normalize(value)\n return 0.0 if near_zero_or_less? value\n return 1.0 if near_one_or_more? value\n value\n end",
"def get_min\n @min ||= calculate_min\n end",
"def min() end",
"def min\n return super if super.nil?\n (numeric_type == 'Integer') ? super.to_i : super.to_f\n end",
"def min\n @range.begin\n end",
"def normalized\n @normalized ||= valid_range? ? range : normalized_range(range)\n rescue Exception => e \n # puts e.message\n value\n end",
"def least\n nil\n end",
"def min_x\n c2f_x(0)\n end",
"def float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end",
"def min; end",
"def min; end",
"def near_zero_or_less?(value)\n (value < 0.0 or near_zero?(value))\n end",
"def normalize\n store.normalize(minimum: minimum_value, spread: @spread)\n end",
"def loose_bounds\n return [@min, @max].collect { |p| Point.new(p) }\n end",
"def upper_bound; end",
"def lower(amount)\n return Temperature.new(@value - amount, scale)\n end",
"def bsearch_lower_boundary(range = 0...length, &block)\n bsearch_boundary(true, range, &block)\n end",
"def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end",
"def inf_norm\n self.to_a.map do |a|\n a.map do |ar|\n ar.abs\n end.inject(&:+)\n end.sort[0]\n end",
"def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end",
"def too_low? temp # check if temp is below absolute zero\n temp < 0\nend",
"def clamp; end",
"def min( value )\n if value < self\n value\n else\n self\n end\n end",
"def ubound(bound)\n self > bound ? bound : self\n end",
"def search_lower_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) < 0\n lower = mid\n else \n upper = mid\n end\n end\n return upper\n end",
"def checked(value)\n value = zero() if value.respond_to?(:nan?) && value.nan?\n value = zero() if value.respond_to?(:infinity?) && value.infinity?\n value = zero() if value.nil?\n value = value.to_f if value.is_a? BigDecimal\n\n value\n end",
"def casted_minimum\n minimum.blank? ? nil : (qtype_name == \"decimal\" ? minimum : minimum.to_i)\n end",
"def min\n @v.compact.min\n rescue\n nil\n end",
"def floor(target: COMMON_SCALE_FACTORS)\n dup.floor!(target: target)\n end",
"def min_tb_rangeF; @min_sf; end",
"def literal_float(value)\n if value.finite?\n super\n elsif value.nan?\n \"'NaN'\"\n elsif value.infinite? == 1\n \"'Infinity'\"\n else\n \"'-Infinity'\"\n end\n end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def floor!(target: COMMON_SCALE_FACTORS)\n round!(target: target, direction: -1)\n end",
"def get_min()\n end",
"def set_min( min )\n if IntegerOption.bounds_ok?( min, @max )\n @min = min\n else\n @min = nil\n raise \"invalid lower bound: #{ min.to_s }\"\n end\n end",
"def lowerQuartile(node)\n\t\t# Min humidity value from the node in the past day\n\t\tmin_hum = Reading.select(:humidity, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:humidity)\n\t\t# Min temperature value from the node in the past day\n\t\tmin_temp = Reading.select(:temperature, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:temperature)\n\t\t# Determine the parameter with the lowest value\n\t\tmin_val = [min_hum, min_temp].min\n\n\t\t# Check if node has returned any values for the current day\n\t\t# Set the min bound into quartiles\n\t\tunless min_val.nil?\n\t\t\toffset = (min_val % 25)\n\t\t\t# Visibility adjustment\n\t\t\tif offset == 1 \n\t\t\t\toffset = 5\n\t\t\tend\t\t\t\n\t\t\treturn min_val - (offset)\n\t\tend\n\t\t# Graph will be empty, set default min\n\t\treturn 0\n\tend",
"def t_min\n @temp.min\n end",
"def floor()\n #This is a stub, used for indexing\n end",
"def min\n return @t_min\n end",
"def minimum\n sides.map(&:value).min\n end",
"def local_min(arr)\n mid = arr.length/2\n min = arr[mid]\n upper = arr.length-1\n lower = 0\n\n while !(arr[mid+lower+1] > min && arr[mid+lower-1] > min)\n # byebug\n #Calculate a new mid point and upper and lower bound.\n if arr[mid+1] < min \n lower = mid\n else\n upper = mid\n end\n mid = ((upper - lower) / 2) \n min = arr[mid + lower] \n end\n min\nend",
"def find_min()\r\n self.min\r\n end",
"def min(a,b)\n a >= b ? a : b\nend",
"def left\n @x_min\n end",
"def test_infinity\n\n x = 1.0 / 0.0 # => Infinity\n\n assert_raises RangeError do\n ln(x)\n end\n\n end",
"def lower_right\n @lower_right ||= world.point(x_max, y_min)\n end",
"def min\n end",
"def min\n end",
"def find_min\n loc = find_min_locator and loc.value\n end",
"def minimum\n Minimum.new(self)\n end",
"def from=(val)\n @from = val ? Number.new(val, vanity: true) : nil\n end",
"def positive_float(value, epsilon: nil)\n result = to_float(value) or return\n result if epsilon ? (result > +epsilon) : result.positive?\n end",
"def effective_maximum\n maximum_bound ? maximum_bound.value : Infinity\n end",
"def smallest_missing(ints)\n ((1..ints.max + 1).to_a - ints).min\nend",
"def single\n min if min == max\n end",
"def compute(&block)\n if block_given?\n begin\n value = dup.instance_eval(&block).to_f\n rescue ZeroDivisionError\n value = 0.0\n end\n (value.blank? || value.nan? || value.infinite?) ? 0.0 : value\n end\n end",
"def get_min\n @min\n end",
"def get_min()\n @data.min\n end",
"def get_float\n get_int.to_f / RAW_FLT_MAX\n end",
"def lower_left\n @lower_left ||= world.point(x_min, y_min)\n end",
"def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend",
"def unbounded?(unbounded_type = nil)\n return false unless numeric?\n\n unboundedness = case unbounded_minimum | unbounded_maximum\n when 3 then :infinite\n when 2 then :maximum\n when 1 then :minimum\n end\n\n return unbounded_type && unboundedness ? ( unboundedness == :infinite ) || ( unboundedness == unbounded_type ) : unboundedness\n end",
"def get_min()\n @min\n end",
"def bsearch_first (range = 0 ... self.length, &block)\n boundary = bsearch_lower_boundary(range, &block)\n if boundary >= self.length || yield(self[boundary]) != 0\n return nil\n else \n return boundary\n end\n end",
"def upper_bound(data)\n return (q3(data) + (1.5 * iqr(data))).to_f\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 upper_bound\n self.class.upper_bound(@obs, z_value)\n end",
"def check_float(param, default, options = {})\n min = (options[:min] ? param.to_f >= options[:min] : true)\n max = (options[:max] ? param.to_f <= options[:max] : true)\n\n if (param && param.strip =~ /^-?[0-9]+(\\.[0-9]+)?$/ && min && max)\n param.to_f\n else\n default\n end\n end",
"def lower_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = 0.25*sorted_array.length + 1\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n return sample+((sample1-sample)*(u-u.truncate))\n end\n end",
"def bsearch_first (range = 0 ... self.length, &block)\r\n boundary = bsearch_lower_boundary(range, &block)\r\n if boundary >= self.length || yield(self[boundary]) != 0\r\n return nil\r\n else \r\n return boundary\r\n end\r\n end",
"def infimum\n @infimum ||= system_record(pos_infimum)\n end"
] |
[
"0.7108944",
"0.6166451",
"0.6125761",
"0.6098916",
"0.5978157",
"0.5925704",
"0.5925704",
"0.59229577",
"0.58828306",
"0.58828306",
"0.5734093",
"0.57071364",
"0.5632774",
"0.56241536",
"0.56192625",
"0.5617183",
"0.56114244",
"0.5604941",
"0.5604941",
"0.5603599",
"0.5588783",
"0.5580591",
"0.55513966",
"0.55462",
"0.55095935",
"0.5469051",
"0.5457763",
"0.54414916",
"0.5433764",
"0.5406154",
"0.540493",
"0.5396424",
"0.53693503",
"0.5366846",
"0.5364813",
"0.53578204",
"0.53432834",
"0.5333912",
"0.5328496",
"0.5328496",
"0.5284581",
"0.52766436",
"0.52679396",
"0.5230212",
"0.5214533",
"0.5207623",
"0.5198254",
"0.51956475",
"0.51830333",
"0.5180997",
"0.5179011",
"0.51731616",
"0.51679856",
"0.5164725",
"0.516465",
"0.5152925",
"0.5148445",
"0.512566",
"0.5123631",
"0.5120367",
"0.5112698",
"0.5110972",
"0.51007223",
"0.50982463",
"0.5079057",
"0.50755996",
"0.50753903",
"0.50665534",
"0.5063034",
"0.50438464",
"0.50336367",
"0.50236464",
"0.49769184",
"0.49745348",
"0.4966315",
"0.49661273",
"0.49661273",
"0.49660814",
"0.49566746",
"0.49497697",
"0.49473047",
"0.4945709",
"0.49446955",
"0.49198538",
"0.49188602",
"0.4915157",
"0.49138036",
"0.49121436",
"0.49096912",
"0.4904397",
"0.48926795",
"0.48909628",
"0.4880074",
"0.48762268",
"0.48713863",
"0.486191",
"0.48568243",
"0.48558727",
"0.4855737",
"0.485393"
] |
0.5693271
|
12
|
Same as to but will return `Float::Infinity` instead of `nil` if no lower bound is set.
|
def numeric_to
@to
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to\n @to == Float::INFINITY ? nil : @to\n end",
"def from\n @from == -Float::INFINITY ? nil : @from\n end",
"def lower_bound\n self.class.lower_bound(@obs, z_value)\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def def_bound_float sym, range, name=nil\n def_numeric(sym, name) {|v|\n next false if (range.respond_to?(:include?) && !range.include?(v))\n true\n }\n end",
"def lower_bound(data)\n return (q1(data) - (1.5 * iqr(data))).to_f\n end",
"def bound(min, max)\n self < min ? min : (self > max ? max : self)\n end",
"def lower_bound_inclusive\n lower_bound\n end",
"def ubound(bound)\n self > bound ? bound : self\n end",
"def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend",
"def ∞ℂ; ::Float::INFINITY_COMPLEX; end",
"def bottom_value\n @relevant_data ? points.minimum_value : nil\n end",
"def unbounded\n ::Unbounded::Range.new(self.min, self.max, exclude_end?)\n end",
"def upper_bound; end",
"def low\n @range_low\n end",
"def to_f\n if isFloat? then\n value = exp.to_f\n return value\n elsif exp == \"Infinity\" then return @@MAX_VALUE\n elsif exp == \"-Infinity\" then return @@MIN_VALUE\n else\n raise \"Non-float conversion in expression: \" + exp\n end\n end",
"def clamp; end",
"def upper_bound_inclusive\n result = upper_bound\n\n # Some special cases:\n # - return a semver \"off-the-charts\" if the upper bound is 0.0.0\n # - deal with ranges that are not really ranges (like =v1.2.3)\n # - The \"biggest semver\" is its own upper bound\n return IMPOSSIBLY_SMALLEST_SEMVER if result.to_a[0...3] == [0, 0, 0]\n return result if upper_bound == lower_bound\n return result if result == XSemVer::BIGGEST_SEMVER\n\n # Figure out the part to decrement, taking care that we can't decrement\n # a part that is already at 0\n index_to_decrement = 2\n while result.to_a[index_to_decrement] == 0 do\n index_to_decrement -= 1\n end\n\n part_to_decrement = [:major, :minor, :patch][index_to_decrement]\n\n # Dynamically decrement the specified part\n value = result.send(part_to_decrement) - 1\n result.send \"#{part_to_decrement}=\", value\n\n # All the parts following the decremented one will be set to infinity\n parts_to_set_to_infinity = [:major, :minor, :patch][index_to_decrement + 1...3]\n\n parts_to_set_to_infinity.each do |part|\n result.send \"#{part}=\", FIXNUM_MAX\n end\n\n result\n end",
"def normalize(value)\n return 0.0 if near_zero_or_less? value\n return 1.0 if near_one_or_more? value\n value\n end",
"def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end",
"def lower_bound\n return 0 if total == 0\n \n (\n phat + dist_sq/(2*total) - dist * Math.sqrt((phat*(1-phat)+dist_sq/(4*total))/total)\n ) / (\n 1+dist_sq/total\n )\n end",
"def near_zero_or_less?(value)\n (value < 0.0 or near_zero?(value))\n end",
"def range_low_or_nil\n return nil unless respond_to?(:range) && respond_to?(:range_low)\n range_low unless range == I18n.t('comparables.missing')\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 floor!(target: COMMON_SCALE_FACTORS)\n round!(target: target, direction: -1)\n end",
"def minmax\n [min, unbounded? ? INFINITY : max]\n end",
"def too_low? temp # check if temp is below absolute zero\n temp < 0\nend",
"def to_a\n get_range('-inf', '+inf', include_boundaries: true)\n end",
"def least\n nil\n end",
"def minimum\n object.minimum.to_f\n end",
"def floor()\n #This is a stub, used for indexing\n end",
"def infinity\n @infinity ||= Point.new(self, :infinity)\n end",
"def upper_bound\n self.class.upper_bound(@obs, z_value)\n end",
"def min\r\n @range.min\r\n end",
"def floor\n self\n end",
"def floor\n self\n end",
"def floor(target: COMMON_SCALE_FACTORS)\n dup.floor!(target: target)\n end",
"def min\n to_a.min\n end",
"def upper_bound(data)\n return (q3(data) + (1.5 * iqr(data))).to_f\n end",
"def search_lower_boundary(array, range=nil, &block)\n range = 0 ... array.length if range == nil\n \n lower = range.first() -1\n upper = if range.exclude_end? then range.last else range.last + 1 end\n while lower + 1 != upper\n mid = ((lower + upper) / 2).to_i # for working with mathn.rb (Rational)\n if yield(array[mid]) < 0\n lower = mid\n else \n upper = mid\n end\n end\n return upper\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 float(limit = nil)\n Validation.new { |d| d.is_a?(Float) && in_range?(d, limit) }\n end",
"def inf_norm\n self.to_a.map do |a|\n a.map do |ar|\n ar.abs\n end.inject(&:+)\n end.sort[0]\n end",
"def first_greater_value(node, target, curr_greater = nil)\n return curr_greater unless node\n \n if node.val <= target\n first_greater_value(node.right, target, curr_greater)\n else\n if curr_greater.nil? || node.val - target < curr_greater - target\n curr_greater = node.val\n end\n\n first_greater_value(node.left, target, curr_greater)\n end\nend",
"def loose_bounds\n return [@min, @max].collect { |p| Point.new(p) }\n end",
"def origin\n range.low\n end",
"def bsearch_lower_boundary(range = 0...length, &block)\n bsearch_boundary(true, range, &block)\n end",
"def floor() end",
"def effective_maximum\n maximum_bound ? maximum_bound.value : Infinity\n end",
"def min\n return super if super.nil?\n (numeric_type == 'Integer') ? super.to_i : super.to_f\n end",
"def min(a,b)\n a >= b ? a : b\nend",
"def Float(p0) end",
"def lower_right\n @lower_right ||= world.point(x_max, y_min)\n end",
"def checked(value)\n value = zero() if value.respond_to?(:nan?) && value.nan?\n value = zero() if value.respond_to?(:infinity?) && value.infinity?\n value = zero() if value.nil?\n value = value.to_f if value.is_a? BigDecimal\n\n value\n end",
"def >= (object)\n if(self.to_float >= object.to_float)\n true\n end\n end",
"def <= (object)\n if(self.to_float <= object.to_float)\n true\n end\n end",
"def positive(from: T.unsafe(nil), to: T.unsafe(nil)); end",
"def lower(amount)\n return Temperature.new(@value - amount, scale)\n end",
"def bottom\n @x_max\n end",
"def min\n @min || 0;\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def min(lower_bound, inclusive = nil)\n @min = lower_bound\n @min_inclusive = inclusive\n end",
"def normalized\n @normalized ||= valid_range? ? range : normalized_range(range)\n rescue Exception => e \n # puts e.message\n value\n end",
"def compute(&block)\n if block_given?\n begin\n value = dup.instance_eval(&block).to_f\n rescue ZeroDivisionError\n value = 0.0\n end\n (value.blank? || value.nan? || value.infinite?) ? 0.0 : value\n end\n end",
"def restrict_to_bounds(value, lower = 1, upper = nil)\n value_i = value.to_i\n\n value_i = upper if !upper.blank? && value_i > upper\n value_i = lower if !lower.blank? && value_i < lower\n\n value_i\n end",
"def get_float\n get_int.to_f / RAW_FLT_MAX\n end",
"def lowerQuartile(node)\n\t\t# Min humidity value from the node in the past day\n\t\tmin_hum = Reading.select(:humidity, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:humidity)\n\t\t# Min temperature value from the node in the past day\n\t\tmin_temp = Reading.select(:temperature, :recorded_at).where(node_id: node, recorded_at: Time.zone.now.beginning_of_day..Time.zone.now.end_of_day).minimum(:temperature)\n\t\t# Determine the parameter with the lowest value\n\t\tmin_val = [min_hum, min_temp].min\n\n\t\t# Check if node has returned any values for the current day\n\t\t# Set the min bound into quartiles\n\t\tunless min_val.nil?\n\t\t\toffset = (min_val % 25)\n\t\t\t# Visibility adjustment\n\t\t\tif offset == 1 \n\t\t\t\toffset = 5\n\t\t\tend\t\t\t\n\t\t\treturn min_val - (offset)\n\t\tend\n\t\t# Graph will be empty, set default min\n\t\treturn 0\n\tend",
"def lower_quartile\n return nil if self.empty?\n sorted_array = self.sort\n u = 0.25*sorted_array.length + 1\n if (u-u.truncate).is_a?(Integer)\n return sorted_array[(u-u.truncate)-1]\n else\n sample = sorted_array[u.truncate.abs-1]\n sample1 = sorted_array[(u.truncate.abs)]\n return sample+((sample1-sample)*(u-u.truncate))\n end\n end",
"def min; end",
"def min; end",
"def literal_float(value)\n if value.finite?\n super\n elsif value.nan?\n \"'NaN'\"\n elsif value.infinite? == 1\n \"'Infinity'\"\n else\n \"'-Infinity'\"\n end\n end",
"def left\n @x_min\n end",
"def positive_float(value, epsilon: nil)\n result = to_float(value) or return\n result if epsilon ? (result > +epsilon) : result.positive?\n end",
"def min_x\n c2f_x(0)\n end",
"def min() end",
"def normalize\n store.normalize(minimum: minimum_value, spread: @spread)\n end",
"def range\n object.range + DEFAULT_MAX_DISTANCE\n end",
"def _lower_bound(array,value,l,r)\r\n return l if r==l\r\n ind=(r+l)/2\r\n return value<=array[ind] ? _lower_bound(array,value,l,ind) : _lower_bound(array,value,ind+1,r)\r\nend",
"def bound a, upper, lower\n size = a.size1 * a.size2\n\n size.times do |i|\n value = a[i] \n if upper and value > upper\n a[i] = upper\n elsif lower and value < lower\n a[i] = lower\n end\n end\n \n a\n end",
"def to_f\n if @last == 0\n raise ZeroDivisionError\n else\n @first.to_f / @last\n end\n end",
"def numeric_from\n @from\n end",
"def clamp(val, min, max)\n\treturn min if val < min\n\treturn max if val > max\n\treturn val\nend",
"def merge!(other)\n if other.lower_bound > @lower_bound\n @lower_bound = other.lower_bound\n @include[:lower_bound] = other.include_lower_bound?\n end\n if other.upper_bound\n if @upper_bound.nil? || other.upper_bound < @upper_bound\n @upper_bound = other.upper_bound\n @include[:upper_bound] = other.include_upper_bound?\n end\n end\n self\n end",
"def > (object)\n if(self.to_float>object.to_float)\n true\n end\n end",
"def clamp(value, minimum_inclusive, maximum_inclusive)\n\n if minimum_inclusive > maximum_inclusive\n\n swap = minimum_inclusive\n\n minimum_inclusive = maximum_inclusive\n maximum_inclusive = swap\n end\n\n value < minimum_inclusive ? minimum_inclusive : value < maximum_inclusive ? value : maximum_inclusive\n end",
"def get_min\n @min ||= calculate_min\n end",
"def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end",
"def min( value )\n if value < self\n value\n else\n self\n end\n end",
"def ceil\n self\n end",
"def ceil\n self\n end",
"def minimum\n sides.map(&:value).min\n end",
"def log\n Double.new(Math.log(self.to_f))\n rescue Math::DomainError\n Double.new(::Float::NAN)\n end",
"def size\n return 1.0 / 0.0 if from.nil? || to.nil?\n 1+(to-from).abs\n end",
"def min\n @range.begin\n end",
"def spread\n (max - min).abs\n end",
"def local_min(arr)\n mid = arr.length/2\n min = arr[mid]\n upper = arr.length-1\n lower = 0\n\n while !(arr[mid+lower+1] > min && arr[mid+lower-1] > min)\n # byebug\n #Calculate a new mid point and upper and lower bound.\n if arr[mid+1] < min \n lower = mid\n else\n upper = mid\n end\n mid = ((upper - lower) / 2) \n min = arr[mid + lower] \n end\n min\nend",
"def lbound(bound); end",
"def floor\n push pop.floor\n end",
"def < (object)\n if(self.to_float<object.to_float)\n true\n end\n end",
"def negative(from: T.unsafe(nil), to: T.unsafe(nil)); end"
] |
[
"0.6894433",
"0.6541123",
"0.6048955",
"0.59837765",
"0.59837765",
"0.5933354",
"0.5909154",
"0.5861911",
"0.5817712",
"0.5742106",
"0.5704086",
"0.5608618",
"0.56060356",
"0.55992645",
"0.5587064",
"0.55531144",
"0.5545616",
"0.5528145",
"0.5515054",
"0.55074674",
"0.54863167",
"0.54495925",
"0.54321474",
"0.54185724",
"0.54185724",
"0.5394072",
"0.5390732",
"0.53813964",
"0.53686756",
"0.53611785",
"0.5358013",
"0.5311545",
"0.5307088",
"0.5273369",
"0.52703655",
"0.5245778",
"0.5245778",
"0.5230667",
"0.52190465",
"0.5210553",
"0.51494765",
"0.5140963",
"0.5140432",
"0.51392925",
"0.5126453",
"0.5126094",
"0.5123482",
"0.5117948",
"0.50749266",
"0.50683",
"0.50645894",
"0.5057486",
"0.5048737",
"0.50333494",
"0.50287783",
"0.5026773",
"0.5026568",
"0.5016501",
"0.5014625",
"0.50114596",
"0.4994232",
"0.49889112",
"0.49889112",
"0.49831778",
"0.49787855",
"0.49730268",
"0.49672997",
"0.4967022",
"0.49655458",
"0.49599025",
"0.49599025",
"0.495944",
"0.49548706",
"0.49512982",
"0.49504936",
"0.49479637",
"0.49334437",
"0.49277556",
"0.4921337",
"0.49165872",
"0.49147928",
"0.49142957",
"0.4911059",
"0.49009594",
"0.48901457",
"0.48792127",
"0.48728713",
"0.48682964",
"0.4866799",
"0.48625728",
"0.48625728",
"0.48625642",
"0.4855033",
"0.48541105",
"0.4853669",
"0.485257",
"0.48517224",
"0.4850803",
"0.4834393",
"0.48296112",
"0.48288742"
] |
0.0
|
-1
|
Concatenates this range with another range provided that the ranges intersect or are adjacent. When that's not the case, this method will return `nil`
|
def merge(o)
if intersect?(o) || adjacent?(o)
new_min = numeric_from <= o.numeric_from ? numeric_from : o.numeric_from
new_max = numeric_to >= o.numeric_to ? numeric_to : o.numeric_to
self.class.new(new_min, new_max)
else
nil
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def merge(other)\n if include?(other.begin) || other.include?(self.begin)\n cmp = self.begin <=> other.begin\n if cmp < 0\n min = self.begin\n excl_begin = exclude_begin?\n elsif cmp > 0\n min = other.begin\n excl_begin = other.exclude_begin?\n else\n min = self.begin\n excl_begin = exclude_begin? && other.exclude_begin?\n end\n\n cmp = self.end <=> other.end\n if cmp > 0\n max = self.end\n excl_end = self.exclude_end?\n elsif cmp < 0\n max = other.end\n excl_end = other.exclude_end?\n else\n max = self.end\n excl_end = exclude_end && other.exclude_end?\n end\n\n MinMaxRange.create(excl_begin ? GtRange.new(min) : GtEqRange.new(min), excl_end ? LtRange.new(max) : LtEqRange.new(max))\n elsif exclude_end? && !other.exclude_begin? && self.end == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif other.exclude_end? && !exclude_begin? && other.end == self.begin\n # Adjacent, other before self\n from_to(other, self)\n elsif !exclude_end? && !other.exclude_begin? && self.end.next(:patch) == other.begin\n # Adjacent, self before other\n from_to(self, other)\n elsif !other.exclude_end? && !exclude_begin? && other.end.next(:patch) == self.begin\n # Adjacent, other before self\n from_to(other, self)\n else\n # No overlap\n nil\n end\n end",
"def union(range)\n # Return self if nil (nothing new to add) or if it matches the other range (they are equivalent)\n return self.clone if range.nil?\n return self.clone if eql?(range)\n\n # Figure out which range starts earlier (to capture the most time)\n if low <= range.low\n earlier_start = self\n later_start = range\n else\n earlier_start = range\n later_start = self\n end\n \n # Figure out which ranges ends earlier (the more restrictive one)\n if high >= range.high\n earlier_end = self\n later_end = range\n else\n earlier_end = range\n later_end = self\n end\n \n result = []\n # We have continuous Ranges so we can return one Range to encapsulate both\n if earlier_start.contains?(later_start.low)\n result << Range.new(\"TS\", earlier_start.low.clone, later_end.high.clone, nil)\n else\n # The Ranges are disjoint, so we'll need to return two arrays to capture all of the potential times\n result << Range.new(\"TS\", earlier_start.low.clone, earlier_start.high.clone, nil)\n result << Range.new(\"TS\", later_start.low.clone, later_start.high.clone, nil)\n end\n end",
"def conjunctionRangeExtd(r1, r2)\n\n [r1, r2].each do |er|\n return er if er.is_none?\n end\n\n r = *( sort_ranges_core([RangeExtd(r1), RangeExtd(r2)]) )\t# => Rangeary.sort_ranges\n\n ## Note: the end product will be (cBeg(:stBeg), cEnd(:stEnd))\n # where :stBeg and :stEnd mean exclude_(begin|end)?\n\n # Set the candidate begin value.\n cBeg = r[1].begin\n if r[0].begin == r[1].begin\n stBeg = (r[1].exclude_begin? || r[0].exclude_begin?)\n else\n stBeg = r[1].exclude_begin?\n end\n\n # Set the candidate end value. (Rangeary.comparable_end() for Ruby-2.6 Endless Range)\n # Note: this comparison ignores @infinities even if set,\n # because @infinities may not be defined in the arguments!\n # Anyway, nothing should be larger than the upper limit\n # and so this should be fine.\n if comparable_beginend_core(r[0]).end == comparable_beginend_core(r[1]).end\n cEndOrig = r[1].end\n cEnd = comparable_beginend_core(r[1]).end\n stEnd = (r[0].exclude_end? || r[1].exclude_end?)\n else\n a = [[comparable_beginend_core(r[0]).end, 0, r[0].end], [comparable_beginend_core(r[1]).end, 1, r[1].end]].min\n cEnd = a[0]\n cEndIndex = a[1]\t# r[cEndIndex] == RangeExtd obj that gives the end of the resultant range.\n cEndOrig = a[2]\n stEnd = nil\n end\n\n case cBeg <=> cEnd\n when 1\t# cBeg > cEnd\n RangeExtd::NONE\n\n when 0\t# cBeg == cEnd\n stEnd = r[0].exclude_end?\n if (!stBeg) && (!stEnd)\n RangeExtd(cBeg..cBeg)\t# Point range\n else\n RangeExtd::NONE\n end\n\n when -1\t# cBeg < cEnd\n # Now, the range must be (cBeg, cEnd). May need adjustment of the exclude status.\n if stEnd.nil?\n stEnd = r[cEndIndex].exclude_end?\n # else\n # # Already defined.\n end\t# if stEnd.nil?\n\n RangeExtd(cBeg, cEndOrig, :exclude_begin => stBeg, :exclude_end => stEnd)\n else\n raise\n end\t\t# case cBeg <=> cEnd\n\n end",
"def merge(other)\n Range.new([first, other.begin].min, [last, other.end].max)\n end",
"def add_range(left, right)\n \n end",
"def add_range(left, right)\n \n end",
"def range_array_union(a, b)\n # convert starting numbers to ranges\n a[a.size-1] = a[a.size-1]..Graphics.frame_count if a[a.size-1].is_a?(Numeric)\n b[b.size-1] = b[b.size-1]..Graphics.frame_count if b[b.size-1].is_a?(Numeric)\n # initialize indices\n i = j = 0\n # stop if either interval doesn't exist\n return if a[i] == nil || b[j] == nil\n # start iteration\n loop do\n # if both arrays' last element\n if a[i + 1] == nil && b[j + 1] == nil\n # if not intersecting intervals\n if a[i].first > b[j].last + 1 || b[j].first > a[i].last + 1\n # add both ranges sorted\n a[i].first < b[j].first ? a[i + 1] = b[j] : (a[i + 1], a[i] = a[i], b[j])\n else\n # get range borders\n min_pos = (a[i].first < b[j].first ? a[i].first : b[j].first)\n max_pos = (a[i].last > b[j].last ? a[i].last : b[j].last)\n # interval union is the last element\n a[i] = min_pos..max_pos\n end\n # abort iteration\n break\n # if no more elements in this array\n elsif a[i] == nil\n # add all elements from other array\n a += b[j, b.size - j]\n # abort iteration\n break\n # if no more elements in other array\n elsif b[j] == nil\n # abort iteration\n break\n # if other intervals is after this interval\n elsif b[j].first > a[i].last + 1\n # check next interval of this array\n i += 1\n # if array is after other array or other interval is within this one\n elsif a[i].first > b[j].last + 1\n # add other interval into this array\n a.insert(i, b[j])\n # check next interval of this array\n i += 1\n # check next interval of other array\n j += 1\n elsif a[i].first >= b[j].first && a[i].last <= b[j].last\n # check next interval of other array\n j += 1\n # if other interval starts before and ends before this interval\n elsif a[i].first < b[j].first && a[i].last > b[j].last\n # unite intervals\n a[i] = b[j].first..a[i].last\n # check next interval of other array\n j += 1\n # if other interval ends after this interval\n else\n # get range borders\n min_pos = (a[i].first < b[j].first ? a[i].first : b[j].first)\n # unite intervals\n a[i] = min_pos..b[j].last\n # as longs as intervals of this array intersect with this interval\n while a[i + 1] != nil && a[i].last + 1 >= a[i + 1].first\n # get range borders\n max_pos = (a[i].last > a[i + 1].last ? a[i].last : a[i + 1].last)\n # unite this interval and next interval of this array\n a[i] = a[i].first..max_pos\n # delete next interval of this array\n a.delete_at(i + 1)\n end\n # check next interval of other array\n j += 1\n end\n end\n # if last range is a converted start number\n if a.size > 0 && a[a.size - 1].last == Graphics.frame_count\n # convert back\n a[a.size - 1] = a[a.size - 1].first\n end\n end",
"def try_to_join_leading_ranges\n if @allocated_ranges[1] && @allocated_ranges[0].last.succ == @allocated_ranges[1].first\n @allocated_ranges[0] = (@allocated_ranges[0].first..@allocated_ranges[1].last)\n @allocated_ranges.delete_at(1)\n end\n end",
"def merge(other)\n if self.overlaps?(other)\n [self | other]\n else\n [self, other]\n end\n end",
"def combine_ranges(code, ranges); end",
"def & other_range\n case other_range\n when Range\n intersection = []\n each do |i|\n intersection << i if other_range.include? i\n end\n result = intersection.to_ranges\n case result[0]\n when Integer\n return (result[0])..(result[0])\n when Range, nil\n return result[0]\n end\n else\n raise \"unsupported type\"\n end\n end",
"def extend_leading_range\n id = @allocated_ranges[0].last.succ\n @allocated_ranges[0] = (@allocated_ranges[0].first..@allocated_ranges[0].last.succ)\n try_to_join_leading_ranges\n id\n end",
"def add_leading_range\n @allocated_ranges.prepend((0..0))\n try_to_join_leading_ranges\n 0\n end",
"def complement_range(first, last)\n casefold ? (TurkishRanges::TrText.new(first.swapcase)..TurkishRanges::TrText.new(last.swapcase)).to_a.join : ''\n end",
"def overlap(a, b)\n o = a.to_a & b.to_a\n o.size < 2 ? nil : (o.first..o.last)\nend",
"def overlap(b)\n a = self\n a_len = self.length\n b_len = b.length\n n = nil\n\n (0..a_len-1).each do |i|\n j = i\n k = 0\n\n while j < a_len and k < b_len and a[j] == b[k]\n j += 1\n k += 1\n end\n\n n = k and break if j == a_len\n end\n\n n ||= 0\n\n a + b[n..b_len-1]\n end",
"def merge!(other)\n if other.lower_bound > @lower_bound\n @lower_bound = other.lower_bound\n @include[:lower_bound] = other.include_lower_bound?\n end\n if other.upper_bound\n if @upper_bound.nil? || other.upper_bound < @upper_bound\n @upper_bound = other.upper_bound\n @include[:upper_bound] = other.include_upper_bound?\n end\n end\n self\n end",
"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 include_range? other_range\n case other_range\n when Range\n if other_range.first >= self.first && other_range.last <= self.last\n return true\n else\n return false\n end\n else\n raise \"unsupported type\"\n end\n end",
"def add_range!(range, ranges)\n # Make sure the arguments are correct\n return nil if range.nil? || ranges.nil?\n\n # Ignore the range if there is an existing one which is bigger\n return nil unless ranges[range.startLine].nil? || ranges[range.startLine].endLine < range.endLine\n ranges[range.startLine] = range\n nil\n end",
"def test_merge_overlaping_1\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (1..10).to_a)\n end",
"def intersect(other)\n begin_at = self.begin >= other.begin ? self.begin : other.begin\n end_at = self.end <= other.end ? self.end : other.end\n\n begin_at <= end_at ? self.class.new(begin_at..end_at) : nil\n end",
"def range_include?(zelf, other)\n # 1...10 includes 1..9 but it does not include 1..10.\n operator = zelf.exclude_end? && !other.exclude_end? ? :< : :<=\n zelf.include?(other.first) && other.last.send(operator, zelf.last)\nend",
"def intersect?(range1,range2)\nif range1.begin < range2.begin\n if range1.end < range2.begin\n nil\n else\n (range2.begin..range1.end)\n end\nelse\n if range2.end < range1.begin\n nil\n else\n (range1.begin..range2.end)\n end\nend\nend",
"def xor(*args)\n other = coerce_range(*args)\n intersection = intersection(other)\n return [self, other].sort unless intersection\n\n merged = merge(other)\n\n [ ARange[merged.begin, intersection.begin], ARange[intersection.end, merged.end] ].reject { |r| r.instant? } \n end",
"def test_merge_enclosed_2\n x = IntegerRange.new(1, 10)\n y = IntegerRange.new(3, 5)\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 overlap? range\n !(self & range).nil?\n end",
"def intersect? (range1,range2)\n if range1.begin < range2.begin\n if range1.end < range2.begin\n nil\n else\n (range2.begin..range1.end)\n end\n else\n if range2.end < range1.begin\n nil\n else\n (range1.begin..range2.end)\n end\n end\nend",
"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 test_merge_enclosed_1\n x = IntegerRange.new(1, 10)\n y = IntegerRange.new(3, 5)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = each_to_a(x)\n\n assert_equal(a, (1..10).to_a)\n end",
"def intersects?(*args)\n other = coerce_range(*args)\n raise ArgumentError, \"#{self.begin.class} expected, received #{other.begin.class}\" unless other.begin.kind_of?(self.begin.class)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n other.begin < self.end and self.begin < other.end\n end\n end",
"def mixed_range\n require 'netaddr'\n range = []\n NetAddr.merge(operate_range).each do |cidr|\n tmp_range = NetAddr::CIDR.create(cidr).enumerate\n range << tmp_range.first.to_s\n range << tmp_range.last.to_s\n end\n range.uniq!\n range += NetAddr.merge(operate_range).delete_if{ |part| part =~ /\\/3[12]/}\n end",
"def exclusive\n if exclude_end?\n self\n else\n Range.new(self.begin, self.end + 1, true)\n end\n end",
"def union(rect)\n self.dup.union!(rect)\n end",
"def intersection(range)\n int_a = (self.to_a & range.to_a) \n int_a.empty? ? nil : Range.new(int_a.min, int_a.max)\n end",
"def union(other)\n set_operation(other, :+,\n distinct: true,\n add_boundaries: true)\n end",
"def range(range_start, range_end)\n return [] if range_end < range_start\n return [range_end] if range_end == range_start\n result = [range_end]\n range(range_start, range_end - 1) + result\nend",
"def +(object)\n raise \"Expecting RubyRanges::Array or Range, but was #{object.class} : #{object.inspect}\" unless object.is_a?(Range) || object.is_a?(Array)\n array_of_ranges = Array.new((object.is_a?(Range) ? (self.old_plus([object])) : super(object)))\n array_of_ranges.flatten_ranges\n end",
"def select_range(first, last)\n first == last ? [first] : [first, *select_range(first.next, last)]\n end",
"def range_begin_and_end(range_or_span)\n rbegin, rend = range_or_span.kind_of?(Range) ? split_range(range_or_span) : split_span(range_or_span)\n raise ArgumentError.new(\"negative offset specified: #{PP.singleline_pp(range_or_span,'')}\") if rbegin < 0\n rend += rbegin\n \n [rbegin, rend]\n end",
"def union_all(other)\n set_operation(\n other,\n :+,\n distinct: false,\n add_boundaries: true,\n inherit_boundaries: true\n )\n end",
"def overlaps(first, second)\n return first.start.between?(second.start, second.end) ||\n first.end.between?(second.start, second.end) ||\n second.start.between?(first.start, first.end) ||\n second.end.between?(first.start, first.end)\nend",
"def translate_range(first, last)\n (TurkishRanges::TrText.new(first)..TurkishRanges::TrText.new(last)).to_a.join \\\n complement_range(first, last)\n end",
"def mixed_range\n range = []\n NetAddr.merge(operate_range).each do |cidr|\n tmp_range = NetAddr::CIDR.create(cidr).enumerate\n range << tmp_range.first.to_s\n range << tmp_range.last.to_s\n end\n\n range.uniq!\n\n range += NetAddr.merge(operate_range).delete_if{ |part| part =~ /\\/3[12]/}\n end",
"def overlap?(self_range, other_range)\n return true if self_range == other_range \n overlap_helper(self_range, other_range) || overlap_helper(other_range, self_range)\n end",
"def merge_cells(start_row, start_col, end_row, end_col)\n validate_workbook\n\n self.merged_cells ||= RubyXL::MergedCells.new\n # TODO: add validation to make sure ranges are not intersecting with existing ones\n merged_cells << RubyXL::MergedCell.new(:ref => RubyXL::Reference.new(start_row, end_row, start_col, end_col))\n end",
"def intersection_with(other)\n r1,r2 = matched_range_types(self, other)\n max_begin = [r1.begin,r2.begin].max\n min_end = [r1.end, r2.end ].min\n excl = ( r1.end == min_end && \n r1.respond_to?(:exclude_end?) && r1.exclude_end?\n ) ||\n ( r2.end == min_end && \n r2.respond_to?(:exclude_end?) && r2.exclude_end?\n )\n unless max_begin > min_end\n Range.new(max_begin, min_end, excl).extend(DateTimeRange)\n end\n end",
"def OverlappingRanges(arr)\n\n # code goes here\n return arr \n \nend",
"def intersection(*args)\n other = coerce_range(*args)\n sorted = [self, other].sort\n\n return nil if self.class.compare(sorted[0].end, sorted[1].begin) < 0\n\n ARange[sorted[1].begin, self.class.min(sorted[1].end, sorted[0].end)]\n end",
"def -(other)\n\n # the ranges don't overlap, nothing to subtract\n return self unless overlaps?(other)\n\n # the other range is bigger, resulting in no more range.\n return [] if other.fully_includes?(self)\n\n # the range is fully included into the other, the results is to discontinuous ranges.\n return [Range.new(first, other.begin), other.end..last] if fully_includes?(other)\n\n # Comparing the range to the other\n case self <=> other\n when -1, 0 # survival range is its left sub-range\n [Range.new(first, other.begin)]\n when 1 # survival range is its right sub-range\n [other.end..last]\n end\n\n end",
"def overlaps?(other)\n cover?(other.begin) || other.cover?(first)\n end",
"def <=>(other) range_start <=> other.range_start end",
"def non_start(value_a, value_b)\n # value_a[1..-1] + value_b[1..-1]\n value_a[1...value_a.length + 1] + value_b[1..-1]\n end",
"def overlaps\n siblings.overlaps date, date_ended\n end",
"def merge(a, b)\n merged = []\n until a.empty? || b.empty?\n # Grab the smaller of the two, move it into the result\n if a.first <= b.first\n merged << a.shift # Pops first element out of \n else\n merged << b.shift\n end\n end\n # Append final remaining element\n merged += a += b\nend",
"def end_with other\n ends_with?(other) ? self : self + other\n end",
"def end_with other\n ends_with?(other) ? self : self + other\n end",
"def end_with other\n ends_with?(other) ? self : self + other\n end",
"def adjacent_either(a, b)\n (adjacent_undirected(a) + adjacent_undirected(b)).uniq\n end",
"def merge(front, back)\n length = overlay_length(front, back)\n front+back[length..-1]\n end",
"def test_merge_abutting_2\n x = IntegerRange.new(1, 4)\n y = IntegerRange.new(5, 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 covers?(*args)\n other = coerce_range(*args)\n\n if other.instant?\n self.begin <= other.begin and other.end < self.end\n else\n self.begin <= other.begin and other.end <= self.end\n end\n end",
"def include_with_range?(value)\n if value.is_a?(::Range)\n operator = exclude_end? ? :< : :<=\n end_value = value.exclude_end? ? last.succ : last\n include?(value.first) && (value.last <=> end_value).send(operator, 0)\n else\n include_without_range?(value)\n end\n end",
"def overlaps?(other)\n a, b = [self, other].map(&:range)\n #\n # Although a Shift which passes through midnight is stored\n # internally as lasting more than TimeOfDay::NUM_SECONDS_IN_DAY\n # seconds from midnight, that's not how it is meant to be\n # handled. Rather, it consists of two chunks:\n #\n # range.first => Midnight\n # Midnight => range.last\n #\n # The second one is *before* the first. None of it is more than\n # TimeOfDay::NUM_SECONDS_IN_DAY after midnight. We thus need to shift\n # each of our ranges to cover all overlapping possibilities.\n #\n one_day = TimeOfDay::NUM_SECONDS_IN_DAY\n ashifted =\n Range.new(a.first + one_day, a.last + one_day, a.exclude_end?)\n bshifted =\n Range.new(b.first + one_day, b.last + one_day, b.exclude_end?)\n #\n # For exclusive ranges we need:\n #\n # a.ending > b.beginning && b.ending > a.beginning\n #\n # and for inclusive we need:\n #\n # a.ending >= b.beginning && b.ending >= a.beginning\n #\n aop = a.exclude_end? ? :> : :>=\n bop = b.exclude_end? ? :> : :>=\n #\n (a.last.send(aop, b.first) && b.last.send(bop, a.first)) ||\n (ashifted.last.send(aop, b.first) && b.last.send(bop, ashifted.first)) ||\n (a.last.send(aop, bshifted.first) && bshifted.last.send(bop, a.first))\n end",
"def together(spans)\n loop do\n converged = true\n\n spans.each_with_index.each_cons(2).reverse_each do |(s1, i), (s2, j)|\n next unless TOGETHER.include?(s1.type) && TOGETHER.include?(s2.type)\n spans[i..j] = Greeb::Span.new(s1.from, s2.to, :together)\n converged = false\n end\n\n break if converged\n end\n\n spans\n end",
"def test_merge_abutting_1\n x = IntegerRange.new(1, 4)\n y = IntegerRange.new(5, 10)\n\n assert_equal(x.mergeable?(y), true)\n x.merge(y)\n\n assert_equal(x.bottom, 1)\n assert_equal(x.top, 10)\n assert_equal(x.to_a, (1..10).to_a)\n\n a = []\n x.each { |i| a << i }\n\n assert_equal(a, (1..10).to_a)\n end",
"def overlaps?(other)\n # overlap == start < finish' AND start' < finish\n self.first <= other.actual_last and other.first <= self.actual_last\n end",
"def combine(left, right)\n left_index = 0\n right_index = 0\n res = []\n\n while left_index < left.size || right_index < right.size\n if left[left_index] && (right[right_index].nil? || left[left_index] <= right[right_index])\n res << left[left_index]\n left_index += 1\n else\n res << right[right_index]\n right_index += 1\n end\n end\n res\nend",
"def adjacent\n (inputs.map(&:from) + outputs.map(&:to)).uniq\n end",
"def combine(a, b)\n result = []\n\n while a.size > 0 && b.size > 0\n result << if a[0] <= b[0]\n a.shift\n else\n b.shift\n end\n end\n \n result.concat(a).concat(b)\nend",
"def collect_between(first, last)\n \tfirst == last ? [first] : [first, *collect_between(first.next, last)]\nend",
"def range_rc(start_num, end_num)\n\n return [] if end_num <= start_num\n range_rc(start_num, end_num - 1) + [end_num - 1]\nend",
"def intersect(other_interval)\n if self.end <= other_interval.start || other_interval.end <= start\n nil\n else\n Interval.new([start, other_interval.start].max, [self.end, other_interval.end].min)\n end\n end",
"def adjacent *a; CssString.new a.flatten.unshift(self).join ' + ' end",
"def remove_range(left, right)\n \n end",
"def remove_range(left, right)\n \n end",
"def +(rhs)\n union(rhs)\n end",
"def merge(left, right, &prc)\nmerged_array = []\nprc ||= Proc.new { |num1, num2| num1 <=> num2 }\nuntil left.empty? || right.empty?\n case prc.call(left.first, right.first)\n when -1\n merged_array << left.shift\n when 0\n merged_array << left.shift\n when 1\n merged_array << right.shift\n end\nend\n\nmerged_array + left + right\nend",
"def overlaps?(range)\n !(completely_left_of?(range) || completely_right_of?(range))\n end",
"def &(range)\n return nil unless overlaps?(range) || touching?(range)\n PosRange.new [@start, range.start].max, [@end, range.end].min\n end",
"def map_range(a, b, s)\n af, al, bf, bl = a.first, a.last, b.first, b.last\n bf + (s - af)*(bl - bf).quo(al - af)\n end",
"def merger(arr1, arr2)\n merged = []\n\n until arr1.empty? || arr2.empty? # this is an interesting way to do it\n if arr1.first <= arr2.first\n merged << arr1.shift\n else\n merged << arr2.shift\n end\n end\n\n merged + arr1 + arr2\nend",
"def allocate\n if @allocated_ranges.empty?\n add_leading_range\n elsif @allocated_ranges.first.first == 0\n extend_leading_range\n else\n add_leading_range\n end\n end",
"def ==(other)\n return true if equal? other\n\n other.kind_of?(Range) and\n self.first == other.first and\n self.last == other.last and\n self.exclude_end? == other.exclude_end?\n \n end",
"def union(other)\n self.class.from_a(to_a | other.to_a)\n end",
"def range(*args)\n value = \"[\"\n args.each_slice(2) do |from, to|\n from = sanitize(from)\n to = sanitize(to)\n value += \"#{from}-#{to}\"\n end\n value += \"]\"\n append value\n end",
"def union(other)\n self.class.from_a(to_a | other.to_a)\n end",
"def append_change_range(changes_ranges, left_lo, left_hi, right_lo, right_hi)\n if left_lo <= left_hi && right_lo <= right_hi # for this change, the bounds are both 'normal'. the beginning of the change is before the end.\n changes_ranges << [:change, left_lo + 1, left_hi + 1, right_lo + 1, right_hi + 1]\n elsif left_lo <= left_hi\n changes_ranges << [:delete, left_lo + 1, left_hi + 1, right_lo + 1, right_lo]\n elsif right_lo <= right_hi\n changes_ranges << [:add, left_lo + 1, left_lo, right_lo + 1, right_hi + 1]\n end\n changes_ranges\n end",
"def test_overlaping\n x = IntegerRange.new(1, 5)\n y = IntegerRange.new(3, 10)\n\n assert_equal(x.mergeable?(y), true)\n assert_equal(y.mergeable?(x), true)\n end",
"def extend(upstream,downstream)\n\t\tif @strand == \"+\"\n\t\t\t@start = @start - upstream\n\t\t\t@graph_start = @graph_start - upstream\n\t\t\t@stop = @stop + downstream\n\t\t\t@graph_stop = @graph_stop + downstream\n\t\t\t@exons_relative_starts[1] += upstream\n\t\t\t@exons_lengths[0] += upstream\n\t\t\t@exons_lengths[1] += downstream \n\t\telse\n\t\t\t@start = @start - downstream\n\t\t\t@graph_start = @graph_start - downstream\n\t\t\t@stop = @stop + upstream\n\t\t\t@graph_stop = @graph_stop + upstream\n\t\t\t@exons_relative_starts[1] += downstream\n\t\t\t@exons_lengths[0] += downstream\n\t\t\t@exons_lengths[1] += upstream \n\t\tend\n\tend",
"def to_range\n\t\tIP.parse(self.start_ip)..IP.parse(self.end_ip)\n\tend",
"def merge(left, right)\n prc ||= Proc.new {|x,y| x <=> y}\n result = []\n until left.empty? || right.empty?\n if prc.call(left[0],right[0]) == -1\n result << left.shift\n elsif prc.call(left[0], right[0]) == 1\n result << right.shift\n else \n result << left.shift\n end\n end\n result + left + right\nend",
"def rmerge!(other)\n if other.is_a?(Array)\n other.each { |v| self << v.rdup unless include?(v) }\n elsif other\n self << other.rdup unless include?(other)\n end\n self\n end",
"def range(start,ending)\r\n return [] if ending <= start\r\n\r\n range(start, ending-1) << ending -1\r\nend",
"def range(start_num, end_num)\n return [] if end_num =< start_num\n range(start_num, end_num - 1) << end_num - 1\nend",
"def inspect\n @ranges.join(' || ')\n end",
"def query_range(left, right)\n \n end",
"def query_range(left, right)\n \n end",
"def intersection(range)\n # Return self if nil (the other range has no restrictions) or if it matches the other range (they are equivalent)\n return self.clone if range.nil?\n return self.clone if eql?(range)\n\n # Figure out which range starts later (the more restrictive one)\n if low <= range.low\n earlier_start = self\n later_start = range\n else\n earlier_start = range\n later_start = self\n end\n \n # Return nil if there is no common time (the two ranges are entirely disjoint)\n return nil unless later_start.contains?(earlier_start.high)\n \n # Figure out which ranges ends earlier (the more restrictive one)\n if high >= range.high\n earlier_end = self\n later_end = range\n else\n earlier_end = range\n later_end = self\n end\n\n Range.new(\"TS\", later_start.low.clone, earlier_end.high.clone, nil)\n end",
"def +(another)\n self.concat(another)\n end",
"def overlaps?(other); end"
] |
[
"0.6783698",
"0.66964114",
"0.65810907",
"0.6481763",
"0.644672",
"0.644672",
"0.6354599",
"0.6305759",
"0.6266257",
"0.6251048",
"0.6172385",
"0.6102747",
"0.5989016",
"0.58342797",
"0.58024406",
"0.57911277",
"0.5772159",
"0.57373995",
"0.57369435",
"0.5732757",
"0.5719501",
"0.56829244",
"0.5656747",
"0.5645788",
"0.56280154",
"0.559203",
"0.5590571",
"0.5590136",
"0.558491",
"0.55710506",
"0.5562178",
"0.5552637",
"0.5551011",
"0.5535701",
"0.5531823",
"0.55277497",
"0.55259615",
"0.5519945",
"0.5500757",
"0.5499637",
"0.54795176",
"0.54763144",
"0.5475624",
"0.5471165",
"0.5454094",
"0.5452593",
"0.54478085",
"0.5445089",
"0.54324025",
"0.5422819",
"0.5402763",
"0.5394815",
"0.53864187",
"0.5377446",
"0.5371875",
"0.5369602",
"0.5369602",
"0.5369602",
"0.5347872",
"0.5342929",
"0.53429025",
"0.53127766",
"0.5309653",
"0.5302236",
"0.52983105",
"0.529295",
"0.5275743",
"0.526282",
"0.52563405",
"0.525152",
"0.52413094",
"0.5237893",
"0.52363485",
"0.5230697",
"0.5223369",
"0.5223369",
"0.52108014",
"0.5210426",
"0.5208832",
"0.52016217",
"0.52011675",
"0.5187666",
"0.5185609",
"0.517619",
"0.5172636",
"0.51684177",
"0.5162016",
"0.5161793",
"0.5156027",
"0.51507384",
"0.5134037",
"0.512781",
"0.51274276",
"0.51263124",
"0.51258075",
"0.5123825",
"0.5122265",
"0.5122265",
"0.5121414",
"0.5100359",
"0.5100318"
] |
0.0
|
-1
|
GET /event_elements GET /event_elements.json
|
def index
@event_elements = EventElement.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def events\n collection(\"events\")\n end",
"def events\n data[\"events\"]\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = eager_event.all\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n respond_with(@events)\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.available.page(params[:page])\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def event_list\n events_list\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def get_events\n response = request(:get, \"/devmgr/v2/events\")\n #status(response, 200, 'Failed to get current events from server')\n #JSON.parse(response.body)\n response\n end",
"def all(params = {})\n req = WebPay::EventListRequest.create(params)\n raw_response = @client._request(:get, 'events', req)\n WebPay::EventResponseList.new(raw_response)\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n render json: @events, include: :talks\n end",
"def events\n data.events\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def index\n begin\n events = Event.all\n render :json => {events: ActiveModel::ArraySerializer.new(events, each_serializer: EventsSerializer), :code => 200}, status: :ok\n rescue Exception => e\n logger.error {\"Error while populating list of events. ErrorMessage: #{e.message}, Params: #{params.inspect}\"}\n render json: {error: e.message, code: 500}\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @events, include: [:partner, :address] }\n end\n end",
"def events *args\n Xmlstats::Endpoints::Events.fetch *args\n end",
"def index\n @event = Event.find(params[:id])\n @users = @event.users\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end",
"def index\n\t\t@events = Event.page(params[:page]).per(10)\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json {\n\t\t\t\trender :json => @events.to_json\n\t\t\t}\n\t\tend\n\n\tend",
"def index\n @client_events = ClientEvent.all\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def index\n render json: Event.all, status: :ok\n end",
"def index\n\t\t@events = Event.all.order('created_at desc')\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render :json => @events }\n\t\tend\n\tend",
"def get_events\n @doc.css(\"#cal-event-entry\")\n end",
"def index\n @events = current_user.events\n\n render json: @events\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n end",
"def index\n @events = Event.all\n\n render json: @events, \n except: [:created_at, :updated_at], \n include: [:reviews => {include: [:attendee => {only: [:first_name, :last_name]}]}, \n :host => {only: [:first_name, :last_name, :id]}]\n\n end",
"def index\n @events = Event.find(:all) \n end"
] |
[
"0.73061967",
"0.68866354",
"0.6868861",
"0.67947763",
"0.66653544",
"0.6641993",
"0.66249585",
"0.65587926",
"0.6506329",
"0.65009993",
"0.648142",
"0.64712006",
"0.6470211",
"0.6443841",
"0.64436775",
"0.64436775",
"0.6436641",
"0.64343876",
"0.6418604",
"0.63791955",
"0.63722503",
"0.6341",
"0.63150275",
"0.6310231",
"0.63011974",
"0.6297701",
"0.6296323",
"0.6282503",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.6277774",
"0.627327",
"0.6271963",
"0.6241475",
"0.6222111",
"0.62041634",
"0.6201198",
"0.6181004",
"0.61805415",
"0.61760813",
"0.6171922",
"0.6167738",
"0.61653304",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6141062",
"0.6135256",
"0.6134063"
] |
0.72904515
|
1
|
GET /event_elements/1 GET /event_elements/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @event_elements = EventElement.all\n end",
"def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end",
"def index\n #returns all events from eventbrite API, need to change to pull from her endpoint\n @eventList = Event.retrieve_all_events params\n render json: @eventList, status: 200\n end",
"def details\n get(\"v1/event/#{@id}\")\n end",
"def events\n url = 'https://api.artic.edu/api/v1/exhibitions?limit=35'\n\n res = RestClient.get(url)\n JSON.parse(res)\nend",
"def index\n @event = Event.all\n render json: @event\n end",
"def index\n @events = Event.find(:all)\n respond_to do |format|\n format.html\n format.json\n end\n end",
"def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end",
"def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.live\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def get_event ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}\"\n end",
"def index\n @events = Event.all\n render json: @events, status: 200\n end",
"def get(event_id)\n @client.request \"events/#{event_id}\"\n end",
"def index\n @events = Event.all\n render json: @events\n end",
"def index\n @event = Event.find(params[:event_id])\n\n end",
"def show\n @event = Event.find(params[:id])\n render json: @event\n end",
"def index\n event = Event.find(params[:event_id])\n render json: event.route, status: :ok\n end",
"def index\n @event = Event.find(:first)\n end",
"def index\n respond_to do |format|\n format.html\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n render json: @events\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json do\n render :json => {events: @events}\n end\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n respond_to do |format|\n format.html \n format.json \n end\n end",
"def index\n respond_with(@events)\n end",
"def show\n @main_event = MainEvent.find(params[:id])\n @events = Event.where(main_event_id: @main_event.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @events }\n format.js { render :json => @events }\n end\n\n end",
"def index\n render json: Event.all, status: :ok\n end",
"def index\n @events = eager_event.all\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event, :includes => [:thumbnail, :pictures, :videos, :documents] }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @events }\n end\n end",
"def index\n @events = Event.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @events }\n end\n end",
"def get_event_list ( year )\n get_api_resource \"#{@@api_base_url}events/#{year}\"\n end",
"def user_event_inforamtion\n @user_events = UserEvent.where(event_id: params[:event_id])\n\n render json: @user_events, root: \"user_event_information\", each_serializer: Web::V1::UserEventInformationSerializer\n end",
"def index\n response = { events: Event.all }\n respond_to do |format|\n format.json { render json: response.to_json }\n format.html { render :index }\n end\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def show\n render json: @event\n end",
"def events\n collection(\"events\")\n end",
"def show\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event_event }\n end\n end",
"def event(event, options = {})\n get \"events/#{event}\", options\n end",
"def index\n @events = Event.available.page(params[:page])\n end",
"def event_list\n @custom_event = Custom_event.find(params[:id])\n end",
"def get_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\tdo_the_get_call( url: api_url, user: @user )\nend",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n render json: EventSerializer.new(@event).as_json, status: 200\n end",
"def index\n @attacheds = Attached.find_all_by_event_id(params[:e_id])\n @event = Event.find(params[:e_id])\n @attached = Attached.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.mobile\n format.json { render json: @attacheds }\n end\n end",
"def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @user.tenant_id)\n if @event.present?\n render :json => @event\n else\n render :json => {messageCode: \"event.notfound\", message: \"Event Not Found\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def event(id, options = {})\n get \"events/#{id}\", options\n end",
"def index\n @events = Event.find(:all) \n end",
"def show\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @myevent }\n end\n end",
"def show\n \trender json: @event\n end",
"def index\n @events = Event.all\n\n render json: @events, include: :talks\n end",
"def index\n #@events = Event.all\n @events = Event.page(params[:page]).per(20)\n\n if params[:eid]\n @event = Event.find( params[:eid] )\n else\n @event = Event.new\n\n end\n\n prepare_variable_for_index_template\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @events.to_xml }\n format.json { render :json => @events.to_json }\n format.atom { @feed_title = \"My event list\" } # index.atom.builder\n end\n end",
"def index\n if params[:eid]\n @event = Event.find( params[:eid])\n else\n @event = Event.new\n # @event.start_on = Date.new(2015,1,1)\n end\n prepare_variable_for_index_template\n\n respond_to do |format|\n format.html\n format.xml {\n render :xml => @events.to_xml\n }\n format.json {\n render :json => @events.to_json\n }\n format.atom {\n @feed_title = \"My event list\"\n }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def events\n data[\"events\"]\n end",
"def show\n\n @event = Event.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def show\n @event = Event.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @event }\n end\n end",
"def index\n @events = Event.all\n\n render json: @events, \n except: [:created_at, :updated_at], \n include: [:reviews => {include: [:attendee => {only: [:first_name, :last_name]}]}, \n :host => {only: [:first_name, :last_name, :id]}]\n\n end",
"def calendar_event(event_id)\n record \"/calendar_events/#{event_id}.xml\", :method => :get\n end",
"def index\n @events = Event.all\n @event = Event.new\n\n respond_to do |format|\n format.html\n format.json { render 'events/index', events: @events }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @event }\n end\n end"
] |
[
"0.6845841",
"0.6650304",
"0.6581152",
"0.6481863",
"0.647552",
"0.6405744",
"0.6343988",
"0.63414484",
"0.6334101",
"0.62903976",
"0.62903976",
"0.6279981",
"0.62682307",
"0.62266964",
"0.62256765",
"0.62162936",
"0.62150276",
"0.62129927",
"0.6205357",
"0.6204575",
"0.6197637",
"0.6192084",
"0.61920714",
"0.61745423",
"0.61684984",
"0.61594105",
"0.6127592",
"0.61260986",
"0.61077344",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6086298",
"0.6080583",
"0.6074272",
"0.606053",
"0.6058609",
"0.6050489",
"0.6050489",
"0.6050489",
"0.6050489",
"0.6050489",
"0.60361785",
"0.6034531",
"0.6026771",
"0.602369",
"0.60111415",
"0.60006946",
"0.5998659",
"0.5998659",
"0.5984716",
"0.59687024",
"0.5948481",
"0.594739",
"0.59457177",
"0.5943727",
"0.59434396",
"0.5941904",
"0.59377706",
"0.59358174",
"0.5934991",
"0.59330726",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.5932178",
"0.59299093",
"0.5929389",
"0.5929032",
"0.5928151",
"0.59228975",
"0.5921291",
"0.5921004",
"0.5918372",
"0.5918372"
] |
0.0
|
-1
|
POST /event_elements POST /event_elements.json
|
def create
@event_element = EventElement.new(event_element_params)
respond_to do |format|
if @event_element.save
format.html { redirect_to @event_element, notice: 'Event element was successfully created.' }
format.json { render :show, status: :created, location: @event_element }
else
format.html { render :new }
format.json { render json: @event_element.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def push_events\n saved = []\n jsonHash = request.POST[:_json];\n jsonHash.each do |jsonEvent|\n event = Event.new\n event.race_id = jsonEvent[\"raceId\"]\n event.walker_id = jsonEvent[\"walkerId\"]\n event.eventId = jsonEvent[\"eventId\"]\n event.eventType = jsonEvent[\"type\"]\n event.eventData = jsonEvent[\"data\"]\n event.batteryLevel = jsonEvent[\"batL\"]\n event.batteryState = jsonEvent[\"batS\"]\n event.timestamp = Time.zone.parse(jsonEvent[\"time\"])\n if event.save # if new\n saved << jsonEvent[\"eventId\"]\n if event.race_id != 0 # if not unknown race_id\n after_create(event)\n end\n else # if exists\n saved << jsonEvent[\"eventId\"]\n puts \"Not Saved!\" # debug print\n puts jsonEvent # debug print \n end\n end\n render :json => {:savedEventIds => saved}\n end",
"def event_element_params\n params.require(:event_element).permit(:starting_at, :due_date, :created_at, :updated_at, :name, :reminder)\n end",
"def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end",
"def create\n megam_rest.post_event(to_hash)\n end",
"def create_event event, data={}\n data[:event] = event\n post '/event', data\n end",
"def event_params\r\n params.require(:event).permit(:title, :description, :start_time, :end_time, :machine_ids => [])\r\n end",
"def event_params\n json_params = ActionController::Parameters.new( JSON.parse(request.body.read) )\n json_params.require(:event).permit(:creator_id, :name, :address, :latitude, :longitude, :creator_id, {:tags_ids => []})\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n\n new_tags = params[:tags].split(',')\n\n new_tags.each do |stag|\n @event.tags.create(tag: stag)\n end\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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 create_events\n end",
"def event_params\n params.require(:event).permit(:name, :start_at, :end_at, :user_id, :description, :color, :important, :guests => [])\n end",
"def create\n @event = Event.new(event_params)\n smart_list\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_url, notice: 'Мероприятие успешно создано.' }\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 create\n\t \n\t \n\t @event = @univers.events.build(event_params)\n\n\t respond_to do |format|\n\t\tif @event.save\n\t\t format.html { redirect_to univers_events_path, notice: 'Event was successfully created.' }\nformat.js\n\t\t\tformat.json { render :show, status: :created, location: [@univers, @event] }\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n\t end \n end\n end",
"def event_params\n params.require(:event).permit(:time, :location, :title, :description, :creator_id, invites: [])\n end",
"def index\n @event_elements = EventElement.all\n end",
"def create\n @event = Event.new(params[:event])\n\n if @event.save\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def event_params\n params.require(:event).permit(:name, :description, user_id: [])\n end",
"def event_params\n params.require(:event).permit(\n :name, :shortdescription,\n :longdescription, :start_date, :duration, :maxparticipants, :type,\n :latest_signup_date, :full_price, :price_early_signup, :durationunit_id,\n :eventtype_id, :allow_signup, :external_signup_url, :redirect_message,\n :external_signup_text, :bottom_text, :end_date, :early_signup_deadline,\n :early_signup_pricing, :onlinestatus_id, :country,\n :planningstatus_id, :generate_invoice, :vat_id, :location, :street,\n :streetno, :zip, :city, :latitude, :longitude, :reservation_expiry,\n :googlemapslocation, :slug, :eventtemplate_id, :currency,\n :max_additional_participants, :request, paymentmethod_ids: [],\n orders_attributes: [:order_date, address_attributes: Address::FORM_ATTRIBUTES],\n eventpaymentmethods_attributes: %i(available_until paymentmethod_id id)\n )\n end",
"def event_params\n params.require(:event).permit(:name, :start_time, :end_time, :location, :description, :image_url, :header_image, :eb_event_id, :permission_url, :num_tickets, :registration_type)\n end",
"def event_params\n params.require(:event).permit(:title, :date, :times, :start_at, :end_at, :body)\n end",
"def save\n event = params\n # This assumes that all keys exists. Yay no error handling...\n toSave = Event.new(update_type: event[:event],\n start_time: event[:payload][:event][:start_time_pretty],\n end_time: event[:payload][:event][:end_time_pretty],\n location: event[:payload][:event][:location],\n invitee_name: event[:payload][:invitee][:name],\n duration: event[:payload][:event_type][:duration],\n event_kind: event[:payload][:event_type][:kind])\n toSave.save\n render json: {}, status: 200\n end",
"def create\n # render json: params[:event]\n temp_event = Event.create(\n name: params[:event][:name],\n location: params[:event][:location],\n date: params[:event][:date],\n time: params[:event][:time],\n budget: params[:event][:budget],\n user: current_user\n )\n redirect_to \"/items?event=#{temp_event.id}\"\n end",
"def create\n\n params[:elements].values.each do |elem|\n puts 'el', elem\n elem_to_save = Element.create (elem)\n @design.elements << elem_to_save\n end\n\n\n respond_to do |format|\n if @design.id\n format.html { redirect_to edit_design_path(@design), notice: 'Design was successfully created.' }\n format.json { render :json => @design}\n else\n format.html { render :new }\n format.json { render json: @design.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def create\n params_for_model = Meetup::GetListOfParamsForModel.new.perform(\n meetup_event_params[:input_text]\n )\n\n return if params_for_model.searched_for_only_one_event? and\n errors?(params_for_model)\n\n params_for_model.list.each do\n |existing_event:, params:, errors_wrapper:|\n next if no_need_to_create_event?(errors_wrapper, existing_event)\n\n meetup_event = Meetup::CreateEvent.new.perform(params, user_id)\n\n next if errors? meetup_event, flash_error: false\n add_to_cookie_for_event_ids meetup_event.id\n end\n\n cable_broadcast\n head :ok\n end",
"def event_params\n params.require(:event).permit(:type, :occurred_at, :data)\n end",
"def create\n\n @event = Event.new(event_params)\n\n tag_array = event_params2['tags'].split(',')\n tag_array.each do |x|\n @tag = Tag.create(desc: x)\n @event.tags << @tag\n end\n EventTag.create(event_id: @event.id, tag_id: @tag.id)\n\n respond_to do |format|\n if @event.save\n params[:event]['images'].each do |a|\n @event_photo = @event.event_photos.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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 event_params\n params.require(:event).permit(Event::WEB_PARAMS)\n end",
"def event_params\n params.require(:event).permit(:event_name, :image_url, :ticket_price, :description,\n :date_range_from, :date_range_to, :venue_address, :venue_address1, :status, :city_id, :state_id, :volunteer_ids => [])\n end",
"def event_params\n params.require(:event).permit(:date, :title, :location, :hour, :min, :description, :invitees)\n end",
"def event_params\n params.require(:event).permit(:name, :time, :deadline, :place_ids)\n end",
"def post_event(url, event, payload_type, payload)\n body = {\n :event => event,\n :payload_type => payload_type }\n body[:payload] = payload if payload\n\n http_post(url) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.body = body.to_json\n req.params['verification'] = 1 if event == 'verification'\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.creator = @current_user\n\n if @event.save\n @event.users.each do |user|\n p \"event user = #{user.name}\"\n user.send_event_push(PushTypes::NEW_EVENT, current_user.to_push, @event.title)\n end\n else\n render json: @event.errors, status: :unprocessable_entity\n return\n end\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n @event.enters\n @event.leaves\n\n # highfive_counter = 0\n # if @event[\"event_type\"] == \"highfive\"\n # highfive_counter = highfive_counter + 1\n # return highfive_counter\n # else\n # 0\n # end\n render json: @event, status: :created, location: @event\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def post_event_params\n params[:post_event]\n end",
"def create\n @event = Event.find(params[:event_id])\n @event_entry = @event.event_entries.build(params[:event_entry])\n\n respond_to do |format|\n if @event_entry.save\n format.html { redirect_to @event, :notice => 'Event entry was successfully created.' }\n format.json { render :json => @event, :status => :created, :location => @event_entry }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @event_entry.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\r\n @event = Event.new(event_params)\r\n convert_timezone @event\r\n event_type_status @event\r\n if @event.save_without_exception\r\n update_theme @event\r\n add_event_categories @event\r\n add_event_location @event\r\n create_group_guest_list @event\r\n add_photos @event\r\n # Create Groups and contacts through CSV\r\n contacts_imports\r\n render json: SuccessResponse.new(\r\n code: 200, message: 'Event Created.', location: '/events/List?id=' + @event.id.to_s, eventID: @event.id\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new, adapter: :json, status: :unprocessable_entity\r\n end\r\n end",
"def event_params\n params.require(:event).permit(:name, :description, :begins_at, :ends_at, :website, :eventable, :eventable_id, :eventable_type, :talks_type, :talks_duration, :talks_slots, :submissions_end_at)\n end",
"def event_params\n params.require(:event).permit({:relations => {}}, {:context => {}}, {:meta => {}})\n end",
"def event_params\n params.require(:event).permit!\n end",
"def event_params\n params.require(:event).permit!\n end",
"def event_params\n params[:event][:category_ids] ||= []\n params.require(:event).permit(:name, :starts_at, :ends_at, :description, :location, :website, :created_by, :updated_by, :category_ids => [])\n end",
"def event_params\n params.require(:event).permit(:title, :content, :location, :date, :images)\n end",
"def create\n @event = Event.new(event_params)\n if @event.save\n head :created\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def create\n @location = Location.find(params[:location_id])\n @event_types = EventType.all(:order => 'name') # strictly for display of error\n \n # sanitize and all that\n #params[:event][:event_details_attributes][:\"0\"][:desc] = format_content(params[:event][:event_details_attributes][:\"0\"][:desc])\n \n # format time from plugin\n params[:event][:event_details_attributes][:\"0\"][:time_from] = Time.parse(params[:event_data][:\"time_from(5i)\"])\n params[:event_data].delete([:\"time_from(5i)\"])\n params[:event][:event_details_attributes][:\"0\"][:time_to] = Time.parse(params[:event_data][:\"time_to(5i)\"])\n params[:event_data].delete([:\"time_to(5i)\"])\n \n @event = @location.events.create(params[:event])\n @event.location = @location\n @event.event_dates.each do |ed|\n ed.destroy unless ed.day || ed.date \n end\n \n respond_to do |format|\n if @event.save\n flash[:notice] = 'Event was successfully created.'\n format.html { redirect_to(@event) } # for realz\n #format.html { render :action => \"new\" } # for test\n format.xml { render :xml => @event, :status => :created, :location => @event }\n else\n format.html { render :action => \"new\" } # index used to add events...sorry\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:name, :description, :location, :date)\n end",
"def event_params\n params.require(:event).permit(:title,\n :description,\n :cover,\n :start_date,\n :start_time,\n :end_date,\n :end_time,\n :address,\n :etype,\n :no_of_registrations,\n :organizer_title,\n :organizer_tel,\n :category_id,\n :fb_link,\n :organizer_desc,\n :telephone_visible,\n :ticket_details,\n :ticket_url )\n end",
"def event_params\n params.require(:event).permit(:date, :dateend, :title, :location, :link, :linktitle, :time, :time_end, :more_link, :moreTitle, :description, :description2, :description3, :description4, :image_link, :image_link_cache, :imageAlt, :festival_id, :venue_id, :free, :category_ids => [])\n end",
"def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end",
"def event_params\n params.require(:event).permit(\n :name,\n :event_type,\n :date,\n artist_ids: [],\n genre_ids: [],\n address_attributes: %i[\n id\n street\n city\n state\n zip\n ]\n )\n end",
"def event_params\n\n params.require(:event).permit(:title, :description, :hour, :duration, :date, :longitude, :latitude, :formatted_addres, :all_tags)\n end",
"def create\n event = Event.new(event_params)\n event.creator_id = @creator_id\n tag = Tag.new(tag_params)\n position = Position.new(position_params)\n\n if Tag.find_by_name(tag.name.downcase).present?\n tag = Tag.find_by_name(tag.name.downcase)\n end\n\n event.tags << tag\n event.position = position\n if event.save && tag.save && position.save\n respond_with event, location: url_for([:api, event]), status: :created\n else\n error = ErrorMessage.new(\"Could not create the Event\", \"Something went wrong\")\n respond_with error, status: :bad_request\n end\n end",
"def event_params\n params.require(:event).permit(:title, :description, :location, :date)\n end",
"def event_params\n params.require(:event).permit(:title, :description, :date, :time, :parent_id, :child_id, :mediator_id, :pending)\n end",
"def event_params\n params.require(:event).permit(:name, :client_id, :data)\n end",
"def event_params\n params.require(:event).permit(:name, :date, :time, :location, :purpose)\n end",
"def event_params\n params.require(:event).permit(:date, :title, :description)\n end",
"def create\n @event = Event.new(event_params)\n respond_to do | format |\n if @event.save\n if(params.require(:event).key?(\"tags\"))\n tags = Tag.find(params.require(:event)['tags'])\n else\n tags = Tag.find_by(name: \"Other\") # Set default tag if none was selected\n end\n @event.tags << tags\n UserEventRelationship.create(event_id: @event.id, user_id: current_user.id, role_type_id: 0)\n format.html { redirect_to @event }\n format.json { render json: @event, 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 create\n @event = Event.new(event_params)\n respond_to do | format |\n if @event.save\n if(params.require(:event).key?(\"tags\"))\n tags = Tag.find(params.require(:event)['tags'])\n else\n tags = Tag.find_by(name: \"Other\") # Set default tag if none was selected\n end\n @event.tags << tags\n UserEventRelationship.create(event_id: @event.id, user_id: current_user.id, role_type_id: 0)\n format.html { redirect_to @event }\n format.json { render json: @event, 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 create\n @event = Event.new(params[:event])\n\t\tif @event.save\t\t \n\t\t respond_to do |format|\n\t\t format.html { redirect_to events_path }\n\t\t format.js\n\t\t end\n\t\tend\n end",
"def test_add_event()\n # Parameters for the API call\n\n req_headers = JSON.parse('{'\\\n '\"Host\": \"api.acmeinc.com\",'\\\n '\"Accept\": \"*/*\",'\\\n '\"Connection\": \"Keep-Alive\",'\\\n '\"User-Agent\": \"Dalvik/2.1.0 (Linux; U; Android 5.0.2; C6906 Build/14.5.A.0.242)\",'\\\n '\"Content-Type\": \"application/json\",'\\\n '\"Content-Length\": \"126\",'\\\n '\"Accept-Encoding\": \"gzip\"'\\\n '}')\n\n req_body = JSON.parse( '{'\\\n '\"items\": ['\\\n '{'\\\n '\"type\": 1,'\\\n '\"id\": \"fwfrf\"'\\\n '},'\\\n '{'\\\n '\"type\": 2,'\\\n '\"id\": \"d43d3f\"'\\\n '}'\\\n ']'\\\n '}')\n\n rsp_headers = JSON.parse('{'\\\n '\"Date\": \"Tue, 6 Jan 2019 23:46:49 GMT\",'\\\n '\"Vary\": \"Accept-Encoding\",'\\\n '\"Pragma\": \"no-cache\",'\\\n '\"Expires\": \"-1\",'\\\n '\"Content-Type\": \"application/json; charset=utf-8\",'\\\n '\"Cache-Control\": \"no-cache\"'\\\n '}')\n\n rsp_body = JSON.parse('{'\\\n '\"Error\": \"InvalidArgumentException\",'\\\n '\"Message\": \"Missing field field_a\"'\\\n '}')\n\n metadata = JSON.parse('{'\\\n '\"foo\": \"rubytestmeta\",'\\\n '\"bar\": \"rubytestmedat2\"'\\\n '}')\n\n event_req = EventRequestModel.new()\n event_req.time = Time.now.utc.iso8601\n event_req.uri = \"https://api.acmeinc.com/items/reviews/\"\n event_req.verb = \"PATCH\"\n event_req.api_version = \"1.1.0\"\n event_req.ip_address = \"61.48.220.123\"\n event_req.headers = req_headers\n event_req.body = req_body\n\n event_rsp = EventResponseModel.new()\n event_rsp.time = (Time.now.utc + 2).iso8601\n event_rsp.status = 500\n event_rsp.headers = rsp_headers\n event_rsp.body = rsp_body\n\n event_model = EventModel.new()\n event_model.request = event_req\n event_model.response = event_rsp\n event_model.user_id = \"my_user_id\"\n event_model.company_id = \"my_company_id\"\n event_model.metadata = metadata\n event_model.session_token = \"23jdf0owekfmcn4u3qypxg09w4d8ayrcdx8nu2ng]s98y18cx98q3yhwmnhcfx43f\"\n\n # Perform the API call through the SDK function\n self.class.controller.create_event(event_model)\n\n # Test response code\n assert_equal(@response_catcher.response.status_code, 201)\n end",
"def create\n @event = Event.new(event_params)\n\n if @event.save\n \tdata = { data: @event, status: :created, message: \"Event was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def event_params\n params.require(:event).permit(:title, :body, :published, :datetime, :location)\n end",
"def create\n @event = Event.create(event_params)\n create_players_events(@event.id)\n \n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:name, :date, :time, :description)\n end",
"def event_params\n params.require(:event).permit(:name, :author, :country_id, :state_id, :city_id, \n :category_id, :published, :deleted, :link, :contact_email, \n :contact_phone, :start_date, :end_date, tags: [],\n activities_attributes: [:id, :link, :start_date, :end_date, \n :price, :published, tags: []])\n end",
"def create\n puts params[:event]\n @event = Event.new(params[:event])\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to events_path, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\t@users = User.all\n \t@event = Event.new(params[:event])\n @tags = params[:tags][:tags]\n @tags=@tags.split\n \n @tags.each do |tag|\n \tnew_tag = Tag.new(:name => tag)\n \tnew_tag.save\n \t@event.tags << new_tag\n end\n \n if @current_user.admin\n \t@event.confirmation = true\n \t@event.save\n end\n\n respond_to do |format|\n if @event.save\n \t@users.each do |user|\n \t\tif user.admin && !@current_user.admin\n \t\t\tUserMailer.event_to_confirm(user, @event).deliver\n \t\t\telse\n \t\t\tif user.id == @current_user.id\n\t \t\t\tUserMailer.your_new_event(user, @event).deliver\n\t \t\t\telse\n\t \t\t\t\tUserMailer.new_event(user, @event).deliver\n \t\t\t\tend\n \t\t\tend\n \t\tend\n format.html { redirect_to @event, notice: 'Wydarzenie dodane do bazy danych' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:summary, :location, :description, :start_date, :timezone, :end_date, :attendees)\n end",
"def event_params\n params.require(:event).permit(:info, :invitees_email)\n end",
"def event_params\n params.require(:event).permit(:name, :image, :location_id, :description, :categories, :date, :time)\n end",
"def event_params\n params.require(:event).permit(:event_name, :web_link, :image, :event_info, :photos)\n end",
"def create\n @event = Event.create(params[:event])\n respond_to do |format|\n if @event.save\n current_project.events<<@event\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n @event.user_id = current_user.id\n\n respond_to do |format|\n if @event.save\n params[:event_attachments]['image'].each do |a|\n @event_attachment = @event.event_attachments.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to edit_event_path(@event), notice: 'event was successfully created.' }\n else\n format.html { render action: 'new' }\n end\n end\n end",
"def event_params\n params.require(:event).permit(\n :title, \n :waiver, \n :description, \n :time, \n :path, \n :id, \n :street_address_one, \n :street_address_two, \n :city, \n :state, \n :zipcode, \n :date,\n :timezone, \n :volunteer_coordinator_email, \n :support_email, \n :google_maps_iframe, \n :receipt_html,\n :packet_pickup_info_html,\n :race_day_info_html,\n :published,\n :on_sale,\n :about,\n :packet_info,\n :deadline_pricing_info,\n :volunteer_info,\n :charity_info\n )\n end",
"def event_params\n params.require(:event).permit(:name, :host_id, :event_description, :imageurl, :start_date, :end_date, :group_id, :tournament_id, :location, :outcome, user_id:[],)\n end",
"def create\n\n params[:event][:sections].shift\n sections = params[:event][:sections]\n event_id = params[:event][:id]\n params[:event].delete \"sections\"\n\n \n @event = Event.new(params[:event])\n \n respond_to do |format|\n if @event.save\n sections.each do |section_id|\n @section = SectionEvent.new({:event_id => @event.id, :section_id => section_id})\n @section.save\n end \n if request.xhr?\n flash[:notice] = \"Event was successfully created.\"\n format.html #{ redirect_to events_url, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n format.js\n @events = Event.by_date(params[:date_query])\n else\n flash[:notice] = \"Event was successfully created.\"\n format.html { redirect_to events_url, notice: 'Event was successfully created.' }\n format.json { render json: @event, status: :created, location: @event }\n format.js\n end\n else\n if request.xhr?\n format.html #{ render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.js\n end\n\n end\n # if @event.save\n # format.html { redirect_to @event, notice: 'Event was successfully created.' }\n # format.json { render json: @event, status: :created, location: @event }\n # format.js\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @event.errors, status: :unprocessable_entity }\n # format.js\n\n end\n end",
"def event_params\n params.require(:event).permit(:name, :status,:event_ribbon, :description, :start_at, :end_at, :local, :participants_limit,\n partners_attributes: [:id, :name, :link, :order, :site, :event_id, :category, :logo,\n :_destroy],\n gifts_attributes: [:id, :name, :photo, :_destroy,\n winners_attributes: [:id, :gift_id, :user_id, :_destroy]],\n albums_attributes: [:id, :title, :event_id, :_destroy,\n images_attributes: [:id, :title, :asset, :_destroy]],\n attachments_attributes: [:id, :name,:file_type, :type, :origin_type, :situation, :file, :_destroy])\n end",
"def event_params\n params.require(:event).permit(:title, :notes, :date, :hour, :reported_by, :site, :facts, :event_status_id, :location, :end_date, :end_hour, :contact_name, :contact_phone, :community_id, :event_type_id, :security_agent_id, :image)\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n params[:users].each do |u|\n EventsUser.create!([{ user_id: u.to_i, event_id: @event.id }])\n EventMailer.send_event_email(@event, u).deliver\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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 event_params\n params.require(:event).permit(:name, :date, :time, :location, :description, :photo, :photo_url, :host_id)\n end",
"def event_params\n params.require(:event).permit(:name, :date, :time)\n end",
"def event_params\n params.require(:event).permit(:name, :occurrence, :job_name, :job_arguments, :start_at,\n :priority, :frequency, :execution_time => [])\n end",
"def event_params\n params.require(:event).permit(:event_name, :event_location, :event_date, :description)\n end",
"def event_params\n params.require(:event).permit(:name, :description, :start_date, :end_date, :one_day)\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.new(event_params)\n\n respond_to do |format|\n if @event.save\n format.json { render :show, status: :created, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def event_params\n params.require(:event).permit(:date, :start_time, :end_time, :title, :description, :cost, :capacity, :location_id, :meeting_point, :event_type, :cohort_id, :track_id, :is_public)\n end",
"def add_events(new_events); end",
"def create\n token_ok, token_error = helpers.API_validate_token(request)\n if not token_ok\n render json: {message: token_error }, status: 401\n else\n\n # Get the order ID\n order_id = params[:order_id].to_i\n\n # Save the order event data\n begin\n order_event_data = OrderEvent.new\n order_event_data.event_id = params['eventId']\n order_event_data.user_id = params['userId']\n order_event_data.order_id = order_id\n order_event_data.scope = params['scope']\n order_event_data.observations = params['observations']\n order_event_data.save!\n\n respond_to do |format|\n format.json { render json: {message: 'Event saved.'} }\n end\n\n rescue => e\n puts \"Error #{e.class}: #{e.message}\"\n puts \"ERROR BACKTRACE:\"\n puts e.backtrace\n respond_to do |format|\n format.json { render json: {message: 'Error saving the event to the order',\n extraMsg: e.message} }\n end\n end\n\n end\n end",
"def event_params\n params.require(:event).permit(:title, :description, :start_datetime, :client_id, :ticket_id)\n end",
"def event_params\n params.require(:event).permit(:title, :date, :location, :description)\n end",
"def post_params\n params.require(:event).permit(:title, :description, :location, :duration, :price, :start_date)\n end",
"def event_params\n params.require(:event).permit('title', 'description', 'start_time', 'end_time', 'occupied')\n end",
"def create\r\n @event = Event.new(event_params)\r\n @event.save\r\n end",
"def event_params\n params.require(:event).permit(:eventID, :date, :time, :location, :GPSLocation, :completionStatus, :description, :startTime, :endTime, :totalTime, :survey)\n end",
"def new\n @event = Event.new\n 3.times { @event.attachments.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end",
"def event_params\n params.require(:event).permit(:address, :description, :start_date, :end_date, :price, :name, :neighborhood_id, :avatar, :counter)\n end",
"def event_params\n params.require(:event).permit(:title, :date, :time)\n end",
"def event_params\n params.require(:event).permit(:name, :date)\n end",
"def create\n @event = Event.new(event_params)\n# @event.create_eventbrite_event(event_params)\n# @event.create_eventbrite_tickets\n\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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 create\n @event = Event.new(event_params)\n @current_user.events << @event\n @event.confirm = nil\n @event.save\n\n respond_to do |format|\n if @event.save\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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"
] |
[
"0.6460685",
"0.59564286",
"0.5924289",
"0.5916261",
"0.5911022",
"0.5910056",
"0.58828604",
"0.5859368",
"0.58439016",
"0.5804608",
"0.5785104",
"0.57801235",
"0.57481337",
"0.573887",
"0.56989515",
"0.56960005",
"0.56655276",
"0.5614666",
"0.5586792",
"0.5584357",
"0.55823326",
"0.5580528",
"0.5576818",
"0.5574499",
"0.5571731",
"0.5565502",
"0.5564633",
"0.5561369",
"0.555524",
"0.5544878",
"0.5543618",
"0.5531157",
"0.5523483",
"0.5520801",
"0.5519401",
"0.5512161",
"0.5508735",
"0.55048037",
"0.55048037",
"0.549847",
"0.5493682",
"0.549073",
"0.54894215",
"0.5484894",
"0.54786927",
"0.5475194",
"0.54670835",
"0.5464211",
"0.5456077",
"0.54535925",
"0.5450859",
"0.5444575",
"0.54427654",
"0.5431324",
"0.5429718",
"0.5425482",
"0.5425482",
"0.5422982",
"0.54186",
"0.5415623",
"0.5409918",
"0.5408726",
"0.54075897",
"0.54013515",
"0.53997344",
"0.5399709",
"0.539738",
"0.5394706",
"0.53920245",
"0.53874457",
"0.5387387",
"0.5383755",
"0.53827775",
"0.53776747",
"0.5377548",
"0.5377375",
"0.5371261",
"0.5368526",
"0.5363332",
"0.5361403",
"0.5359009",
"0.53583956",
"0.5358168",
"0.53581667",
"0.53581667",
"0.53581405",
"0.5356414",
"0.535297",
"0.5350047",
"0.53496695",
"0.5348517",
"0.5343816",
"0.5343533",
"0.5340614",
"0.53391135",
"0.5338496",
"0.53354496",
"0.5334959",
"0.5333997",
"0.5333415"
] |
0.65677327
|
0
|
PATCH/PUT /event_elements/1 PATCH/PUT /event_elements/1.json
|
def update
respond_to do |format|
if @event_element.update(event_element_params)
format.html { redirect_to @event_element, notice: 'Event element was successfully updated.' }
format.json { render :show, status: :ok, location: @event_element }
else
format.html { render :edit }
format.json { render json: @event_element.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(json_body, user_id, group_id, event_id)\n\n render status: :ok, text: \"\"\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { head :no_content }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params(params))\n render json: @event, status: 200\n else\n render :json => @event.errors, :status => 422\n end\n end",
"def update\n\tif @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n @event.update(event_params)\r\n end",
"def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end",
"def pupdate\n @event = Event.find(params[:id])\n respond_to do |format|\n if @event.update_attributes(JSON.parse(params[:event]))\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n @event.tags.clear()\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render json: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(params[:event])\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.using(:shard_one).find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end",
"def update\n @event.update(event_params) \n end",
"def update\n @event = Event.find(params[:id])\n#TODO fazer o update event via jquery, retornando rjs\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(tasks_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event.update(event_params)\n end",
"def update\n \n \n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: t(:event_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n \n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n if @event.update(event_params)\n head :no_content\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n return forbidden unless user_is_owner\n return bad_request unless @event.update_attributes(event_params)\n render json: @event, status: :ok\n end",
"def update\n @event_event = Event::Event.find(params[:id])\n\n respond_to do |format|\n if @event_event.update_attributes(params[:event_event])\n format.html { redirect_to @event_event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n # @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n render json: { location: format_event(@event) }\n else\n render json: @event.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @base_event.update(base_event_params)\n format.json { head :no_content }\n else\n format.json { render json: @base_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch_event(json_body, user_id, group_id, event_id)\n event = Event.find(event_id)\n\n json_body.each do |operation_line|\n if operation_line[\"op\"] == \"add\"\n if operation_line[\"path\"] == \"/voters\"\n email_to_add = operation_line[\"value\"]\n event.voters << Voter.create(email: email_to_add)\n elsif operation_line[\"path\"] == \"/restaurants\"\n\n end\n\n end\n\n end\n end",
"def update\n #@event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n debugger\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n #require \"pry\"; binding.pry\n\n update_users\n\n respond_to do |format|\n if @event.update(event_params)\n sync_update @event\n format.html { redirect_to @event, notice: t(\"successfully_updated\", :model => t(\"models.event\")) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n# @event.update_eventbrite_event(event_params)\n\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.json { render :show, status: :ok, location: @event }\n else\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, :notice => 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update Fenix::Store::Converter::Flattener.event params[:event]\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_request = EventRequest.find(params[:id])\n\n respond_to do |format|\n if @event_request.update_attributes(params[:event_request])\n format.html { redirect_to @event_request, notice: 'Event request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n @event.save!\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n event_id = params[:id]\n if event_id.present? && params[:event].present? && @user.uuid.present? && @user.uuid != \"guest\"\n event_params = params[:event]\n @event = Com::Nbos::Events::Event.where(id: params[:id], user_id: @user.id ).first\n if @event.present?\n @event.update(event_params.permit!)\n if @event.save\n render :json => @event\n else\n data = add_error_messages(@event)\n render :json => data\n end\n else\n render :json => {\"messageCode\": \"module.user.unauthorized\", \"message\": \"Unauthorized to update others Event\"}, status: 404\n end\n else\n render :json => {messageCode: \"bad.request\", message: \"Bad Request\"}, status: 400\n end\n end",
"def update\n @chronicle = Chronicle.find(params[:chronicle_id])\n @events = @chronicle.events.order(sort_column2 + \" \" + sort_direction2).paginate(:per_page =>10, :page => params[:page])\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @chronicle, notice: 'Event was successfully updated.' }\n format.js { render :show, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html do\n gflash :notice\n redirect_to @event\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html {redirect_to events_path }\n format.xml { head :ok }\n\t\t\t\tformat.js\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n\t\t\t\tformat.js\n end\n end\n end",
"def update\n\t@desktop_override = true\n\t@event.title = nilify(params[:event][:title])\n\t@event.description = nilify(params[:event][:description])\n\t@event.start_time = nilify(params[:event][:start_time]).nil? ? nil : Time.parse(nilify(params[:event][:start_time])).getutc.iso8601\n\t@event.end_time = nilify(params[:event][:end_time]).nil? ? nil : Time.parse(nilify(params[:event][:end_time])).getutc.iso8601\n\t@event.recurrence = nilify(params[:event][:recurrence])\n\t@event.event_type = nilify(params[:event][:event_type])\n\t@event.updated_by = \"RestNapForm\"\n\n\tif @event.valid?\n\t @event.save\n\t #redirect_to country_region_locality_event_path(@country, @region, @locality, @event)\n\t redirect_to country_region_locality_events_path(@country, @region, @locality)\n\telse\n\t @errors = true\n\t respond_to do |format|\n\t\tformat.html do\n\t\t render :layout => \"restlessnapkin\", :action => :edit\n\t\tend\n\t end\n\tend\n end",
"def update\n @event = Event.find(params[:id])\n\n @client = Client.find(params[:event][:client_id])\n @event.event_type_id = nil\n @event_type = EventType.find(params[:selected])\n if @event_type.node == false\n @event.event_type_id = params[:selected]\n end\n\n respond_to do |format|\n if params[:event][:event_type_id] != \"\" && @event.update_attributes(params[:event])\n format.html { redirect_to @event, notice: 'Ereignis wurde erfolgreich bearbeitet' }\n format.json { head :no_content }\n else\n self.reload_params\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n setup_variables\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n flash[:notice] = 'Event was successfully updated.'\n format.html { redirect_to(admin_event_path(@event)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to organization_event_url(@event.organization, @event), notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html {redirect_to @event, notice: 'Event was successfully updated.'}\n format.json {head :no_content}\n else\n format.html {render action: 'edit'}\n format.json {render json: @event.errors, status: :unprocessable_entity}\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n \n respond_to do |format|\n if @event.update_attributes(params[:event])\n @content = \"4\"\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to edit_admin_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n @event.update(status: \"Pending\")\n else\n @reopen = true\n format.json { render json: @event.errors, status: :unprocessable_entity }\n format.html { render :show }\n end\n end\n end",
"def update\n respond_to do |format|\n if @axis_event.update(axis_event_params)\n format.html { redirect_to @axis_event, notice: 'Axis event was successfully updated.' }\n format.json { render :show, status: :ok, location: @axis_event }\n else\n format.html { render :edit }\n format.json { render json: @axis_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.from_param(params[:event_id])\n @time_table = @event.time_tables.where(:permalink => params[:id]).first\n success = params[:time_table] && params[:time_table][:times] && \n @time_table.update_attributes(:times => JSON.parse(params[:time_table][:times]))\n success ? update_success : update_failure\n rescue JSON::ParserError\n update_failure\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(params[:event])\n format.html { redirect_to @event}\n flash[:success] = \"Event was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event = Event.find(params[:id])\n\n respond_to do |format|\n if @event.update_attributes(event_params)\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n\n respond_to do |format|\n if @page_usage_event.update_attributes(params[:page_usage_event])\n flash[:notice] = 'PageUsageEvent was successfully updated.'\n format.html { redirect_to(@page_usage_event) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @page_usage_event.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @event.update(event_params)\n \tdata = { data: @event, status: :ok, message: \"Event was successfully updated.\" }\n render :json => data\n else\n \tdata = { data: @event.errors, status: :unprocessable_entity }\n render :json => data\n end\n end",
"def update\n @myevent = Myevent.find(params[:id])\n\n respond_to do |format|\n if @myevent.update_attributes(params[:myevent])\n format.html { redirect_to @myevent, notice: 'Myevent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myevent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event_event.update(event_event_params)\n format.html { redirect_to [:admin, @event_event], notice: 'Event was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @event_event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.js { render :refresh, status: :created, location: [@team, @event] }\n else\n format.js { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_path, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: events_path(@event) }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @event.update(event_params)\r\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @event.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to events_event_path(@event), notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @event.update(event_params)\n format.html { redirect_to admin_events_path, notice: 'El evento fue modificado' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.68292314",
"0.65027267",
"0.6403947",
"0.6382738",
"0.63632184",
"0.636033",
"0.63441545",
"0.6337041",
"0.6318268",
"0.6317005",
"0.631292",
"0.63085395",
"0.6307107",
"0.63040006",
"0.628511",
"0.62832874",
"0.62605256",
"0.62605256",
"0.6243118",
"0.6221383",
"0.6166579",
"0.61588365",
"0.6158019",
"0.6152523",
"0.614357",
"0.614168",
"0.61394113",
"0.6136617",
"0.61284065",
"0.6127556",
"0.6127556",
"0.6098614",
"0.6098614",
"0.6098614",
"0.60861397",
"0.608484",
"0.6083328",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.60786265",
"0.6075782",
"0.60747355",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60745424",
"0.60545576",
"0.60501426",
"0.60501426",
"0.60501426",
"0.60501426",
"0.60501426",
"0.60501426",
"0.60501426",
"0.60501426",
"0.6046247",
"0.6040168",
"0.60374063",
"0.60372555",
"0.6036481",
"0.60338414",
"0.60301113",
"0.6024273",
"0.60218364",
"0.6015666",
"0.6015508",
"0.6011101",
"0.6007583",
"0.6007583",
"0.6006591",
"0.5998142",
"0.59971005",
"0.59964186",
"0.59944016",
"0.59928286",
"0.59888446",
"0.59804904",
"0.5972836"
] |
0.69288176
|
0
|
DELETE /event_elements/1 DELETE /event_elements/1.json
|
def destroy
@event_element.destroy
respond_to do |format|
format.html { redirect_to event_elements_url, notice: 'Event element was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def delete_event\n if params[:id]\n @e = Evento.find(params[:id]).destroy\n end\n render :json => msj = { :status => true, :message => 'ok'}\n end",
"def destroy\n @event = Event.find(params[:id])\n @events = Event.where(event_id: params[:id])\n @events.each.destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def remove_one_event(event)\n client.execute(\n :api_method => calendar.events.delete,\n :parameters => {:calendarId => calendar_id, :eventId => event['id']})\n end",
"def destroy\n @event.destroy\n \n head :no_content\n end",
"def destroy\n @eventtype.events.each do |e|\n e.destroy\n end\n @eventtype.destroy\n respond_to do |format|\n format.html { redirect_to eventtypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n\n head :no_content\n end",
"def destroy\n @event.destroy\n\n head :no_content\n end",
"def destroy\n @event.destroy\n\n head :no_content\n end",
"def destroy\n @event_event = Event::Event.find(params[:id])\n @event_event.destroy\n\n respond_to do |format|\n format.html { redirect_to event_events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n #@event.update_attribute(:deleted, true)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n \n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n head :no_content\n end",
"def delete_event(event)\n notifications = \"sendNotifications=#{event.send_notifications?}\"\n send_events_request(\"/#{event.id}?#{notifications}\", :delete)\n end",
"def destroy\r\n @event.destroy\r\n @item.image.destroy # remove image from s3\r\n @item.image.clear # queues attachment to be deleted\r\n respond_to do |format|\r\n format.html { redirect_to events_url }\r\n format.json { head :no_content }\r\n end\r\n flash[:success] = \"Event deleted.\"\r\n redirect_to events_url\r\n end",
"def destroy\n #@event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event.destroy\n\n sync_destroy @event\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @myevent = Myevent.find(params[:id])\n @myevent.destroy\n\n respond_to do |format|\n format.html { redirect_to myevents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.users.clear\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_events_path }\n format.json { head :no_content }\n end\n end",
"def delete_event(event)\n @connection.send(Addressable::URI.parse(events_url + \"/#{event.id}\"), :delete)\n end",
"def delete_event\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n event.update(status: 3)\r\n lt_update_event_status event, 'archived'\r\n render json: SuccessResponse.new(\r\n code: 200,\r\n message: 'Event Deleted.'\r\n ), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(\r\n code: 404,\r\n message: 'Event not found!'\r\n ), adapter: :json, status: :not_found\r\n end\r\n\r\n end",
"def destroy\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :ok }\n end\n end",
"def destroy_rest\n @page_usage_event = PageUsageEvent.find(params[:id])\n @page_usage_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(page_usage_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event_request = EventRequest.find(params[:id])\n @event_request.destroy\n\n respond_to do |format|\n format.html { redirect_to event_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @client = Client.find(@event.client_id)\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_to_client_path(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_event = ClientEvent.find(params[:id])\n @client_event.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_events_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n render :nothing => true, :status => 200, :content_type => 'text/plain'\n end",
"def destroy\n @event = EventPost.find(params[:id])\n @event.destroy\n track_activity @event\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end",
"def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url}\n format.json { head :no_content }\n end\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end",
"def destroy\n @event = Event.find(params[:id])\n @event.destroy\n end",
"def destroy\n @bom_event.destroy\n respond_to do |format|\n format.html { redirect_to bom_events_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.7053537",
"0.7040418",
"0.7040418",
"0.7040418",
"0.7039979",
"0.69784653",
"0.6945369",
"0.6918084",
"0.689456",
"0.68933415",
"0.68933415",
"0.68933415",
"0.6880953",
"0.68658686",
"0.6861537",
"0.6835604",
"0.6835494",
"0.6819734",
"0.6815949",
"0.68095356",
"0.6809278",
"0.68087333",
"0.6806906",
"0.6781207",
"0.6773935",
"0.6769413",
"0.6767189",
"0.6764808",
"0.6763613",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.67632693",
"0.6762613",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6762604",
"0.6751822",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6748826",
"0.6738355",
"0.67346793",
"0.6732329",
"0.6725537",
"0.6725101",
"0.6720969",
"0.671647",
"0.66942835",
"0.66942835",
"0.6684103"
] |
0.7162513
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_event_element
@event_element = EventElement.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 set_actions\n actions :all\n end",
"def define_action_helpers?; end",
"def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end",
"def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end",
"def setup_handler\n end",
"def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end",
"def before_actions(*logic)\n self.before_actions = logic\n end",
"def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end",
"def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def action; end",
"def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end",
"def workflow\n end",
"def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end",
"def before(action)\n invoke_callbacks *self.class.send(action).before\n end",
"def process_action(...)\n send_action(...)\n end",
"def before_dispatch(env); end",
"def setup\n # override and do something appropriate\n end",
"def after_actions(*logic)\n self.after_actions = logic\n end",
"def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end",
"def setup(_context)\n end",
"def setup(resources) ; end",
"def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end",
"def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end",
"def determine_valid_action\n\n end",
"def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end",
"def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end",
"def startcompany(action)\n @done = true\n action.setup\n end",
"def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end",
"def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end",
"def define_tasks\n define_weave_task\n connect_common_tasks\n end",
"def setup(&block)\n define_method(:setup, &block)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup\n transition_to(:setup)\n end",
"def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend",
"def action\n end",
"def 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 after_set_callback; end",
"def initialize(*args)\n super\n @action = :set\nend",
"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 around_hooks; end",
"def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end",
"def release_actions; end",
"def setup(easy)\n super\n easy.customrequest = @verb\n end",
"def save_action; end",
"def 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 setup(&blk)\n @setup_block = blk\n end",
"def default_action; end",
"def callback_phase\n super\n end",
"def advice\n end",
"def _handle_action_missing(*args); end",
"def call\n setup_context\n super\n end",
"def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend",
"def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end",
"def duas1(action)\n action.call\n action.call\nend"
] |
[
"0.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622",
"0.5309231",
"0.5296901",
"0.529641",
"0.5296097",
"0.5258364",
"0.5242683",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.5236372",
"0.52346426",
"0.52320486",
"0.5225926",
"0.52210605",
"0.52171826",
"0.52138335",
"0.5207914",
"0.52069265",
"0.5176269",
"0.5174653",
"0.51730466",
"0.51650184",
"0.5161409",
"0.5156175",
"0.5154185",
"0.5151096",
"0.5151089",
"0.51452935",
"0.5138662",
"0.51339483",
"0.5113475",
"0.51132",
"0.51132",
"0.5108031",
"0.51075375",
"0.5090693",
"0.50892115",
"0.5081523",
"0.5081454",
"0.5064919",
"0.50545585",
"0.50531805",
"0.50501585",
"0.50501585",
"0.50329936",
"0.5024674",
"0.50203156",
"0.50156844",
"0.50149846",
"0.50011337",
"0.4999346",
"0.49984375",
"0.4988749",
"0.4988749",
"0.49842322",
"0.49800175",
"0.4979922",
"0.49791628",
"0.49666047",
"0.49655434",
"0.49559638",
"0.49557537",
"0.49554902",
"0.4953974",
"0.49519545",
"0.49449277",
"0.49440357",
"0.49329734",
"0.49315402",
"0.49261367",
"0.4925912",
"0.4925598",
"0.4924306",
"0.49202663",
"0.49167567",
"0.49164373",
"0.4915191",
"0.49145022",
"0.49140996"
] |
0.0
|
-1
|
Never trust parameters from the scary internet, only allow the white list through.
|
def event_element_params
params.require(:event_element).permit(:starting_at, :due_date, :created_at, :updated_at, :name, :reminder)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def param_whitelist\n [:role, :title]\n end",
"def expected_permitted_parameter_names; end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end",
"def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end",
"def param_whitelist\n [:rating, :review]\n end",
"def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end",
"def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end",
"def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end",
"def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end",
"def valid_params_request?; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end",
"def allowed_params\n params.require(:allowed).permit(:email)\n end",
"def permitted_params\n []\n end",
"def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend",
"def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end",
"def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end",
"def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end",
"def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end",
"def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end",
"def safe_params\n params.require(:user).permit(:name)\n end",
"def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def check_params; true; end",
"def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end",
"def quote_params\n params.permit!\n end",
"def valid_params?; end",
"def paramunold_params\n params.require(:paramunold).permit!\n end",
"def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend",
"def filtered_parameters; end",
"def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end",
"def filtering_params\n params.permit(:email, :name)\n end",
"def check_params\n true\n end",
"def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end",
"def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend",
"def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend",
"def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end",
"def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end",
"def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end",
"def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end",
"def active_code_params\n params[:active_code].permit\n end",
"def filtering_params\n params.permit(:email)\n end",
"def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end",
"def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end",
"def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end",
"def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end",
"def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end",
"def list_params\n params.permit(:name)\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end",
"def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end",
"def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end",
"def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end",
"def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end",
"def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end",
"def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end",
"def url_whitelist; end",
"def admin_social_network_params\n params.require(:social_network).permit!\n end",
"def filter_params\n params.require(:filters).permit(:letters)\n end",
"def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end",
"def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end",
"def sensitive_params=(params)\n @sensitive_params = params\n end",
"def permit_request_params\n params.permit(:address)\n end",
"def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end",
"def secure_params\n params.require(:location).permit(:name)\n end",
"def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end",
"def question_params\n params.require(:survey_question).permit(question_whitelist)\n end",
"def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end",
"def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end",
"def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end",
"def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end",
"def url_params\n params[:url].permit(:full)\n end",
"def backend_user_params\n params.permit!\n end",
"def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend",
"def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end",
"def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end",
"def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end",
"def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end",
"def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end",
"def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end",
"def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end",
"def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end"
] |
[
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",
"0.62894756",
"0.6283177",
"0.6242471",
"0.62382483",
"0.6217549",
"0.6214457",
"0.6209053",
"0.6193042",
"0.6177802",
"0.6174604",
"0.61714715",
"0.6161512",
"0.6151757",
"0.6150663",
"0.61461",
"0.61213595",
"0.611406",
"0.6106206",
"0.6105114",
"0.6089039",
"0.6081015",
"0.6071004",
"0.60620916",
"0.6019971",
"0.601788",
"0.6011056",
"0.6010898",
"0.6005122",
"0.6005122",
"0.6001556",
"0.6001049",
"0.59943926",
"0.5992201",
"0.59909594",
"0.5990628",
"0.5980841",
"0.59669393",
"0.59589154",
"0.5958826",
"0.5957911",
"0.5957385",
"0.5953072",
"0.59526145",
"0.5943361",
"0.59386164",
"0.59375334",
"0.59375334",
"0.5933856",
"0.59292704",
"0.59254247",
"0.5924164",
"0.59167904",
"0.59088355",
"0.5907542",
"0.59064597",
"0.5906243",
"0.5898226",
"0.589687",
"0.5896091",
"0.5894501",
"0.5894289",
"0.5891739",
"0.58860534",
"0.5882406",
"0.587974",
"0.58738774",
"0.5869024",
"0.58679986",
"0.5867561",
"0.5865932",
"0.5864461",
"0.58639693",
"0.58617616",
"0.5861436",
"0.5860451",
"0.58602303",
"0.5854586",
"0.58537364",
"0.5850427",
"0.5850199"
] |
0.0
|
-1
|
TODO read /etc/services and support default numeric port match? allow addr to be regexp, glob, or literal
|
def _escape (addr)
addr =~ /\\./ ? addr
: addr =~ /\.\*/ ? addr.gsub(/\*/, '\d+').gsub(/\./, '\.')
: Regexp.escape(addr)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def dns_get_srv(name)\n addr, port = '.', 0\n\n DNSRuby::DNS.open do |dns|\n srv = dns.getresource(name, DNSRuby::Types.SRV)\n addr, port = srv.target.to_s, srv.port\n end\n\n (addr == '.' || port == 0) ? [nil, nil] : [addr, port]\nend",
"def config_fgservice(servicename, lowport, highport, comment, category, type, proto)\n\n config = String.new\n\n#####################################\n# TCP and Destination Entry\n####################################\n if type == :dst && proto == :tcp\n\n fgservice = <<-EOS\n edit #{servicename}\n set tcp-portgrange #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n####################################\n# UDP and Destination Entry\n####################################\n if type == :dst && proto == :udp\n\n fgservice = <<-EOS\n edit #{servicename}\n set udp-portgrange #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# TCP and Source Entry\n####################################\n if type == :src && proto == :tcp\n\n fgservice = <<-EOS\n edit #{servicename}\n set tcp-portgrange 1 65535 #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# UDP and Source Entry\n####################################\n if type == :src && proto == :udp\n\n fgservice = <<-EOS\n edit #{servicename}\n set udp-portgrange 1 65535 #{lowport} #{highport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n###################################\n# ICMP Service Entry\n####################################\n if type == :icmp && proto == :icmp\n\n fgservice = <<-EOS\n edit #{servicename}\n set protocol ICMP\n set icmptype #{lowport}\n set category #{category}\n set comment \"#{comment}\"\n next\n EOS\n\n config += fgservice\n end\n\n return config\nend",
"def run_service(msg)\n if CMDS.include?(msg[1])\n # TODO work around FREEBSD: search service in /etc/rc.d/ then in /usr/local/etc/rc.d/\n run_cmd(\"/etc/init.d/#{msg[1]} #{msg[2]}\")\n else\n send_response \"Error: unknown command argument #{msg[1]}\"\n end\n end",
"def service name, proto = nil, **opts\n proto ||= opts.delete(:proto) || :unix\n case proto\n when :unix\n opts[:path] ||= choose_socket_filename(name, base: opts[:base])\n\n when :tcp\n opts[:connect_host] ||=\n case opts[:bind_host]\n when nil, \"0.0.0.0\", /\\A<any>\\z/i\n host_name\n when \"localhost\", \"127.0.0.1\"\n \"localhost\"\n end\n end\n\n service = Service.for(name, proto, **opts)\n rd, wr = IO.pipe\n fork do\n rd.close\n log.progname = name\n log.info \"starting\"\n\n svr = service.serve(max_tries: MAX_TRIES, log: log)\n yield svr if block_given?\n no_interrupt_if_interactive\n\n Marshal.dump service, wr\n wr.close\n sleep\n end\n\n wr.close\n services[name] = Marshal.load rd\n rd.close\n end",
"def check_xinetd_service(service)\n ret = false\n srv = Facter::Core::Execution.exec(\"chkconfig --list 2>/dev/null | grep #{service}\")\n if srv.empty?\n ret = false\n else\n srvs = srv.split(\"\\n\")\n srvs.each do |line|\n data = line.split(%r{:})\n if data[1].casecmp('off') != 0\n ret = true\n end\n end\n end\n\n ret\nend",
"def get_service_port_or_default(host_cert, service_name, port_key)\n config = PuppetX::Puppetlabs::Meep::Config.new(closure_scope)\n services = config.services_list\n\n primary = services['primary'] || {}\n service_list = primary[service_name] || []\n service_config = service_list.find { |e| e['certname'] == host_cert } || {}\n default = PuppetX::Puppetlabs::Meep::Defaults.parameters[port_key]\n service_config['port'] || default\n end",
"def default_ctl_listen\n socket_name = if service_name == 'supervisor'\n 'supervisor.sock'\n else\n \"supervisor-#{service_name}.sock\"\n end\n # File.join is largely symbolic, this can't run on Windows anyway.\n ::File.join('', 'tmp', socket_name)\n end",
"def set_port_cap file\n return unless [:ubuntu, :debian].include? DISTRO[0]\n sh \"sudo setcap cap_net_bind_service=+ep #{File.expand_path file}\"\nend",
"def serve_service\n raise 'Service was already started' unless stopped?\n\n # set flag to signal shutdown by stop / shutdown command\n @shutdown = false\n\n # instantiate the service for all @addresses (ip_address:port)\n @addresses.each do |address|\n # break address into ip_address and port and serve service\n ip_address = address.rpartition(':').first\n port = address.rpartition(':').last\n serve_service_on_ip_address_and_port(ip_address, port)\n end\n end",
"def findPort()\n # this is REALLY ugly\n port = @config['startPort']\n while true\n good = true\n #self.class.each { |v|\n # if (v.port == port)\n # good = false\n # break\n # end\n #}\n # Retrieve the list of all Daemons running\n if (@@inst[self.class] != nil)\n @@inst[self.class].each_value { |value|\n # For each Daemon, check its used port compared to our candidate one\n if (value.port == port)\n good = false\n break\n end\n }\n end\n if (good)\n begin\n info \"Checking port TCP:#{port}...\"\n serv = TCPServer.new(port)\n rescue\n good = false\n info \"Port TCP:#{port} is in use!\"\n else\n serv.close\n info \"Port TCP:#{port} is free!\"\n begin\n info \"Checking port UDP:#{port}...\"\n serv = UDPSocket.new\n\t serv.bind(nil,port)\n rescue\n good = false\n info \"Port UDP:#{port} is in use!\"\n else\n serv.close\n info \"Port UDP:#{port} is free!\"\n\t end\n end\n end\n return port if (good)\n # The candidate port is already used, increase it and loop again...\n port += 1\n end\n end",
"def link(options={})\n next_ip = (options[:first_ip] || 2).to_i\n next_port = (options[:first_port] || 3000).to_i\n @service_nodes.map do |service_node|\n service = Service.new\n service.service_node = service_node\n service.name = service_node.service_definition.name\n service.box = @service_box_names[service_node]\n service.ip_address = ip_address(next_ip, options)\n begin\n next_ip += 1\n end while ip_address(next_ip, options) == host_ip(options)\n service.forwarded_ports = { 80 => next_port }.merge(ports_for(service_node))\n next_port += 1\n service.root = service_node.service_definition.service_root\n service.vm_root = options[:vm_root] || '/mnt/app/current'\n service\n end\n end",
"def services\n if dockerized?\n puts \"Running inside of a docker container\"\n puts \"No systemd support, skipping service activation\"\n return\n end\n\n # portusctl runs as root and creates this file for the 1st time, so\n # we must fix its permissions\n FileUtils.chown_R(\"root\", \"www\", \"/srv/Portus/log/production.log\")\n FileUtils.chmod_R(0o664, \"/srv/Portus/log/production.log\")\n\n services = [\n [\"portus_crono\", false],\n [\"apache2\", true]\n ]\n services << [\"mysql\", false] if database_local?\n services << [\"registry\", true] if @options[\"local-registry\"]\n services.each do |service|\n Runner.activate_service(service[0], service[1])\n end\n end",
"def list_of_services(name=nil)\n file = File.read('config/ms_ports.json')\n data_hash = JSON.parse(file)\n if name\n return data_hash[name]\n else\n return data_hash\n end\n\n end",
"def check_services(first_file)\n if first_file.start_with?('service:')\n service = first_file.sub(/service:/, '')\n SERVICES.each do |k,v|\n if k == service\n @files = v\n end\n end\n end\n end",
"def address_bound?(ip, port)\n out, err, rc = shellCmd(\"/usr/sbin/lsof -i @#{ip}:#{port}\")\n return rc != 0\n end",
"def service_address(name)\n @services.fetch(name) do \n raise ArgumentError,\"no address for service #{name.inspect}\"\n end\n end",
"def run_host(ip)\n begin\n\n epm = dcerpc_endpoint_list()\n if(not epm)\n print_status(\"Could not contact the endpoint mapper on #{ip}\")\n return\n end\n\n eports = {}\n\n epm.each do |ep|\n next if !(ep[:port] and ep[:prot] and ep[:prot] == \"tcp\")\n eports[ep[:port]] ||= {}\n eports[ep[:port]][ep[:uuid]+'_'+ep[:vers]] = true\n end\n\n eports.each_pair do |eport, servs|\n\n rport = eport\n print_status(\"Looking for services on #{ip}:#{rport}...\")\n\n ids = dcerpc_mgmt_inq_if_ids(rport)\n next if not ids\n\n ids.each do |id|\n if (not servs.has_key?(id[0]+'_'+id[1]))\n print_status(\"\\tHIDDEN: UUID #{id[0]} v#{id[1]}\")\n\n conn = nil\n bind = nil\n call = nil\n data = nil\n error = nil\n begin\n connect(true, { 'RPORT' => eport })\n conn = true\n\n handle = dcerpc_handle(id[0], id[1], 'ncacn_ip_tcp', [eport])\n dcerpc_bind(handle)\n bind = true\n\n res = dcerpc.call(0, NDR.long(0) * 128)\n call = true\n\n if (dcerpc.last_response != nil and dcerpc.last_response.stub_data != nil)\n data = dcerpc.last_response.stub_data\n end\n\n rescue ::Interrupt\n raise $!\n rescue ::Exception => e\n error = e.to_s\n end\n\n if (error and error =~ /DCERPC FAULT/ and error !~ /nca_s_fault_access_denied/)\n call = true\n end\n\n status = \"\\t\\t\"\n status << \"CONN \" if conn\n status << \"BIND \" if bind\n status << \"CALL \" if call\n status << \"DATA=#{data.unpack(\"H*\")[0]} \" if data\n status << \"ERROR=#{error} \" if error\n\n print_status(status)\n print_status(\"\")\n\n ## Add Report\n report_note(\n :host => ip,\n :proto => 'tcp',\n :port => datastore['RPORT'],\n :type => \"DCERPC HIDDEN: UUID #{id[0]} v#{id[1]}\",\n :data => status\n )\n\n end\n end\n end\n\n rescue ::Interrupt\n raise $!\n rescue ::Exception => e\n print_status(\"Error: #{e}\")\n end\n end",
"def process_service_config\n @unbound_config = UnboundConfig.new(options[:service])\n end",
"def find_service(service)\n @configs[service]\n end",
"def locate(service_name = nil)\n if service_name\n dir = File.join(services_dir, service_name)\n else\n dir = Dir.pwd\n end\n file = service_file_in_dir(dir)\n ServiceFileParser.parse(file, dir)\n end",
"def set_service_port(service, port)\n if @@ports.keys.include?(service.upcase)\n @@ports[\"#{service.upcase}\"] = port.to_i\n else\n print_error(\"#{service.upcase} Service NOT Recognized!\")\n print_error(\"NO Changes made to port settings....\")\n return false\n end\n end",
"def service_addresses!(service, index = nil)\n meta = {}\n resp = _service.get(service, :all, {index: index, wait: '2s'}, meta)\n\n if (nindex = meta[:index]) != index\n addresses = resp.map do |address|\n {\n id: address.ServiceID,\n ip: address.ServiceAddress,\n node: address.Node,\n port: address.ServicePort\n }\n end\n\n [addresses, nindex]\n end\n end",
"def read_facts_services_enabled(services, os = '', release = '')\n services_enabled = {}\n\n services.each do |srv|\n srv_name = \"srv_#{srv}\"\n services_enabled[srv_name] = check_service_is_enabled(srv, os, release)\n end\n\n rsh = check_service_is_enabled('rsh.socket', os, release)\n rlogin = check_service_is_enabled('rlogin.socket', os, release)\n rexec = check_service_is_enabled('recex.socket', os, release)\n\n services_enabled['srv_rsh'] = if (rsh == 'enbaled') || (rlogin == 'enabled') || (rexec == 'enabled')\n 'enabled'\n else\n 'disabled'\n end\n\n nfs = check_service_is_enabled('nfs', os, release)\n nfsserver = check_service_is_enabled('nfs-server', os, release)\n rpcbind = check_service_is_enabled('rpcbind', os, release)\n\n services_enabled['srv_nfs'] = if (nfs != 'disabled') || (nfsserver != 'disabled') || (rpcbind != 'disabled')\n 'enabled'\n else\n 'disabled'\n end\n\n services_enabled\nend",
"def address_bound?(ip, port)\n _, _, rc = Utils.oo_spawn(\"/usr/sbin/lsof -i @#{ip}:#{port}\")\n rc == 0\n end",
"def addresses_ip_command(service_arg=service, options={})\n mac=self.mac\n\n # Aug 24 17:34:41 juno arpwatch: new station 10.247.4.137 52:54:00:88:5a:0a eth0.4\n # Aug 24 17:37:19 juno arpwatch: changed ethernet address 10.247.4.137 52:54:00:27:33:00 (52:54:00:88:5a:0a) eth0.4\n # Check if another ip_command string was provided\n ip_command_global=service_arg.ip_command.nil? ? 'grep $mac /var/log/arpwatch.log|sed -e \"s/new station//\"|sed -e \"s/changed ethernet address//g\" |sed -e \"s/reused old ethernet //\" |tail -1 |cut -d \":\" -f 4-| cut -d \" \" -f 3' : service_arg.ip_command\n ip_command_local=options[:ip_command].nil? ? ip_command_global : options[:ip_command]\n\n ip_command=\"mac=#{mac}; server_name=#{name.gsub(DOMAIN_CLEANUP_REGEXP, '_')}; \"+ip_command_local\n\n ip_address=nil\n\n if service_arg.uri.ssh_enabled?\n ip_address=ssh_ip_command(ip_command, service_arg.uri)\n else\n # It's not ssh enabled, so we assume it is\n if service_arg.uri.transport==\"tls\"\n raise Fog::Errors::Error.new(\"TlS remote transport is not currently supported, only ssh\")\n end\n ip_address=local_ip_command(ip_command)\n end\n\n # The Ip-address command has been run either local or remote now\n\n if ip_address==\"\"\n #The grep didn't find an ip address result\"\n ip_address=nil\n else\n # To be sure that the command didn't return another random string\n # We check if the result is an actual ip-address\n # otherwise we return nil\n unless ip_address=~/^(\\d{1,3}\\.){3}\\d{1,3}$/\n raise Fog::Errors::Error.new(\n \"The result of #{ip_command} does not have valid ip-address format\\n\"+\n \"Result was: #{ip_address}\\n\"\n )\n end\n end\n\n return { :public => [ip_address], :private => [ip_address]}\n end",
"def optional_port; end",
"def configHost\n unless File.open('nagios.cfg').read() =~ /hosts.cfg/ && File.open('nagios.cfg').read() =~ /services.cfg/\n\tcfg = File.read('nagios.cfg')\n\tcfg = cfg.gsub(/templates.cfg/, \"templates.cfg\\ncfg_file=/usr/local/nagios/etc/hosts.cfg\\ncfg_file=/usr/local/nagios/etc/services.cfg\")\n\tFile.open('nagios.cfg', 'w') { |file| file.puts cfg }\n end\n File.open('hosts.cfg', 'a+') { |file|\n\tfile.puts \"define host{\\nname\\t\\t\\tlinux-box\\nuse\\t\\t\\tgeneric-host\\ncheck_period\\t\\t24x7\\ncheck_interval\\t\\t5\\nretry_interval\\t\\t1\\nmax_check_attempts\\t10\\ncheck_command\\t\\tcheck-host-alive\\nnotification_period\\t24x7\\nnotification_interval\\t30\\nnotification_options\\td,r\\ncontact_groups\\t\\tadmins\\nregister\\t\\t\\t0\\n}\\n\" unless File.open('hosts.cfg').read() =~ /name\\t\\t\\tlinux-box/\n\t@names.length.times do |x|\n\t file.puts \"define host{\\nuse\\t\\t\\tlinux-box\\nhost_name\\t\\t#{@names[x]}\\nalias\\t\\t\\t#{@names[x]}\\naddress\\t\\t\\t#{@ips[x]}\\n}\\n\\n\"\n\tend\n }\n File.open('services.cfg', 'a') { |file| \n @names.length.times do |x|\n file.puts \"define service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCPU Load\\n\\tcheck_command\\t\\tcheck_nrpe!check_load\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tTotal Processes\\n\\tcheck_command\\t\\tcheck_nrpe!check_total_procs\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tCurrent Users\\n\\tcheck_command\\t\\tcheck_nrpe!check_users\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tSSH\\n\\tcheck_command\\t\\tcheck_ssh\\n}\\n\\ndefine service{\\n\\tuse\\t\\t\\tgeneric-service\\n\\thost_name\\t\\t#{@names[x]}\\n\\tservice_description\\tPING\\n\\tcheck_command\\t\\tcheck_ping!100.0,20%!500.0,60%\\n}\\n\\n\" \n end\n }\n end",
"def load_from_file(filename)\n d = XML::Document.file(filename)\n if (not File.exists?(SERVICE_DTD_PATH))\n $stderr.puts \"Could not find service DTD at #{SERVICE_DTD_PATH}\"\n exit(1)\n end\n dtd = File.open(SERVICE_DTD_PATH, \"r\") { |f|\n lines = f.readlines().join(\"\")\n }\n validator = XML::Dtd.new(dtd)\n @valid = d.validate(validator)\n if (not @valid)\n $stderr.puts \"Service file #{filename} failed validation\"\n exit(1)\n end\n sg = d.root\n sg.children.each { |c|\n case c.name\n when \"name\"\n @name = c.content\n if ((not c[\"replace-wildcards\"].nil?) and (c[\"replace-wildcards\"] == \"yes\"))\n @replace_wildcards = true\n end\n when \"service\"\n node = c\n params = {}\n node.children.each { |c|\n case c.name\n when \"type\"\n params[:type] = c.content\n when \"subtype\"\n params[:subtype] = c.content\n when \"host-name\"\n params[:hostname] = c.content\n when \"port\"\n params[:port] = c.content.to_i\n when \"txt-record\"\n params[:txt] = c.content\n when \"domain-name\"\n params[:domainname] = c.content\n end\n }\n @services.push(AvahiService.new(self.name, params))\n end\n }\n end",
"def parsed_host\n sockets = new_resource.host.split if new_resource.host.is_a?(String)\n sockets = new_resource.host if new_resource.host.is_a?(Array)\n r = []\n sockets.each do |s|\n if s.match(/^unix:/) || s.match(/^tcp:/) || s.match(/^fd:/)\n r << s\n else\n Chef::Log.info(\"WARNING: docker_service host property #{s} not valid\")\n end\n end\n r\n end",
"def read_facts_xinetd_services(srvs, type = 'std')\n xinetd_services = {}\n\n srvs.each do |srv|\n srv_name = \"srv_#{srv}\"\n xinetd_services[srv_name] = check_xinetd_service(srv, type)\n end\n\n xinetd_services\nend",
"def parse_addr(string)\n # Split host and port number from string.\n case string\n when /\\A\\[(?<address> .* )\\]:(?<port> \\d+ )\\z/x # string like \"[::1]:80\"\n address, port = $~[:address], $~[:port]\n when /\\A(?<address> [^:]+ ):(?<port> \\d+ )\\z/x # string like \"127.0.0.1:80\"\n address, port = $~[:address], $~[:port]\n else # string with no port number\n address, port = string, nil\n end\n\n # Pass address, port to Addrinfo.getaddrinfo. It will raise SocketError if address or port is not valid.\n # IPAddr currently cannot handle ::1 notation, use Addrinfo instead\n ary = Addrinfo.getaddrinfo(address, port)\n\n # An IP address is exactly one address.\n ary.size == 1 or raise SocketError, \"expected 1 address, found #{ary.size}\"\n ary.first\nend",
"def analyze_ports(scan_results, host)\n scan_results.elements.each(\"/nmaprun/host/ports/port[state/@state='open']\") do |port|\n # get service name\n service_name = REXML::XPath.match(\n REXML::Document.new(port.to_s),\n \"/port[state/@state='open']/service/@name\"\n )[0].to_s\n\n # get port number\n port_number = Integer(REXML::XPath.match(\n REXML::Document.new(port.to_s),\n '/port/@portid'\n )[0].to_s)\n\n # check services\n if service_name.eql?('http') || service_name.eql?('http-proxy')\n if (port_number == 5985) && host.os.include?('Windows')\n # then this is most likely not http but winrm\n host.services.append NetworkService.new(host.ip, port_number, 'WinRM')\n unless host.os.eql?('Windows') || host.os.eql?('Linux')\n # this is probably windows but was not recognized due to filtered ports\n host.os = 'Windows'\n end\n end\n host.services.append NetworkService.new(host.ip, port_number, 'http')\n elsif service_name.eql? 'https'\n host.services.append NetworkService.new(host.ip, port_number, 'https')\n elsif service_name.eql? 'ftp'\n host.services.append NetworkService.new(host.ip, port_number, 'ftp')\n elsif service_name.eql? 'ldap'\n # get domain name\n extra_info = REXML::XPath.match(\n REXML::Document.new(port.to_s),\n \"/port[state/@state='open']/service/@extrainfo\"\n )[0].to_s\n begin\n domain_name = extra_info.split('Domain: ').last.split(',').first\n host.services.append LdapService.new(host.ip, port_number, 'ldap', domain_name)\n rescue StandardError\n # domain could not be parsed\n host.services.append LdapService.new(host.ip, port_number, 'ldap')\n end\n elsif service_name.eql?('microsoft-ds') || service_name.eql?('netbios-ssn')\n host.services.append NetworkService.new(host.ip, port_number, 'smb')\n else\n # not for a scanner\n host.services.append NetworkService.new(host.ip, port_number, service_name)\n end\n end\n end",
"def nameserver_config\n return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC']\n\n address, port = ENV['MM_DNSRC'].split(/:/)\n\n {\n nameserver_port: [[address, port.to_i]]\n }\n rescue StandardError\n {}\n end",
"def lookup_server_uri\n server_lookup_attempts.times do\n first_alive_listing = service_directory.all_listings_for(service).find do |listing|\n host_alive?(listing.try(:address))\n end\n\n if first_alive_listing\n host = first_alive_listing.try(:address)\n port = first_alive_listing.try(:port)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n host = options[:host]\n port = options[:port]\n\n if host_alive?(host)\n @stats.server = [port, host]\n return \"tcp://#{host}:#{port}\"\n end\n\n sleep(1.0 / 100.0)\n end\n\n fail \"Host not found for service #{service}\"\n end",
"def host_with_port; end",
"def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\nrescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\nend",
"def with_service(node, service)\n mapping = CONF['service_mappings']\n if mapping and mapping[service]\n mapping[service].include?(name(node))\n end\nend",
"def addresses(service_arg=service, options={})\n addresses_method = self.method(:addresses_dhcp)\n # check if ruby-libvirt was compiled against a new enough version\n # that can use dhcp_leases, as otherwise it will not provide the\n # method dhcp_leases on any of the network objects.\n has_dhcp_leases = true\n begin\n service.networks.first.dhcp_leases(self.mac)\n rescue NoMethodError\n has_dhcp_leases = false\n rescue\n # assume some other odd exception.\n end\n\n # if ruby-libvirt not compiled with support, or remote library is\n # too old (must be newer than 1.2.8), then use old fallback\n if not has_dhcp_leases or service.libversion() < 1002008\n addresses_method = self.method(:addresses_ip_command)\n end\n\n # replace current definition for this instance with correct one for\n # detected libvirt to perform check once for connection\n (class << self; self; end).class_eval do\n define_method(:addresses, addresses_method)\n end\n addresses(service_arg, options)\n end",
"def procfile_entry(service, profile, port = nil)\n name = service.name\n\n port = nil unless profile == 'server'\n\n [\n \"#{[name, profile].join('_')}:\",\n server_name_map[profile.to_sym],\n name,\n service_path(service),\n port\n ].compact.join ' '\n end",
"def get_ai_publisherport(options)\n message = \"Information:\\tDetermining publisher port for service \"+options['service']\n command = \"svcprop -a pkg/server |grep 'port count'\"\n in_use = execute_command(options,message,command)\n return in_use\nend",
"def check_sol_bind(options)\n if options['host-os-name'].to_s.match(/11/)\n pkg_name = \"service/network/dns/bind\"\n install_sol11_pkg(options,pkg_name)\n end\n create_named_conf(options)\n return\nend",
"def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend",
"def raw_host_with_port; end",
"def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend",
"def parse_vcap_services(element, instance)\n properties = Utils.parse_compliant_vcap_service(element, instance)\n @service_name = properties['service_name']\n # extract the db_name, host, port, user and password from the properties. Since we are using cloud variables for substitution into server.xml,\n # this means we're actually using the keys in the props, not the values. We could use the values for direct substitution.\n conn_prefix = \"cloud.services.#{@service_name}.connection.\"\n\n # uri is the only property portable between Pivotal, BlueMix, and Heroku\n conn_uri = properties[\"#{conn_prefix}uri\"]\n if conn_uri.nil?\n raise \"Resource #{@service_name} does not contain a #{conn_prefix}uri property\"\n end\n uri = URI.parse(conn_uri)\n\n @db_name = get_cloud_property(properties, element, \"#{conn_prefix}name\", uri.path[1..-1])\n @host = get_cloud_property(properties, element, \"#{conn_prefix}host\", uri.host)\n @port = get_cloud_property(properties, element, \"#{conn_prefix}port\", uri.port)\n @user = get_cloud_property(properties, element, \"#{conn_prefix}user\", uri.user)\n @password = get_cloud_property(properties, element, \"#{conn_prefix}password\", uri.password)\n\n # ensure all the cloud properties are always set\n get_cloud_property(properties, element, \"#{conn_prefix}hostname\", uri.host)\n get_cloud_property(properties, element, \"#{conn_prefix}username\", uri.user)\n\n # default JNDI name for DB is jdbc/service_name\n @jndi_name = \"jdbc/#{@service_name}\"\n # create standard configuration ids.\n @datasource_id = \"#{@config_type}-#{@service_name}\"\n @connection_manager_id = \"#{@config_type}-#{@service_name}-conMgr\"\n @properties_id = \"#{@config_type}-#{@service_name}-props\"\n @jdbc_driver_id = \"#{@config_type}-driver\"\n @lib_id = \"#{@config_type}-library\"\n @fileset_id = \"#{@config_type}-fileset\"\n end",
"def url_2_port (url)\n\t\tputs \"Retrieve service port on URL: #{url}\" if @verbose\n\t\tbegin\n\t\t\tssl = (url =~ /https/i)\n\t\t\turl = url.downcase.gsub(/(http:\\/\\/|https:\\/\\/)/, \"\")\n\t\t\trecord1 = url.split('/')\n\t\t\trecord2 = record1[0].split(':')\t\n\t\t\tif (record2.length == 2) \n\t\t\t\tputs \"The service port: #{record2[1]}\" if @verbose\n\t\t\t\treturn record2[1].to_i\n\t\t\telsif ssl\n\t\t\t\tputs \"The service port: 443\" if @verbose\n\t\t\t\treturn 443\n\t\t\telse\n\t\t\t\tputs \"The service port: 80\" if @verbose\n\t\t\t\treturn 80\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend",
"def verify_service_and_port_exist!(service_name, port_name)\n service = services[service_name]\n port = service[:ports][port_name] if service\n\n unless port\n raise ArgumentError, \"Unknown service #{service_name.inspect} or port #{port_name.inspect}.\\n\" \\\n \"Here is a list of known services and port:\\n\" + services.inspect\n end\n end",
"def check_osx_service_is_enabled(options,service)\n plist_file = \"/Library/LaunchDaemons/\"+service+\".plist\"\n if not File.exist?(plist_file)\n plist_file = \"/System\"+plist_file\n end\n if not File.exist?(plist_file)\n handle_output(options,\"Warning:\\tLaunch Agent not found for #{service}\")\n quit(options)\n end\n tmp_file = \"/tmp/tmp.plist\"\n message = \"Information:\\tChecking service \"+service+\" is enabled\"\n if service.match(/dhcp/)\n command = \"cat #{plist_file} | grep Disabled |grep true\"\n else\n command = \"cat #{plist_file} | grep -C1 Disabled |grep true\"\n end\n output = execute_command(options,message,command)\n if not output.match(/true/)\n if options['verbose'] == true\n handle_output(options,\"Information:\\t#{service} enabled\")\n end\n else\n backup_file(options,plist_file)\n copy = []\n check = false\n file_info = IO.readlines(plist_file)\n file_info.each do |line|\n if line.match(/Disabled/)\n check = true\n end\n if line.match(/Label/)\n check = false\n end\n if check == true and line.match(/true/)\n copy.push(line.gsub(/true/,\"false\"))\n else\n copy.push(line)\n end\n end\n File.open(tmp_file,\"w\") {|file| file.puts copy}\n message = \"Information:\\tEnabling \"+service\n command = \"cp #{tmp_file} #{plist_file} ; rm #{tmp_file}\"\n execute_command(options,message,command)\n message = \"Information:\\tLoading \"+service+\" profile\"\n command = \"launchctl load -w #{plist_file}\"\n execute_command(options,message,command)\n end\n return\nend",
"def init_drb_service(port)\n begin\n service_url = \"%s:%s\" % ['127.0.0.1', port]\n $LOG.debug \"Loading remote service at druby://#{service_url}\"\n DRb.install_acl(ACL.new(%w(deny all allow 127.0.0.1)))\n DRb.start_service(\"druby://#{service_url}\", self)\n rescue => e\n $LOG.error \"#{e.message}: #{e.backtrace.first}\"\n exit # TODO: Create alert and inform user about drb error\n end\n end",
"def drb_service(port)\n require \"drb/drb\"\n\n # Make sure we have a listener running\n unless @drb_listener_running\n begin\n DRb.start_service(\"druby://127.0.0.1:0\")\n rescue SocketError, Errno::EADDRNOTAVAIL\n DRb.start_service(\"druby://:0\")\n end\n\n @drb_listener_running = true\n end\n\n @drb_services ||= {}\n @drb_services[port.to_i] ||= DRbObject.new_with_uri(\"druby://127.0.0.1:#{port}\")\n end",
"def port; config[:port]; end",
"def dot_service( shortname )\n shortname + \".service\"\n end",
"def add_host\n entry_line = \"#{ipaddress?} www.example.com test.example.com\"\n\n if open('/etc/hosts') { |f| f.grep(/^#{entry_line}$/).empty? }\n open('/etc/hosts', 'a') { |p| p.puts \"\\n#{entry_line}\" }\n end\n\n if open('/etc/hosts') { |f| f.grep(/^#{entry_line}$/).empty? }\n false\n else\n true\n end\nend",
"def create_service(resource, actions)\n service_name = get_service_name()\n\n case resource.service_type\n when \"upstart\"\n service service_name do\n provider Chef::Provider::Service::Upstart\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n when \"init.d\"\n service service_name do\n supports :status => true, :restart => true, :reload => true\n action actions\n end\n else\n raise \"dashing: Unknown service_type '#{resource.service_type}'\"\n end\nend",
"def service_info(name)\n\tservice = {}\n\tservicekey = \"HKLM\\\\SYSTEM\\\\CurrentControlSet\\\\Services\\\\#{name.chomp}\"\n\tservice[\"Name\"] = registry_getvaldata(servicekey,\"DisplayName\").to_s\n\tsrvstart = registry_getvaldata(servicekey,\"Start\").to_i\n\tif srvstart == 2\n\t\tservice[\"Startup\"] = \"Auto\"\n\telsif srvstart == 3\n\t\tservice[\"Startup\"] = \"Manual\"\n\telsif srvstart == 4\n\t\tservice[\"Startup\"] = \"Disabled\"\n\tend\n\tservice[\"Command\"] = registry_getvaldata(servicekey,\"ImagePath\").to_s\n\tservice[\"Creentials\"] = registry_getvaldata(servicekey,\"ObjectName\").to_s\n\treturn service\nend",
"def host_port_map\n Dir[Ros.deployments_dir].each_with_object([]) do |file, ary|\n name = File.basename(file).gsub('.yml', '')\n Ros.load_env(name)\n infra_type = Settings.meta.components.provider.split('/').last\n if infra_type.eql? 'instance'\n ary.append({ host: Settings.infra.endpoint.host, port: Settings.platform.nginx_host_port })\n end\n end\n end",
"def actual_port; end",
"def actual_port; end",
"def service_addresses(service, index = nil)\n loop do\n addresses, nindex = service_addresses!(service, index)\n return [addresses, nindex] if addresses && nindex\n end\n end",
"def port_dir(port)\n case port\n\n # When the package name starts with a '/' treat it as the full path to the ports directory.\n when %r{^\\/}\n port\n\n # Otherwise if the package name contains a '/' not at the start (like 'www/wordpress') treat\n # as a relative path from /usr/ports.\n when %r{\\/}\n \"/usr/ports/#{port}\"\n\n # Otherwise look up the path to the ports directory using 'whereis'\n else\n whereis = shell_out!(\"whereis -s #{port}\", env: nil)\n path = whereis.stdout[/^#{Regexp.escape(port)}:\\s+(.+)$/, 1]\n raise Chef::Exceptions::Package, \"Could not find port with the name #{port}\" unless path\n path\n end\nend",
"def local_ip_address\n conf['base_address'] ||\n %x{ip addr show #{conf['base_interface'] || 'br0'} | grep inet}.split(' ')[1].to_s.strip.split('/').first.to_s\nend",
"def service_types\n { \n \"renderer\" => {\"start\" => \"ls\", \"stop\" => \"ls\"},\n \"smscd\" => {\"start\" => \"sudo /etc/init.d/smscd start\", \"stop\" => \"sudo /etc/init.d/smscd stop\", \"options\" => \"tunnel\"},\n \"ussd\" => {\"start\" => \"ls\", \"stop\" => \"ls\"}\n }\n end",
"def services_list\n available_services.map do |service|\n formula = {\n name: service.formula.name,\n status: :stopped,\n user: nil,\n file: nil,\n }\n\n if service.service_file_present?(for: :root) && service.pid?\n formula[:user] = \"root\"\n formula[:file] = System.boot_path + service.service_file.basename\n elsif service.service_file_present?(for: :user) && service.pid?\n formula[:user] = System.user_of_process(service.pid)\n formula[:file] = System.user_path + service.service_file.basename\n elsif service.loaded?\n formula[:user] = System.user\n formula[:file] = service.service_file\n end\n\n # If we have a file or a user defined, check if the service is running or errored.\n if formula[:user] && formula[:file]\n formula[:status] =\n Service::ServicesCli.service_get_operational_status(service)\n end\n\n formula\n end\n end",
"def refresh_osx_service(service_name)\n if not service_name.match(/\\./)\n if service_name.match(/dhcp/)\n service_name = \"homebrew.mxcl.isc-\"+service_name\n else\n service_name= \"com.apple.\"+service_name+\"d\"\n end\n end\n disable_osx_service(service_name)\n enable_osx_service(service_name)\n return\nend",
"def services_for(node)\n # This info is taken from our JSON inventory file\n [JSON.parse(File.read(\"#{repository_path}/hosts.json\"))[\"#{node}.hpc_tutorial.org\"]]\n end",
"def start(host, port); end",
"def default_httpd_port\n if monit_version && UNIXSOCKET_VERSION.satisfied_by?(monit_version)\n monit_name_path('/var/run/%{name}.sock')\n else\n 2812\n end\n end",
"def initialize(services=[], ipv4addr='', available = true, ttl = 60)\n @services = services\n @ipv4addr = ipv4addr\n @available = available\n @ttl = ttl\n end",
"def configure_instance(node, i)\n node.vm.hostname = fqdn(i)\n network_ports node, i\nend",
"def infra_services_map\n {\n web: 'haproxy -- ./router.conf',\n yard: 'yard server --gems'\n }\n end",
"def listen_addresses\n node['network']['interfaces'].map do |iface, data| \n data[\"addresses\"].select { |addr, data| data[\"family\"] == \"inet\" }.keys[0]\n end\nend",
"def set_service_ids\n service_ids = FP::Vars.services_on_this_instance.join(',')\n Facter.add(:service_ids) { setcode { service_ids} }\nend",
"def read_env_address_and_port\n @sensu_address = ENV['SENSU_SOCKET_ADDRESS'] \\\n if ENV.key?('SENSU_SOCKET_ADDRESS')\n @sensu_port = ENV['SENSU_SOCKET_PORT'].to_i \\\n if ENV.key?('SENSU_SOCKET_PORT')\n end",
"def service name, operation, role\n run \"#{sudo} /etc/init.d/#{name} #{operation}\", :role => role\nend",
"def port\n @hash[\"Listen\"].to_i\n end",
"def [](key)\n\n if SERVICE_PREFIX.match(key)\n @services[key]\n else\n conf[key]\n end\n end",
"def net_services\n svc = []\n# svc = cluster_configurations.map{ |cc| cc.net_service(self.node_type.node_type) }\n clusters.each do |cc| \n cc.services.each {|s|\n svc << [s.ha_ip_address , s.ha_port ,\n s.ha_proto, s.localport,\n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n }\n svc << [nil, nil,'icmp', nil, \n \"#{net_type}#{cc.vlan}\" # local interface\n ]\n end\n #puts \"DEBUG:#{hostname}: #{svc.inspect}\" if is_load_balancer? \n if is_server? then \n svc2 = []\n svc.each { |s| \n svc2 << [\"\",\"\",s[2],s[3], mangle(s[4])]\n svc2 << [\"\",\"\",s[2],s[3], s[4]]\n }\n #puts \"DEBUG:#{hostname}: #{svc2.inspect}\" if is_load_balancer? \n svc.concat(svc2)\n end\n # will be wrong for virutal with SANs\n san = san_nics.map { |nic| [nil, nil, 'tcp', 22, nic.port_name] }\n svc.concat(san)\n if node_type.is_loadbalancer?\n ha_svc = ClusterConfiguration.find_all_ha_net_services\n svc.concat(ha_svc)\n # For Testing only - Delete after Feb 28, 2009 or come up with\n # something better\n test_vlans = Cluster.find(:all, :conditions => [\"vlan <= 102 and vlan > 8\"]).map{|c| c.vlan }\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'tcp',22, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n testing_svc = test_vlans.map{|vlan|\n [nil,nil,'icmp',nil, \"vlan#{vlan}\"]\n }.uniq\n svc.concat(testing_svc)\n end\n # Icmp for application vlans\n if node_type.is_virtual?\n icmp = nics.map { |nic| \n [nil,nil,'icmp',nil, nic.port_name] if nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(icmp)\n nginx = nics.map { |nic| \n [nil,nil,'tcp', 80, nic.port_name] if nic.lan? and nic.port_name =~ /eth\\d+/ \n }.compact\n svc.concat(nginx)\n end\n if hostname == 'uk01' then\n svc << [nil,nil,'tcp',11301,'eth4000']\n end\n rules = svc.map{|a| a.join(':') }\n if mgmt_ip_address then\n rules.concat( mgmt_ip_address.network.net_service(net_type) )\n end\n rules.map{|a| %Q(\\t\"#{a}\") }.sort.uniq.join(\"\\n\")\n end",
"def pids_on_ports(first=3000, count=4)\n last = first + count - 1\n `lsof -Fp -i tcp:#{first}-#{last}`.split(\"\\n\").map { |el| el[1,el.length].to_i }\nend",
"def register(service,configFileName)\n # We now derive the service Class from the string 'service'\n # 'service' is the service name given by the calling run() method\n # This new design allows us to avoid calling 'register' from the service .rb file\n #\n # name = service.serviceName\n # path = \"/#{name}\"\n # @@registeredServices[path] = service\n # service.mount(@@server, path)\n serviceClass = Class::class_eval(\"#{service}\")\n name = serviceClass.serviceName\n path = \"/#{name}\"\n @@registeredServices[path] = serviceClass\n serviceClass.mount(@@server, path)\n\n # configFile = \"#{findServiceDir}/#{name}.yaml\"\n configFile = \"#{findServiceDir}/#{configFileName}\"\n MObject.debug(:register, \"Loading service config file '#{configFile}'\")\n if (File.readable?(configFile))\n #params = YAML::load(File.open(configFile))\n params = YAML::parse(File.open(configFile)).transform\n\n if (cfg = params[name]).nil?\n raise \"Missing configuration for service '#{name}'\"\n end\n # service.configure(params[name])\n serviceClass.configure(cfg)\n else\n MObject.error(\"Service config file '#{configFile}' is not readable\")\n end\nend",
"def server_port(id = '__default__')\n @servers[id].port\n end",
"def resolve_filename (filename, port)\n s = TCPSocket.open('localhost', port)\n s.puts(\"RESOLVE:\\n\")\n s.puts(filename)\n s.puts(\"\\n\")\n r = s.gets\n values = r.split(\":\")\n server = values[0]\n file = values[1].strip\n s.close\n return server, file\nend",
"def process_nix(r,ns_opt)\n\t\tr.each_line do |l|\n\t\t\tdata = l.scan(/(\\S*) has address (\\S*)$/)\n\t\t\tif not data.empty?\n\t\t\t\tdata.each do |e|\n\t\t\t\t\tprint_good(\"#{ns_opt} #{e[1]}\")\n\t\t\t\t\treport_host(:host=>e[1], :name=>ns_opt.strip)\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend",
"def service_options(resource)\n super\n resource.ruby_command(\"unicorn --port #{new_resource.port} #{configru_path}\")\n end",
"def create_service_objects\n\n # initialize vars\n svcconfig = String.new\n svcconfig = \"#### Service Objects ####\\n\"\n svcconfig += \"config firewall service custom\"\n service_tracker = Set.new # create a set for tracking if service already has been created to avoid duplicates\n category = $opts[:servicecategory]\n filterused = nil\n\n # Open external files with data for mapping protocol port numbers\n ip = File.open 'reference/ip_protocol_nums.txt', 'r'\n tcpudp = File.open 'reference/tcp-udp_ports.txt', 'r'\n icmp = File.open 'reference/icmp_type_codes.txt', 'r'\n icmpmsg = File.open 'reference/icmp_msg_codes.txt', 'r'\n\n # Initialize hashes for stroing the protocol/port number information from files\n h_ip = Hash.new\n h_tcpudp = Hash.new\n h_icmp = Hash.new\n h_icmp_msg = Hash.new\n\n # import the ip protocol number info from file to h_ip hash\n ip.each_line do |x|\n num, name = x.split\n h_ip[num] = name\n end\n\n # reverse the keys and values\n h_ip = h_ip.invert\n\n # import the tcp/dump port number info from file to h_tcpudp hash\n tcpudp.each_line do |x|\n num, name = x.split\n h_tcpudp[num] = name\n end\n\n # reverse the keys and values\n h_tcpudp = h_tcpudp.invert\n\n # import the icmp type code detail from file to the h_icmp hash\n icmp.each_line do |x|\n num, name = x.split\n h_icmp[num] = name\n end\n\n # import the icmp msg code detail from file to the h_icmp_msg hash\n icmpmsg.each_line do |x|\n num, name = x.split\n h_icmp_msg[num] = name\n end\n\n # close the protocol info files\n ip.close\n tcpudp.close\n icmp.close\n icmpmsg.close\n\n # Create a new service category in the local fg config file to assign all created services to\n svcconfig = <<-EOS\nconfig firewall service category\n edit #{category}\nend\n\nEOS\n\n # Merge ipv4 and ipv6 filters to hash \"filters\" to process both ipv4 and ipv6 in this request\n filters = $h_filters.merge($h_filters6)\n\n # Process service objects for all ipv4 filters first\n filters.each_key do |filtername|\n filterused = check_if_filter_used(filtername)\n\n unless filterused\n p \"policy_service_objects: filter not used by an interface, skipping: #{filtername}\" if $opts[:verbose]\n next\n end\n\n\n filters[filtername].each_key do |termname|\n filters[filtername][termname][:source].each do |sourcename, sourcetype|\n\n # Use sourcetype to identify service definitions then modify those as needed to\n # convert for use in FG config\n case sourcetype.to_s # we will be matching against strings and output to string so need to chg from symbol\n when *%w[destination-port source-port port]\n\n # Matching anything that is all digits or digits with a single dash\n # the just digits indicates a single port number while with a dash is a range.\n # anything that does not match these will be processed in subsequent case\n # as we'll need to map those from words \"http, ftp, etc\" to port numbers\n if /^(\\d+)$/ =~ sourcename || /^(\\d+[-]\\d+)$/ =~ sourcename\n\n ### Some entries contain a range of ports. In these cases\n ### we need to split the low and high ports for assignment\n lowport, highport = ''\n lowport, highport = sourcename.to_s.split('-')\n\n highport = lowport unless highport\n\n ### Check to see if the associated term defines tcp, udp or icmp\n ### if it defines none of these then we will create objects for\n ### both tcp and udp. It defines just icmp, we won't worry about the\n ### tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n # create a tcp destination object if term contains protocol tcp and if\n # it's not type source-port and if we haven't already created this object\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n\n # Map named protocol term definitions to ports (aka http, ftp, snmp)\n else\n # Get port matching sourcename from h_tcpudp service/port mapping array\n port, lowport, highport = nil\n\n port = h_tcpudp[sourcename.to_s]\n # if port is nil then no match was found, print out some info and move to next record\n if port == nil\n p \"Couldn't find a protocol match in file: Sourcename: #{sourcename} --> Port: #{port}\"\\\n if $opts[:verbose]\n\n next\n end\n\n lowport, highport = port.split('-')\n highport = lowport unless highport\n\n # Check to see if the associated term defines tcp, udp or icmp\n # if it defines none of these then we will create objects for\n # both tcp and udp. It defines just icmp, we won't worry about the\n # tcp/udp objects and will process icmp under a different case\n tcp, udp, icmp = nil\n if filters[filtername][termname][:source].has_key?(:tcp)\n tcp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:udp)\n udp = true\n end\n\n if filters[filtername][termname][:source].has_key?(:icmp)\n icmp = true\n end\n unless tcp && udp && icmp\n tcp = true\n udp = true\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype != :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp\", lowport, highport, \"from term: #{termname}\",\\\n category, :dst, :udp)\n\n service_tracker.add(\"#{sourcename}-udp\")\n end\n\n if (tcp && !service_tracker.include?(\"#{sourcename}-tcp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-tcp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :tcp)\n\n service_tracker.add(\"#{sourcename}-tcp_source\")\n end\n\n if (udp && !service_tracker.include?(\"#{sourcename}-udp\") && sourcetype == :'source-port')\n svcconfig += config_fgservice(\"#{sourcename}-udp_source\", lowport, highport, \"from term: #{termname}\",\\\n category, :src, :udp)\n\n service_tracker.add(\"#{sourcename}-udp_source\")\n end\n end\n\n\n### Process ICMP protocol types\n\n when *%w[icmp-type icmp-type-except]\n port = String.new\n\n if /^(\\d+)$/ =~ sourcename\n port = sourcename\n else\n port = h_icmp[sourcename.to_s]\n end\n\n if port and !service_tracker.include?(port)\n svcconfig += config_fgservice(\"ICMP-#{sourcename}\", port, port, \"from term: #{termname}\",\\\n category, :icmp, :icmp)\n\n service_tracker.add(\"ICMP-#{sourcename}\")\n\n elsif !port\n p \"create_fgpolicy_service_objects: service icmp-type not found port = #{port} sourcename = #{sourcename}\"\\\n if $opts[:verbose] || $opts[:debug]\n next\n end\n end\n end\n end\n end\n if $opts[:debug]\n p \"service tracker\"\n service_tracker.each do |x|\n p x\n end\n end\n\n # Return the resulting config to main execution\n svcconfig += \"end\\n\\n\"\nend",
"def services\n (YAML.load_file( @options[:path] )||[]) rescue []\n end",
"def service_resource\n find_resource(:systemd_unit, \"#{new_resource.name}.service\") do\n content(\n 'Unit' => {\n 'Description' => \"MongoDB #{new_resource.name} service\",\n 'After' => 'network.target',\n 'Documentation' => 'https://docs.mongodb.org/manual'\n },\n 'Service' => {\n 'User' => new_resource.user,\n 'Group' => new_resource.group,\n 'ExecStart' => \"#{new_resource.daemon_path} --config #{new_resource.config_path}\",\n 'RestartSec' => '3s',\n 'Restart' => 'always',\n 'LimitFSIZE' => 'infinity',\n 'LimitCPU' => 'infinity',\n 'LimitAS' => 'infinity',\n 'LimitNOFILE' => 64000,\n 'LimitNPROC' => 16000\n },\n 'Install' => {\n 'WantedBy' => 'multi-user.target'\n }\n )\n\n triggers_reload true\n\n action :nothing\n end\n end",
"def complete_service?\n unless supports_incomplete_services?\n raise Puppet::Error, _(\"Cannot query if the %{service} service is complete: The concept of complete/incomplete services was introduced in Solaris 11.1. You are on a Solaris %{release} machine.\") % { service: @resource[:name], release: Puppet.runtime[:facter].value(:operatingsystemrelease) }\n end\n\n return @complete_service if @complete_service\n\n # We need to use the service's FMRI when querying its config. because\n # general/complete is an instance-specific property.\n fmri = service_fmri\n\n # Check if the general/complete property is defined. If it is undefined,\n # then svccfg will not print anything to the console.\n property_defn = svccfg(\"-s\", fmri, \"listprop\", \"general/complete\").chomp\n @complete_service = ! property_defn.empty?\n end",
"def conf_example(port = 8080)\n <<~EOS\n listen: #{port}\n hosts:\n \"127.0.0.1.xip.io:#{port}\":\n paths:\n /:\n file.dir: #{var}/h2o/\n EOS\n end",
"def addresses_dhcp(service_arg=service, options={})\n mac=self.mac\n\n ip_address = nil\n nic = self.nics.find {|nic| nic.mac==mac}\n if !nic.nil?\n net = service.networks.all(:name => nic.network).first\n if !net.nil?\n leases = net.dhcp_leases(mac, 0)\n # Assume the lease expiring last is the current IP address\n ip_address = leases.sort_by { |lse| lse[\"expirytime\"] }.last[\"ipaddr\"] if !leases.empty?\n end\n end\n\n return { :public => [ip_address], :private => [ip_address] }\n end",
"def parse_service_yaml service_yaml_text\n return nil unless service_yaml_text && !service_yaml_text.empty?\n service_yaml = YAML.safe_load service_yaml_text\n service = Google::Api::Service.new\n\n if service_yaml.key? CONFIG_VERSION_KEY\n config_ver = Google::Protobuf::UInt32Value.new\n config_ver.value = service_yaml[CONFIG_VERSION_KEY]\n service.config_version = config_ver\n end\n\n service.name = service_yaml[NAME_KEY] if service_yaml.key? NAME_KEY\n service.id = service_yaml[ID_KEY] if service_yaml.key? ID_KEY\n service.title = service_yaml[TITLE_KEY] if service_yaml.key? TITLE_KEY\n\n service.apis = parse_apis service_yaml[APIS_KEY] if service_yaml.key? APIS_KEY\n service.http = parse_http service_yaml[HTTP_KEY] if service_yaml.key? HTTP_KEY\n service\n end",
"def parse_old\n\thost_tracker=Wmap::HostTracker.instance\n\t@services=Hash.new\n\tf_site=File.open(ARGV[0],'r')\n\tf_site.each do |line|\n\t\tsite=line.chomp.strip\n\t\tsite=host_tracker.url_2_site(site)\n\t\tabort \"Error on processing site: #{site}\" if site.nil?\n\t\thost=host_tracker.url_2_host(site)\n\t\tabort \"Error on processing host: #{host}\" if host.nil?\n\t\tip=host_tracker.local_host_2_ip(host)\n\t\tip=host_tracker.host_2_ip(host) if ip.nil?\n\t\tnext if ip.nil?\n\t\tnext unless host_tracker.is_ip?(ip)\n\t\tport=host_tracker.url_2_port(site)\n\t\tkey=ip+\":\"\n\t\tkey+=port.to_s\n\t\t@services[key]=true unless @services.key?(key)\n\tend\n\tf_site.close\n\thost_tracker=nil\nend",
"def service_enable_variable_name\n @service_enable_variable_name ||=\n if init_command\n ::File.open(init_command) do |rcscript|\n rcscript.each_line do |line|\n if line =~ /^name=\"?(\\w+)\"?/\n return $1 + \"_enable\"\n end\n end\n end\n # some scripts support multiple instances through symlinks such as openvpn.\n # We should get the service name from rcvar.\n logger.trace(\"name=\\\"service\\\" not found at #{init_command}. falling back to rcvar\")\n shell_out!(\"#{init_command} rcvar\").stdout[/(\\w+_enable)=/, 1]\n else\n # for why-run mode when the rcd_script is not there yet\n new_resource.service_name\n end\n end",
"def address\n @address ||= \"#{@options[:host]}:#{@options[:port]}\"\n end",
"def open_port(host, port, tab_port)\n sock = Socket.new(:INET, :STREAM)\n raw = Socket.sockaddr_in(port, host)\n # puts \"#{port} open.\" if sock.connect(raw)\n if sock.connect(raw)\n # Check if port is known in the hash\n if H_ports.any? {|h| h[\"port\"] == port.to_s}\n tab_port.push(H_ports.select{|port_number, service| port_number[\"port\"] == port.to_s })\n else\n tab_port.push([{\"port\" => port.to_s, \"service\" => \"random service\"}])\n end\n end\n\n rescue (Errno::ECONNREFUSED)\n rescue(Errno::ETIMEDOUT)\n end",
"def servlist(mask = nil, type = nil)\n raw \"SERVLIST #{mask} #{type}\".strip << \"\\r\\n\"\n end",
"def serve_service_on_ip_address_and_port(ip_address, port)\n # log information\n logger.info(\"Starting service on #{ip_address}:#{port}\")\n # check that there is a specific ip_address defined\n raise 'Unable to start TCP listener on missing or empty ip_address!' if ip_address.empty?\n # instantiate the service for ip_address and port\n tcp_server = TCPServer.new(ip_address, port)\n # append this server to the list of TCPServers\n @tcp_servers << tcp_server\n\n # run thread until shutdown\n @tcp_server_threads << Thread.new do\n begin\n # always check for shutdown request\n until shutdown?\n # get new client and start additional thread\n # to handle client process\n client = tcp_server.accept\n Thread.new(client) do |io|\n # add to list of connections\n @connections << Thread.current\n # handle connection\n begin\n # initialize a session storage hash\n Thread.current[:session] = {}\n # process smtp service on io socket\n io = serve_client(Thread.current[:session], io)\n # save returned io value due to maybe\n # established ssl io socket\n rescue SmtpdStopConnectionException\n # ignore this exception due to service shutdown\n rescue StandardError => e\n # log fatal error while handling connection\n on_logging_event(nil, Logger::FATAL, \"#{e} (#{e.class})\".strip, err: e.clone)\n ensure\n begin\n # always gracefully shutdown connection.\n # if the io object was overriden by the\n # result from serve_client() due to ssl\n # io, the ssl + io socket will be closed\n io.close\n rescue StandardError\n # ignore any exception from here\n end\n # remove closed session from connections\n @connections_mutex.synchronize do\n # drop this thread from connections\n @connections.delete(Thread.current)\n # drop this thread from processings\n @processings.delete(Thread.current)\n # signal mutex for next waiting thread\n @connections_cv.signal\n end\n end\n end\n end\n rescue SmtpdStopServiceException\n # ignore this exception due to service shutdown\n rescue StandardError => e\n # log fatal error while starting new thread\n on_logging_event(nil, Logger::FATAL, \"#{e} (#{e.class})\".strip, err: e.clone)\n ensure\n begin\n # drop the service\n tcp_server.close\n # remove from list\n @tcp_servers.delete(tcp_server)\n # reset local var\n tcp_server = nil\n rescue StandardError\n # ignore any error from here\n end\n if shutdown?\n # wait for finishing opened connections\n @connections_mutex.synchronize do\n @connections_cv.wait(@connections_mutex) until @connections.empty?\n end\n else\n # drop any open session immediately\n @connections.each { |c| c.raise SmtpdStopConnectionException }\n end\n # remove this thread from list\n @tcp_server_threads.delete(Thread.current)\n end\n end\n end",
"def socket_port; end",
"def loadservices\n yml = YAML::load(File.open('services.yml'))\n yml.each do |el| \n puts \"grabbing info for #{el[1]['name']}\"\n yml = infoFor(el[1]['regex'])\n logyml(el[1]['name'], yml)\n\n puts \"sending info for #{el[1]['name']}\"\n sendreport(el[1]['name'])\n end\n end",
"def daemon_port_prefix(env)\n case env.to_s.downcase\n when \"development\" then 74\n when \"test\" then 75\n end\nend",
"def parse_udp_port(config)\n value = config.scan(/(?<=vxlan udp-port )\\d+/)\n { udp_port: value.first.to_i }\n end",
"def bind_listen(address = '0.0.0.0:8080', opt = {})\n return address unless String === address\n\n sock = if address[0] == ?/\n if File.exist?(address)\n if File.socket?(address)\n begin\n UNIXSocket.new(address).close\n # fall through, try to bind(2) and fail with EADDRINUSE\n # (or succeed from a small race condition we can't sanely avoid).\n rescue Errno::ECONNREFUSED\n logger.info \"unlinking existing socket=#{address}\"\n File.unlink(address)\n end\n else\n raise ArgumentError,\n \"socket=#{address} specified but it is not a socket!\"\n end\n end\n old_umask = File.umask(opt[:umask] || 0)\n begin\n Kgio::UNIXServer.new(address)\n ensure\n File.umask(old_umask)\n end\n elsif /\\A\\[([a-fA-F0-9:]+)\\]:(\\d+)\\z/ =~ address\n new_tcp_server($1, $2.to_i, opt.merge(:ipv6=>true))\n elsif /\\A(\\d+\\.\\d+\\.\\d+\\.\\d+):(\\d+)\\z/ =~ address\n new_tcp_server($1, $2.to_i, opt)\n else\n raise ArgumentError, \"Don't know how to bind: #{address}\"\n end\n set_server_sockopt(sock, opt)\n sock\n end"
] |
[
"0.5956091",
"0.5928387",
"0.5927588",
"0.58764595",
"0.5846239",
"0.57991546",
"0.57599294",
"0.5747656",
"0.5745353",
"0.5733637",
"0.5729986",
"0.57153106",
"0.5619922",
"0.5574001",
"0.54904646",
"0.5474945",
"0.54748076",
"0.54709685",
"0.54575247",
"0.5447638",
"0.5442575",
"0.54390943",
"0.54267806",
"0.5418629",
"0.54091495",
"0.5403736",
"0.5365708",
"0.5359348",
"0.53524715",
"0.5347697",
"0.5327307",
"0.53045017",
"0.52859044",
"0.528074",
"0.52793986",
"0.5258143",
"0.524572",
"0.5238947",
"0.52258176",
"0.5213247",
"0.5212879",
"0.52107036",
"0.52078575",
"0.52058667",
"0.5185503",
"0.5169248",
"0.51617664",
"0.5156258",
"0.5144265",
"0.51283216",
"0.5116668",
"0.5103606",
"0.50971055",
"0.5096324",
"0.5092165",
"0.5090407",
"0.5086676",
"0.5086676",
"0.5076885",
"0.50757307",
"0.507495",
"0.5068907",
"0.50660306",
"0.50654",
"0.5060415",
"0.50603735",
"0.5049882",
"0.5047127",
"0.5047101",
"0.5046256",
"0.5044537",
"0.50413865",
"0.503667",
"0.50361985",
"0.50352335",
"0.5029035",
"0.50290173",
"0.5016875",
"0.50058943",
"0.50036615",
"0.49990788",
"0.4998482",
"0.4980207",
"0.49752778",
"0.49716425",
"0.49699172",
"0.49681833",
"0.49563685",
"0.49549034",
"0.4954103",
"0.4953143",
"0.4946722",
"0.49427202",
"0.4939469",
"0.49388736",
"0.49376982",
"0.49363253",
"0.49312532",
"0.4931217",
"0.4930472",
"0.4928911"
] |
0.0
|
-1
|
change the ed.paid_by on line 72 to reflect profile_id of friend
|
def you_are_owed
detailed_expenses = self.expenses.includes(:expense_details)
amount = 0
more_details = Hash.new {|h,k| h[k] = k }
detailed_expenses.each do |ex|
id = Friend.includes(:profile).find(ex.payable_id)
friend_id = self.id != id.profile_id ? id.profile_id : id.friend_id
ex.expense_details.each do |ed|
if ed.paid_by == self.id
amount += (ed.amount_paid / 2.0)
more_details[friend_id] ||= {}
more_details[friend_id] += ed.amount_paid / 2.0
end
end
end
[amount, more_details]
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def associate_payment_profile\n order = Spree::Order.where(\"email = ?\", @user.email).order(\"created_at\").last\n if order.try(:payments).present?\n payment_source = order.payments.last.source\n payment_source.update_attributes(user_id: @user.id)\n end\n end",
"def update\n $lovedone = nil\n @family_member = User.find(params[:id])\n params = family_member_params\n profile_params = params[:profile_attributes]\n\n profile = Profile.find(@family_member.profile.id)\n params[:profile_attributes][:user_type] = '1'\n\n respond_to do |format|\n if profile.update(profile_params)\n\n # check if lovedone_id is changed now...\n if request.params[:prev_lovedone_id]!=family_member_params_for_lovedone[:lovedones]\n follower = Follower.find_by(user_id: @family_member.id,\n lovedone_id: request.params[:prev_lovedone_id])\n follower.destroy unless follower.nil?\n\n unless family_member_params_for_lovedone[:lovedones].blank?\n follower = Follower.new user_id: @family_member.id, request_status: \"invited\", \n lovedone_id: family_member_params_for_lovedone[:lovedones]\n follower.save\n end\n end\n\n if params.include?(:email)\n @family_member.skip_confirmation!\n @family_member.skip_confirmation_notification!\n @family_member.confirm!\n @family_member.update_attribute(:email, params[:email])\n @family_member.save\n end\n\n\n\n format.html { redirect_to familymembers_path, notice: 'Family member was successfully updated.' }\n format.json { render :show, status: :ok, location: @family_member }\n else\n format.html { render :edit }\n format.json { render json: @family_member.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @user = current_user\n @meetup = Meetup.find_by(id: params[:id])\n if (@meetup.primary != @user) then\n @meetup.friend = @meetup.primary\n @meetup.primary = @user\n end\n @meetup.save\n end",
"def edit_profile\n \t@user = current_user\n end",
"def confirm!\n # add if else here in case user already existed and is updating/changing data (email etc),\n # shouldn't add_profile again if profile already exists. can determine with a user db 'nil' value...\n unless self.profile\n add_profile\n end\n super\n end",
"def edit\n @profile = @author.profile\n end",
"def profile_edit\n @user = User.find(current_user.id)\n end",
"def edit\n @user.profile ||= Profile.new\n @profile = @user.profile\n end",
"def atest_ID_25845_edit_profile_edit_profile_details\n # Need clarification\n end",
"def set_profile\n @user = current_user\n @profile = @user.profile\n end",
"def set_profile\n @profile = current_user\n end",
"def owned_by (profile)\n self.by_profile_id(profile.id)\n end",
"def user_profile_edit\n\n\n end",
"def edit\n @user = User.find(params[:user_id])\n @profile = @user.profile\n \n end",
"def edit\n user = User.find(params[:user_id])\n @profile = user.profile\n end",
"def edit\n @user = current_user\n @profile = current_user.profile\n end",
"def set_current_user_profile\n @profile = custom_find do\n current_v1_user.profiles.find(params[:profile_id])\n end\n end",
"def edit_profile\n end",
"def update_profile!(caller_id, access = {})\n json = Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/#{caller_id}/user/{{client_id}}/profile\"\n request[:request_body] = to_hash\n end.execute!\n\n json[:user_guid]\n end",
"def mark_paid(user)\n event_user = event_user(user)\n event_user.paid_at = Time.now\n event_user.save\n end",
"def handle_payment_profile_id(id)\n case id\n when PaymentProfile\n set_fields(:customer_payment_profile_id => id.customer_payment_profile_id.to_s)\n when nil\n nil\n else\n set_fields(:customer_payment_profile_id => id.to_s)\n end\n end",
"def set_profile\n @profile = Profile.where(user_id: current_user).first\n end",
"def set_social_profile\n @full_profile = SocialProfile.find(params[:id])\n end",
"def update\n\t @friendable = Friendable.where(from_id: current_user, to_id: params[:id]).first\n\t @friendable.update(approved: true)\n\t if @friendable.save\n\t redirect_to root_url, :notice => \"Successfully confirmed friend!\"\n\t else\n\t redirect_to root_url, :notice => \"Sorry! Could not confirm friend!\"\n\t end\n\t end",
"def edit\n @user = User.find (params[:user_id])\n @profile = @user.profile\n end",
"def set_profile\r\n @user = Account.find(params[:id])\r\n end",
"def edit\n\t\t@user = User.find( params[:user_id] )\n\t\t@profile = @user.profile\n\tend",
"def add_profile(post, profile)\n post[:profile] = profile\n post[:profileupdate] = 'Y'\n end",
"def update\n respond_to do |format|\n\n if performing_follow?\n #unfollow or follow depending on what in the database\n @profile.user.toggle_followed_by(current_user)\n\n\n\n elsif @profile.update(profile_params)\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n\n end",
"def set_profile\n @profile = current_owner.profile\n end",
"def update\n if @profile.update_attributes(profile_params)\n begin\n response_bank = Pagarme::CreateBankAccountService.new(profile: @profile).call\n rescue\n return redirect_to new_client_profile_path, notice: 'Houve um problema para salvar o perfil.'\n end\n if response_bank.id.present?\n @profile.reload.update(bank_id: response_bank.id)\n if @profile.recipient_id.blank?\n response_recipient = Pagarme::CreateRecipientService.new(profile: @profile).call\n else\n response_recipient = Pagarme::UpdateRecipientService.new(profile: @profile).call\n end\n if response_recipient.id.present?\n @profile.reload.update(recipient_id: response_recipient.id)\n return redirect_to edit_client_profile_path(@profile), notice: 'Perfil atualizado com sucesso.'\n end\n end\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n else\n redirect_to edit_client_profile_path(@profile), notice: 'Houve um problema para salvar o perfil.'\n end\n end",
"def edit\n\t\t#Find the Particular Profile\n\t\t@surgeon_profile = @profile\n\tend",
"def payee\n profile\n end",
"def set_profile\n @stakeholder = Stakeholder.find(params[:stakeholder_id])\n @profile = @stakeholder.profile\n end",
"def profile_update(profile,user)\n @profile=profile\n @user=user\n mail to: @user.email, subject: \"Profile updated (Socail Trip App)\", from:'test@example.com'\n end",
"def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end",
"def edit\n @profile = Profile.find(current_user.id)\n end",
"def set_profile\n @profile = if params[:id]\n Profile.find_by!(user_id: params[:id])\n else\n Profile.find_by(user: current_user)\n end\n end",
"def save_old_profile\n @_old_profile_id = profile_id_change ? profile_id_change.first : false\n true\n end",
"def set_profile\n @profile = current_user.profiles.find(params[:id])\n end",
"def update_friends\n if self.friends_last_updated_at.nil? || ((self.friends_last_updated_at + 1.day) < DateTime.now)\n self.friends = profile.friends(:fields => 'gender,name').map{|f| {\"label\" => f.name, \"value\" => f.identifier, \"gender\" => f.gender}}\n self.friends_last_updated_at = DateTime.now\n save(:validate => false)\n end\n end",
"def set_email_updates\n get_email = FollowerFollowing.where('follower_id=? and following_id=?', @login_user.id, params[:id]).first\n get_email.update_attributes(:get_email_updates => !get_email.get_email_updates)\n redirect_to \"/users/profile/#{params[:id]}\"\n end",
"def handle_profile_id(id)\n case id\n when CustomerProfile\n set_fields(:customer_profile_id => id.customer_profile_id.to_s)\n when nil\n nil\n else\n set_fields(:customer_profile_id => id.to_s)\n end\n end",
"def edit\n @owner = Owner.includes(:owner_profile).find(session[:user_id])\n @owner.build_owner_profile unless @owner.owner_profile\n end",
"def friending(a_user)\n # self.push_uniq(:attendees => a_user.id)\n friendship_ids << a_user.id\n save\n end",
"def update_profile(user)\n create_feed(user, {:title => 'Profile changed', :description => \"#{create_link(user)}'s changed his profile\"})\n end",
"def edit\n @user.build_user_profile unless @user.user_profile\n end",
"def build_the_profile\n\tself.build_profile\n\tself.profile.user_id = self.id\n end",
"def edit_profile\n \t@user = UsersService.findUserById(params[:id])\n \tuser = UsersService.findUserById(params[:id])\n \t@user_profile_form = UserProfileForm.new(UserProfileForm.attributes(user, :edit_profile))\n end",
"def set_profile\n @profile = @user.profile\n end",
"def profile\n if params[:id]\n # match the code and grant the session\n @subscription = @project.subscriptions.find_by_confirm_code( params[:id] )\n if ! @subscription\n flash.now[:error] = _(\"Unable to match confirmation code!\")\n else\n @subscription.confirm( params[:id] )\n session[:subscription_id] = @subscription.id\n redirect_to :action => 'profile', :id => nil\n return\n end\n end\n \n if session[:subscription_id]\n @subscription = Subscription.find( session[:subscription_id] ) if (! @subscription)\n if request.post?\n if @subscription.recipient.update_attributes( params[:recipient] )\n session[:subscription_id] = nil\n render_page 'PAGE_PROFILE_OK'\n return\n else\n @recipient = @subscription.recipient\n flash.now[:error] = _(\"Unable to save profile!\")\n end\n end\n \n render_page 'PAGE_PROFILE_FORM', :subscription => @subscription, :recipient => @subscription.recipient\n else\n if request.post?\n recipient = @project.recipients.find_by_email( params[:recipient][:email] )\n if (! recipient)\n flash.now[:error] = _('Unable to find email address in database!')\n else\n sub = @project.subscriptions.find_by_recipient_id( recipient.id )\n Notifier.deliver_message( 'EMAIL_PROFILE_CONFIRM', :subscription => sub )\n flash.now[:notice] = _('Request accepted, please check your mail!')\n end\n else\n recipient = Recipient.new(params[:recipient])\n end\n # show enter email form\n render_page 'PAGE_PROFILE_EMAIL', :recipient => recipient \n end\n end",
"def set_profile\n @profile = Profile.find_by_id(params[:id])\n @user = User.find_by_id(@profile.user_id)\n end",
"def set_user_profile\n @user_profile = current_user.user_profile\n end",
"def update\n @profile = Profile.find_by_user_id(current_user.id)\n\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Personal info saved sucessfuly\"\n else\n error_messages(@profile)\n end\n\n redirect_to edit_profile_path\n end",
"def confirm\n\t @profiles=@current_user.user_profile.update_attributes(params[:body])\n\tend",
"def update\n @profile = @user.profile\n @profile.update_attributes(params[:profile])\n if params[\"starting\"] == \"pending\"\n @profile.started_on = nil\n @profile.target_completion_date = nil\n end\n\n respond_to do |format|\n if @profile.save\n format.html { redirect_to user_profile_path, notice: 'Profile was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @profile = Profile.find(params[:id])\n \n #@profile.email = \n #puts \"ATRIBUTIIIIIIIIIIIIIi\"\n #for @enProfil in @profile.attribute_names\n # puts @enProfil\n #end\n #puts \"PARAMETRIIIIII\"\n \n #puts \"PROFILE = \" + @profile.to_s\n #puts \"USER = \" + @profile.user.to_s\n #@profile.update_attribute(:email, @profile.email)\n #@profile.update_attribute(:im, \"drekkkk\")\n #@profile.save\n #puts 'PRVI PARAMETER = '+ params[:IM]\n\t\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to(@profile) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n \n end",
"def update\n if current_user.user_profile\n @user_profile=UserProfile.find(params[:id])\n @user_profile.update_attributes(params[:user_profile])\n flash[:notice]= t(:edit_profile)\n else\n @user_profile = UserProfile.new(params[:user_profile])\n @user_profile.user_id = current_user.id if !current_user.is_admin?\n @user_profile.save\n flash[:notice]= t(:new_profile)\n end\n redirect_to(:action=>\"edit\") \n end",
"def update\n @friendship = Friendship.where(friend_id: current_user, user_id: params[:id]).first\n @friendship.update(approved: true)\n if @friendship.save\n redirect_to :back, :notice => \"Successfully confirmed friend!\"\n else\n redirect_to :back, :notice => \"Sorry! Could not confirm friend!\"\n end\n end",
"def update_profile_email\n user_profile.update_attribute(:email, email) if saved_change_to_email?\n end",
"def originalFriend \n self.token ? self : User.find_by_facebook_id(Network.find_by_friend_id(self['facebook_id'])['facebook_id'])\n end",
"def update\n @profile = current_user.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = \"Ваш профиль успешно обновлён\"\n format.html { redirect_to(profile_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # @profile = Profile.find(profile_params[:id])\n @user = current_user\n @profile = @user.profile\n # @user.profile = @profile\n # redirect_to(profile_path)\n\n # @user.update(user_params) #from the private method below - whitelist check\n\n \n\n respond_to do |format|\n if @profile.update(profile_params)\n\n format.html { redirect_to @profile, notice: 'Profile was successfully updated.' }\n format.json { render :show, status: :ok, location: @profile }\n else\n format.html { render :edit }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_profile\n\t\t@profile = current_user.profile\n\tend",
"def set_profile\n @profile = Profile.includes(user: {reviewee: {reviewer: [:profile]}}).find(params[:id])\n end",
"def set_profile\n @profile = User.friendly.find(params[:user_id]).profile\n end",
"def update_profile_info\n info = provider_class.profile_info\n self.update_attributes(info)\n end",
"def update_paid\n self.check_paid\n # Use update_columns to skip more callbacks\n self.update_columns(paid: self.paid, paid_amount: self.paid_amount)\n end",
"def edit\n @title = \"Edit Profile\"\n @user = current_user\n @user.profile ||= Profile.new\n @profile = @user.profile\n if param_posted?(:profile)\n if @user.profile.update_attributes(params[:profile])\n flash[:notice] = \"Changes saved.\"\n # redirect_to :controller => \"profile\", :action => \"index\"\n end\n end\n end",
"def save_or_create_profile\n if profile.present?\n profile.actor_id = id\n profile.save!\n else\n create_profile\n end\n end",
"def update\n @profile = self.current_member.profile\n\n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n flash[:notice] = 'Profile was successfully updated.'\n format.html { redirect_to [self.current_member, @profile] }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @profile.errors.to_xml }\n end\n end\n end",
"def set_profile\n @partnership = current_user_profile.partnerships.find(params[:partnership_id])\n @profile = Profile.find(@partnership.partner_id)\n end",
"def set_profil\n @profil = User.find(params[:id])\n end",
"def update\n\t\t@user = current_user\n\t\t@profile = @user.profile\n\t\t@profile.update_columns(profile_params)\n\t\trespond_with @profile \n\tend",
"def edit\n @profile = User.find(params[:id])\n end",
"def profile\n @profile = current_user\n end",
"def set_ProfileID(value)\n set_input(\"ProfileID\", value)\n end",
"def set_profile_invite\r\n @profile_invite = Profile::Invite.find(params[:id])\r\n end",
"def confirm_friend(user)\n friendship = inverse_friendships.find { |friendship| friendship.user == user }\n friendship.confirmed = true\n friendship.save\n end",
"def set_profile\n @profile = Profile.friendly.find(params[:id])\n if !(@profile \n (session[:type_user]==\"SimpleUser\" and current_user.profile.family.id==@profile.family.id ) or \n (session[:type_user]==\"Miembro\" and @profile.family and current_user.profile.member.comunity.id==@profile.family.comunity.id) or\n (session[:type_user]==\"Administrador\"))\n redirect_to(root_path,alert: \"Lo sentimos, no tiene permisos para acceder a esta seccion\") \n end\n end",
"def profile_friend_params\n\t\t\tparams.require(:friendship).permit(:friend_b_id)\n\t\tend",
"def set_profile\n u_id = params[:user_id]\n @profile = Profile.where(user_id: u_id)\n end",
"def update\n #@profile = UsersDisciplines.find(params[:id])\n @profile = Profile.find_by_user_id(current_user.id)\n \n respond_to do |format|\n if @profile.update_attributes(params[:profile])\n format.html { redirect_to users_profile_index_path, notice: t(:profile_successfully_updated) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @profile.errors, status: :unprocessable_entity }\n end\n end\n end",
"def find_profile_announcement(id)\n\t\tprofile_announcements.detect{|a| a.id == id} || payment_profile_announcements.detect{|a| a.id == id}\n\tend",
"def update\n\n if param_user[:email_work] != user.login\n param_user[:login] = param_user[:email_work]\n end\n @selected_profiles = param_user[:profile_ids]\n\n respond_to do |format|\n if user.update_attributes(param_user)\n @message = \"#{@user.full_name} has been modified.\"\n\t Resque.enqueue(Finforenet::Jobs::CheckPublicProfiles, @user.id) if @user.is_public\n if !request.xhr?\n format.html { redirect_to users_path({:page=>params[:page]}), :notice => @message }\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr?}\n end\n else\n format.html { render :action => \"edit\", :layout=> !request.xhr? }\n end\n end\n end",
"def edit_identity\n if request.post?\n #OPTIMIZE: presently, one database save per field. Take it all in one go.\n begin\n [ :feed_real_name,\n :feed_aliases,\n :feed_preferred_calling_name,\n :profile_status_message,\n :feed_description,\n :feed_gender,\n :feed_birth_time_pref,\n :feed_email,\n :feed_show_email,\n :feed_country_living_code\n ].each { |e|\n @profile_user[e] = params[e]\n }\n rescue ActiveRecord::RecordInvalid => e\n flash.now[:notice] = e.message\n return\n end\n\n @profile_user[:feed_birth_time] = DateTime.new(params[:feed_birth_time]['(1i)'].to_i,\n params[:feed_birth_time]['(2i)'].to_i, params[:feed_birth_time]['(3i)'].to_i)\n #better method exists?\n #{}.index or {}.rassoc(Ruby 1.9), but we need a case insenstive search!\n #Create new method city_list_downcased and use like this?\n #<tt>city_list_downcased.index params[:feed_city].downcase</tt>\n @profile_user[:feed_city_has_code] = \"no\"\n city_list.each { |k,v| #60,000 rounds in worst case!!\n if v.to_s.downcase == params[:feed_city].downcase\n @profile_user[:feed_city] = k.to_s #From symbol\n @profile_user[:feed_city_has_code] = \"yes\"\n break\n end\n }\n @profile_user[:feed_city] = params[:feed_city] if @profile_user[:feed_city_has_code] == \"no\"\n flash[:highlight] = \"Profile updated!\" if flash[:notice].blank?\n redirect_to @kopal_route.home\n end\n end",
"def edit_profile\n @user = User.find params[:id]\n end",
"def set_updated_by\n account.updated_by = current_user.id\n account\n end",
"def set_profile\n @profile = Profile.find_by(user_id: current_user.id)\n end",
"def add_friends_wizard\n @user = params[:id] ? User.active.find(params[:id]) || current_actor : current_actor\n raise Kroogi::NotPermitted unless permitted?(@user, :profile_edit)\n render :partial => 'add_friends_wizard', :locals => {:start_following_step => params[:start_following_step] == 'true'}\n end",
"def set_profile\n @profile = current_user.profile\n end",
"def set_profile\n @profile = current_user.profile\n end",
"def set_profile\n @profile = current_user.profile\n end",
"def set_profile\n @profile = current_user.profile\n end",
"def set_profile\n @user = User.find(params[:id])\n @profile = @user.profile\n end",
"def set_profiledetail\n @profiledetail = current_user.profiledetail\n end",
"def marked_as_paid_email(from_user, tab)\n\t\t@from_user = from_user\n\t\tto = 'kuehlschrank@fachschaft.cs.uni-kl.de'\t\t\n\t\t@tab = tab\n\t\tmail(\n\t\t\tfrom: get_email_with_name(from_user),\n\t\t\tto: to,\n\t\t\tsubject: \"#{@from_user.displayed_name} hat eine Rechnung als bezahlt markiert\"\n\t\t\t)\n\tend",
"def update\n @family = Family.find(params[:id])\n @user = User.find_by_email(session[:user_email])\n if @user && @user.identity == 2\n\t@family.approved_by = nil\n end\n respond_to do |format|\n if @family.update_attributes(params[:family])\n format.html { redirect_to session[:redirect_path], notice: 'Family was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @family.errors, status: :unprocessable_entity }\n end\n end\n end",
"def flipper_id\n \"User;#{id}\"\n end",
"def update\n if @current_user.id == params[:id].to_i && \\\n @current_user.update_attributes(params[:user])\n flash[:success] = \"profile was successfully updated\"\n redirect_to individual_path(@current_user.id)\n else\n flash[:error] = \"update error, please try again\"\n @user = @current_user\n render(:action => \"edit\")\n end\n end",
"def set_personal_profile\n @personal_profile = current_user.personal_profile\n if not @personal_profile.user_id==current_user.id\n redirect_to root_path\n end\n\n end"
] |
[
"0.6438835",
"0.62872684",
"0.6132743",
"0.595829",
"0.58557457",
"0.5845514",
"0.5827744",
"0.5780614",
"0.5749414",
"0.5716976",
"0.5703836",
"0.56760716",
"0.5661688",
"0.56603104",
"0.5658655",
"0.5654952",
"0.5631802",
"0.56277275",
"0.5614434",
"0.5610527",
"0.56084245",
"0.56066906",
"0.5600545",
"0.55935806",
"0.5591185",
"0.55855346",
"0.5552126",
"0.55483156",
"0.5532136",
"0.5528263",
"0.5526518",
"0.5520809",
"0.5509234",
"0.5502251",
"0.5490441",
"0.54887265",
"0.54884475",
"0.5481045",
"0.5474418",
"0.5460487",
"0.5454474",
"0.54525286",
"0.5449711",
"0.54469335",
"0.54412466",
"0.5426984",
"0.5423304",
"0.5418494",
"0.5414363",
"0.54063016",
"0.54040694",
"0.5403463",
"0.5381196",
"0.53805107",
"0.53750306",
"0.5373728",
"0.53714794",
"0.53701025",
"0.5367438",
"0.5365975",
"0.53618646",
"0.5354361",
"0.5349611",
"0.534703",
"0.53435415",
"0.53390145",
"0.5338801",
"0.53383285",
"0.53371453",
"0.5334326",
"0.53335685",
"0.5329679",
"0.5318149",
"0.53168243",
"0.5316577",
"0.5314522",
"0.53113747",
"0.53108156",
"0.5310176",
"0.53095",
"0.53084266",
"0.53044504",
"0.53001016",
"0.5295434",
"0.5290726",
"0.5286673",
"0.528576",
"0.52840155",
"0.52823746",
"0.5272278",
"0.52710307",
"0.52710307",
"0.52710307",
"0.52710307",
"0.5268686",
"0.52612627",
"0.52585393",
"0.525825",
"0.5250083",
"0.52476025",
"0.52472025"
] |
0.0
|
-1
|
See escape >> require 'awltool/structures' >> AwlTool::Structures::StringType::unescape "one$ltwo$lthree$l" => "one\ntwo\nthree\n"
|
def unescape(escaped_string)
escaped_string.
gsub(/\$\$|\$'|\$L|\$P|\$R|\$P|\$T/i) do |match|
case match
when "$$"
"$"
when "$'"
"'"
when "$L", "$l"
"\n"
when "$R", "$r"
"\r"
when "$T", "$t"
"\t"
when "$P", "$p"
"\f"
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def unescape_stringify(str)\n chars = {\n 'a' => \"\\x07\", 'b' => \"\\x08\", 't' => \"\\x09\", 'n' => \"\\x0a\", 'v' => \"\\x0b\", 'f' => \"\\x0c\",\n 'r' => \"\\x0d\", 'e' => \"\\x1b\", \"\\\\\\\\\" => \"\\x5c\", \"\\\"\" => \"\\x22\", \"'\" => \"\\x27\"\n }\n # Escape all the things\n str.gsub(/\\\\(?:([#{chars.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\'\n then '\\\\'\n else\n chars[$1]\n end\n elsif $2\n [\"#$2\".hex].pack('U*')\n elsif $3\n [$3].pack('H2')\n end\n }\n end",
"def unescape(string)\n \"\\\"#{string}\\\"\".undump\n end",
"def unescape(str)\n # Escape all the things\n str.gsub(/\\\\(?:([#{UNESCAPES.keys.join}])|u([\\da-fA-F]{4}))|\\\\0?x([\\da-fA-F]{2})/) {\n if $1\n if $1 == '\\\\' then '\\\\' else UNESCAPES[$1] end\n elsif $2 # escape \\u0000 unicode\n [\"#$2\".hex].pack('U*')\n elsif $3 # escape \\0xff or \\xff\n [$3].pack('H2')\n end\n }\n end",
"def unescape( value )\n return value unless @escape\n\n value = value.to_s\n value.gsub!(%r/\\\\[0nrt\\\\]/) { |char|\n case char\n when '\\0'; \"\\0\"\n when '\\n'; \"\\n\"\n when '\\r'; \"\\r\"\n when '\\t'; \"\\t\"\n when '\\\\\\\\'; \"\\\\\"\n end\n }\n value\n end",
"def unescape(s)\n s.to_s.gsub(/%2[Bb]/, \"+\")\n end",
"def unescape_value(value)\n value = value.to_s\n value.gsub!(%r{\\\\[0nrt\\\\]}) do |char|\n case char\n when '\\0' then \"\\0\"\n when '\\n' then \"\\n\"\n when '\\r' then \"\\r\"\n when '\\t' then \"\\t\"\n when '\\\\\\\\' then '\\\\'\n end\n end\n value\n end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n enc = str.encoding\n enc = Encoding::UTF_8 if enc == Encoding::US_ASCII\n str.gsub(escaped) { [$&[1, 2]].pack('H2').force_encoding(enc) }\n end",
"def unescape(val)\n\tval.gsub!(/(\\\\x[\\da-f]{2}|\\\\u[\\da-f]{4})/) { [$1[2..-1].hex].pack('U') }\n\tval\nend",
"def unescape_component(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\;/, \";\").gsub(/\\\\,/, \",\").\n gsub(/\\\\[Nn]/, \"\\n\").tr(\"\\u007f\", \"\\\\\")\n end",
"def unescape(s)\n YAML.load(%Q(---\\n\"#{s}\"\\n))\nend",
"def unescape( src )\n String.class_eval(%Q(\"#{src}\"))\nend",
"def parse_escaped_chars; end",
"def unescape(str, escaped = @regexp[:ESCAPED])\n str.gsub(escaped) { [$&[1, 2].hex].pack('C') }.force_encoding(str.encoding)\n end",
"def he_decode(text); self.class.he_decode text; end",
"def unescape(value)\n return nil if value.nil?\n regex = /\\\\(?:([nevfbart\\\\])|0?x([0-9a-fA-F]{2})|u([0-9a-fA-F]{4}))/\n value.gsub(regex) do\n if Regexp.last_match(3)\n [Regexp.last_match(3).to_s.hex].pack('U*')\n elsif Regexp.last_match(2)\n [Regexp.last_match(2)].pack('H2')\n else\n UNESCAPES[Regexp.last_match(1)]\n end\n end\n end",
"def unescape(s); s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n){[$1.delete('%')].pack('H*')} end",
"def unescape(s)\n s.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) {\n [$1.delete('%')].pack('H*')\n }\n end",
"def unescape(str)\n str.to_s.gsub(/%(..)/) { Regexp.last_match(1).hex.chr }\n end",
"def decode_string(str)\n\nend",
"def strip_and_unescape(value)\n value.strip\n .gsub(/^\\^\"(.*)\\^\"$/, '\\1')\n .gsub(/^\"(.*)\"$/, '\\1')\n .gsub(/\\^([\\\\\"&%^<>|])/, '\\1')\n .gsub(/\\\\\\\\/, '\\\\')\n end",
"def unescape(s)\n s.gsub(/((?:%[0-9a-fA-F]{2})+)/n) {[$1.delete('%')].pack('H*')}\n end",
"def unescape(string)\n string.tr('+', ' ').gsub(/((?:%[0-9a-fA-F]{2})+)/n) do\n [$1.delete('%')].pack('H*')\n end\n\tend",
"def unescape(x)\n # temporarily escape \\\\ as \\007f, which is disallowed in any text\n x.gsub(/\\\\\\\\/, \"\\u007f\").gsub(/\\\\,/, \",\").gsub(/\\\\[Nn]/, \"\\n\").\n tr(\"\\u007f\", \"\\\\\")\n end",
"def unnormalize(string, entities = T.unsafe(nil), filter = T.unsafe(nil)); end",
"def unescape_special_chars( str )\n\t\t\tEscapeTable.each {|char, hash|\n\t\t\t\t@log.debug \"Unescaping escaped %p with %p\" % [ char, hash[:md5re] ]\n\t\t\t\tstr.gsub!( hash[:md5re], hash[:unescape] )\n\t\t\t}\n\n\t\t\treturn str\n\t\tend",
"def decoder(string)\n string.gsub(/(WUB)+/, ' ').strip\nend",
"def unescape(string,encoding=@@accept_charset)\n str=string.tr('+', ' ').b.gsub(/((?:%[0-9a-fA-F]{2})+)/) do |m|\n [m.delete('%')].pack('H*')\n end.force_encoding(encoding)\n str.valid_encoding? ? str : str.force_encoding(string.encoding)\n end",
"def unnormalize(string, doctype = T.unsafe(nil), filter = T.unsafe(nil), illegal = T.unsafe(nil)); end",
"def decode(text); end",
"def decode_json_scrp\n self\n .gsub('\\u0022', '\"')\n .gsub('\\u00E0', \"à\")\n .gsub('\\u00E2', \"â\")\n .gsub('\\u00E8', \"è\")\n .gsub('\\u00E9', \"é\")\n .gsub('\\u00E7', \"ç\")\n .gsub('\\u00F9', \"ù\")\n .gsub('\\u0026', \"&\")\n .gsub('\\u20AC', \"€\")\n .gsub('\\u0027', \"'\")\n .gsub('\\u00A0', \"\")\n .gsub('\\u00C8', \"È\")\n .gsub('\\u00B2', \"²\")\n .gsub('\\u00C9', \"É\")\n .gsub('\\\\\"', '\"')\n end",
"def unescape_string_if_needed(str)\n\t# unsafe characters - see above for complete list\n\tunsafeCharacters = [0x200c, 0x200d]\n\t# let's convert our string into array (to preserve proper unicode numbers)\n\tstr_array=str.unpack(\"U*\")\n\t# set this to false until the first replacement takes place\n\treplacement_done = false\n\n\t# loop over all unsafe character and try to replace all occurencies\n\tunsafeCharacters.each do |c|\n\t\t# find the first occurence of that character\n\t\ti = str_array.index(c)\n\t\twhile i != nil\n\t\t\t# replaces a single character with '%uXXXX', where XXXX is hex code of character\n\t\t\t# this only works with non-math characters, but it should not happen that any bigger number would occur\n\t\t\tstr_array[i,1] = sprintf(\"%%u%4X\", c).unpack(\"U*\")\n\t\t\ti = str_array.index(c)\n\t\t\treplacement_done = true\n\t\tend\n\tend\n\n\t# convert the array back to string\n\tstr = str_array.pack(\"U*\")\n\n\tif replacement_done\n\t\treturn \"unescape('#{str}')\"\n\telse\n\t\treturn \"'#{str}'\"\n\tend\nend",
"def unescape_all(value)\n return nil if value.nil?\n value = unescape(value).gsub(/\\\\(.)/) { Regexp.last_match(1) }\n value\n end",
"def unescape_value(value)\n CGI.unescape(value)\n end",
"def uninspect(str)\n return nil unless str\n str.gsub(%r!\\\\([\\\\#\"abefnrstvx]|u\\d{4}|u\\{[^\\}]+\\}|\\d{1,3}|x\\d{1,2}|cx|C-[a-zA-Z]|M-[a-zA-Z]| |=|:)!) do |m|\n repl = \"\"\n if ['\\\\', '#', '\"'].include?($1)\n repl = $1\n else\n repl = eval(\"\\\"\\\\#{$1}\\\"\")\n end\n repl\n end\n end",
"def convert_string(item)\n escape(item).\n\n # convert ... to elipsis (and make sure .... becomes .<elipsis>)\n gsub(/\\.\\.\\.\\./, '.\\ldots{}').gsub(/\\.\\.\\./, '\\ldots{}').\n\n # convert single closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\'}, '\\1\\'').\n gsub(%r{\\'(?=\\W|s\\b)}, \"'\" ).\n\n # convert single opening quote\n gsub(/'/, '`').\n\n # convert double closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\\"(?=\\W)}, \"\\\\1''\").\n\n # convert double opening quote\n gsub(/\"/, \"``\").\n\n # convert copyright\n gsub(/\\(c\\)/, '\\copyright{}')\n\n end",
"def urldecode\n _rfc2396_parser.unescape(self)\n end",
"def decode(joined_password)\n joined_password.gsub!(\"ashley\", \" \")\n joined_password.gsub!(\"blake\", \"e\")\n new_password_array = joined_password.split(\" \")\n password_array = []\n password_array[1] = new_password_array[1]\n password_array[0] = new_password_array.last\n password_array[3] = new_password_array.first\n password = password_array.compact.join(\"_\")\n password = password.to_sym\nend",
"def unicode_esc!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 9 )\n\n \n # - - - - main rule block - - - -\n # at line 309:9: '\\\\\\\\' 'u' HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT\n match( 0x5c )\n match( 0x75 )\n hex_digit!\n hex_digit!\n hex_digit!\n hex_digit!\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 9 )\n\n end",
"def consume_escaped; end",
"def double_quote_string_literal!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 44)\n\n type = DOUBLE_QUOTE_STRING_LITERAL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 496:4: '\\\"' ( ESC | ~ ( '\\\\\\\\' | '\\\"' ) )* '\\\"'\n match(?\")\n # at line 496:8: ( ESC | ~ ( '\\\\\\\\' | '\\\"' ) )*\n loop do #loop 7\n alt_7 = 3\n look_7_0 = @input.peek(1)\n\n if (look_7_0 == ?\\\\) \n alt_7 = 1\n elsif (look_7_0.between?(0x0000, ?!) || look_7_0.between?(?#, ?[) || look_7_0.between?(?], 0xFFFF)) \n alt_7 = 2\n\n end\n case alt_7\n when 1\n # at line 496:9: ESC\n esc!\n\n when 2\n # at line 496:15: ~ ( '\\\\\\\\' | '\\\"' )\n if @input.peek(1).between?(0x0000, ?!) || @input.peek(1).between?(?#, ?[) || @input.peek(1).between?(?], 0x00FF)\n @input.consume\n else\n mse = MismatchedSet(nil)\n recover(mse)\n raise mse\n end\n\n\n\n else\n break #loop 7\n end\n end\n match(?\")\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 44)\n\n end",
"def deserialize_rdf_literals!(env)\n tagged_fields.each do |field|\n env.attributes[field] = value_for(field, env) if env.attributes[field]\n end\n end",
"def decode\n transform :decode\n end",
"def lex_en_interp_backslash_delimited; end",
"def lex_en_interp_backslash_delimited; end",
"def lex_en_interp_backslash_delimited; end",
"def s2v(str)\n #Variables\n if str =~ /\\$[{]?\\w+[}]?/\n str.gsub(/\\$[{]?(\\w+)[}]?/) do |t|\n str = str.sub(t,lookupvar($1).to_s)\n end\n end\n #Functions\n if str =~ /%[{]?[a-zA-Z0-9!\"'\\(\\)\\*\\+,-\\.\\/:;<=>\\?@\\[\\\\\\]\\^_\\\\|~]+[\\}]?/\n str.gsub(/%[{]?([a-zA-Z0-9!\"'\\(\\)\\*\\+,-\\.\\/:;<=>\\?@\\[\\\\\\]\\^_\\\\|~]+)[\\}]?/) do |t|\n str = str.sub(t,eval(\"function_#{$1}\").to_s)\n end\n end\n return str\n end",
"def url_decode\n Rack::Utils.unescape self\n end",
"def unescape(str)\n # URI.unescape is obsolete\n DEFAULT_PARSER.unescape(str)\n end",
"def lex_en_interp_backslash_delimited_words; end",
"def lex_en_interp_backslash_delimited_words; end",
"def lex_en_interp_backslash_delimited_words; end",
"def reencode_string(input); end",
"def unescape_uri(uri); end",
"def test_decode_string()\n input = [\n 131, 107, 0, 24, 110, 111, 119, 32, 103, 101, 116, 32, 121, 111,\n 117, 114, 32, 97, 115, 115, 32, 116, 111, 32, 109, 97, 114, 115]\n expected = \"now get your ass to mars\"\n\n stream = Erlang::StreamEmulator.new(input)\n actual = Erlang::decode(stream)\n\n assert_equal(expected, actual)\n end",
"def lex_en_plain_backslash_delimited; end",
"def lex_en_plain_backslash_delimited; end",
"def lex_en_plain_backslash_delimited; end",
"def escape(str)\n str.dump[1..-2]\nend",
"def unescape_hash( hash )\n hash.each_pair {\n |k, v|\n hash[k] = unescape( hash[k] ) if hash[k].is_a?( String )\n hash[k] = unescape_hash( v ) if v.is_a? Hash\n }\n\n return hash\n end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def singleq2utf\n self.gsub(\"'\", '%EF%BC%87')\n end",
"def unicode_filter_decode(str)\n self.encode_unicode ? Rex::Text.unicode_filter_decode(str) : str\n end",
"def test_string2\n token, value, rest = @c.lex(' \"say \\\\\"hello\\\\\"\" while')\n assert_equal(:string, token)\n assert_equal('\"say \\\\\"hello\\\\\"\"', value)\n assert_equal(' while', rest)\n end",
"def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/\\n/, ' ') \n str.gsub!(/\\0/, '')\n str\n end",
"def decoder\n joined_password = \"intblakernblaketsashleythblakeashleyall\"\n joined_password.gsub!(\"ashley\", \" \")\n joined_password.gsub!(\"blake\", \"e\")\n new_password_array = joined_password.split\n #[\"internets\", \"the\", \"all\"] \n #new_password_array.compact!\n #the compact doesn't do anything, it returned nil, so i'm taking this step out\n password_array = []\n password_array[0] = new_password_array[2]\n password_array[1] = new_password_array[1]\n password_array[2] = new_password_array[0]\n pass_as_string = password_array.join(\"_\")\n password = pass_as_string.to_sym\nend",
"def decode; end",
"def decode; end",
"def literal_sub(s, fexp, wi)\n\n case s\n when /^\\$(?:variable|var|v):([^{}\\s\\$]+)$/\n fexp.lookup_variable($~[1])\n when /^\\$([^{}:\\s\\$]+)$/, /^\\$(?:field|fld|f):([^{}\\s\\$]+)$/\n Ruote.lookup(wi['fields'], $~[1])\n else\n s\n end\n end",
"def decode(str)\n str.gsub(/\\\\\\(/, '(').gsub(/\\\\\\)/, ')')\n end",
"def convert_string_fancy(item)\n # convert ampersand before doing anything else\n item.gsub(/&/, '&').\n\n # convert -- to em-dash, (-- to en-dash)\n gsub(/---?/, '—'). #gsub(/--/, '–').\n\n # convert ... to elipsis (and make sure .... becomes .<elipsis>)\n gsub(/\\.\\.\\.\\./, '.…').gsub(/\\.\\.\\./, '…').\n\n # convert single closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\'}, '\\1’'). # }\n gsub(%r{\\'(?=\\W|s\\b)}, '’').\n\n # convert single opening quote\n gsub(/'/, '‘').\n\n # convert double closing quote\n gsub(%r{([^ \\t\\r\\n\\[\\{\\(])\\\"(?=\\W)}, '\\1”'). # }\n\n # convert double opening quote\n gsub(/\"/, '“').\n\n # convert copyright\n gsub(/\\(c\\)/, '©').\n\n # convert registered trademark\n gsub(/\\(r\\)/, '®')\n end",
"def convert_field_values_to_utf8!(struct)\n return nil if struct.nil?\n struct.each_with_index do |value, index|\n if value.is_a?(String)\n converted = Puppet::Util::CharacterEncoding.convert_to_utf_8!(value)\n struct[index] = converted if !converted.nil?\n elsif value.is_a?(Array)\n struct[index] = convert_array_values_to_utf8!(value)\n end\n end\n end",
"def unescape(str)\n str = str.force_encoding(\"UTF-8\") if str.respond_to?(:force_encoding)\n str = str.gsub(/&#(\\d{3});/) { [$1.to_i].pack(\"U\") }\n CGI.unescapeHTML(str)\n end",
"def fetch_and_unescape(obj, meth)\n CGI.unescape(call_if_defined(obj, meth).to_a.join(' '))\nend",
"def test_string3\n token, value, rest = @c.lex('\" hello \\\\\\\\\" for')\n assert_equal(:string, token)\n assert_equal('\" hello \\\\\\\\\"', value)\n assert_equal(' for', rest)\n end",
"def h_(str)\n str.to_s.gsub(/['&\\\"<>]/, {\"'\"=>\"'\", \"&\"=>\"&\", '\"'=>\""\", \"<\"=>\"<\", \">\"=>\">\"})\n end",
"def unescape(html)\n CGI.unescapeHTML(html)\n end",
"def u64(s)\n return unless s\n Base64.decode64 CGI.unescape(s)\n end",
"def escape(str); end",
"def url_unescape(s)\n #Added this to make cadaver work\n s = s.gsub(\"%28\", \"(\").gsub(\"%29\", \")\")\n URI.unescape(s)\n end",
"def unicode_escape!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 76 )\n\n\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 601:11: '\\\\\\\\' 'u' HexDigit HexDigit HexDigit HexDigit\n match( 0x5c )\n match( 0x75 )\n\n hex_digit!\n\n\n hex_digit!\n\n\n hex_digit!\n\n\n hex_digit!\n\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 76 )\n\n\n end",
"def u(str)\n CGI.escape(str)\n end",
"def encode_string_ex; end",
"def h(str)\n CGI.unescape_html(str.to_s)\n .gsub('&', '&')\n .gsub('\"', '"')\n .gsub('<', '<')\n .gsub('>', '>')\n end",
"def escape(string); end",
"def decode_quoted_printable\n self.unpack(\"M*\").first\n end",
"def unencode_javascript_unicode_escape(str)\n if str.respond_to?(:gsub!)\n str.gsub!(/\\\\u([0-9a-fA-F]{4})/) do |s| \n int = $1.to_i(16)\n if int.zero? && s != \"0000\"\n s\n else\n [int].pack(\"U\")\n end\n end\n end\n str\n end",
"def convert_escape_characters(text)\n result = rm_extender_convert_escape_characters(text).to_s.clone\n result.gsub!(/\\eL\\[\\:(\\w+)\\]/i) { L[$1.to_sym] }\n result.gsub!(/\\eSL\\[\\:(\\w+)\\]/i) { SL[$game_message.call_event, $1.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_sym] }\n result.gsub!(/\\eSL\\[(\\d+)\\,\\s*(\\d+)\\,\\s*\\:(\\w+)\\]/i) { SL[$1.to_i, $2.to_i, $3.to_sym] }\n result.gsub!(/\\eSV\\[([^\\]]+)\\]/i) do\n numbers = $1.extract_numbers\n array = [*numbers]\n if numbers.length == 1\n array = [$game_message.call_event] + array\n end\n SV[*array]\n end\n return result\n end",
"def escape(string)\n string.gsub(/([\\<\\>\\:\\\"\\/\\\\\\|\\?\\*]+)/n) do\n '%' + $1.unpack('H2' * $1.size).join('%').upcase\n end.tr(' ', '_')\n end",
"def escape(s); s.to_s.gsub(/([^ a-zA-Z0-9_.-]+)/n){'%'+$1.unpack('H2'*$1.size).join('%').upcase}.tr(' ', '+') end",
"def decode_word(text)\n return text unless text =~ /=\\?([^?]+)\\?(.)\\?([^?]*)\\?=/\n \n charset, method, encoded_string = $1, $2, $3\n \n # Strip out the RFC2231 language specification if there is one.\n charset = $1 if charset =~ /^([^\\*]+)\\*?(.*)$/\n \n # Quoted-printable in RFC2047 substitutes spaces with underscores.\n encoded_string.tr!('_', ' ') if method.downcase == 'q'\n \n encoded_string.decode_mime(method).iconv('utf-8', charset)\n end",
"def unescape(string)\n string.is_a?(String) ? string.gsub(/\\n|\\r/, \"\") : string\n end",
"def test_decode_entities\n data = Plist::parse_xml('<string>Fish & Chips</string>')\n assert_equal('Fish & Chips', data)\n end",
"def double_metaphone(str); end",
"def lex_en_plain_string; end",
"def lex_en_plain_string; end",
"def lex_en_plain_string; end",
"def lex_en_plain_backslash_delimited_words; end",
"def lex_en_plain_backslash_delimited_words; end"
] |
[
"0.68075",
"0.66801375",
"0.6557451",
"0.63808054",
"0.6252174",
"0.62201196",
"0.61941385",
"0.61899817",
"0.6186463",
"0.61666256",
"0.61056936",
"0.60777396",
"0.60711956",
"0.6047817",
"0.602092",
"0.5932695",
"0.59232986",
"0.5880502",
"0.5852494",
"0.58016133",
"0.57858527",
"0.57849914",
"0.57760006",
"0.57379544",
"0.56930405",
"0.5685724",
"0.56809956",
"0.5659719",
"0.5653997",
"0.56458396",
"0.5593365",
"0.55891633",
"0.55605686",
"0.5505182",
"0.5494339",
"0.549388",
"0.54925823",
"0.5490531",
"0.5459056",
"0.543696",
"0.54325306",
"0.54185194",
"0.5408688",
"0.5408688",
"0.5408688",
"0.5395882",
"0.5384607",
"0.53749985",
"0.5374773",
"0.5374773",
"0.5374773",
"0.53670055",
"0.5356122",
"0.534924",
"0.53470063",
"0.53470063",
"0.53470063",
"0.53436565",
"0.5337701",
"0.5332431",
"0.5332431",
"0.5332431",
"0.5326787",
"0.5326647",
"0.5325371",
"0.5318827",
"0.5306955",
"0.5269677",
"0.5269677",
"0.5264856",
"0.5251541",
"0.5250121",
"0.52397186",
"0.5236845",
"0.52324694",
"0.5225231",
"0.52227217",
"0.52219355",
"0.5220026",
"0.5212929",
"0.5212029",
"0.5205956",
"0.520529",
"0.52050734",
"0.5202165",
"0.5198036",
"0.5182444",
"0.51791805",
"0.5175056",
"0.517372",
"0.515768",
"0.51549685",
"0.5153348",
"0.514176",
"0.5138237",
"0.51377803",
"0.51377803",
"0.51377803",
"0.5135964",
"0.5135964"
] |
0.6202425
|
6
|
up by identifiers for each block, print 1 message per failure or error found
|
def parse_message_from_log_entry
unique_messages = { }
id = ""
ARGF.each do |line|
block_id = line.match(/Loaded suite (.*)/)
failure_msg = line.match(/[1-9]+ failures/)
err_msg = line.match(/[1-9]+ errors/)
if ! block_id.nil?
id = block_id[1]
elsif ! failure_msg.nil?
unique_messages["FAIL: #{id}"] = ""
elsif ! err_msg.nil?
unique_messages["ERROR: #{id}"] = ""
end
end
puts unique_messages.keys.join("\n")
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def print_results\n if !@failures.empty?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend",
"def display_error(i, given, correct)\n puts \"Line #{i+1}: Invalid block number #{given}, should be #{correct.to_i + 1}\"\n end",
"def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end",
"def print_error\n parts = @curr_blk.text.split('|')\n out = \"Line #{@curr_line}:\"\n\n case @curr_blk.validity\n when 1\n out += \" Could not parse line '#{@curr_blk.text}.\"\n when 2\n out += \" Invalid block number #{@curr_blk.number}, should be #{@curr_line}.\"\n when 3\n out += \" Could not parse transactions list '#{@curr_blk.text.split('|')[2]}'.\"\n when 4\n out += \" Invalid block, address #{@curr_wallet.address} has #{@curr_wallet.balance} billcoins!\"\n when 5\n out += \" Could not parse timestamp '#{@curr_blk.text.split('|')[3]}'.\"\n when 6\n out += \" Previous timestamp #{@p_s}.#{@p_ns} >= new timestamp #{@curr_blk.seconds}.#{@curr_blk.nseconds}.\"\n when 7\n h_string = @curr_blk.text.chomp('|' + parts[4])\n out += \" String '#{h_string}' hash set to #{parts[4]}, should be #{@curr_hash}.\"\n when 8\n out += \"Previous hash was #{parts[1]}, should be #{@p_h}.\"\n when 9\n out += \" Previous hash was #{parts[1]}, should be 4 characters or less.\" if parts[1].length > 4\n out += \" Block hash was #{parts[4]}, should be 4 characters or less.\" if parts[4].length > 4\n end\n\n puts out\n\n @curr_blk.validity\n end",
"def setup_fail(message)\n puts '-'*50\n message.each { |line| puts line }\n puts '-'*50\n exit\n end",
"def output_priority\n priority = Hash.new # where priority[id] = block id's priority \n error_set = Hash.new # where error_set[id] = block id's error set\n \n # init error_set to contain all the blocks\n @validations.values.each do |validation|\n for i in 0..validation.blocks.size-1\n unless validation.blocks[i].class != Set \n id = validation.id.to_s + \"~\" + i.to_s \n error_set.merge!(id => validation.blocks[i])\n priority.merge!(id => 1)\n end\n end\n end\n\n error_set.keys.each do |key| \n error_set.keys.each do |other| # QUADRATIC\n unless key == other\n if error_set[key].difference(error_set[other]).empty? then priority[other] = priority[other] + 1 end # key is a subest of other so other's priority increases\n end\n end\n end\n\n sorted = priority.sort{|key, value| -1*(key[1] <=> value[1]) } \n\n i = 0\n puts \"========= Priority by block-error-set ========\"\n puts sorted[i].class\n while i < LIMIT and sorted[i]\n id = sorted[i][0]\n print sorted[i][1].to_s + \" blocks will be successful if you fix: \"\n puts id.to_s\n error_set[id].each do |error|\n print \" \" + error.to_s.delete(\"[\").delete(\"]\")\n puts \"\"\n end\n i = i + 1\n\n \n end\n end",
"def dump_failure(counter, failure)\n end",
"def dump_failure(counter, failure)\n end",
"def print_errors(rows)\n print \"Errors:\\n\"\n rows.each do |row|\n print \"Row #{row[:row_number]} rejected: #{row[:validation_errors].join(\", \")}\\n\"\n\n end\n print \"\\n\"\n end",
"def check_for_errors\n return unless @chunks.any? { |chunk| chunk.first[0] == :error }\n errors = @chunks.find_all { |chunk| chunk[0] == :error }\n $stderr.puts \"WARNING: found the following errors: #{errors.map(&last).inspect}\"\n end",
"def print_invalid_users\n puts \"==================================================\"\n puts \"============ Malformed User Records ==============\"\n puts \"==================================================\"\n\n @bad_user_records.each do |rec|\n rec.output\n puts \"\"\n end\n end",
"def print_failures(arr)\n if arr.length > 0\n puts \"Failures:\"\n end\n\n arr.each do |bad|\n puts \"\\t#{bad}\"\n end\n end",
"def test_check_bad_block\n assert_raises SystemExit do\n assert_output \"Line 1: Invalid block, missing or extra element(s)\\nBLOCKCHAIN INVALID\" do\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d', '']\n line_num = 1\n @verify.check_block(line, line_num)\n end\n end\n end",
"def send_hashes(event)\n levels = MappackLevel.where('mappack_id > 0')\n count = levels.count\n res = levels.each_with_index.select{ |l, i|\n dbg(\"Hashing level #{i} / #{count}...\", newline: false, pad: true)\n !l.compare_hashes\n }.map{ |map, i| map.name }\n event << \"There are #{res.size} levels with differing hashes:\"\n res.size <= 20 ? event << format_block(res.join(\"\\n\")) : send_file(event, res.join(\"\\n\"))\nrescue => e\n lex(e, \"Error getting hash discrepancies.\", event: event)\nend",
"def failure_details(io)\n super\n unless test_case.input.empty?\n format_block(io, \"Input\", test_case.input)\n end\n format_block(io, \"Evaluated commands\", test_case.evaluated_commands)\n comparisons.each do |expectation|\n expectation.format_details(io)\n end\n unless test_case.scope.debug.empty?\n format_block(io, \"Contents of *debug*\", test_case.scope.debug)\n end\n format_block(io, \"How to run this test\", test_case.shell_command_details)\n end",
"def error_details\n msg = ''\n @runner.failures.each do |checker|\n # msg << error(\"------- #{checker.name} -------\") << \"\\n\"\n # msg << error(\"#{checker.hint}\") << \"\\n\"\n checker.errors.details.each do |type, content|\n case type\n when :source\n content.each_line.with_index do |l, i|\n msg << yellow((i + 1).to_s.rjust(3)) << '|' << l\n end\n when Integer\n msg << info('Line: ') << yellow(type) << '|' << info(content)\n when Array\n msg << info('Pos: ') << yellow(type.join(',')) << '|' << info(content)\n when nil\n msg << info(content)\n end\n msg << \"\\n\"\n end\n end\n msg\n end",
"def display_error\n counter = 0\n file_data_arr.each_with_index do |file_data, index|\n data_index = index + 1\n counter += 1 unless missing_ending_semicolon?(file_data, data_index)\n counter += 1 unless space_before_semicolon?(file_data, data_index)\n counter += 1 unless indentation_error?(file_data, data_index)\n counter += 1 unless space_after_colon?(file_data, data_index)\n counter += 1 unless space_before_colon?(file_data, data_index)\n counter += 1 unless trailing_white_space?(file_data, data_index)\n end\n puts 'No Errors Found'.green if counter.zero?\n end",
"def process_unexpected_transactions()\t\t\n\t\tunexpected_uuids=[]\t\n\t\tparams=prepare_base_params()\t\n\t\tresult=server_rest_api(@transaction_restapi,params)\t\n\t\tresult.each do |res|\t\n\t\t\tif ! @output[:transactionInstances][:data][:expected_results].any?{ |h| ! h.nil? && ! h[:uuid].nil? && h[:uuid] == res[:uuid]} && ! @optional.any?{ |h| ! h.nil? && h[:name] == res[:name]}\n\t\t\t\t@output[:transactionInstances][:data][:not_expected_results].push({:name => res[:name], :uuid=> res[:uuid], :tr_exist => true, :tr_status => false})\t\t\n\t\t\t\t@output[:transactionInstances][:failed_count]+=1\t\t\n\t\t\tend\t\t\t\n\t\tend\tunless result.nil?\n\t\t@output[:transactionInstances][:total_count]=@output[:transactionInstances][:failed_count] + @output[:transactionInstances][:success_count]\n\t\t@output[:transactionInstances][:success_rate]=(@output[:transactionInstances][:total_count] == 0) ? 0 : ( ( @output[:transactionInstances][:success_count].to_f / @output[:transactionInstances][:total_count] ) * 100).round(2)\n\t\t@output[:workUnits][:total_count]=@output[:workUnits][:failed_count] + @output[:workUnits][:success_count]\n\t\t@output[:workUnits][:success_rate]=(@output[:workUnits][:total_count] == 0) ? 0 : ( ( @output[:workUnits][:success_count].to_f / @output[:workUnits][:total_count] ) * 100).round(2)\t\t\n\t\t@output[:workUnitAttributes][:total_count]=@output[:workUnitAttributes][:failed_count] + @output[:workUnitAttributes][:success_count]\n\t\t@output[:workUnitAttributes][:success_rate]=(@output[:workUnitAttributes][:total_count] == 0) ? 0 : ( ( @output[:workUnitAttributes][:success_count].to_f / @output[:workUnitAttributes][:total_count] ) * 100).round(2)\t\t\n\tend",
"def identify_error\n begin\n yield\n rescue => ex\n ex.message.insert(0, \"#{@id} error: \")\n raise\n end\n end",
"def report_test_results(test_name, results)\n status = true\n message = \"\"\n for result in results\n # print (\"Status: \"+result[0].to_s+\"\\n\")\n status = (status && result[0])\n if (result[1].is_a?(Array))\n for m in result[1]\n message += m.to_s + \"\\n\\t\"\n end\n else\n message += result[1] + \"; \"\n end\n end\n\n report_test_result(test_name, status, message)\nend",
"def check_summary_for_errors(summary)\n if summary.has_key?(\"resources\")\n resources = summary[\"resources\"]\n\n failed_to_restart = resources[\"failed_to_restart\"]\n if failed_to_restart.nil?\n @errors << \"failed to restart count not in summary.\"\n elsif failed_to_restart > 0\n @errors << \"#{failed_to_restart} resources failed to restart.\"\n end\n\n failed = resources[\"failed\"]\n if failed.nil?\n @errors << \"failed resources count not in summary.\"\n elsif failed > 0\n @errors << \"#{failed} failed resources.\"\n end\n\n total = resources[\"total\"]\n # this happens when execution expired sometimes. \n if total.nil?\n @errors << \"total resources count not in summary.\"\n elsif total == 0\n @errors << \"there were zero total resources in the run summary, which suggests something went wrong.\"\n end \n else\n @errors << \"no resources information.\"\n end\n\n # failure events are usually failed resourced, but sometimes aren't.\n # we record these if there aren't already failed resources.\n if summary.has_key?(\"events\")\n failure = summary[\"events\"][\"failure\"]\n if failure.nil?\n @errors << \"no failure count in summary events.\"\n elsif failure > 0 and failed == 0\n @errors << \"#{failure} failure events.\"\n end\n else\n @errors << \"no events in summary.\"\n end\n\n @errors.length\n end",
"def group name\n @messages << name\n yield\n rescue StandardError => caught\n @counts.errors += 1\n puts_failure_data(\n header: ERROR_HEADER,\n additional_info: error_to_info_array(caught)\n )\n ensure\n @messages.pop\n end",
"def send_inline_comments(results)\n results.each do |result|\n result[\"errors\"].each do |error|\n file = result[\"file\"]\n message = error[\"message\"]\n line = error[\"line\"]\n fail(message, file: file, line: line)\n end\n end\n end",
"def process_blocks(blocks); end",
"def failures; end",
"def failures; end",
"def failures; end",
"def dump_failures\n super\n return if failed_examples.empty?\n if self.class.config[:growl_failures]\n\n msg = failed_examples.each_with_index.map do |example, idx|\n [\"#{idx+1}. it #{example.description}\",\n example.metadata[:execution_result][:exception]]\n end.flatten.join(\"\\n\\n\")\n\n ::Growl.notify_warning msg, {\n :title => \"#{failed_examples.size} specs failed\"\n }.merge(self.class.growlnotify_config)\n end\n end",
"def test_check_good_block\n line = ['0', '0', 'SYSTEM>569274(100)', '1553184699.650330000', '288d']\n line_num = 1\n assert_output(nil) { @verify.check_block(line, line_num) }\n end",
"def run_checks\n bad_refs(qtag_count) do |qt|\n yield Error.new(survey, Question, :bad_ref, qt, qtag_expectations[qt])\n end\n\n bad_refs(atag_count) do |qt, at|\n yield Error.new(survey, Answer, :bad_ref, at, atag_expectations[[qt, at]])\n end\n\n bad_refs(ctag_count) do |c, tag|\n yield Error.new(survey, Condition, :bad_ref, tag, c)\n end\n\n by_qref.select { |k, v| v.length > 1 }.each do |k, vs|\n yield Error.new(survey, Question, :duplicate_qref, k, vs)\n end\n end",
"def test_summary_warnings_109\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.warning_difference_filter(171,\n \"list\",\n \"1\",\n \"3\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n #there are 15 diff_warning in this list\n assert_equal(diff_warnings.size, 15)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def better_log block_description, &block\n\t\n\tprefix = ' '*$nest\n\tputs prefix + \"Beginning #{block_description.inspect}...\"\n\t$nest += 1\n\tl = block.call\n\t$nest -= 1\n\tputs prefix + \"...#{block_description.inspect} finished, returning: #{l}\"\nend",
"def ensure_failed(broker, targets, response_dataset, max_retries: 30, query_interval: 1)\n transaction_ids = response_dataset.map { |data| data['transaction_id'] }\n agent_identities(targets).zip(transaction_ids).map do |identity, transaction_id|\n check_non_blocking_response(broker, identity, transaction_id, max_retries, query_interval) do |result|\n assert_equal('failure', result['status'], 'Action was expected to fail')\n assert_equal(nil, result['stdout'], 'Successful action expected to have no output on stdout')\n assert_equal(1, result['exitcode'], \"Successful action expected to have exit code #{exit_code}\")\n yield result['stderr'] if block_given?\n end\n end\nend",
"def testRun2ActionsWith2Errors\n executeSlave(\n [\n '--user', 'DummyUser',\n '--tool', 'DummyTool',\n '--action', 'DummyActionWithParams',\n 'Param1',\n '--action', 'DummyActionError'\n ],\n :AddRegressionActions => true,\n :Repository => 'Dummy/AllDummyActionsAvailable',\n :Error => WEACE::Slave::Client::ActionExecutionsError\n ) do |iError|\n assert(defined?(iError.ErrorsList))\n assert(iError.ErrorsList.kind_of?(Array))\n assert_equal(2, iError.ErrorsList.size)\n # First error\n assert(iError.ErrorsList[0].kind_of?(Array))\n assert_equal(5, iError.ErrorsList[0].size)\n lProduct, lTool, lAction, lParams, lError = iError.ErrorsList[0]\n assert_equal('RegProduct', lProduct)\n assert_equal('DummyTool', lTool)\n assert_equal('DummyActionWithParams', lAction)\n assert_equal(['Param1'], lParams)\n assert(lError.kind_of?(WEACE::Slave::Client::AdapterArgumentError))\n # Second error\n assert(iError.ErrorsList[1].kind_of?(Array))\n assert_equal(5, iError.ErrorsList[1].size)\n lProduct, lTool, lAction, lParams, lError = iError.ErrorsList[1]\n assert_equal('RegProduct', lProduct)\n assert_equal('DummyTool', lTool)\n assert_equal('DummyActionError', lAction)\n assert_equal([], lParams)\n assert(lError.kind_of?(WEACE::Slave::Adapters::DummyProduct::DummyTool::DummyError))\n end\n end",
"def present_non_assertion_error_summary\n return if non_assertion_errors.empty?\n Terminal.format_title(@io, 2, \"Errors other than assertion failures\")\n non_assertion_errors.each do |error|\n error.non_assertion_error_details(@io)\n end\n end",
"def record_error_with_less_nodes\n @supervisor.increment_error_count\n\n dashes = '-' * 90\n\n @error = %{#{exception.message}\\n#{exception.backtrace.join(\"\\n\")}\n#{dashes}\\nQUEUE ELEMENT:\\n#{@element.inspect}\n#{dashes}\\nRAW PAYLOAD:\\n#{@response.inspect}\n#{dashes}\\nRAW BODY:\\n#{@response_body.inspect}\n#{dashes}\\nPARSED PAYLOAD:\\n#{@entity.inspect}}\n\n log(\"#{'=' * 90}\\nERROR processing data!#{@error}\")\nend",
"def expect_error_msgs(*messages)\n within \"#error_explanation\" do\n error_count = messages.size\n expect(page).to have_content \"#{error_count} #{'error'.pluralize(error_count)} prohibited this user from being saved\"\n within \"ul\" do\n expect(page).to have_css \"li\", count: error_count\n messages.each do |expected_msg|\n expect(page).to have_selector \"li\", text: expected_msg\n end\n end\n end\n end",
"def report(out=$stderr)\n errors = expected_participants.collect(&:errors).flatten\n unless errors.empty?\n out.puts \"CSV Errors:\"\n errors.each do |error|\n out.puts \"* #{error}\"\n end\n out.puts\n end\n\n if differences.empty?\n out.puts \"Everything matches exactly.\"\n else\n differences.each do |code, p_ids|\n out.puts MESSAGES[code]\n p_ids.sort.each do |p_id|\n out.puts \"* #{p_id}\"\n end\n end\n end\n end",
"def dump_failures(notification)\n failure_notifications = notification.failure_notifications\n return if failure_notifications.empty?\n\n failure_notifications.each do |failure|\n exception = failure.exception\n next unless exception\n\n sauce_test_link = failure.example.metadata[:sauce_test_link]\n next unless sauce_test_link\n\n # Use nonbreaking space to bypass message.strip and ensure we have\n # a newline after the message and before the stack trace.\n nbsp = \"\\u00A0\"\n message = \"#{exception.message}\\n#{sauce_test_link}\\n#{nbsp}\"\n exception.instance_eval <<-RUBY\n def message\n %q(#{message})\n end\n\n def to_s\n message\n end\n RUBY\n end\n\n # Use default RSpec logic to format the failures now that we've\n # attached the Sauce test link to the exceptions\n super\n end",
"def validate_first_block(f_info)\r\n\t\terror_msg = \"\"\r\n\t\tsuccess = true\r\n\r\n\t\t# verifies the timestamps\r\n\t\tsuccess, error_msg = validate_timestamps(f_info)\r\n\t\treturn success, error_msg unless success\r\n\r\n\t\tif f_info['id'] != 0\r\n\t\t\terror_msg = \"Invalid block number #{f_info['id']}, should be 0\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telsif f_info['prev_hash'] != \"0\"\r\n\t\t\terror_msg = \"Previous hash was #{f_info['prev_hash']}, should be 0\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telsif f_info['transaction'].length != 1\r\n\t\t\terror_msg = \"Transaction count for first block was #{f_info['transaction'].length}, should be 1\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telsif not validate_hash(f_info)\r\n\t\t\terror_msg = \"String #{f_info['original'].strip} hash set to #{f_info['self_hash'].strip}, should be #{get_hash(get_string_to_hash(f_info))}\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telse\t\t\t\r\n\t\t\t# updates the transaction logs\r\n\t\t\tsuccess, error_msg = update_billcoins(f_info)\r\n\t\t\t#error_msg = \"\" unless not success\r\n\t\t\treturn success, error_msg unless success\r\n\t\tend\r\n\r\n\t\treturn success, error_msg\r\n\tend",
"def test_summary_warnings_65\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"2\",\n \"1\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n\n #there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 0)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_summary_warnings_79\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n false,\n \"analyzeme.c\",\n \"file\",\n \"1\",\n \"3\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def all_pass_result_summary_msg\n if result_count < 1\n \"uhh...\"\n elsif result_count == 1\n \"pass\"\n else\n \"all pass\"\n end\n end",
"def validate_block(info, line_number)\r\n\t\terror_msg = \"\"\r\n\t\tsuccess = true\r\n\r\n\t\t# verifies the timestamps\r\n\t\tsuccess, error_msg = validate_timestamps(info)\r\n\t\treturn success, error_msg unless success\r\n\r\n\t\tif info['id'] != line_number\r\n\t\t\terror_msg = \"Invalid block number #{info['id']}, should be #{line_number}\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telsif info['prev_hash'].strip != @prev_hash.strip\r\n\t\t\terror_msg = \"Previous hash was #{info['prev_hash']}, should be #{@prev_hash}\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telsif not validate_hash(info)\r\n\t\t\terror_msg = \"String #{info['original'].strip} hash set to #{info['self_hash'].strip}, should be #{get_hash(get_string_to_hash(info))}\"\r\n\t\t\tsuccess = false\r\n\t\t\treturn success, error_msg\r\n\t\telse\r\n\t\t\t# updates the transaction logs\r\n\t\t\tsuccess, error_msg = update_billcoins(info)\r\n\t\t\t#error_msg = \"\" unless not success\r\n\t\t\treturn success, error_msg unless success\r\n\t\tend\r\n\r\n\t\treturn success, error_msg\r\n\tend",
"def display_results\r\n if @errors.empty?\r\n if @test_diff.empty?\r\n @out.puts \"Output matches exactly\"\r\n else\r\n @out.puts \"Test diff:\"\r\n @out.puts @test_diff\r\n end\r\n else\r\n @errors.each {|error| @out.puts error }\r\n end\r\n end",
"def process_ingest_errors(result, *records, **opt)\n\n # If there were no errors then indicate that all items succeeded.\n errors = ExecReport[result].error_table(**opt)\n return records, {} if errors.blank?\n\n # Otherwise, all items will be assumed to have failed.\n errors = errors.dup\n failed = {}\n\n # Errors associated with the position of the item in the request.\n by_index = errors.select { |idx| idx.is_a?(Integer) && records[idx-1] }\n if by_index.present?\n errors.except!(*by_index.keys)\n by_index.transform_keys! { |idx| manifest_item_id(records[idx-1]) }\n by_index.transform_values! { |msg| Array.wrap(msg) }\n failed.rmerge!(by_index)\n end\n\n # Errors associated with item submission ID.\n by_sid = errors.extract!(*records.map(&:submission_id))\n if by_sid.present?\n sid_id = records.map { |rec| [rec.submission_id, rec] }.to_h\n by_sid.transform_keys! { |sid| manifest_item_id(sid_id[sid]) }\n by_sid.transform_values! { |msg| Array.wrap(msg) }\n failed.rmerge!(by_sid)\n end\n\n # Remaining (general) errors indicate that there was a problem with the\n # request and that all items have failed.\n if errors.present?\n general = errors.values.presence || ['unknown error'] # TODO: I18n\n general = records.map { |rec| [manifest_item_id(rec), general] }.to_h\n failed.rmerge!(general)\n end\n\n return [], failed\n\n end",
"def failure_message\n if found.nil?\n found_count = 'none'\n found_string = nil\n else\n materialized_found = found.to_a\n found_count = \"#{materialized_found.length}:\"\n found_string = materialized_found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n end\n [\n \"expected #{expected_count || 'any number of'} jobs matching #{expected.to_s},\",\n \"found #{found_count}\",\n found_string,\n ].compact.join(' ')\n end",
"def print_audit_findings(failed_audit_checks, text, color, cat_count, last=false)\n\n\t\t\t\t# evaluate and start loop\n\t\t\t\tif failed_audit_checks.length > 0\n\t\t\t\t\tplugins = []\n\t\t\t\t\tseen_vuln_ids = []\n\t\t\t\t\tnumber = 1\n\t\t\t\t\tputs \"\\n[+] #{text}:\"\n\t\t\t\t\tputs \"-----\"\n\t\t\t\t\tputs \"- Raw Count: #{failed_audit_checks.length}\"\n\t\t\t\t\tputs \"- Unique: #{cat_count.to_s}\"\n\n\t\t\t\t\t# CAT Finding X title\n\t\t\t\t\ttitle text + \" (#{cat_count.to_s})\", 18, color\n\n\t\t\t\t\t# risk rating\n\t\t\t\t\trisk = \"\"\n\t\t\t\t\tcase text\n\t\t\t\t\twhen \"CAT I Findings\"\n\t\t\t\t\t\trisk = \"High\"\n\t\t\t\t\twhen \"CAT II Findings\"\n\t\t\t\t\t\trisk = \"Medium\"\n\t\t\t\t\twhen \"CAT III Findings\"\n\t\t\t\t\t\trisk = \"Low\"\n\t\t\t\t\tend\n\n\t\t\t\t\t# first iteration to snag plugin names\n\t\t\t\t\tfailed_audit_checks.each do |fc|\n\t\t\t\t\t\t# done to separate windows server and win 7 compliance checks as both are called \"Windows Compliance Checks\"\n\t\t\t\t\t\tcheck = [fc.plugin_name, fc.cm_compliance_audit_file]\n\t\t\t\t\t\tunless plugins.include?(check)\n\t\t\t\t\t\t\tplugins << check\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\n\t\t\t\t\t########## MAIN LOOP\n\n\t\t\t\t\t# for each unique plugin name we found\n\t\t\t\t\tplugins.each do |plugin|\n\t\t\t\t\t\t# let this wipe clean for each plugin\n\t\t\t\t\t\tplugin_data = {\n\t\t\t\t\t\t\t:audit_data => [],\n\t\t\t\t\t\t\t:tech_details => [],\n\t\t\t\t\t\t\t:hostlist => \"\",\n\t\t\t\t\t\t\t:control_nums => [],\n\t\t\t\t\t\t\t:audit_file => \"\"\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t#failed_checks is model collection (Item.where(:cm_compliance_result => \"FAILED\")\n\t\t\t\t\t\tfailed_audit_checks.each do |fc|\n\t\t\t\t\t\t\tprint \"Collecting failed #{plugin[0]} (#{plugin[1]})... \\r\"\n\t\t\t\t\t\t\tcheck = [fc.plugin_name, fc.cm_compliance_audit_file]\n\t\t\t\t\t\t\t# ensure we're only dealing with one plugin at a time\n\t\t\t\t\t\t\tif check != plugin\n\t\t\t\t\t\t\t\tnext\n\t\t\t\t\t\t\tend\n\n\n\t\t\t\t\t\t\t#@hosts = Item.where(:plugin_id => fc.plugin_id).group(:host_id)\n\n\t\t\t\t\t\t\t@hosts = Item.where(:cm_compliance_audit_file => fc.cm_compliance_audit_file).group(:host_id)\n\n\t\t\t\t\t\t\t# this is the magic to parse out the cat info\n\t\t\t\t\t\t\tcompliance_refs = Hash[fc.cm_compliance_reference.split(\",\").map {|el| el.split(\"|\")}]\n\t\t\t\t\t\t\t# {\"800-53\"=>\"IA-5\", \"CSF\"=>\"PR.AC-1\", \"ITSG-33\"=>\"IA-5\", \"800-171\"=>\"3.5.9\", \"CAT\"=>\"II\", \"CCI\"=>\"CCI-000366\", \"Group-ID\"=>\"V-63985\", \"Rule-ID\"=>\"SV-78475r1_rule\", \"STIG-ID\"=>\"VCWN-06-000024\\n\"}\n\n\t\t\t\t\t\t\t# Build a hash of all the info we want from the object\n\t\t\t\t\t\t\t# most of these keys are not being used but you should keep this mapping for later templates\n\t\t\t\t\t\t\taudit_data = {\n\t\t\t\t\t\t\t\t\"plugin_name\" => fc.plugin_name,\n\t\t\t\t\t\t\t\t\"description\" => fc.cm_compliance_info,\n\t\t\t\t\t\t\t\t\"check_name\" => fc.cm_compliance_check_name.split(\" - \")[1],\n\t\t\t\t\t\t\t\t\"nist_ref\" => compliance_refs[\"800-53\"],\n\t\t\t\t\t\t\t\t\"vuln_id\" => compliance_refs[\"Group-ID\"],\n\t\t\t\t\t\t\t\t\"cat_score\" => compliance_refs[\"CAT\"],\n\t\t\t\t\t\t\t\t\"solution\" => fc.cm_compliance_solution,\n\t\t\t\t\t\t\t\t\"see_also\" => fc.cm_compliance_see_also,\n\t\t\t\t\t\t\t\t\"audit_file\" => fc.cm_compliance_audit_file,\n\t\t\t\t\t\t\t\t\"tech_details\" => fc.cm_compliance_actual_value,\n\t\t\t\t\t\t\t\t}\n\n\n\t\t\t\t\t\t\t# bounces between Group-ID and Vuln-ID cuz stigs don't care about naming consistency :(\n\t\t\t\t\t\t\tif audit_data[\"vuln_id\"] == nil\n\t\t\t\t\t\t\t\taudit_data[\"vuln_id\"] = compliance_refs[\"Vuln-ID\"]\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# now let's deterimine if we've seen it before\n\t\t\t\t\t\t\tif seen_vuln_ids.include?(audit_data[\"vuln_id\"])\n\t\t\t\t\t\t\t\tnext # we've seen this vuln already, let's keep moving\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tseen_vuln_ids << audit_data[\"vuln_id\"]\n\t\t\t\t\t\t\t\tplugin_data[:audit_file] << audit_data[\"audit_file\"]\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# store our control numbers for organization in the report\n\t\t\t\t\t\t\tunless audit_data[\"nist_ref\"] == nil || plugin_data[:control_nums].include?(audit_data[\"nist_ref\"])\n\t\t\t\t\t\t\t\tplugin_data[:control_nums] << audit_data[\"nist_ref\"]\n\t\t\t\t\t\t\tend\n\n\n\t\t\t\t\t\t\t# Our data has passed the test. Now append our table data to our plugins hash\n\t\t\t\t\t\t\tplugin_data[:tech_details] << [\"\", audit_data[\"vuln_id\"], audit_data[\"check_name\"], audit_data[\"tech_details\"]]\n\t\t\t\t\t\t\t# comment out the line above and uncomment the one below if you need additional details for findings\n\t\t\t\t\t\t\t# plugin_data[:tech_details] << [\"\", audit_data[\"vuln_id\"], fc.cm_compliance_info, fc.cm_compliance_solution]\n\t\t\t\t\t\t\t####################\n\n\t\t\t\t\t\t\thosts_to_scans = Hash.new []\n\t\t\t\t\t\t\t@hosts.each do |host|\n\t\t\t\t\t\t\t\tho = Host.find_by_id(host.host_id)\n\t\t\t\t\t\t\t\tscan = Report.find_by_id(ho.report_id).name\n\n\t\t\t\t\t\t\t\tif hosts_to_scans.has_key?(scan)\n\t\t\t\t\t\t\t\t\thosts_to_scans[scan] += [ho.ip]\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\thosts_to_scans[scan] = []\n\t\t\t\t\t\t\t\t\thosts_to_scans[scan] += [ho.ip]\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\thosts_to_scans.each do |scan, ips|\n\t\t\t\t\t\t\t\t# call our \"to_ranges\" function against our host list\n\t\t\t\t\t\t\t\tunless plugin_data[:hostlist].include?(scan)\n\t\t\t\t\t\t\t\t\tplugin_data[:hostlist] << \"#{scan}: (#{to_ranges(hosts_to_scans[scan]).join(', ')})\\n\"\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\tend # fc for end\n\n\t\t\t\t\t\toutput.font_size(16) do\n\t\t\t\t\t\t\ttext \"#{plugin[0]}\\n(#{plugin[1]})\"\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttext \"Hosts (#{@hosts.length})\", :style => :bold\n\t\t\t\t\t\ttext \"\\n\"\n\n\t\t\t\t\t\trelease = plugin_data[:audit_file].split(\"DISA_STIG_\")[1].split(\".audit\")[0].split(\"_\")[-1].downcase().split(\"r\")[1]\n\n\t\t\t\t\t\tstock_description = \"The baseline configuration of the #{plugin[0].split(\"Compliance\")[0].strip()} installations are not fully\n\t\t\t\t\t\thardened and secured based on the DISA STIG baseline standard. The\n\t\t\t\t\t\tinstallations are deployed with configurations that are lacking in\n\t\t\t\t\t\t[DESCRIBE FINDINGS, ex. audit protection, backup configuration, etc].\"\n\n\t\t\t\t\t\tstock_recommendation = \"Configure the #{plugin[0].split(\"Compliance\")[0].strip()} installations in accordance\n\t\t\t\t\t\twith the #{plugin_data[:audit_file].split(\"DISA_STIG_\")[1].split(\".audit\")[0].split(\"_\")[0..-2].join(\" \")} Security Technical Implementation Guide: Release: #{release}, Benchmark Date: [dd mm yyyy].\"\n\n\t\t\t\t\t\tstock_tech_details = \"This was found during an automated STIG audit review using the #{plugin_data[:audit_file].split(\"DISA_STIG_\")[1].split(\".audit\")[0].split(\"_\")[0..-2].join(\" \")}\n\t\t\t\t\t\tSecurity Technical Implementation Guide: Release: #{release}.\\n\n\t\t\t\t\t\tThe Table below shows the STIG CAT level, Vuln ID, Rule Title, and SAT Comments for the open finding(s).\\n\\n\"\n\n\t\t\t\t\t\tstock_impact = \"#{risk}: Not fully establishing and configuring systems according to a secure baseline\n\t\t\t\t\t\tstandard can place the platform, data, and connected systems at risk. Impact is rated at a #{risk} level based on #{text.split(\"Findings\")[0].strip()} STIG categorizations.\"\n\n\t\t\t\t\t\tstock_exploitability = \"#{risk}: Attackers may take advantage of a variety of configuration shortcomings when\n\t\t\t\t\t\ta system is not configured to a secure baseline. Attacks against #{plugin[0].split(\"Compliance\")[0].strip()} installations\n\t\t\t\t\t\tcould be attempted by an insider threat on the local network.\"\n\n\t\t\t\t\t\t# classifcation marker\n\t\t\t\t\t\ttext \"#{Report.classification.upcase}\"\n\t\t\t\t\t\tprint \"Writing failed #{plugin[0]} (#{plugin[1]}) to report... \\r\"\n\t\t\t\t\t\t# table for our findings. It's a loop because of prawn formatting.\n\t\t\t\t\t\toutput.table([\n\t\t\t\t\t\t\t\t[\"#{risk}\\n\\n\", \"(#{Report.classification.upcase}) #{Report.network.upcase}-#{risk[0]}-0#{number}: #{plugin[0]}\"],\n\t\t\t\t\t\t\t\t[\"NIST Security Control Number\", \"CM-6\"],\n\t\t\t\t\t\t\t\t[\"Description\", stock_description],\n\t\t\t\t\t\t\t\t[\"Affected Scope\", plugin_data[:hostlist]],\n\t\t\t\t\t\t\t\t[\"Impact\", stock_impact],\n\t\t\t\t\t\t\t\t[\"Exploitability\", stock_exploitability],\n\t\t\t\t\t\t\t\t[\"Recommendations\", stock_recommendation],\n\t\t\t\t\t\t\t\t[\"Technical Details\", stock_tech_details],\n\t\t\t\t\t\t\t], :width => 530, :column_widths => { 0 => 100, 1 => 430}) do\n\t\t\t\t\t\t\t### keep this for actual record of control numbers\n\t\t\t\t\t\t\t# [\"NIST Security Control Number\", plugin_data[:control_nums].uniq.join(\", \")]\n\t\t\t\t\t\t\tcolumn(0).style(:background_color => 'f2f3f4' ) # gray\n\t\t\t\t\t\t\trow(0).style(:font_style => :bold, :background_color => color.split(\"#\")[1])\n\t\t\t\t\t\t\tcells.borders = [:top, :bottom, :left, :right]\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# cont. of Tech details because having issues putting a table in a table with width formatting;\n\t\t\t\t\t\t# we use this as a header because we want to sort our vuln ids from lowest to highest\n\t\t\t\t\t\toutput.table([[\"\", \"Vuln ID\", \"Rule Title\", \"Comments\"]], :width => 530, :column_widths => [100, 75, 155, 200]) do\n\t\t\t\t\t\t\tcolumn(0).style(:background_color => 'f2f3f4' )\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# our actual tech details\n\t\t\t\t\t\toutput.table(plugin_data[:tech_details].sort(), :width => 530, :column_widths => [100, 75, 155, 200]) do\n\t\t\t\t\t\t\tcolumn(0).style(:background_color => 'f2f3f4' )\n\t\t\t\t\t\tend\n\t\t\t\t\t\t# our table number\n\t\t\t\t\t\toutput.table([[\"(#{Report.classification.upcase}) Table #{@@table_number} - #{plugin[0]} #{text.split(\"Findings\")[0].strip()} Findings\"]], :width => 530, :column_widths => [530]) do\n\t\t\t\t\t\t\tcells.style(:font_style => :bold, :align => :center)\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttext \"\\n\\n\\n\"\n\t\t\t\t\t\tprintf(\"%-10s %10s\\n\", \"Writing failed #{plugin[0]} (#{plugin[1]}) to report...\", \"[DONE]\")\n\t\t\t\t\t\t@output.start_new_page if last == false\n\t\t\t\t\t\tnumber += 1\n\t\t\t\t\t\t@@table_number += 1\n\t\t\t\t\tend # plugins for end\n\t\t\t\tend #if end\n\t\t\tend",
"def puts_failure_data header:, additional_info: []\n break_after_print\n checked_puts header + @messages.join(SEPERATOR)\n\n additional_info.each.with_index do |text, index|\n checked_puts indent(text, index + 1)\n end\n end",
"def test_summary_warnings_68\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"2\",\n \"2\",\n \"0288\",\n \"status\",\n \"ASC\",\n \"1\")\n\n #there are 1diff_warning in this list\n assert_equal(diff_warnings.size, 0)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def on_fail( &block )\n @on_fail_blocks ||= []\n @on_fail_blocks << block\n end",
"def set_up_split_listing_failure_test(exception)\n build = BrewBuild.find_by_nvr!('autotrace-0.31.1-26.el6')\n pv = ProductVersion.find_by_name!('RHEL-6')\n\n ProductListingCache.where(:brew_build_id => build).where('product_version_id = ?', pv).delete_all\n\n expect_call_and_raise = lambda do |label|\n Brew.any_instance.expects(:getProductListings).once.\n with(label, build.id).\n raises(exception)\n end\n\n expect_call_and_succeed = lambda do |label|\n Brew.any_instance.expects(:getProductListings).once.\n with(label, build.id).\n returns({label.gsub(/^RHEL-6-/, '') => {\n 'autotrace-0.31.1-26.el6' => {\n 'x86_64' => ['x86_64']}}})\n end\n\n expect_no_call = lambda do |label|\n Brew.any_instance.expects(:getProductListings).with(label, build.id).never\n end\n\n %w[\n RHEL-6-Client\n RHEL-6-ComputeNode\n ].each(&expect_call_and_succeed)\n\n %w[\n RHEL-6-Server\n ].each(&expect_call_and_raise)\n\n # Since server failed, it should stop before workstation\n %w[\n RHEL-6-Workstation\n ].each(&expect_no_call)\n\n [build, pv]\n end",
"def print_invalid_businesses\n puts \"==================================================\"\n puts \"========== Malformed Business Records ============\"\n puts \"==================================================\"\n\n @bad_business_records.each do |rec|\n rec.output\n puts \"\"\n end\n end",
"def test_summary_warnings_108\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.warning_difference_filter(1,\n \"list\",\n \"1\",\n \"3\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n #there are 15 diff_warning in this list\n assert_equal(diff_warnings.size, DiffWarning.per_page)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_summary_warnings_53\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"2\",\n \"1\",\n \"3\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n # there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 3)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_mult_pids\n # NOTE: If this test is failing, make sure your IDE did not strip off trailing space on the two 'D' lines below\n str =<<-EOS\nI 2016-05-13T16:06:02.702771 [19893,,16c,2,6435] : Parameters: {\"flash\"=>\"false\"}\nI 2016-05-13T16:06:02.705831 [19893,,16c,3,58fb] : Completed 200 OK in 3ms (Views: 0.4ms | ActiveRecord: 0.0ms)\nD 2016-05-13T16:06:03.193366 [19892,,d84,5,f82f] : \nD 2016-05-13T16:06:03.193544 [19892,,d84,6,9b54] : \nI 2016-05-13T16:06:03.193710 [19892,,d84,7,3e40] : Started GET \"/\" for ::1 at 2016-05-13 16:06:03 -0500\nEOS\n parser = ChainLog::Parser.new\n str.split(\"\\n\").each { |line|\n entry = parser.parse_and_validate_line line\n assert !entry.nil?, \"Parse error on line #{line}\"\n assert !entry.hash_chain_broken? ,\"Invalid chain on line #{line}\"\n }\n end",
"def fail\n @counts.fails += 1\n puts_failure_data(header: FAIL_HEADER)\n end",
"def test_check_second_bad_address\n assert_raises SystemExit do\n assert_output 'Line 1: Invalid address 1234567\\nBLOCKCHAIN INVALID' do\n add = %w[123456 1234567]\n line_num = 1\n @verify.check_addresses(add, line_num)\n end\n end\n end",
"def test_summary_warnings_75\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"1\",\n \"2\",\n \"2209\",\n \"status\",\n \"ASC\",\n \"1\")\n\n #there are 4 diff_warning in this list\n assert_equal(diff_warnings.size, 1)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_summary_warnings_92\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.warning_difference_filter(nil,\n \"list\",\n \"1\",\n \"3\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n # there are 15 diff_warning in this list\n assert_equal(diff_warnings.size, DiffWarning.per_page)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def report\n\t\t\tputs \"Tests: #{@ok} ok, #{@fail} failures.\"\n\t\t\tif (@fail > 0)\n\t\t\t\tputs \"*** THERE WERE FAILURES *** \"\n\t\t\telse \n\t\t\t\tputs \"*** ALL TESTS PASSED ***\"\n\t\t\tend\n\t\tend",
"def error_message\n if nagios_mode?\n puts \"CRIT: #{invalid_metadata_files.size} metadata files and #{invalid_packages.size} packages with invalid checksums\"\n else\n invalid_metadata_files.each do |metadata|\n msg metadata.explain_error\n end\n invalid_packages.each do |pkg|\n msg pkg.explain_error\n end\n end\n end",
"def output_results(test_results)\n total_tests = test_results.size\n total_assertions = 0\n total_failures = 0\n total_errors = 0\n\n test_results.each do |test_result|\n if test_result.status == \"allow_failure\"\n output_stdout(\"Test #{test_result.name} was allowed to fail, and failed\\n\")\n elsif test_result.status == \"allow_success\"\n output_stdout(\"Test #{test_result.name} was allowed to fail, but succeeded\\n\")\n end\n total_assertions += test_result.assertion_count\n if not test_result.passed?\n total_failures += test_result.failures.size\n total_errors += test_result.errors.size\n faults = test_result.failures + test_result.errors\n faults.each_with_index do |fault, index|\n output_stdout(\"\\n%3d) %s\\n\" % [index + 1, fault.long_desc])\n end\n test_result.coredumps.each do |hostname, corelist|\n output_stdout(\"Coredumps on host #{hostname}:\\n\")\n corelist.each {|core| output_stdout(core.corefilename)}\n output_stdout(\"Binaries and corefiles saved in #{hostname}:#{corelist.first.coredir}\\n\")\n end\n end\n end\n output_stdout(\"In all: #{total_tests} Tests, #{total_assertions} Assertions, #{total_failures} Failures, #{total_errors} Errors.\\n\")\n end",
"def test_summary_warnings_66\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"2\",\n \"2\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n\n #there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 0)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def execute_all &decision\n @result = nil\n @exception = nil\n\n @test_lines.each do |line|\n break if execute_line line, &decision\n end\n unless @exception\n #puts \"=> \" + @result.inspect\n end\n end",
"def report(result_set)\n print '.' and return if result_set.success?\n\n puts\n files = Hash.new { |h, k| h[k] = File.readlines(k) }\n result_set.each do |result|\n file = files[result.filename]\n node = result.node\n puts \"#{result.filename}:#{node.line}\"\n puts \"#{node.line-1}: #{file[node.line - 2]}\" if file[node.line - 2] && !(node.line - 2).negative?\n puts \"#{node.line}: #{file[node.line - 1]}\"\n puts \"#{node.line+1}: #{file[node.line]}\" if file[node.line]\n puts '-' * 16\n end\n puts\n end",
"def dump_all\n puts \"----------------------------------------------------------------------\"\n puts \" AUDIT ID: #{self.id}\\t\\t\\tDESIGN: #{self.design.directory_name}\"\n puts \" DESIGN CHECKS: #{self.design_checks.size.to_s}\"\n puts \" SELF COMPLETE: #{self.designer_complete?.to_s} \" +\n \" #{self.designer_completed_checks.to_s} (#{self.self_percent_complete.to_s}%)\\t\\t\" +\n \" PEER COMPLETE: #{self.auditor_complete?.to_s} \" +\n \" #{self.auditor_completed_checks.to_s} (#{self.peer_percent_complete.to_s}%)\"\n puts \"----------------------------------------------------------------------\"\n\n self.design_checks.each do |design_check|\n printf(\" DESIGN CHECK ID: %5d\\n\", design_check.id)\n printf(\" Self Auditor: %25s Result: %10s At: %25s\\n\",\n User.find(design_check.designer_id).name,\n design_check.designer_result,\n design_check.designer_checked_on.format_dd_mm_yy_at_timestamp.to_s) if design_check.designer_id > 0\n printf(\" Peer Auditor: %25s Result: %10s At: %25s\\n\",\n User.find(design_check.auditor_id).name,\n design_check.auditor_result,\n design_check.auditor_checked_on.format_dd_mm_yy_at_timestamp.to_s) if design_check.auditor_id > 0\n end\n \n puts \"----------------------------------------------------------------------\"\n end",
"def each_successful_run\n each_log_line do |(timestamp, rest)|\n if host=parse_last_run(rest)\n yield [timestamp, host]\n end\n end\n end",
"def test_check_bad_prev_hash\n assert_raises SystemExit do\n assert_output 'Line 1: Previous hash was 1, should be 0\\nBLOCKCHAIN INVALID' do\n p_hash = '0'\n line_num = '1'\n block_p_hash = ['1']\n hash = '1'\n @verify.check_prev_hash(p_hash, block_p_hash, hash, line_num)\n end\n end\n end",
"def test_summary_warnings_04\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"1\",\n \"3\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n # there are 15 diff_warning in this list\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_summary_warnings_72\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"1\",\n \"1\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n #there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 3)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def generate_failure_or_error_line(array_details, arr_index)\n html_details = \"<tr style='background-color: #ffdddd; color: #770000;'><td align='center'><img src='images/exclamation.png'/></td><td>\"\n array_details[arr_index].delete_at(0)\n if arr_index == index\n 4.times do |index|\n array_details[arr_index].delete_at(array_details[arr_index].length - 1)\n end\n end\n file_path = array_details[arr_index][array_details[arr_index].length - 2]\n file_path.slice!((file_path.length - 1)..(file_path.length))\n failure_file_details = file_path.split(/:/)\n unless file_path.match(/\\.\\/spec\\//).nil?\n failure_file_details[0].slice!(0..2)\n file_link = generate_link(failure_file_details, file_path)\n array_details[arr_index].delete_at(array_details[arr_index].length - 2)\n else\n file_link = \"\"\n end\n html_details << \"#{file_link}<pre>#{CGI::escapeHTML(array_details[arr_index].to_s.sanitize_from_terminal_to_html)}</pre></td></tr>\"\n return html_details, array_details\n end",
"def check_result_has_summary(li_arr)\n puts \"#{@@info_indicate} start checking summaries(long, medium, short)\"\n li_arr.each do |li|\n assert_not_nil(get_summary_long(li),\"#{@warning_indicate} Could not find summary long\")\n assert_not_nil(get_summary_medium(li),\"#{@warning_indicate} Could not find summary medium\")\n assert_not_nil(get_summary_short(li),\"#{@warning_indicate} Could not find summary short\")\n end\n end",
"def test_summary_warnings_78\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"1\",\n \"3\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n #there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 3)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def generate_fail_message(results)\n msg = fail_message.dup\n unless results.empty?\n failed_items = results.map do |item|\n f_item = item[:failures]\n next if f_item.nil? || f_item == true || f_item == false\n f_item\n end.flatten.compact.map(&:to_s)\n unless failed_items.empty?\n msg = \"#{msg} (failures: `#{failed_items.join(\"`, `\")}`)\"\n end\n end\n msg\n end",
"def errors(errors)\n output \"Errors Loading Players\"\n output \"======================\"\n \n errors.each do |error|\n output \"* #{error}\"\n end\n output \"* No errors to report :o)\" if errors.empty?\n \n blank_line\n end",
"def test_failed(array)\n last_item = array.length - 1\n test_name = array[last_item - 2]\n reason = array[last_item].chomp + ' at line: ' + array[last_item - 3]\n test_suite_verify(array[@class_name])\n printf \"%-40s FAILED\\n\", test_name\n\n if test_name.start_with? 'TEST('\n array2 = test_name.split(' ')\n @test_suite = array2[0].sub('TEST(', '')\n @test_suite = @test_suite.sub(',', '')\n test_name = array2[1].sub(')', '')\n end\n\n return unless @xml_out\n\n @array_list.push ' <testcase classname=\"' + @test_suite + '\" name=\"' + test_name + '\">'\n @array_list.push ' <failure type=\"ASSERT FAILED\"> ' + reason + ' </failure>'\n @array_list.push ' </testcase>'\n end",
"def test_on_error_multi\n\n pdef = Ruote.define do\n sequence :on_error => [\n [ /unknown participant/, 'alpha' ],\n [ nil, 'bravo' ]\n ] do\n nada\n end\n end\n\n @dashboard.register_participant /alpha|bravo/ do |workitem|\n tracer << workitem.participant_name\n end\n\n wfid = @dashboard.launch(pdef)\n @dashboard.wait_for(wfid)\n\n assert_equal 'alpha', @tracer.to_s\n end",
"def long_display\n location_display = if(location.size == 1)\n location[0].sub(/\\A(.+:\\d+).*/, ' [\\\\1]')\n else\n \"\\n [#{location.join(\"\\n \")}]\"\n end\n [\n \"Failure\".yellow.bold, \n \":\\n\",\"#@test_name\".white, \n \"#{location_display}\".gsub(/:(\\d+)/, \":#{'\\1'.yellow}\"), \n \":\\n\", \"#@message\".yellow\n ].join('')\n end",
"def find_fail_keys(contents)\n keys = []\n contents.map do |line|\n line.scan(/(fail|raise)\\s+([A-Z]\\w+)\\,\\s+\\:(\\w+)/).each do |m|\n keys << m[1..2].map(&:underscore).join('.')\n end\n end\n keys.uniq\n end",
"def print_summary(products_with_errors)\n info_and_log(\"\\n--------\\nSUMMARY:\\n\")\n @products.sort.each do |product|\n result = products_with_errors.include?(product) ? '-' : '+'\n info_and_log(\" #{product}: #{result}\")\n end\n end",
"def test_summary_warnings_56\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"3\",\n \"1\",\n \"1\",\n nil,\n \"status\",\n \"ASC\",\n \"1\")\n # there are 6 diff_warning in this list\n assert_equal(3, diff_warnings.size)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert_equal(1, diff_warning.diff_file_id)\n end\n end",
"def perform_action(message, multiline, on_fail_msg, abort_on_fail)\n line = \"#{message}... \"\n endline = \"...#{message} \"\n if multiline\n puts line\n else\n print line\n end\n result = yield\n mark = result ? \"✓\" : \"✗\"\n # if multline, put checkmark at full width\n print endline if multiline\n puts mark.rjust(WIDTH - line.length, \" \")\n unless result\n puts on_fail_msg unless on_fail_msg.nil?\n @failure_count += 1\n # print out error messaging here if we've captured it\n terminate if abort_on_fail\n end\n result\nend",
"def test_summary_warnings_87\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(1,\n false,\n \"analyzeme.c\",\n \"file\",\n \"1\",\n \"2\",\n \"1\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n\n #there are 15 diff_warning in this list\n assert_equal(diff_warnings.size, 0)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_check_num\n assert_raises SystemExit do\n assert_output 'Line 2: Invalid block number 1, should be 2\\nBLOCKCHAIN INVALID' do\n block_no = '1'\n line_no = '2'\n @verify.check_num(block_no, line_no)\n end\n end\n end",
"def report_check_run_failure\n data = params\n check_run = data[:check_run]\n check_run_status = check_run[:status]\n sha = check_run[:head_sha]\n workflow_name = check_run[:name]\n conclusion = check_run[:conclusion]\n check_run_url = check_run[:html_url]\n check_suite = check_run[:check_suite]\n app_name = check_run[:app][:name]\n details_url = check_run[:details_url]\n pull_requests = check_suite[:pull_requests]\n pull_request = pull_requests[0]\n branch = check_suite[:head_branch]\n repository = data[:repository]\n repo_name = repository[:name]\n repo_url = repository[:html_url]\n sender_login = data[:sender][:login]\n pr_number = pull_request[:number] if pull_request.present?\n branch_path = ''\n branch_path = \"/tree/#{branch}\" if branch != 'master'\n\n # We are only interested in completed non-success\n return if check_run_status != 'completed' || conclusion == 'success'\n\n message = \"[ [#{repo_name}](#{repo_url}) ]\"\n message += if app_name == 'GitHub Actions'\n \" GitHub Action workflow [#{workflow_name}](#{check_run_url}):\"\n else\n \" Check run [#{workflow_name}](#{check_run_url}):\"\n end\n message += if pull_request.present?\n \" [#{conclusion}](#{repo_url}/pull/#{pr_number}/checks?sha=#{sha})\"\n else\n \" [#{conclusion}](#{details_url})\"\n end\n message += \" on [#{sha.first(7)}](#{repo_url}/commit/#{sha.first(10)})\"\n message += \" by #{sender_login}\" if sender_login.present?\n message += \" in the [#{branch}](#{repo_url}#{branch_path}) branch\" if branch.present?\n message += \" for [PR ##{pr_number}](#{repo_url}/pull/#{pr_number})\" if pull_request.present?\n\n # We don't want to send more than one message for this workflow & sha with the same conclusion within 20 minutes.\n # This counter expires from Redis in 20 minutes.\n ci_counter = Redis::CI.new(\"check_run_#{workflow_name}_#{conclusion}_#{sha}\")\n ci_counter.sucess_count_incr\n ActionCable.server.broadcast 'smokedetector_messages', message: message if ci_counter.sucess_count == 1\n end",
"def run_errored_command(broker, targets, command)\n run_command(broker, targets, command,\n blocking_request: true,\n expected_response_type: \"http://puppetlabs.com/rpc_error_message\") do |response_dataset|\n response_dataset.each { |data| yield data['description'] } if block_given?\n end\nend",
"def do_it\n\t\tif @type == \"multiple_answer_error\"\n\t\t\tthen puts \"Error: Item #{@holder} raised #{@type} in #{@method}\"\n\t\telsif @type == \"not_found_error\"\n\t\t\tthen puts \"Error: #{@holder} was #{@type} in #{@method}\"\n\t\telse puts \"Error: Have been given an unknown error type: #{@type}\"\n\t\tend\n\tend",
"def failure_message\n +\"expected to find #{description}\" << count_message\n end",
"def each_notice(&block)\n while true\n string, structure = next_notice(&block)\n break unless string\n end\n end",
"def test_ut_diff_warning_02\n assert_equal 2,@diff_warning.diff_status_id\n assert_equal 1,@diff_warning.diff_file_id\n assert_equal 1,@diff_warning.rule_set\n assert_equal 1,@diff_warning.warning_id\n assert_equal 1,@diff_warning.original_file_id\n end",
"def error_chunks(text) \n text.split(/^$/).select(){ |block| block =~ /^(\\d+)\\t([^\\t]+)\\t([^\\t]+)\\t(.+)$/ }\nend",
"def show_failure\n failed_commands = Cache.instance[\"failed_commands\"]\n failed_commands.each_with_index do |command, i|\n Ansi.write($stdout, :red, \"Failed command (#{i + 1}/#{failed_commands.size}):\", :reset, \"\\n\")\n $stdout.puts Util.command_to_s(command)\n end\n end",
"def basic_status_and_output(messages); end",
"def test_summary_warnings_39\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"2\",\n \"3\",\n \"3\",\n \"analyzeme.c\",\n \"status\",\n \"ASC\",\n \"1\")\n\n # there are 6 diff_warning in this list\n assert_equal(diff_warnings.size, 0)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def test_summary_warnings_36\n @dir = \"sample_c/src\"\n # gets a list of diff_warning from database\n diff_warnings = DiffWarning.summary_warnings(nil,\n @dir,\n false,\n \"dir\",\n \"2\",\n \"3\",\n \"2\",\n \"****\",\n \"status\",\n \"ASC\",\n \"1\")\n\n # there are 6 diff_warning in this list\n assert(0, diff_warnings.size)\n # all these warnings belong to analysis results of a diff_result (id = 1)\n diff_warnings.each do |diff_warning|\n assert(1 == diff_warning.diff_file_id)\n end\n end",
"def print_known_cidr_blks\n\t\tputs \"Print the known CIDR Netblocks in ascendant order\" if @verbose\n\t\tputs \"Network CIDR, RIPE Reference Text, NETNAME\"\n\t\t@known_cidr_blks_asce_index.map do |key|\n\t\t\tref=@known_cidr_blks[key]['ref']\n\t\t\tnetname=@known_cidr_blks[key]['netname']\n\t\t\tputs \"#{key}, #{ref}, #{netname}\"\n\t\tend\n\t\tputs \"End of the summary\"\n\tend",
"def negative_failure_message\n return '' if found.nil? || found == []\n\n found_count = found.length\n found_string = found.map {|job| strategy.pretty_print_job(job) }.join(\"\\n\")\n if expected_count?\n job_count = expected_count\n job_word = expected_count == 1 ? 'job' : 'jobs'\n else\n job_count = 'any'\n job_word = 'jobs'\n end\n return [\n \"did not expect #{job_count} #{job_word} matching #{expected.to_s},\",\n \"found #{found_count}:\",\n found_string,\n ].join(' ')\n end",
"def check_users\n dups = valids = invalid_format = total = 0\n @summary = '<ol>'\n each_user_line(params[:users_to_add]) do |line|\n total += 1\n (status, email, first_name, last_name) = check_new_user(line)\n case status\n when 'already_exists'\n line_out = \"email: #{email} already exists in the system, won't be added, but may add new roles.\"\n dups += 1\n when 'invalid_format'\n line_out = \"#{line} Unrecognized format, won't be added\"\n invalid_format += 1\n when 'good'\n line_out = \"email-(#{email}) first_name-(#{first_name}) last_name-(#{last_name})\"\n valids += 1\n end\n\t\n @summary += '<li>' + line_out + '</li>'\n end\n @summary += '</ol>'\n \n @summary = \"<p>Out of #{total} users to add: #{valids} are valid, #{dups} already exist, and #{invalid_format} are in the wrong format.</p>\" + @summary\n render :update do |page|\n page.replace_html :summary, \"<h2>Summary</h2>\" + @summary\n end\n\n end",
"def ensure_successful(broker, targets, response_dataset, max_retries: 30, query_interval: 1)\n transaction_ids = response_dataset.map { |data| data['transaction_id'] }\n agent_identities(targets).zip(transaction_ids).map do |identity, transaction_id|\n check_non_blocking_response(broker, identity, transaction_id, max_retries, query_interval) do |result|\n assert_equal('success', result['status'], 'Action was expected to succeed')\n assert_nil(result['stderr'], 'Successful action expected to have no output on stderr')\n assert_equal(0, result['exitcode'], 'Successful action expected to have exit code 0')\n yield result['stdout'] if block_given?\n end\n end\nend"
] |
[
"0.6025213",
"0.5931905",
"0.59062314",
"0.58988017",
"0.5816392",
"0.57000244",
"0.56740606",
"0.56740606",
"0.566949",
"0.5634256",
"0.5603858",
"0.5530434",
"0.5529261",
"0.5500961",
"0.5486108",
"0.54777855",
"0.5447047",
"0.54027534",
"0.5400522",
"0.5374856",
"0.5364118",
"0.5353203",
"0.534955",
"0.533349",
"0.5323513",
"0.5323513",
"0.5323513",
"0.5308503",
"0.5308444",
"0.5302545",
"0.529295",
"0.52765334",
"0.5270985",
"0.5265437",
"0.5262567",
"0.5258319",
"0.52534485",
"0.5253346",
"0.52351105",
"0.5234329",
"0.523399",
"0.52186227",
"0.52181464",
"0.5216571",
"0.5215848",
"0.52088815",
"0.51966757",
"0.5194944",
"0.51805097",
"0.51767135",
"0.51714075",
"0.5150614",
"0.51498365",
"0.5146678",
"0.5146444",
"0.5144789",
"0.51435804",
"0.5139633",
"0.512534",
"0.5123992",
"0.51211375",
"0.5116904",
"0.5106829",
"0.5104444",
"0.51024204",
"0.5096947",
"0.5093453",
"0.5089529",
"0.50869787",
"0.50857615",
"0.5084831",
"0.5084193",
"0.5082109",
"0.5081305",
"0.5081266",
"0.50795835",
"0.50761163",
"0.506709",
"0.50647414",
"0.5064088",
"0.5062003",
"0.5058741",
"0.5055687",
"0.50538886",
"0.50510234",
"0.5044104",
"0.5039656",
"0.50393176",
"0.5039066",
"0.5037973",
"0.5037864",
"0.50367874",
"0.5032392",
"0.50311273",
"0.502558",
"0.5023506",
"0.5019174",
"0.50161546",
"0.50148886",
"0.50132334"
] |
0.602597
|
0
|
Logs in the user
|
def login(username, password)
db = connect_db("db/webshop.db")
params = [username, password]
is_valid(params)
result = db.execute("SELECT * FROM users WHERE username=?", username).first
if result != nil
password_digest = result["password_digest"]
id = result["id"]
if BCrypt::Password.new(password_digest) == password
session[:user] = username
session[:id] = id
redirect('/elever')
else
session[:error] = "Fel lösenord eller användarnamn. Försök igen."
redirect('/error')
end
else
session[:error] = "Fel lösenord eller användarnamn. Försök igen."
redirect('/error')
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def login\n\t\tif @current_user != nil\n\t\t\tredirect_to user_path(@current_user.id)\n\t\tend\n\tend",
"def sign_in(user)\n login_as user\n end",
"def login\n make_login_call\n end",
"def login\n end",
"def log_in\n end",
"def user_login(user)\n click_log_in\n fill_login_credentials(user)\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login\n end",
"def login(user=:joerg)\r\n login_as(user)\r\n end",
"def login\n @current_user = nil\n system 'clear'\n puts \"--------LOGIN--------\"\n username = @prompt.ask(\"Username: \", required: true)\n if User.all.map(&:name).include?(username)\n @current_user = User.all.find{|user_instance| user_instance.name == username}\n if password\n main_menu\n end\n else\n if @prompt.yes?(\"There is no user by this name. Would you like to create an account?\")\n create_account\n end\n end\n end",
"def login\n\n end",
"def login\n\n end",
"def log_in\n @user = User.new\n end",
"def login\n self.login\n end",
"def login\n\t\tuser = User.authenticate(params[:username],params[:password])\n\t\tif user\n\t\t\tsession[:current_user_id] = user.id\n\t\t\tflash[:notice] = \"logged in\"\n\t\t\tredirect_to '/home'\n\t\telse\n\t\t\tflash[:notice] = \"Wrong username/password\"\n\t\t\tredirect_to '/index'\n\t\tend\n\tend",
"def logging_in \n @user = User.find(current_user.id)\n sign_in @user\n\n redirect_to after_sign_in_path_for(@user)\n end",
"def login_user\n puts \"Please enter your name\"\n name = CLI.gets_with_quit\n\n if self.user_exists(name)\n user = self.find_user(name)\n if check_password(user)\n CLI.active_user = user\n # fall through to CLI.start\n else\n CLI.start\n end\n\n else\n puts \"Sorry, User not found!\"\n if CLI.yes_no(\"Sign Up\")\n self.signup_user(name)\n else\n CLI.start\n end\n end\n end",
"def login\n\tend",
"def login_as(user)\n login(users(user).email, users(user).password)\n end",
"def login_admin_anna\n user = User.find_by(name: \"Anna\")\n log_in(user)\n end",
"def log_in\n visit \"/gp/login.do\"\n fill_in \"id\", :with => @user\n fill_in \"clave\", :with => @password\n first(\".bLogin a\").click\n end",
"def login\n\n username = prompt.ask(\"Enter your username:\\n\")\n while !User.find_by(username: username)\n puts \"Username not found - please try again.\\n\"\n username = prompt.ask(\"Enter your username:\\n\")\n end\n\n password = prompt.mask(\"Enter your password:\")\n while User.find_by(username: username).password != password\n puts \"Invalid password - please try again.\"\n password = prompt.mask(\"Enter your password:\")\n end\n \n self.user_id = User.find_by(username: username).id\n puts \"Successfully logged in! Welcome #{User.return_username(user_id)}!\\n\"\n\n show_threads\n end",
"def logged_in_user\n unless logged_in?\n redirect_to login_url, flash: { danger: 'Por favor, faça login' }\n end\n end",
"def log_in_as(user)\n puts 'logging in!!'\n session[:name] = user.name\n end",
"def logging_in\n \t\t\n \tend",
"def login(username, password)\n self.username.set username\n self.password.set password\n log_in.click\n end",
"def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"def login\r\n if request.get?\r\n # Logout user\r\n self.logged_in_user = nil\r\n else\r\n # Authenticate user\r\n user = User.try_to_login(params[:login], params[:password])\r\n if user\r\n self.logged_in_user = user\r\n # user.update_attribute(:ip_last, request.remote_ip)\r\n journal(\"log_in\",user.id)\r\n # generate a key and set cookie if autologin\r\n if params[:autologin] && Setting.autologin?\r\n token = Token.create(:user => user, :action => 'autologin')\r\n cookies[:autologin] = { :value => token.value, :expires => 1.year.from_now }\r\n end\r\n puts \"aqui\"\r\n if user.show? \r\n puts \"1\"\r\n redirect_back_or_default :controller => 'my', :action => 'athletes'\r\n else \r\n puts \"2\" \r\n redirect_back_or_default :controller => 'my', :action => 'page'\r\n end\r\n else\r\n # if user.locked?\r\n # flash.now[:notice] = l(:status_locked)\r\n # else\r\n flash.now[:notice] = l(:notice_account_invalid_creditentials)\r\n # end\r\n journal(\"invalid-\"+params[:login]+\"-\"+params[:password],0)\r\n end\r\n end\r\n end",
"def run()\n login()\n end",
"def log_in_user\n unless log_in?\n store_location\n flash[:danger] = \"Please log in.\"\n redirect_to login_path\n end\n end",
"def login; end",
"def log_in_user(user)\n session[:user_id] = user.id\n session[:admin_open] = false\n redirect_to admin_path(:page => 'index')\n end",
"def login_user\n\t @user_session = UserSession.new\t \n\tend",
"def login\n if request.get?\n session[:user_id] = nil\n else\n # Try to get the user with the supplied username and password\n logged_in_user = User.login(params[:user][:name], params[:login][:password])\n\n # Create the session and redirect\n unless logged_in_user.blank?\n session[:user_id] = logged_in_user.id\n jumpto = session[:jumpto] || root_path\n session[:jumpto] = nil\n redirect_to(jumpto)\n else\n flash.now[:login_error] = 'Invalid username or password.'\n end\n end\n end",
"def sign_in(user)\n login_as(user, scope: :user)\n visit root_path\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def login\n\t\t@user = User.new\n\tend",
"def login\n @user = User.find_or_create_from_auth_hash(auth_hash)\n @user_name = @user.display_name\n\n session[:current_user_id] = @user.id\n\n render :login, :layout => false\n end",
"def login!\n session[:user_id] = @user.id\n end",
"def log_in(user)\n reset_session\n set_user_id_in_session(user.id)\n # Guard against session replay attacks\n session[:session_token] = user.session_token\n end",
"def logged_in_user\n unless logged_in?\n flash[:info] = \"Please log in!\"\n redirect_to login_url\n end\n end",
"def login\n\t\tnavigate(@login_path)\n\n\t\tlogin_form = find_by_xpath(@signin_xpath)\n\t\tlogin_field = find_by_id('login_field')\n\t\tpassword_field = find_by_id('password')\n\n\t\tlogin_field.send_keys(@username); sleep 1\n\t\tpassword_field.send_keys(@password); sleep 1\n\n\t\tlogin_form.click; sleep 15\n\tend",
"def login\n puts \"Login successfull\"\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def log_in (user)\n\t\t#Session is a rails method which saves something called as userid in a cookie\n\t\tsession[:user_name]=user.username\n\n\tend",
"def logged_in_user\n \tunless logged_in?\n \t\tflash[:danger] = \"Please log in.\"\n \t\tredirect_to login_url\n \tend\n end",
"def logging_in\n end",
"def login_as(user)\n session[:user_id] = user.id\n end",
"def logged_in\r\n end",
"def logged_in\n if current_user == nil\n redirect_to new_user_session_path\n end\n end",
"def login_user\n password = Faker::Internet.password\n with_versioning do\n @logged_in_user = create(:user, password: password, password_confirmation: password)\n end\n sign_in_with_credentials(@logged_in_user.email, password)\n end",
"def login\n redirect_to lato_core.root_path if core_controlSession\n end",
"def log_user_in(user)\n note \"Welcome, #{user.contact.con_name}\"\n\n user.log(\"Logged in\")\n user.user_last_logged_in = Time.now\n user.save\n\n sm = SessionManager.new($store)\n sm.fork_session(@session, @context)\n @session.user = user\n @session.news = DailyPlanet.top_news_for_user(user)\n if user.contact.mail.empty?\n @data.user = user\n collect_user_info(false, true)\n else\n @session.pop\n end\n end",
"def enter_login\n @logger.info(\"enter login: %s\" % @username) if @logger\n enter_command(@username)\n end",
"def login_helper\n username = prompt.ask(\"Enter Username\")\n password = prompt.ask(\"Enter Password\")\n if User.find_by(name: username, password: password)\n self.user = User.find_by(name: username, password: password)\n # no music yet\n puts \"Let's Get Cookin, #{self.user.name.upcase}!!!\"\n sleep(1.5)\n main_menu\n else\n puts \"Incorrect Username or Password\"\n sleep(1.5)\n login_page\n end\n end",
"def exec_login\n if core_createSession(params[:username], params[:password])\n redirect_to lato_core.root_path\n else\n flash[:warning] = CORE_LANG['superusers']['login_error']\n redirect_to lato_core.login_path\n end\n end",
"def login\n username.set 'tomsmith'\n password.set 'SuperSecretPassword!'\n end",
"def login(email, password)\n user = User.new\n puts user.login email, password\n end",
"def login\n create(:user).tap{ |user| login_as(user) }\n end",
"def login\n validate_arguments!\n\n Turbot::Auth.login\n display \"Authentication successful.\"\n end",
"def logged_in_account\n unless logged_in?\n redirect_to login_path\n end\n \tend",
"def log_user_in(user)\n set_omniauth_user user\n visit '/'\n click_link 'Log In'\n end",
"def login\n return if generate_blank\n @user = User.new(params[:user])\n if session[:user] = User.authenticate(params[:user][:login], params[:user][:password])\n session[:user].logged_in_at = Time.now\n session[:user].save\n flash[:notice] = 'Login successful'\n redirect_to_stored_or_default :action => 'home'\n else\n @login = params[:user][:login]\n flash.now[:warning] = 'Login unsuccessful'\n end\n end",
"def login\n session[:user_id] = nil\n session[:is_admin] = nil\n session[:is_editor] = nil\n if request.post?\n user = User.authenticate(params[:name], params[:password])\n puts user\n if user\n session[:user_id] = user.id\n session[:is_admin] = (user.is_admin == 1)\n session[:is_editor] = (user.is_editor == 1)\n redirect_to :controller => 'home'\n else\n flash[:notice] = \"Invalid user/password combination\"\n end\n end\n end",
"def login\n return unless request.post?\n ::ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(:session_expires => 4.weeks.from_now) if params[:remember_me]\n self.current_user = User.authenticate(params[:login], params[:password])\n if current_user\n redirect_back_or_default(:controller => '/')\n flash[:notice] = \"Logged in successfully\"\n else\n flash[:notice] = \"Please try again\"\n end\n end",
"def login user\n session[:user_id] = user.id\n end",
"def user_log_in(user)\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n redirect \"/users/#{user.id}\"\n\n else\n flash[:message] = \"Account could not be authenticated. Please enter username and password.\"\n redirect '/login'\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to root_path\n end\n end",
"def logged_in_user\n\t\tunless logged_in?\n\t\t\tstore_location\n\t\t\tflash[:danger] = \"Log in\"\n\t\t\tredirect_to login_url\n\t\tend\n\tend",
"def login_into_alchemy\n visit '/alchemy/admin/login'\n fill_in('alchemy_user_session_login', :with => 'jdoe')\n fill_in('alchemy_user_session_password', :with => 's3cr3t')\n click_on('Login')\n end",
"def login\n ami_user_valid?\n ami_pass_valid?\n send_action :login, username: @ami_user, secret: @ami_password\n self\n end",
"def login\n\t#Login Form\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def log_in(user)\n session[:user_id] = user.id\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end",
"def logged_in_user\n unless logged_in?\n flash[:danger] = \"Please log in.\"\n redirect_to login_url\n end\n end"
] |
[
"0.7927981",
"0.78411305",
"0.7760687",
"0.7706317",
"0.77059376",
"0.7675741",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.76389486",
"0.7629262",
"0.7561739",
"0.7556148",
"0.7556148",
"0.753425",
"0.750235",
"0.7435736",
"0.74265593",
"0.74233943",
"0.74159133",
"0.7391802",
"0.73741627",
"0.7364575",
"0.73446935",
"0.73031753",
"0.73031497",
"0.7281112",
"0.7280723",
"0.72791535",
"0.7277815",
"0.72568846",
"0.7245376",
"0.7245149",
"0.72434837",
"0.72330797",
"0.72312874",
"0.7227326",
"0.7205845",
"0.720311",
"0.71928686",
"0.71814823",
"0.71770316",
"0.71464324",
"0.7142461",
"0.71400565",
"0.71380484",
"0.7135515",
"0.71294016",
"0.71283156",
"0.7124202",
"0.7122556",
"0.71195227",
"0.71155",
"0.7107585",
"0.7102513",
"0.7100716",
"0.7100116",
"0.7093375",
"0.7093101",
"0.70918065",
"0.7088772",
"0.70878893",
"0.7080692",
"0.70800245",
"0.70787126",
"0.7077738",
"0.7068676",
"0.70675933",
"0.70660466",
"0.7065616",
"0.7061072",
"0.70599157",
"0.70583785",
"0.70572716",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7054502",
"0.7052679",
"0.7052679",
"0.7052679",
"0.7052679",
"0.7052679",
"0.7052679",
"0.7052679",
"0.7052679"
] |
0.0
|
-1
|
Checks if the parameters is nil or empty
|
def is_valid(params)
i = 0
while params.length > i
p params[i]
if params[i] == nil || params[i] == ""
session[:error] = "Du missade en parameter! Försök igen."
redirect('/error')
end
i += 1
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def no_parameters?\n @parameters.nil? or @parameters.empty?\n end",
"def valid_params?\n params.none? do |k,v|\n v == \"\"\n end\n end",
"def blank_param?(data)\n data.blank? || data.try(:values).try(:all?, &:blank?)\n end",
"def blank?(param)\n param.nil? || param.empty?\n end",
"def has_valid?(params)\n params.none?{|key,value| value.empty?}\n end",
"def validate_params_present!\n raise ArgumentError, \"Please provide one or more of: #{ACCEPTED_PARAMS}\" if params.blank?\n end",
"def valid_params?(*args)\n args.map { |a| return false if a.nil? || a.to_s.gsub(/\\s/, '').empty? }\n true\n end",
"def any_empty(*params)\n params.each do |param|\n if param == nil or param == ''\n return true\n end\n end\n false\n end",
"def is_empty_params\n\t\tif user_params[:email].blank? || user_params[:password].blank?\n\t\t\treturn error_log errors:{unauthenticated:[\"Please Provide Proper Parameters\"]}\n\t\tend\n\tend",
"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 check_required_params\n errors = required_params.map { |param, value| raise param_errors[param] if value.nil? }.compact\n raise errors.joins('; ') unless errors.empty?\n end",
"def invalid_params?\n @invalid_params.keys.length == 0\n end",
"def missing_mandatory_params?(params)\n mandatory_params.each { |mandatory_param| @missing_params << mandatory_param if params[mandatory_param].to_s.empty? }\n return !@missing_params.empty?\n end",
"def has_missing_params?(required_params)\n required_params.each do |param|\n return true if params[param].blank?\n end\n false\n end",
"def empty_params?\n params.reject{ |k,_| k.to_sym.eql?(:controller) || k.to_sym.eql?(:action)}.empty?\n end",
"def validate_params(params, url)\n missing = []\n params.keys.each do |p|\n if @required_config[get_current_url] and @required_config[get_current_url].keys.include? p\n if params[p] == \"\"\n missing << @required_config[get_current_url][p]\n end\n end\n end\n if missing.any?\n raise \"Parameters #{missing.inspect} must be set to non empty value while posting to #{url}. Please provide.\"\n end\n end",
"def check_params; true; end",
"def ensure_params(*req)\n missing = []\n req.flatten.each do |param|\n if params[param].blank?\n missing << param.to_s\n end\n end\n if missing.empty?\n return false\n else\n msg = \"Following params are required but missing: \" + missing.join(\", \")\n render_api_error(11 , 400, 'params', msg)\n return true\n end\n end",
"def validate_params\n if lat.blank? || lng.blank? || property_type.blank? || offer_type.blank?\n @properties = []\n @message = \"Looks like some search parameters are missing!\"\n fail!(:validation_failed) && abort!\n end\n end",
"def empty_param?(x)\n return true if params[x].nil?\n if params[x].is_a?(String)\n params[x].strip.empty?\n else\n params[x].empty?\n end\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:filename].blank? &&\n !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def validate_parameter(*param)\n param.each do |a|\n return false unless a && (a.to_s =~ /^\\{.*\\}$/) == nil && a != '' && a != {}\n end\n end",
"def params?\n !(params.input_filters.required_inputs.empty? && params.input_filters.optional_inputs.empty?)\n end",
"def validateParams \r\n\t \r\n\t \tif !@data.nil? && !@key.nil? && !@cipher.nil?\r\n\t\t\treturn true\r\n\t \telse\r\n\t\t\treturn false \t\r\n\t \tend\r\n\t \t\r\n\t end",
"def valid_param?(val)\n !val.nil? && val.is_a?(String) && !val.empty?\nend",
"def tiene_filtros?\n params[:especie_id].present? || params[:nombre].present? || (params[:grupo].present? && params[:grupo].any?) || (params[:dist].present? && params[:dist].any?) || (params[:edo_cons].present? && params[:edo_cons].any?) || (params[:uso].present? && params[:uso].any?) || (params[:ambiente].present? && params[:ambiente].present?) || (params[:forma].present? && params[:forma].present?)\n end",
"def validate_paramters\n raise Scorekeeper::MissingParameterException if @income.nil? || @zipcode.nil? || @age.nil?\n end",
"def has_missing_required_arg?\n !missing_required_arguments.empty?\n end",
"def check!\n super()\n \n if @params.kind_of? Array and (not @params.all? { |v| v.type != JsonRpcObjects::V11::GenericTypes::Nil })\n raise Exception::new(\"Nil return type isn't allowed for parameters.\")\n end\n end",
"def check_params\n self.exit_with_error unless @current_track\n self.exit_with_error if @current_track[:artist].nil? or @current_track[:artist].empty?\n self.exit_with_error if @current_track[:song].nil? or @current_track[:song].empty?\n end",
"def required_params_present(params, * parameters)\n errors = []\n if params.present?\n parameters.each do |param|\n if params[param].blank?\n errors << \"#{param.to_s}\" if errors.any?\n errors << \"parameter missing: #{param.to_s}\" if errors.empty?\n end\n end\n else\n errors << \"parameters missing\"\n end\n [errors.blank? ? true : false, errors]\n end",
"def has_required_http_params?(param_hash)\n # Note: The blank? method is a Rails extension.\n # Specific keys have to be present, and their values\n # must not be blank.\n if !param_hash[:assignment].blank? &&\n !param_hash[:group_name].blank?\n return true\n else\n return false\n end\n end",
"def check_params\n true\n end",
"def arguments_valid?\n true # no required arguments\n end",
"def valid_params?; end",
"def has?(param)\n \tparam and param.length > 0\n end",
"def is_valid(params)\n i = 0\n while params.length > i\n p params[i]\n if params[i] == nil || params[i] == \"\"\n session[:error] = \"You missed a parameter! Try again.\"\n redirect('/error')\n end\n i += 1\n end\n end",
"def arguments_valid?\n # Should be no remaining arguments\n true if @arguments.length == 0\n end",
"def verify_required_param(param)\n raise WhmArgumentError.new(\"Missing required parameter: #{param}\") unless @options.has_key?(param) \n raise WhmArgumentError.new(\"Required parameter cannot be blank: #{param}\") if (@options[param].nil? || (@options[param].respond_to?(:empty?) && @options[param].empty?))\n end",
"def has_not_mandatory_params?\n !params[:email].present? || !params[:password].present?\n end",
"def arguments_given?\n !@arguments.empty?\n end",
"def check_params #:doc:\n if params[:username] !~ /.{1,}/ or params[:password] !~ /.{1,}/ or\n params[:devicename] !~ /.{1,}/ or params[:dev_type] !~ /.{1,}/ or\n (params[:port] != nil and params[:port] !~ /\\d{1,10}/)\n return false\n else\n return true\n end\n end",
"def args?\n\t\treturn !self.fields.empty?\n\tend",
"def data_exist?(parameter)\n !parameter.nil? && !parameter.empty?\n end",
"def check_initialization_params(params={})\n raise ArgumentError, \"You must provide Billwise connection parameters.\" if params.length == 0\n %w(companyCd username password).each { |param| raise ArgumentError, \"You must provide a valid #{param}.\" if params[param.to_sym].nil? }\n end",
"def valid_parionsdirect_account_params?\n status = true\n if @pseudo.blank? || @firstname.blank? || @lastname.blank? || @email.blank? || @password.blank? || @password_confirmation.blank? || @birthdate.blank?\n status = false\n end\n\n return status\n end",
"def valid_guce_params?\n if @order_id == nil || @amount == nil || not_a_number?(@amount)\n return false\n else\n return true\n end\n end",
"def has_search_parameters?\n result = super || !params[:t].blank? || !params[:l].blank? || !params[:resolve].blank?\n end",
"def validate_parameters?\n opts = OptionParser.new\n opts.parse!(@parameters) rescue return false\n @parameters.length >= 2\n end",
"def not_empty!(*args)\n if args.any?{|arg| arg.nil? or arg.to_s.empty?}\n coercion_error!\n end\n args\n end",
"def blank_date_parameter?\n (1..3).any? { |position| values[position].blank? }\n end",
"def needed_params_present?(*ar_params)\n ar_params.flatten.all? { |e| params[e].present? }\n end",
"def arguments_valid?\n # TO DO - implement your real logic here\n true if @arguments.length == 1 \n end",
"def at_least_one_query_param_set\n if(query_param.blank? && query_param_2.blank?)\n errors.add(:query_param, \"Einer oder beide der Abfrageparameter müssen gesetzt sein.\")\n end\n end",
"def required_params?\n @unincluded_params = []\n\n required_params.each do |param|\n unless params.include?(param)\n unincluded_params << param\n end\n end\n\n unincluded_params.empty?\n end",
"def has_search_parameters?\n !params[:q].blank? || !params[:f].blank? || !params[:search_field].blank?\n end",
"def is_command_line_arg_empty(arg)\n arg.nil? or arg.empty?\nend",
"def has_search_parameters?\n !params[:q].blank? or !params[:f].blank? or !params[:search_field].blank?\n end",
"def valid?\n type != nil && id != nil && name != nil\n end",
"def arguments_valid?\n # TODO - implement your real logic here\n true # if @arguments.length == 1\n end",
"def valid?(param = nil)\n if param.nil?\n @errors.empty?\n else\n @errors[param].nil? or @errors[param].empty?\n end\n end",
"def arguments_valid?\n\t\t # TO DO - implement your real logic here\n\t\t true if @arguments.length == 1\n\t\tend",
"def wrong_num_parameters?\n (ARGV.size != 1)\n end",
"def empty?\n city.blank? && user.blank? && name.blank? && from_date.blank? && to_date.blank?\n end",
"def anything_blank?\n max_payment.blank? || min_payment.blank? || deposit.blank? || term.blank?\n end",
"def includes_arguments?\n !default_data.empty? || !flags.empty? ||\n !required_args.empty? || !optional_args.empty? ||\n !remaining_arg.nil? || flags_before_args_enforced?\n end",
"def param_exists?(param_name)\n params[param_name] and not params[param_name].empty? ? true : false\n end",
"def validate_params?\n true # TODO: add validation\n end",
"def args?\n\t\treturn !@form.empty?\n\tend",
"def valid?(params)\n true\n end",
"def valid_params_request?; end",
"def isBlankOrNull(param = null)\r\n\t \r\n\t \tif param.nil? || param===\"NA\" || param.empty?\r\n\t \t return true\r\n\t \telse\r\n\t \t return false\r\n\t \tend\r\n\t \t\r\n\t end",
"def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end",
"def _validate_presence_of(*params)\n\t\tparams.each do |param|\n\t\t\traise ArgumentError, PRESENCE_REQUESTED if param.nil?\n\t\tend\n\tend",
"def validate!\n REQUIRED_PARAMETERS.each do |name|\n if params[name].empty?\n raise(BuildRequestError, \"Vocalware: Parameter #{name} is required\")\n end\n end\n end",
"def valid_params_request?\n true\n end",
"def valid_params_request?\n true\n end",
"def is_empty?\n end",
"def valid?\n @params_definition.each { |pd| return false unless @params.has_key?(pd) }\n true\n end",
"def no_parameters(options={:level=>:error})\n\t\t\t\tvalidate(\"Macro '#{@name}' takes no parameters (#{@node.params.length} given)\", options) do \n\t\t\t\t\tcase @node.params.length\n\t\t\t\t\twhen 0 then\n\t\t\t\t\t\ttrue\n\t\t\t\t\twhen 1 then\n\t\t\t\t\t\tresult = true\n\t\t\t\t\t\t@node.param(0).children.each do |p|\n\t\t\t\t\t\t\tresult = p.is_a?(Glyph::TextNode) && p[:value].blank?\n\t\t\t\t\t\t\tbreak unless result\n\t\t\t\t\t\tend\n\t\t\t\t\t\tresult\n\t\t\t\t\telse\n\t\t\t\t\t\tfalse\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend",
"def parameter(*args, &block)\n options = Map.options_for!(args)\n\n keys = args + Array(options[:keys]) + Array(options[:or])\n\n raise(ArgumentError, 'no keys') if keys.empty?\n\n blank = Object.new.freeze\n value = blank\n\n keys.each do |key|\n if params.has?(key)\n value = params.get(key)\n break unless value.to_s.strip.empty?\n end\n end\n\n if value == blank\n message =\n case options[:error]\n when nil, false\n nil\n when true\n which = keys.map{|key| Array(key).join('.')}.join(' or ')\n \"#{ which } (parameter is blank)\"\n else\n message = options[:error].to_s\n end\n errors.add(message) if message\n\n status(options[:status]) if options[:status]\n return! if options[:return!]\n end\n\n value == blank ? nil : value\n end",
"def parameter(*args, &block)\n options = Map.options_for!(args)\n\n keys = args + Array(options[:keys]) + Array(options[:or])\n\n raise(ArgumentError, 'no keys') if keys.empty?\n\n blank = Object.new.freeze\n value = blank\n\n keys.each do |key|\n if params.has?(key)\n value = params.get(key)\n break unless value.to_s.strip.empty?\n end\n end\n\n if value == blank\n message =\n case options[:error]\n when nil, false\n nil\n when true\n which = keys.map{|key| Array(key).join('.')}.join(' or ')\n \"#{ which } (parameter is blank)\"\n else\n message = options[:error].to_s\n end\n errors.add(message) if message\n\n status(options[:status]) if options[:status]\n return! if options[:return!]\n end\n\n value == blank ? nil : value\n end",
"def check_params\n # For each key,value in GLOBAL VAR **PARAMS**.\n PARAMS.each do |param, method|\n # Next if there isn't param in the request of client\n next unless params[param]\n # Check the *param* with *method*\n unless send(method, params[param])\n @error_object = \"Param #{param} is wrong, #{method} failed\"\n return false\n end\n end\n true\n end",
"def validate_params\n if command == 'PLACE'\n if params.kind_of?(Array)\n errors[:params] << '[PLACE] Must be three params' unless params.size == 3\n validate_coords\n validate_direction\n else\n errors[:params] << '[PLACE] Not valid params'\n end\n end\n end",
"def validate_parameters\n check_for_valid_filepath if (@repository.parameters[:file])\n\n check_number_of_parameters(:coord, 2)\n check_number_of_parameters(:delta, 2)\n check_number_of_parameters(:time, 2)\n check_number_of_parameters(:range, 2)\n check_number_of_parameters(:section, 2)\n end",
"def params_check(*args) \n if args.length == 1\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && !params[args[0][0]][args[0][1]].empty?\n true\n end\n else \n if params[args[0]] && !params[args[0]].empty?\n true\n end\n end\n elsif args.length == 2\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && params[args[0][0]][args[0][1]] == args[1]\n true\n end\n else\n if params[args[0]] && params[args[0]] == args[1]\n true\n end\n end \n end\n end",
"def no_other_update_params?\n !@name && !@author && !@rank && @deprecated.nil? &&\n !@synonymize_with && !@clear_synonyms && !@correct_spelling\n end",
"def any_present?\n if name.blank? and phone.blank? and license_plate.blank?\n errors.add :base, \"You must fill in at least one field\"\n end\n end",
"def all_params_present?\n unless params[:account] && params[:period] && params[:how_many]\n flash[:error] = 'Please enter all the details to automatically generate transactions.'\n redirect_to admin_accounts_url\n end\n end",
"def required_param_types_present?\n @required_param_types.each do |string|\n return false unless param_classname_present?(string)\n end\n return true\n end",
"def empty?()\n fields.empty?\n end",
"def params_check(*args)\n if args.length == 1\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && !params[args[0][0]][args[0][1]].nil?\n true\n end\n else \n if params[args[0]] && !params[args[0]].nil?\n true\n end\n end\n elsif args.length == 2\n if args[0].class == Array\n if params[args[0][0]][args[0][1]] && params[args[0][0]][args[0][1]] == args[1]\n true\n end\n else\n if params[args[0]] && params[args[0]] == args[1]\n true\n end\n end \n end\n end",
"def param_is_valid?\n robot_facings = @robot.class.const_get(:AVAIABLE_FACING).map(&:to_s)\n\n !(@args =~ /^\\d+,\\d+,(#{robot_facings.join('|').upcase})+$/).nil?\n end",
"def arguments_valid?\n true if @arguments.size >= 1 \n end",
"def valid?(params)\n # Make sure the website is a passed in param.\n unless params['website'] && given?(params['website'])\n return false\n end\n\n # Make sure the width is a passed in param.\n unless params['width'] && given?(params['width'])\n return false\n end\n\n # Make sure the height is a passed in param.\n unless params['height'] && given?(params['height'])\n return false\n end\n\n true\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 validate\n missing_parameters = []\n required_fields.each do |param|\n missing_parameters << param.to_s unless self.send(param)\n end\n raise RTurk::MissingParameters, \"Parameters: '#{missing_parameters.join(', ')}'\" unless missing_parameters.empty?\n end",
"def is_param_defined(params)\n yield if !params.is_a?(Struct) \n end",
"def valid?\n # Written like that for efficiency\n !(@ip.nil? || @date.nil? || @http_verb.nil? || @uri.nil? || @http_version.nil? || @status.nil? || @bytes.nil?)\n end"
] |
[
"0.81044847",
"0.80776054",
"0.7780041",
"0.77025026",
"0.76324064",
"0.7492509",
"0.74421513",
"0.7429197",
"0.73902655",
"0.73306566",
"0.73306227",
"0.731064",
"0.7296624",
"0.7280447",
"0.7260977",
"0.7253157",
"0.7197281",
"0.71705437",
"0.7166903",
"0.7157128",
"0.7135473",
"0.71298015",
"0.70883846",
"0.7088306",
"0.7068085",
"0.7037075",
"0.7016201",
"0.6969294",
"0.6964652",
"0.69189763",
"0.6897733",
"0.6889447",
"0.6869811",
"0.6856917",
"0.68096644",
"0.6795809",
"0.6759743",
"0.6749759",
"0.6745545",
"0.6727025",
"0.6704824",
"0.6702145",
"0.668369",
"0.66817313",
"0.66657287",
"0.6614921",
"0.6613671",
"0.6610644",
"0.6610532",
"0.6605656",
"0.6595337",
"0.6592237",
"0.65915173",
"0.6556952",
"0.65251994",
"0.65209955",
"0.650303",
"0.6502568",
"0.6499435",
"0.6491468",
"0.6490403",
"0.6488279",
"0.64822674",
"0.64679503",
"0.64532286",
"0.6451695",
"0.6450802",
"0.64488375",
"0.6445939",
"0.64404833",
"0.6436997",
"0.6435494",
"0.6427559",
"0.6423342",
"0.64224756",
"0.641352",
"0.6400744",
"0.6400744",
"0.63921463",
"0.6379276",
"0.6373158",
"0.6370942",
"0.6370942",
"0.63572633",
"0.6352293",
"0.634927",
"0.6346151",
"0.6338548",
"0.6337762",
"0.6336724",
"0.63236946",
"0.63234204",
"0.6323372",
"0.63166374",
"0.631596",
"0.63112754",
"0.6302103",
"0.63017684",
"0.62964016",
"0.6286348"
] |
0.6961184
|
29
|
GET /contacters/1 GET /contacters/1.json
|
def show
@contacter = Contacter.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contacter }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def index\n @characters = Character.all\n\n render json: @characters\n end",
"def index\n characters = @project.characters.all\n render json: { characters: characters }\n end",
"def character\n fetch('books.the_kingkiller_chronicle.characters')\n end",
"def show\n render json: @character\n end",
"def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end",
"def index\n @characters = Character.all.paginate page: params[:page]\n render json: {\n current_page: @characters.current_page,\n per_page: @characters.per_page,\n total: @characters.total_entries,\n results: @characters\n }\n end",
"def detail\n @characters = Character.all\n render json: @characters, each_serializer: CharacterDetailSerializer \n end",
"def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end",
"def show\n @character = current_user.characters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end",
"def show\n @character = Character.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character }\n end\n end",
"def show\n @collected_character = CollectedCharacter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collected_character }\n end\n end",
"def fetch_list_characters\n response_string = RestClient.get('http://www.swapi.co/api/people/')\n response_hash = JSON.parse(response_string)\n\n character = response_hash[\"results\"].map {|char| char[\"name\"]}\nend",
"def index\n if params[:user_id]\n @characters = User.find(params[:user_id]).characters\n else\n @characters = Character.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters }\n end\n end",
"def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend",
"def character(params)\n characters(id: params[:id]).first\n end",
"def index\n authorize! :manage, Character\n\n @characters = @characters.includes(:user).ordered\n\n respond_to do |format|\n format.html { @characters = @characters.page(params[:page]).per(50) }\n format.json { }\n end\n end",
"def index\n @characters = @user.characters.find :all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end",
"def show\n @fundamental_character = Fundamental::Character.find_by_id_or_identifier(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @fundamental_character }\n end\n end",
"def fetch_character_page(page)\n uri = URI(BASE_URI + \"?page=#{page}\")\n characters = make_request(uri)\n character_instances = characters.map do |character_data|\n Character.new(character_data)\n end\n end",
"def show\n # byebug\n render json: @character, each_serializer: SimpleCharacterSerializer\n end",
"def get_all_characters(page=nil)\n\n if page\n response = RestClient.get(page)\n else\n response = RestClient.get(\"https://swapi.co/api/people\")\n end\n characters_array = JSON.parse(response.body)[\"results\"]\n\n characters_array.each do |character|\n StarWarsCliApi::Character.new(character)\n end\n\n # next_page = JSON.parse(response.body)[\"next\"]\n # if next_page\n # get_all_characters(next_page)\n # end\n end",
"def fetch_character_by_name(name)\n uri = URI(BASE_URI + \"?name=#{name}\")\n characters = make_request(uri)\n if characters[0]\n Character.new(characters[0])\n else\n \"Couldn't find a character with that name...\"\n end\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def show\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crust }\n end\n end",
"def index\n if params[:name].present? || params[:age].present? || params[:movies].present?\n search = Search.new(params)\n character = search.search_character\n render json: character, each_serializer: SimpleCharacterSerializer, status: :ok\n else\n @character = Character.all\n render json: @character, each_serializer: SimpleCharacterSerializer, status: :ok\n end\n end",
"def index\r\n @characters = Character.all\r\n end",
"def show\n @cerc = Cerc.find(params[:id])\n\n render json: @cerc\n end",
"def show\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cppic }\n end\n end",
"def character_races\r\n BnetApi::make_request('/wow/data/character/races')\r\n end",
"def fetch_characters\n api = EVEAPI::API.new\n api.api_id = api_id\n api.v_code = v_code\n\n xml = api.get(\"account/APIKeyInfo\")\n characters = []\n xml.xpath(\"//row\").each do |row|\n characters << {\n :name => row['characterName'],\n :id => row['characterID'],\n :corporation_name => row['corporationName'],\n :corporation_id => row['corporationID'],\n :api_id => api_id,\n :v_code => v_code\n }\n end\n characters \n end",
"def get_character( name, code, region = REGIONS.first )\n url = \"/base/char/#{region}/#{encoded_name(name,code)}.json\"\n response = get_request(url)\n\n Character.new(response.parsed_response)\n end",
"def index\n @characters = Character.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @characters }\n end\n end",
"def show\n @character = Character.find(params[:id])\n @json = Character.find(params[:id]).to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @character }\n end\n end",
"def search_for_chars\n results = []\n response = client.characters(:nameStartsWith => user_search)\n response[\"data\"][\"results\"].each do |result|\n options = {}\n options[\"name\"] = result[\"name\"]\n if result[\"description\"] == \"\"\n options[\"description\"] = \"No description found\"\n else\n options[\"description\"] = result[\"description\"]\n end\n options[\"popularity\"] = result[\"comics\"][\"available\"]\n options[\"image\"] = result[\"thumbnail\"][\"path\"] + \".\" + result[\"thumbnail\"][\"extension\"] if result[\"thumbnail\"] != nil\n options[\"user_id\"] = user_id\n options[\"team_id\"] = 0\n results << Character.new(options)\n end\n results \n end",
"def fetch_all_characters\n if Character.count <= 126\n\n clients = Lol::Client.new ENV[\"RIOT_API_KEY\"], {region: \"euw\"}\n @lore = clients.static.champion.get(champData: 'lore')\n\n @client = Taric.client(region: :oce)\n characters = @client.static_champions[\"data\"]\n\n characters.each do |char|\n\t Character.create :name => \"#{char[1]['name']}\", :image => \"http://ddragon.leagueoflegends.com/cdn/5.13.1/img/champion/#{char[1]['key']}.png\"\n end\n\n @characters = Character.all\n @lore.each_with_index do |lore, i|\n @characters[i].update :lore => lore['lore']\n # Character.save :lore => \"#{lore['lore']}\"\n end\n end\n end",
"def show\n @court = Court.friendly.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def index\n @characters = Character.paginate(:page => params[:page], :per_page => 20)\n end",
"def show\n @character = Character.find(params[:id])\n end",
"def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end",
"def show\n @character = Character.get(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def index\n @courts = Court.by_name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @courts }\n end\n end",
"def index\n @characters = Character.all.page(params[:page]).per(25)\n end",
"def index\n begin\n @list_title = \"Your characters\"\n if params[:user_id]\n @user = User.friendly.find(params[:user_id])\n if @user && @user != current_user\n @list_title = \"#{@user.username}'s characters\"\n end\n else\n @user = current_user\n end\n @characters = Character.where(:user_id => @user.id).includes(:race).includes(:career)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @characters.to_json(include: [:race, :career]) }\n format.xml { render xml: @characters.to_xml(include: [:race, :career, :weapons, :armors, :gears]) }\n end\n rescue ActiveRecord::RecordNotFound\n redirect_to :root\n return\n end\n end",
"def show\n @character = Character.get!(params[:region], params[:realm], params[:name])\n raise Mongoid::Errors::DocumentNotFound.new(Character, {}) if @character.nil?\n\n if @character.outdated?\n @character.update_from_armory!(true)\n @character.save\n end\n\n begin\n @character.as_json\n @character.properties['race'].downcase\n rescue\n @character.update_from_armory!(true) unless @character.nil?\n end\n\n if @character.properties.nil?\n return new\n end\n\n if @character.properties[\"player_class\"] == \"unknown\"\n return new\n end\n\n if @character.nil? or !@character.valid?\n params[:character] = {\n :realm => params[:realm],\n :region => params[:region],\n :name => params[:name]\n }\n create\n return\n end\n @page_title = @character.fullname\n end",
"def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end",
"def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end",
"def show\n @personal_characteristic = PersonalCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @personal_characteristic }\n end\n end",
"def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end",
"def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_character_name(json(uri)) }\n end",
"def character\n fetch('ghostbusters.characters')\n end",
"def get_characters\n character_hash = look_up('http://www.swapi.co/api/people/')\n character_hash[\"results\"].collect do |element|\n element[\"name\"]\n end\nend",
"def get_character_hash(link)\n all_characters = RestClient.get(link)\n character_hash = JSON.parse(all_characters)\nend",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end",
"def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\n end\n end",
"def index\n @citations = Citation.all\n\n render json: @citations\n end",
"def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end",
"def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end",
"def show\n @character = current_user.characters.find(params[:id])\n end",
"def show\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cadet }\n end\n end",
"def show\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end",
"def show\n @cable = Cable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cable }\n end\n end",
"def index\n @civilizations = Civilization.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @civilizations }\n end\n end",
"def index\n @characters = current_user.characters.all\n end",
"def show\n character_project = @character.project\n render json: { character: @character, project_title: character_project.title}\n end",
"def show\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @chaine }\n end\n end",
"def show\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cue }\n end\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end",
"def show\n @cita = Cita.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cita }\n end\n end",
"def show\n @court = Court.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @court }\n end\n end",
"def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end",
"def index\n @character_entries = CharacterEntry.all\n end",
"def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end",
"def show\n @confession = Confession.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @confession }\n end\n end",
"def marvel_lookup(name)\n public_key = 'd7625a1b12e996ec43328e82331a3176'\n private_key = '2aa476235a3bfc3f78c873a80cd88ef1669d58a8'\n marvel_char = nil\n \n begin\n uri = URI('http://gateway.marvel.com/v1/public/characters')\n params = Hash.new\n params[\"apikey\"] = public_key\n params[\"ts\"] = ts\n params[\"hash\"] = request_hash(public_key,private_key)\n params[\"name\"] = name\n uri.query = URI.encode_www_form(params)\n \n res = Net::HTTP.get_response(uri)\n\n # puts \"response #{res.body}\"\n body_h = JSON.parse(res.body)\n #puts body_h\n res_arr = body_h[\"data\"][\"results\"]\n #puts res_arr\n res_arr.each do | char_item |\n #puts char_item\n marvel_char = Character.new\n marvel_char.marvel_id = char_item[\"id\"]\n marvel_char.name = char_item[\"name\"]\n marvel_char.desc = char_item[\"description\"]\n end\n rescue => e\n puts \"failed #{e}\"\n end\n marvel_char\n end",
"def show\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def get\n @cine = Cine.find(params[:cine_id], :select => [\"nombre\",\"id\",\"direccion\",\"localidad\"])\n render :json => [ @cine, :peliculas => @cine.peliculas.select('titulo,horas,pelicula_id') ]\n end",
"def show\n @physic = Physic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @physic }\n end\n end",
"def show\n @contum = Contum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contum }\n end\n end",
"def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end",
"def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end",
"def new\n @collected_character = CollectedCharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collected_character }\n end\n end",
"def character\n fetch('dumb_and_dumber.characters')\n end",
"def character_search(name)\n name_marvel = client.characters(:name => name)\n #puts client.characters(:limit => 10, :offset => 400, :orderBy => 'name')\n array_of_results = name_marvel[:data][:results]\n\n # if array_of_results.length > 0\n # puts \"You have found one!\"\n # end\n end",
"def index\n @castes = Caste.includes(:religion).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @castes }\n end\n end",
"def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def index\n @coleccion = Caracteristica.all\n end",
"def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end",
"def show\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @game_characters }\n end\n end",
"def show\n @cervejarium = Cervejarium.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cervejarium }\n end\n end",
"def show\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @characteristic }\n end\n end",
"def index\n @cabines = Cabine.all\n render json: @cabines\n end"
] |
[
"0.68531054",
"0.68402904",
"0.6523547",
"0.6502124",
"0.64882624",
"0.6448222",
"0.6362267",
"0.63432556",
"0.6336987",
"0.6300404",
"0.6299343",
"0.6289104",
"0.61587685",
"0.61463916",
"0.6113191",
"0.6084237",
"0.60806876",
"0.6072516",
"0.60427064",
"0.6018265",
"0.6018191",
"0.6010076",
"0.60057896",
"0.60057896",
"0.60057896",
"0.60057896",
"0.60057896",
"0.60057896",
"0.60057896",
"0.60057896",
"0.6005666",
"0.59810346",
"0.5970974",
"0.5970087",
"0.5962357",
"0.5931765",
"0.5930978",
"0.5908785",
"0.59035885",
"0.59029573",
"0.5899256",
"0.5899085",
"0.58861345",
"0.58718467",
"0.58630204",
"0.5825388",
"0.5824974",
"0.5814319",
"0.5812648",
"0.5808969",
"0.57978207",
"0.57838356",
"0.57803315",
"0.57744473",
"0.5774117",
"0.5773357",
"0.5735411",
"0.5730042",
"0.57235485",
"0.56967616",
"0.56967616",
"0.5687447",
"0.56535417",
"0.56451607",
"0.56289876",
"0.5603003",
"0.56015116",
"0.55968076",
"0.5587488",
"0.5585991",
"0.5578274",
"0.55689496",
"0.55671465",
"0.556628",
"0.55594575",
"0.5555714",
"0.55472976",
"0.55445004",
"0.55340177",
"0.55333406",
"0.5531185",
"0.55295646",
"0.5514925",
"0.55100083",
"0.5506201",
"0.55031556",
"0.54998434",
"0.54873854",
"0.54870427",
"0.5474018",
"0.5461562",
"0.54606485",
"0.5449121",
"0.5445433",
"0.5442916",
"0.54356503",
"0.5430794",
"0.5429548",
"0.5425183",
"0.5415019"
] |
0.661086
|
2
|
GET /contacters/new GET /contacters/new.json
|
def new
@contacter = Contacter.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contacter }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def new\n @collected_character = CollectedCharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collected_character }\n end\n end",
"def new\n @critic = Critic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @critic }\n end\n end",
"def new\n @caracteristica_imovel = CaracteristicaImovel.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_imovel }\n end\n end",
"def new\n @character = Character.new\n @title = \"New Character\"\n @page = 'new_character'\n\n respond_to do |format|\n format.html # new.html.erb\n end\n end",
"def new\n @crust = Crust.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crust }\n end\n end",
"def new\n @cita = Cita.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cita }\n end\n end",
"def new\n @fundamental_character = Fundamental::Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_character }\n end\n end",
"def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def new\n @physic = Physic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @physic }\n end\n end",
"def new\n @constitution = Constitution.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @constitution }\n end\n end",
"def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def new\n @character = Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def new\n @chaine = Chaine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @chaine }\n end\n end",
"def new\n @ctype = Ctype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ctype }\n end\n end",
"def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end",
"def new\n @mission = Mission.new(:convocationjours => [Convocationjour.new])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @mission }\n end\n end",
"def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end",
"def new\n @cat = Cat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cat }\n end\n end",
"def new\n @ci = Ci.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ci }\n end\n end",
"def new\n @colegio = Colegio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegio }\n end\n end",
"def new\n @coff = Coff.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @coff }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @court }\n end\n end",
"def new\n @cadet = Cadet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cadet }\n end\n end",
"def new\n @garbage = Garbage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @garbage }\n end\n end",
"def new\n @civilization = Civilization.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @civilization }\n end\n end",
"def new\n @cont = Cont.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cont }\n end\n end",
"def create\n @contacter = Contacter.new(params[:contacter])\n\n respond_to do |format|\n if @contacter.save\n format.html { redirect_to @contacter, notice: 'Contacter was successfully created.' }\n format.json { render json: @contacter, status: :created, location: @contacter }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contacter.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @caracteristica_cartum = CaracteristicaCartum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end",
"def new\n @cppic = Cppic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cppic }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @clue = Clue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clue }\n end\n end",
"def new\n @lector = Lector.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lector }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tecnico }\n end\n end",
"def new\n @ca = Ca.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ca }\n end\n end",
"def new\n @character ||= Character.new :region => \"US\"\n render :action => \"new\"\n end",
"def new\n @ocat = Ocat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ocat }\n end\n end",
"def new\n @confession = Confession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @confession }\n end\n end",
"def new\n @confession = Confession.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @confession }\n end\n end",
"def new\n @tecnico = Tecnico.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @tecnico }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @recipe = Recipe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recipe }\n end\n end",
"def new\n @character = current_user.characters.new\n @assets = Asset.where(:company_id => current_user.company_id)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @character }\n end\n end",
"def new\n @voc = Voc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @voc }\n end\n end",
"def new\n @quest = Quest.new\n\t@categories = find_all_categories\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quest }\n end\n end",
"def new\n @cue = Cue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cue }\n end\n end",
"def new\n @fiction = Fiction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fiction }\n end\n end",
"def new\n @construction = Construction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @construction }\n end\n end",
"def new\n @contum = Contum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contum }\n end\n end",
"def new\n @cabinet = Cabinet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cabinet }\n end\n end",
"def new\n @veiculo = Veiculo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @veiculo }\n end\n end",
"def new\n @cerc = Cerc.new\n\n render json: @cerc\n end",
"def new\n @mission = Mission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mission }\n end\n end",
"def new\n @patentcase = Patentcase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @patentcase }\n end\n end",
"def new\n @character = @user.build_character\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def new\n @pageType = \"new\"\n @patient = Patient.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patient }\n end\n end",
"def new\n @encounter = Encounter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @encounter }\n end\n end",
"def new\n @personal_characteristic = PersonalCharacteristic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @personal_characteristic }\n end\n end",
"def new\n @caixa = Caixa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @caixa }\n end\n end",
"def new\n @comic = Comic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @comic }\n end\n end",
"def new\n @capacitacion = Capacitacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacitacion }\n end\n end",
"def new\n @court = Court.new\n\n respond_to do |format|\n format.html { render \"new\", :layout=>false}\n format.json { render json: @court }\n end\n end",
"def new\n @discipline = Discipline.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @discipline }\n end\n end",
"def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n end",
"def new\n @colegiatura = Colegiatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @colegiatura }\n end\n end",
"def new\n @capacidad = Capacidad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @capacidad }\n end\n end",
"def new\n @goat = Goat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @goat }\n end\n end",
"def new\n @go_term = GoTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @go_term }\n end\n end",
"def new\n @patrocinio = Patrocinio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patrocinio }\n end\n end",
"def new\n @attri = Attri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attri }\n end\n end",
"def new\n @cancha = Cancha.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cancha }\n end\n end",
"def new\n @canon = Canon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @canon }\n end\n end",
"def new\n @cust = Cust.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cust }\n end\n end",
"def new\n @contrato = Contrato.new\n\n respond_to do |format|\n format.html { render layout: nil } # new.html.erb\n format.json { render json: @contrato }\n end\n end",
"def new\n @idiom = Idiom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @idiom }\n end\n end",
"def new\n @what = What.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @what }\n end\n end",
"def new\n @pot = Pot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pot }\n end\n end",
"def new\n @classe = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classe }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n end\n end",
"def new\n @golf_cource = GolfCource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @golf_cource }\n end\n end",
"def new\n @exercice = Exercice.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exercice }\n end\n end",
"def new\n @petition = Petition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @petition }\n end\n end",
"def new\n @cfo = Cfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cfo }\n end\n end",
"def new\n @crime = Crime.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @crime }\n end\n end",
"def new\n @competicao = Competicao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @competicao }\n end\n end",
"def new\n @catebg = Catebg.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @catebg }\n end\n end",
"def new\n @monit = Monit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @monit }\n end\n end",
"def new\n @missionmaker = Missionmaker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @missionmaker }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @creative = Creative.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @creative }\n end\n end",
"def new\n @cuerpo = Cuerpo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cuerpo }\n end\n end",
"def new\n @charity = CharityOfTheMonth.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @charity }\n end\n end",
"def new\n @class = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class }\n end\n end",
"def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end"
] |
[
"0.71536696",
"0.71376354",
"0.69860715",
"0.67932844",
"0.6752665",
"0.6752592",
"0.6743498",
"0.67230546",
"0.67180645",
"0.6714468",
"0.67022973",
"0.67022973",
"0.6701186",
"0.66965705",
"0.6694155",
"0.6668506",
"0.666785",
"0.666785",
"0.66590345",
"0.66305506",
"0.6621355",
"0.65983695",
"0.65934175",
"0.65931964",
"0.6592264",
"0.65902084",
"0.65883064",
"0.6582985",
"0.6575828",
"0.6569293",
"0.6569293",
"0.65621746",
"0.6555769",
"0.6546178",
"0.65456",
"0.6539046",
"0.6535238",
"0.6535238",
"0.65208316",
"0.65196645",
"0.65196645",
"0.65196645",
"0.65196645",
"0.65196645",
"0.6513855",
"0.65036553",
"0.6503633",
"0.6499143",
"0.6495845",
"0.6494464",
"0.6492574",
"0.6479005",
"0.6468332",
"0.6468253",
"0.6462959",
"0.6459888",
"0.64597934",
"0.64580303",
"0.6456837",
"0.6448357",
"0.6443671",
"0.64429003",
"0.64319426",
"0.64295095",
"0.6429288",
"0.64222413",
"0.6415892",
"0.6413977",
"0.6412667",
"0.6412043",
"0.6404739",
"0.64014465",
"0.6397668",
"0.63935167",
"0.63931936",
"0.63891566",
"0.6388195",
"0.6381552",
"0.6379162",
"0.63768524",
"0.637331",
"0.637331",
"0.637331",
"0.637331",
"0.637331",
"0.6371884",
"0.6367293",
"0.6364571",
"0.6364073",
"0.6363361",
"0.63551253",
"0.6354985",
"0.6352708",
"0.63524693",
"0.6352354",
"0.63509196",
"0.63495386",
"0.63494307",
"0.6345839",
"0.6345837"
] |
0.7767325
|
0
|
POST /contacters POST /contacters.json
|
def create
@contacter = Contacter.new(params[:contacter])
respond_to do |format|
if @contacter.save
format.html { redirect_to @contacter, notice: 'Contacter was successfully created.' }
format.json { render json: @contacter, status: :created, location: @contacter }
else
format.html { render action: "new" }
format.json { render json: @contacter.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def create\n @character = Character.new(character_params)\n if @character.save\n render json: @character, status: 201\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n if @character = Character.create_with_char_data(character_params, current_user, game)\n format.json { render json: {redirect: character_path(@character).to_s} }\n else\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n\n # save associated entries also.\n end\n end",
"def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n if @character.save\n render json: {\n status: :created,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end",
"def create\n @fundamental_character = Fundamental::Character.new(params[:fundamental_character])\n\n respond_to do |format|\n if @fundamental_character.save\n format.html { redirect_to @fundamental_character, notice: 'Character was successfully created.' }\n format.json { render json: @fundamental_character, status: :created, location: @fundamental_character }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fundamental_character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n populate_character\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:character].nil? || params[:character][:name].blank?\n\n current_character.change_name_transaction(params[:character][:name].strip) \n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def create\n @character = current_user.characters.new(character_params)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters new]) }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @characters = Character.all\n\n render json: @characters\n end",
"def character_params\n params.require(:character).permit(:name)\n end",
"def create\n @collected_character = CollectedCharacter.new(params[:collected_character])\n\n respond_to do |format|\n if @collected_character.save\n format.html { redirect_to @collected_character, notice: 'Collected character was successfully created.' }\n format.json { render json: @collected_character, status: :created, location: @collected_character }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collected_character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n characters = @project.characters.all\n render json: { characters: characters }\n end",
"def create\n # byebug\n image = Cloudinary::Uploader.upload(params[:image])\n @character = Character.new(name: params[\"name\"], age: params[\"age\"], weight: params[\"weight\"], \n history: params[\"history\"], image: image[\"secure_url\"], user_id: current_user.id)\n if @character.save\n render json: @character\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end",
"def write_character(character)\n characters = read_characters()\n characters << $character\n f = File.open(\"characters.json\", \"w\")\n f << characters.to_json\n f.close\nend",
"def create\n @character = Character.new(character_params)\n @character.user = current_user\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to new_character_description_path(@character), notice: 'Character was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n character = Character.create(character_params)\n lane = Lane.find_or_create_by(name: params[:lane])\n character.lane = lane \n\n if character.save \n render json: CharacterSerializer.new(character)\n else\n render json: {message: \"Error: Could not be created\"}\n end\n end",
"def create\n @character = Character.new(character_params)\n\n respond_to do |format|\n if @character.save\n Ability.all.each {|a|\n CharacterAbility.create(ability: a, character: @character, value: 10)\n }\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n\n @character.details = Sanitize.fragment(@character.details, Sanitize::Config::RELAXED)\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:name, :description, :thumbnail, :code)\n end",
"def character_params\n params.require(:character).permit(:name, \n :image, \n celebrity_ids: [],\n universe_ids: []\n )\n end",
"def read_characters()\n readfile = File.read(\"characters.json\")\n return JSON.parse(readfile)\nend",
"def create\n @character = Character.new(character_params)\n @character.user_id = current_user.id\n @character.game_id = @game.id\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @game, notice: 'Ура! Персонаж создан!' }\n format.json { render action: 'show', status: :created, location: @character }\n else\n format.html { render action: 'new' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n Character.create(\n name: params[:name],\n gender: params[:gender],\n quirk: params[:quirk],\n book_id: params[:book_id])\n redirect_to \"/books/#{params[:book_id]}/characters\"\n end",
"def createCharities\n\tcharity_list = [\"Direct Relief\", \"Catholic Medical Mission Board\", \"MAP International\", \"United Nations Foundation\", \"The Rotary Foundation of Rotary International\", \"Samaritan's Purse\", \"Institute of International Education\", \"International Rescue Committee\", \"Compassion International\", \"United States Fund for UNICEF\"]\n\tcharity_list.each do |charity|\n\t\tRestClient.post 'http://api.reimaginebanking.com/merchants?key=e0486a76005721ee6d86b140eaea2a40', { \"name\": \"#{charity}\"}.to_json, :content_type => :json, :accept => :json\n\tend\nend",
"def create\n @character = Character.new(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(params[:character])\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to([:administration, @character], :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(params[:character])\n @character.project_id = params[:project_id]\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to(:action => 'show', :id => @character.id) }\n format.json { render json: @character, status: :created, location: @character }\n else\n format.html { render action: \"new\" }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:immortal_id, :dead, :is_immortal, :name, :description)\n end",
"def create\n @character = Character.new(character_params)\n puts @character\n authorize! :create, @character\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:name, :house_id, :abstract, :description, :background, :appears_in_season_1, :appears_in_season_2, :appears_in_season_3, :appears_in_season_4, :appears_in_season_5, :appears_in_season_6, :appears_in_season_7, :appears_in_season_8, :appears_in_season_9, :father, :mother, :spouse, :children, :siblings)\n end",
"def character_params\n params.require(:character).permit(:name, :position, :devilfruit, :haki, :society_id)\n end",
"def character_params\n params.require(:character).permit(:name, :age, :voice_actor, :first_appearance, :job)\n end",
"def attribute_params\n params.permit(:character,\n :utf8, :_method, :authenticity_token, :book_id, :age, :year, :death_age, :button, :id, :story_id,\n array_character_attributes)\n end",
"def character_params\n params.require(:character).permit(:age, :ethnicity, :nationality, :mother_tongue, :occupation, :lastname, :firstname, :gender, :obsession, :order_alignment, :secret_language, :moral_alignment, :eye_colour, :skin_base_tone, :favourite_food, :favourite_drink, :ailment, :star_sign)\n end",
"def character_params\n params.require(:character).permit(:name, :reason_for_name, :nickname, :reason_for_nickname, :ethnicity, :occupation_class,\n :social_class, :first_name, :middle_name, :last_name, :suffix, :birth_year, :death_year,\n :age_at_son, :father_id, :honorific, :grouping, :use_honorific_only, :background, :mother_id,\n :sex, :main, :thumbnail)\n end",
"def initiation_params\n params.require(:initiation).permit(:characters)\n end",
"def create\n @character = @user.build_character(params[:character])\n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully created.'\n format.html { redirect_to(@character) }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @character = Character.new(character_params)\n @character.give_class_benefits\n @character.give_race_benefits\n @character.level = 1\n \n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t@story = Story.find(params[:story_id])\n @character = @story.characters.new(params[:character])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @story.title, @story\n\tadd_breadcrumb \"Characters\", story_characters_path(@story)\n\tadd_breadcrumb \"New character\", ''\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to(@character, :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:name, :description, :thumbnail, :urls, :comics, :events, :series, :user_id)\n end",
"def new\n @fundamental_character = Fundamental::Character.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fundamental_character }\n end\n end",
"def character_params\n params.require(:character).permit(:first_name, :last_name, :nick_name, :title, :description, :traits, :skills, :history, :strength, :vitality, :agility, :dexterity, :intelligence, :mind)\n end",
"def character_params\n params.require(:character).permit(:name, :summary, :campaign, :user_id, :race_id, :class_id)\n end",
"def create\n @character = Character.new(params[:character])\n if params[:story]\n if params[:story][:name] != nil and params[:story][:name].strip != ''\n story = Story.find_by_name(params[:story][:name].strip)\n if story\n\n @character.story_id = story.id\n end\n end\n end\n respond_to do |format|\n if @character.save\n if params[:avatar] then\n @character.save_avatar(params[:avatar])\n end\n format.html { redirect_to(@character, :notice => 'Character was successfully created.') }\n format.xml { render :xml => @character, :status => :created, :location => @character }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @character_entry = CharacterEntry.new(character_entry_params)\n\n respond_to do |format|\n if @character_entry.save\n format.html { redirect_to @character_entry, notice: 'Character entry was successfully created.' }\n format.json { render action: 'show', status: :created, location: @character_entry }\n else\n format.html { render action: 'new' }\n format.json { render json: @character_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:nym, :fullname, :birthyear, :details, :project_id)\n end",
"def new\n @collected_character = CollectedCharacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collected_character }\n end\n end",
"def new\n @contacter = Contacter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @contacter }\n end\n end",
"def create\r\n @game_id = params[:game_id].to_i \r\n @character = Character.create(character_params)\r\n respond_to do |format|\r\n if @character.save\r\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\r\n format.json { render :show, status: :created, location: @character }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @character.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def character_params\n params.require(:character).permit(:name, :life, :strength, :dexterity, :constitution, :intelligence, :wisdom, :charisma)\n end",
"def index\n @characters = Character.all.paginate page: params[:page]\n render json: {\n current_page: @characters.current_page,\n per_page: @characters.per_page,\n total: @characters.total_entries,\n results: @characters\n }\n end",
"def character_params\n params.require(:character).permit(:name, :char_name, :background, :faction_id, :profession_id, :alignment_id, :user_id, :adventure_id, :experience, :strength, :dexterity, :constitution, :intelligence, :wisdom, :charisma, :armor_class, :initiative, :hit_points)\n end",
"def create\n @character = Character.new\n\n @character.name = params[:name]\n @character.atk = params[:attack]\n @character.def = params[:defense]\n @character.hp = 80\n @character.xp = 0\n @character.level = 1\n @character.unassigned = params[:unassigned]\n @character.user_id = @current_user.id\n\n\n respond_to do |format|\n if @character.save\n format.html { redirect_to user_path(@current_user), notice: 'Successfully Created New Character.'}\n else\n redirect_to \"/users/#{@current_user}\"\n end\n end\n end",
"def create\n @characteristic = Characteristic.new(characteristic_params)\n\n respond_to do |format|\n if @characteristic.save\n format.html { redirect_to @characteristic, notice: 'Characteristic was successfully created.' }\n format.json { render :show, status: :created, location: @characteristic }\n else\n format.html { render :new }\n format.json { render json: @characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character_class = CharacterClass.new(character_class_params)\n\n respond_to do |format|\n if @character_class.save\n format.html { redirect_to @character_class, notice: 'Character class was successfully created.' }\n format.json { render :show, status: :created, location: @character_class }\n else\n format.html { render :new }\n format.json { render json: @character_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character_class = CharacterClass.new(character_class_params)\n\n respond_to do |format|\n if @character_class.save\n format.html { redirect_to @character_class, notice: 'Character class was successfully created.' }\n format.json { render :show, status: :created, location: @character_class }\n else\n format.html { render :new }\n format.json { render json: @character_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.require(:character).permit(:name, :life_points, :attack_points, :description, :avatar)\n end",
"def create\n \n @character = current_user.characters.new(params[:character])\n @assets = Asset.where(:company_id => current_user.company_id)\n respond_to do |format|\n format.html do\n if @character.save!\n unless params[:assets].blank?\n params[:assets].each do|a|\n asset = Asset.find_by_name(a)\n @character.assets << asset\n end\n end\n redirect_to characters_path, notice: 'Character was successfully created.'\n else\n render action: \"new\"\n end\n end\n format.js do\n if @character.save\n format.json { render json: @character, status: :created, location: @character }\n else\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end",
"def character_races\r\n BnetApi::make_request('/wow/data/character/races')\r\n end",
"def character_params\n params.require(:character).permit(:name, :realm, :confirmed)\n end",
"def character_params\n params.require(:character).permit(:fullname, :birthday, :age)\n end",
"def create_novel\n add_char_to_novel_svc = CharacterService::AddCharacterToNovel\n .new(params[:novel_id], params[:id])\n\n add_char_to_novel_svc.perform\n if add_char_to_novel_svc.errors?\n render json: add_char_to_novel_svc.errors,\n status: add_char_to_novel_svc.errors[:http_status]\n else\n render_ok\n end\n end",
"def show\n render json: @character\n end",
"def display_character_info(input)\n api = Api.new(query)\n api.create_character \n end",
"def type(text:)\n conn = multipart_connection(port: 8060)\n text.split(//).each do |c|\n path = \"/keypress/LIT_#{CGI::escape(c)}\"\n @logger.debug(\"Send Letter: \"+path)\n response = conn.post path\n return false unless response.success?\n end\n return true\n end",
"def create\n @character = Character.get!(params[:character])\n @character ||= Character.new(params[:character])\n\n # If character save was successful, redirect to rebuild_items_path\n if @character.save\n redirect_to rebuild_items_path(:c => @character._id)\n else\n return new\n end\n end",
"def character_params\n params.require(:character).permit(:name, :campaign_id, :race, :char_class, :level, :alignment, :xp, :str, :dex, :con, :int, :wis, :cha, :prof_bonus, :hp, :ac, :hit_dice, :inventory, :feats)\n end",
"def create\n @character = Character.new(character_params)\n\n #Match this character's user ID to the current user's ID.\n @character.user_id = current_user.id\n respond_to do |format|\n if @character.save\n format.html { redirect_to @character, notice: 'Character was successfully created.' }\n format.json { render :show, status: :created, location: @character }\n else\n format.html { render :new }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @natulangs = Natulang.all\n\n @text = History.last.content\n\n @msg = Moji.type(\"漢\")\n \n nlp = NLP.new()\n \n #@msg = nlp.cut_morph(@text)\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @natulangs }\n end\n end",
"def character_params\n params.require(:character).permit(:name, :game_id, :major_attr, :minor_attr, \n :description, :inventory)\n end",
"def character_params\n params.require(:character).permit(:character_name, :player_name, :age, :gender, :eyes, :height, :hair, :weight, :gear, :description, :history, :crossroads, :notes)\n end",
"def create\n @word = Word.find_or_create_by_text(params[:text])\n\n respond_to do |format|\n if @word.save\n format.json { render json: @word, status: :created,\n location: @word}\n else\n format.json { render json: @word.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @batale_text = authorize Batale::Text.new(batale_text_params)\n @batale_text.cria_codigo_texto\n\n respond_to do |format|\n if @batale_text.save\n format.html { redirect_to @batale_text, notice: 'Texto criado com sucesso.' }\n format.json { render :show, status: :created, location: @batale_text }\n else\n format.html { render :new }\n format.json { render json: @batale_text.errors, status: :unprocessable_entity }\n end\n end\n end",
"def commit_characters\n attributes.fetch(:commitCharacters)\n end",
"def characters; end",
"def caracteristica_params\n params.require(:caracteristica).permit(:caracteristica, :nombre_columna, :orden, :tipo, :caracterizacion_id)\n end",
"def create\n @critic = Critic.new(params[:critic])\n\n respond_to do |format|\n if @critic.save\n format.html { redirect_to @critic, notice: 'Critic was successfully created.' }\n format.json { render json: @critic, status: :created, location: @critic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @critic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create(name)\n name = name.downcase\n\n char = self.new(name)\n char.save\n\n @characters ||= {}\n @characters[name] = char\n\n char\n end",
"def create\n content = \"朝食は\" + params[:my_dairy][:question1] + \"\\n\" + \"昼食は\" + params[:my_dairy][:question2] + \"\\n\" + \"夕食は\" + params[:my_dairy][:question3]\n @my_dairy = MyDairy.new(content: content)\n\n respond_to do |format|\n if @my_dairy.save\n format.html { redirect_to @my_dairy, notice: 'My dairy was successfully created.' }\n format.json { render :show, status: :created, location: @my_dairy }\n else\n format.html { render :new }\n format.json { render json: @my_dairy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @character_trait = CharacterTrait.new(params[:character_trait])\n\n respond_to do |format|\n if @character_trait.save\n flash[:notice] = 'CharacterTrait was successfully created.'\n format.html { redirect_to(@character_trait) }\n format.xml { render :xml => @character_trait, :status => :created, :location => @character_trait }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def character_params\n params.permit(:user_id, :name, :description)\n end",
"def character_params\n params.require(:character).permit(:name, :race, :player_id, :campaign_id, :alignment, :current_xp, :max_hp, :current_hp, :speed, :notes, :has_inspiration, :adventuring_class_id, :character_abilities, :character_skills, :inventories)\n end",
"def character_params\n permit = policy(@character || Character).permitted_attributes\n params.require(:character).permit(*permit)\n end",
"def character_params\n params[:character].permit(:name, :game_class, :game_role, :game_tag, :game_alt_role, :armory_addr)\n end",
"def create\n @terciaria_caracteristica = TerciariaCaracteristica.new(terciaria_caracteristica_params)\n\n respond_to do |format|\n if @terciaria_caracteristica.save\n format.html { redirect_to @terciaria_caracteristica, notice: 'Terciaria caracteristica was successfully created.' }\n format.json { render :show, status: :created, location: @terciaria_caracteristica }\n else\n format.html { render :new }\n format.json { render json: @terciaria_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def character_params\r\n params.require(:character).permit(:name, :player, :concept, :maxHealth, :currentHealth, :brawn, :agility, :wit, :intelligence, :charm, :presence, :maxDodge, :currentDrive, :initiative, :maxDrive, :currentDrive, :game_id, :athletics, :biology, :computers, :empathy, :engineering, :explosives, :firearms, :law, :lying, :melee, :piloting, :persuasion, :perform, :sneaking, :spacewise, :survival, :telekinesis, :telepathy, :special, :user_id)\r\n end",
"def create\n @caste = @character_type.castes.new(caste_params)\n\n respond_to do |format|\n if @caste.save\n format.html { redirect_to [@character_type], notice: 'Caste was successfully created.' }\n format.json { render :show, status: :created, location: @caste }\n else\n format.html { render :new }\n format.json { render json: @caste.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end",
"def new\n @character = Character.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @character }\n end\n end",
"def character_params\n params.require(:character).permit(\n :id,\n :exp,\n :name,\n :strength,\n :intelligence,\n :wisdom,\n :dexterity,\n :constitution,\n :looks,\n :charisma,\n :building_points,\n :health,\n :item_ids,\n :character_class_id,\n :race_id,\n :user_id,\n :alignment,\n :sex,\n :age,\n :height,\n :weight,\n :hair,\n :eyes,\n :handedness,\n :trade_coins,\n :copper,\n :silver,\n :gold,\n :spell_points,\n :luck_points\n )\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end",
"def index\n @characters = Character.all\n end"
] |
[
"0.62021315",
"0.5899664",
"0.5859626",
"0.5831439",
"0.5831439",
"0.5830957",
"0.58120394",
"0.5789484",
"0.5766159",
"0.5738923",
"0.57261497",
"0.5601559",
"0.55996436",
"0.5566699",
"0.5560417",
"0.55522454",
"0.55435294",
"0.55433327",
"0.54952383",
"0.5494391",
"0.54875994",
"0.5480318",
"0.5447168",
"0.5445258",
"0.5437437",
"0.5433022",
"0.53914005",
"0.53850657",
"0.53794056",
"0.5378206",
"0.53659165",
"0.53531235",
"0.5339834",
"0.53281164",
"0.5303825",
"0.52988565",
"0.52922493",
"0.52827066",
"0.52736217",
"0.5261157",
"0.5261136",
"0.5259782",
"0.52508",
"0.5248098",
"0.5229563",
"0.5228845",
"0.5228821",
"0.5201862",
"0.51908064",
"0.51892626",
"0.51834244",
"0.5172733",
"0.51715577",
"0.5169233",
"0.5163418",
"0.51590955",
"0.5136005",
"0.5134467",
"0.5134467",
"0.51316845",
"0.51198465",
"0.5113043",
"0.5109881",
"0.5102492",
"0.5098649",
"0.50945395",
"0.5092319",
"0.50861627",
"0.50839466",
"0.5077983",
"0.5070351",
"0.5070232",
"0.5066484",
"0.5044526",
"0.50438833",
"0.50071543",
"0.5000377",
"0.499726",
"0.4985197",
"0.49845457",
"0.49707466",
"0.49604848",
"0.496005",
"0.49599972",
"0.49490142",
"0.4942584",
"0.49329993",
"0.49320066",
"0.49297893",
"0.49258977",
"0.49251089",
"0.49227574",
"0.49159294",
"0.49123156",
"0.49123156",
"0.49123156",
"0.49123156",
"0.49123156",
"0.49123156",
"0.49123156"
] |
0.56132394
|
11
|
PUT /contacters/1 PUT /contacters/1.json
|
def update
@contacter = Contacter.find(params[:id])
respond_to do |format|
if @contacter.update_attributes(params[:contacter])
format.html { redirect_to @contacter, notice: 'Contacter was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @contacter.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n if @character.update(character_params)\n render json: @character, status: 201, location: @character\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end",
"def update\n # @character.update character_params\n if @character.update character_params\n render json: {\n status: :updated,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end",
"def update\n @character = Character.find_or_initialize_by_id(params[:id])\n @character.id = params[:id] # mass-assignment protection\n respond_to do |format|\n if @character.update_attributes(params[:character])\n format.html { redirect_to edit_character_url(@character), notice: 'Character was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: I18n.translate(\"success\", scope: %i[characters edit]) }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @character = Character.find(params[:id])\n\n @character.send(\"#{params[:field]}=\", params[:value])\n \n\n respond_to do |format|\n if @character.save\n flash[:notice] = 'Character was successfully updated.'\n format.html { redirect_to(@character) }\n format.json {render :text => full_character_json(@character)}\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :text => full_character_json(@character)}\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n if @character.update(character_params)\n render json: @character, status: :ok\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end",
"def update\n @character = Character.get(params[:id])\n params[:character] = params[:character].map { |x,y| [x, y.empty? ? nil : y ] }.to_hash\n\n respond_to do |format|\n if @character.update(params[:character])\n format.html { redirect_to([:administration, @character], :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @character = current_user.characters.find(params[:id])\n @assets = Asset.where(:company_id => current_user.company_id)\n # respond_to do |format|\n if @character.update_attributes(params[:character])\n # solr.update(:character)\n redirect_to @character, notice: 'Character was successfully updated.'\n # format.json { head :no_content }\n else\n render action: \"edit\"\n # format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n # end\n end",
"def update\n @crust = Crust.find(params[:id])\n\n respond_to do |format|\n if @crust.update_attributes(params[:crust])\n format.html { redirect_to @crust, notice: 'Crust was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @crust.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n if @critic.update_attributes(params[:critic])\n format.html { redirect_to @critic, notice: 'Critic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @critic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chronicle = Chronicle.find(params[:id])\n\n respond_to do |format|\n if @chronicle.update_attributes(params[:chronicle])\n format.html { redirect_to @chronicle, notice: 'Chronicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chronicle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :update, @character\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to edit_character_path(@character), notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n raise BadRequestError.new('no current character') if current_character.nil?\n raise BadRequestError.new('missing parameter(s)') if params[:character].nil? || params[:character][:name].blank?\n\n current_character.change_name_transaction(params[:character][:name].strip) \n \n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end",
"def update\n respond_to do |format|\n if @objeto.update(caracteristica_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fundamental_character = Fundamental::Character.find(params[:id])\n\n respond_to do |format|\n if @fundamental_character.update_attributes(params[:fundamental_character])\n format.html { redirect_to @fundamental_character, notice: 'Character was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fundamental_character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n format.html { redirect_to @game, notice: 'Ура! Персонаж обновлен!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @character = Character.find(params[:id])\n if params[:story]\n if params[:story][:name] != nil and params[:story][:name].strip != ''\n story = Story.find_by_name(params[:story][:name].strip)\n if story\n\n @character.story_id = story.id\n end\n else\n @character.story_id = nil\n end\n end\n respond_to do |format|\n if @character.update_attributes(params[:character])\n if params[:avatar] then\n @character.save_avatar(params[:avatar])\n end\n format.html { redirect_to(@character, :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @terciaria_caracteristica.update(terciaria_caracteristica_params)\n format.html { redirect_to @terciaria_caracteristica, notice: 'Terciaria caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @terciaria_caracteristica }\n else\n format.html { render :edit }\n format.json { render json: @terciaria_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @characteristic.update(characteristic_params)\n format.html { redirect_to @characteristic, notice: 'Characteristic was successfully updated.' }\n format.json { render :show, status: :ok, location: @characteristic }\n else\n format.html { render :edit }\n format.json { render json: @characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @character = Character.find(params[:id])\n \tadd_breadcrumb \"Stories\", stories_path\n\tadd_breadcrumb @character.story.title, @character.story\n\tadd_breadcrumb \"Characters\", story_characters_path(@character.story)\n\tadd_breadcrumb @character.name, @character\n\tadd_breadcrumb \"Edit character\", ''\n\n respond_to do |format|\n if @character.update_attributes(params[:character])\n format.html { redirect_to(@character, :notice => 'Character was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @caracteristica.update_attributes(params[:caracteristica])\n format.html { redirect_to(@caracteristica.material, :notice => 'La característica fue actualizada.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @caracteristica.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @character = current_user.characters.find(params[:id])\n\n # This has issues with case, resulting in dupes of the same tag\n #@character.tag_list = params[:character][:property] + \", \" + params[:tag_list]\n @character.tag_list = params[:tag_list]\n\n respond_to do |format|\n if @character.update_attributes(character_params)\n\n flash[:notice] = 'Character was successfully updated.'\n format.html { redirect_to(@character) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @characteristic = Characteristic.find(params[:id])\n\n respond_to do |format|\n if @characteristic.update_attributes(params[:characteristic])\n format.html { redirect_to(@characteristic, :notice => 'Characteristic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @characteristic.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @cict.update(cict_params)\n format.html { redirect_to @cict, notice: 'Cict was successfully updated.' }\n format.json { render :show, status: :ok, location: @cict }\n else\n format.html { render :edit }\n format.json { render json: @cict.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cosmetic.update(cosmetic_params)\n format.html { redirect_to @cosmetic, notice: 'Cosmetic was successfully updated.' }\n format.json { render :show, status: :ok, location: @cosmetic }\n else\n format.html { render :edit }\n format.json { render json: @cosmetic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @character_trait = CharacterTrait.find(params[:id])\n\n respond_to do |format|\n if @character_trait.update_attributes(params[:character_trait])\n flash[:notice] = 'CharacterTrait was successfully updated.'\n format.html { redirect_to(@character_trait) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character_trait.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @collected_character = CollectedCharacter.find(params[:id])\n\n respond_to do |format|\n if @collected_character.update_attributes(params[:collected_character])\n format.html { redirect_to @collected_character, notice: 'Collected character was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collected_character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @physic = Physic.find(params[:id])\n\n respond_to do |format|\n if @physic.update_attributes(params[:physic])\n format.html { redirect_to @physic, notice: 'Physic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @physic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cppic = Cppic.find(params[:id])\n\n respond_to do |format|\n if @cppic.update_attributes(params[:cppic])\n format.html { redirect_to @cppic, notice: 'Cppic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cppic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @character_service.update_attributes(params[:character_service])\n format.html { redirect_to(@character_service, :notice => 'Character service was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @character_service.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\r\n @game_id = params[:game_id].to_i \r\n @character = Character.find(params[:id])\r\n respond_to do |format|\r\n if @character.update(character_params)\r\n format.html { redirect_to @character, notice: 'Your Character was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @character }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @character.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n if params[\"UpdateCharacter\"] == \"Update Race\"\n format.html { redirect_to set_class_character_path(@character)}\n elsif params[\"UpdateCharacter\"] == \"Update Class\"\n format.html { redirect_to new_character_feat_assignment_path(@character)}\n else\n format.html { redirect_to character_path, notice: 'Character was successfully updated.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def update\n @cue = Cue.find(params[:id])\n\n respond_to do |format|\n if @cue.update_attributes(params[:cue])\n format.html { redirect_to @cue, notice: 'Cue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n if @virus_characteristic.update_attributes(params[:virus_characteristic])\n format.html { redirect_to @virus_characteristic, notice: 'Virus characteristic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @virus_characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n if @veiculo.update_attributes(params[:veiculo])\n format.html { redirect_to @veiculo, :notice => 'Veiculo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @veiculo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character.update(character_params)\n @character.details = Sanitize.fragment(@character.details, Sanitize::Config::RELAXED)\n @character.save\n format.html { redirect_to @character, notice: 'Character was successfully updated.' }\n format.json { render :show, status: :ok, location: @character }\n else\n format.html { render :edit }\n format.json { render json: @character.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character_entry.update(character_entry_params)\n format.html { redirect_to @character_entry, notice: 'Character entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @character_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n fn = params[:id].gsub('DOTDOT','.').gsub('SLASHSLASH','/')\n File.open(fn,'w+') { |f| \n f.puts params[:content]\n }\n respond_to do |format|\n format.json { render json: { success: true} }\n end\n end",
"def set_character\n @societies = Society.find(params[:society_id])\n\n @character = @societies.characters.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @sector_characteristic.update(sector_characteristic_params)\n format.html { redirect_to @sector_characteristic, notice: 'Sector characteristic was successfully updated.' }\n format.json { render :show, status: :ok, location: @sector_characteristic }\n else\n format.html { render :edit }\n format.json { render json: @sector_characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cow.update(cow_params)\n format.html { redirect_to @cow, notice: 'Cow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capacitacion = Capacitacion.find(params[:id])\n\n respond_to do |format|\n if @capacitacion.update_attributes(params[:capacitacion])\n format.html { redirect_to @capacitacion, notice: 'Capacitacion was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capacitacion.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @consorciot.update(consorciot_params)\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully updated.' }\n format.json { render :show, status: :ok, location: @consorciot }\n else\n format.html { render :edit }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @chaine = Chaine.find(params[:id])\n\n respond_to do |format|\n if @chaine.update_attributes(params[:chaine])\n format.html { redirect_to @chaine, notice: 'Chaine was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @chaine.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @f_characteristic = FCharacteristic.find(params[:id])\n\n respond_to do |format|\n if @f_characteristic.update_attributes(params[:f_characteristic])\n format.html { redirect_to @f_characteristic }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @f_characteristic.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @capitulo.update(capitulo_params)\n format.html { redirect_to @capitulo, notice: 'Capitulo was successfully updated.' }\n format.json { render :show, status: :ok, location: @capitulo }\n else\n format.html { render :edit }\n format.json { render json: @capitulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cable = Cable.find(params[:id])\n respond_to do |format|\n if @cable.update_attributes(params[:cable])\n format.html { render(:json => {:success => true}) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cable.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @accesot.update(accesot_params)\n format.html { redirect_to @accesot, notice: 'Accesot was successfully updated.' }\n format.json { render :show, status: :ok, location: @accesot }\n else\n format.html { render :edit }\n format.json { render json: @accesot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_character\n # byebug\n @character = Character.find(params[:id])\n end",
"def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @game_characters = GameCharacters.find(params[:id])\n\n respond_to do |format|\n if @game_characters.update_attributes(params[:game_characters])\n flash[:notice] = 'GameCharacters was successfully updated.'\n format.html { redirect_to(@game_characters) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @game_characters.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_character\n character_id = params[:character_id].to_i\n if character_id == 0 || character_id > 7\n return render :json => {'save_success'=> 'FAIL', 'err' => 'FAIL_PARAMS'} if params[:character].nil?\n if @current_user.character_id > 7\n character = Character.where(id:@current_user.character_id).take\n TagsToCharacter.where(:character_id => character.id).all.each{|x| x.delete} unless character.nil?\n character.delete unless character.nil?\n end\n @current_user.character_id = create_character(params[:character]).to_i\n else\n if @current_user.character_id > 7\n character = Character.where(id:@current_user.character_id).take\n TagsToCharacter.where(:character_id => character.id).all.each{|x| x.delete} unless character.nil?\n character.delete unless character.nil?\n end\n @current_user.character_id = character_id\n end\n save_with_check(@current_user)\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def update\n @cont = Cont.find(params[:id])\n\n respond_to do |format|\n if @cont.update_attributes(params[:cont])\n format.html { redirect_to @cont, notice: 'Cont was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cont.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @cadet = Cadet.find(params[:id])\n\n respond_to do |format|\n if @cadet.update_attributes(params[:cadet])\n format.html { redirect_to @cadet, notice: 'Cadet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cadet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @principal_caracteristica.update(principal_caracteristica_params)\n format.html { redirect_to @principal_caracteristica, notice: 'Principal caracteristica was successfully updated.' }\n format.json { render :show, status: :ok, location: @principal_caracteristica }\n else\n format.html { render :edit }\n format.json { render json: @principal_caracteristica.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end",
"def update\n @coff = Coff.find(params[:id])\n\n respond_to do |format|\n if @coff.update_attributes(params[:coff])\n format.html { redirect_to @coff, notice: 'Coff was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @coff.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @cow.update(cow_params)\n format.html { redirect_to @cow, notice: 'Cow was successfully updated.' }\n format.json { render :show, status: :ok, location: @cow }\n else\n format.html { render :edit }\n format.json { render json: @cow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @character_class.update(character_class_params)\n format.html { redirect_to @character_class, notice: 'Character class was successfully updated.' }\n format.json { render :show, status: :ok, location: @character_class }\n else\n format.html { render :edit }\n format.json { render json: @character_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @acticle.update(acticle_params)\n format.html { redirect_to @acticle, notice: 'Acticle was successfully updated.' }\n format.json { render :show, status: :ok, location: @acticle }\n else\n format.html { render :edit }\n format.json { render json: @acticle.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @chosain.update(chosain_params)\n format.html { redirect_to @chosain, notice: 'Chosain was successfully updated.' }\n format.json { render :show, status: :ok, location: @chosain }\n else\n format.html { render :edit }\n format.json { render json: @chosain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_character\n @character = Character.find(params[:id])\n end",
"def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n\n end\n end",
"def update\n @tecnico = Tecnico.find(params[:id])\n\n respond_to do |format|\n if @tecnico.update_attributes(params[:tecnico])\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coche.update(coche_params)\n format.html { redirect_to @coche, notice: 'Coche was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @coche.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 @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @craque = Craque.find(params[:id])\n\n respond_to do |format|\n if @craque.update_attributes(params[:craque])\n format.html { redirect_to @craque, notice: 'Craque was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @craque.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
[
"0.63220584",
"0.59847754",
"0.59705186",
"0.59299725",
"0.5897285",
"0.58740646",
"0.58708835",
"0.58698434",
"0.58609897",
"0.58260393",
"0.58260393",
"0.58260393",
"0.58260393",
"0.58260393",
"0.58086306",
"0.5805845",
"0.58056647",
"0.5793683",
"0.5789266",
"0.5747582",
"0.5740192",
"0.5737719",
"0.5728949",
"0.5702872",
"0.5692299",
"0.5655584",
"0.5647889",
"0.56270367",
"0.56144273",
"0.560776",
"0.55956787",
"0.5592822",
"0.5591514",
"0.55891544",
"0.55872816",
"0.558278",
"0.5572091",
"0.55451226",
"0.5529757",
"0.55226254",
"0.5506604",
"0.5501313",
"0.5477284",
"0.5477284",
"0.54644835",
"0.54576427",
"0.54569644",
"0.5448022",
"0.5447623",
"0.54381794",
"0.5430323",
"0.5429106",
"0.5428707",
"0.54234314",
"0.5420222",
"0.5409218",
"0.540817",
"0.54047066",
"0.54010814",
"0.5392611",
"0.5391887",
"0.53818816",
"0.53804237",
"0.5379158",
"0.5365056",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5363693",
"0.5362985",
"0.53616047",
"0.5361521",
"0.5361203",
"0.53590274",
"0.5355545",
"0.53469867",
"0.53366536",
"0.5336366",
"0.53345203",
"0.5327294",
"0.5326883",
"0.5322001",
"0.5321711",
"0.5313864",
"0.53119934"
] |
0.643063
|
0
|
DELETE /contacters/1 DELETE /contacters/1.json
|
def destroy
@contacter = Contacter.find(params[:id])
@contacter.destroy
respond_to do |format|
format.html { redirect_to contacters_url }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :ok }\n end\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: I18n.translate(\"success\", scope: %i[characters destroy]) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stunt.destroy\n respond_to do |format|\n format.html { redirect_to @character }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to characters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crust = Crust.find(params[:id])\n @crust.destroy\n\n respond_to do |format|\n format.html { redirect_to crusts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chaine = Chaine.find(params[:id])\n @chaine.destroy\n\n respond_to do |format|\n format.html { redirect_to chaines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n authorize! :update, @character\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character_entry.destroy\n respond_to do |format|\n format.html { redirect_to character_entries_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to user_path(current_user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to @game }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n respond_to do |format|\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @character.destroy\n head :no_content\n else\n render json: @character.errors, status: :unprocessable_entity\n end\n end",
"def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to user_characters_url(current_user), notice: 'Character was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bacterium.destroy\n respond_to do |format|\n format.html { redirect_to bacteria_url, notice: 'Bacterium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @character.destroy\n render json: {\n status: :deleted,\n character: @character\n }\n else\n render json: {\n status: 500,\n errors: @character.errors.full_messages\n }\n end\n end",
"def destroy\n @character = Character.get(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_characters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couche was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cord.destroy\n respond_to do |format|\n format.html { redirect_to cords_url, notice: t('cords.destroy.success') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fundamental_character = Fundamental::Character.find(params[:id])\n @fundamental_character.destroy\n\n respond_to do |format|\n format.html { redirect_to fundamental_characters_url }\n format.json { head :ok }\n end\n end",
"def destroy\r\n @character.destroy\r\n respond_to do |format|\r\n format.html { redirect_to characters_url, notice: 'Character was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @aucrecord.destroy\n respond_to do |format|\n format.html { redirect_to aucrecords_url }\n format.json { head :no_content }\n end\n end",
"def delete(path)\n RestClient.delete request_base+path\n end",
"def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @character = Character.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end",
"def delete\n render json: Alien.delete(params[\"id\"])\n end",
"def destroy\n @chemical_substance.destroy\n respond_to do |format|\n format.html { redirect_to chemical_substances_url, notice: 'Sustancia Quimica fue eliminada de forma exitosa.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to do |format|\n format.html { redirect_to conta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cervejarium = Cervejarium.find(params[:id])\n @cervejarium.destroy\n\n respond_to do |format|\n format.html { redirect_to cervejaria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @characteristic_detail.destroy\n respond_to do |format|\n format.html { redirect_to admin_characteristic_path(session[:characteristic]), notice: 'Características Eliminada' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cafeterium.destroy\n respond_to do |format|\n format.html { redirect_to cafeteria_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cadet = Cadet.find(params[:id])\n @cadet.destroy\n\n respond_to do |format|\n format.html { redirect_to cadets_url }\n format.json { head :no_content }\n end\n end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @critique.destroy\n respond_to do |format|\n format.html { redirect_to critiques_url, notice: 'Critique was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @character = current_user.characters.find(params[:id])\n @character.destroy\n\n respond_to do |format|\n format.html { redirect_to(characters_url) }\n format.xml { head :ok }\n end\n end",
"def delete path\n make_request(path, \"delete\", {})\n end",
"def destroy\n @capacitacion = Capacitacion.find(params[:id])\n @capacitacion.destroy\n\n respond_to do |format|\n format.html { redirect_to capacitacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caracteristica.destroy\n\n respond_to do |format|\n format.html { redirect_to material_url(@caracteristica.material) }\n format.xml { head :ok }\n end\n end",
"def destroy\r\n @sivic_celula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_celulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @contador.destroy\n respond_to do |format|\n format.html { redirect_to contadors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @terciaria_caracteristica.destroy\n respond_to do |format|\n format.html { redirect_to terciaria_caracteristicas_url, notice: 'Terciaria caracteristica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cont = Cont.find(params[:id])\n @cont.destroy\n\n respond_to do |format|\n format.html { redirect_to conts_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_contcelula.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contcelulas_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @game_characters = GameCharacters.find(params[:id])\n @game_characters.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_characters_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidades3.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades3s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @data = @recipe.delete(params[:id])\n render json: @data\n end",
"def destroy\n @comic.destroy\n respond_to do |format|\n format.html { redirect_to '/', notice: \"Comic \\\"#{@comic.name}\\\" was successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @collected_character = CollectedCharacter.find(params[:id])\n @collected_character.destroy\n\n respond_to do |format|\n format.html { redirect_to collected_characters_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @caracteristica_patologica.destroy\n respond_to do |format|\n format.html { redirect_to caracteristica_patologicas_url, notice: 'Caracteristica patologica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cow.destroy\n respond_to do |format|\n format.html { redirect_to kine_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cargo_eleicao = CargoEleicao.find(params[:id])\n @cargo_eleicao.destroy\n\n respond_to do |format|\n format.html { redirect_to cargo_eleicaos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conta.destroy\n params[:id] = nil\n respond_to do |format|\n format.html { redirect_to contas_path, notice: @@titulo + t('msg.remove') }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uchronia = Uchronia.find(params[:id])\n @uchronia.destroy\n\n respond_to do |format|\n format.html { redirect_to uchronias_url }\n format.json { head :no_content }\n end\n end",
"def delete(container_name, file_name)\n validate_path_elements(container_name, file_name)\n\n client.request(\n method: :delete,\n path: \"#{container_name}/#{file_name}\",\n expected: 204\n )\n end",
"def destroy\n @cfile.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 @ocat = Ocat.find(params[:id])\n @ocat.destroy\n\n respond_to do |format|\n format.html { redirect_to ocats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @regular_chemical.destroy\n respond_to do |format|\n format.html { redirect_to regular_chemicals_url, notice: 'Regular chemical was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @typerelsequence.destroy\n respond_to do |format|\n format.html { redirect_to typerelsequences_url, notice: 'Typerelsequence was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @chemical.destroy\n respond_to do |format|\n format.html { redirect_to chemicals_url, notice: 'Chemical was successfully deleted.' }\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 @cio.destroy\n respond_to do |format|\n format.html { redirect_to cios_url, notice: 'Cio excluido.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n @virus_characteristic.destroy\n\n respond_to do |format|\n format.html { redirect_to virus_characteristics_url }\n format.json { head :no_content }\n end\n end",
"def delete(options={})\n connection.delete(\"/\", @name)\n end",
"def destroy\n @cegonha = Cegonha.find(params[:id])\n @cegonha.destroy\n\n respond_to do |format|\n format.html { redirect_to cegonhas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cppic = Cppic.find(params[:id])\n @cppic.destroy\n\n respond_to do |format|\n format.html { redirect_to cppics_url }\n format.json { head :no_content }\n end\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end",
"def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @capitulo.destroy\n respond_to do |format|\n format.html { redirect_to capitulos_url, notice: 'Capitulo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @characteristic = Characteristic.find(params[:id])\n @characteristic.destroy\n\n respond_to do |format|\n format.html { redirect_to(characteristics_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @chosain.destroy\n respond_to do |format|\n format.html { redirect_to chosains_url, notice: 'Chosain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(id)\n request(:delete, \"/recipes/#{id}.json\")\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end",
"def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @caracteristica_tipo_vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to caracteristica_tipo_vehiculos_url, notice: 'Caracteristica tipo Vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @f_characteristic = FCharacteristic.find(params[:id])\n @f_characteristic.destroy\n\n respond_to do |format|\n format.html { redirect_to f_characteristics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @c_titul.destroy\n respond_to do |format|\n format.html { redirect_to c_tituls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete\n request(:delete)\n end",
"def destroy\n @craft.destroy\n respond_to do |format|\n format.html { redirect_to crafts_url, notice: '成功删除工艺.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ciclistum.destroy\n respond_to do |format|\n format.html { redirect_to ciclista_url, notice: 'Ciclistum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
[
"0.67664516",
"0.6712981",
"0.6622304",
"0.6600404",
"0.6595037",
"0.6564816",
"0.6544008",
"0.65417403",
"0.65376085",
"0.65118873",
"0.6508892",
"0.6495616",
"0.64875376",
"0.6487026",
"0.6485353",
"0.6485353",
"0.6485353",
"0.6485353",
"0.6485353",
"0.6485353",
"0.6485353",
"0.6485353",
"0.64700395",
"0.64629304",
"0.64598495",
"0.64451134",
"0.64423835",
"0.6427527",
"0.6426851",
"0.64229083",
"0.64180946",
"0.64178807",
"0.641664",
"0.64160126",
"0.6411405",
"0.63868546",
"0.63719904",
"0.63681835",
"0.6364756",
"0.6364756",
"0.6362244",
"0.63611907",
"0.6356546",
"0.6354069",
"0.6347651",
"0.6335889",
"0.6335303",
"0.6333985",
"0.6333978",
"0.63261807",
"0.63158876",
"0.6313928",
"0.6299349",
"0.6299008",
"0.6295482",
"0.6291197",
"0.62872493",
"0.6284606",
"0.6283212",
"0.6283197",
"0.62805283",
"0.62774855",
"0.6277246",
"0.6271347",
"0.6271116",
"0.6270291",
"0.6269264",
"0.6268073",
"0.6266547",
"0.6265299",
"0.62637645",
"0.6261289",
"0.62596697",
"0.62586486",
"0.625809",
"0.62538135",
"0.6253172",
"0.62517846",
"0.6249177",
"0.6246712",
"0.62433743",
"0.62422836",
"0.62362266",
"0.62362266",
"0.62362266",
"0.62362266",
"0.62340474",
"0.62313384",
"0.6222119",
"0.62156737",
"0.62144864",
"0.62125576",
"0.62125486",
"0.621082",
"0.62095433",
"0.6209349",
"0.62089264",
"0.6206381",
"0.6206334",
"0.620198"
] |
0.7373848
|
0
|
store! nil's the cache_id after it finishes so we need to remember it for deletition
|
def remember_cache_id(new_file)
@cache_id_was = cache_id
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def cache_store; end",
"def cache_store; end",
"def cache_store=(_arg0); end",
"def cache_store=(_arg0); end",
"def escribe_cache\n Rails.cache.write(\"cache_service_#{id}\", true, :expires_in => 1.week)\n end",
"def before_commit\n cache.delete(id)\n end",
"def flush!\n @_cache = {}\n end",
"def clear_cache() @cache = {}; end",
"def update_cache(ticket, cache)\n cache[ticket[:spacekey]] = ticket[:id] if seen?(ticket, cache)\n cache\n end",
"def cache!\n @@cache\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def remember_cache_id(new_file)\n @cache_id_was = cache_id\n end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def cache; end",
"def expire_cache!\n @snapshot = nil\n end",
"def set_cache(value); end",
"def set_cache(value); end",
"def flush_cache; end",
"def invalidate!\n @cache = MiniCache::Store.new\n return nil\n end",
"def clear_cache; end",
"def cache(data); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def cache=(_arg0); end",
"def refill\n now = Time.now.to_i\n cache_set.each {|rec|\n ttl = rec[:end_ts].to_i - now\n cache_write( rec[:key], rec[:value], ttl ) if ttl > 0 \\\n if rec[:value] and rec[:value].length > MAX_OBJ_SIZE and ttl > 0\n }\n end",
"def cache\n if self.cache_store\n self.cache_store\n else\n self.cache_store = :file_store, root.join(\"tmp\").to_s\n self.cache_store\n end\n end",
"def cache_clear\n @store.clear\n end",
"def cache_key(id); end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n persist('memory_only_ser')\n end",
"def save(key, data)\n self.ready\n \n unless @validId.nil?\n\t\t\t\traise SwapDmi::CacheSaveError.new(key) unless self.instance_exec(key, &@validId)\n end\n \n self.evict(key) if @evictWhen[:save]\n self.instance_exec(key, data, &@save)\n self\n end",
"def add_to_cache\n redis.hset 'identifiers', self.typed_id, item.typed_id\n redis.sadd 'identifier:' + item.typed_id, self.typed_id\n end",
"def delete_cache\n if self.id != nil && current_user != nil\n cache_key = \"activities/Users/#{current_user.id}/#{self.class.name}/#{self.id}-#{(self.updated_at.to_f * 1000).round(0)}\"\n Chorus.log_debug \"-- BEFORE SAVE: Clearing cache for #{self.class.name} with ID = #{self.id} --\"\n Rails.cache.delete(cache_key)\n return true # Prevent a missing key from the callback chain\n end\n end",
"def move_to_cache\r\n true\r\n end",
"def store_in_cache(request, response)\n response.body = response.body.to_s\n metastore.store(request, response, entitystore)\n nil\n end",
"def cache_set(ck, obj)\n @cache_store.set(ck, obj, @cache_ttl)\n end",
"def store(request, response)\n return unless response.cachable?\n\n entries = cache_entries_for(request)\n entries[request] = response\n\n @memcache[request.to_mc_key] = entries\n end",
"def store\n @cache.compute_if_absent(current_store_id) { new_store }\n end",
"def cache\n @cache ||= {}\n end",
"def move_to_cache\n true\n end",
"def set_cache\n cache_key = self.class.cache_key(self.key)\n Rails.cache.write(cache_key, self.actual_value)\n end",
"def cache_clear\n @store.delete\n end",
"def cached?; end",
"def store(request_id)\n if (log_to_be_stored = combined_log).present?\n redis.setex \\\n request_key(request_id),\n FullRequestLogger.ttl,\n compress(log_to_be_stored)\n end\n ensure\n clear\n end",
"def flush_cache\n Rails.cache.delete([self.class.name, symbol_was.to_s])\n Rails.cache.delete([self.class.name, id])\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def move_to_cache\n true\n end",
"def cache_key\n end",
"def update_cache\n return '' if disabled?\n\n key = \"#{identity_cache_key}:#{short_sha1}:#{Time.now.to_f}\"\n ArCache.write(identity_cache_key, key, raw: true, expires_in: 20.years)\n key\n end",
"def cache_delete(key)\n @cache_store.delete(key)\n nil\n end",
"def cache_store(key, value, options = {})\n key = namespaced(key)\n ttl = options[:ttl] rescue nil\n expires = Time.now + ttl if !ttl.nil?\n record = @store[:key => key]\n\n # Figure out if the record is new or already exists\n if !record\n record = @store.create(:key => key, :value => value, :expires => expires)\n record.value\n else\n record = record.update(:value => value, :expires => expires)\n record.value\n end\n end",
"def escribe_cache(recurso, tiempo = 1.day)\n Rails.cache.write(\"#{recurso}_#{id}\", :expires_in => eval(tiempo).to_f, :created_at => Time.now.to_f)\n end",
"def cache\n @cache ||= {}\n end",
"def cache\n @cache ||= {}\n end",
"def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end",
"def clear_cache!\n @cache = {}\n end",
"def clear_cache!\n @cache = {}\n end",
"def cache( object = nil )\n return @cache unless object\n @cache[ object.id ] = object\n end",
"def cache_store(*args)\n super { |key, value| @store[key] = value }\n end",
"def save_client_cache\n self.client_cache = @client.cache\n end",
"def cache_store(key, value, options = {})\n options[:expires] = options.delete(:ttl) || @options[:expires_in]\n @moneta.store(key, value, options)\n end",
"def clear_cache\n $redis.del self.id\n end",
"def clear_cache\n $redis.del self.id\n end",
"def cache_value?; end",
"def cache!(path)\n puts \"Caching library\"\n redis.flushall\n it = ITunes::Library.load path\n playlist = it.find_playlist('Echotunes')\n raise 'Create a \"Echotunes\" playlist in iTunes' unless playlist\n\n playlist.tracks.each do |track|\n redis.set redis.track_id(track.id), Marshal.dump(track.to_hash)\n end\n\n # TODO Don't leave this binary...recache every so often\n redis.set 'cached', Time.now\nend",
"def update_cache(type, id, data)\n end",
"def update_cache(type, id, data)\n end",
"def cache=(cache)\n expire_index!\n @cache = cache\n end",
"def clear!\n @cache = {}\n end",
"def clear_cache\n @cache = {}\n end",
"def set(data)\n data = data.to_json\n cache_key = Digest::SHA1.hexdigest(data)\n\n log(\"insert :Cache, #{cache_key} -> {'blob' => #{data.inspect}}\")\n connection.insert(:Cache, cache_key, { \"blob\" => data })\n cache_key\n end",
"def after_create(resume) \n expire_cache_for(resume) \n end",
"def invalidate_cache! now\n end",
"def clear\n\n set_id_to_cache_key_map\n\n cache_response = fetch\n @id_to_cache_key_map.each do |id, key|\n Memcache.delete(key)\n Memcache.delete(\"ca_sa_shared_de_sa_cs_#{cache_response[id][:api_key]}\")\n end\n\n nil\n\n end",
"def cache_key; @cache.to_sym; end",
"def clear!\n @cache.delete(current_store_id)\n end",
"def after_create(entry)\n expire_cache_for(entry)\n end",
"def autorestore; end",
"def update_cache(type, id, data)\n end",
"def flush_cache(cache)\n cache[:last_checked] = @last_checked\n File.open(@data_file, 'w') do |out|\n YAML.dump(cache, out)\n end\n end",
"def update_cache\n # Does nothing...up to subclasses to implement.\n end",
"def cache_store(key, value, options = {})\n ttl = options[:ttl] || @options[:expires_in]\n\n @client.setex(key, ttl, ::Marshal.dump(value))\n\n return value\n end",
"def cache!(io, phase:)\n cache.upload(io, context.merge(phase: phase))\n end",
"def remove_from_cache\n redis.hdel 'identifiers', self.typed_id\n redis.srem 'identifier:' + item.typed_id, self.typed_id\n end",
"def flush_cache\n KitSaasSharedCacheManagement::TokenDetails.new([client_id]).clear\n KitSaasSharedCacheManagement::TokenByTokenId.new([id]).clear\n end",
"def simple_cache\n @@cache_store\n end"
] |
[
"0.70733666",
"0.70733666",
"0.70002025",
"0.70002025",
"0.68247736",
"0.6720141",
"0.6549733",
"0.6517653",
"0.64939106",
"0.6480127",
"0.64477515",
"0.64399475",
"0.6386983",
"0.6386983",
"0.6386983",
"0.6386983",
"0.6386983",
"0.6386983",
"0.6386983",
"0.6334964",
"0.6329964",
"0.6329964",
"0.63253736",
"0.6262036",
"0.6204379",
"0.61802584",
"0.6175602",
"0.6175602",
"0.6175602",
"0.6175602",
"0.616458",
"0.6140637",
"0.61248565",
"0.6121301",
"0.6097705",
"0.6097705",
"0.60970086",
"0.6095711",
"0.6092839",
"0.60872644",
"0.6084392",
"0.60776716",
"0.6068063",
"0.606644",
"0.606149",
"0.6053178",
"0.60508794",
"0.6036943",
"0.60298836",
"0.602823",
"0.602674",
"0.6016198",
"0.60161555",
"0.60161555",
"0.60161555",
"0.6003796",
"0.5996077",
"0.5995769",
"0.59869796",
"0.59757555",
"0.59466195",
"0.59466195",
"0.59442073",
"0.59239334",
"0.59239334",
"0.59198654",
"0.5918321",
"0.5916623",
"0.59151834",
"0.590931",
"0.590931",
"0.5908155",
"0.5905631",
"0.5898119",
"0.5898119",
"0.5893953",
"0.5880468",
"0.58672786",
"0.58656245",
"0.586422",
"0.5862404",
"0.58543634",
"0.5844048",
"0.5835281",
"0.58340025",
"0.58314943",
"0.5830876",
"0.58277565",
"0.58119994",
"0.580229",
"0.5794409",
"0.5791558",
"0.5790104",
"0.57872117"
] |
0.6529188
|
13
|
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
|
def extension_white_list
%w(jpg jpeg gif png)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w[jpg jpeg gif png]\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png)\n end",
"def extension_whitelist\n %w[jpg jpeg png]\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png pdf)\n end",
"def extension_whitelist\n %w(jpg jpeg gif png tif tiff avi m4v mov mp4 mpg mpeg mpeg wmv qt)\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_whitelist\n %w[png jpg jpeg]\n end",
"def extension_allowlist\n %w(jpg jpeg png)\n end",
"def extension_whitelist\n Spotlight::Engine.config.allowed_upload_extensions\n end",
"def extensions_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg JPG jpeg JPEG gif GIF png PNG)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png JPG JPEG GIF PNG)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\r\n %w(jpg jpeg png)\r\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_white_list\n %w(jpg jpeg gif png pdf)\n end",
"def extension_whitelist\n %w[txt csv xls xlsx doc docx gif jpg jpeg png bmp svg pdf ppt pptx]\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg gif png)\n end",
"def extension_white_list\n %w(jpg jpeg png)\n end"
] |
[
"0.8159334",
"0.81505024",
"0.81505024",
"0.81505024",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81259763",
"0.81250226",
"0.80939883",
"0.80939883",
"0.80939883",
"0.8090943",
"0.79984885",
"0.79377717",
"0.79377717",
"0.79169697",
"0.7839252",
"0.7817261",
"0.77454793",
"0.77219033",
"0.7696474",
"0.7687402",
"0.7687402",
"0.7684333",
"0.76805884",
"0.7658339",
"0.7658339",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.7651603",
"0.76349944",
"0.7632248",
"0.7632248",
"0.7632248",
"0.76318276",
"0.7628001",
"0.7628001",
"0.7628001",
"0.7616462"
] |
0.766807
|
36
|
Override the filename of the uploaded files:
|
def filename
@name ||= "#{model.firstname.parameterize}-#{model.lastname.parameterize}.#{model.image.file.extension}"
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def filename\n if super.present?\n @name ||=\"#{SecureRandom.hex}.#{file.extension.downcase}\" if original_filename\n Rails.logger.debug(\"(BaseUploader.filename) #{@name}\")\n @name\n end\n end",
"def file_name\n uploaded_file_file_name\n end",
"def original_filename\n fake_file_name || super\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def set_file_name\n update(name: (file.filename rescue \"Untitled File\"))\n end",
"def filename\n \"#{original_filename_without_extension.parameterize}_#{model.filename_token}#{original_extension}\" if original_filename\n end",
"def filename\n if super.present?\n # current_path 是 Carrierwave 上传过程临时创建的一个文件,有时间标记,所以它将是唯一的\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}.#{ext}\"\n end\n end",
"def filename\n @filename = \"#{secure_token}_#{split_extension(original_filename)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n if original_filename\n \"#{model.name.parameterize}-#{secure_token(8)}.#{file.extension}\"\n end\n end",
"def filename\n original_filename\n end",
"def full_filename( for_file )\n super.downcase\n # super.chomp( File.extname( super ) ) + '.jpg'\n end",
"def filename\n \"#{model.name.parameterize}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n if original_filename\n # This is pretty gross. We only want to reuse the existing filename if\n # a new avatar isn't being uploaded, we look at the *_change attribute to\n # determine if that happened.\n if model && model.read_attribute(mounted_as).present? && !model.send(:\"#{mounted_as}_change\")\n model.read_attribute(mounted_as)\n else\n # new filename\n @name ||= \"#{timestamp}.#{model.send(mounted_as).file.extension}\" if original_filename\n end\n end\n end",
"def filename\n @name ||= \"#{timestamp}-#{secure_token(8)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token(10)+File.extname(original_filename)}\" if original_filename.present?\n end",
"def filename\n \"#{original_filename}+#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def file_name=(value)\n @file_name = value\n end",
"def file_name=(value)\n @file_name = value\n end",
"def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end",
"def filename\n if super.present?\n @name ||= Digest::MD5.hexdigest(File.dirname(current_path))\n \"#{@name}#{File.extname(original_filename).downcase}\"\n end\n end",
"def file_name\n \"#{@file_name}.#{extension}\"\n end",
"def filename\n \"#{mounted_as}1.#{model.image.file.extension}\" if original_filename\n end",
"def filename\n @name ||= \"#{md5}.#{file.extension}\" if original_filename.present?\n end",
"def original_file_name\n object.original_file_name.nil? ? \"\" : object.original_file_name\n end",
"def original_file_name\n object.original_file_name.nil? ? \"\" : object.original_file_name\n end",
"def original_filename; end",
"def filename\n @original_filename\n end",
"def filename\n \"#{secure_token(10)}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n if original_filename.present?\n \"#{model.story.slug}-#{secure_token}.#{file.extension}\"\n end\n end",
"def filename\n super\n end",
"def filename\n if original_filename\n md5 = Digest::MD5.hexdigest(\"#{model.imagenable.friendly_id}_#{Time.now}\")\n \"#{md5}.#{file.extension}\"\n end\n end",
"def filename\n if original_filename\n var = :\"@#{mounted_as}_unique_file_name\"\n model.instance_variable_get(var) or model.instance_variable_set(var, unique_file_name)\n end\n end",
"def filename\n sanitize(original_filename) if original_filename\n end",
"def default_file_name\n ''\n end",
"def filename\n \"#{resize_prefix}_#{original_filename}\"\n end",
"def generate_file_name\n file_name = attachment.instance_read(:file_name).slugged_filename\n attachment.instance_write :file_name, file_name\n end",
"def set_filename_from_parent\n components = parent.filename.split('.')\n if components.size > 1\n ext = components.last\n name = components[0, components.size - 1].join('.')\n else\n ext = 'mp3'\n name = parent.filename\n end\n name = Digest::SHA1.hexdigest(\"KroogiFileDownload-#{id}-#{name}\")\n \n self.filename = \"#{name}.#{ext}\"\n end",
"def file_name\n self.file_file_name\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename\n end",
"def original_filename\n @file_representation.original_filename\n end",
"def original_filename\n @file_representation[:filename]\n end",
"def filename_for_image_upload\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}--#{current_user.id.to_s}\").first(15)\n \"temp_upload_#{random_token}\"\n end",
"def filename_for_image_upload\n random_token = Digest::SHA2.hexdigest(\"#{Time.now.utc}--#{current_user.id.to_s}\").first(15)\n \"temp_upload_#{random_token}\"\n end",
"def filename\n \"application_#{model.hash}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present?\n end",
"def filename\n if original_filename\n if model && model.read_attribute(mounted_as).present?\n model.read_attribute(mounted_as)\n else\n @name ||= \"#{mounted_as}-#{uuid}.#{file.extension}\"\n end\n end\n end",
"def filename\n \"#{model.original_name}\"\n end",
"def original_filename\n @original_filename ||= path.basename.to_s\n end",
"def filename\n \"#{folder_id}#{File.extname(super)}\"\n end",
"def set_name\n self.name = self.asset.original_filename\n end",
"def filename\n \"#{secure_token}.#{file.extension}\" if original_filename.present? \n end",
"def filename= name\n #This is a stub, used for indexing\n end",
"def filename(name)\n @filename = name.downcase.strip.gsub(' ', '-')\n end",
"def filename\n \"#{options.filename}.#{options.filetype}\"\n end",
"def filename\n puts model.name\n puts original_filename\n model.name + File.extname(original_filename)\n end",
"def filename(record, file)\n original = \"#{file.basename}.#{file.extension}\"\n write_attribute(:original_filename, original)\n ext = file.suffix.nil? || file.suffix == :original ? file.extension : file.suffix\n \"#{application_for_offering.id.to_s}-#{title.gsub(/[\\s,\\.\\\\\\/\\*\\?\\%\\:\\|\\\"\\'\\<\\>]?/,'')}.#{ext}\"\n end",
"def filename\n @file.basename.to_s\n end",
"def filename\n if super.present?\n \"#{secure_token}.#{file.extension}\"\n end\n end",
"def file_name\n \"#{Time.current.to_i}-#{@file.original_filename}\"\n end",
"def file_name\n @file_name\n end",
"def filename=(value)\n @old_filename = full_filename unless filename.nil? or @old_filename\n write_attribute :filename, sanitize_filename(value)\n end",
"def processed_original_filename\n processed_filename original_filename_without_extension, original_filename_extension\n end",
"def filename\n if original_filename.present? && model.photoable.present?\n \"#{model.photoable.display_name.parameterize}-#{secure_token}.#{file.extension}\"\n elsif original_filename.present? && model.photoable.blank?\n \"mydiscoveries-#{secure_token}.#{file.extension}\"\n end\n end",
"def image_file_name= value\n super if value.present?\n end",
"def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end",
"def original_filename\n File.basename(@file_path)\n end",
"def original_filename\n instance_read(:file_name)\n end",
"def filename(upload = file)\n @@_filename ||= lambda {\n if upload.present?\n current_filename = upload.filename.match(/(.+)\\.csv$/).captures.first\n \"#{model.uuid}-#{current_filename}.csv\"\n end\n }.call\n end",
"def original_filename\n metadata[\"filename\"]\n end",
"def original_filename\n File.basename(self.path)\n end",
"def original_filename\n File.basename(self.path)\n end",
"def original_filename\n File.basename(self.path)\n end",
"def filename\n @name ||= ActiveSupport::SecureRandom.hex\n\t\"#{@name}#{File.extname(original_filename).downcase}\" if original_filename\n end",
"def filename=(name)\n @filename = File.basename(name)\n end",
"def filename=(value)\n @old_filename = filename unless filename.nil? || @old_filename\n write_attribute :filename, sanitize_filename(value)\n end",
"def filename\n unless @filename\n @filename = @path.basename.to_s\n end\n\n @filename\n end",
"def filename\n model.respond_to?(:filename) ? model.filename : super\n end",
"def filename\n filename = (model.name + '_' + model.artist.name + '_' + model.release.name).downcase.gsub(/\\s/, '-')\n \"#{filename}\" if original_filename \n end",
"def default_file_name\n \"#{klass_name.underscore}_#{id}\"\n end",
"def file name\n \n end",
"def original_filename\n @original_filename ||= File.basename(path)\n end",
"def file_name\n name.underscore\n end",
"def file_name\n potential_name = params[:filename] || file.original_name || (asset.respond_to?(:label) && asset.label) || file.id\n potential_name = potential_name.gsub(/[,;]/, '')\n potential_extension = ''\n if file.mime_type == 'image/png'\n potential_extension = '.png'\n elsif file.mime_type == 'image/tiff'\n potential_extension = '.png'\n elsif file.mime_type == 'image/jpeg' || file.mime_type == 'image/jpg'\n potential_extension = '.jpg'\n end\n return potential_name\n #return potential_name + potential_extension\n end",
"def processed_original_filename_without_extension\n processed_filename original_filename_without_extension\n end",
"def fix_filename\n unless self.filename.blank?\n self.filename.sub!(/^.*\\/([^\\/]*)$/, '\\1')\n self.filename += '.torrent' unless self.filename =~ /\\.torrent$/\n end\n end",
"def original_file # Accessor for probably protected value original_filename\r\n original_filename\r\n end",
"def custom_filename(file, opts = {})\n file = CarrierWave::SanitizedFile.new(file) if file.is_a?(String)\n base_name = model.respond_to?(\"#{mounted_as}_token\") ? model.send(\"#{mounted_as}_token\") : file.basename\n base_name = \"#{base_name}_cropped_#{crop_args.join('_')}\" if croppable? && opts[:cropping]\n base_name = [opts[:version], base_name].compact.join('_')\n [base_name, file.extension].join('.')\n end",
"def upload_file=(file_name)\n self.file_field(:id=>\"multifile_upload\").set(File.expand_path(File.dirname(__FILE__)) + \"/../../data/sakai-oae/\" + file_name)\n end",
"def to_actual_filename!\n filename = to_actual_filename\n replace(filename) if filename\n end",
"def filename\n #\"#{original_filename.split('.').first}.png\" if original_filename\n \"img.#{original_filename.split('.').last}\" if original_filename\n #original_filename if original_filename\n end",
"def assignment_upload_file_name\n read_attribute(:file_name)\n end",
"def filename\n @filename ||= attached_file&.original_filename&.dup\n end",
"def default_name\n self.name ||= File.basename(data_file.filename, '.*').titleize if data_file.filename && !self.name\n end",
"def file_name\n return @file_name\n end",
"def file_name\n return @file_name\n end",
"def filename\n unless @filename\n load_file_params\n end\n @filename\n end",
"def full_filename (for_file = model.source.file)\n super.chomp(File.extname(super)) + '.png'\n end",
"def filename\n \"something.jpg\" if original_filename\n end"
] |
[
"0.77587795",
"0.77092165",
"0.7650253",
"0.76119834",
"0.76119834",
"0.7511504",
"0.7509861",
"0.7469618",
"0.7408529",
"0.7325303",
"0.7303221",
"0.7293142",
"0.72422063",
"0.7219045",
"0.717902",
"0.7177287",
"0.71570605",
"0.71570605",
"0.7156595",
"0.7156595",
"0.71199685",
"0.71060795",
"0.7078763",
"0.7055206",
"0.7055206",
"0.70549446",
"0.7051379",
"0.7042117",
"0.7037963",
"0.70329183",
"0.70156527",
"0.7000826",
"0.69688857",
"0.69544435",
"0.69500697",
"0.69326687",
"0.6927857",
"0.6925345",
"0.6905939",
"0.6900493",
"0.6882137",
"0.68809104",
"0.68809104",
"0.68774104",
"0.6858724",
"0.6858724",
"0.6858724",
"0.68583566",
"0.6851462",
"0.6842949",
"0.6831099",
"0.683003",
"0.68283087",
"0.6826605",
"0.6825505",
"0.6805264",
"0.6804222",
"0.6792292",
"0.6785332",
"0.6772306",
"0.67703664",
"0.6766309",
"0.67125064",
"0.671188",
"0.6705976",
"0.66968745",
"0.6684644",
"0.6676638",
"0.66709805",
"0.66707826",
"0.66682374",
"0.6648865",
"0.6648865",
"0.6648865",
"0.6647036",
"0.6643361",
"0.6638393",
"0.66348225",
"0.66304153",
"0.6623784",
"0.6606556",
"0.66008097",
"0.65934175",
"0.65812045",
"0.6571191",
"0.6563757",
"0.65520394",
"0.6550502",
"0.6538596",
"0.6535129",
"0.6527255",
"0.65192956",
"0.6518568",
"0.6518133",
"0.65173864",
"0.65096986",
"0.65096986",
"0.6508294",
"0.65067494",
"0.6501712"
] |
0.6885877
|
40
|
Helper method to delete znodes
|
def delete_node(path, force = false)
while true
begin
@zk.delete(path)
puts "Deleted #{path}"
rescue ZK::Exceptions::NotEmpty
# Catch node exists, walk lower, call delete_node w/ args on it.
# This will recursively delete nodes under a path.
if force
children = @zk.children(path)
children.each do |child_path|
delete_node("#{path}/#{child_path}", force)
end
else
puts "ERROR: Cannot delete #{path} as it is not empty. Delete with force to recursively delete"
break
end
rescue ZK::Exceptions::NoNode
# break the while loop if no node is reported
break
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def delete_node\n node.destroy if node\n end",
"def destroy\n chef_server_rest.delete(\"nodes/#{name}\")\n end",
"def delete!\n PoolNode.rmdir(@id)\n super\n Address.delete(@id)\n Subnet.delete(@subnet)\n end",
"def delete_node(l)\n node = Node.find_by(layer: l).destroy\n Connection.destroy_all(parent_id: node.id)\n Connection.destroy_all(child_id: node.id)\n end",
"def delete_node(current_node)\n\nend",
"def delete_path(path)\n @zk.delete(path)\n logger.info(\"Deleted ZK node #{path}\")\n rescue ZK::Exceptions::NoNode => ex\n logger.info(\"Tried to delete missing znode: #{ex.inspect}\")\n end",
"def delete_node\n delete(@nodename)\n end",
"def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end",
"def delete_node(address)\n @cache.delete(address)\n @nodes.delete_blob(address)\n end",
"def delete\n CMark.node_unlink(@pointer)\n end",
"def destroy_nodes(nodes)\n ids = nodes.map do |node|\n case node\n when Node\n node.id\n when Hash\n node[:id] || node['id']\n else\n node\n end\n end\n ids_query = ids.map { |id| \"id=#{id}\" }.join('&')\n response = @connection.lbreq(\"DELETE\", @lbmgmthost, \"#{@lbmgmtpath}/loadbalancers/#{CloudLB.escape(@id.to_s)}/nodes?#{ids_query}\",@lbmgmtport,@lbmgmtscheme)\n CloudLB::Exception.raise_exception(response) unless response.code.to_s.match(/^202$/)\n true\n end",
"def delete_all(xpath); end",
"def delete(data)\n deleting(prev_n_current_nodes(data))\n end",
"def delete_tree\n @root = nil # In ruby it will be taken care by garbage collector\n end",
"def delete(node=nil, root=nil, &block)\n return super(node, root) do | dn | \n block.call(dn) if block\n dn.update_left_size(:deleted, -1) if dn\n end\n end",
"def delete(node)\n remove_node(node)\n end",
"def delete_head\r\n delete_node @head\r\n end",
"def zoneremove_standard(fabrickey, zonename, *aliases)\n result = @zones.alterzoning_standard(fabrickey, 'REMOVE', zonename, *aliases)\n result[1]\n end",
"def delete_tail\r\n delete_node @tail\r\n end",
"def zonedelete(fabrickey, *zonenames)\n result = @zones.zonedelete(fabrickey, *zonenames)\n result[1]\n end",
"def rm_rf(z, path)\n z.get_children(:path => path).tap do |h|\n if h[:rc].zero?\n h[:children].each do |child|\n rm_rf(z, File.join(path, child))\n end\n elsif h[:rc] == ZNONODE\n # no-op\n else\n raise \"Oh noes! unexpected return value! #{h.inspect}\"\n end\n end\n\n rv = z.delete(:path => path)\n\n unless (rv[:rc].zero? or rv[:rc] == ZNONODE)\n raise \"oh noes! failed to delete #{path}\" \n end\n\n path\n end",
"def erase\n @nodes.erase\n end",
"def db_delete\n assert_privileges(\"db_delete\")\n db = MiqWidgetSet.find(params[:id]) # temp var to determine the parent node of deleted items\n process_elements(db, MiqWidgetSet, \"destroy\")\n g = MiqGroup.find(@sb[:nodes][2].split('_').first)\n # delete dashboard id from group settings and save\n db_order = g.settings && g.settings[:dashboard_order] ? g.settings[:dashboard_order] : nil\n db_order&.delete(db.id)\n g.save\n nodes = x_node.split('-')\n self.x_node = \"#{nodes[0]}-#{nodes[1]}-#{nodes[2].split('_').first}\"\n replace_right_cell(:replace_trees => [:db])\n end",
"def delete(nodeidentifier)\n node = @nodes[nodeidentifier]\n @nodes[nodeidentifier] = nil\n @edges.delete node\n @back_edges.delete node\n end",
"def delete_front()\n \n end",
"def clean_neo4j\n neo_connection.execute_query(\"START n0=node(0),nx=node(*) MATCH n0-[r0?]-(),nx-[rx?]-() WHERE nx <> n0 DELETE r0,rx,nx\")\nend",
"def delete\n extract.children.to_a.each(&:extract)\n end",
"def ajax_delete_node\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # If node exits, then remove the node\n if !node.nil?\n node.destroy\n end\n\n end",
"def empty\n delete_old_nodes 0\n end",
"def destroy\n getnodes.each{|node|\n Sys.exec(\"vagrant destroy #{node.name} -f\")\n }\n end",
"def destroy\n @zone.destroy\n\n head :no_content\n end",
"def delete_content(nodes)\n nodes.each do |node|\n chapters = node.chapters\n chapters.each do |chapter|\n awsdocuments = chapter.awsdocuments\n awsdocuments.each do |awsdocument|\n awsdocument.destroy\n end\n chapter.destroy\n end\n node.destroy\n end\n end",
"def zoneremove_peerzone(fabrickey, zonename, **wwns)\n result = @zones.alterzoning_peerzone(fabrickey, 'REMOVE', zonename, **wwns)\n result[1]\n end",
"def delete_all\n Neo.db.execute_query(\"#{initial_match} OPTIONAL MATCH (n0)-[r]-() DELETE n0,r\")\n end",
"def destroy\n @parent = nil\n @root = nil\n end",
"def delete(element); end",
"def delete_gdom_dir(options)\n gdom_dir = $ldom_base_dir+\"/\"+options['name']\n destroy_zfs_fs(gdom_dir)\n return\nend",
"def delete!\n\t\t\tClient.delete @root\n\t\tend",
"def delete_entry(aliaz)\n\n end",
"def delete_uncompressed_backups\n end",
"def destroy\n requires :id\n \n service.delete_nat_gateway(id)\n true\n end",
"def teardown\n @root.remove!(@left_child1)\n @root.remove!(@right_child1)\n @root = nil\n end",
"def test_delete_node_tree_r_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [8, 10]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end",
"def destroy\n b.node.destroy\n respond_to do |format|\n format.html { redirect_to nodes_url, notice: 'Node was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_node(tree_match)\n descendants.find{|i| i === tree_match}\n .delete_node(tree_match)\n update_height\n self\n end",
"def destroy; delete end",
"def removeNodeAtPos(xml, index)\n\n attribs = xml[\"nodeAttributes\"]\n size = xml[\"childCount\"].to_i\n returnHash = xml.delete(index)\n for j in (index+1)..size\n\n temp = xml.delete(j)\n xml[j-1] = temp\n end\n xml[\"childCount\"] = (size-1)\n return returnHash\n end",
"def delete; rest_delete(link('self')); end",
"def delete; rest_delete(link('self')); end",
"def destroy\n @ozone.destroy\n\n end",
"def delete_all_node_groups\n delete_node_group_descendents(get_node_group(Rootuuid))\n end",
"def delete_node(xpath, attrs)\n @doc.find(xpath).each do |node|\n node.remove! if node_match?(node, attrs)\n end\n end",
"def delete!\n graph.removeVertex element\n end",
"def delete(id)\n request(:delete, \"/network_zones/#{id}.json\")\n end",
"def destroy_empty\n @obj = Node.find(params[:id])\n @obj.destroy_empty\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @zanyatium.destroy\n respond_to do |format|\n format.html { redirect_to zanyatia_url, notice: 'Запись успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def delete_node(xn, send_to_deleted_text, send_to_notes)\n @xn_context.process_children = false\n add_deleted_text(xn, xn.text) if send_to_deleted_text\n add_notes(xn, \"Deleted text: #{ xn.text }\") if send_to_notes\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n project = Project.where(:user_id => current_user[:id]).first\n project.optimized = false\n project.loading = false\n project.save\n @nodes = Node.where(:user_id => current_user[:id])\n @nodes.each do |node|\n node.jobnumber = nil\n node.vehicle_id = nil\n node.servicetime = nil\n node.tour_id = nil\n node.save\n end\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n n = Node.find_key(params[:id] || params[:name])\n render api_delete Node\n end",
"def destroy!\n children = @zk.children(full_queue_path)\n locks = []\n children.each do |path|\n lock = @zk.locker(\"#{full_queue_path}/#{path}\")\n lock.lock!\n locks << lock\n end\n children.each do |path|\n @zk.delete(\"#{full_queue_path}/#{path}\")\n end\n @zk.delete(full_queue_path)\n locks.each do |lock|\n lock.unlock!\n end\n end",
"def destroy\n @node = Node.scopied.find(params[:id])\n @node.kill\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def remove_or_decrement_ref(*nodes); end",
"def remove\n each { |x| x.parent.children.delete(x) }\n end",
"def delete_old_nodes (days_to_keep = DAYS_TO_KEEP_NODE)\n children.where('updated_at < ?', Time.now - days_to_keep.day).each do |node|\n node.destroy_self_and_children!\n end\n end",
"def delete_min\n @root = delete_min_node(@root)\n end",
"def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end",
"def delete_children(id, gel)\n element_dataset.filter(container_id_sym => id).delete\n end",
"def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end",
"def delete_element(element); end",
"def purge_nodes(name)\n nodes = nodes_for_environment(name)\n futures = []\n\n nodes.each do |node|\n futures << ridley.client.future(:delete, node)\n futures << ridley.node.future(:delete, node)\n end\n\n futures.map(&:value)\n end",
"def test_delete_node_tree_l_2_nodes\n # Prep\n tree = BST::Tree.new\n val = [10, 8]\n val.each {|v| tree.insert(v)}\n tree.delete(val.last)\n # Test\n _delete_node_tree_hlpr(val, tree)\n end",
"def unlink \n @lnode.unlink unless @lnode.nil?\n end",
"def remove_node\n remove_node_helper(@root)\n end",
"def delete\n self.class.fire_event(NodeDeletedEvent.new(self))\n relations.each {|r| r.delete}\n @internal_node.delete\n lucene_index.delete(neo_node_id)\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node = Node.find(params[:id])\n @node.destroy\n\n respond_to do |format|\n format.html { redirect_to(nodes_url) }\n format.xml { head :ok }\n end\n end",
"def delete_all\n neo4j_query(\"MATCH (n:`#{mapped_label_name}`) OPTIONAL MATCH (n)-[r]-() DELETE n,r\")\n end",
"def delete_branch\n #we'll get all descendants by level descending order. That way we'll make sure deletion will come from children to parents\n children_to_be_deleted = self.class.find(:all, :conditions => \"id_path like '#{self.id_path},%'\", :order => \"level desc\")\n children_to_be_deleted.each {|d| d.destroy}\n #now delete my self :)\n self.destroy\n end",
"def recursive_delete(path: nil)\n raise ArgumentError, \"path is a required argument\" if path.nil?\n\n result = zk.get_children(path: path)\n raise Kazoo::Error, \"Failed to list children of #{path} to delete them. Result code: #{result.fetch(:rc)}\" if result.fetch(:rc) != Zookeeper::Constants::ZOK\n\n threads = result.fetch(:children).map do |name|\n Thread.new do\n Thread.abort_on_exception = true\n recursive_delete(path: File.join(path, name))\n end\n end\n threads.each(&:join)\n\n result = zk.delete(path: path)\n raise Kazoo::Error, \"Failed to delete node #{path}. Result code: #{result.fetch(:rc)}\" if result.fetch(:rc) != Zookeeper::Constants::ZOK\n end",
"def delete_node(node)\n ## just copy the information of the next node and then cut it out\n node.id = node.next.id\n node.next = node.next.next\nend",
"def delete(value)\n find_node(value)&.delete\n end",
"def delete!\n graph.remove_vertex element\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_at(p0) end",
"def delete_network(request, params)\n network = VirtualNetworkOCCI.new(\n VirtualNetwork.build_xml(params[:id]),\n @client)\n\n # --- Delete the VNET ---\n rc = network.delete\n if OpenNebula.is_error?(rc)\n return rc, CloudServer::HTTP_ERROR_CODE[rc.errno]\n end\n\n return \"\", 204\n end",
"def destroy\n @f5_node = F5Node.find(params[:id])\n @f5_node.destroy\n\n respond_to do |format|\n format.html { redirect_to f5_nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @map_node = Map::Node.find(params[:id])\n @map_node.destroy\n\n respond_to do |format|\n format.html { redirect_to map_nodes_url }\n format.json { head :ok }\n end\n end",
"def delete_node(index)\n # find the index of the node and call the block in order to acess the properties\n # and parent required to keep the code DRY\n find(index) do |parent, to_be_deleted, property|\n if to_be_deleted.left_child.nil? and to_be_deleted.right_child.nil?\n # if both the nodes left and right child are nil then this means we can\n # simply remove the node without having to do any extra leg work\n set_replacement(parent, to_be_deleted, nil, property)\n elsif to_be_deleted.right_child.nil?\n # if just the right child is nil then all we have to do is move up the left_child \n replacement = to_be_deleted.left_child\n set_replacement(parent, to_be_deleted, replacement, property) \n elsif to_be_deleted.left_child.nil?\n # if jus the left child is nil then all we have to do is move up the right_child\n replacement = to_be_deleted.right_child\n set_replacement(parent, to_be_deleted, replacement, property) \n else\n # otherwise we need to locate the lowest left child of tree, we store it in a pointer \n # in memory and then delete it from the tree by calling the method again\n replacement = min_left_child(to_be_deleted.right_child)\n delete_node(replacement.key)\n\n # then we assing the node to be deleted left and right child values\n replacement.left_child = to_be_deleted.left_child \n replacement.right_child = to_be_deleted.right_child\n\n # once the replacement node has the correct values and has been removed from its previous\n # position we call the set replacement method on the node to be deleted parent in order\n # to remove it from refrence in the tree\n set_replacement(parent, to_be_deleted, replacement, property)\n end\n end\n end",
"def delete(args)\n args = {:path => args} unless args.is_a?(Hash)\n assert_supported_keys(args, [:path, :version, :callback, :context])\n assert_required_keys(args, [:path])\n args[:version] ||= -1\n\n if args[:callback] ## asynchronous\n raise KeeperException::BadArguments unless args[:callback].kind_of?(VoidCallback)\n return zoo_adelete(@zk_handle, args[:path], args[:version], args[:callback].proc, YAML.dump(args[:context]))\n end\n\n ## synchronous\n rc = zoo_delete(@zk_handle, args[:path], args[:version])\n raise KeeperException.by_code(rc), ZooKeeperFFI::zerror(rc) unless rc == ZOK\n return rc\n end",
"def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end",
"def delete!\n graph.remove_edge element\n end",
"def delete!\n graph.remove_edge element\n end",
"def destroy\n @obj = Node.find(params[:id])\n @obj.destroy\n\n respond_to do |format|\n format.html { redirect_to :back}\n format.json { head :no_content }\n end\n end",
"def delete_at_index(index)\n if index.zero?\n self.first_node = first_node.next_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 node_after_deleted_node = current_node.next_node.next_node\n current_node.next_node = node_after_deleted_node\n end\n end",
"def free\n CMark.node_unlink(@pointer)\n CMark.free_nodes(@pointer)\n end",
"def delete(root, data)\n return if data.nil?\n\n target = find(root, data)\n return if target.nil?\n\n last_node = find_last(@root, @count)\n target == last_node ? remove_last_node(target) : remove(target)\n end",
"def cleanup_zone(zone, domain, namespace, ingress_name)\n if is_zone_empty?(zone.hosted_zone.id)\n delete_zone(zone.hosted_zone.id)\n else\n delete_a_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace, ingress_name)\n delete_txt_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace)\n delete_zone(zone.hosted_zone.id)\n end\nend"
] |
[
"0.650912",
"0.6470525",
"0.6456191",
"0.64444256",
"0.6336328",
"0.6295006",
"0.62753695",
"0.625475",
"0.6196137",
"0.617878",
"0.60367924",
"0.59813136",
"0.59520453",
"0.5942409",
"0.594054",
"0.58667934",
"0.58645576",
"0.5863295",
"0.575592",
"0.57541513",
"0.57482266",
"0.57466286",
"0.5726065",
"0.57067305",
"0.5697466",
"0.5696057",
"0.56907135",
"0.56889284",
"0.5685071",
"0.56849855",
"0.56825346",
"0.5681445",
"0.56807",
"0.5674659",
"0.5663993",
"0.5656631",
"0.56472766",
"0.5639737",
"0.5632324",
"0.56114537",
"0.56037396",
"0.5590375",
"0.55787957",
"0.55699575",
"0.55622864",
"0.55558777",
"0.55553883",
"0.55534744",
"0.55534744",
"0.5548237",
"0.55454206",
"0.55296826",
"0.55222386",
"0.55212665",
"0.5518487",
"0.55142415",
"0.5506802",
"0.5506135",
"0.5505108",
"0.5500322",
"0.55002844",
"0.5496732",
"0.54950875",
"0.5479924",
"0.54777217",
"0.54753447",
"0.54747736",
"0.5467729",
"0.54557276",
"0.5455548",
"0.54504985",
"0.5450032",
"0.5445825",
"0.5442086",
"0.54355896",
"0.54355896",
"0.54355896",
"0.54355896",
"0.54355896",
"0.5435543",
"0.54299176",
"0.5427595",
"0.5425088",
"0.54209524",
"0.541342",
"0.54118115",
"0.5405518",
"0.54045147",
"0.5399919",
"0.5396361",
"0.53959244",
"0.53928",
"0.53907555",
"0.5385189",
"0.5385189",
"0.53807485",
"0.53806984",
"0.5375242",
"0.53669757",
"0.53654855"
] |
0.5717679
|
23
|
If the passphrase contains one of "i", "o" or "l", we should skip past all the subsequent strings in the sequence that will also contain these letters.
|
def skip_known_failures(passphrase)
passphrase.gsub(/[iol].+$/) { |m| m.chars.first.next + ('a' * m[1..-1].size) }
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def skip?(char)\n !KEYMAP.include? char\n end",
"def is_valid_passchars?(passphrase)\n words = passphrase.split(' ').map { |word| word.chars.sort.join('') }\n words.uniq.length == words.length\nend",
"def encryptor(user_pass)\n counter = 0\n output = \"\"\n while counter < user_pass.length\n\n if user_pass[counter] == \" \"\n output += \" \"\n elsif user_pass[counter] == \"z\"\n # conditional for \"z\"\n output += \"a\"\n else\n output += user_pass[counter].next\n end\n\n counter += 1\n\n end\n\n return output\nend",
"def is_valid_passphrase?(passphrase)\n words = passphrase.split(' ')\n words.uniq.length == words.length\nend",
"def validate(passphrase)\n words = passphrase.split\n words == words.uniq\nend",
"def valid_password?(str)\n return false unless str.size == 6\n\n last = nil\n had_pair = false\n counter = 1\n\n str.each_char do |char|\n if last == char\n # puts 'raise'\n counter += 1\n else\n # puts \"ok - #{counter}\"\n had_pair = true if counter == 2\n counter = 1\n end\n\n # invalid decrease\n if last && char.to_i < last.to_i\n return false\n end\n\n last = char\n end\n\n had_pair || counter == 2\nend",
"def next_password(pw)\n l = pw.length\n pos = l - 1\n\n next_pw = pw.dup\n loop do\n if pos < 0\n next_pw = \"a\" + next_pw\n break\n elsif next_pw[pos] != 'z'\n next_pw[pos] = (next_pw[pos].ord + 1).chr\n next_pw[pos] = (next_pw[pos].ord + 1).chr if DENY_LETTERS.include? next_pw[pos]\n break\n else\n next_pw[pos] = 'a'\n pos -= 1\n end\n end\n next_pw\n end",
"def encrypt(password)\n end_password = password.length\n encrypt_counter = 0\n e_string = \"\"\n while encrypt_counter < end_password\n if password[encrypt_counter].next == \"aa\"\n e_string += \"a\"\n elsif password[encrypt_counter].next == \"!\"\n \t\te_string += \" \"\n else \n e_string += \"#{password[encrypt_counter]}\".next\n end\n encrypt_counter += 1\n end\n e_string\nend",
"def decrypt(my_string)\n i = 0\n new_string = \"\"\n # chose to create a new string to return rather than modify the input\n # string by side effect\n \n until i == my_string.length\n if $alphabet.index(my_string[i]) == nil\n new_string += my_string[i]\n else\n new_string += $alphabet[$alphabet.index(my_string[i])-1]\n #wraps automatically from 0 to -1; don't need 3rd condition\n end\n i = i + 1\n end\n \n return new_string\nend",
"def decrypt(encrypted_password)\n e_index=0\n while e_index < encrypted_password.length\n decrypter=\" abcdefghijklmnopqrstuvwxyz\"\n d_index=0\n while d_index < decrypter.length\n if encrypted_password[e_index]==decrypter[d_index]\n if encrypted_password[e_index]==\" \"\n p \" \"\n e_index+=1\n elsif encrypted_password[e_index]==\"a\"\n p \"z\"\n e_index+=1\n else\n p decrypter[d_index-1]\n end\n end\n d_index+=1\n end\n e_index+=1\n end\nend",
"def encrypt(string)\n length = string.length\n\n\n encrypt_string = \"\"\n count = 0\n until count >= length\n if string[count] == \"z\"\n encrypt_string = encrypt_string + \"a\"\n\n else\n encrypt_string = encrypt_string + string[count].next\n end\n count += 1\n end\n p encrypt_string\nend",
"def decrypt(word)\n counter = 0\n password = \"\"\n\n until counter == word.length\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n letter = alphabet.index(word[counter]) - 1\n counter += 1\n password = alphabet[letter] + password\n\n end\n password.reverse\n end",
"def block_word?(string)\n hash = { 'B' => 'O', 'G' => 'T', 'V' => 'I', \n 'X' => 'K', 'R' => 'E', 'L' => 'Y',\n 'D' => 'Q', 'F' => 'S', 'Z' => 'M',\n 'C' => 'P', 'J' => 'W', 'N' => 'A', 'H' => 'U'}\n\n banned_letters = []\n bool = true\n letters = string.upcase.chars\n letters.each do |letter|\n if hash.has_key?(letter)\n banned_letters << hash[letter]\n elsif hash.has_value?(letter)\n banned_letters << hash.key(letter)\n end\n end\n banned_letters.each do |letter|\n if letters.include?(letter)\n bool = false\n break\n else\n next\n end\n end\n bool\nend",
"def translate(phrase)\nstring = phrase.split() \nstring.each do |string|\n\tif string.start_with?(\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t\treverse = string.reverse!\n\t\tpig = reverse + \"ay\"\n\t\treturn pig\n\telsif string.start_with?(\"a\",\"e\",\"i\",\"o\",\"u\",\"y\")\n\t\treturn string + \"ay\"\n\t# elsif string.slice(0, 2)? (\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"z\")\n\t# \treverse = string.reverse!\n\t# \tstring.except[string.slice(0, 2)]\n\t# \tpig = reverse + \"ay\"\n\telse \n\t\tprint \"L'entrée est de type inconnue\"\n\tend\nend\nend",
"def decrypt(seq_string)\n alphabets = \"abcdefghijklmnopqrstuvwxyz\"\n index = 0\n seq_string3 = \"\"\n while index < seq_string.length\n post_desired_letter = alphabets.index(seq_string[index])\n desired_letter = post_desired_letter - 1\n seq_string3 = seq_string3 + alphabets[desired_letter]\n index += 1\n end\n puts seq_string3\n\nend",
"def fail_letter?(letter)\n return @secret_word.include?(letter) ? false : letter\n end",
"def valid?(password)\n # Does not contain i o l\n return false if password =~ /i|o|l/\n\n # Finds a straight\n return false unless password\n .split('')\n .each_cons(3)\n .find {|a| a[1] == a[0].next && a[2] == a[1].next }\n\n # Contains two different overlapping pairs\n return false unless password\n .split('')\n .slice_when{|i,j| i!=j}\n .select{|a| a.size == 2}\n .uniq\n .count >= 2\n return true\nend",
"def missing_letter(word)\n word.each_with_index do |letter, i|\n return letter.next if word[i + 1] != letter.next\n end\nend",
"def encrypt(my_string)\n i = 0 # start with first letter of string\n new_string = \"\" # placeholder of new string since it will be generated after\n# increase it one letter\n until i == my_string.length # until i == the length of my_string aka 3 keep running loop\n if !(\"a\"..\"z\").include?(my_string[i]) # if there is an anti-alphabet in my_string\n new_string = new_string + my_string[i] # take whatever value in new string take current value in new string and add character we're on right now \"\" + \" \" p pr pry pryz; (\"+\" is tacking on next letter)\n elsif my_string[i] == \"z\" # or if my_string is a z\n new_string = new_string + \"a\" # take w/e value we have so far in new_string and add \"a\"\n else # otherwise\n new_string = new_string + my_string[i].next # take w/e value we have so far and tack on the next letter of string[i]\n end\n i += 1 # go onto the next character in the string / increment up 1 // iterate over string and position in array\n end\n new_string # show me the new string\nend",
"def encrypt(pass)\n counter = 0\n password = \"\"\n\n until counter == pass.length\n alphabet = \"abcdefghijklmnopqrstuvwxyza\"\n letter = alphabet.index(pass[counter]) + 1\n counter += 1\n password = alphabet[letter] + password\n\n end\n password.reverse\n end",
"def encrypt(string)\n index=0\n while index < string.length\n letter=string[index].next\n if letter==\"aa\"\n p \"a\"\n else\n p letter\n end\n index +=1\n end\n end",
"def pirates_say_arrrrrrrrr(string)\n string.each_char.each_cons(2)\n .with_object(\"\") do |(a,b), to_return|\n next unless a.downcase == \"r\"\n to_return << b\n end\nend",
"def pirates_say_arrrrrrrrr(string)\n holder = String.new\n i = 0\n until i+1 == string.length\n holder << string[i+1] if string[i] == \"r\" || string[i] == \"R\"\n i +=1\n end\n holder\nend",
"def encrypt(password)\n encrypted_password = \"\"\n index = 0\n while index < password.length\n if (password[index] != \" \") && (password[index] != \"z\")\n encrypted_password[index] = password[index].next\n elsif password[index] == \" \"\n encrypted_password[index] = password[index]\n elsif password[index] == \"z\"\n encrypted_password[index] = \"a\"\n end\n index += 1\n end\n\n\n puts \"the encrypted password is: \"\n p encrypted_password\nend",
"def dangler_situation\n (@i == @len) && !valid_word?(@prefix)\n end",
"def encrypt(password)\r\n\tfor i in 0...password.length\r\n\t\tif password[i] == \" \"\r\n\t\telse\r\n\t\t\tif password[i] == \"z\"\r\n\t\t\t\tpassword[i] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tpassword[i] = password[i].next\r\n\t\t\tend\r\n\t\tend\r\n\tend\r\n\treturn password\r\nend",
"def encrypt(string)\r\n\r\n\t\tlength = string.length - 1 \r\n\r\n\t\tuntil length == -1\r\n\t\t\tif \r\n\t\t\t\tstring[length] == \"z\"\r\n\t\t\tthen\r\n\t\t\t\tstring[length] = \"a\"\r\n\t\t\telse\r\n\t\t\t\tstring[length] = string[length].next\r\n\t\t\tend\r\n\t\t\tlength = length -1\t\r\n\t\tend\r\n\t\tstring\r\nend",
"def encrypt(password)\n i = 0\n while i < password.length\n if password[i] == \"z\"\n password[i] = \"a\"\n elsif password[i] == \" \"\n password[i] = \" \"\n else\n password[i] = password[i].next!\n end\n i += 1\n end\n password\nend",
"def encrypt(string)\ncounter = 0 \n while counter < string.length \n string_enc = string[counter].next\n \tif string_enc == \"aa\" \n \t\tstring_enc = \"a\"\n \tend\n print string_enc\n counter += 1 \n end \nend",
"def test_sequence_valid13\n result = contains_password?(\"passwrd12*\")\n assert(result, \"'passwrd12*' should be valid because it doesn't contain a sequence\")\n end",
"def encrypt(string) #encryption method\nindex = 0 #initializes the loop to go through letters in the string \nwhile index < string.length #sets the condition of the loop\n if string[index] == \"z\"\n string[index] = \"a\"\n index += 1\n elsif string[index] == \"\"\n index += 1\n else\n string[index] = string[index].next\n index += 1\n end\n end\nstring #loop ends when method gets to the last letter in the string\nend",
"def encrypt(password)\n\tsplit_string = string.password(//)\n\tsplit_string.each do |letter|\n\t\tletter.next\n\tend\n\nend",
"def encrypt(string)\r\nnew_string=\"\"\r\nidx=0\r\nwhile idx < string.length\r\nnew_string << string[idx].next unless\r\nif string[idx] == \"z\"\r\nstring[idx] = \"a\"\r\nnew_string << string[idx]\r\nend\r\nidx+=1\r\nend\r\nnew_string\r\nend",
"def encrypt(password)\n index = 0\n while index < password.length\n if password[index] == \"z\"\n password[index] = password[index].next.chop\n else\n password[index] = password[index].next\n end\n index += 1\n end\n password\nend",
"def unlock(str)\n key = {\n 2 => ['a', 'b', 'c'],\n 3 => ['d', 'e', 'f'],\n 4 => ['g', 'h', 'i'],\n 5 => ['j', 'k', 'l'],\n 6 => ['m', 'n', 'o'],\n 7 => ['p', 'q','r', 's'],\n 8 => ['t', 'u', 'v'],\n 9 => ['w', 'x', 'y', 'z']\n }\n\n output = []\n str.downcase.chars.each {|x| key.any? {|k,v| output << k if v.include? x} }\n output.join\n\nend",
"def block_word?(str)\n ltrs = {\"B\"=>\"O\", \"X\"=>\"K\", \"D\"=>\"Q\", \"C\"=>\"P\", \"N\"=>\"A\", \"G\"=>\"T\", \"R\"=>\"E\", \"F\"=>\"S\", \"J\"=>\"W\", \"H\"=>\"U\", \"V\"=>\"I\", \"L\"=>\"Y\", \"Z\"=>\"M\" }\n list = str.upcase.split(\"\")\n list.each do |ltr|\n if ltrs.value?(ltr) || ltrs.key?(ltr)\n ltrs.delete_if{|k,v| k == ltr || v == ltr}\n else return false end\n end\n true\nend",
"def is_alt(s)\n vowels = %w(a e i o u)\n test = s.chars.map { |letter| vowels.include?(letter) ? 1 : 0 }\n test.each_with_index { |char, index| return false if char == test[index+1] }\n true\nend",
"def encrypt (password)\n # Uppercase and spaces will be ignored!\n ## Because we are getting rid of them...\n password.delete!(\" \")\n password.downcase!\n encrypted_password = \"\"\n while password != \"\"\n ## We're retrieving the next letter\n pass_var = password[0].next\n ## Creating our exception for 'z'\n if pass_var == \"aa\"\n pass_var = \"a\"\n end\n ## Recycling our old letters\n password = password[1..-1]\n ## Now adding them with our new letter!\n encrypted_password += pass_var\n end\n ## And now we're implicitly returning it\n encrypted_password\nend",
"def missing_letter2(word)\n alphabet = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ\"\n for letter in alphabet.split(\"\")\n if letter == word[0]\n start = alphabet.index(letter)\n break\n end\n end\n\n for letter in word\n if letter != alphabet[start]\n return alphabet[start]\n else start +=1\n end\n end\nend",
"def pirates_say_arrrrrrrrr(string)\n #sort through letters in a string, return next letter\n array = string.split('')\n array.select.each_with_index do |item, index|\n if item == \"r\" \n array[index + 1].join\n else\n nil\n end\n end\nend",
"def encrypt(string)\n\nindex_of_string = 0\n#postilion of the character within the string, the substring of the string in question \n\n\twhile index_of_string < string.length\n\t\t#the character position in the index has to be less than the actual length of if the string\n\t\tif string[index_of_string] == \"z\"\n\t\t\tstring[index_of_string] = \"a\"\t\n\t\telsif string[index_of_string] == \"\"\n\t\t\t\t\n\t\t# if the character is z, the program will automatically make the letter to be a so that it can be b when called next, and not aa\n\telse\t\t\n\tstring[index_of_string] = string[index_of_string].next\n\n\tend\n\t\tindex_of_string = index_of_string + 1\n\t\n\tend\n\treturn string\nend",
"def skip\n @str.slice! @last_re if peek_next_type != :eos\n end",
"def extra_letter( dict_word, word )\n\n\tnum = word.length - 1\n\n\t# Remove a letter from the test word to see if a match results\n\tnum.times do |i|\n\n\t\ttest_word = word[0, i+1] + word[i+2, num]\n\n\t\t# Match made\n\t\treturn true if @dictionary[test_word]\t\n\tend\n\n\t# No match found\n\treturn false\nend",
"def encrypt str\n index = 0\n return_str = \"\"\n until index >= str.length\n if str[index] != \" \" && str[index] != \"z\"\n x = str[index].next\n return_str = return_str + x\n elsif str[index] == \"z\"\n x = \"a\"\n return_str = return_str + x\n else\n x = str[index]\n return_str = return_str + x\n end\n index += 1\n end\n return return_str\nend",
"def encrypt (password)\n index = 0\n while index < password.length\n if password[index] == \" \"\n then password[index] = password[index]\n elsif password[index] == \"z\"\n then password[index] = \"a\"\n else\n password[index] = password[index].next!\n end\n index += 1\n end\n p password\nend",
"def pirates_say_arrrrrrrrr(string)\n to_return = \"\"\n next_letter = false\n string.size.times do |letter|\n current_letter = string[letter]\n to_return << current_letter if next_letter\n next_letter = (current_letter == \"r\" or current_letter == \"R\")\n end\n to_return\n \nend",
"def encrypt(string)\n current_index = 0\n while current_index <= (string.length - 1)\n if string[current_index] == \"z\"\n string[current_index] = \"a\" #for edge cases\n else string[current_index] = string[current_index].next\n end\n current_index += 1\n end\n return string\nend",
"def encrypt(str)\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n array = str.split('')\n array.map! do |letter|\n if letter == letters[25]\n letter = letters[0]\n else\n letter.next\n end\n end\n array.join\nend",
"def encrypt(str)\n\tcount = 0\n\talphabet = \"abcdefghijklmnopqrstuvwxyz\"\n\tif str[count] == alphabet[0]\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\tputs str\n\telsif str[count] == alphabet[25]\n\t\tstr[count] = alphabet[0]\n\t\tcount+=1\n\t\tuntil count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount+=1\n\t\tend\n\t\t\n\telse\n\t until count == str.length\n\t\tstr[count] = str[count].next\n\t\tcount +=1\n\t\tend\n\t\t\n\t\t\n str\n\n\tend\n\t\t\nend",
"def encrypt(password)\n counter = 0\n result = \"\"\n while counter < password.length\n letter = password[counter]\n \n if letter == \" \"\n result << \" \"\n elsif letter == \"z\"\n result << \"a\"\n else\n result << letter.next\n end\n counter += 1\n end\n result\nend",
"def encrypt(password)\n index = 0\n\n while index < password.length\n if password[index] == \" \"\n password[index]\n elsif password[index] == \"z\"\n \"a\"\n else \n password[index] = password[index].next\n end\n index += 1\n end\n \n p password \n\nend",
"def encrypt(secret_password)\n index = 0\nwhile index < secret_password.length\n if secret_password.index\"z\"\n secret_password[index] = \"a\"\n else\n secret_password[index] = secret_password[index].next!\nend\n index += 1\n end\nputs secret_password\nend",
"def encrypt(str)\n str_count = 0\n str_actual = \"\"\n until str_count == str.length\n if str[str_count] == \"z\"\n str_actual += \"a\"\n else\n str_actual += str[str_count].next\n end\n str_count += 1\n end\n encrypt = str_actual\nend",
"def play_pass(str, n)\n str.chars.map.with_index do |ltr, idx|\n if ltr =~ /[a-zA-Z]/\n if ltr.ord + n > 90 || ltr.ord + n > 122\n ltr = (ltr.ord - 26 + n).chr\n else\n ltr = (ltr.ord + n).chr\n end\n \n if idx.odd?\n ltr = ltr.downcase\n else\n ltr = ltr.upcase\n end\n \n elsif ltr =~ /\\d/\n ltr = 9 - ltr.to_i\n else\n ltr\n end\n end.join.reverse\nend",
"def encrypt(x)\n i = 0\n string = \"\"\n while i < x.length\n if x[i].next == \"aa\"\n string += \"a\"\n else\n string += x[i].next\n end\n i += 1\n end\n string\nend",
"def missing_letters(string)\n alphabet='a'..'z'\n alphabet.reject {|el|string.downcase.include?(el)}\nend",
"def next_letters(string)\r\n\r\n string = swap_names(string)\r\n \r\n letters = string.split(\"\")\r\n \r\n \r\n next_letters = letters.map! do |letter|\r\n next_vowel?(letter)\r\n end\r\n \r\n next_letters.join(\"\")\r\n \r\n \r\nend",
"def encrypt(code)\r\n #declare empty string to add to\r\n encrypted_code=\"\"\r\n i = 0\r\n #loop the letters\r\n while i < code.length\r\n #z is an edge case make a special conditon for that\r\n if code[i] == \"z\"\r\n encrypted_code = encrypted_code + \"a\"\r\n \r\n # all the letters change to subsequent letters and add to encrypted code\r\n else\r\n encrypted_code = encrypted_code + code[i].next\r\n \r\n end\r\n i+=1\r\n end\r\n \r\n return encrypted_code\r\nend",
"def uses_available_letters?(input, letters_in_hand)\n input = input.split('')\n letters_in_hand.reject do |letter|\n if input.include?(letter)\n input.slice!(input.index(letter))\n end\n end\n # the length of the input checks that the user used only available letters\n if input.length == 0\n return true\n else\n return false\n end\nend",
"def decrypt(pass)\r\n\tfor i in 0...pass.length\r\n\t\tif pass[i] == \" \"\r\n\t\telse\r\n\t\t\tind = \"abcdefghijklmnopqrstuvwxyz\".index(pass[i])\r\n\t\t\tpass[i] = \"abcdefghijklmnopqrstuvwxyz\"[ind-1]\r\n\t\tend\r\n\tend\r\n\treturn pass\r\nend",
"def encrypt(password)\n index = 0\n while index < password.length\n if password[index] == \" \"\n password[index] = \" \"\n elsif password[index] == \"z\"\n password[index] = \"a\"\n else\n password[index] = password[index].next\n end\n index += 1\n end\n return password\nend",
"def translator(phrase)\r\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\r\n idx = 0\r\n translation = \"\"\r\n while idx < phrase.length\r\n if alpha.index(phrase[idx].downcase) == nil\r\n translation += \" boing\"\r\n elsif alpha.index(phrase[idx].downcase) < alpha.length / 2 && /[[:upper:]]/ =~ phrase[idx]\r\n translation += \" bloop\"\r\n elsif phrase[idx] == \"e\" || /[[:upper:]]/ =~ phrase[idx]\r\n translation += \" buzz\"\r\n else\r\n translation += \" beep\"\r\n end\r\n idx += 1\r\n end\r\n return translation\r\nend",
"def pirates_say_arrrrrrrrr(string)\n other_word = \"\"\n string.length.times do | index |\n if ((string[index].downcase.include? \"r\") && (string[index + 1] != nil))\n other_word << string[index + 1]\n end\n end\n\n return other_word\nend",
"def encrypt(password)\r\n\tindex = 0\r\n\twhile index < password.length\r\n\t\tif password[index] == \"z\"\r\n\t\t\tpassword[index] = \"a\"\r\n\t\telse\r\n\t\t\tpassword[index] = password[index].next!\r\n\t\tend\r\n\tindex += 1\r\n\tend\r\n#return password\r\nend",
"def missing_letters(string)\n return ('a'..'z').to_a.select {|e| !string.include?(e)}\nend",
"def should_be_skipped?(word)\n reject?(word) || hashtag?(word) || uri?(word) || mention?(word)\n end",
"def pirates_say_arrrrrrrrr(string)\n return \"\" if string == \"\"\n string.downcase!\n result = \"\"\n (0..string.length-2).each do |i|\n if string[i] == 'r'\n result += string[i + 1]\n end\n end\n result\nend",
"def next_char_ignored\n state[:ignore] = true\n end",
"def palindrome_permutation(string)\n lowercase = string.downcase\n counter = Hash.new(0)\n \n lowercase.each_char {|char| counter[char] += 1 unless char == \" \"}\n \n found_odd = false\n \n counter.keys.each do |char|\n if counter[char] % 2 != 0\n return false if found_odd\n found_odd = true\n end\n end\n true\nend",
"def encrypt(password)\n index = 0\n while index < password.length\n if password[index] == \" \"\n password[index] = password[index]\n elsif password[index] == \"z\"\n password[index] = \"a\"\n else\n password[index] = password[index].next\n end\n index += 1\n end\n puts password\nend",
"def encrypt(password_str)\n\t# puts \"Enter text for encryption\"\n\t# password_str = gets.chomp\n\tindex = 0\n\twhile index < password_str.length \n\t\tpassword_str[index] = password_str[index].next\n\t\tindex +=1\n\tend\n\tpassword_str\nend",
"def encrypt(password)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n index = 0\n while index < password.length\n letter = password[index]\n position = alphabet.index(letter) #magic\n\n if password[index] == \"z\"\n password[index] = \"a\"\n else\n password[index] = alphabet[position].next!\n end\n\n index += 1\n end\n return password\nend",
"def encrypt(password)\n\tcount = 0\n\twhile count < password.length\n #leaves empty spaces as is\n\t\tif password[count] != \" \"\n #moves letter forward one in alphabet\n\t\t\tpassword[count] = password[count].next\n\t\tend\n\t\tcount += 1\n\tend\n #resolves issue with 'ab' instead of 'a' when moving forward from 'z'\n if password.include? 'ab'\n password.sub!('ab', 'a')\n end\n\tpassword\nend",
"def encrypt(str)\n\tcounter = 0\n\tword = \"\"\n\tuntil counter == str.length\n\t\tif str[counter] == \"z\" #edge case\n\t\t\tword += \"a\"\n\t\t\tcounter +=1\n\t\telse\n\t\t\tword += str[counter].next\n\t\t\tcounter += 1\n\t\tend\n\tend\n\tputs word\nend",
"def dr_evils_cipher(coded_message)\n input = coded_message.downcase.split(\"\") # Check out this method in IRB to see how it works! Also refer to the Ruby docs.\n decoded_sentence = []\n cipher = {\"e\" => \"a\", # This is technically a shift of four letters...Can you think of a way to automate this? Is a hash\n \"f\" => \"b\", # the best data structure for this problem? What are the pros and cons of hashes?\n \"g\" => \"c\",\n \"h\" => \"d\",\n \"i\" => \"e\",\n \"j\" => \"f\",\n \"k\" => \"g\",\n \"l\" => \"h\",\n \"m\" => \"i\",\n \"n\" => \"j\",\n \"o\" => \"k\",\n \"p\" => \"l\",\n \"q\" => \"m\",\n \"r\" => \"n\",\n \"s\" => \"o\",\n \"t\" => \"p\",\n \"u\" => \"q\",\n \"v\" => \"r\",\n \"w\" => \"s\",\n \"x\" => \"t\",\n \"y\" => \"u\",\n \"z\" => \"v\",\n \"a\" => \"w\",\n \"b\" => \"x\",\n \"c\" => \"y\",\n \"d\" => \"z\"}\n\n input.each do |x| # What is #each doing here?\n found_match = false # Why would this be assigned to false from the outset? What happens when it's true?\n cipher.each_key do |y| # What is #each_key doing here?\n if x == y # What is this comparing? Where is it getting x? Where is it getting y? What are those variables really?\n decoded_sentence << cipher[y]\n found_match = true\n break # Why is it breaking here?\n elsif x == \"@\" || x == \"#\" || x == \"$\" || x == \"%\"|| x == \"^\" || x == \"&\"|| x ==\"*\" #What the heck is this doing?\n decoded_sentence << \" \"\n found_match = true\n break\n elsif (0..9).to_a.include?(x) # Try this out in IRB. What does \" (0..9).to_a \" do?\n decoded_sentence << x\n found_match = true\n break\n end\n end\n if not found_match # What is this looking for?\n decoded_sentence << x\n end\n end\n decoded_sentence = decoded_sentence.join(\"\")\n #What is this method returning?\nend",
"def decrypt(string)\n #find out length of string\n length = string.length\n\n decrypt_string = \"\"\n count = 0\n\n until count >= length\n if string[count] == \"a\"\n decrypt_string = decrypt_string + \"z\"\n\n elsif string[count] == \"!\"\n new_letter = \" \"\n decrypt_string = decrypt_string + new_letter\n\n elsif string[count] == string[count].upcase\n upper_alphabet = \"abcdefghijklmnopqrstuvwxyz\".upcase\n index_val = upper_alphabet.index(string[count])\n new_letter = upper_alphabet[index_val - 1]\n decrypt_string = decrypt_string + new_letter\n\n else\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n index_val = alphabet.index(string[count])\n new_letter = alphabet[index_val - 1]\n decrypt_string = decrypt_string + new_letter\n end\n count += 1\n end\n p decrypt_string\nend",
"def preposition?(word)\n word.size == PREPOSITION_SIZE && # exactly 5 chars\n !FOO_LETTERS.include?(word[4]) && # The last letter should be included in BAR LETTER group\n !word.include?(\"l\") # The word can't include the letter \"l\"\n end",
"def missing_letters(string)\n letters = %w[a b c d e f g h i j k l m n o p q r s t u v w x y z]\n letters.select { |c| c unless string.include?(c) }\nend",
"def pirates_say_arrrrrrrrr(string)\nz = \"\"\nstring.split(\"\").each_index{|x| z << string[x+1] if string.downcase[x] == \"r\" && string[x+1] != nil }\nz\nend",
"def z_after_a2(string)\n\n index = 0\n\n while string.length() > index\n\n if string[ index ] != \"a\"\n index += 1\n next # if cond is true then jumps to next while ( ignores \"index2 = index + 1\" )\n end\n\n index2 = index + 1\n\n while ( string.length > index2 ) && ( index + 3 >= index2 )\n\n if string[index2] == \"z\"\n return true\n end\n\n index2 += 1\n\n end# while\n\n index += 1\n\n end # while\n\n return false\n\n\nend",
"def encrypt(message)\n new_message = \"\"\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n \n counter = 0\n while counter < message.length\n \n if alphabet.index(message[counter]) == 25\n new_message += alphabet[0]\n else\n new_message += message[counter].next\n end\n \n counter += 1\n end\n new_message\nend",
"def encrypt(var) #var=random string.\n store = ''\n len = var.length #prepare for line 10\n count = 0 #represent the first word in a string, just like index.\n while count < len #loop through each character at a time until every words have been looped.\n if var[count].next == \"aa\" \n store << \"a\" #Normally the word after a is aa, but I want only a.\n else\n store << var[count].next #first time looping through will be var[0].next \n end #and second time looping through become var[1].next etc.\n #store << full[full.index(var[count])+1]\n count += 1 #go on to the next index.\n\n end\n puts store\nend",
"def encrypt(str)\n len = str.length\n counter = 0\n message = \"\"\n while counter < len\n if str[counter] == \"z\"\n note = \"a\"\n else\n note = str[counter].next\n end\n message << note\n counter += 1\n end\n p message\nend",
"def encrypt(secret_password)\n# Create a character index\n index = 0\n# Create an empty string to have a return value\n encrypted_string = \"\"\n# Loop until you get to the last letter in the password\n while index < secret_password.length do\n encrypted_string += secret_password[index].next\n# Call the index plus 1\n index += 1\n end\n #return the implicit empty response at the end\n encrypted_string\n# end encryption method\nend",
"def missing_letters(string)\n letters = ('a'..'z').to_a\n letters.reject { |char| string.downcase.include?(char) }\nend",
"def make_password(phrase)\n phrase.split(\" \").map do |x|\n x = x[0]\n x = \"1\" if x == \"i\" || x == \"I\"\n x = \"0\" if x == \"o\" || x == \"O\"\n x = \"5\" if x == \"s\" || x == \"S\"\n x\n end.join()\nend",
"def encrypt(word)\r\n \r\nposition = 0\r\nnewstring = \"\"\r\n while position < word.length\r\n crypt = word[position].next\r\n newstring += crypt\r\n position += 1\r\n end\r\n return newstring\r\nend",
"def step_through_with(s)i\n # It doesn't solve the kata because it returns true even if same chars are met in diffrent part of the word. Like \"ThaT\"\n s.chars.count == s.chars.uniq.count\nend",
"def comes_after(str,letter)\n result = []\n unwanted_chars = \"1234567890.,!;:?_ \"\n str.length.times do |index|\n if str[index] == letter.downcase || str[index] == letter.upcase\n result << str[index + 1]\n end\n end\n result.join.delete(unwanted_chars)\nend",
"def encrypt(str)\n index = 0 \n secret_password = \" \"\n while index < str.length\n secret_password[index] = str[index].next\n index += 1\n end\n secret_password\nend",
"def encryption(string)\n\tnew_string = \"\"\n\tx = 0\n\twhile x < string.length\n\t\t\n\t\tif string[x] == \"z\"\n\t\t\tnew_string = new_string + \"a\"\n\t\telsif string[x] == \" \"\n\t\t\tnew_string = new_string + \"_\"\n\t\telse\n\t\t\tnew_string = new_string + string[x].next\n\t\t\n\t\tend\n\t\t\t\n\tx += 1\nend\n\tp new_string\nend",
"def decrypt(encrypted_password)\nindex = 0\n# List the entire alphabet in order to match the letters of the decrypted password to their correct index\nalphabet = \"abcdefghijklmnopqrstuvwxyz\"\n# Prepare an empty string to store results\ndecrypted_string = \"\"\n# Create a loop to iterate over the encrypted password\nwhile index < encrypted_password.length do\n decrypted_index = alphabet.index(encrypted_password[index])\n decrypted_string+= alphabet[decrypted_index -1]\n index += 1\nend\n#return the implicit empty response at the end\n decrypted_string\nend",
"def remember(phrase)\n phrase.chars.select { |e| phrase.count(e) > 1}.uniq\nend",
"def pirates_say_arrrrrrrrr(string)\n return_string = \"\"\n\n string_length = string.length\n\n for x in 0...string_length\n if string[x] == \"r\" || string[x] == \"R\"\n return_string << string[x+1] unless (x+1) == string_length\n end\n end\n return_string\nend",
"def pirates_say_arrrrrrrrr(string)\n s = \"\"\n ((0 ... string.length).find_all { |i| string.downcase[i,1] == 'r' }).each do |c|\n if c < (string.length-1) then s += string[c+1] end\n end\n return s\nend",
"def encrypt_text(secret_code)\n code_length = secret_code.length\n current_position = 0\n\n until current_position == code_length\n \n if secret_code[current_position] == \"z\"\n secret_code[current_position] = \"a\"\n\n else\n\n secret_code[current_position] = secret_code[current_position].next\n\n end\n current_position = current_position + 1\nend\n\n puts \"The encrypted code is: #{secret_code}.\"\nreturn secret_code\nend",
"def decrypt(banana)\n ind = 0\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n while ind < banana.length\n litera = banana[ind]\n index_in_alphabet = alphabet.index(litera)\n if index_in_alphabet == 0\n puts \"z\"\n else\n puts alphabet[index_in_alphabet - 1]\n end\n ind += 1\n end\nend",
"def missing_letters(string)\n alphabet = (\"a\"..\"z\").to_a\n alphabet.reject { |x| string.downcase.include?(x) }\nend",
"def pirates_say_arrrrrrrrr(string)\n output = ''\n string.each_char.with_index do |letter, i|\n unless string[i + 1].nil?\n output += string[i + 1] if letter == 'r' || letter == 'R'\n end\n end\n output\nend",
"def encrypt(str)\n index = 0\n while index < str.length\n str[index] = if str[index].include? 'z'\n 'a'\n else\n str[index].next\n end\n index += 1\n end\n str\nend"
] |
[
"0.62243783",
"0.6128043",
"0.59000134",
"0.58669007",
"0.5838073",
"0.582331",
"0.58108056",
"0.57477117",
"0.5714367",
"0.5712501",
"0.5688031",
"0.5656528",
"0.5651552",
"0.5646401",
"0.56370896",
"0.5628277",
"0.5612075",
"0.5587763",
"0.5585386",
"0.55820566",
"0.55633664",
"0.55444866",
"0.55258477",
"0.5521867",
"0.552066",
"0.54918087",
"0.5468879",
"0.5465965",
"0.5453222",
"0.54529274",
"0.5452876",
"0.54465693",
"0.5445479",
"0.54271406",
"0.5416206",
"0.54134166",
"0.54098046",
"0.5408417",
"0.5406484",
"0.54057455",
"0.5387545",
"0.53867215",
"0.53741294",
"0.53622156",
"0.5351434",
"0.53468025",
"0.53291297",
"0.5325613",
"0.5318455",
"0.53164744",
"0.53157103",
"0.5314832",
"0.53062874",
"0.5304494",
"0.52977675",
"0.5289612",
"0.52852035",
"0.5274985",
"0.527315",
"0.5269744",
"0.5269298",
"0.5265234",
"0.5264016",
"0.52586687",
"0.52552074",
"0.5252222",
"0.5244044",
"0.5243768",
"0.5243744",
"0.52437073",
"0.5240485",
"0.5238369",
"0.5237363",
"0.52294755",
"0.5223162",
"0.52221125",
"0.5221499",
"0.5220606",
"0.5220377",
"0.5217416",
"0.52164006",
"0.5213829",
"0.52134484",
"0.52104986",
"0.5207317",
"0.5202212",
"0.5199372",
"0.51981765",
"0.5192928",
"0.5192018",
"0.5191884",
"0.5191734",
"0.51915246",
"0.5191231",
"0.51908636",
"0.5188838",
"0.51885366",
"0.51883435",
"0.5185996",
"0.5185039"
] |
0.7532067
|
0
|
Handles response and error codes from the remote service.
|
def handle_response(response)
case response.code.to_i
when 200...400
response
when 404
raise NotFoundError.new(response)
else
raise ConnectionError.new(response)
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def handle_response(response)\n case response.code\n when 200..299\n response\n else\n if response.request.format == :json\n raise FreebaseAPI::ServiceError.new(response['error'])\n else\n raise FreebaseAPI::NetError.new('code' => response.code, 'message' => response.response.message)\n end\n end\n end",
"def process_response(response)\n case response.code.to_i\n when 200, 404\n parse_message response.body\n when 401, 500\n error_message = parse_message response.body\n raise \"Unauthorized: #{error_message['error']['message']}\"\n else\n raise \"Response code #{response.code} not recognized\"\n end\n end",
"def handle_response(response)\n handler_for_code(response.code).call(response)\n end",
"def handle_response(response)\n case response.code.to_i\n when 200...300\n response\n else\n raise ResponseError.new(response)\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise Redirection, response\n when 200...400\n response\n when 400\n raise ResourceInvalid, response\n when 401\n raise UnauthorizedAccess, response\n when 403\n raise ForbiddenAccess, response\n when 404\n raise ResourceNotFound, response\n when 405\n raise MethodNotAllowed, response\n when 409\n raise ResourceConflict, response\n when 410\n raise ResourceGone, response\n when 422\n raise ResourceInvalid, response\n when 401...500\n raise ClientError, response\n when 500...600\n raise ServerError, response\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"def handle_status_code(req)\n case req.code\n when 200..204; return\n when 400; raise ResponseError.new req\n when 401; raise ResponseError.new req\n else raise StandardError\n end\n end",
"def handle_response(response); end",
"def handle_response(response); end",
"def process_response(url, response)\n json = response.parsed_response\n response_code = json['responseCode']\n return json unless response_code != 1\n\n # we got an error response from the handle server, so convert it into\n # an actual exception and throw it here\n\n message = if json['message']\n json['message']\n elsif Error.response_codes.include? response_code\n Error.response_codes[response_code]\n else\n 'Unexpected error'\n end\n\n error = Error.new(response_code, message)\n error.handle = json['handle']\n error.url = url\n raise error\n end",
"def handle_response(response) # :nodoc:\n case response.code\n when 400\n #IN CASE WE WANT MORE PRECISE ERROR NAMES\n #data = response.parsed_response\n #case data['code']\n #when 230\n # raise ParameterDataInvalid.new data\n #else\n # raise BadRequest.new data\n #end\n raise BadRequest.new(response.parsed_response)\n when 403\n raise Unauthorized.new(response.parsed_response)\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new\n when 500...600\n raise ServerError.new\n else\n response.parsed_response\n end\n end",
"def handleResult(response)\n response = JSON.parse(response, :symbolize_names => true)\n case response[:code]\n when CODE_OK then response[:data]\n when CODE_INVALID_PARAMETERS, CODE_INVALID_API_KEY, CODE_INVALID_METHOD\n raise ArgumentError, response[:message]\n else\n raise StandardError, \"An unknown error ocurrced while handling the response: #{response.to_s}\"\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 301, 302, 303, 307\n raise(Redirection.new(response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(response))\n when 401\n raise(UnauthorizedAccess.new(response))\n when 403\n raise(ForbiddenAccess.new(response))\n when 404\n raise(ResourceNotFound.new(response))\n when 405\n raise(MethodNotAllowed.new(response))\n when 409\n raise(ResourceConflict.new(response))\n when 410\n raise(ResourceGone.new(response))\n when 422\n raise(ResourceInvalid.new(response))\n when 401...500\n raise(ClientError.new(response))\n when 500...600\n raise(ServerError.new(response))\n else\n raise(ConnectionError.new(response, \"Unknown response code: #{response.code}\"))\n end\n end",
"def handleHTTPStatus(code)\n case code\n when 200 # Ok\n puts \"HTTP request successful\"\n return true\n when 204\n puts \"HTTP Error: No Content\"\n return false\n when 401\n puts \"HTTP Error: Server rejected authentication.\"\n return false\n else\n puts \"Unhandled HTTP status: #{code}\"\n return false\n end # case code\n end",
"def handle_error_response(response)\n message = code = nil\n if response.include?(\"error\")\n error = response[\"error\"]\n message = (error[\"message\"] || DEFAULT_ERROR)\n code = error[\"code\"]\n else\n message = DEFAULT_ERROR\n end\n log.error \"Error response received from server.\\nMessage: #{message}\\nCode: #{code}\"\n case code\n when \"errors.sessions.authorization_required\"\n raise CAAuthorizationError.new(message, nil, code: code)\n when \"errors.sessions.authentication_required\"\n raise CAAuthenticationError.new(message, nil, code: code)\n else\n raise CAError.new(message, nil, code: code)\n end\n end",
"def handle_response(result)\n unless result.success\n #if result.error_class\n # TODO needs to be constantized first (see TODO in lib/rjr/message)\n # raise result.error_class.new(result.error_msg) unless result.success\n #else\n fail result.error_msg\n #end\n end\n return result.result\n end",
"def handler\n Proc.new do |response|\n case response.code\n when 200..204\n response\n when 400\n raise Jiralicious::TransitionError.new(response.inspect)\n when 404\n raise Jiralicious::IssueNotFound.new(response.inspect)\n else\n raise Jiralicious::JiraError.new(response.inspect)\n end\n end\n end",
"def handle_response(resp, head_instead: false)\n case resp.code\n when 200, 201\n head_instead ? resp.headers : JSON.parse(resp.body)\n when 202, 204\n true\n when 400\n raise BadRequest, resp\n when 401\n raise NotAllowed, resp\n when 403\n raise NotAuthorized, resp\n when 404\n raise NotFound, resp\n else\n if resp.code >= 500\n raise ServerError, resp\n else\n raise Error, resp\n end\n end\n end",
"def handle_response(request, response)\n case response.code.to_i\n when 301,302\n raise(Redirection.new(request, response))\n when 200...400\n response\n when 400\n raise(BadRequest.new(request, response))\n when 401\n raise(UnauthorizedAccess.new(request, response))\n when 403\n raise(ForbiddenAccess.new(request, response))\n when 404\n raise(ResourceNotFound.new(request, response))\n when 405\n raise(MethodNotAllowed.new(request, response))\n when 409\n raise(ResourceConflict.new(request, response))\n when 412\n raise(PreconditionFailed.new(request, response))\n when 422\n raise(ResourceInvalid.new(request, response))\n when 401...500\n raise(ClientError.new(request, response))\n when 500...600\n raise(ServerError.new(request, response))\n else\n raise(ConnectionError.new(request, response, \"Unknown response code: #{response.code}\"))\n end\n begin\n if response.body.blank?\n nil\n else\n hash = JSON(response.body)\n normalize_hash(hash)\n end\n rescue JSON::ParserError => e\n raise(ConnectionError.new(request, response, \"Invalid json response: #{e.body}\"))\n end\n end",
"def handle_errors(response)\n if response.soap_fault?\n exception = exception_for_soap_fault(response)\n raise exception\n end\n if response.http_error?\n raise AdsCommon::Errors::HttpError,\n \"HTTP Error occurred: %s\" % response.http_error\n end\n end",
"def handle_response(response)\n case response[:status]\n when :success, :created\n self.instance_variable_set('@notsaved', false)\n true\n when :errors\n Amfetamine.logger.warn \"Errors from response\\n #{response[:body]}\"\n response[:body].each do |attr, error_messages|\n error_messages.each do |msg|\n errors.add(attr.to_sym, msg)\n end\n end\n false\n when :server_error\n Amfetamine.logger.warn \"Something went wrong at the remote end.\"\n false\n end\n end",
"def _handle_response(response)\n \n \n # -- MAJOR EXCEPTION handling (authentication)\n \n if (response == Net::HTTPUnauthorized || response.message == 'Unauthorized') ||\n (response && response['status'].to_i == 403 && response['message'] == \"Access to group-memberships denied\")\n raise APIAuthError.new\n \n \n # -- STANDARD handling\n \n else\n \n hashed_response = nil\n \n # Check if the 'response.body' starts with an '<?xml' tag -> indicating it's XML structure\n if response.body =~ /\\A<\\?xml/ \n hashed_response = Hash.from_xml(response.body)\n else\n hashed_response = hash_a_json(response.body)\n end\n \n # -- Bad request (e.g. posting duplicate content)\n \n \n \n _res = { :response_http_object => response }\n \n \n # -- Bad request (e.g. posting duplicate content)\n \n if response == Net::HTTPBadRequest || response.message == \"Bad Request\" || response.code == 400\n _res[:status] = \"bad_request\"\n _res[:response_object] = hashed_response\n \n \n # -- API SERVICE ERROR\n \n elsif response == Net::HTTPInternalServerError || response.message == 'Internal Server Error' || response.code == 500\n _res[:status] = \"api_service_error\"\n _res[:response_object] = hashed_response\n \n \n # -- FORBIDDEN -> trying to use a resource the user is not allowed, store the 'body' as plain XML at this point\n \n elsif response == Net::HTTPForbidden || response.message == 'Forbidden'\n _res[:status] = \"denied_access\" # e.g. post to LinkedIn group required moderation by an admin\n _res[:response_object] = hashed_response\n \n # Check if additional permissions are required (SHARING)\n if _res[:response_object]['error']['message'] == 'Access to posting shares denied'\n raise APIAuthError.new\n end\n \n \n # -- POST / PUT\n \n elsif response.body.blank? || (response.body.nil? && response.code == 204) # A response without content -> successful \n _res[:status] = \"updated_successfully\"\n \n if response.body.blank?\n _res[:response_object] = {}\n else\n _res[:response_object] = hashed_response\n end\n \n \n # -- GET\n \n else\n _res[:status] = \"retrieved_successfully\"\n _res[:response_object] = hashed_response\n \n end\n \n end\n \n \n _res\n \n end",
"def handle_response(res)\n # relogin if needed\n return relogin if should_relogin(res)\n\n check_unauthorized(res.status, res.env.url.to_s)\n check_not_found(res.status)\n check_not_success(res.status)\n handle_success(res.body) do |json_body|\n yield(json_body) if block_given?\n end\n end",
"def handle_response(response)\n case response.code.to_i\n when 200\n JSON.parse(response.body)['holidays']\n when 400\n raise BadRequest.new response.parsed_response\n when 401\n raise Unauthorized.new\n when 404\n raise NotFound.new\n when 400...500\n raise ClientError.new response.parsed_response\n when 500...600\n raise ServerError.new\n else\n response\n end\n end",
"def handle_error(response)\n unless response[0] == :error\n raise InvalidReponse, \"Expected error response, got: #{response.inspect}\"\n end\n\n type, code, klass, detail, backtrace = response[1]\n case type \n when :server\n if code == 1\n raise NoSuchModule\n elsif code == 2\n raise NoSuchFunction\n else\n raise UnknownError, \"Unknown server error: #{response.inspect}\"\n end\n when :user\n raise UserError.new(\"#{klass}: #{detail}\\n#{backtrace.join()}\")\n when :protocol\n if code == 1\n raise BadHeader\n elsif code == 2\n raise BadData\n else\n raise UnknownError, \"Unknown protocol error: #{reponse.inspect}\"\n end\n else\n raise UnknownError, \"Unknown error: #{response.inspect}\"\n end\n end",
"def handle_http_error(res)\n if res.code == \"202\" # retry\n self.call\n else\n raise \"Error in FoodTruckApiClient: Call to API failed, returning the HTTP status code #{res.code} and the following error message: #{error}\"\n end\n end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def response_code; end",
"def handle_http_failure(method:, http_response:)\n content = http_response.inspect\n msg = \"received a #{http_response&.code} response with: #{content}!\"\n log_error(method: method, error: ExternalApiError.new(msg))\n end",
"def handle_response\n unless performed?\n if @error.present?\n handle_error(@error)\n else\n respond_with do |format|\n # Browser scope.\n format.html do\n handle_response_html\n end\n # Rails remote form.\n format.js do\n handle_response_js\n end\n # API / xhr scope.\n format.json do\n handle_response_json\n end\n end\n end\n end\n end",
"def process_response(response)\n case response\n when Net::HTTPSuccess\n JSON.parse response.body\n when Net::HTTPUnauthorized\n { 'error' => \"#{response.message}:\n username and password set and correct?\" }\n when Net::HTTPServerError\n { 'error' => \"#{response.message}: try again later?\" }\n else\n { 'error' => response.message }\n end\n end",
"def handle_response(response)\n case response\n when Net::HTTPOK \n begin\n JSON.parse(response.body)\n rescue JSON::ParserError\n response.body\n end\n when Net::HTTPUnauthorized\n raise ClearanceTwitter::Unauthorized, 'The credentials provided did not authorize the user.'\n else\n message = begin\n JSON.parse(response.body)['error']\n rescue JSON::ParserError\n if match = response.body.match(/<error>(.*)<\\/error>/)\n match[1]\n else\n 'An error occurred processing your Twitter request.'\n end\n end\n\n raise TwitterAuth::Dispatcher::Error, message\n end\n end",
"def handle_status(env)\n case env[:status]\n when BadSyntaxStatus then bad_syntax\n when AuthenticationFailed then authentication_failed\n when ResourceNotFoundError then resource_not_found_for(env)\n when ClientErrorStatuses then client_error_status_for(env[:body])\n when ServerErrorStatuses then server_error_status_for(env[:body])\n end\n end",
"def finish_request\n if (400..499).include? response.code\n set_error_body(response.code)\n end\n end",
"def handle_response(response)\n type, msgid, error, result = response\n if observable = @requests[msgid]\n @requests[msgid].set_response(result, error)\n else\n warn \"unknown response with id=#{msgid}\"\n end\n end",
"def handle_response!\n logger.debug \"Attempting OpenID auth: #{provider_response.inspect}\"\n\n case provider_response.status\n when :success\n resource = find_resource || build_resource || create_resource\n\n if resource && validate(resource)\n begin\n update_resource!(resource)\n rescue\n fail! $!\n else\n success!(resource)\n end\n else\n fail! \"This OpenID URL is not associated with any registered user\"\n end\n\n when :cancel\n fail! \"OpenID authentication cancelled\"\n when :failure\n fail! \"OpenID authentication failed\"\n end\n end",
"def parse_response_line\n if @headers.first =~ /\\AHTTP\\/1\\.[01] ([\\d]{3})/\n @status = $1.to_i\n else\n set_deferred_status :failed, {\n :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this.\n }\n close_connection\n end\n end",
"def handle_response(response, used_by)\n if Utils.is_success_status_code(response.code)\n if response.body.nil? || response.body == ''\n nil\n else\n JSON.parse(response.body)\n end\n elsif Utils.is_under_maintenance_response(response.code)\n raise UnderMaintenanceException.new.reason\n elsif Utils.is_rate_limit_response(response.code)\n raise RateLimitException.new.reason\n else\n _err_message = '---------Copyleaks SDK Error (' + used_by + ')---------' + \"\\n\\n\"\n _err_message += 'status code: ' + response.code + \"\\n\\n\"\n\n _err_message += 'response body:' + \"\\n\" + response.body.to_json + \"\\n\\n\" unless response.body.nil?\n\n _err_message += '-------------------------------------'\n raise CommandException.new(_err_message).reason + \"\\n\"\n end\n end",
"def perform\n resp = connection.get(request_uri)\n handle_response(resp)\n # If server returns 200, everything is OK.\n self.success = resp.status == 200\n rescue Faraday::Error => e\n self.response = { message: e.message }\n self.success = false\n rescue JSON::ParserError, ::EasyManageClient::InvalidResponseContent\n # Response cannot be handled.\n self.response = { message: 'Invalid response from the server.' }\n self.success = false\n end",
"def flex_error_handling\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(422)\n response.headers['Status'] = interpret_status(200) if response.headers['Status'] == interpret_status(201)\n end",
"def process_response\n case @msg.sip_method\n when :INVITE\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n when :ACK\n when :CANCEL\n if client_transaction = @msg.connection.class.invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response_to_cancel(@msg)\n return\n end\n else\n if client_transaction = @msg.connection.class.non_invite_client_transactions[@msg.via_branch_id]\n client_transaction.receive_response(@msg)\n return\n end\n end\n log_system_debug \"ignoring a response non matching a client transaction (#{@msg.sip_method} #{@msg.status_code})\" if $oversip_debug\n end",
"def process_response(response)\n @last_response = response.body\n\n logger.debug @last_response if logger.present?\n\n if response.body =~ /:Fault>/ then\n handle_error(response)\n else\n response.body\n end\n end",
"def handle_error(response)\n unless response[0] == :error\n raise InvalidResponse, \"Expected error response, got: #{response.inspect}\"\n end\n\n type, code, klass, detail, backtrace = response[1]\n case type\n when :server\n if code == 1\n raise NoSuchModule\n elsif code == 2\n raise NoSuchFunction\n else\n raise UnknownError, \"Unknown server error: #{response.inspect}\"\n end\n when :user\n raise UserError.new(\"#{klass}: #{detail}#{\"\\n#{backtrace.join()}\" if backtrace.respond_to?(:join)}\", klass, code)\n when :protocol\n if code == 1\n raise BadHeader\n elsif code == 2\n raise BadData\n else\n raise UnknownError, \"Unknown protocol error: #{response.inspect}\"\n end\n else\n raise UnknownError, \"Unknown error: #{response.inspect}\"\n end\n end",
"def handle_response(res)\n if res.code.to_i == 201\n return res['Location']\n elsif [200,203,204,302].detect { |d| d == res.code.to_i }\n if res.body\n begin\n return JSON.load(res.body)\n rescue => e\n return res\n end\n else\n return res\n end\n else \n raise \"invalid response HTTP code: #{res.code.to_i}, #{res.code}, #{res.body}\"\n end\n end",
"def handle_error(status_p)\n begin\n yield\n\n true\n rescue => e\n status = Status.from_pointer(status_p)\n status.update(:error_client, 1, \"#{e.class}: #{e}\")\n false\n end\n end",
"def handle_error (url, res)\n puts \"#{url} was not found\" if res.code.to_i == 404\n puts \"#{url} requires authorization\" if res.code.to_i == 401\n puts \"#{url} returns an application error\" if res.code.to_i == 500\nend",
"def handle_post_response(&block)\n exit_code = 1\n begin\n response = yield\n exit_code = 0 if response.success?\n log \"Error: Snooze returned status error #{response.status}\" unless response.success?\n log \"Snooze returned status message: #{response.body}\" if @verbose\n rescue Snooze::ConnectionError\n log \"Error: Snooze server is unreachable\"\n end\n exit_code\n end",
"def handle_response(response, expected = nil)\n response.value\n # todo: pick a better exception\n raise \"Expected a #{expected} response\" if expected and expected != response.code.to_i\n response\n end",
"def handle_error(errors, status, content_type)\n if defined?(Rails)\n Rails.logger.warn \"RESPONSE STATUS: #{status}\"\n Rails.logger.warn errors\n end\n\n OpenStruct.new(success?: false, status: status, body: { errors: errors }, content_type: content_type)\n end",
"def handle_exception(data)\n logger.warn \"Got exception from remote call of #{data[\"action\"]}: #{data[\"message\"]}\"\n end",
"def handle_response(response)\n token = response.token\n if response.is_a?(Result)\n if result = OperationResult.from_results(response)\n if result.non_delivery?\n @non_delivery_stats.update(result.content.nil? ? \"nil\" : result.content.inspect)\n elsif result.error?\n @result_error_stats.update(result.content.nil? ? \"nil\" : result.content.inspect)\n end\n @result_stats.update(result.status)\n else\n @result_stats.update(response.results.nil? ? \"nil\" : response.results)\n end\n\n if handler = @pending_requests[token]\n if result && result.non_delivery? && handler.kind == :send_retryable_request &&\n [OperationResult::TARGET_NOT_CONNECTED, OperationResult::TTL_EXPIRATION].include?(result.content)\n # Log and ignore so that timeout retry mechanism continues\n # Leave purging of associated request until final response, i.e., success response or retry timeout\n Log.info(\"Non-delivery of <#{token}> because #{result.content}\")\n else\n deliver(response, handler)\n end\n elsif result && result.non_delivery?\n Log.info(\"Non-delivery of <#{token}> because #{result.content}\")\n else\n Log.debug(\"No pending request for response #{response.to_s([])}\")\n end\n end\n true\n end",
"def handle(response)\n exception = AuthorizeNet::Exception.new\n\n if !response.errors.nil?\n first_error = response.errors.first\n exception.message = first_error[:text]\n\n # Add errors to exception\n response.errors.each do |error|\n exception.errors << buildError(error)\n end\n\n raise exception\n\n # If there are no errors, then the \"messages\" are probably errors... *sigh*\n elsif !response.messages.nil? and response.result == AuthorizeNet::RESULT_ERROR\n first_msg = response.messages.first\n exception.message = first_msg[:text]\n\n # Add messages (that are sometimes actually errors) to exception\n response.messages.each do |msg|\n exception.errors << buildError(msg)\n end\n\n raise exception\n end\n\n end",
"def handle_response(response, required_root_key = nil)\n # at this point the FaradayMiddleware::ParseXml or JSON should have parsed\n # all valid responses into a Hash\n if response.env[:method] != :delete && !response.body.is_a?(Hash)\n raise Errors::ResponseError, 'Unexpected or empty response'\n end\n\n case response.status\n when 401\n raise Errors::AuthenticationError, response['technical_message']\n when 500\n raise Errors::SystemError, response.body\n else\n if required_root_key\n response_data_for_key!(response.body, required_root_key)\n else\n response.body\n end\n end\n end",
"def handle_response(response)\n response.value\n JSON.parse(response.body).with_indifferent_access\n rescue Net::HTTPClientException => e\n raise_error(e)\n end",
"def process_response!(response)\n\t\t\t\tfinish_request!\n\t\t\t\t\n\t\t\t\tif Exception === response\n\t\t\t\t\t@logger.warn \"[#{@message.id}] Failure while processing response #{response}!\" if @logger\n\t\t\t\t\tRubyDNS.log_exception(@logger, response) if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telsif response.tc != 0\n\t\t\t\t\t@logger.warn \"[#{@message.id}] Received truncated response!\" if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telsif response.id != @message.id\n\t\t\t\t\t@logger.warn \"[#{@message.id}] Received response with incorrect message id: #{response.id}\" if @logger\n\t\t\t\t\t\n\t\t\t\t\ttry_next_server!\n\t\t\t\telse\n\t\t\t\t\t@logger.debug \"[#{@message.id}] Received valid response #{response.inspect}\" if @logger\n\t\t\t\t\t\n\t\t\t\t\tsucceed response\n\t\t\t\tend\n\t\t\tend",
"def handle res, opts = {}\n @response = res\n\n parse = opts.has_key?(:parse) ? opts[:parse] : true\n\n case res.status\n when 200..299, 422 then JSON.parse res.body if parse\n when 401, 403 then raise Audiosocket::Unauthorized\n when 404 then nil\n\n else\n raise \"Unexpected response (#{res.status}) from the API:\\n#{res.body}\"\n end\n end",
"def process_response(obj)\n end",
"def response_from_service\n\n end",
"def interpret_response(response)\n case response.code.to_i\n when 200\n puts 'OK'\n when 201,202,204\n puts 'OK'\n return\n when 400\n puts 'Bad request'\n return\n when 404\n puts 'Resource not found'\n return\n when 500\n puts 'Sensu encountered an error'\n return\n else\n puts \"Unexpected HTTP response code #{response.code}\"\n return\n end\n\n return JSON.parse(response.body)\n end",
"def invoke\n res = catch(:halt) { yield }\n res = [res] if Fixnum === res || String === res\n if Array === res && Fixnum === res.first\n res = res.dup\n status(res.shift)\n body(res.pop)\n headers(*res)\n elsif res.respond_to? :each\n body res\n end\n nil # avoid double setting the same response tuple twice\n end",
"def receive_response(response); end",
"def dispatch(method, retype, args)\n result = self.send(\"handle_#{method}\".to_sym, args)\n result_key = Chassis.exit_after_current_dispatch ? :last_result : :result\n case retype\n when :json\n [result_key, [:raw, result.to_json]]\n when :pure\n [result_key, result]\n else\n raise \"Unknown response type: #{retype}\"\n end\n rescue Exception => e\n if e.instance_of?(SystemExit)\n exit\n elsif Chassis.exception_handler\n begin\n Chassis.exception_handler.call(e)\n rescue Exception => e2\n [:error, e2.message + \"\\n\\n\" + e2.backtrace.join(\"\\n\")]\n end\n else\n [:error, e.message + \"\\n\\n\" + e.backtrace.join(\"\\n\")]\n end\n end",
"def process_response(response)\n case response\n when Net::HTTPFound, Net::HTTPCreated\n response['Location']\n when Net::HTTPConflict\n raise URLConflict\n when Net::HTTPNotAcceptable\n raise URLFormatError\n else\n raise InvalidResponse.new(\"Invalid Shorty Response Code: #{response.code} #{response.message}\")\n end\n end",
"def guess_status(response)\n result = {}\n # response status code returned by php-simple-proxy and php-json-proxy\n if response =~ /\"status\":{\"http_code\":([\\d]+)}/\n result['code'] = $1\n result['message'] = ''\n # generic page titles containing HTTP status\n elsif response =~ />301 Moved</ || response =~ />Document Moved</ || response =~ />Object Moved</ || response =~ />301 Moved Permanently</\n result['code'] = 301\n result['message'] = 'Document Moved'\n elsif response =~ />302 Found</ || response =~ />302 Moved Temporarily</\n result['code'] = 302\n result['message'] = 'Found'\n elsif response =~ />400 Bad Request</\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ />401 Unauthorized</\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ />403 Forbidden</\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ />404 Not Found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />The page is not found</\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ />413 Request Entity Too Large</\n result['code'] = 413\n result['message'] = 'Request Entity Too Large'\n elsif response =~ />500 Internal Server Error</\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ />503 Service Unavailable</\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n # getaddrinfo() errors\n elsif response =~ /getaddrinfo: /\n if response =~ /getaddrinfo: nodename nor servname provided/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /getaddrinfo: Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # getnameinfo() errors\n elsif response =~ /getnameinfo failed: /\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # PHP 'failed to open stream' errors\n elsif response =~ /failed to open stream: /\n # HTTP request failed! HTTP/[version] [code] [message]\n if response =~ %r{failed to open stream: HTTP request failed! HTTP\\/(0\\.9|1\\.0|1\\.1) ([\\d]+) }\n result['code'] = $2.to_s\n result['message'] = ''\n if response =~ %r{failed to open stream: HTTP request failed! HTTP/(0\\.9|1\\.0|1\\.1) [\\d]+ ([a-zA-Z ]+)}\n result['message'] = $2.to_s\n end\n # No route to host\n elsif response =~ /failed to open stream: No route to host in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection refused\n elsif response =~ /failed to open stream: Connection refused in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /failed to open stream: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n # Success - This likely indicates an SSL/TLS connection failure\n elsif response =~ /failed to open stream: Success in/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Java 'java.net' exceptions\n elsif response =~ /java\\.net\\.[^\\s]*Exception: /\n if response =~ /java\\.net\\.ConnectException: No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.ConnectException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /java\\.net\\.UnknownHostException: Invalid hostname/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketException: Connection reset/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /java\\.net\\.SocketTimeoutException: Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # C errno\n elsif response =~ /\\[Errno -?[\\d]{1,5}\\]/\n if response =~ /\\[Errno -2\\] Name or service not known/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 101\\] Network is unreachable/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 104\\] Connection reset by peer/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 110\\] Connection timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n elsif response =~ /\\[Errno 111\\] Connection refused/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 113\\] No route to host/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 11004\\] getaddrinfo failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10053\\] An established connection was aborted/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10054\\] An existing connection was forcibly closed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10055\\] An operation on a socket could not be performed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10060\\] A connection attempt failed/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /\\[Errno 10061\\] No connection could be made/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n end\n # Python urllib errors\n elsif response =~ /HTTPError: HTTP Error \\d+/\n if response =~ /HTTPError: HTTP Error 400: Bad Request/\n result['code'] = 400\n result['message'] = 'Bad Request'\n elsif response =~ /HTTPError: HTTP Error 401: Unauthorized/\n result['code'] = 401\n result['message'] = 'Unauthorized'\n elsif response =~ /HTTPError: HTTP Error 402: Payment Required/\n result['code'] = 402\n result['message'] = 'Payment Required'\n elsif response =~ /HTTPError: HTTP Error 403: Forbidden/\n result['code'] = 403\n result['message'] = 'Forbidden'\n elsif response =~ /HTTPError: HTTP Error 404: Not Found/\n result['code'] = 404\n result['message'] = 'Not Found'\n elsif response =~ /HTTPError: HTTP Error 405: Method Not Allowed/\n result['code'] = 405\n result['message'] = 'Method Not Allowed'\n elsif response =~ /HTTPError: HTTP Error 410: Gone/\n result['code'] = 410\n result['message'] = 'Gone'\n elsif response =~ /HTTPError: HTTP Error 500: Internal Server Error/\n result['code'] = 500\n result['message'] = 'Internal Server Error'\n elsif response =~ /HTTPError: HTTP Error 502: Bad Gateway/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n elsif response =~ /HTTPError: HTTP Error 503: Service Unavailable/\n result['code'] = 503\n result['message'] = 'Service Unavailable'\n elsif response =~ /HTTPError: HTTP Error 504: Gateway Time-?out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Ruby exceptions\n elsif response =~ /Errno::[A-Z]+/\n # Connection refused\n if response =~ /Errno::ECONNREFUSED/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /Errno::EHOSTUNREACH/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Errno::ETIMEDOUT/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # ASP.NET System.Net.WebClient errors\n elsif response =~ /System\\.Net\\.WebClient/\n # The remote server returned an error: ([code]) [message].\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) /\n result['code'] = $1.to_s\n result['message'] = ''\n if response =~ /WebException: The remote server returned an error: \\(([\\d+])\\) ([a-zA-Z ]+)\\./\n result['message'] = $2.to_s\n end\n # Could not resolve hostname\n elsif response =~ /WebException: The remote name could not be resolved/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Remote server denied connection (port closed)\n elsif response =~ /WebException: Unable to connect to the remote server/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a plain-text connection to a HTTPS or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a receive/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # This likely indicates a HTTPS connection to a plain-text HTTP or non-HTTP service\n elsif response =~ /WebException: The underlying connection was closed: An unexpected error occurred on a send/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # The operation has timed out\n elsif response =~ /WebException: The operation has timed out/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n # Generic error messages\n elsif response =~ /(Connection refused|No route to host|Connection timed out) - connect\\(\\d\\)/\n # Connection refused\n if response =~ /Connection refused - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # No route to host\n elsif response =~ /No route to host - connect\\(\\d\\)/\n result['code'] = 502\n result['message'] = 'Bad Gateway'\n # Connection timed out\n elsif response =~ /Connection timed out - connect\\(\\d\\)/\n result['code'] = 504\n result['message'] = 'Timeout'\n end\n end\n result\n end",
"def send_by_code request, response, code, headers = {}\n\t\t\t\tbegin\n\t\t\t\t\tresponse.status = code\n\t\t\t\t\theaders.each {|k, v| response[k] = v}\n\t\t\t\t\treturn ErrorCtrl.new(request, response).index\n\t\t\t\trescue => e\n\t\t\t\t\tPlezi.error e\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend",
"def run\n response = nil\n @error_procs.each do |error_proc|\n result = nil\n begin\n result = error_proc.call(@exception, @context)\n rescue *STANDARD_ERROR_CLASSES => proc_exception\n @exception = proc_exception\n end\n response ||= response_from_proc(result)\n end\n response || response_from_exception(@exception)\n end",
"def detect\n get\n handle_response_code\n return @retval\n rescue Errno::ECONNREFUSED\n return [\"??? Cannot connect to #{@url}\"]\n rescue Exception => e\n return [\"??? Error: #{e.message}\"]\n end",
"def handle_response(response)\n begin\n if ok?(response.code)\n if response.body.present?\n parse_response_body(response.body)\n else\n true # blank body\n end\n else\n Rails.logger.error \"Unexpected response #{response.code}, not sure what to do here...\"\n response.message\n end\n rescue => e\n # don't report, just return\n response.message\n end\n end",
"def callback\n return response if called\n self.response = k.inject(\n env.merge(RESPONSE_BODY => body ,\n RESPONSE_STATUS => status,\n RESPONSE_HEADERS => headers,\n RESPONSE_SOCKET => socket,\n FAIL => ((env[FAIL]||[]) + [error]).compact,\n LOG => env[LOG] ||[])){ |r, i| i.call(r) }\n ensure\n self.called = true\n end",
"def api_response(*args) # :nodoc:\n code = args.first\n args.shift\n\n err = @@ERROR_CODES[code] || @@ERROR_CODES[:unknown]\n render :json => {\n :error => {\n :code => err[0],\n :message => err[1],\n },\n :content => args.first,\n }, :status => err[2]\n end",
"def error_manager(uri, response)\n case response\n when Net::HTTPSuccess then\n # This covers cases where the response may not validate as JSON.\n begin\n return JSON.parse(response.body)\n rescue\n return {}\n end\n when Net::HTTPBadRequest\n raise Ropenstack::MalformedRequestError, response.body\n when Net::HTTPNotFound\n raise Ropenstack::NotFoundError, \"URI: #{uri} \\n\" + response.body\t\n when Net::HTTPUnauthorized\n raise Ropenstack::UnauthorisedError, response.body\n else\n raise Ropenstack::RopenstackError, response.body\n end\n end",
"def process_response(response)\n if !valid_rpc_response?(response)\n fail(InvalidResponse.new(response: response))\n return\n end\n\n error_key = @symbolize_names ? :error : :error.to_s\n if response.key?(error_key)\n # process error response\n fail(ErrorResponse.parse(response, symbolize_names: @symbolize_names))\n else\n # process successful response\n succeed(Response.parse(response, symbolize_names: @symbolize_names))\n end\n end",
"def handle_error(e)\n # if an error is raised, we send an error response\n unless @response_sent || @streaming\n send_response(Response.error(e))\n end\n end",
"def on_server_response(connection, message)\n end",
"def handle_response(resp)\n self.response = JSON.parse(resp.body, symbolize_names: true)\n\n # :content and :reference must be included in response.\n if response.keys.include?(:content) && response.keys.include?(:reference)\n return\n end\n\n # :content or :reference not included.\n raise ::EasyManageClient::InvalidResponseContent\n end",
"def receive_codes(opts = {})\n receive_codes_with_http_info(opts)\n nil\n end",
"def status_code; end",
"def handle_resp!(resp)\n case resp\n when '201', '202'\n [ true, resp ]\n else\n [ false, resp ]\n end\n end",
"def handle_status(env)\n status = env[:status]\n case status\n when BadSyntaxStatus then raise Ashikawa::Core::BadSyntax\n when ResourceNotFoundErrorError then raise resource_not_found_for(env)\n when ClientErrorStatuses then raise Ashikawa::Core::ClientError, status\n when ServerErrorStatuses then raise Ashikawa::Core::ServerError, status\n end\n end",
"def handle_error_response(response)\n # Some errors come back under the `message` key while others are nested\n # under `error`\n error_message = response.body.dig('message') || response.body.dig('error', 'message')\n Rails.logger.error(\"SOLIDUS DRIP | #{error_message}\")\n end",
"def handle_request_exception(exception)\n # puts \"ERROR: #{exception}\\n\" + exception.backtrace.join(\"\\n\")\n handle_error_response(exception.kind_of?(CAHTTPError) ? JSON.parse(exception.response) : {})\n end",
"def process_response(cgi_response, ssb_response)\n case\n when ssb_response.nil?\n ['response is nil', 'N/A']\n when ssb_response.instance_of?(String)\n string_response(cgi_response, ssb_response)\n when ['301', '302'].include?(ssb_response.code)\n redirect_response(cgi_response, ssb_response)\n else\n ok_response(cgi_response, ssb_response)\n end\n end",
"def handle_headers_complete(headers)\n @code = @parser.status_code.to_i\n if @code != 200\n receive_error(\"invalid status code: #{@code}.\")\n end\n self.headers = headers\n @state = :stream\n end",
"def handle( request )\n\t\tresponse = nil\n\n\t\t# Dispatch the request after allowing plugins to to their thing\n\t\tstatus_info = catch( :finish ) do\n\t\t\tself.log.debug \"Starting dispatch of request %p\" % [ request ]\n\n\t\t\t# Run fixup hooks on the request\n\t\t\trequest = self.fixup_request( request )\n\t\t\tself.log.debug \" done with request fixup\"\n\t\t\tresponse = self.handle_request( request )\n\t\t\tself.log.debug \" done with handler\"\n\t\t\tresponse = self.fixup_response( response )\n\t\t\tself.log.debug \" done with response fixup\"\n\n\t\t\tnil # rvalue for the catch\n\t\tend\n\n\t\t# Status response\n\t\tif status_info\n\t\t\tself.log.debug \"Preparing a status response: %p\" % [ status_info ]\n\t\t\treturn self.prepare_status_response( request, status_info )\n\t\tend\n\n\t\treturn response\n\trescue => err\n\t\tself.log.error \"%s: %s %s\" % [ err.class.name, err.message, err.backtrace.first ]\n\t\terr.backtrace[ 1..-1 ].each {|frame| self.log.debug(' ' + frame) }\n\n\t\tstatus_info = { :status => HTTP::SERVER_ERROR, :message => 'internal server error' }\n\t\treturn self.prepare_status_response( request, status_info )\n\tend",
"def handle_error(client, e)\n code = case e\n when EOFError,Errno::ECONNRESET,Errno::EPIPE,Errno::ENOTCONN\n # client disconnected on us and there's nothing we can do\n when Unicorn::RequestURITooLongError\n 414\n when Unicorn::RequestEntityTooLargeError\n 413\n when Unicorn::HttpParserError # try to tell the client they're bad\n 400\n else\n Unicorn.log_error(@logger, \"app error\", e)\n 500\n end\n if code\n client.kgio_trywrite(err_response(code, @request.response_start_sent))\n end\n client.close\n rescue\n end",
"def server_error_status_code\n _undefined\n end",
"def client_error_status_code\n _undefined\n end",
"def handle_errors(interactor)\n interactor.call\n rescue Errors::Base => e\n context.fail!(resource: e, status: e.status)\n end",
"def check_response_for_errors(response)\n # take no action if there are no errors\n return unless response.soap_fault? || response.http_error?\n\n response_hash = response.to_hash\n if response_hash[:fault] && response_hash[:fault][:detail]\n # we can parse the response, so check the specific error code\n error_code = response_hash[:fault][:detail][:code]\n\n # if we can recognize the specific code, dispatch the proper exception\n if ERROR_HANDLERS.has_key? error_code\n raise ERROR_HANDLERS[error_code], response_hash[:fault][:faultstring]\n end\n\n # otherwise return a well-defined error string with the code and error message\n raise UnknownError, \"#{response_hash[:fault][:detail][:code]} #{response_hash[:fault][:detail][:description]}: #{response_hash[:fault][:faultstring]}\"\n end\n\n # we can't parse the error, so just pass back the entire response body\n raise UnknownError, response.to_s\n end",
"def _handle_error(e)\n res = @_response\n res.send(:initialize)\n res.status = 500\n res = _roda_handle_route{handle_error(e)}\n begin\n _roda_after(res)\n rescue => e2\n if errors = env['rack.errors']\n errors.puts \"Error in after hook processing of error handler: #{e2.class}: #{e2.message}\"\n e2.backtrace.each{|line| errors.puts(line)}\n end\n end\n res\n end",
"def handle_response(path, &block)\n begin\n result = yield\n rescue HTTPClient::TimeoutError\n raise ApiResource::RequestTimeout.new(\"Request Time Out - Accessing #{path}}\")\n rescue Exception => error\n if error.respond_to?(:http_code)\n ApiResource.logger.error(\"#{self} accessing #{path}\")\n ApiResource.logger.error(error.message)\n result = error.response\n else\n exception = ApiResource::ConnectionError.new(\n nil,\n :message => \"Unknown error #{error}\"\n )\n exception.set_backtrace(error.backtrace)\n raise exception\n end\n end\n return propogate_response_or_error(result, result.code)\n end",
"def processresponse(httpresponse)\n\n @responsecode = httpresponse.code\n case httpresponse.code\n when 201 # success condition\n @response = httpresponse.headers[:location]\n when 200 # success condition\n @response = httpresponse.headers[:location]\n\n end\n\n end",
"def execute(rpc_method, request_args)\n @last_request = request(rpc_method, request_args)\n\n _service_class.client.__send__(rpc_method, @last_request) do |c|\n\n # In the event of service failure, raise the error.\n c.on_failure do |error|\n raise ActiveRemoteError, error.message\n end\n\n # In the event of service success, assign the response.\n c.on_success do |response|\n @last_response = response\n end\n end\n end",
"def validate_response(response) # :nodoc:\n code = response.code.to_i\n raise HttpError, \"#{code} #{response.msg}\" if code < 200 || code > 299\n end",
"def got_response(response)\n end",
"def analyse_http_code(response_code)\n case response_code\n when 1 then\n # Failure to use the proxy\n return false\n when 400 .. 403 then\n # Proxy asks for authentication\n return false\n when 407 then\n # Proxy asks for authentication\n return false\n when 444 then\n return response_code\n else\n # If we get a valid return code, we add it to the final list\n return response_code\n end\n end",
"def net_http_res; end",
"def handle(name_or_code, app = Pakyow.app, from_logic = false)\n app.response.status = name_or_code if name_or_code.is_a?(Integer)\n\n @sets.each { |set|\n if h = set[1].handle(name_or_code)\n app.response.status = h[1]\n from_logic ? throw(:fns, h[2]) : self.trampoline(h[2], app)\n break\n end\n }\n end"
] |
[
"0.68822074",
"0.67487186",
"0.6747314",
"0.6656227",
"0.6633585",
"0.65465456",
"0.6535698",
"0.6535698",
"0.6498876",
"0.64748615",
"0.64741695",
"0.6401612",
"0.6363939",
"0.6346135",
"0.6337945",
"0.627549",
"0.6248701",
"0.6226966",
"0.6196111",
"0.61911094",
"0.61808723",
"0.6089815",
"0.6076218",
"0.6074166",
"0.6065097",
"0.60627973",
"0.60627973",
"0.60627973",
"0.60627973",
"0.60554165",
"0.6009715",
"0.60039353",
"0.59998924",
"0.59937906",
"0.59924644",
"0.59872127",
"0.5977522",
"0.596887",
"0.59536934",
"0.5944751",
"0.5943567",
"0.59380496",
"0.5934647",
"0.5922112",
"0.5919771",
"0.5900699",
"0.5867936",
"0.58650845",
"0.5861965",
"0.585195",
"0.5839494",
"0.58241755",
"0.5815155",
"0.58104783",
"0.5793029",
"0.57913876",
"0.57837236",
"0.5776518",
"0.5773615",
"0.57689875",
"0.57540864",
"0.57333624",
"0.5724572",
"0.5719367",
"0.5718237",
"0.57104105",
"0.5700868",
"0.5691936",
"0.56878626",
"0.5678254",
"0.56704456",
"0.5653997",
"0.5647197",
"0.5645259",
"0.5643223",
"0.56409097",
"0.5638229",
"0.56269157",
"0.5621717",
"0.5608754",
"0.5603669",
"0.55864316",
"0.55746907",
"0.55735606",
"0.5552983",
"0.5543308",
"0.5540845",
"0.5539877",
"0.55282104",
"0.5525311",
"0.5514097",
"0.5513192",
"0.5511361",
"0.5495898",
"0.54956937",
"0.5491585",
"0.5481102",
"0.54763234",
"0.547562"
] |
0.6858358
|
2
|
A method that attempts to render content from rit and if none found will raise an error Arguments: layout_name: +String+ The name of the rit layout instance_name: +String+ The name of the rit instance (optional) plate_name: +String+ The name of the rit plate Returns: Returns content (string) or raises error if not found
|
def rit_plate!(layout_name, instance_name, plate_name)
Rit::Plate.get(layout_name, instance_name, plate_name, session[:preview_time])
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def rit_plate!(layout_name, instance_name, plate_name)\n RitClient::Plate.get(layout_name, instance_name, plate_name, nil) # session[:preview_time]\n end",
"def render(name, options = {})\n options = options.merge(:request => request, :params => params)\n content = render_template(name, options)\n layout = options.delete(:layout)\n \n if name[0, 1] == '_'\n return content\n \n elsif layout == false\n response.body = content\n else\n options.merge!(:content => content)\n response.body = render_template(layout || \"layout.rhtml\", options)\n end\n\n response['Content-Length'] = response.body.size.to_s\n end",
"def render(template_name)\n if already_built_response? \n raise \"DoubleRenderError\"\n else \n controller_name = self.class.to_s.underscore \n dir = File.join(\"views\",controller_name, \"#{template_name}.html.erb\")\n # debugger\n content = File.read(dir).split(\"\\n\")\n content.map! do | statement | \n start_point = /<%/ =~ statement\n # debugger\n if start_point.nil? \n statement\n else \n front_part = statement[0...start_point]\n # returning = \n # start_point += statement[start_point+2] == \"=\" ? 2 : 1\n end_point = /%>/ =~ statement \n end_point += 1\n rear_part = statement[end_point+2..-1]\n front_part.to_s + ERB.new(statement[start_point..end_point]).result(binding) + rear_part.to_s\n end \n end \n render_content(content)\n end \n end",
"def render_rhtml(name)\n logmsg \"base_controller::render_rthml rendering #{name}\"\n content = get_rhtml(name)\n #logmsg \"base_controller::render_rhtml_internal() file not found #{name}\" if !content && @@debug\n return nil if !content\n if @body\n temp = body\n @body = \"\"\n erb = ERB.new(content,nil,nil,\"@body\")\n erb.result(binding)\n @body = temp + @body\n else\n erb = ERB.new(content,nil,nil,\"@body\")\n erb.result(binding)\n end\n # something in erb handling is changing the session! xxx\n # @session = Session.find_by_hashid cookies.anselm_sid\n return \"\"\n end",
"def read_or_render(template_name,language,key,render_args={},&prerender_block)\n # @logger.debug(\"render_base.read_or_render(#{template_name},#{language},#{key})\") if @logger\n #check cache\n\n renderer=nil\n unless key\n #try to generate the key\n renderer ||= get_renderer(template_name)\n\n key=renderer.get_key( render_args)\n end\n if key\n result=peek(language,key)\n end\n unless result\n\n template_name,key,render_args = process_prerender_block(\n template_name,\n key,\n render_args,\n &prerender_block)\n \n renderer ||= get_renderer(template_name)\n result=renderer.render(language,render_args,{})\n put_page_into_s3(language,key,result)\n else\n # @logger.debug(\"got it from cache\") if @logger\n\n end\n return result\n end",
"def rndr_frgmnt\n @somehtml = Frgmnt.find(params[:id]).frgtxt\n render(:layout => \"layouts/layout4rndr\")\n end",
"def render\n template_body = Tilt.new(@template).render(self)\n if @layout\n layout = Dir[File.join(File.dirname(@template), @layout) + '*'].first\n raise \"#{Guinness::EMOJI} Guinness : Unable to locate layout at: '#{@layout}'\" unless layout\n @body = Tilt.new(layout).render(self) { template_body }\n end\n @body || template_body\n end",
"def render_content(format)\n begin\n ERB.new( File.open( template_path_for(format) ).read, nil, '%<>' ).result(self.get_binding)\n rescue TemplateUndefined\n ''\n end\n end",
"def render(template_name)\n template_content = File.read(template_path(template_name))\n template = ERB.new(template_content)\n response_body = template.result(get_binding)\n render_content(response_body, 'text/html')\n end",
"def _render_one(entry)\n @entry = entry\n @filename = @entry.filename\n\n # avoid double render of layout path\n return if @entry.source_path == @layout_path\n\n # render. Result goes into @content_for_resources\n input = File.read(@entry.source_path)\n \n # render using either erb or haml\n case File.extname(@entry.source_path)\n when /\\.rhtml$/, /\\.html.erb$/\n @content_for_resources += eval(Erubis::Eruby.new.convert(input))\n when /\\.haml$/, /\\.html.haml$/\n require 'haml'\n @content_for_resources += Haml::Engine.new(input).to_html(self)\n end\n\n @filename =nil\n @entry = nil\n end",
"def load(name)\n render_rhtml [\"#{name}.rhtml\"]\n return \"\"\n end",
"def process_layout(config, widget_name)\n layout = nil\n layout_path = File.join(widget_name, 'layouts', \"#{config['layout']}.html\")\n [\n File.join(@ruhoh.paths.theme, \"widgets\", layout_path),\n File.join(@path, layout_path),\n File.join(@system_path, layout_path)\n ].each do |path|\n layout = path and break if File.exist?(path)\n end\n\n return '' unless layout\n content = File.open(layout, 'r:UTF-8') { |f| f.read }\n Mustache.render(content, {'config' => config})\n end",
"def render\n content\n end",
"def _render_layout_for( res )\n return unless res.layout\n lyt = Resources.layouts.find :filename => res.layout\n return if lyt.nil?\n\n _track_rendering(lyt.path) {\n @content = Filters.process(\n self, lyt, ::Webby::Resources::File.read(lyt.path))\n _render_layout_for(lyt)\n }\n end",
"def render(template_name)\n #Open template, put content into string-content\n cntrl_name = self.class.to_s.underscore\n\n erb_temp = File.read(\"views/#{cntrl_name}/#{template_name}.html.erb\")\n content = ERB.new(erb_temp).result(binding)\n\n render_content(content , 'text/html')\n end",
"def render(template_name)\n # \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # format view path\n controller_name = self.class.to_s.underscore\n view_path = \"views/#{controller_name}/#{template_name}.html.erb\"\n\n # read in contents of view file and interpret embedded ruby\n view_content = File.read(view_path)\n template_content = ERB.new(view_content).result(binding) # binding gives erb access to ivars\n\n # html/text downloads output???\n render_content(template_content, \"text/html\")\n end",
"def render(template_name)\n #Use controller and template names to construct paths to template files.\n\n\n #Use File.read to read the template file.\n\n #Create a new ERB template from the contents.\n \n #Evaluate the ERB template, using binding to capture the controller's instance variables.\n\n #Pass the result to #render_content with a content_type of text/html.\n\n \n end",
"def render(data = {}, &block)\n output = content(data, &block)\n output = layout.render(get_data(data)) { output } unless layout.nil?\n output\n end",
"def render(template_name)\n contents = File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\")\n template = ERB.new(contents)\n # ivars = self.instance_variables\n new_content = template.result(binding)\n render_content(new_content, \"text/html\")\n end",
"def layout_render(content)\n\t\t\treturn content unless @layout\n\n\t\t\tlayout_files = find_layouts(@layout)\n\t\t\treturn content if layout_files.empty?\n\n\t\t\tlayout_files.each_with_object(content.dup) do |layout_file, result|\n\t\t\t\tlayout = compile_file(layout_file)\n\t\t\t\tresult.replace layout.render(@scope, @locals) { result }\n\t\t\tend\n\t\tend",
"def lookup_layout\n return \"{{{content}}}\" if metadata.key?('layout') && !metadata['layout']\n\n name = metadata['layout'] || 'page'\n name = name + '.mustache' unless name.end_with?('.mustache')\n\n path = ::File.join('_layouts', name)\n dir = ::File.join(wiki.path, ::File.dirname(file.path))\n\n layout_file = lookup_path(path, dir)\n\n if layout_file\n IO.read(layout_file)\n else\n default_layout\n end\n end",
"def render(template_name)\n controller_name = self.class.to_s.gsub(/Controller$/, '').underscore\n base_template = ERB.new File.read(\"app/views/layouts/application.html.erb\")\n page_template = ERB.new File.read(\"app/views/#{controller_name}/#{template_name}.html.erb\")\n page = page_template.result(call_binding)\n content = base_template.result(call_binding { page })\n render_content(content, \"text/html\")\n end",
"def render(template_name)\n controller_name = self.class.to_s.underscore\n\n string = File.read(\"./views/#{controller_name}/#{template_name}.html.erb\")\n #\"./\" for project root dir\n\n template = ERB.new(string)\n capture = template.result(binding) #evaluate and bind\n\n render_content(capture, \"text/html\")\n end",
"def fetch_template_from_url\n layout_url = lookup_template_url\n return nil if layout_url == nil\n\n Rails.logger.info \"Fetching remote template from #{layout_url.inspect}\"\n\n response = Curl.get( layout_url ) do |curl| \n curl.timeout = self.http_timeout\n end\n response_body = response.body_str\n\n Rails.logger.info \"Got remote template response code #{response.response_code} with body #{response_body.inspect}\"\n\n return nil if response.response_code == 404\n \n response_body = postprocess_template( response_body ) if respond_to?( :postprocess_template, true )\n\n return response_body\n \n rescue SocketError, Curl::Err::TimeoutError, Errno::ECONNREFUSED, TemplateRejectedError => e\n Rails.logger.error e.message\n return nil\n end",
"def render(template_name)\n controller_name = self.class.to_s.underscore\n filepath = \"views/#{controller_name}/#{template_name}.html.erb\"\n file = File.read(filepath)\n\n to_render = ERB.new(file).result(binding)\n\n self.render_content(to_render, \"text/html\")\n end",
"def render(template_name)\n template = ERB.new( \n File.read( full_template_path( template_name ) )\n )\n render_content( template.result( binding ), 'text/html' )\n end",
"def render\n # puts 'rendering'\n # puts @@env\n if File.exist? @temp_view\n res = \n [ \n Erubis::Eruby.new(\n File.read(File.join(@@app, \"views\", \"template\", \"tem.html.erb\")) +\n File.read(@temp_view) +\n File.read(File.join(@@app, \"views\", \"template\", \"plate.html.erb\"))\n ).result( binding )\n ]\n [200, {'Content-Type' => 'text/html'}, res]\n else\n res = \n [ \n Erubis::Eruby.new(\n File.read(File.join(@@app, \"views\", \"template\", \"tem.html.erb\")) +\n File.read(File.join(@@app, \"views\", \"404.html.erb\")) +\n File.read(File.join(@@app, \"views\", \"template\", \"plate.html.erb\"))\n ).result( binding )\n ]\n [404, {'Content-Type' => 'text/html'}, res]\n end\n end",
"def render_from_view(what, type, engines=[:sass])\n out = show :\"#{type}/#{what}\", :engine => engines\n\n content_type type\n out\n rescue Errno::ENOENT => e\n nil\n end",
"def wrap_layout(layout_name, &block)\n # Save current buffer for later\n buf_was = save_buffer\n\n # Find a layout for this file\n layout_file = ::Middleman::TemplateRenderer.locate_layout(@app, layout_name, current_engine)\n\n # Get the layout engine\n extension = File.extname(layout_file[:relative_path])\n engine = extension[1..-1].to_sym\n\n # Store last engine for later (could be inside nested renders)\n self.current_engine = engine\n engine_was = current_engine\n\n # By default, no content is captured\n content = ''\n\n # Attempt to capture HTML from block\n begin\n content = capture_html(&block) if block_given?\n ensure\n # Reset stored buffer, regardless of success\n restore_buffer(buf_was)\n end\n\n # Render the layout, with the contents of the block inside.\n concat_safe_content render_file(layout_file, @locs, @opts) { content }\n ensure\n # Reset engine back to template's value, regardless of success\n self.current_engine = engine_was\n end",
"def render\n content\n end",
"def render\n content\n end",
"def render\n content\n end",
"def the_template(content=nil)\n if node = content || @content || Content.get(params[:id])\n node.template\n else\n \"<strong>Error:</strong> No template information could be found\" unless ENV['RACK_ENV'] == 'production'\n end\n end",
"def render(template_name, context=Context.new, layout=true)\n #context = Context.new(context) if context.is_a?(Hash)\n context = hook_context(context)\n while true\n template = get_template(template_name, context) # context is passed only for preprocessor\n _buf = context._buf\n output = template.render(context)\n context._buf = _buf\n unless context._layout.nil?\n layout = context._layout\n context._layout = nil\n end\n layout = @layout if layout == true or layout.nil?\n break unless layout\n template_name = layout\n layout = false\n context.instance_variable_set('@_content', output)\n end\n return output\n end",
"def render(template_name)\n template = ERB.new(File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\"))\n bindings = binding()\n render_content(template.result(bindings), \"text/html\")\n end",
"def render(template_name)\n body_string = ''\n File.open(\"./app/views/#{controller_name}/#{template_name}.html.erb\", 'r') do |f|\n f.each_line do |line|\n body_string += line\n end\n end\n\n content = ERB.new(body_string).result(binding)\n render_content(content, 'text/html')\n end",
"def render(request)\n case format\n when :html\n @data\n when :erb\n scope = Scope.new(request, @view_registry)\n view_html = Tilt[\"erb\"].new { @data }.render(scope)\n\n if @layout_data\n layout_template = Tilt[\"erb\"].new { @layout_data }\n layout_template.render(scope) { view_html }\n else\n view_html\n end\n end\n end",
"def render_for_file_with_dryml(template_path, status = nil, layout = nil, locals = {})\n render_for_file_without_dryml(template_path, status, layout, locals)\n rescue ActionView::MissingTemplate => ex\n # Try to use a DRYML <page> tag instead\n tag_name = @dryml_fallback_tag || \"#{File.basename(template_path).dasherize}-page\"\n\n text = call_dryml_tag(tag_name)\n if text\n render_for_text text, status \n else\n raise ex\n end\n end",
"def render(template_name)\n controller_name = self.class.name.underscore\n dir_path = File.dirname(__FILE__)\n\n file_path = File.join(dir_path, \"..\", 'views', controller_name, \"#{template_name}.html.erb\")\n file_content = File.read(file_path)\n\n template = ERB.new(file_content)\n render_content(template.result(binding), 'text/html')\n end",
"def contents_or_blank\n\t\tcontents\n\trescue Rush::DoesNotExist\n\t\t\"\"\n\tend",
"def render(content = 'No template provided')\n # get Nokogiri object with html source\n html = Nokogiri::HTML(htmlbody)\n\n # pick image tags from source and inject the right images\n mailskinassets.each do |mailskinasset|\n html.css('img').each do |image|\n # do we have the filename of our mailskinasset in the source attribute?\n if image.attributes['src'].value.to_s.include? mailskinasset.mailskinasset_file_name\n # replace he whole source with correct url\n image.attributes['src'].value = mailskinasset.absolute_asset_url.to_s\n end\n end\n end\n html.to_s.gsub('{yield}', content)\n end",
"def _layout_page\n @content = @page.render(self)\n\n _track_rendering(@page.path) {\n _render_layout_for(@page)\n }\n raise ::Webby::Error, \"rendering stack corrupted\" unless @@stack.empty?\n\n @content\n rescue ::Webby::Error => err\n @log.error \"while rendering page '#{@page.path}'\"\n @log.error err.message\n rescue => err\n @log.error \"while rendering page '#{@page.path}'\"\n @log.fatal err\n exit 1\n ensure\n @content = nil\n @@stack.clear\n end",
"def render r\n end",
"def render_body(view_name, locals={})\n filename = File.join \"app\", \"views\", controller_name, \"#{view_name}.html.erb\"\n if File.exist? filename\n renderfile = Tilt.new(filename)\n body_content = renderfile.render(self)\n render_layout.render self do body_content end\n end\n end",
"def render(template_name)\n path = \"views/#{ActiveSupport::Inflector.underscore(self.class.to_s)}/#{template_name}.html.erb\"\n ftext = File.read(path)\n template = ERB.new(ftext).result(binding)\n render_content(template, 'text/html')\n# Let's write a #render(template_name) method that will:\n# Use controller and template names to construct paths to template files.\n# Use File.read to read the template file.\n# Create a new ERB template from the contents.\n# Evaluate the ERB template, using binding to capture the controller's\n# instance variables.\n# Pass the result to #render_content with a content_type of text/html.\n# We'll assume that any developers who use our framework are aware of\n# our template naming convention, which is as follows:\n# \"views/#{controller_name}/#{template_name}.html.erb\". Use\n# ActiveSupport's #underscore (require 'active_support/inflector')\n# method to convert the controller's class name to snake case. We'll be\n# lazy and not chop off the _controller bit at the end.\n end",
"def render(template_name)\n path = File.join('views', self.class.name.underscore, \"#{template_name}.html.erb\")\n file = File.read(path)\n @flash = flash.now unless flash.now.empty?\n render_content(ERB.new(file).result(binding), 'text/html')\n end",
"def rails_render(*args)\n return if rails_api_controller?\n\n rails_controller_instance.render_to_string(*args)\n rescue ActionView::MissingTemplate\n nil\n end",
"def render(path)\n\t\t\tredcarpet = Redcarpet::Markdown.new(Redcarpet::Render::HTML, :autolink => true)\n\t\t\tredcarpet.render(File.read(path))\n\t\tend",
"def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end",
"def postload\n if @current_layout && @current_layout.length > 0\n @content_for_layout = @body\n @body = \"\"\n render_rhtml(@current_layout)\n end\n end",
"def get_driver_recipe\n # TODO: we may want to move the path from the top level\n return nil if config[:layout].nil?\n path = \"#{config[:kitchen_root]}/#{config[:layout]}\"\n file = File.open(path, \"rb\")\n contents = file.read\n file.close\n contents\n end",
"def openoffice_content(layout_path, basename)\n filename = basename[0..(basename.index(\".\")-1)]\n template_path = \"app/views/#{params[:controller]}/#{params[:format]}/#{params[:action]}/#{basename}\"\n layout_path = \"app/views/layouts/#{params[:format]}/#{basename}\"\n temp_ref_path = \"#{params[:controller]}/#{params[:format]}/#{params[:action]}/#{filename}.xml\"\n layout_ref_path = \"layouts/#{params[:format]}/#{filename}.xml\"\n\n #each registered mime-type needs a template directory in app/views/layouts that corresponds to the mimetype. Example:\n #the template for odp can be found in app/views/layouts/odp\n\n #if there's a template in the directory, render it with the layout. if there's not, just render the layout.\n\n if File.exists?(template_path)\n #for each file, evaluate the template code to a string\n content = render_to_string(:template => temp_ref_path, :layout => layout_ref_path)\n else\n content = render_to_string(:template => layout_ref_path)\n end\n content\n end",
"def render_template(path)\n render(path)\n exit\n end",
"def render(model, &content)\n template = Neapolitan.file(path, :stencil=>site.config.stencil)\n\n # update the model's metadata\n #model.update(template.metadata)\n\n result = template.render(model, &content).to_s\n\n layout_name = template.metadata['layout']\n\n if layout_name\n layout = site.lookup_layout(layout_name)\n\n raise \"No such layout -- #{layout}\" unless layout\n\n result = layout.render(model){ result }\n end\n\n result.to_s\n end",
"def get( wrapped_page_layout )\n key = wrapped_page_layout.to_key \n unless resources_cache.key? key\n target_resource = nil\n resource_id = wrapped_page_layout.assigned_text_id\n if resource_id > 0 \n target_resource = Spree::TemplateText.find(resource_id)\n end\n resources_cache[key] = target_resource \n end\n if resources_cache[key].present?\n resources_cache[key]\n else\n nil \n end\n end",
"def uncached_render\n before_process\n\n content = engine.transform(self)\n\n if path and tlayout = layout\n [instance, tlayout.instance].each do |i|\n i.instance_variable_set(\"@content\", content)\n end\n\n content = tlayout.render\n end\n\n content\n\n ensure\n after_process unless $!\n end",
"def render\n erb_page = ERB.new(content).result(binding)\n Kramdown::Document.new(erb_page).to_html.html_safe\n end",
"def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end",
"def render_template(name)\n locals = { :task => @task, :node => @node, :repo => @repo }\n content_type 'text/plain'\n template, opts = @task.find_template(name)\n erb template, opts.merge(locals: locals, layout: false)\n end",
"def render(template_name, options = {})\n file = File.read(\"views/#{self.class.to_s.underscore}/#{template_name}.html.erb\")\n template = ERB.new(file).result(binding)\n return template if options.include?(:partial)\n render_content(template, 'text/html')\n end",
"def assert_renders_correctly(name, path)\n input_source = path.read\n output_source = @handler.compile(Template.new(input_source))\n value = @view.instance_eval output_source\n reference = (REFERENCE_PATH + @view.prawnto_options[:filename]).read\n\n message = \"template: #{name}\\n\"\n message += \">\"*30 + \" original template: \" + \">\"*20 + \"\\n\"\n message += input_source + \"\\n\"*2\n message += \">\"*30 + \" manipulated template: \" + \">\"*20 + \"\\n\"\n message += output_source + \"\\n\" + \"<\"*60 + \"\\n\"\n\n assert_equal reference, value, message\n end",
"def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end",
"def render(filename, content)\n if renderer = renderer_for(filename)\n renderer.call content\n else\n content\n end\n end",
"def single_content_for(name, content = nil, &block)\n @view_flow.set(name, ActiveSupport::SafeBuffer.new)\n content_for(name, content, &block)\n end",
"def content\n return @raw if @raw\n\n if self.uri\n @raw = HTTParty.get(self.uri.to_s).body\n # elsif self.precompiled?\n # template = Tilt.new(self.filepath)\n # @raw = template.render\n else\n @raw = File.read(self.filepath)\n end\n end",
"def render_result\n layout = @render_args[:layout]\n view = @render_args[:view]\n if layout.kind_of? Symbol # this handles the layout(:none)\n view.result(binding)\n else\n @view[:timestamp] = \"<!-- server: #{@port} / rendered: #{Time.now()} / env: #{rack_env} -->\"\n @view[:body] = view.result(binding)\n # layout = @layout if layout.nil? # this handles the layout(:some_other_layout) case for formats\n layout.result(binding)\n end\n end",
"def render(snip, part=:content, args=[])\n rendering(snip) do |r|\n r.render(snip, part, args)\n end\n end",
"def render(template)\n template = File.read(\"./views/#{template}\")\n engine = Haml::Engine.new(template)\n @response = engine.render\nend",
"def render_string_from_view(view_file)\n end",
"def render_string_from_view(view_file)\n end",
"def get_content_for_layout()\n get_partial(@type)\n # if @type == \"home\"\n # get_partial('home')\n # elsif @type == \"page\"\n # get_partial('page')\n # elsif @type == \"article\"\n # get_partial('article')\n # elsif @type == \"category\"\n # get_partial('category')\n # end\n end",
"def render_template(template, env)\n templates_dir = \"lib/search_engine/views\"\n template = \"#{template}.slim\" unless template.end_with? \".slim\"\n template_path = \"#{templates_dir}/#{template}\"\n content = File.read(template_path)\n Slim::Template.new { content }.render(env)\nend",
"def layout_or_nil(layout_name)\n begin\n if (layout = Rfm.layout(layout_name)).table then layout; end\n rescue nil\n end\n end",
"def render_partial(file_name)\n # The \"default\" version of the partial.\n file_to_render = \"#{@input_folder}/partials/#{file_name.to_s}.haml\"\n if @scope\n # Look for a partial prefixed with the current \"scope\" (which is just the name of the\n # primary template being rendered).\n scope_file = \"#{@input_folder}/partials/#{@scope.to_s}_#{file_name.to_s}.haml\"\n # Use it if it's there.\n file_to_render = scope_file if File.exists? scope_file\n end\n # If we found a matching partial (either the scoped one or the default), render it now.\n if File.exists? file_to_render\n partial = Haml::Engine.new(File.read(file_to_render), @options)\n partial.render self\n else\n nil\n end\n rescue Exception => e\n raise $!, \"#{$!} PARTIAL::#{file_name} \", $!.backtrace\n end",
"def content_for_with_empty_check(name, content = nil, &block)\n if content_for?(name) == :empty\n # Some preceding layout or template has already specified that there is to be no content for this name, and that is FINAL.\n return nil\n else\n content_for_without_empty_check(name, content, &block)\n end\n end",
"def inner_content\n return \"\" if inner_template == nil\n if inner_presenter == nil\n return GentleREST::Template.render(inner_template)\n else\n return GentleREST::Template.render(inner_template, inner_presenter)\n end\n end",
"def render\n ExtensionMatcher.new(path)\n .default { content }\n .on(\"html\") { compress render_erb }\n .on(\"md\") { compress render_erb }\n .on(\"erb\") { compress render_erb }\n .match\n end",
"def partial(file_name)\n erb file_name, :layout => false\n end",
"def render\n template = ERB.new File.new(@template_path).read, nil, \"%\"\n template.result(binding)\n end",
"def post_process\n @result = @result[:content].first\n raise ::Grafana::ImageCouldNotBeRenderedError, @panel if @result.include?('<html')\n end",
"def content\n @content ||= @filename ? pathname.read : BLANK_TEMPLATE\n end",
"def get_layout(layout_path)\n\n if layout_path.nil?\n contents = \"---\\n\"\n contents << \"title:\\n\"\n contents << \"layout: post\\n\"\n contents << \"date:\\n\"\n contents << \"---\\n\"\n ext = nil\n else\n begin\n contents = File.open(layout_path, \"r\").read()\n ext = layout_path.match(/\\.(.*?)$/)[1]\n rescue Errno::ENOENT\n bad_path(layout_path)\n end\n end\n\n return contents, ext\n end",
"def partial(template_name, locals, &content)\n self.kramdown_source.render(template_name)\n end",
"def content\n super\n @renderer = @widget.content\n div :id => 'doc3' do\n if @renderer.render? :header\n div :id => 'hd' do\n if @renderer.render? :top_line\n render_top_line\n end\n if @renderer.render? :title\n h1 @page_title || 'Missing :page_title'\n end \n end\n end\n div :id => 'bd' do\n render_body\n end\n if @renderer.render? :footer\n div :id => 'ft' do\n render_footer\n end\n end\n end\n end",
"def erb(path, layout: nil, status: 200)\n content = \"\"\n\n unless path.nil?\n templates = [read_template(path)]\n templates << read_template(layout) unless layout.nil?\n\n content = templates.inject(nil) do |prev, temp|\n _render_erb(temp) { prev }\n end\n end\n\n Rack::Response.new(content, status, {\n \"Content-Type\" => \"text/html\",\n })\n end",
"def render(template_path)\n template = File.read(\"#{app.views}/#{template_path.sub(/^\\//, '')}\")\n engine = Haml::Engine.new(template)\n @response = engine.render(self, assigns_for_template)\nend",
"def rendered_content\n ERB.new(template).result(binding)\n end",
"def find_template(name)\n \n # Search in theme path\n template_path = Themes::ThemeManager.instance.selected_theme.resource_path(\"#{name}.erb\",'template','ui') \n \n # Search in the project\n if not template_path\n path = app.get_path(name) #File.expand_path(File.join(File.dirname(__FILE__), '..', 'views', \"#{name}-fieldset-render.erb\")) \n template_path = path if File.exist?(path)\n end\n \n template_path\n \n end",
"def render_content(options={})\n layout = ::Liquid::Template.parse(\"{{content}}\").render({\"content\" => page.content})\n result = ::Liquid::Template.parse(layout).render(optional_data(options), :registers => {:controller => controller}).html_safe\n rescue => e\n log_error(e)\n ensure\n return filter_images_urls(result.to_s)\n end",
"def find(name, options = {})\n config = Resource::System.configuration(options)\n find_from_config(\"config/repoLayouts/repoLayout/name[text()='#{name}']\", config, options)\n rescue Error::HTTPError => e\n raise unless e.code == 404\n\n nil\n end",
"def render_resource(r)\n data = {\n \"title\" => r[:title],\n \"content\" => r.html\n }\n\n populate(data)\n end",
"def render!\n render :file => template_path\n end",
"def render_content(content, content_type = 'text/html')\n if self.already_built_response?\n raise \"Double render error!\"\n else\n @res.write(content)\n @res['Content-Type'] = content_type\n @already_built_response = true\n nil\n end\n end",
"def render_template(view, template, layout_name, locals); end",
"def content_asset(name, content)\n page = Islay::Pages.definitions[name]\n raise \"The page '#{name}' has not been defined\" if page.nil?\n raise \"The content '#{content}' has not been defined\" if page.contents[content].nil?\n\n if record = page.record\n config = record.content_with_config(content)\n\n case config[:type]\n when :image then config[:value].asset if config[:value]\n end\n end\n end",
"def body_content(params, show_raw = false)\n p = PatientMedicareEligibilityInfo.new(\"9999999990\", \"Metro\", \"Praveen\", \"K\", Date.new(2014, 5, 19), \"123456789A\")\n #edi_content = p.medicare_eligibility_271_edi_content\n #hcpc_codes_file_path = File.join(Rails.root, 'static_data', 'hcpc_codes', 'hcpc_2013.csv')\n data_hash = p.generate_eligibility_xml\n debug_log data_hash\n if data_hash == {}\n %Q(\n <html><body style='font-color: red'><h1>Error fetching Eligibility Information. Possible Reasons: \n <br>\n <br>\n <h2>1. No matching Patient Information found in Medicare database.\n <h2>2. Temporary Error Contacting Medicare Servers.\n <br>\n <br> \n <h2> Please double check the information you entered and Try after sometime.\n <h2> If Error persists, please contact Fasternotes Support.</body></html>\n )\n else\n html_content = html_data_from_hash(data_hash)\n %Q(\n #{html_content}\n )\n end\n end",
"def layout\n return @layout if @layout\n\n bad_tiles = [] # The set of tile names that didn't work!\n @layout = [] # The 2D array of tiles\n for row in layout_text\n @layout.push(r = [])\n for tile_name in row\n tile = Tile.find_by_name(tile_name)\n r.push(tile)\n # Handle an error by remembering the tile name\n unless tile\n bad_tiles.push(tile_name) unless bad_tiles.include?(tile_name)\n end\n end\n end\n\n # If there was a problem raise the Error.\n unless bad_tiles.empty?\n @layout = nil\n raise Error(\"Bad tiles: %s\" % bad_tiles.join(\", \"))\n end\n @layout\n end",
"def layout\n return @layout if @layout\n\n bad_tiles = [] # The set of tile names that didn't work!\n @layout = [] # The 2D array of tiles\n for row in layout_text\n @layout.push(r = [])\n for tile_name in row\n tile = Tile.find_by_name(tile_name)\n r.push(tile)\n # Handle an error by remembering the tile name\n unless tile\n bad_tiles.push(tile_name) unless bad_tiles.include?(tile_name)\n end\n end\n end\n\n # If there was a problem raise the Error.\n unless bad_tiles.empty?\n @layout = nil\n raise Error(\"Bad tiles: %s\" % bad_tiles.join(\", \"))\n end\n @layout\n end",
"def renders(&block)\n define_method(:renderable) do\n instance_eval(&block).try(:to_page)\n end\n end",
"def render *args\n @content\n end"
] |
[
"0.6837537",
"0.6112611",
"0.5998462",
"0.5934889",
"0.5829886",
"0.5757414",
"0.57359535",
"0.5678536",
"0.5645443",
"0.558501",
"0.55717665",
"0.5544386",
"0.55421066",
"0.5535778",
"0.55078614",
"0.55052394",
"0.55020916",
"0.5502012",
"0.5449088",
"0.5441717",
"0.5434127",
"0.54209644",
"0.54176515",
"0.54176027",
"0.5416264",
"0.540829",
"0.5403641",
"0.5401682",
"0.53780615",
"0.5367858",
"0.5367858",
"0.5367858",
"0.5366916",
"0.53614306",
"0.53445894",
"0.53437626",
"0.5307538",
"0.5300488",
"0.52958",
"0.5281092",
"0.5243241",
"0.52408844",
"0.52216554",
"0.5219757",
"0.5207168",
"0.52071315",
"0.5200266",
"0.5193726",
"0.51831585",
"0.5181759",
"0.5172392",
"0.5171692",
"0.51586825",
"0.51534724",
"0.51373",
"0.51368684",
"0.51348704",
"0.51283205",
"0.5117342",
"0.5102698",
"0.5100804",
"0.5098768",
"0.50980985",
"0.50970685",
"0.50923073",
"0.5091666",
"0.50687456",
"0.5061167",
"0.5061107",
"0.5061107",
"0.5053648",
"0.5051912",
"0.50491065",
"0.50458163",
"0.50412667",
"0.50261325",
"0.5019893",
"0.5011626",
"0.5007526",
"0.5003441",
"0.50027615",
"0.5002118",
"0.4998488",
"0.49976543",
"0.49903706",
"0.49899992",
"0.4985148",
"0.4981694",
"0.49777633",
"0.4966286",
"0.4949068",
"0.49426302",
"0.4936369",
"0.4922379",
"0.4917567",
"0.49159378",
"0.4913469",
"0.4913469",
"0.491242",
"0.49056038"
] |
0.7066558
|
0
|
GET /fotos_empresas GET /fotos_empresas.json
|
def index
@fotos_empresas = FotosEmpresa.all
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @fotos = Foto.all\n end",
"def index\n @fotos = Foto.all\n end",
"def index\n @fotos = Foto.all\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def set_fotos_empresa\n @fotos_empresa = FotosEmpresa.find(params[:id])\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 @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @current_page = 'recettes'\n @recettes = Recette.includes(:photo_files).all.order('id desc').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recettes }\n end\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def show\n @foto = Foto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foto }\n end\n end",
"def show\n @foto_galeri = FotoGaleri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foto_galeri }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end",
"def show\n @men_fashion = MenFashion.find(params[:id])\n @photos = @men_fashion.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @men_fashion }\n end\n end",
"def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end",
"def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end",
"def show\n @producto = Producto.includes(:fotos).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n end",
"def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end",
"def index\n @especie = Especie.find(params[:especie_id])\n @especie_imagens = EspecieImagem.find(@especie.especie_imagens)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @especie_imagens }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end",
"def index\n por_pagina = params[:por_pagina] || 18\n @productos = Producto.paginate(page: params[:page], per_page: por_pagina).includes(:fotos)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @productos }\n end\n end",
"def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\n end",
"def show\n #@pet = Pet.find(params[:id])\n @pet = Pet.includes(:petphotos).find(params[:id])\n\n if (@pet.petphotos.length > 0)\n logger.debug(\"image = \" + @pet.petphotos[0].image)\n end \n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @pet }\n format.json { render json: {:pet => @pet, :petphoto => @pet.petphotos[0] } }\n end\n end",
"def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def index\n @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n render json: Picture.all\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 @foto_album = FotoAlbum.find(params[:id])\n @fotos = @foto_album.fotos\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @foto_album }\n end\n end",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def index\n @pictures = @museum.pictures.all #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 index\n render json: @fiestas\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 index\n #@arquivos = Arquivo.all\n\n residencial = current_user.apartamento.residencial\n @arquivos = Arquivo\n .where(:residencial_id => residencial.id)\n .order(\"created_at\")\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arquivos }\n end\n end",
"def index()\n @photos = all_photos()\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def 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 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 respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\n end\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 @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n\n ests = @establecimientos.map { |establecimiento| { :nombre_establecimiento => establecimiento.nombre, :id => establecimiento.id, \n :descripcion => establecimiento.descripcion, :longitud => establecimiento.longitud,\n :latitud => establecimiento.latitud, :direccion => establecimiento.direccion, :imagen => establecimiento.foto.url(:small),\n :eventos => establecimiento.eventos.map { |evento| { :nombre => evento.nombre } } } } \n render json: ests\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n\n }\n format.html { redirect_to :controller=>'login', :action=>'login' } #solo el app movil puede revisar toda la lista de establecimientos.\n end\n end",
"def show\n @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end",
"def show\n @photoalbum = Photoalbum.find(params[:id])\n \n # temporary solution to get exif information in photos which are on the server: TODO\n @exifphotos = @photoalbum.photos.where(exif_date: nil, photo_content_type: \"image/jpeg\")\n @exifphotos.each do |p|\n if File.exists?(p.photo.path)\n exif = EXIFR::JPEG.new(p.photo.path)\n p.exif_date = exif.date_time\n if not exif.date_time.nil?\n p.save\n end\n end\n end\n\n @allphotos = @photoalbum.photos.all(:order => 'exif_date DESC, photo_file_name DESC, created_at DESC')\n @photos = @photoalbum.photos.paginate(:page => params[:page], :order => 'exif_date DESC, photo_file_name DESC, created_at DESC', :per_page => 12)\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photoalbum }\n end\n end",
"def index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\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 @ventas_presupuestos = Ventas::Presupuesto.paginate(:page => params[:page], :per_page => 5)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ventas_presupuestos }\n end\n end",
"def index\n @rock_photos = RockPhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rock_photos\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 @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def show\n @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologo }\n end\n end",
"def index\n @efectivos = Efectivo.all\n end",
"def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @photos = @room.photos\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",
"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 respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end",
"def index\n @photos = @contest.photos.for_user(current_user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\n end\n end",
"def index\n @foros = Foro.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @foros }\n end\n end",
"def consulta\n fiesta = Fiesta.all\n render json: fiesta\n end",
"def index\n @hotel_photos = HotelPhoto.all\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 @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def index\n @structure_photos = StructurePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @structure_photos\n end",
"def obtener_fotos(filtro, numero)\n\t\t$Fotos = flickr.photos.search(:tags => filtro, :per_page => numero, :page => 1)\n\tend",
"def index\n @postos = Posto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postos }\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 show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @look_book = LookBook.find(params[:id])\n\n @photos = @look_book.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @look_book }\n end\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def index\n @producto_imagenes = ProductoImagen.all\n end",
"def index\n @coordenador_estagios = CoordenadorEstagio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coordenador_estagios }\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 index\n @employes = Employe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @employes }\n end\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 etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def show\n @publicaciones = Publicacione.find(params[:id])\n render json: @publicaciones, status: :ok\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 index\n if current_user.nil?\n @photoalbums = Photoalbum.includes('agendaitem').where(public: true).order(\"case when agendaitems is null then photoalbums.created_at else agendaitems.date end DESC\").paginate(:page => params[:page], :per_page => 12)\n else\n @photoalbums = Photoalbum.includes('agendaitem').order(\"case when agendaitems is null then photoalbums.created_at else agendaitems.date end DESC\").paginate(:page => params[:page], :per_page => 12)\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photoalbums }\n end\n end",
"def get_photos_from_flickr(args = {})\n args = GET_PHOTOS_DEFAULT_OPTIONS.merge(args)\n response = client.people.getPhotos(args)\n return nil if response.page > response.pages\n\n normalize(response:)\n end",
"def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def index\n if params[:all] == 'true'\n @photos = Photo.all\n else\n @photos = Photo.paginate(:page => params[:page], :per_page => 50)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n @imagen_pedido = ImagenPedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagen_pedido }\n format.xml { render xml: @imagen_pedido }\n\n end\n end",
"def index\n @repas = Repa.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @repas }\n end\n end",
"def show\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_photo }\n end\n end",
"def index\n @activity = Activity.find(params[:activity_id])\n @pictures = @activity.pictures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pictures }\n end\n end"
] |
[
"0.72819805",
"0.6677903",
"0.6677903",
"0.6677903",
"0.6607128",
"0.65713364",
"0.6549457",
"0.65436417",
"0.650856",
"0.64812297",
"0.6460189",
"0.6456988",
"0.6441628",
"0.64356804",
"0.64270514",
"0.64240247",
"0.64195305",
"0.6382988",
"0.6381398",
"0.6377611",
"0.63662183",
"0.63628256",
"0.63608843",
"0.6351534",
"0.6340384",
"0.63397783",
"0.630417",
"0.6276131",
"0.624372",
"0.61991245",
"0.61963075",
"0.6184632",
"0.6149539",
"0.6135495",
"0.6131279",
"0.6116688",
"0.61154443",
"0.6115309",
"0.6106236",
"0.6089161",
"0.6077775",
"0.60667986",
"0.60663766",
"0.6063802",
"0.60573846",
"0.60531235",
"0.60393494",
"0.6028926",
"0.6025725",
"0.6010741",
"0.6009831",
"0.6004967",
"0.5991487",
"0.59844077",
"0.5978705",
"0.5975286",
"0.59628767",
"0.59594667",
"0.59535074",
"0.59506744",
"0.5949786",
"0.59474736",
"0.59455246",
"0.59455246",
"0.59455246",
"0.5943174",
"0.59380895",
"0.5936841",
"0.59367955",
"0.59365976",
"0.59358275",
"0.5927117",
"0.5926766",
"0.59216094",
"0.5920696",
"0.5918289",
"0.5917633",
"0.5917312",
"0.59155446",
"0.5905938",
"0.5901648",
"0.59010524",
"0.58997446",
"0.5895143",
"0.5891918",
"0.58835727",
"0.5883235",
"0.586938",
"0.5868751",
"0.58661747",
"0.5864503",
"0.5859805",
"0.5859",
"0.5857659",
"0.5851926",
"0.5848501",
"0.5845278",
"0.5844381",
"0.58397543",
"0.5838403"
] |
0.74116987
|
0
|
GET /fotos_empresas/1 GET /fotos_empresas/1.json
|
def show
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"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 @fotos_empresas = FotosEmpresa.all\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 @fotos = Foto.all\n end",
"def index\n @fotos = Foto.all\n end",
"def index\n @fotos = Foto.all\n end",
"def set_fotos_empresa\n @fotos_empresa = FotosEmpresa.find(params[:id])\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def show\n @foto = Foto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foto }\n end\n end",
"def show\n @foto_galeri = FotoGaleri.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foto_galeri }\n end\n end",
"def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end",
"def index\n @current_page = 'recettes'\n @recettes = Recette.includes(:photo_files).all.order('id desc').limit(15)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recettes }\n end\n end",
"def index\n @imagems = Imagem.where(:imovel_id => current_user.imovels {|i| i.id})\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagems }\n end\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @especie = Especie.find(params[:especie_id])\n @especie_imagens = EspecieImagem.find(@especie.especie_imagens)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @especie_imagens }\n end\n end",
"def show\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n render json: @photo\n end\n end",
"def show\n @producto = Producto.includes(:fotos).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @producto }\n end\n end",
"def index\n @pictures = Picture.where(foodscape_id: params[:foodscape_id])\n render json: @pictures\n end",
"def index\n @photos = Photo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def show\n #@pet = Pet.find(params[:id])\n @pet = Pet.includes(:petphotos).find(params[:id])\n\n if (@pet.petphotos.length > 0)\n logger.debug(\"image = \" + @pet.petphotos[0].image)\n end \n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @pet }\n format.json { render json: {:pet => @pet, :petphoto => @pet.petphotos[0] } }\n end\n end",
"def index\n session_guest.hit_logger(\"photo\")\n @photos = Photo.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\r\n @photos = Photo.all\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @photos }\r\n end\r\n end",
"def index\n #@photos = Photo.all\n\n #respond_to do |format|\n # format.html # index.html.erb\n # format.json { render json: @photos }\n #end\n end",
"def show\n @men_fashion = MenFashion.find(params[:id])\n @photos = @men_fashion.photos\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @men_fashion }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n render json: @photo\n end",
"def photos options={}\n response = client.get(\"/#{id}/photos\", options)\n end",
"def index\n @users_photos = UsersPhoto.all\n respond_to do |format|\n\n format.html # index.html.erb\n format.json { render json: @users_photos }\n end\n end",
"def index\n por_pagina = params[:por_pagina] || 18\n @productos = Producto.paginate(page: params[:page], per_page: por_pagina).includes(:fotos)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @productos }\n end\n end",
"def index\n @images = Image.all\n\n render json: @images\n end",
"def show\n @photoalbum = Photoalbum.find(params[:id])\n \n # temporary solution to get exif information in photos which are on the server: TODO\n @exifphotos = @photoalbum.photos.where(exif_date: nil, photo_content_type: \"image/jpeg\")\n @exifphotos.each do |p|\n if File.exists?(p.photo.path)\n exif = EXIFR::JPEG.new(p.photo.path)\n p.exif_date = exif.date_time\n if not exif.date_time.nil?\n p.save\n end\n end\n end\n\n @allphotos = @photoalbum.photos.all(:order => 'exif_date DESC, photo_file_name DESC, created_at DESC')\n @photos = @photoalbum.photos.paginate(:page => params[:page], :order => 'exif_date DESC, photo_file_name DESC, created_at DESC', :per_page => 12)\n\t\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photoalbum }\n end\n end",
"def get_photos(arg)\n response_str = RestClient.get(\"#{arg}.json\")\n response_hash = JSON.parse(response_str)\n return response_hash\nend",
"def show\n @proyecto_imagen = ProyectoImagen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @proyecto_imagen }\n end\n end",
"def index\n @album = Album.find(params[:album_id])\n @photos = @album.photos.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @photos }\n end\n end",
"def index\n @photos = get_possible_photos\n paginate json: @photos, per_page: 10\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 @photos = Photo.find_with_reputation(:votes, :all, order: 'votes desc')\n @photos = Kaminari.paginate_array(@photos).page(params[:page]).per(4)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def index\n @team_photos = TeamPhoto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @team_photos }\n end\n end",
"def index\n render json: Picture.all\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 @foto_album = FotoAlbum.find(params[:id])\n @fotos = @foto_album.fotos\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @foto_album }\n end\n end",
"def show\n @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @odontologo }\n end\n end",
"def show\n @photo = @allbum.photos.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @ef_pares = EfPare.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ef_pares }\n end\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo.as_json(:methods => Photo::FIELDS) }\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 #@arquivos = Arquivo.all\n\n residencial = current_user.apartamento.residencial\n @arquivos = Arquivo\n .where(:residencial_id => residencial.id)\n .order(\"created_at\")\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @arquivos }\n end\n end",
"def show\n photo_obj = API.get_one(params[:id])\n if photo_obj['error'].nil?\n photo = PhotoPresenter.new(photo_obj['photo'])\n render :json => photo.as_json\n else\n render :json => photo_obj\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 @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 @pictures = @museum.pictures.all #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 index\n @images = Image.all\n\n respond_to do |format|\n format.html # index.html.slim\n format.json { render json: @images }\n end\n end",
"def index\n @product_images = ProductImage.where(product_uuid: params[:product_id])\n render json: @product_images, status: 200\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 render json: @fiestas\n end",
"def show\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @estatuto }\n end\n end",
"def show\n @photo = current_user.photos.find params[:id]\n respond_to do |format|\n format.html { redirect_to photos_path, alert: \"Sorry, can't view individual photos yet\" }\n format.json { render json: @photo }\n end\n end",
"def index\n @ores = Ore.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ores }\n end\n end",
"def show\n @photo = @album.photos.new\n @photos = @album.photos.order('created_at DESC').page(params[:page]).per(12)\n respond_to do |format|\n format.js\n format.html # show.html.erb\n format.json { render json: @album }\n end\n end",
"def index\n logement = Logement.find_by(id:params[:logement_id])\n equipement = logement.equi_securites[0].title\n equipements = logement.equi_securites[0]\n\n render json: {\n securites:equipement,\n fichier:equipements\n }\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def index\n @structure_photos = StructurePhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @structure_photos\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo }\n end\n end",
"def show\n @home_categories_products_indices_photo = Home::Categories::Products::Indices::Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @home_categories_products_indices_photo }\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 index\n @expedientes = Expediente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expedientes }\n end\n end",
"def show\n\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def show\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @photo }\n end\n end",
"def index\n # @images = Image.all\n # @images = Image.order(\"id\").page(params[:page])\n @images = Image.page(params[:page])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @images }\n end\n end",
"def show\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @peso }\n end\n end",
"def show\n @arquivo = Arquivo.find(params[:id])\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id, :comentavel_type => \"Arquivo\").order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @arquivo }\n end\n end",
"def show\n @users_photo = UsersPhoto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users_photo }\n end\n end",
"def index()\n @photos = all_photos()\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 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 @rock_photos = RockPhoto.paginate(page: params[:page], per_page: params[:size])\n .order(created_at: :desc).all\n render json: @rock_photos\n end",
"def index\n @artefact = Artefact.find(params[:artefact_id])\n\n @assets = @artefact.assets\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @assets }\n end\n end",
"def new\n @photoalbum = Photoalbum.new\n @agendaitems = Agendaitem.order(\"date DESC\").limit(\"50\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photoalbum }\n end\n end",
"def show\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @photo1 }\n end\n end",
"def index\n @photos = if params[:id].present?\n if params[:limit]\n Collection.find(params[:id]).photos.order(\"created_at DESC\").limit(4)\n else\n Collection.find(params[:id]).photos.order(\"created_at DESC\")\n end\n else\n Photo.ranked\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @photos }\n end\n end",
"def show\n @imagen_pedido = ImagenPedido.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @imagen_pedido }\n format.xml { render xml: @imagen_pedido }\n\n end\n end",
"def index\n @establecimientos = Establecimiento.all\n respond_to do |format|\n format.json { \n\n if (params[:appkey].eql? appkey) #si el appkey es correcto\n\n ests = @establecimientos.map { |establecimiento| { :nombre_establecimiento => establecimiento.nombre, :id => establecimiento.id, \n :descripcion => establecimiento.descripcion, :longitud => establecimiento.longitud,\n :latitud => establecimiento.latitud, :direccion => establecimiento.direccion, :imagen => establecimiento.foto.url(:small),\n :eventos => establecimiento.eventos.map { |evento| { :nombre => evento.nombre } } } } \n render json: ests\n else\n render json: {:error => \"No autorizado\"}\n end\n\n\n\n }\n format.html { redirect_to :controller=>'login', :action=>'login' } #solo el app movil puede revisar toda la lista de establecimientos.\n end\n end",
"def index\n @family_images = FamilyImage.all\n\n render json: @family_images\n end",
"def index\n @eicons = Eicon.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @eicons }\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",
"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.7256302",
"0.7246558",
"0.6848788",
"0.66275537",
"0.66275537",
"0.66275537",
"0.6611914",
"0.6610392",
"0.6604908",
"0.6599378",
"0.65280986",
"0.6503242",
"0.64934975",
"0.6472482",
"0.64681137",
"0.6461162",
"0.6455488",
"0.6449857",
"0.64384365",
"0.643168",
"0.6421537",
"0.6421413",
"0.6399346",
"0.63916445",
"0.63804305",
"0.63708204",
"0.6365702",
"0.6337707",
"0.63104105",
"0.62461287",
"0.62131554",
"0.6203114",
"0.6195659",
"0.61896247",
"0.618628",
"0.617347",
"0.61723995",
"0.6165061",
"0.61641335",
"0.6162142",
"0.6150437",
"0.6149033",
"0.61470157",
"0.6132276",
"0.6114643",
"0.61144584",
"0.6109933",
"0.6108506",
"0.6107254",
"0.60906225",
"0.6082694",
"0.6068595",
"0.60682225",
"0.6060256",
"0.60565376",
"0.605329",
"0.6052636",
"0.6052038",
"0.6044485",
"0.604007",
"0.60391754",
"0.6038272",
"0.6037937",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6037334",
"0.6032908",
"0.6017567",
"0.6010319",
"0.6008505",
"0.59913206",
"0.5988634",
"0.5981864",
"0.59741175",
"0.5971253",
"0.59669137",
"0.5959799",
"0.5957187",
"0.5957187",
"0.5955393",
"0.5953087",
"0.5947927",
"0.59461373",
"0.59461",
"0.59424",
"0.5937441",
"0.59328383",
"0.592927",
"0.5928417",
"0.5928417",
"0.5928417"
] |
0.0
|
-1
|
POST /fotos_empresas POST /fotos_empresas.json
|
def create
@fotos_empresa = FotosEmpresa.new(fotos_empresa_params)
respond_to do |format|
if @fotos_empresa.save
format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully created.' }
format.json { render :show, status: :created, location: @fotos_empresa }
else
format.html { render :new }
format.json { render json: @fotos_empresa.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def fotos_empresa_params\n params.require(:fotos_empresa).permit(:name, :image, :estado)\n end",
"def set_fotos_empresa\n @fotos_empresa = FotosEmpresa.find(params[:id])\n end",
"def index\n @fotos_empresas = FotosEmpresa.all\n end",
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def 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 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 create\n @proyecto_imagen = ProyectoImagen.new(params[:proyecto_imagen])\n\n if @proyecto_imagen.save\n respond_to do |format|\n format.html {\n render :json => [@proyecto_imagen.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json {\n render :json => [@proyecto_imagen.to_jq_upload].to_json\n }\n end\n else\n render :json => [{:error => \"custom_failure\"}], :status => 304\n end\n end",
"def create\n @objeto = Imagen.new(imagen_params)\n\n respond_to do |format|\n if @objeto.save\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully created.' }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \t#debugger \n @fotoproduto = Fotoproduto.new(fotoproduto_params)\n @fotoproduto.imagem = params[:file]\n\n if @fotoproduto.save\n render json: true\n else\n render json: @fotoproduto_file.errors \n end\n end",
"def create\n @foto = Foto.new(foto_params)\n\n respond_to do |format|\n if @foto.save\n format.html { redirect_to @foto, notice: 'Foto was successfully created.' }\n format.json { render :show, status: :created, location: @foto }\n else\n format.html { render :new }\n format.json { render json: @foto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @emprestimo = Emprestimo.new(emprestimo_params)\n\n respond_to do |format|\n if @emprestimo.save\n format.html { redirect_to @emprestimo, notice: 'Reserva/Empréstimo foi Adicionado.' }\n format.json { render :show, status: :created, location: @emprestimo }\n else\n format.html { render :new }\n format.json { render json: @emprestimo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n if @photo.save\n render json: @photo, status: :created\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def empresa_params\n params.require(:empresa).permit(:logo, :name, :tag_list ,:category_id, :description, :plan, :map_string, :address, :excerpt, :web, :email, :tel, :video, {fotos:[]}, :schedule0, :schedule1, :schedule2, :schedule3, :schedule4, :schedule5, :schedule6,\n :schedule7, :schedule8, :schedule9, :schedule10, :schedule11, :schedule12, :schedule13, :schedule14, :schedule15, :schedule16, :schedule17, :schedule18, :schedule19, :schedule20, :schedule21, :schedule22, :schedule23, :schedule24, :schedule25, :schedule26, :schedule27, :remove_logo)\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\n @estatuto = Estatuto.new(params[:estatuto])\n\n respond_to do |format|\n if @estatuto.save\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully created.' }\n format.json { render json: @estatuto, status: :created, location: @estatuto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @foto_produto = FotoProduto.new(foto_produto_params)\n\n respond_to do |format|\n if @foto_produto.save\n format.html { redirect_to @foto_produto, notice: 'Foto produto was successfully created.' }\n format.json { render :show, status: :created, location: @foto_produto }\n else\n format.html { render :new }\n format.json { render json: @foto_produto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empresas = Empresa.new(empresa_params)\n\n respond_to do |format|\n if @empresas.save\n format.html { redirect_to @empresas, notice: 'Empresa was successfully created.' }\n format.json { render :show, status: :created, location: @empresas }\n else\n format.html { render :new }\n format.json { render json: @empresas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n @photo.user = @current_user\n if @photo.save\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def create\n\n @pregoestitulosgrafico = Pregoestitulosgrafico.new(pregoestitulosgrafico_params)\n\n @arquivo = Arquivo.new\n\n path = File.join(Rails.root, \n \"public/pregoes/\", \n params[:pregoestitulosgrafico][:arquivo_id].original_filename)\n\n # escreve o arquivo no local designado\n File.open(path, \"wb\") do |f| \n f.write(params[:pregoestitulosgrafico][:arquivo_id].read)\n end\n\n @arquivo.caminho = \"public/pregoes/\" + params[:pregoestitulosgrafico][:arquivo_id].original_filename # imagem[\"public_id\"] #+ \".\" + imagem[\"format\"]\n @arquivo.nome = params[:pregoestitulosgrafico][:arquivo_id].original_filename # imagem[\"public_id\"] #+ \".\" + imagem[\"format\"]\n\n @arquivo.save\n\n @pregoestitulosgrafico.arquivo_id = @arquivo.id\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n\n respond_to do |format|\n if @pregoestitulosgrafico.save\n format.html { redirect_to pregoestitulo, notice: 'Arquivo incluído com sucesso.' }\n format.json { render :show, status: :created, location: @pregoestitulosgrafico }\n else\n format.html { render :new }\n format.json { render json: @pregoestitulosgrafico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n if params[:photo_files].blank?\n render json: [ 'ファイルを選択してください' ], status: :unprocessable_entity\n return\n end\n\n album = Album.find(params['album_id'])\n # TODO: Transactionかけるとかエラーハンドリングしたい\n params[:photo_files].each do |file|\n photo = Photo.new(image: file, title: '[無題]', album_id: album.id, user_id: current_user.id, exif_at: Photo::set_exif_at(file.path))\n photo.save\n end\n\n # memo Ajaxでのpostはsaveのエラーが画面には表示されないので、自分で出力してあげる\n # あと、pメソッドでログに出力されないため、loggerを使用する\n # logger.debug @photo.errors.full_messages.inspect\n # logger.debug @photo.errors.full_messages.to_sentence\n\n UpdateHistory.create_or_update(album, UpdateHistory::ALBUMPHOTO_CREATE, current_user.id)\n render json: {}, status: :created\n end",
"def create\n @evento = Evento.new(params[:evento])\n @evento.data_hora = Time.now\n @evento.foto = @evento.foto.read if !@evento.foto.nil?\n\n respond_to do |format|\n if @evento.save\n trocar_foto_por_url @evento\n format.html { redirect_to(@evento, :notice => 'Evento was successfully created.') }\n format.xml { render :xml => @evento, :status => :created, :location => @evento }\n format.json { render :json => @evento, :status => :created, :location => @evento }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @evento.errors, :status => :unprocessable_entity }\n format.json { render :json => @evento.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @foto = Foto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foto }\n end\n end",
"def create\n\n @post = current_user.posts.new(post_params)\n\n respond_to do |format|\n\n\n if params[:images] || !params[:post][:vk_album_id].empty? ||!params[:post][:flickr_album_id].empty?\n begin\n\n if @post.save\n\n if !params[:post][:vk_album_id].empty?\n # The magic is here ;)\n vk = VkontakteApi::Client.new(session[:token])\n\n @photos = vk.photos.get(owner_id: params[:post][:vk_owner_id], album_id: params[:post][:vk_album_id], version: \"5.73\")\n @photos.each { |image|\n\n @post.panoramas.create(image_file_name: image.src_xxxbig, image_file_name_thumb: image.src_xbig )\n }\n\n elsif !params[:post][:flickr_album_id].empty?\n\n FlickRaw.api_key = ''\n FlickRaw.shared_secret = ''\n\n @photosets = flickr.photosets.getPhotos(photoset_id: params[:post][:flickr_album_id]).photo.map do |photo|\n flickr.photos.getSizes(photo_id: photo.id).map do |size|\n size.source\n end\n end\n @photosets.each do |image|\n @post.panoramas.create(image_file_name: image.last, image_file_name_thumb: image[6] )\nend\n else\n\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n @post.panoramas.create(image: image)\n }\n end\n end\n\n format.html { redirect_to @post, notice: 'Пост создан' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n\n end #if post save\n\n\n rescue\n flash[:alert] = \"Проблема с VK или FLICKR (альбом не доступен)\"\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n\n\n\n else\n flash[:alert] = \"Нужны панорамы!!!\"\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n\n end\n\n end #respond do\n end",
"def create\n @etapa = Etapa.new(etapa_params)\n\n respond_to do |format|\n if @etapa.save\n format.html { redirect_to @etapa, notice: 'Etapa fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @etapa }\n else\n format.html { render :new }\n format.json { render json: @etapa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @exemplaresproduto = Exemplaresproduto.new(exemplaresproduto_params)\n\n respond_to do |format|\n if @exemplaresproduto.save\n format.html { redirect_to @exemplaresproduto, notice: 'Exemplaresproduto was successfully created.' }\n format.json { render :show, status: :created, location: @exemplaresproduto }\n else\n format.html { render :new }\n format.json { render json: @exemplaresproduto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @pet = current_user.pets.new(pet_params)\n\n params[:pet][:photos][:photo].each {|photo| @pet.photos.build(photo: photo)} if params[:pet][:photos].present?\n\n respond_to do |format|\n if @pet.save\n format.html { redirect_to @pet, notice: 'Pet was successfully created.' }\n format.json { render :show, status: :created, location: @pet }\n else\n format.html { render :new }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @imagen_pedido = ImagenPedido.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @imagen_pedido }\n end\n end",
"def create\n @foto = Foto.new(foto_params)\n \n respond_to do |format|\n if @foto.save\n case @foto.foto_categoria\n when \"entidad_territorial\" then\n @entidad_territorial = EntidadTerritorial.find(@foto.foto_llave_externa)\n format.html { redirect_to edit_entidad_territorial_path(@entidad_territorial), notice: 'Fotografia cargada exitosamente.' }\n #format.json { render action: 'show', status: :created, location: @foto }\n end\n else\n format.html { render action: 'new' }\n format.json { render json: @foto.errors, status: :unprocessable_entity }\n end \n end\n end",
"def create\n\n @event = Event.new(event_params)\n\n tag_array = event_params2['tags'].split(',')\n tag_array.each do |x|\n @tag = Tag.create(desc: x)\n @event.tags << @tag\n end\n EventTag.create(event_id: @event.id, tag_id: @tag.id)\n\n respond_to do |format|\n if @event.save\n params[:event]['images'].each do |a|\n @event_photo = @event.event_photos.create!(:image => a, :event_id => @event.id)\n end\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\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 destroy\n @fotos_empresa.destroy\n respond_to do |format|\n format.html { redirect_to fotos_empresas_url, notice: 'Fotos empresa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def create\n @perfil_egresado = PerfilEgresado.new(perfil_egresado_params)\n\n respond_to do |format|\n if @perfil_egresado.save\n format.html { redirect_to @perfil_egresado, notice: 'Perfil egresado was successfully created.' }\n format.json { render :show, status: :created, location: @perfil_egresado }\n else\n format.html { render :new }\n format.json { render json: @perfil_egresado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @empresas = Empresa.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @empresas }\n end\n end",
"def foto_params\n params.require(:foto).permit(:legenda, :produto_id, :foto)\n end",
"def create \n examenes = params[:examenes]\n byebug \n\n if !params[:perfil][:nombre].nil? || !params[:perfil][:nombre].blank?\n @perfil = Perfil.new(perfil_params) \n @perfil.save\n \n respond_to do |format|\n if @perfil.save\n \n examenes.each do |examen|\n @perfil_examenes = PerfilExamene.new\n @perfil_examenes.perfil_id = @perfil.id\n @perfil_examenes.tipo_examen_id = examen\n @perfil_examenes.save\n end \n \n byebug\n\n format.html { redirect_to perfils_path, notice: 'El Perfil fue creado exitosamente' }\n format.json { render json: { :examenes => examen } }\n else\n \n format.html { render :new }\n format.json { render json: { :examenes => examen } }\n end\n end\n else\n \n respond_to do |format| \n format.html { redirect_to perfils_path, notice: 'El Perfil no fue creado correctamente vuelva a intentarlo' }\n format.json { render json: { :examenes => examen } } \n end\n end \n\n end",
"def create\n @foto_galeri = FotoGaleri.new(params[:foto_galeri])\n\n respond_to do |format|\n if @foto_galeri.save\n format.html { redirect_to @foto_galeri, notice: 'Foto galeri was successfully created.' }\n format.json { render json: @foto_galeri, status: :created, location: @foto_galeri }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foto_galeri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eventphoto = EventPhoto.new(eventphoto_params)\n event = Event.find_by_id(params[:event_id])\n respond_to do |format|\n if @eventphoto.save\n event.event_photos << @eventphoto\n format.html { redirect_to event_path(event), notice: 'Event Photo was successfully created.' }\n format.json { render action: 'show', status: :created, location: @eventphoto }\n else\n format.html { render action: 'new' }\n format.json { render json: @eventphoto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empresas.update(empresa_params)\n #File.extname(params[:logo].path)\n format.html { redirect_to @empresas, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresas }\n else\n format.html { render :edit }\n format.json { render json: @empresas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload\n @mote = mote.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mote }\n end\n end",
"def upload_image\n @image = Image.create(image_path: params[:upload][:image])\n p @image\n render json: @image\n end",
"def update\n respond_to do |format|\n if @fotos_empresa.update(fotos_empresa_params)\n format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @fotos_empresa }\n else\n format.html { render :edit }\n format.json { render json: @fotos_empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def etiquetas_por_aluno\n logger.info(params)\n @etiquetas_aluno = Etiqueta.all.where(aluno_id: params[:aluno_id])\n respond_with @etiquetas_aluno\n end",
"def create\n @guardario = Guardario.new(guardario_params)\n @guardario.user_id = current_user.id\n\n respond_to do |format|\n if @guardario.save\n if params[:images]\n params[:images].each { |image|\n GuardarioImage.create(image: image, guardario_id: @guardario.id)\n }\n end\n format.html { redirect_to @guardario, notice: 'O seu avistamento foi reportado com sucesso.' }\n format.json { render :show, status: :created, location: @guardario }\n else\n format.html { render :new }\n format.json { render json: @guardario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def foto_params\n params.require(:foto).permit(:descripcion, :src, :id, :es_portada)\n end",
"def new\n @foto_galeri = FotoGaleri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @foto_galeri }\n end\n end",
"def create\n @photo = Photo.new(photo_params)\n\n respond_to do |format|\n if @photo.save\n save_to_json \n format.html { redirect_to @photo, notice: 'Photo was successfully created.' }\n format.json { render :show, status: :created, location: @photo }\n else\n format.html { render :new }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @producto_imagen = ProductoImagen.new(producto_imagen_params)\n\n respond_to do |format|\n if @producto_imagen.save\n format.html { redirect_to @producto_imagen, notice: 'Producto imagen was successfully created.' }\n format.json { render :show, status: :created, location: @producto_imagen }\n else\n format.html { render :new }\n format.json { render json: @producto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n params.permit!\n @employeer_photo = EmployeerPhoto.new(params[:employeer_photo])\n\n respond_to do |format|\n if @employeer_photo.save\n format.html { redirect_to(@employeer_photo, :notice => 'Employeer photo was successfully created.') }\n format.xml { render :xml => @employeer_photo, :status => :created, :location => @employeer_photo }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @employeer_photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n # associate aparment with user\n @apartment = current_user.apartments.new(apartment_params)\n # generate verification code\n @apartment.code = Apartment.generate_code\n # set apartment user_id field to current_user\n @apartment.user_id = current_user.id if current_user\n\n respond_to do |format|\n if @apartment.save\n # upload and save multiple images, if they are there\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @apartment.photos.create!(:image => a, :apartment_id => @apartment.id)\n end\n end\n format.html { redirect_to @apartment, notice: 'Apartment was successfully created.' }\n format.json { render :show, status: :created, location: @apartment }\n else\n format.html { render :new, notice: 'Something went wrong. Please try again!' }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empresa = Empresa.find(params[:empresa_id])\n\n @tipo_de_imposto = TipoDeImposto.new(tipo_de_imposto_params)\n @tipo_de_imposto.empresa_id = @empresa.id\n\n respond_to do |format|\n if @tipo_de_imposto.save\n format.html { redirect_to @empresa, notice: 'Tipo de imposto adicionado com sucesso.' }\n format.json { render :show, status: :created, location: @tipo_de_imposto }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_imposto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @photo = Photo.new(params[:photo])\n\n respond_to do |format|\n if @photo.save\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.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\n @efectivo = Efectivo.new(efectivo_params)\n\n respond_to do |format|\n if @efectivo.save\n format.html { redirect_to @efectivo, notice: 'Efectivo was successfully created.' }\n format.json { render :show, status: :created, location: @efectivo }\n else\n format.html { render :new }\n format.json { render json: @efectivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empresario = Empresario.new(empresario_params)\n @empresario.creador = current_user.id\n @empresario.modificador = current_user.id\n\n respond_to do |format|\n if @empresario.save\n format.html { redirect_to @empresario, notice: 'Empresario was successfully created.' }\n format.json { render :show, status: :created, location: @empresario }\n else\n format.html { render :new }\n format.json { render json: @empresario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventario = Inventario.new(params[:inventario])\n @foto = Foto.new(:uploaded_data => params[:foto_file])\n puts \"vvvvvvvvvvvvvvv\"\n p params[:foto_file]\n p @foto\n puts \"xxxxxxxxxxxxxxxxx\"\n @service = InventarioService.new(@inventario, @foto)\n\n respond_to do |format|\n\tif @service.save\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully created.') }\n format.xml { render :xml => @inventario, :status => :created, :location => @inventario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create_photos\n end",
"def create\n @faltante = Faltante.new(faltante_params)\n @employees = Employee.all\n @faltantes = Tipofaltante.all\n \n respond_to do |format|\n if @faltante.save\n format.html { redirect_to @faltante, notice: 'Faltante was successfully created.' }\n format.json { render :show, status: :created, location: @faltante }\n else\n format.html { render :new }\n format.json { render json: @faltante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ejemplo = Ejemplo.new(ejemplo_params)\n\n respond_to do |format|\n if @ejemplo.save\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully created.' }\n format.json { render :show, status: :created, location: @ejemplo }\n else\n format.html { render :new }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n ev_params = event_params.clone\n ev_params[:time_at] = Time.parse(ev_params[:time_at])\n ev_params[:user_id] = current_user.id\n ev_params[:latitude] = ev_params[:latitude].to_f\n ev_params[:longitude] = ev_params[:longitude].to_f\n @event = Event.new(ev_params, params[:event][:photo])\n\n respond_to do |format|\n # tempfile = params[:event][:photo]\n \n if @event.save\n\n # file = File.open('./public/IMG_3503.JPG')\n\n format.html { redirect_to @event, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @event }\n\n else\n format.html { render :new }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n p_attr = params[:photo]\n p_attr.permit!\n @photo = Photo.new(p_attr)\n\n respond_to do |format|\n if @photo.save\n #save new link between photo and post\n if (params[:post_id].length)\n\n countInPost = PostPhoto.where(post_id: params[:post_id]).count\n @photo.sort = (countInPost+1)*100\n @photo.save\n\n #check post\n post = Post.find(params[:post_id])\n if (!post.present?)\n raise 'Post is not found'\n end\n\n if (post.main_photo.to_i < 1)\n post.main_photo = @photo.id\n post.save\n end\n\n post_photo = PostPhoto.find_or_initialize_by(post_id: params[:post_id], photo_id: @photo.id)\n post_photo.save\n\n end\n\n format.html {\n render :json => [@photo.to_jq_upload].to_json,\n :content_type => 'text/html',\n :layout => false\n }\n format.json { render json: {files: [@photo.to_jq_upload]}, status: :created, location: @photo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @asociado = Asociado.new(params[:asociado])\n\n uploaded_file = params[:asociado][:logo]\n\n\n\n photo = Parse::File.new({\n :body => File.read(uploaded_file.tempfile) ,\n :local_filename => uploaded_file.original_filename,\n :content_type => uploaded_file.content_type\n })\n\n photo.save\n\n model = Parse::Object.new(\"Asociado\").tap do |p|\n p[\"descripcion\"] = @asociado.descripcion\n p[\"logo\"] = photo\n\n p[\"categoria\"] = @asociado.categoria\n p[\"direccion\"] = @asociado.direccion\n p[\"email\"] = @asociado.email\n p[\"facebook\"] = @asociado.facebook\n p[\"nombre\"] = @asociado.nombre\n p[\"pinterest\"] = @asociado.pinterest\n p[\"telefono\"] = @asociado.telefono\n p[\"twitter\"] = @asociado.twitter\n p[\"web\"] = @asociado.web\n\n end\n\n\n model.save\n\n\n redirect_to @asociado\n\n end",
"def create\n \n\n @foto = Foto.new(params[:foto])\n uploaded_file = params[:foto][:foto]\n \n\n\n photo = Parse::File.new({\n :body => File.read(uploaded_file.tempfile) ,\n :local_filename => uploaded_file.original_filename,\n :content_type => uploaded_file.content_type\n })\n \n photo.save\n foto = Parse::Object.new(\"Foto\").tap do |p|\n p[\"foto\"] = photo\n p[\"descripcion\"] = params[:foto][:descripcion]\n p[\"categoryId\"] = params[:foto][:categoryId]\n end\n \n\n foto.save\n \n\n redirect_to @foto\n end",
"def create\n @emprego = Emprego.new(emprego_params)\n\n respond_to do |format|\n if @emprego.save\n format.html { redirect_to @emprego, notice: 'Emprego was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emprego }\n else\n format.html { render action: 'new' }\n format.json { render json: @emprego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to empleados_path, notice: 'Registro de Empleado creado.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_presupuesto_foto\n @presupuesto_foto =Presupuesto::Foto.all.find(params[:id]) \n #Le he agregao all porque sino arroja error de procedimiento almacenado\n end",
"def create\n if(@check)\n @evento = Evento.create(event_params.except(:token))\n @evento.participants=0\n @evento.reports=0\n @evento.id_creator=params[:id_creator].to_i\n @company=User.find_by_id(params[:id_creator].to_i)\n @evento.author=@company.name\n datafi = Date.parse(@evento.end_date)\n dataini = Date.parse(@evento.start_date)\n if datafi < dataini\n @message=\"ERROR: La data d'inici no pot ser posterior a la data de fi\"\n render json: @message\n elsif @evento.save\n if params[:event_image_data]\n params[:event_image_data].each do |file|\n @evento.event_images.create!(:image => file)\n end\n end\n render json: @evento, status: :created, location: @evento\n else\n render json: @evento.errors, status: :unprocessable_entity\n end\n end\n end",
"def create\n @funcionario = Funcionario.new(params[:funcionario])\n file = params[:foto]\n if file\n file.configure(FileClassification::IMAGES::config)\n if file.is_valid?\n if @funcionario.save\n file.file_name = \"#{@funcionario.id.to_s}_#{file.original_filename}\"\n params[:funcionario]['foto'] = file.file_name\n if file.save\n @funcionario.update_attribute(:foto, file.file_name)\n respond_to {|format| format.html { render :json => {:success => true} } }\n else\n @funcionario.destroy\n respond_to {|format| format.html { render :json => {:success => false, :errors => file.errors.join('<br />')} } }\n end\n end\n else\n respond_to {|format| format.html { render :json => {:success => false, :errors => file.errors.join('<br />')} } }\n end\n else\n respond_to do |format|\n if @funcionario.save\n format.html { render :json => {:success => true} }\n format.xml { render :xml => @funcionario, :status => :created, :location => @funcionario }\n else\n format.html { render :json => ( (@funcionario.errors.full_messages.join(\".<br />\").to_s + \".\").to_json ) } unless @funcionario.errors.empty?\n end\n end\n end\n end",
"def create\n @arquivo = Arquivo.new(params[:arquivo])\n @arquivo.save!\n\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { render json: @arquivo.errors, status: :unprocessable_entity }\n end\n end",
"def empresa_params\n params.require(:empresa).permit(:municipio, :picture, :activo, :modificador, :creador, :descripcion, :nombre, :nit, :nroEmpleados, :direccion, :facebook, :twitter, :instagram, :web)\n end",
"def create\r\n @photo = Photo.new(params[:photo]) \r\n\r\n respond_to do |format|\r\n if @photo.save\r\n format.html { redirect_to @photo, notice: 'Fotka úspěšně vytvořena.' }\r\n format.json { render json: @photo, status: :created, location: @photo }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @photoalbum = Photoalbum.new\n @agendaitems = Agendaitem.order(\"date DESC\").limit(\"50\")\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @photoalbum }\n end\n end",
"def create\n @photograph = Photograph.new(photograph_params)\n\n @photograph.temp_url = params[\"photograph\"][\"image\"].tempfile.path\n @photograph.gallery_id = current_user.gallery.id\n @photograph.profile_picture = false\n\n respond_to do |format|\n if @photograph.save\n format.html { redirect_to mygallery_path, notice: 'Photograph was successfully created.' }\n format.json { render :show, status: :created, location: @photograph }\n else\n format.html { render :new }\n format.json { render json: @photograph.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n @prepagada = Prepagada.new({ :prepagada => params[:prepagada], :odontologo_id => params[:odontologo_id] })\n\n respond_to do |format|\n if @prepagada.save\n format.html { redirect_to @prepagada, notice: 'Prepagada was successfully created.' }\n format.json { render json: @prepagada, status: :created, location: @prepagada }\n else\n format.html { render action: \"new\" }\n format.json { render json: @prepagada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @apartment.photos.create!(:image => a, :apartment_id => @apartment.id)\n end\n end\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @respuesta = Respuesta.new(params[:respuesta])\n\n if @respuesta.save\n render json: @respuesta, status: :created, location: @respuesta\n else\n render json: @respuesta.errors, status: :unprocessable_entity\n end\n end",
"def new\n @photo = Photo.new\n\n render json: @photo\n end",
"def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Empleado was successfully created.' }\n format.json { render action: 'show', status: :created, location: @empleado }\n else\n format.html { render action: 'new' }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Empleado fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empregador = Empregador.new(empregador_params)\n\n respond_to do |format|\n if @empregador.save\n format.html { redirect_to empregadors_path, notice: 'O Empregador foi criado com sucesso!.' }\n format.json { render :show, status: :created, location: @empregador }\n else\n format.html { render :new }\n format.json { render json: @empregador.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @oferta_academica = OfertaAcademica.new(params[:oferta_academica])\n\n if @oferta_academica.save\n render json: @oferta_academica, status: :created, location: @oferta_academica\n else\n render json: @oferta_academica.errors, status: :unprocessable_entity\n end\n end",
"def create\n @imagen_articulo = ImagenArticulo.new(imagen_articulo_params)\n \n respond_to do |format|\n if @imagen_articulo.save\n if params[:articulo_id]\n @articulo = Articulo.find(params[:articulo_id])\n @articulo.imagen_articulo = @imagen_articulo\n authorize! :editar, @articulo\n @articulo.save\n format.html { redirect_to @articulo, notice: 'La imagen fue asignada correctamente al artículo' }\n format.json { render :show, status: :created, location: @imagen_articulo }\n end\n else\n format.html { render :new }\n format.json { render json: @imagen_articulo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empresa = Empresa.new(empresa_params)\n\n respond_to do |format|\n if @empresa.save\n format.html { redirect_to @empresa, notice: 'Empresa creada exitosamente.' }\n format.json { render :show, status: :created, location: @empresa }\n else\n format.html { render :new }\n format.json { render json: @empresa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @proyecto_imagen = ProyectoImagen.new(proyectos_imagen_params)\n\n respond_to do |format|\n if @proyecto_imagen.save\n format.html { redirect_to @proyecto_imagen, notice: 'Proyecto imagen was successfully created.' }\n format.json { render :show, status: :created, location: @proyecto_imagen }\n else\n format.html { render :new }\n format.json { render json: @proyecto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empleado_especialidad = EmpleadoEspecialidad.new(empleado_especialidad_params)\n\n respond_to do |format|\n if @empleado_especialidad.save\n format.html { redirect_to @empleado_especialidad, notice: 'Empleado especialidad was successfully created.' }\n format.json { render :show, status: :created, location: @empleado_especialidad }\n else\n format.html { render :new }\n format.json { render json: @empleado_especialidad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @empleado = Empleado.new(empleado_params)\n\n respond_to do |format|\n if @empleado.save\n format.html { redirect_to @empleado, notice: 'Se ha creado un nuevo empleado.' }\n format.json { render :show, status: :created, location: @empleado }\n else\n format.html { render :new }\n format.json { render json: @empleado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = current_user.posts.new(post_params)\n\n respond_to do |format|\n if @post.save\n params[:post_attachments]['avatar'].each do |a|\n @post_attachment = @post.post_attachments.create(:avatar => a, :post_id => @post.id)\n end\n format.html { redirect_to @post, notice: 'Post was successfully created.' }\n format.json { render :show, status: :created, location: @post }\n else\n format.html { render :new }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end",
"def empresario_params\n params.require(:empresario).permit(:municipio, :activo, :modificador, :creador, :descripcion, :nombre, :apellido, :cedula, :sexo, :empresa, :telefono, :celular, :email, :whatsapp, :instagram, :twitter, :facebook, :puntov, :cNombre, :cCel1, :cCel2, :cTel, :cWhatsapp, :cEmail, :picture)\n end",
"def foto_params\n params.require(:foto).permit(:usuario_id,:DESCRIPCION, :FECHA, :TITULO, :imagen)\n end",
"def empresa_params\n params.require(:empresa).permit(:name, :ruc, :direccion, :telefono, :moneda, :igv, :about_1, :about_2, :logo)\n end",
"def create\n @article_photo = ArticlePhoto.new(article_photo_params)\n\n respond_to do |format|\n if @article_photo.save\n format.html { redirect_to @article_photo, notice: 'Article photo was successfully created.' }\n format.json { render :show, status: :created, location: @article_photo }\n else\n format.html { render :new }\n format.json { render json: @article_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos.count > 0\n @imagen_pedidos = @pedidos[0].imagen_pedidos\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @imagen_pedidos }\n end\n else\n redirect_to pedidos_path, notice: 'No tiene pedidos pendientes'\n end\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:images]\n # The magic is here ;)\n params[:images].each { |image|\n if (image!=nil)\n @apartment.pictures.create(image: image)\n \n end\n }\n end\n format.html { redirect_to @apartment, notice: 'La propiedad se actualizo correctamente.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imagem = Imagem.new(params[:imagem])\n\n respond_to do |format|\n if @imagem.save\n format.html { redirect_to new_imagem_path(:id => @imagem.imovel.id), notice: 'Imagem criada com sucesso.'}\n format.json { render json: @imagem, status: :created, location: @imagem }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imagem.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @hotel_photo = HotelPhoto.new(hotel_photo_params)\n @hotel = @hotel_photo.hotel\n respond_to do |format|\n if @hotel_photo.save\n format.html { redirect_to @hotel, notice: 'Hotel photo was successfully created.' }\n format.json { render :show, status: :created, location: @hotel_photo }\n else\n format.html { render :new }\n format.json { render json: @hotel_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n # Esto es para mostrar primero las fotos de NaturaLista, despues las de CONABIO\n fotos_naturalista = @especie.photos.where.not(type: 'ConabioPhoto').where(\"medium_url is not null or large_url is not null or original_url is not null\")\n fotos_conabio = @especie.photos.where(type: 'ConabioPhoto').where(\"medium_url is not null or large_url is not null or original_url is not null\")\n @photos = [fotos_naturalista, fotos_conabio].flatten.compact\n\n respond_to do |format|\n format.html do\n @especie.delayed_job_service\n\n # Para saber si es espcie y tiene un ID asociado a NaturaLista\n if @especie.species_or_lower?\n if proveedor = @especie.proveedor\n @con_naturalista = proveedor.naturalista_id if proveedor.naturalista_id.present?\n end\n end\n end\n format.json do\n @especie[:fotos] = @especie.photos\n render json: @especie.to_json\n end\n format.kml do\n redirect_to(especie_path(@especie), :notice => t(:el_taxon_no_tiene_kml)) unless proveedor = @especie.proveedor\n\n if params[:snib].present? && to_boolean(params[:snib])\n redirect_to(especie_path(@especie), :notice => t(:el_taxon_no_tiene_kml)) unless proveedor.snib_kml\n send_data @especie.proveedor.snib_kml, :filename => \"#{@especie.nombre_cientifico}.kml\"\n elsif params[:naturalista].present? && to_boolean(params[:naturalista])\n redirect_to(especie_path(@especie), :notice => t(:el_taxon_no_tiene_kml)) unless proveedor.naturalista_kml\n send_data @especie.proveedor.naturalista_kml, :filename => \"#{@especie.nombre_cientifico}.kml\"\n else\n redirect_to especie_path(@especie), :notice => t(:el_taxon_no_tiene_kml)\n end\n end\n\n format.pdf do\n # wicked_pdf no admite request en ajax, lo llamamos directo antes del view\n @describers = if CONFIG.taxon_describers\n CONFIG.taxon_describers.map{|d| TaxonDescribers.get_describer(d)}.compact\n elsif @especie.iconic_taxon_name == \"Amphibia\" && @especie.species_or_lower?\n [TaxonDescribers::Wikipedia, TaxonDescribers::AmphibiaWeb, TaxonDescribers::Eol]\n else\n [TaxonDescribers::Wikipedia, TaxonDescribers::Eol]\n end\n\n\n @describers.each do |d|\n @describer = d\n @description = begin\n d.equal?(TaxonDescribers::EolEs) ? d.describe(@especie, :language => 'es') : d.describe(@especie)\n rescue OpenURI::HTTPError, Timeout::Error => e\n nil\n end\n break unless @description.blank?\n end\n\n ruta = Rails.root.join('public', 'pdfs').to_s\n fecha = Time.now.strftime(\"%Y%m%d%H%M%S\")\n pdf = \"#{ruta}/#{fecha}_#{rand(1000)}.pdf\"\n FileUtils.mkpath(ruta, :mode => 0755) unless File.exists?(ruta)\n\n render :pdf => @especie.nombre_cientifico.parameterize,\n #:save_to_file => pdf,\n #:save_only => true,\n :wkhtmltopdf => CONFIG.wkhtmltopdf_path,\n :template => 'especies/show.pdf.erb'\n #:encoding => 'UTF-8',\n #:user_style_sheet => 'http://colibri.conabio.gob.mx:4000/assets/application.css'\n #:print_media_type => false,\n #:disable_internal_links => false,\n #\n\n\n end\n end\n end",
"def create\n @emmision = Emmision.new(emmision_params)\n\n respond_to do |format|\n if @emmision.save\n format.html { redirect_to @emmision, notice: \"Emmision was successfully created.\" }\n format.json { render :show, status: :created, location: @emmision }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @emmision.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n # @photos = Photo.all\n data = Photo.all\n render status: :ok, json: data\n end",
"def create\n @pedidos = Pedido.find(:all,:conditions=> {:status => [0], :user_id => current_user.id})\n if @pedidos[0].imagen_pedidos.count < 3\n @imagen_pedido = ImagenPedido.new(params[:imagen_pedido])\n @imagen_pedido.pedido_id = @pedidos[0].id\n respond_to do |format|\n if @imagen_pedido.save\n format.html { redirect_to imagen_pedidos_path, notice: 'La imagen fue subida satisfactoriamente.' }\n format.json { render json: @imagen_pedido, status: :created, location: @imagen_pedido }\n else\n format.html { render action: \"new\" }\n format.json { render json: @imagen_pedido.errors, status: :unprocessable_entity }\n end\n end\n else\n #moviendo el estado a 1: Listo para verificacion\n @pedidos[0].status = 1\n @pedidos[0].save\n redirect_to pedidos_path, notice: 'El pedido ha sido enviado\nsatisfactoriamente.'\n end\n end",
"def index\n @photos = Photo.all\n\n render json: @photos\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 @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"
] |
[
"0.6770414",
"0.6445009",
"0.62958515",
"0.59873664",
"0.59584296",
"0.5910884",
"0.5883888",
"0.5875258",
"0.58667576",
"0.58359736",
"0.5790208",
"0.5782646",
"0.57696867",
"0.5754405",
"0.57535523",
"0.57173353",
"0.56878203",
"0.5678379",
"0.5666089",
"0.5660587",
"0.5656835",
"0.5648031",
"0.5647349",
"0.5636865",
"0.56302255",
"0.5629629",
"0.56159073",
"0.55935353",
"0.55832475",
"0.55773336",
"0.5567745",
"0.5552915",
"0.5541646",
"0.5541154",
"0.5531926",
"0.5528853",
"0.5527356",
"0.55272573",
"0.55266225",
"0.55199707",
"0.55193865",
"0.5515355",
"0.5507092",
"0.55051434",
"0.5494686",
"0.5494064",
"0.54759234",
"0.54756695",
"0.54742235",
"0.54651624",
"0.54596984",
"0.54581964",
"0.5457951",
"0.54482347",
"0.5448201",
"0.5447905",
"0.5441584",
"0.5441442",
"0.5436006",
"0.5432489",
"0.5428939",
"0.54259634",
"0.5425535",
"0.5421506",
"0.5417752",
"0.5411441",
"0.54048",
"0.54035336",
"0.53992665",
"0.53959453",
"0.53853494",
"0.5385244",
"0.5384924",
"0.53846717",
"0.53825814",
"0.5382198",
"0.5381833",
"0.53636664",
"0.5361854",
"0.53618413",
"0.53617287",
"0.5349631",
"0.5347931",
"0.5347319",
"0.53460556",
"0.53447175",
"0.5335204",
"0.5327642",
"0.53274065",
"0.53273326",
"0.53267324",
"0.5324229",
"0.5319132",
"0.5318484",
"0.53162634",
"0.5314442",
"0.5308022",
"0.5306995",
"0.53062946",
"0.5300522"
] |
0.70054215
|
0
|
PATCH/PUT /fotos_empresas/1 PATCH/PUT /fotos_empresas/1.json
|
def update
respond_to do |format|
if @fotos_empresa.update(fotos_empresa_params)
format.html { redirect_to @fotos_empresa, notice: 'Fotos empresa was successfully updated.' }
format.json { render :show, status: :ok, location: @fotos_empresa }
else
format.html { render :edit }
format.json { render json: @fotos_empresa.errors, status: :unprocessable_entity }
end
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def update\n respond_to do |format|\n if @empresas.update(empresa_params)\n #File.extname(params[:logo].path)\n format.html { redirect_to @empresas, notice: 'Empresa was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresas }\n else\n format.html { render :edit }\n format.json { render json: @empresas.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = current_user.photos.find_by_id(params[:id])\n if @photo.nil?\n render json: {error: 'foto no encontrada'}, status: :not_found\n elsif @photo.update(photo_params)\n render json: @photo\n else\n render json: @photo.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @foto.update(foto_params)\n format.html { redirect_to @foto, notice: 'Foto actualizada exitosamente.' }\n format.json { head :no_content }\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 @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 @foto.update(foto_params)\n format.html { redirect_to @foto, notice: 'Foto was successfully updated.' }\n format.json { render :show, status: :ok, location: @foto }\n else\n format.html { render :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 @foto.update(foto_params)\n format.html { redirect_to @foto, notice: 'Foto was successfully updated.' }\n format.json { render :show, status: :ok, location: @foto }\n else\n format.html { render :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 @objeto.update(imagen_params)\n set_redireccion\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully updated.' }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @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 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 set_fotos_empresa\n @fotos_empresa = FotosEmpresa.find(params[:id])\n end",
"def update\n @inventario = Inventario.find(params[:id])\n @foto = @inventario.foto\n \n @service = InventarioService.new(@inventario, @foto)\n respond_to do |format|\n\n if @inventario.update_attributes(params[:inventario],params[:foto_file])\n format.html { redirect_to(@inventario, :notice => 'Inventario was successfully updated.') }\n format.xml { head :ok }\n else\n\t @foto = @service.foto\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @inventario.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foto.update(foto_params)\n format.html { redirect_to @foto, notice: 'Zdjęcie zmienione !' }\n format.json { render :show, status: :ok, location: @foto }\n else\n format.html { render :edit }\n format.json { render json: @foto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update\n respond_to do |format|\n if @eventphoto.update(eventphoto_params)\n format.html { redirect_to @eventphoto, notice: 'Event Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @eventphoto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @imagen_pedido = ImagenPedido.find(params[:id])\n\n respond_to do |format|\n if @imagen_pedido.update_attributes(params[:imagen_pedido])\n format.html { redirect_to @imagen_pedido, notice: 'Imagen pedido was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @imagen_pedido.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @producto_imagen.update(producto_imagen_params)\n format.html { redirect_to @producto_imagen, notice: 'Producto imagen was successfully updated.' }\n format.json { render :show, status: :ok, location: @producto_imagen }\n else\n format.html { render :edit }\n format.json { render json: @producto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Fotka byla úspěšně upravena.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n\n @proyecto = Proyecto.find(params[:gallery_id])\n\n @proyecto_imagen = @proyecto.proyecto_imagenes.find(params[:id])\n\n respond_to do |format|\n if @proyecto_imagen.update_attributes(proyecto_imagen_params)\n format.html { redirect_to gallery_path(@proyecto), notice: 'ProyectoImagen was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proyecto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:product][:photos_attributes][:'0'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'0'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'0'][:image])\n end\n if params[:product][:photos_attributes][:'1'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'1'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'1'][:image])\n end\n if params[:product][:photos_attributes][:'2'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'2'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'2'][:image])\n end\n if params[:product][:photos_attributes][:'3'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'3'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'3'][:image])\n end\n if params[:product][:photos_attributes][:'4'] != nil\n @photo = Photo.find(params[:product][:photos_attributes][:'4'][:id])\n @photo.update(image: params[:product][:photos_attributes][:'4'][:image])\n end\n\n respond_to do |format|\n if @product.update(product_update_params)\n\tformat.html { redirect_to products_url, notice: '产品已审核成功' }\n\tformat.json { render :show, status: :ok, location: @product }\n else\n\tformat.html { render :edit }\n\tformat.json { render json: @product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @adoption = Adoption.find(params[:id])\n @races = Race.all\n respond_to do |format|\n if params[:images_attributes]\n if params[:images_attributes]['image'].length <= 10\n if @pet.update(pet_params)\n if params[:images_attributes]\n params[:images_attributes]['image'].each do |a|\n @image_attachment = @pet.images.create!(:picture => a, :name => @pet.name)\n end\n \n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n end\n \n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n else\n flash.now[:danger] = \"El Producto debe tener un máximo de 10 imágenes\"\n # @user = Role.all\n render 'edit'\n end\n else\n if @pet.update(pet_params)\n flash[:success] = \"Producto Actualizado exitosamente\"\n format.html { redirect_to admin_pets_path}\n format.json { render :show, status: :ok, location: @pet }\n else\n flash[:warnig] = \"Producto no Actualizado\"\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end\n end",
"def actualizacion \n fiesta.update (params[:id]) \n render json: fiesta\n end",
"def update\n respond_to do |format|\n if @apartment.update(apartment_params)\n if params[:photos]\n params[:photos]['image'].each do |a|\n @photo = @apartment.photos.create!(:image => a, :apartment_id => @apartment.id)\n end\n end\n format.html { redirect_to @apartment, notice: 'Apartment was successfully updated.' }\n format.json { render :show, status: :ok, location: @apartment }\n else\n format.html { render :edit }\n format.json { render json: @apartment.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo_attivitum.update(photo_attivitum_params)\n format.html { redirect_to @photo_attivitum, notice: 'Il file è stato modificato con successo.' }\n format.json { render :show, status: :ok, location: @photo_attivitum }\n else\n format.html { render :edit }\n format.json { render json: @photo_attivitum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @albums = get_current_albums\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to photos_url, notice: 'Фотография была успешно обновлена.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if request.xhr?\n @product = Product.find(params[:product][:id])\n\n @product.photos.each do |photo|\n photo.update_attribute(:main, false)\n end\n\n if params[:photo][:id].empty?\n return\n else\n @photo = Photo.find(params[:photo][:id])\n end\n\n else\n @photo = Photo.find(params[:id])\n end\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n flash[:notice] = 'Plik został zapisany poprawnie.' unless request.xhr?\n format.html { redirect_to([:admin, @photo]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @photo.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 @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foto_galeri = FotoGaleri.find(params[:id])\n\n respond_to do |format|\n if @foto_galeri.update_attributes(params[:foto_galeri])\n format.html { redirect_to @foto_galeri, notice: 'Foto galeri was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foto_galeri.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action=> \"edit\" }\n format.json { render :json => @photo.errors, :status=> :unprocessable_entity }\n end\n end\n end",
"def update\n if current_user.nil?\n redirect_to(log_in_path) and return\n end\n\n @persona_vinculada = PersonaVinculada.find(params[:id])\n \n# img_orig = Magick::Image.read(params[:persona_vinculada][:foto]).first\n# archivo = img_orig.resize_to_fit(x,75) \n \n# image_orig.change_geometry!(\"640x480\") { |cols, rows, img|\n# newimg = img.resize(cols, rows)\n# newimg.write(\"newfilename.jpg\")\n# }\n \n# if !params[:persona_vinculada][:foto].nil?\n# archivo = params[:persona_vinculada][:foto]\n# name = params[:persona_vinculada][:tipo_documento].to_s.rjust(3, \"0\") + params[:persona_vinculada][:numero_documento].rjust(10, \"0\") + archivo.original_filename[-4, 4]\n# directory = \"app/assets/images\"\n# path = File.join(directory, name) \n#\n# params[:persona_vinculada][:foto] = name\n# end\n\n respond_to do |format|\n if @persona_vinculada.update_attributes(params[:persona_vinculada])\n# if !archivo.nil?\n# File.open(path, \"wb\") { |f| f.write(archivo.read) }\n# end\n format.html { redirect_to @persona_vinculada, notice: 'Persona vinculada fue actualizada satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @persona_vinculada.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo.photoable, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"forms\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was updated successfully.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, :notice => 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @gallery = Gallery.find(params[:gallery_id])\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to gallery_path(@photo.gallery), notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.find(params[:id])\n\n respond_to do |format|\n if @photo.update_attributes(params[:photo])\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo1 = Photo1.find(params[:id])\n\n respond_to do |format|\n if @photo1.update_attributes(params[:photo1])\n format.html { redirect_to @photo1, notice: 'Photo1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo1.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foto_produto.update(foto_produto_params)\n format.html { redirect_to @foto_produto, notice: 'Foto produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @foto_produto }\n else\n format.html { render :edit }\n format.json { render json: @foto_produto.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 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 if @photo.update(photo_params)\n return render json: {info: 'Photo successfully updated'}\n else\n return render json: {exception: 'PhotoException', message: @photo.errors.full_messages}, status: 400\n end\n end",
"def update\r\n @photo = Photo.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @photo.update_attributes(params[:photo])\r\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @photo.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @photo_overview.update(photo_overview_params_edit)\n format.html { redirect_to hotel_overview_photo_overview_path(@hotel_overview, @photo_overview), notice: 'Photo overview was successfully updated.' }\n format.json { render :show, status: :ok, location: @photo_overview }\n else\n format.html { render :edit }\n format.json { render json: @photo_overview.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @prueba_json.update(prueba_json_params)\n format.html { redirect_to @prueba_json, notice: 'Prueba json was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prueba_json.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo, notice: 'Updated successfully.' }\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 respond_to do |format|\n if @efectivo.update(efectivo_params)\n format.html { redirect_to @efectivo, notice: 'Efectivo was successfully updated.' }\n format.json { render :show, status: :ok, location: @efectivo }\n else\n format.html { render :edit }\n format.json { render json: @efectivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to photos_url, notice: t(\"controllers.photos.update_success\") }\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 @rental = Rental.find(params[:id])\n rental_data = params[:rental]\n photo_ids = rental_data.delete :photo_ids\n\n respond_to do |format|\n if @rental.update_attributes(rental_data)\n update_photos_with_rental_id photo_ids, @rental\n\n format.html { redirect_to @rental, notice: 'Rental was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rental.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update \n authorize! :editar, @imagen_laboratorio.laboratorio\n respond_to do |format|\n if @imagen_laboratorio.update(imagen_laboratorio_params)\n format.html { redirect_to @imagen_laboratorio, notice: 'La imagen del laboratorio fue correctamente modificada.' }\n format.json { render :show, status: :ok, location: @imagen_laboratorio }\n else\n format.html { render :edit }\n format.json { render json: @imagen_laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_photo.update(recipe_photo_params)\n format.html { redirect_to @recipe_photo, notice: 'Recipe photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_photo }\n else\n format.html { render :edit }\n format.json { render json: @recipe_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @peso = Peso.find(params[:id])\n\n respond_to do |format|\n if @peso.update_attributes(params[:peso])\n format.html { redirect_to @peso, notice: 'Peso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_tags\n\n respond_to do |format|\n if @photo.update(photo_params)\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 @odontologo = Odontologo.find(params[:id])\n\n respond_to do |format|\n if @odontologo.update_attributes(params[:odontologo])\n format.html { redirect_to \"/administrador/odontologos\" }\n format.json { render json: @odontologo }\n else\n format.html { render text: \"error\" }\n format.json { render json: @odontologo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @hotel_photo.update(hotel_photo_params)\n format.html { redirect_to @hotel_photo, notice: 'Hotel photo was successfully updated.' }\n format.json { render :show, status: :ok, location: @hotel_photo }\n else\n format.html { render :edit }\n format.json { render json: @hotel_photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ejemplo.update(ejemplo_params)\n format.html { redirect_to @ejemplo, notice: 'Ejemplo was successfully updated.' }\n format.json { render :show, status: :ok, location: @ejemplo }\n else\n format.html { render :edit }\n format.json { render json: @ejemplo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end",
"def update\n respond_to do |format|\n \n if @pet.update(pet_params)\n if params[:images]\n params[:images].each { |image|\n @pet.images.create(image: image)\n }\n end\n if params[:selected]\n params[:selected].each { |selecte|\n @pet.images.destroy(selecte)\n }\n end\n if pet_params[:solved]\n format.html { redirect_to @pet}\n else\n format.html { redirect_to @pet, notice: 'Publicación actualizada correctamente.' }\n end\n format.json { render :show, status: :ok, location: @pet }\n else\n format.html { render :edit }\n format.json { render json: @pet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @arquivo = Arquivo.find(params[:id])\n\n respond_to do |format|\n if @arquivo.update_attributes(params[:arquivo])\n format.html { redirect_to @arquivo, notice: 'Arquivo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arquivo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @proyecto_imagen.update(proyectos_imagen_params)\n format.html { redirect_to @proyecto_imagen, notice: 'Proyecto imagen was successfully updated.' }\n format.json { render :show, status: :ok, location: @proyecto_imagen }\n else\n format.html { render :edit }\n format.json { render json: @proyecto_imagen.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n params.permit!\n @employeer_photo = EmployeerPhoto.find(params[:id])\n\n respond_to do |format|\n if @employeer_photo.update_attributes(params[:employeer_photo])\n format.html { redirect_to(@employeer_photo, :notice => 'Employeer photo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @employeer_photo.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n photo_params = params[:photo].clone\n if photo_params[:retakeable]\n photo_params[:retakeable] = %(yes true 1).include?(photo_params[:retakeable].to_s.downcase)\n photo_params[:retakeable] = nil if params[:photo][:retakeable] == 'unknown'\n end\n if photo_params[:accessibility]\n photo_params[:accessibility] = nil if params[:photo][:accessibility] == 'unknown'\n end\n respond_to do |format|\n if @photo.update_attributes(photo_params)\n format.html { redirect_to @photo, notice: 'Photo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @photo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @coleccion_imagene.update(coleccion_imagene_params)\n format.html { redirect_to @coleccion_imagene, notice: 'Coleccion imagene was successfully updated.' }\n format.json { render :show, status: :ok, location: @coleccion_imagene }\n else\n format.html { render :edit }\n format.json { render json: @coleccion_imagene.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @empresario.update(empresario_params) and @empresario.update_attributes(:modificador => current_user.id)\n format.html { redirect_to @empresario, notice: 'Empresario was successfully updated.' }\n format.json { render :show, status: :ok, location: @empresario }\n else\n format.html { render :edit }\n format.json { render json: @empresario.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo = Photo.with_attached_pictures.find(params[:id])\n @photo.user_id = current_user.id\n #@photo.update\n # raise @photo.inspect\n respond_to do |format|\n if @photo.update(photo_params)\n # raise @photo.inspect\n format.html { redirect_to album_photos_path, notice: \"Photo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @photo }\n else\n format.html { render :edit, status: :unprocessable_entity }\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 @emprego.update(emprego_params)\n format.html { redirect_to @emprego, notice: 'Emprego was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @emprego.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @capa = Capa.find(params[:id])\n\n respond_to do |format|\n if @capa.update_attributes(params[:capa])\n unless params[:capa_files].blank?\n params[:capa_files]['file'].each do |a|\n @capa_file = @capa.capa_files.create!(:file => a, :capa_id => @capa.id)\n end\n end\n format.html { redirect_to @capa, notice: 'Capa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @capa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if(@check)\n @evento.update(event_params.except(:token))\n if @evento.save\n #first we delete all the current images if there are\n if params[:event_image_data]\n @evento.event_images.each do |image|\n image.destroy\n end\n #then we will create new ones\n params[:event_image_data].each do |file|\n @evento.event_images.create!(:image => file)\n end\n end\n render json: @evento, status: :ok, location: @evento\n else\n render json: @evento.errors, status: :unprocessable_entity\n end\n end\n end",
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\n format.html { redirect_to @photo }\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 respond_to do |format|\n if @proyecto.update(proyecto_params)\n @proyecto.imagenes = params[:proyecto][:imagenes] if params[:proyecto][:imagenes].present?\n format.html { redirect_to @proyecto, notice: 'Proyecto editado correctamente.' }\n format.json { render :show, status: :ok, location: @proyecto }\n format.js\n else\n format.html { render :edit }\n format.json { render json: @proyecto.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end",
"def update\n respond_to do |format|\n if @ficheiro.update(ficheiro_params)\n format.html { redirect_to @ficheiro, notice: 'File was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ficheiro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @estatuto = Estatuto.find(params[:id])\n\n respond_to do |format|\n if @estatuto.update_attributes(params[:estatuto])\n format.html { redirect_to @estatuto, notice: 'Estatuto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @estatuto.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @photo_job = PhotoJob.find(params[:id])\n\n respond_to do |format|\n if @photo_job.update_attributes(params[:photo_job])\n format.html { redirect_to @photo_job, :notice => 'Photo job was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @photo_job.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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 respond_to do |format|\n if @photo.update(photo_params)\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"
] |
[
"0.6514478",
"0.64352906",
"0.6353353",
"0.6338215",
"0.6337079",
"0.6337079",
"0.6287684",
"0.6222424",
"0.6222141",
"0.6207968",
"0.6204778",
"0.61978185",
"0.6168992",
"0.61014175",
"0.61005306",
"0.6087029",
"0.6066618",
"0.6065872",
"0.6045812",
"0.6030342",
"0.6011959",
"0.6010257",
"0.60065025",
"0.6003797",
"0.6002811",
"0.5991021",
"0.5987007",
"0.5968889",
"0.5960126",
"0.5954943",
"0.5950862",
"0.5950862",
"0.5950862",
"0.5950862",
"0.5950862",
"0.5950862",
"0.594615",
"0.5944217",
"0.5942928",
"0.5942337",
"0.5941726",
"0.5940527",
"0.5938713",
"0.5933939",
"0.5933939",
"0.5933939",
"0.5933939",
"0.5921066",
"0.591915",
"0.59139264",
"0.5913511",
"0.5904532",
"0.58895075",
"0.58855605",
"0.58831793",
"0.58821476",
"0.58787316",
"0.5877502",
"0.58758533",
"0.5875615",
"0.5864187",
"0.5858347",
"0.58490825",
"0.58466935",
"0.5846597",
"0.58417004",
"0.58403146",
"0.58403146",
"0.58383596",
"0.5837141",
"0.5835022",
"0.5830887",
"0.58247185",
"0.58246255",
"0.58235884",
"0.58226335",
"0.5819846",
"0.58162487",
"0.58015144",
"0.5801295",
"0.5800856",
"0.5795804",
"0.57944953",
"0.5792164",
"0.5791334",
"0.57900757",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131",
"0.5789131"
] |
0.6861167
|
0
|
DELETE /fotos_empresas/1 DELETE /fotos_empresas/1.json
|
def destroy
@fotos_empresa.destroy
respond_to do |format|
format.html { redirect_to fotos_empresas_url, notice: 'Fotos empresa was successfully destroyed.' }
format.json { head :no_content }
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto = Foto.find(params[:id])\n @foto.destroy\n\n respond_to do |format|\n format.html { redirect_to fotos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @sample_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @structure_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @imagen_pedido = ImagenPedido.find(params[:id])\n @imagen_pedido.destroy\n\n respond_to do |format|\n format.html { redirect_to imagen_pedidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n\tCloudinary::Api.delete_resources([@foto.public_id])\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to @proyecto, notice: 'Foto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to fotos_url, notice: 'Foto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto.comentarios.each do |c|\n c.destroy\n end\n #@foto.calificaciones.each do |c|\n # c.destroy\n #end\n @foto.destroy\n respond_to do |format|\n format.html { redirect_to current_usuario, notice: 'Foto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto_galeri = FotoGaleri.find(params[:id])\n @foto_galeri.destroy\n\n respond_to do |format|\n format.html { redirect_to foto_galeris_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to @photo.item }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @rock_photo.destroy\n render json: {message: 'Foto Excluida'} , status: :ok\n end",
"def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.photo.destroy\n @photo.destroy\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 @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 @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 @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 if @photo.nill?\n render json: {error: 'foto no encontrada'}, status: :not_found\n else\n @photo.destroy\n end\n end",
"def destroy\n arquivo = Arquivo.find(@pregoestitulosgrafico.arquivo_id)\n\n File.delete(arquivo.caminho)\n\n pregoestitulo = Pregoestitulo.find(@pregoestitulosgrafico.pregoestitulo_id)\n \n @pregoestitulosgrafico.destroy\n respond_to do |format|\n format.html { redirect_to pregoestitulo, notice: 'Arquivo excluído com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @odontologo = Odontologo.find(params[:id])\n @odontologo.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/administrador/odontologos\" }\n format.json { head :no_content }\n end\n end",
"def destroy\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 @photo.destroy\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 @photo.destroy\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 @photo = Photo.find(params[:id])\n gallery = @photo.gallery\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to gallery_path(gallery) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to photos_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 @archivo.destroy\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @uploadphoto.destroy\n respond_to do |format|\n format.html { redirect_to uploadphotos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_photo.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_photos_url, notice: 'Restaurant photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n \r\n #eliminar foto de perfil \r\n r = Photo.where(\"#{:user_id} =?\",params[:id])\r\n #solo eliminar si posee foto de perfil \r\n if r.present?\r\n r.destroy_all\r\n end\r\n\r\n @usuario.destroy\r\n respond_to do |format|\r\n format.html { redirect_to usuarios_url, success: 'Eliminaste un usuario correctamenteed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\r\n @photo = Photo.find(params[:id])\r\n @photo.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to photos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @archivo = Archivo.find(params[:id])\n @archivo.destroy\n\n respond_to do |format|\n format.html { redirect_to archivos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @coleccion_imagene.destroy\n respond_to do |format|\n format.html { redirect_to coleccion_imagenes_url, notice: 'Coleccion imagene was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @image.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @image = Image.find(params[:id])\n \n imagen = @image.filename\n \n #function in manage_images.rb\n remove_image_file(imagen)\n \n @image.destroy\n\n respond_to do |format|\n format.html { redirect_to images_url }\n format.json { head :ok }\n end\n end",
"def destroy\n query = \"created_by = \\\"#{current_user.email}\\\"\"\n @photo = Photo.where(query).with_attached_images.find(params[:id])\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_path, notice: 'Destroyed successfully.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_photo = Photo.find(params[:id])\n @admin_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to edit_admin_gallery_path(:id=>@gallery.id) }\n format.json { render :json => true }\n end\n end",
"def destroy\n photo.destroy\n respond_to do |format|\n format.html { redirect_to admin_photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @salon_image.destroy\n respond_to do |format|\n format.html { redirect_to salon_salon_images_url(@salon), notice: 'Salon image was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @arquivo = Arquivo.find(params[:id])\n\n @comentarios = Comentario.where(:comentavel_id => @arquivo.id)\n\n if @comentarios\n @comentarios.delete_all\n end\n\n @arquivo.destroy\n\n respond_to do |format|\n format.html { redirect_to arquivos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = @allbum.photos.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to allbum_photos_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n alb=@photo.album\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to alb, notice: 'Фотография успешно удалена.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @producto_imagen.destroy\n respond_to do |format|\n format.html { redirect_to producto_imagenes_url, notice: 'Producto imagen 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 @locweb_thepic.destroy\n respond_to do |format|\n format.html { redirect_to locweb_thepics_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exura = Exura.find(params[:id])\n @exura.destroy\n\n respond_to do |format|\n format.html { redirect_to exuras_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n album=@photo.album\n @photo.destroy\n save_to_json\n respond_to do |format|\n format.html { redirect_to album_path(album), notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n respond_to do |format|\n format.html { redirect_to @photo.photoable }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo = Photo.find(params[:id])\n @photo.destroy\n\n head :no_content\n end",
"def destroy\n @adocao_animal = AdocaoAnimal.find(params[:id])\n @adocao_animal.destroy\n\n respond_to do |format|\n format.html { redirect_to adocao_animals_url }\n format.json { head :no_content }\n end\n end",
"def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end",
"def 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 #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 @photo.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: \"投稿を削除しました.\" }\n format.json { head :no_content }\n end\n \n end",
"def destroy\n @adm_galerias_imagem.destroy\n respond_to do |format|\n format.html { redirect_to adm_galerias_imagens_url, notice: 'Galerias imagem was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @plate_photo = PlatePhoto.find(params[:id])\n @plate_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to plate_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gallery.delete\n respond_to do |format|\n format.html { redirect_to galleries_url, notice: 'Gallery was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n set_redireccion\n @objeto.destroy\n respond_to do |format|\n format.html { redirect_to @redireccion, notice: 'Imagen was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @respuesta = Respuesta.find(params[:id])\n @respuesta.destroy\n\n respond_to do |format|\n format.html { redirect_to respuestas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n #@users_photo = UsersPhoto.find(params[:id])\n #@users_photo.destroy\n\n respond_to do |format|\n format.html { redirect_to users_photos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @photo.destroy\n respond_to do |format|\n format.html { redirect_to photos_url, notice: 'Photo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foto_produto.destroy\n respond_to do |format|\n format.html { redirect_to foto_produtos_url, notice: 'Foto produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @material_apoyo = MaterialApoyo.find(params[:id])\n\n begin\n File.delete(@material_apoyo.url)\n @material_apoyo.destroy\n flash[:mensaje] = \"Archivo Eliminado del sistema.\"\n rescue Exception => e\n flash[:mensaje] = \"Error al intentar eliminar. #{e.message}\"\n end\n respond_to do |format|\n format.html { redirect_to material_apoyos_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @retroalimentacion = Retroalimentacion.find(params[:id])\n @retroalimentacion.destroy\n\n respond_to do |format|\n format.html { redirect_to retroalimentacions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @imagedemo.destroy\n respond_to do |format|\n format.html { redirect_to imagedemos_url }\n format.json { head :no_content }\n end\n end",
"def 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 @realiza = Realiza.find(params[:id])\n @realiza.destroy\n\n respond_to do |format|\n format.html { redirect_to realizas_url }\n format.json { head :no_content }\n end\n end"
] |
[
"0.73268193",
"0.7246554",
"0.7215032",
"0.72038674",
"0.7198135",
"0.7140757",
"0.7135134",
"0.71095705",
"0.70867217",
"0.70660174",
"0.7062079",
"0.7054283",
"0.70417583",
"0.7038",
"0.7032899",
"0.7026498",
"0.7006211",
"0.6994916",
"0.69821143",
"0.6975315",
"0.697528",
"0.6973463",
"0.6973463",
"0.6958618",
"0.6956745",
"0.6956745",
"0.6956745",
"0.6956745",
"0.6956745",
"0.6949277",
"0.6949277",
"0.6949277",
"0.6949277",
"0.6949277",
"0.6949277",
"0.69392693",
"0.69275045",
"0.69224507",
"0.6919733",
"0.6905727",
"0.6900511",
"0.6897605",
"0.6897605",
"0.6897582",
"0.6889246",
"0.68836796",
"0.68830687",
"0.68828386",
"0.68789995",
"0.6874211",
"0.68738824",
"0.6868171",
"0.6865234",
"0.6860933",
"0.685683",
"0.6842245",
"0.6842245",
"0.683345",
"0.68250203",
"0.6824886",
"0.6819645",
"0.6817289",
"0.6812312",
"0.6810706",
"0.6805158",
"0.6800259",
"0.67992365",
"0.67973346",
"0.6790783",
"0.67874396",
"0.67859286",
"0.6785625",
"0.67839986",
"0.67820305",
"0.67761296",
"0.67753834",
"0.67732024",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.67723775",
"0.6771754",
"0.6768024",
"0.67670554",
"0.67667276",
"0.676107",
"0.67539966"
] |
0.7468334
|
0
|
Use callbacks to share common setup or constraints between actions.
|
def set_fotos_empresa
@fotos_empresa = FotosEmpresa.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 list of trusted parameters through.
|
def fotos_empresa_params
params.require(:fotos_empresa).permit(:name, :image, :estado)
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\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 strong_params\n params.require(:user).permit(param_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 allow_params_authentication!; end",
"def whitelisted_args\n args.select &:allowed\n end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def safe_list_sanitizer; end",
"def filtered_parameters; end",
"def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end",
"def strong_params\n params.require(:team_member).permit(param_whitelist)\n end",
"def expected_permitted_parameter_names; end",
"def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end",
"def strong_params\n params.require(:education).permit(param_whitelist)\n end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); end",
"def safe_list_sanitizer=(_arg0); 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 param_whitelist\n [:rating, :review]\n end",
"def check_params; true; end",
"def strong_params\n params.require(:experience).permit(param_whitelist)\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 allowed?(*_)\n true\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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end",
"def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\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 permitir_parametros\n \t\tparams.permit!\n \tend",
"def strong_params\n params.require(:community).permit(param_whitelist)\n end",
"def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end",
"def valid_params?; 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 url_allowlist=(_arg0); 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 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 list_params\n params.permit(:list_name)\n end",
"def valid_params_request?; end",
"def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end",
"def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end",
"def safelists; end",
"def authorize_own_lists\n authorize_lists current_user.lists\n end",
"def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end",
"def lists_params\n params.require(:list).permit(:name)\n\n end",
"def list_params\n params.require(:list).permit(:name, :user_id)\n end",
"def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end",
"def check_params\n true\n end",
"def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end",
"def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend",
"def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end",
"def filter_parameters; end",
"def filter_parameters; end",
"def whitelist; end",
"def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.permit(:name)\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end",
"def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end",
"def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end",
"def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end",
"def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end",
"def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end",
"def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end",
"def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end",
"def permitted_params\n []\n end",
"def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end",
"def params(list)\n @declared_params = list\n end",
"def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end",
"def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end",
"def allow(ids); end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end",
"def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end",
"def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end",
"def list_params\n params.require(:list).permit(:name)\n end",
"def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end",
"def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end",
"def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end",
"def safelist; end",
"def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end",
"def valid_for_params_auth?; end",
"def default_param_whitelist\n [\"mode\"]\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 shopping_list_params\n params.require(:shopping_list).permit!\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def permitted_params\n declared(params, include_missing: false)\n end",
"def safe_params\n params.except(:host, :port, :protocol).permit!\n end",
"def permitters\n @_parametrizr_permitters || {}\n end",
"def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end",
"def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end",
"def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end",
"def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end",
"def url_allowlist; end",
"def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end",
"def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end",
"def quote_params\n params.permit!\n end"
] |
[
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.6326454",
"0.63140553",
"0.6299814",
"0.62642586",
"0.626006",
"0.62578833",
"0.6236823",
"0.6227561",
"0.6221758",
"0.62200165",
"0.620879",
"0.61983657",
"0.6195055",
"0.6172993",
"0.6156856",
"0.61558664",
"0.61521494",
"0.6135789",
"0.6121145",
"0.61118174",
"0.60736513",
"0.6071645",
"0.60632104",
"0.60549796",
"0.6043906",
"0.6034662",
"0.60207325",
"0.6018568",
"0.6016575",
"0.60103434",
"0.60084206",
"0.600763",
"0.6007443",
"0.6003619",
"0.6003619",
"0.5995791",
"0.5993301",
"0.5993231",
"0.5984926",
"0.597122",
"0.5968121",
"0.5965808",
"0.59640145",
"0.59632224",
"0.59602356",
"0.59332967",
"0.5927556",
"0.5922805",
"0.5909745",
"0.5905083",
"0.5904304",
"0.5893434",
"0.58888215",
"0.58823985",
"0.58823985",
"0.58823985",
"0.5873434",
"0.58619875",
"0.58533794",
"0.5845531",
"0.58426666",
"0.58360124",
"0.583218",
"0.5828041",
"0.5827927",
"0.5816121",
"0.5814705",
"0.5812719",
"0.581121",
"0.5803423",
"0.5803423",
"0.57995003",
"0.5794207",
"0.5784923",
"0.5781365",
"0.5776385",
"0.5774859",
"0.57671493",
"0.5766998",
"0.57618684",
"0.5758038"
] |
0.0
|
-1
|
Keep URIs like this as they were input:
|
def path=(new_path)
super
if new_path[0..0] != '/' # addressable adds a / but scp-style uris are altered by this behavior
@path = path.sub(%r|^/+|,'')
@normalized_path = nil
validate
end
path
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def uri_normalizer; end",
"def normalize\n uri = dup\n uri.normalize!\n uri\n end",
"def normalize_uri(*strs)\n new_str = strs * '/'\n new_str = new_str.gsub!('//', '/') while new_str.index('//')\n new_str\n end",
"def normalize_uri\r\n self.link = Addressable::URI.heuristic_parse(self.link).normalize!.to_s if self.link\r\n end",
"def normalize_uri(*strs)\n new_str = strs * \"/\"\n\n new_str = new_str.gsub!(\"//\", \"/\") while new_str.index(\"//\")\n\n # Makes sure there's a starting slash\n unless new_str[0,1] == '/'\n new_str = '/' + new_str\n end\n\n new_str\n end",
"def clean_uri(uri)\n uri = uri.dup\n uri.path = \"\"\n uri.query = nil\n uri.fragment = nil\n uri\n end",
"def uri\n self + \"\"\n end",
"def uri\n self + \"\"\n end",
"def extract_uris(uri, uri_content)\n # empty --> this is like an abstract class method\n end",
"def to_uri\n URI(normalise)\n end",
"def coerce_uri incoming_uri\n if incoming_uri.is_a? Hash\n Addressable::URI.new deep_hash_normalize(incoming_uri)\n elsif incoming_uri\n Addressable::URI.parse incoming_uri\n end\n end",
"def uri\n @uri ||= select { |type,value| type == :uri }.map do |(type,value)|\n URI.parse(value)\n end\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def normalize_uri uri\n (uri =~ /^https?:/) ? uri : \"http://#{uri}\"\n end",
"def URI(url); end",
"def to_uri\n URI.parse self\n end",
"def extract_uris(uri, uri_content)\n # in our case, no new uri can be extracted from a web resource\n return Array.new()\n end",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def uri_normalize(uri)\n \treturn 'http://' + uri unless uri =~ /http:\\/\\//\n \turi\n\tend",
"def parse_uri(input)\n lines = parse_input input\n extract_uri lines\n end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def uri=(_arg0); end",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def unescape_uri(uri); end",
"def update_uri(p)\n update_attribute(:uri_actual, p)\n end",
"def tokenize_urls!\n @raw.gsub!(%r{http[\\w\\-\\#:/_.?&=]+}) do |url|\n maybe_parse_url(url) do |uri|\n path = uri.path.tap { |str| str.tr!('/_\\-', ' ') }\n query = uri.query.tap { |str| str&.tr!('?=&#_\\-', ' ') }\n fragment = uri.fragment.tap { |str| str&.tr!('#_/\\-', ' ') }\n\n \"#{uri.scheme} #{uri.host} #{path} #{query} #{fragment}\"\n end\n end\n end",
"def original_url; end",
"def normalize_uri\n \n # Don't do anything on blanks\n return if self.uri.blank?\n\n # Try to parse, and set to nil if it fails\n uri = Addressable::URI.heuristic_parse(self.uri) rescue nil\n\n # Seems like it's possible to get here with a non-blank URI\n return if uri.blank?\n\n # Normalize it!\n self.uri = uri.normalize.to_s\n\n end",
"def update_duplicate_uri\n # Checking if multiple content are present with the same uri the updating the uri\n duplicate_entries = Content.where(:uri=>self.uri)\n\n # Only change the uri if more than one entry is found for the current uri\n if duplicate_entries.length > 1\n old_uri = self.uri\n new_uri = old_uri+'_'+rand(100000).to_s\n\n # Updating the current uri with the newly generated uri\n self.update_attributes(:uri => new_uri)\n end\n # End of code for handling the content with same uri\n end",
"def to_urls!\n map! { |element| process_url_element(element) }\n end",
"def process_uri(uri)\n # empty --> this is like an abstract class method\n end",
"def canonical_uri; end",
"def normalize_links!\n # TODO: normalize Array of Symbol, String, DM::Property 1-jump-away or DM::Query::Path\n end",
"def process_uri(uri)\n URI.parse(uri)\n rescue URI::InvalidURIError\n uri_parts = uri.split('?')\n # regexp from Ruby's URI::Parser#regexp[:UNSAFE], with [] specifically removed\n encoded_uri = URI.encode(uri_parts.shift, /[^\\-_.!~*'()a-zA-Z\\d;\\/?:@&=+$,]/)\n encoded_uri << '?' << URI.encode(uri_parts.join('?')) if uri_parts.any?\n URI.parse(encoded_uri) rescue raise CarrierWave::DownloadError, \"couldn't parse URL\"\n end",
"def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end",
"def convert _obj\n if _obj.figures.length == 1 && _obj.figures.first.link.present?\n _obj.figures.first.link = _obj.figures.first.link.gsub(\"http://\", \"https://\")\n _obj.save!\n end\nend",
"def conform_uri(uri_string)\n uri_string.gsub(/^(?!\\/)(.*)/, '/\\1').gsub(/[\\/]+$/, '')\n end",
"def normalize_uri(uri)\n (uri =~ /^(https?|ftp|file):/) ? uri : \"http://#{uri}\"\n end",
"def result\n ::RDF::URI.new(value.sub(/^uri-/, ''))\n end",
"def normalize_url(url); end",
"def normalize!\n u = normalize\n @url = URI.parse(u)\n self\n end",
"def extract_uris( graph ) \n graph.terms.map{|t| t.to_s if t.uri?}.compact\nend",
"def square_uri\n square_params\n uri\n end",
"def merge_uri_with! details\n resource_uri = convert_id_to_uri(@resource_id)\n details.merge! :resource_uri => resource_uri\n end",
"def fix_url\n self.url = UrlNormalizer.normalize_entry_url self.url, self\n end",
"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 expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]+)/ do\n $1+url+$3\n end\n end",
"def fix_image_links(text, raw_uri, additional_path = '')\n readme_doc = Nokogiri::HTML(text)\n readme_doc.xpath(\"//img[@src]\").each() do |el|\n #puts 'img: '+el['src'].to_s\n unless el['src'].start_with?('http')\n el['src'] = ('%s/%s/' % [raw_uri, additional_path])+el['src']\n end\n end\n\n return readme_doc.to_s, readme_doc\nend",
"def expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]*)/ do\n $1+url+$3\n end\n end",
"def expand_urls(input, url='')\n url ||= '/'\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\\"'>]*)/ do\n $1+url+$3\n end\n end",
"def process_uris(element, value, evaluation_context, base, **options)\n return [] if value.to_s.empty?\n add_debug(element) {\"process_uris: #{value}\"}\n value.to_s.split(/\\s+/).map {|v| process_uri(element, v, evaluation_context, base, **options)}.compact\n end",
"def create_uri\n end",
"def urls\n @url.map do |el|\n case el\n when %r{^IANA$}\n IANA_URL % [ @media_type, @sub_type ]\n when %r{^RFC(\\d+)$}\n RFC_URL % $1\n when %r{^DRAFT:(.+)$}\n DRAFT_URL % $1\n when %r{^LTSW$}\n LTSW_URL % @media_type\n when %r{^\\{([^=]+)=([^\\}]+)\\}}\n [$1, $2]\n when %r{^\\[([^=]+)=([^\\]]+)\\]}\n [$1, CONTACT_URL % $2]\n when %r{^\\[([^\\]]+)\\]}\n CONTACT_URL % $1\n else\n el\n end\n end\n end",
"def normalize(sources)\n normalized = sources.map do |source|\n uri = URI.parse(source[:url])\n next unless uri.scheme =~ /\\Ahttps?\\z/\n\n s = {}\n s[:url] = \"#{uri.scheme}://#{uri.host}#{uri.path.gsub(/.git$/, '')}\"\n s[:token] = uri.user if uri.user\n s[:branch] = uri.fragment if uri.fragment\n source.merge(s)\n end\n normalized.compact\n end",
"def build_uri\n unless title.blank?\n self.uri = title.mb_chars.normalize(:d).split(//u).reject { |e| e.length > 1\n }.join.gsub(\"\\n\", \" \").gsub(/[^a-z0-9\\-_ \\.]+/i, '').squeeze(' '\n ).gsub(/ |\\.|_/, '-').gsub(/\\-+/, '-').gsub(/(^\\-)|(\\-$)/, '').downcase\n end\n end",
"def expand_urls(input, url=nil)\n url ||= root\n input.gsub /(\\s+(href|src)\\s*=\\s*[\"|']{1})(\\/[^\\/>]{1}[^\\\"'>]*)/ do\n $1 + expand_url($3, url)\n end\n end",
"def rebase_hrefs(input, base_uri)\n Utils.rebase_hrefs(input, base_uri) rescue input\n end",
"def correct_image_paths\n results = @content.scan(/src=\\\".*?\\\"/)\n # {|m| copy_image_locally m.gsub!(\"src=\", \"\").gsub!(\"\\\"\", \"\")}\n results.each do |result|\n copy_image_locally result.gsub!(\"src=\", \"\").gsub!(\"\\\"\", \"\")\n end\n end",
"def urlescape\n @@uri_parser ||= URI::RFC2396_Parser.new\n @@uri_parser.escape(self)\n end",
"def normalize_with_encoded_query\n normalize_without_encoded_query.tap do |uri|\n if uri.query_values.present?\n uri.query_values = uri.query_values.map { |key, value| [key, value] }\n end\n uri\n end\n end",
"def check_uri_build\n\n end",
"def cleanup_urls\n self.url = self.url.to_s.downcase\n end",
"def name_to_uris\n uri_set('networkUris', OneviewSDK::EthernetNetwork)\n uri_set('fcNetworkUris', OneviewSDK::FCNetwork)\n uri_set('fcoeNetworkUris', OneviewSDK::FCoENetwork)\n end",
"def normalize_base_uri(str) #:nodoc:\n str =~ /^https?:\\/\\// ? str : \"http#{'s' if str.include?(':443')}://#{str}\"\n end",
"def build_uri(uri)\n return uri if @region.nil? && @edge.nil?\n\n parsed_url = URI(uri)\n pieces = parsed_url.host.split('.')\n product = pieces[0]\n domain = pieces[-2, 2]\n new_edge = @edge\n new_region = @region\n\n case pieces.length\n when 4\n new_region ||= pieces[1]\n when 5\n new_edge ||= pieces[1]\n new_region ||= pieces[2]\n end\n\n new_region = @@default_region if !new_edge.nil? && new_region.nil?\n\n parsed_url.host = [product, new_edge, new_region, domain].reject(&:nil?).join('.')\n parsed_url.to_s\n end",
"def normalize_path(url); end",
"def normalize_path(url); end",
"def rebuild_id_uri\n self.id_uri = build_id_uri\n end",
"def process_uri(uri)\n URI.parse(URI.escape(URI.unescape(uri)))\n end",
"def process_uri(uri)\n URI.parse(URI.escape(URI.unescape(uri)))\n end",
"def scheme_set(scheme)\n rebuild_uri :scheme => scheme\n end",
"def clean(uri)\n uri = URI.parse(uri) unless uri.is_a? URI\n uri.fragment = ''\n uri.query = ''\n URI.parse(uri.to_s.gsub(/[?#\\/]+$/, ''))\n end",
"def uri_escape(input); end",
"def rewrite\n rewrited_content = parse_for_urls(content)\n parse_for_ids(rewrited_content)\n end",
"def parse(uri)\n URI.for(*self.split(uri), self)\n end",
"def correct_uri( url )\n uri = URI( url )\n if uri.scheme == 'http'\n case\n when uri.host.match( 'github.com' )\n # remove possible subdomain like 'wiki.github.com'\n uri = URI \"https://github.com#{uri.path}\"\n when uri.host.match( 'bitbucket.org' )\n uri = URI \"https://#{uri.host}#{uri.path}\"\n end\n end\n\n uri\n end",
"def 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 original_uri(encrypted_image_digest)\n return Config.urls_memo[encrypted_image_digest] if Config.urls_memo[encrypted_image_digest]\n Config.urls_memo[encrypted_image_digest] = SimpleEncryptor.decrypt(encrypted_image_digest, Config.secret_key)\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 to_uri\n URI(normalize)\n end",
"def uri=(u)\n # Remove any format extension (.json, .rdf etc.)\n ext = File.extname(u)\n @uri = ext.nil? || ext.empty? ? u : u.rpartition(ext)[0]\n end",
"def url=(_); end",
"def clean\n @url = @url.gsub(/\\s/, '+')\n @url = @url.gsub(/\\+{2,}/, '+')\n end",
"def reg_url2; /(.+)\\//; end",
"def reg_url2; /(.+)\\//; end",
"def path_set(path)\n absolute_path = (Pathname.new(uri.path) + path).to_s\n rebuild_uri :path => absolute_path\n end",
"def base_uri\n ary = contents_uri.to_s.split(\"/\")\n ary.pop if ary[-1].blank?\n ary.pop\n ary.join(\"/\") + \"/\"\n end",
"def strip_whitespace\n self.url = url.strip rescue ''\n self.explicit_refspec = explicit_refspec.strip rescue ''\n end",
"def fix_isgd_url!\n self.src_url.gsub!(%r{(http://is.gd/\\w+)[-/]}, '\\1')\n end",
"def sanitize\n self.original_url.strip!\n self.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n self.sanitize_url = \"http://#{self.sanitize_url}\"\n end",
"def encode_uri(chart_config_orig)\n chart_config = chart_config_orig.deep_dup\n chart_config.delete(:min_combined_school_date)\n chart_config.delete(:max_combined_school_date)\n encoded = chart_config.to_params_es.gsub(' ', '+')\n encoded = move_back_to_original_hash_position('timescale', chart_config, encoded)\n encoded = move_back_to_original_hash_position('filter', chart_config, encoded)\n decoded = decode_uri(encoded)\n [chart_config == decoded, encoded]\n end",
"def process_links!(source)\r\n links.each{ |l| source.gsub!(\"[[#{l}]]\", link(l)) }\r\n end",
"def file_to_uri(file); end",
"def file_to_uri(file); 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 normalize_uri(uri, parent_uri = nil)\n return nil if uri.nil?\n\n normalized = uri.is_a?(URI) ? uri : URI.parse(uri)\n\n if normalized.relative?\n return nil if !parent_uri\n normalized = URI.parse(parent_uri).merge(normalized)\n end\n\n scheme = normalized.scheme\n allowed_schemes = [ 'http' ]\n allowed_schemes << 'https' if @options[:allow_ssl]\n return nil unless allowed_schemes.include?(scheme)\n\n normalized = normalized.normalize\n\n query_string = normalized.select(:query)[0]\n normalized = normalized.select(:host, :path).join\n normalized += \"?#{query_string}\" if query_string\n\n normalized = CGI.unescape(normalized)\n normalized = \"#{scheme}://#{normalized}\"\n normalized = normalized.split('#').first\n \n return normalized\n end",
"def to_s\n reconstruct_uri\n end",
"def constituent_uris\n Array.wrap(constituents).uniq.delete_if(&:empty?)\n end",
"def to_uri_fragment\n # remove HTML tags from the input\n buf = gsub(/<.*?>/, '')\n\n # The first or only character must be a letter.\n buf.insert(0, 'a') unless buf[0,1] =~ /[[:alpha:]]/\n\n # The remaining characters must be letters, digits, hyphens (-),\n # underscores (_), colons (:), or periods (.) or Unicode characters\n buf.unpack('U*').map! do |code|\n if code > 0xFF or code.chr =~ /[[:alnum:]\\-_:\\.]/\n code\n else\n 32 # ASCII character code for a single space\n end\n end.pack('U*').strip.gsub(/[[:space:]-]+/, '-')\n end"
] |
[
"0.7110346",
"0.65558916",
"0.63931084",
"0.6074482",
"0.6025108",
"0.59675574",
"0.5935905",
"0.5935905",
"0.591151",
"0.59091246",
"0.5891018",
"0.58639556",
"0.58330065",
"0.5801311",
"0.5792798",
"0.57888573",
"0.5788427",
"0.5783444",
"0.5783444",
"0.57736105",
"0.57490593",
"0.57490593",
"0.57490593",
"0.57490593",
"0.57446927",
"0.57332546",
"0.57156634",
"0.5713145",
"0.57078844",
"0.5692985",
"0.5681519",
"0.56797343",
"0.5675946",
"0.5674051",
"0.5671444",
"0.565214",
"0.56415063",
"0.56397396",
"0.56364584",
"0.5631296",
"0.5620047",
"0.5611958",
"0.5609171",
"0.5608001",
"0.55896395",
"0.55817777",
"0.55749995",
"0.5564581",
"0.55644625",
"0.5556216",
"0.5542074",
"0.5542074",
"0.5535791",
"0.5532754",
"0.55174726",
"0.550193",
"0.55005157",
"0.5499669",
"0.5499558",
"0.5499268",
"0.5487658",
"0.5472541",
"0.5463799",
"0.54582536",
"0.5455739",
"0.54530466",
"0.5445015",
"0.54372334",
"0.54372334",
"0.5418983",
"0.5410037",
"0.5410037",
"0.53953016",
"0.5390611",
"0.5377564",
"0.53770334",
"0.5376904",
"0.53740686",
"0.5373548",
"0.53685427",
"0.5367633",
"0.536365",
"0.53599524",
"0.53573626",
"0.53560424",
"0.5349092",
"0.5349092",
"0.53451616",
"0.53407776",
"0.533235",
"0.532442",
"0.5324026",
"0.5303053",
"0.5302757",
"0.5299874",
"0.5299874",
"0.52873147",
"0.5287126",
"0.5283973",
"0.5280759",
"0.52629906"
] |
0.0
|
-1
|
Get the URI as a string in the same form it was input. Taken from Addressable::URI.
|
def to_s
@uri_string ||=
begin
uri_string = "#{normalized_authority}:#{normalized_path}"
if uri_string.respond_to?(:force_encoding)
uri_string.force_encoding(Encoding::UTF_8)
end
uri_string
end
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def to_s\n uri.to_s\n end",
"def to_s\n uri_string\n end",
"def to_s\n @uri.to_s\n end",
"def to_s\n @uri.to_s\n end",
"def to_s\n uri\n end",
"def to_s\n reconstruct_uri\n end",
"def to_s\n self.uri.to_s\n end",
"def to_s\n @uri\n end",
"def getURI()\n return @uri.to_s\n end",
"def to_s\n @uri\n end",
"def to_uri\n URI.parse(to_s)\n end",
"def to_uri\n URI(normalise)\n end",
"def to_uri\n URI(normalize)\n end",
"def to_addressable_uri\n @uri\n end",
"def uri\n @uri.to_s\n end",
"def to_uri\n URI.parse self\n end",
"def to_s\n return '' unless scheme && path\n\n uri = \"#{scheme}:/#{path}\"\n\n if query?\n query_string = query.map { |key, value| \"#{key}=#{value}\" }.join('&')\n\n uri += \"?#{query_string}\"\n end\n\n uri\n end",
"def to_uri\n build_uri\n end",
"def uri\n self + \"\"\n end",
"def uri\n self + \"\"\n end",
"def to_uri(uri, base_uri = nil)\n case base_uri\n when nil, ''\n Utils.normalize_uri(uri.to_s)\n else\n Utils.normalize_uri(base_uri) + Utils.normalize_uri(uri.to_s)\n end\n rescue URI::Error\n nil\n end",
"def to_url\n to_uri.to_s\n end",
"def to_s\n \"#{scheme}://#{host}#{path}\"\n end",
"def build_uri(uri = nil)\n if uri.nil?\n \"#{@path}\"\n else\n [\"#{@path}\", uri].join(\"/\")\n end\n end",
"def to_url\n\t\t\tto_uri.to_s\n\t\tend",
"def to_s\n u = uri\n u = u.gsub(/^mailto: */i, '')\n\n if cn.length > 0\n \"#{cn.inspect} <#{uri}>\"\n else\n uri\n end\n end",
"def _uri(uri, absolute = false, format = \"do\")\n return absolute ? \"#{uri}.#{format}\" : \"#{uri_prefix}#{uri ? uri : ''}.#{format}\"\n end",
"def to_uri\n uri_class = ::URI.const_get scheme.upcase\n uri_class.build host: host, path: path\n end",
"def uri( new_uri=nil )\n\t\tif new_uri\n\t\t\t@uri = URI( new_uri )\n\t\t\t@uri.host ||= self.addresses.first.to_s\n\n\t\t\tself.app_protocol( @uri.scheme )\n\t\t\tself.port( @uri.port )\n\t\tend\n\n\t\treturn @uri.to_s\n\tend",
"def full_uri\n \"#{host_uri}#{uri}\"\n end",
"def to_uri\n URI.parse(url)\n end",
"def to_s\n\t\turl.to_s\n\tend",
"def build_as_url\n URI(build_as_string)\n rescue Urb::InvalidUrl => e\n URI('/')\n end",
"def uri\n URI.new :scheme => scheme,\n :host => host,\n :path => path,\n :query => query\n end",
"def construct_url(uri)\n \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end",
"def url\n uri.to_s\n end",
"def to_s\n @url\n end",
"def absolute_uri (uri)\n return uri if @base_uris.empty?\n base = URI.parse(@base_uris.last)\n base.merge(uri).to_s\n end",
"def to_s\n url\n end",
"def uri\n @uri ||= begin\n uri = Addressable::URI.parse(sanitize_link(@link_string))\n uri.normalize\n uri.query_values = nil\n uri\n end\n end",
"def uri_for(uri_or_path, params = nil)\n if uri_or_path.kind_of? URI\n u = uri_or_path.dup\n\n u.host = @uri.host\n u.port = @uri.port\n u.scheme = @uri.scheme\n else\n u = uri.dup\n u.path = File.join(uri.path, uri_or_path)\n end\n\n u.query = query_string_for(params) if params\n u.to_s\n end",
"def to_s; @url; end",
"def to_s\n uri_or_empty_string_if_either_date_is_nil\n end",
"def cannonical_uri_string\n @cannonical_uri_string ||= if resource_collection_uri?\n \"#{@string}/#{UUID.generate}\"\n elsif resource_uri?\n @string\n else\n raise CloudKit::InvalidURIFormat\n end\n end",
"def normalise\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def to_query_string\n query = @uri.query\n query ? Wgit::Url.new(\"?#{query}\") : nil\n end",
"def to_uri_fragment\n # remove HTML tags from the input\n buf = gsub(/<.*?>/, '')\n\n # The first or only character must be a letter.\n buf.insert(0, 'a') unless buf[0,1] =~ /[[:alpha:]]/\n\n # The remaining characters must be letters, digits, hyphens (-),\n # underscores (_), colons (:), or periods (.) or Unicode characters\n buf.unpack('U*').map! do |code|\n if code > 0xFF or code.chr =~ /[[:alnum:]\\-_:\\.]/\n code\n else\n 32 # ASCII character code for a single space\n end\n end.pack('U*').strip.gsub(/[[:space:]-]+/, '-')\n end",
"def uri\n uri_prefix + Digest::MD5.hexdigest(self.address)\n end",
"def full_url\n [ self.class.base, normalize_uri ].join('')\n end",
"def uri\n \"#{base_uri}#{path}\"\n end",
"def to_uri\n date_as_uri_or_empty_if_nil\n end",
"def to_path\n path = @uri.path\n return nil if path.nil? || path.empty?\n return Wgit::Url.new('/') if path == '/'\n\n Wgit::Url.new(path).without_slashes\n end",
"def uri\n URI::Generic.build(host: addr, port: port)\n end",
"def uri\n URI::Generic.build(host: addr, port: port)\n end",
"def uri\n @uri ||= if @href then\n begin\n URI.parse @href\n rescue URI::InvalidURIError\n begin\n URI.parse(Addressable::URI.escape(@href))\n rescue Addressable::URI::InvalidURIError\n raise URI::InvalidURIError\n end\n end\n end\n end",
"def uri\n uri_for({}, nil)\n end",
"def to_s\n url\n end",
"def url\n uri.to_s\n end",
"def to_path\n path = @uri.path\n return nil if path.nil? || path.empty?\n return Wgit::Url.new('/') if path == '/'\n\n Wgit::Url.new(path).omit_slashes\n end",
"def get_uri\n unless self.uri == nil\n return self.uri\n else \n return repository.generate_uri(title)\n end\n end",
"def typecast_to_uri(value)\n URI(value)\n rescue ArgumentError\n nil\n end",
"def urlescape\n @@uri_parser ||= URI::RFC2396_Parser.new\n @@uri_parser.escape(self)\n end",
"def uri\n N::URI.new(self[:uri])\n end",
"def uri\n N::URI.new(self[:uri])\n end",
"def uri\n @uri ||= URI(url)\n end",
"def build_uri(uri)\n return uri if @region.nil? && @edge.nil?\n\n parsed_url = URI(uri)\n pieces = parsed_url.host.split('.')\n product = pieces[0]\n domain = pieces[-2, 2]\n new_edge = @edge\n new_region = @region\n\n case pieces.length\n when 4\n new_region ||= pieces[1]\n when 5\n new_edge ||= pieces[1]\n new_region ||= pieces[2]\n end\n\n new_region = @@default_region if !new_edge.nil? && new_region.nil?\n\n parsed_url.host = [product, new_edge, new_region, domain].reject(&:nil?).join('.')\n parsed_url.to_s\n end",
"def request_uri(uri)\n if has_colon_path_separator?(uri)\n path = hostname_and_path(uri).split(':').all_but_first.join('/')\n else\n path = hostname_and_path(uri).split('/').all_but_first.join('/')\n path.blank? ? nil : '/' + path\n end\n end",
"def to_uri info: false\n if info\n URI(_info_uri)\n else\n URI(_http_url)\n end\n end",
"def to_s\n return uri_builder_delegate.to_s if uri_builder_delegate\n specs = uri_builder_specs\n # if a.none? ????\n if specs.none?\n raise NoURISpecFound.new(self)\n end\n return specs.first.template.expand(self.variables || {}).to_s\n end",
"def to_s\n str = ''.dup\n if @scheme\n str << @scheme\n str << ':'\n end\n\n if @opaque\n str << @opaque\n else\n if @host || %w[file postgres].include?(@scheme)\n str << '//'\n end\n if self.userinfo\n str << self.userinfo\n str << '@'\n end\n if @host\n str << @host\n end\n if @port && @port != self.default_port\n str << ':'\n str << @port.to_s\n end\n str << @path\n if @query\n str << '?'\n str << @query\n end\n end\n if @fragment\n str << '#'\n str << @fragment\n end\n str\n end",
"def to_base\n return nil unless @uri.scheme && @uri.host\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def to_base\n return nil if @uri.scheme.nil? || @uri.host.nil?\n\n base = \"#{@uri.scheme}://#{@uri.host}\"\n Wgit::Url.new(base)\n end",
"def to_s\n @scheme + ':' +\n if @to\n @to\n else\n ''\n end +\n if @headers.size > 0\n '?' + @headers.collect{|x| x.join('=')}.join('&')\n else\n ''\n end +\n if @fragment\n '#' + @fragment\n else\n ''\n end\n end",
"def result\n ::RDF::URI.new(value.sub(/^uri-/, ''))\n end",
"def process_uri(uri)\n ret = uri\n\n require 'open-uri'\n require 'open_uri_redirections'\n begin\n open(uri, :allow_redirections => :safe) do |r|\n ret = r.base_uri.to_s\n end\n end\n\n ret\n end",
"def to_s\n url_value = value.to_s.tr('#;\\'\"\"', '').gsub(' ', '%20')\n id? ? \"/#{value}\" : \"#{name}=#{url_value}\"\n end",
"def uri\n @uri ||= select { |type,value| type == :uri }.map do |(type,value)|\n URI.parse(value)\n end\n end",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def get_URI()\n \t return @outputs[\"URI\"]\n \tend",
"def uri\n @uri ||= URI.parse @url if @url\n @uri\n end",
"def get_raw_uri(uri_s, branch)\n uri = URI(uri_s)\n\n case uri.host\n when 'github.com'\n uri_split = File.split(uri.path)\n return 'https://raw.githubusercontent.com/%s/%s/%s' % [uri_split[0], uri_split[1].rpartition('.')[0], branch]\n when 'bitbucket.org'\n uri_split = File.split(uri.path)\n return 'https://bitbucket.org/%s/%s/raw/%s' % [uri_split[0], uri_split[1], branch]\n end\n\n return ''\nend",
"def normalize\n Wgit::Url.new(@uri.normalize.to_s)\n end",
"def uri\n \"http://example.com#{base_path}#{anchor}\"\n end",
"def build_uri\n # Validate the scheme.\n scheme = build_scheme.upcase\n raise UnresolvableResourceError, 'scheme must be http or https' if scheme!='HTTP' && scheme!='HTTPS'\n \n # Build and normalize the URI.\n URI.const_get(scheme).\n build2(host: build_host, port: build_port(scheme), userinfo: build_userinfo, path: build_path, query: build_query).\n normalize\n end",
"def build_as_string\n if @host.nil? || @host.empty?\n raise Urb::InvalidUrl 'Host is can not be bil or empty'\n end\n\n \"#{safe_scheme}#{@host}#{safe_port}#{safe_path}#{safe_queries}\"\n end",
"def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters.each {|k,v| params_with_values << \"#{k}=#{v}\"}\n @base_url+'?'+params_with_values.join('&')\n end",
"def uri_path\n __getobj__.uri.path\n end",
"def build_uri(path)\n path = path.to_s\n unless path.match(/^\\//)\n path = \"/#{path}\"\n end\n base_uri + path\n end",
"def encode_uri(uri)\n uri = uri.join(\"/\") if uri.class == Array\n additional_encoding(URI.parse(URI.encode(uri)).to_s)\n end",
"def full_uri(path)\n raise NotImplementedError\n end",
"def to_s\n \"#{self.class}#url: #{url}\"\n end",
"def to_uri_format(to_format)\n return to_format.gsub(/\\W/, \"+\").gsub(/[+]+/, \"+\").force_encoding('UTF-8')\n end",
"def encode_URI_Component(path)\n return \"/\" + ERB::Util.url_encode(path)\n end",
"def to_s\n '/' + @path.map { |part|\n if part.is_a? String\n part\n elsif part.is_a? Symbol\n part.inspect\n else\n fail \"Invalid path part: #{part}\"\n end\n }.join('/')\n end",
"def uri (name,default=\"\")\n \n name=name.to_s\n #FIXME: bad urls (for example just www.example.com will produce an endless-loop\n if name.try(:include?, \"://\")\n return name[0..name.length-2] if name[-1,1]==\"/\"\n return name[0..name.length]\n else\n name +=\"/\" unless (name[name.length-1..name.length-1] == (\"/\" || \"#\")) || name.try(:include?, \":\")\n\n if name.index(\":\") \n t= @object_namespaces[name.split(\":\")[0].to_sym]\n t ||=\"\"\n t += \"/\" unless (t[t.length-1..t.length-1] == (\"/\" || \"#\") || t.blank?) || name.try(:include?, \":\")\n return uri( t+ normalize_local_name(name.split(\":\")[1])+\"/\")\n else \n t= default.blank? ? @base_uri : default\n t += \"/\" unless t[t.length-1..t.length-1]==\"/\"\n return uri( t + normalize_local_name(name))\n end\n end\n end",
"def to_uri(ast)\n f = file\n if f.nil? || f.empty?\n f = 'string:'\n else\n f = Puppet::Util.path_to_uri(f).to_s\n end\n offset = ast.offset\n URI(\"#{f}?line=#{line_for_offset(offset)}&pos=#{pos_on_line(offset)}\")\n end",
"def url(scheme: false)\n if scheme\n URI::Generic.build(scheme: type, host: addr, port: port).to_s\n else\n URI::Generic.build(host: addr, port: port).to_s\n end\n end",
"def full_path\n uri.request_uri\n end"
] |
[
"0.8432645",
"0.83854246",
"0.82970846",
"0.82970846",
"0.8071216",
"0.80264616",
"0.7997858",
"0.7971643",
"0.794352",
"0.78279793",
"0.7679003",
"0.7640053",
"0.7484552",
"0.7458709",
"0.73864716",
"0.7316196",
"0.7296652",
"0.7273483",
"0.71955323",
"0.71955323",
"0.7125588",
"0.7124205",
"0.70099044",
"0.6990697",
"0.6808328",
"0.6801295",
"0.6789945",
"0.6776344",
"0.6772418",
"0.6762331",
"0.67509377",
"0.67465377",
"0.6731176",
"0.6731032",
"0.6714658",
"0.67126346",
"0.6708765",
"0.6670126",
"0.6667181",
"0.66612124",
"0.6628158",
"0.66273695",
"0.6627227",
"0.66264874",
"0.66243035",
"0.65838534",
"0.65836805",
"0.6551752",
"0.65436184",
"0.652944",
"0.6501356",
"0.64913446",
"0.64881796",
"0.64881796",
"0.64760375",
"0.6474655",
"0.64721006",
"0.6443763",
"0.6438838",
"0.6424535",
"0.6414482",
"0.637249",
"0.6367957",
"0.6367957",
"0.6345294",
"0.6336246",
"0.6327191",
"0.632355",
"0.63200456",
"0.6319692",
"0.6315477",
"0.62917596",
"0.62889266",
"0.628882",
"0.6280277",
"0.62789786",
"0.627848",
"0.62696755",
"0.62696755",
"0.62696755",
"0.62696755",
"0.6268721",
"0.6249121",
"0.624865",
"0.62486094",
"0.6245352",
"0.6242176",
"0.6221969",
"0.62163",
"0.62020695",
"0.6196004",
"0.61948115",
"0.6194469",
"0.61830884",
"0.61506766",
"0.61491203",
"0.61445785",
"0.6142641",
"0.6136672",
"0.61339587"
] |
0.7956929
|
8
|
Return the actual scheme even though we don't show it
|
def inferred_scheme
'ssh'
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def scheme; end",
"def scheme; end",
"def scheme; end",
"def scheme; end",
"def scheme\n attributes.fetch(:scheme)\n end",
"def scheme\n attributes.fetch(:scheme)\n end",
"def scheme\n attributes.fetch(:scheme)\n end",
"def scheme\n\t\t\t@options[:scheme]\n\t\tend",
"def scheme\n fetch(:@scheme) { |grid_string| grid_string[0,2] }\n end",
"def full_scheme\n @full_scheme = (0..11).map { |n| (scheme[n] || @@natural_key_colors[n]) } unless @full_scheme\n @full_scheme\n end",
"def normalized_scheme\n scheme.strip.downcase if scheme\n end",
"def GetScheme(p_val)\n keep_lastargs @ole._invoke(1610678272, [p_val], [VT_BYREF|VT_BYREF|VT_DISPATCH])\n end",
"def GetScheme(p_val)\n keep_lastargs @ole._invoke(1610678272, [p_val], [VT_BYREF|VT_BYREF|VT_DISPATCH])\n end",
"def scheme\n ENV['CA_SCHEME'] || DEFAULT_SCHEME\n end",
"def scheme\n @scheme ||= headers[SCHEME_KEY]\n end",
"def scheme_name\n svc = minter\n return nil unless svc.present?\n\n scheme(svc: svc)&.name&.downcase\n end",
"def scheme!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 34 )\n\n type = SCHEME\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 168:10: 'scheme'\n match( \"scheme\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 34 )\n\n end",
"def scheme\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n return_value = SchemeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 138:20: uri\n @state.following.push(TOKENS_FOLLOWING_uri_IN_scheme_911)\n uri\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n end\n\n return return_value\n end",
"def scheme\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 22 )\n return_value = SchemeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n begin\n # at line 112:20: uri\n @state.following.push( TOKENS_FOLLOWING_uri_IN_scheme_973 )\n uri\n @state.following.pop\n # - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 22 )\n\n end\n \n return return_value\n end",
"def get_scheme_identifer\n data = get_schemes.select{|scheme| scheme[\"creditorSchemeId\"] == ENV['NUA_PAY_CREDIT_SCHEME_ID'] }\n if data.blank?\n raise \"Credit Scheme ID missing in the schemes\"\n else\n data.first[\"id\"]\n end\n end",
"def scheme\n unless defined?(@scheme)\n @scheme = solr_url.scheme if solr_url\n @scheme ||= user_configuration_from_key('solr', 'scheme')\n @scheme ||= default_scheme\n end\n @scheme\n end",
"def scheme_switch\n super\n end",
"def scheme=(_); end",
"def scheme(value = nil)\n if value\n @scheme = value\n else\n @scheme ||= 'http'\n end\n end",
"def determine_color_scheme\n @default_options.color_scheme = @highline.choose do |menu|\n menu.layout = :one_line\n menu.select_by = :name\n menu.header = nil\n menu.prompt = \"What color scheme would you like? \"\n menu.choice(\"none\") { :none }\n menu.choice(\"dark terminal background\") { :dark_bg }\n menu.choice(\"light terminal background\") { :light_bg }\n end\n end",
"def category_scheme\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n value = nil\n scheme11 = nil\n\n begin\n # at line 70:37: ';' ( WS )? 'scheme' '=' '\\\"' scheme '\\\"'\n match(T__11, TOKENS_FOLLOWING_T__11_IN_category_scheme_160)\n # at line 70:41: ( WS )?\n alt_8 = 2\n look_8_0 = @input.peek(1)\n\n if (look_8_0 == WS)\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 70:41: WS\n match(WS, TOKENS_FOLLOWING_WS_IN_category_scheme_162)\n\n end\n match(T__12, TOKENS_FOLLOWING_T__12_IN_category_scheme_165)\n match(T__13, TOKENS_FOLLOWING_T__13_IN_category_scheme_167)\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_scheme_169)\n @state.following.push(TOKENS_FOLLOWING_scheme_IN_category_scheme_171)\n scheme11 = scheme\n @state.following.pop\n match(T__14, TOKENS_FOLLOWING_T__14_IN_category_scheme_173)\n # --> action\n value = (scheme11 && @input.to_s(scheme11.start, scheme11.stop))\n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n\n return value\n end",
"def build_scheme\n case @https_value\n when FalseClass then 'http'\n when NilClass then base_value.scheme || 'http'\n else 'https'\n end\n end",
"def file_uri_scheme; end",
"def scheme\n request.scheme\n end",
"def scheme\n request.scheme\n end",
"def scheme\n scheme = @scheme\n\n if !scheme\n scheme = ENV['YOLO_OCUNIT_SCHEME']\n end\n\n return scheme\n end",
"def visit_scheme?(scheme)\n if scheme\n @schemes.include?(scheme)\n else\n true\n end\n end",
"def absolute?; !scheme.nil?; end",
"def scheme\n\t\treturn self.headers.url_scheme || 'http'\n\tend",
"def uri_scheme_without_suffix(scheme)\n return nil if scheme.blank?\n scheme.sub %r{:/*$}, \"\"\n end",
"def scheme=(v)\n check_scheme(v)\n set_scheme(v)\n v\n end",
"def shelfkey_scheme\n return 'sudoc' if scheme == 'SUDOC'\n\n 'other'\n end",
"def scheme(svc:)\n # Add the DOI service as an IdentifierScheme if it doesn't already exist\n scheme = IdentifierScheme.find_or_create_by(name: svc.name)\n if scheme.new_record?\n scheme.update(description: svc.description, active: true,\n for_identification: true, for_plans: true)\n end\n scheme\n end",
"def category_scheme\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 4 )\n value = nil\n scheme11 = nil\n\n begin\n # at line 43:37: SEMICOLON ( WS )? SCHEME EQUALS QUOTE scheme QUOTE\n match( SEMICOLON, TOKENS_FOLLOWING_SEMICOLON_IN_category_scheme_157 )\n # at line 43:47: ( WS )?\n alt_8 = 2\n look_8_0 = @input.peek( 1 )\n\n if ( look_8_0 == WS )\n alt_8 = 1\n end\n case alt_8\n when 1\n # at line 43:47: WS\n match( WS, TOKENS_FOLLOWING_WS_IN_category_scheme_159 )\n\n end\n match( SCHEME, TOKENS_FOLLOWING_SCHEME_IN_category_scheme_162 )\n match( EQUALS, TOKENS_FOLLOWING_EQUALS_IN_category_scheme_164 )\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_scheme_166 )\n @state.following.push( TOKENS_FOLLOWING_scheme_IN_category_scheme_168 )\n scheme11 = scheme\n @state.following.pop\n match( QUOTE, TOKENS_FOLLOWING_QUOTE_IN_category_scheme_170 )\n # --> action\n value = ( scheme11 && @input.to_s( scheme11.start, scheme11.stop ) ) \n # <-- action\n\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 4 )\n\n end\n \n return value\n end",
"def normalize_scheme(scheme)\n return \"http\" unless scheme\n scheme.to_s[/^\\w+/]\n end",
"def choseScheme()\n \tscheme = UI.select(\"Select scheme:\", [\"CIASMovie\", \"ZhongDuMovie\", \"BaoShan\", \"HuaChenMovie\", \"HengDian\"])\n\n\tENV[\"SCHEME\"] = scheme\n\tENV[\"APP_ID\"] = ENV[\"APP_ID_#{scheme}\"]\n\n end",
"def to_scheme\n scheme = @uri.scheme\n scheme ? Wgit::Url.new(scheme) : nil\n end",
"def to_scheme\n scheme = @uri.scheme\n scheme ? Wgit::Url.new(scheme) : nil\n end",
"def scheme_handlers; end",
"def scheme_handlers; end",
"def fontscheme(data)\n id = data.unpack('C').first\n\n name = {\n 0x00 => :XFSNONE, # No font scheme\n 0x01 => :XFSMAJOR, # Major scheme\n 0x02 => :XFSMINOR, # Minor scheme\n 0xff => :XFSNIL # Ninched state\n }[id]\n\n {\n FontScheme: id,\n FontScheme_d: name,\n }\n end",
"def scheme(new_scheme)\n allow_list = %w[ftp http rtmp rtsp https gopher mailto news nntp irc smb prospero telnet\n wais xmpp file data tel afs cid mid mailserver nfs tn3270 z39 skype smsto\n ed2k market steam bitcoin ob tg]\n unless allow_list.include?(new_scheme)\n raise Urb::InvalidUrl\n end\n\n @scheme = new_scheme\n\n self\n end",
"def set_scheme\n @scheme = Scheme.find(params[:id])\n end",
"def set_scheme\n @scheme = Scheme.find(params[:id])\n end",
"def color_scheme_helper(opts={})\n color_scheme = user_pref(:color_scheme)\n color_scheme = Settings.default_color_scheme if color_scheme.blank? && !opts[:allow_blank]\n color_scheme = 'red' if color_scheme == 'xmas' && !is_holiday_season?\n color_scheme\n end",
"def set_scheme(v)\n @scheme = v&.downcase\n end",
"def get_scm_url_style\n get_scm_url_warnings[0]\n end",
"def valid_scheme?\n !invalid_uri_error? && (@valid_schemes.include?(@scheme))\n end",
"def scheme\n @mongrel_headers['url_scheme'] || mongrel17_scheme\n end",
"def file_uri_scheme=(_arg0); end",
"def schemed?\n identifier_scheme.present?\n end",
"def identifier_scheme\n svc = minter\n return nil unless svc.present? && svc.name.present?\n\n # Add the DMP ID service as an IdentifierScheme if it doesn't already exist\n scheme = IdentifierScheme.find_or_create_by(name: svc.name.downcase)\n scheme.update(description: svc.description, active: true, for_plans: true) if scheme.new_record?\n scheme\n end",
"def scheme=(_arg0); end",
"def identifier_for(scheme)\n user_identifiers.where(identifier_scheme: scheme).first\n end",
"def get_format_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/formatScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['FormatScheme']\n rescue Exception=>e\n print e\n end\n end",
"def select_scheme(preferred_to_include: nil)\n if options[:scheme].to_s.length > 0\n # Verify the scheme is available\n unless schemes.include?(options[:scheme].to_s)\n UI.error(\"Couldn't find specified scheme '#{options[:scheme]}'. Please make sure that the scheme is shared, see https://developer.apple.com/library/content/documentation/IDEs/Conceptual/xcode_guide-continuous_integration/ConfigureBots.html#//apple_ref/doc/uid/TP40013292-CH9-SW3\")\n options[:scheme] = nil\n end\n end\n\n return if options[:scheme].to_s.length > 0\n\n if schemes.count == 1\n options[:scheme] = schemes.last\n elsif schemes.count > 1\n preferred = nil\n if preferred_to_include\n preferred = schemes.find_all { |a| a.downcase.include?(preferred_to_include.downcase) }\n end\n\n if preferred_to_include && preferred.count == 1\n options[:scheme] = preferred.last\n elsif automated_scheme_selection? && schemes.include?(project_name)\n UI.important(\"Using scheme matching project name (#{project_name}).\")\n options[:scheme] = project_name\n elsif Helper.ci?\n UI.error(\"Multiple schemes found but you haven't specified one.\")\n UI.error(\"Since this is a CI, please pass one using the `scheme` option\")\n show_scheme_shared_information\n UI.user_error!(\"Multiple schemes found\")\n else\n puts(\"Select Scheme: \")\n options[:scheme] = choose(*schemes)\n end\n else\n show_scheme_shared_information\n\n UI.user_error!(\"No Schemes found\")\n end\n end",
"def auth_scheme; end",
"def category_scheme_urn_id\n Instance.first.prefix + Instance.sep + category_scheme_prefix + Instance.sep + scheme_id.to_s.rjust(Instance.just, '0')\n end",
"def url_scheme\n if Pages.enterprise?\n Pages.scheme\n elsif owner == 'github' && domain.end_with?('.github.com')\n 'https'\n else\n 'http'\n end\n end",
"def scheme_with_host(domain=nil)\n ['http://', domain || self.name, '/'].join(\"\")\n end",
"def load_color_scheme\n if @options.color_scheme != :none then\n search_directories = [ Keybox::APP_RESOURCE_DIR, File.dirname(@options.config_file) ]\n scheme_basename = \"#{@options.color_scheme.to_s}.color_scheme.yaml\"\n scheme_path = nil\n\n # get the path to the file\n search_directories.each do |sd|\n if File.exists?(File.join(sd,scheme_basename)) then\n scheme_path = File.join(sd,scheme_basename)\n break\n end\n end\n\n # if we have a file then load it and make sure we have\n # all the valid labels.\n if scheme_path then\n initial_color_scheme = YAML::load(File.read(scheme_path))\n\n # make sure that everything is a Symbol and in the\n # process make sure that all of the required labels\n # are there.\n color_scheme = {}\n initial_color_scheme.each_pair do |label,ansi_seq|\n color_scheme[label.to_sym] = ansi_seq.collect { |a| a.to_sym }\n end\n\n # validate that all the required color labels exist\n if (NONE_SCHEME.keys - color_scheme.keys).size == 0 then\n ::HighLine.color_scheme = ::HighLine::ColorScheme.new(color_scheme)\n else\n @options.color_scheme = :none \n ::HighLine.color_scheme = ::HighLine::ColorScheme.new(NONE_SCHEME)\n\n @stdout.puts \"The color scheme in file '#{scheme_path}' is Invalid\"\n @stdout.puts \"It is missing the following items:\"\n\n (NONE_SCHEME.keys - color_scheme.keys).each do |missing_label|\n @stdout.puts \"\\t :#{missing_label}\"\n end\n\n @stdout.puts \"Not using any color scheme.\"\n end\n\n else\n # if we don't have a file then set the color\n # scheme to :none and we're done\n @options.color_scheme = :none\n ::HighLine.color_scheme = ::HighLine::ColorScheme.new(NONE_SCHEME)\n end\n else\n ::HighLine.color_scheme = ::HighLine::ColorScheme.new(NONE_SCHEME)\n end\n end",
"def absolute?\n if @scheme\n true\n else\n false\n end\n end",
"def get_color_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/colorScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['ColorScheme']\n rescue Exception=>e\n print e\n end\n end",
"def hier?\n !NON_HIER_SCHEMES.include?(scheme)\n end",
"def rack_url_scheme(scheme = T.unsafe(nil)); end",
"def scheme_set(scheme)\n rebuild_uri :scheme => scheme\n end",
"def show\n @scheme = Scheme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scheme }\n end\n end",
"def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end",
"def concept_scheme_title\n\n # Possible properties\n title_properties = [\"http://purl.org/dc/terms/title\",\n \"http://www.w3.org/2000/01/rdf-schema#label\",\n \"http://www.w3.org/2004/02/skos/core#prefLabel\"]\n\n title = \"\"\n\n conceptschemes = RDF::Query.execute(@graph) do\n pattern [:scheme, RDF.type, RDF::SKOS.ConceptScheme]\n end\n\n if conceptschemes.size == 1\n\n scheme = conceptschemes[0]\n @log.info(\"Looking for title for \" + scheme.scheme)\n\n scheme_info = RDF::Query.execute(@graph) do\n pattern [scheme.scheme, :predicate, :object]\n end\n\n scheme_info.each do |solution|\n\n case solution.predicate.to_s\n when *title_properties\n title = solution.object.value\n end\n end\n\n return title\n\n end\n\n end",
"def with_default_scheme(url)\n URI.parse(url).scheme.nil? ? 'http://' + url : url\n end",
"def schemes\n @schemes ||= if workspace?\n workspace.schemes.reject do |k, v|\n v.include?(\"Pods/Pods.xcodeproj\")\n end.keys\n else\n Xcodeproj::Project.schemes(path)\n end\n end",
"def show\n @loyalty_scheme = current_user.loyalty_schemes.find(params[:id])\n end",
"def custom_http_auth_scheme\n @custom_http_auth_scheme.to_s\n end",
"def shared_scheme(&block)\n @shared_scheme ||= block\n end",
"def get_font_scheme(slide_number,storage_type='',storage_name='')\n begin\n if @filename == ''\n raise 'No file name specified'\n end\n str_uri = $product_uri + '/slides/' + @filename + '/slides/' + slide_number.to_s + '/theme/fontScheme'\n if !storage_name.empty?\n str_uri += '?storage=' + storage_name\n end\n signed_uri = Aspose::Cloud::Common::Utils.sign(str_uri)\n response = RestClient.get(signed_uri, :accept => 'application/json')\n json = JSON.parse(response)\n return json['FontScheme']\n rescue Exception=>e\n print e\n end\n end",
"def get_format_scheme(name, slide_index, password = nil, folder = nil, storage = nil)\n data, _status_code, _headers = get_format_scheme_with_http_info(name, slide_index, password, folder, storage)\n data\n end",
"def flavour\n variables[:flavour]\n end",
"def prefix_scheme(scheme = :http)\n unless %i[http https].include?(scheme)\n raise \"scheme must be :http or :https, not :#{scheme}\"\n end\n\n return self if absolute? && !scheme_relative?\n\n separator = scheme_relative? ? '' : '//'\n Wgit::Url.new(\"#{scheme}:#{separator}#{self}\")\n end",
"def generate_color_scheme\n if values_bits[Constants::V_Use_of_colors]<=2.5 #No colors \n if values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness > Constants::Min_lightness#image as bg\n scheme = 'dark'\n elsif values_bits[Constants::V_Type_of_BG]<4.5 and @image_colors[0].get_lightness < Constants::Min_lightness\n scheme = 'light'\n elsif values_bits[Constants::V_Darkness]<=4.5#Light\n scheme = 'dark'\n elsif values_bits[Constants::V_Darkness]>=4.5#Dark\n scheme = 'light'\n end\n \n if scheme == 'dark'\n @colors[0]=Colour.new(255,255,255)\n @colors[1]=Colour.new\n @colors[2]=Colour.new\n @colors[3]=Colour.new\n @colors[4]=Colour.new(40,40,40)\n @colors[5]=Colour.new(55,55,55)\n @colors[6]=Colour.new(70,70,70)\n @colors[7]=Colour.new\n elsif scheme == 'light'\n @colors[0]=Colour.new\n @colors[1]=Colour.new(255,255,255)\n @colors[2]=Colour.new(255,255,255)\n @colors[3]=Colour.new(255,255,255)\n @colors[4]=Colour.new(240,240,240)\n @colors[5]=Colour.new(235,235,235)\n @colors[6]=Colour.new(230,230,230)\n @colors[7]=Colour.new(255,255,255)\n end\n \n else #Colors\n #Main color (colors[1] - colors[3])\n if values_bits[Constants::V_Main_color]<=2 #Complementary main pic\n @colors[1] = @image_colors[1].get_complementary\n elsif values_bits[Constants::V_Main_color]>2 and values_bits[Constants::V_Main_color]<=5 #Contrast main pic\n @colors[1] = @image_colors[1].get_contrasted\n elsif values_bits[Constants::V_Main_color]>5 and values_bits[Constants::V_Main_color]<=8 #main_pic\n @colors[1] = @image_colors[1]\n else #random\n @colors[1] = Colour.new.get_random_color()\n end\n @colors[2] = colors[1].get_lighter\n @colors[3] = colors[1].get_darker\n \n #Accent colors (colors[4] - colors[6])\n if values_bits[Constants::V_Accent_colors]<=2 #secondary\n accent_colors = @image_colors[2].get_analogous\n @colors[4]=@image_colors[2]\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>2 and values_bits[Constants::V_Accent_colors]<=4.5 #triadic\n accent_colors = colors[1].get_triadic\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n elsif values_bits[Constants::V_Accent_colors]>4.5 and values_bits[Constants::V_Accent_colors]<=8 #analogous\n accent_colors = colors[1].get_analogous\n 3.times do |n|\n @colors[n+4] = accent_colors[n]\n end\n else #complementary\n @colors[4] = colors[1].get_complementary\n accent_colors = colors[4].get_analogous\n 2.times do |n|\n @colors[n+5] = accent_colors[n]\n end\n end\n \n #Background color (colors[0])\n if values_bits[Constants::V_BG_color]<7 #Plain background\n if values_bits[Constants::V_Darkness]>4.5 #Dark design \n @colors[0]=colors[1].get_dark\n else #Light design\n @colors[0]=colors[1].get_pale\n end\n else\n @colors[0]=Colour.new\n end\n \n #Text color (colors[7])\n if values_bits[Constants::V_Type_of_BG]>=4.5 #Contrast with plain background\n if values_bits[Constants::V_Darkness]<4.5 #Light bg\n @colors[7]=Colour.new\n else #Dark bg\n @colors[7]=Colour.new(255,255,255)\n end\n else #Contrast with picture as background\n if @image_colors[0].get_lightness > Constants::Min_lightness\n @colors[7]=Colour.new\n else\n @colors[7]=Colour.new(255,255,255)\n end\n end\n end\n \n @background = @colors[0]\n end",
"def gruber_find(text, schemes = nil)\n schemes = schemes.nil? ? nil : schemes.to_a\n if schemes.nil? then\n scheme_re = $gruber_re_scheme\n else\n scheme_alt = schemes.join('|')\n scheme_re = \"(?:(?:#{scheme_alt}):(?:/{1,3}))\"\n end\n scheme_rec = $gruber_re_front + scheme_re + $gruber_re_back\n gruber_re = Regexp.new(scheme_rec)\n return text.scan(gruber_re).map { |o| o[0] }\nend",
"def configure_schemes(project, name, platforms)\n share_schemes(project, name, platforms)\n add_testable_entries(project, name, platforms)\n\n Xcodeproj::Project.schemes(\"#{Dir.pwd}/#{$project_name}.xcodeproj\").each do |scheme|\n puts \"Scheme: #{scheme}\"\n end\nend",
"def identifier_for(scheme)\n identifiers.by_scheme_name(scheme, 'User')&.first\n end",
"def scheme_relative?\n start_with?('//')\n end",
"def identifier_format\n scheme = identifier_scheme&.name\n return scheme if %w[orcid ror fundref].include?(scheme)\n\n return 'ark' if value.include?('ark:')\n\n doi_regex = %r{(doi:)?[0-9]{2}\\.[0-9]+/.}\n return 'doi' if value.match?(doi_regex)\n\n return 'url' if value.starts_with?('http')\n\n 'other'\n end",
"def permission_scheme\n # Get the permission scheme class variable\n class_variables.include?('@@permission_scheme') ? class_variable_get(:@@permission_scheme) : {}\n end",
"def scheme(*contexts)\n Ablerc.scheme = contexts\n end",
"def check_scheme(v)\n if v && parser.regexp[:SCHEME] !~ v\n raise InvalidComponentError,\n \"bad component(expected scheme component): #{v}\"\n end\n\n return true\n end",
"def actual_color\n ColorCode.where(numeric_code: default_code.split(\"-\")[-2])[0]\n end",
"def scheme(env)\n if env['HTTPS'] == 'on'\n 'https'\n elsif env['HTTP_X_FORWARDED_PROTO']\n env['HTTP_X_FORWARDED_PROTO'].split(',')[0]\n else\n env['rack.url_scheme']\n end\n end",
"def scheme( env )\n if env['HTTPS'] == 'on'\n 'https'\n elsif env['HTTP_X_FORWARDED_PROTO']\n env['HTTP_X_FORWARDED_PROTO'].split(',')[0]\n else\n env['rack.url_scheme']\n end\n end",
"def schemes=(new_schemes)\n @schemes = new_schemes.map(&:to_s)\n end",
"def result\n ::RDF::URI.new(value.sub(/^uri-/, ''))\n end",
"def valid_uri_schemes\n %w[http https file]\n end",
"def theme_resolver\n theme(current_account.account_prefix) if DmCore.config.enable_themes\n end",
"def full_uri\n\n return nil unless self.uri\n self.uri.index('/') ? self.uri : \"/defs/#{self.uri}\"\n end"
] |
[
"0.78328466",
"0.78328466",
"0.78328466",
"0.78328466",
"0.7430929",
"0.7430929",
"0.7430929",
"0.7211511",
"0.7109889",
"0.7078122",
"0.693763",
"0.68889755",
"0.68889755",
"0.68122107",
"0.67955506",
"0.67838484",
"0.66584194",
"0.65200454",
"0.6509008",
"0.6499369",
"0.64234596",
"0.64110076",
"0.63764864",
"0.6364205",
"0.6327259",
"0.6315685",
"0.6271673",
"0.6267828",
"0.62600756",
"0.62600756",
"0.6259697",
"0.6240021",
"0.62028515",
"0.619728",
"0.6192215",
"0.6164364",
"0.61297286",
"0.6109724",
"0.6105323",
"0.6058223",
"0.6051119",
"0.60211563",
"0.60211563",
"0.60132164",
"0.60132164",
"0.60062134",
"0.5954381",
"0.59459126",
"0.59459126",
"0.5939195",
"0.5924177",
"0.5917249",
"0.59043133",
"0.58994186",
"0.5882661",
"0.58820856",
"0.5856695",
"0.5853907",
"0.580693",
"0.57822996",
"0.5764529",
"0.57594466",
"0.5758998",
"0.575802",
"0.57440954",
"0.57117516",
"0.5686381",
"0.56698406",
"0.5656374",
"0.56345445",
"0.562923",
"0.5621231",
"0.5572523",
"0.5531795",
"0.55167556",
"0.5497597",
"0.5471243",
"0.5453642",
"0.54468954",
"0.5439712",
"0.54022294",
"0.5373802",
"0.5373352",
"0.5362133",
"0.53408706",
"0.53377706",
"0.5335544",
"0.53248507",
"0.53044575",
"0.5294795",
"0.52896106",
"0.52836084",
"0.52751553",
"0.5247043",
"0.5247002",
"0.51784307",
"0.5158689",
"0.51540184",
"0.5148701",
"0.5134085"
] |
0.64082265
|
22
|
Scp style URIs are always ssh
|
def ssh?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def ssh_uri\n new_uri = @uri.host\n new_uri = \"#{@uri.user}@#{new_uri}\" if @uri.user\n\n return new_uri\n end",
"def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end",
"def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end",
"def ssh_url\n uri = URI.parse(git_url)\n uri.scheme = 'ssh'\n uri.path = ''\n uri.fragment = nil\n uri\n end",
"def ssh_uri\n unless @uri.host\n raise(InvalidConfig,\"URI does not have a host: #{@uri}\",caller)\n end\n\n new_uri = @uri.host\n new_uri = \"#{@uri.user}@#{new_uri}\" if @uri.user\n\n return new_uri\n end",
"def inferred_scheme\n 'ssh'\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def ssh_string\n uri = ssh_url\n user = \"#{uri.userinfo}@\" if uri.userinfo\n port = \":#{uri.port}\" if uri.port\n [user,uri.host,port].join\n end",
"def sshAndScp\n return contentHost.sshAndScp\n end",
"def protocol\n if origin_url =~ /https?:\\/\\//\n 'http'\n else\n 'ssh'\n end\n end",
"def kind\n :ssh\n end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def ssh_type; end",
"def parse_url url\n begin\n URI.parse(url)\n \n rescue URI::InvalidURIError\n if m = url.match(\"^(#{USERINFO})@(#{HOST}):(#{REL_PATH})$\")\n URI::Generic.new \"ssh\", m[1], m[2], 22, nil, \"/\" + m[3], nil, nil, nil\n \n else\n raise\n end\n end\n end",
"def check_git_ssh_source(s)\n if git = s[:git]\n if git =~ %r{\\w+\\@(\\w|\\.)+\\:(/\\w+)*}\n results.add_warning('source', 'Git SSH URLs will NOT work for ' \\\n 'people behind firewalls configured to only allow HTTP, ' \\\n 'therefore HTTPS is preferred.', true)\n end\n end\n end",
"def initialize_ssh; end",
"def url_for_fetching\n server = Settings.git_server(url)\n if server.mirror.present?\n url.gsub(%r{(git@|https://).*?(:|/)}, server.mirror)\n else\n url\n end\n end",
"def ssh(*args)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n options << ssh_uri\n options += args\n\n return system('ssh',*options)\n end",
"def ssh(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str(_path_of_servers, command))\n end",
"def valid_git_ssh_url?(url)\n url.match(GIT_SSH_URL_REGEX)\n end",
"def normalized_host; end",
"def uri_host; end",
"def ssh(*arguments)\n options = []\n\n # Add the -p option if an alternate destination port is given\n if @uri.port\n options += ['-p', @uri.port.to_s]\n end\n\n # append the SSH URI\n options << ssh_uri\n\n # append the additional arguments\n arguments.each { |arg| options << arg.to_s }\n\n return system('ssh',*options)\n end",
"def host_local_url(host, path)\n if host.is_cygwin?\n path_result = on(host, \"cygpath #{path}\")\n path = path_result.raw_output.chomp\n end\n \"file://#{path}\"\nend",
"def console_url\n URI::HTTPS.build(:host => hostname, :port => port)\n end",
"def groupon_path(repo)\n github = \"github.groupondev.com\"\n ENV[\"INTERNAL_GEMS_OVER_SSH\"] ? \"git@#{github}:#{repo}.git\" : \"https://#{github}/#{repo}.git\"\nend",
"def raw_host_with_port; end",
"def home_path\n @ssh_home\n end",
"def sshhost\n \"#{script.cluster}.osc.edu\"\n end",
"def to_s()\n return \"ssh:#{@parameters[:user]}@#{@parameters[:host]}\"\n end",
"def assemble_urls( servers, repo_path, protocol=\"http://\")\n urls = \"\"\n servers.each do |server|\n Chef::Log.debug \"Setting up Repo server: #{server}\"\n urls << \"#{protocol}#{server}#{repo_path} \\n\"\n end \n urls.chomp\n urls\n end",
"def _ssh(path_of_servers, sshpass_command, user_exec_command)\n if path_of_servers.size == 0\n return \"#{sshpass_command} #{user_exec_command}\"\n end\n\n server = path_of_servers.shift\n #shell command needs double quote's escape\n sshpass_command += \"\\\"#{one_ssh_str(server)}\"\n _ssh(path_of_servers, sshpass_command, user_exec_command)\n end",
"def ssh\n platform_service(:ssh)\n end",
"def sub_url (p)\n res = (p != \"\") ? \"http://\" + request.host + \":3000\" + p.sub(\"/execute/\", \"/rest2/\") : p\n end",
"def ssh_cmd(destination_host, cmd)\n\n if strict_host_checking\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n else\n [\n 'ssh', '-t',\n '-p', OodCore::Job::Adapters::Helper.ssh_port,\n '-o', 'BatchMode=yes',\n '-o', 'UserKnownHostsFile=/dev/null',\n '-o', 'StrictHostKeyChecking=no',\n \"#{username}@#{destination_host}\"\n ].concat(cmd)\n end\n end",
"def dup_ssh(&block)\n Snapsync.debug \"Opening new ssh session: \"+uri.to_s\n Net::SSH.start(uri.host, uri.user, password: uri.password, non_interactive: true, &block)\n end",
"def ssh_array\n [\"-o StrictHostKeyChecking=no\", \"-l '#{Base.user}'\", '-i \"'+full_keypair_path+'\"']\n end",
"def ssh_hostfile(file)\n CommandRunner.instance.ssh_hostfile file\n end",
"def page_url\n if service == 'stash' && protocol == 'ssh'\n pattern = /(.*)@([^:]*):?([^\\/]*)\\/([^\\/]*)\\/(.*)\\.git/\n replacement = 'https://\\2/projects/\\4/repos/\\5/browse?at=' +\n current_branch\n elsif service == 'stash' && protocol == 'http'\n pattern = /(.*)@([^:\\/]*)(:?[^\\/]*)\\/(.*)scm\\/([^\\/]*)\\/(.*)\\.git/\n replacement = 'https://\\2\\3/\\4projects/\\5/repos/\\6/browse?at=' +\n current_branch\n elsif protocol == 'ssh'\n pattern = /(.*)@(.*):(.*)\\.git/\n replacement = 'https://\\2/\\3/'\n elsif protocol == 'http'\n pattern = /https?\\:\\/\\/(([^@]*)@)?(.*)\\.git/\n replacement = 'https://\\3/'\n end\n origin_url.sub(pattern, replacement)\n end",
"def rsync_port\n \"-e 'ssh -p #{port}'\"\n end",
"def host_as_string; end",
"def smart_add_url_protocol\n return if self.original.blank?\n unless self.original[/\\Ahttp:\\/\\//] || self.original[/\\Ahttps:\\/\\//]\n self.original = \"http://#{self.original}\"\n end\n end",
"def orcid_https_uri\n return if orcid.blank?\n # orcid uri should ALWAYS be http://\n orcid_uri.gsub('http', 'https')\n end",
"def insert_urls\n # match all variables, every variable begins with an at (@).\n # variables can also end with a semicolon to have a safe declaration.\n ip = Thread.current['client'].connect_address.ip_address\n port = Thread.current['client'].connect_address.ip_port\n @output = @output.gsub(/self\\:\\/\\//) {\n \"http://#{ip}#{\":\" + port.to_s if port != 80}/\"\n }\n end",
"def file_uri_scheme; end",
"def ssh_command\n args = domain!\n args = \"#{user}@#{args}\" if user?\n args << \" -i #{identity_file}\" if identity_file?\n args << \" -p #{ssh_port}\" if ssh_port?\n args << \" -t\"\n \"ssh #{args}\"\n end",
"def url(style = self.default)\n path = self.path(style)\n host = self.host\n host = self.aliases[path.hash % self.aliases.count] unless self.aliases.empty?\n return \"#{host}#{path}\"\n end",
"def url\n # HACK: Revisit and make configurable separate from the connection options.\n \"http://#{@uploader.sftp_host}/#{path}\"\n end",
"def ssh_primary(host, cmd, cf)\n \n user = cf.get_user\n pass = cf.get_passwd\n\n begin\n ssh = Net::SSH.start(host, user, :password => pass)\n out = ssh.exec!(cmd)\n ssh.close\n puts out\n rescue StandardError => e\n puts e.to_s\n end \n\nend",
"def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end",
"def shorthand_url(input)\n input.gsub /(https?:\\/\\/)(\\S+)/ do\n $2\n end\n end",
"def url(opts = {})\n opts = opts.to_h.compact.symbolize_keys\n\n host = opts.fetch(:host, \"default\").to_s\n path = opts.fetch(:path, \"\").to_s\n @template.expand url: @base_url + @ssh_url, host: host, path: path\n end",
"def sf_uri_regex\n { uri: %r{\\b(\n (((ht|f)tp[s]?://)|([a-z0-9]+\\.))+\n (?<!@)\n ([a-z0-9\\_\\-]+)\n (\\.[a-z]+)+\n ([\\?/\\:][a-z0-9_=%&@\\?\\./\\-\\:\\#\\(\\)]+)?\n /?\n )}ix,\n protocol: /((ht|f)tp[s]?)/i }\n end",
"def prefix_scheme(scheme = :http)\n unless %i[http https].include?(scheme)\n raise \"scheme must be :http or :https, not :#{scheme}\"\n end\n\n return self if absolute? && !scheme_relative?\n\n separator = scheme_relative? ? '' : '//'\n Wgit::Url.new(\"#{scheme}:#{separator}#{self}\")\n end",
"def configured_uri_for(uri)\n uri = uri.gsub(\"git@github.com:\", \"https://github.com/\")\n if /https?:/ =~ uri\n remote = URI(uri)\n config_auth =\n Bundler.settings[remote.to_s] || Bundler.settings[remote.host]\n remote.userinfo ||= config_auth\n remote.to_s\n else\n uri\n end\n end",
"def square_url\n square_uri.to_s\n end",
"def ssh_send_url_ruby(host, username, command, content_url)\n content_url = URI.parse(URI.encode(content_url.to_s))\n ssh_ruby(host, username, command) do |channel|\n HTTPClient.new.get_content(content_url) do |chunk|\n channel.send_data chunk\n end\n end\n end",
"def ssh\n @ssh ||= Net::SSH.start(self, self['user'] || \"root\" , self['ssh'])\n end",
"def ssh\n @ssh ||= @remote.connect\n @remote\n end",
"def absolute?; !scheme.nil?; end",
"def parse_url(input)\n hosts = \"github\\.com|bitbucket\\.org|gitlab\\.com\"\n\n # HTTPS/HTTP link pointing to recognised hosts\n if input =~ /^(?:https?:\\/\\/)?(?:[^.@]+@)?(?:www\\.)?(#{hosts})\\/([^\\/]+)\\/([^\\/]+)/i\n { host: $1.downcase(), user: $2, repo: $3.sub(/\\.git$/, \"\") }\n # SSH\n elsif input =~ /^git@(#{hosts}):([^\\/]+)\\/([^\\/]+)\\.git$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # provider:user/repo\n elsif input =~ /^(github|bitbucket|gitlab):\\/?([^\\/]+)\\/([^\\/]+)\\/?$/i\n { host: $1.downcase(), user: $2, repo: $3 }\n # user/repo - Common GitHub shorthand\n elsif input =~ /^\\/?([^\\/]+)\\/([^\\/]+)\\/?$/\n { host: \"github.com\", user: $1, repo: $2 }\n else\n raise \"Unsupported URL: #{input}\"\n end\nend",
"def to_host\n host = @uri.host\n host ? Wgit::Url.new(host) : nil\n end",
"def to_host\n host = @uri.host\n host ? Wgit::Url.new(host) : nil\n end",
"def uri_parts(uri)\n uri_parts = {\n :protocol => JenkinsPullover::Github::Client::GITHUB_API_PROTOCOL,\n :host => JenkinsPullover::Github::Client::GITHUB_API_HOST,\n :uri => uri\n }\n end",
"def allowed_ssh?\n port_protocol_allowed('22')\n end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def host; end",
"def transform_automation_url(arg)\n return arg unless arg.start_with?(\"http\")\n\n remote_file = determine_remote_filename(arg)\n github_match = GITHUB_REGEX.match(arg)\n\n arg = if arg.start_with?(\"https://gist.github.com\")\n arg.sub( # rubocop:disable Style/StringConcatenation\n \"https://gist.github.com\", \"https://gist.githubusercontent.com\"\n ) + \"/raw\"\n elsif github_match\n new_url = arg.sub(GITHUB_REGEX, \"https://raw.githubusercontent.com\")\n github_tree_match = GITHUB_TREE_REGEX.match(arg)\n github_blob_match = GITHUB_BLOB_REGEX.match(arg)\n\n if github_tree_match\n new_url.sub(\"/tree/\", \"/\")\n elsif github_blob_match\n new_url.sub(\"/blob/\", \"/\")\n else\n \"#{new_url}/#{Bridgetown::Utils.default_github_branch_name(arg)}\"\n end\n else\n arg\n end\n\n \"#{arg}/#{remote_file}\"\n end",
"def urls(resource)\n \"https://what.cd/#{resource}\"\n end",
"def ssh_without_dquote_command(path_of_servers, command)\n _path_of_servers = path_of_servers.dup\n remove_first_localhost!(_path_of_servers)\n Open3.capture3(ssh_str_without_dquote_command(_path_of_servers, command))\n end",
"def get_protocol(url)\n url_partitioned_at_colon = url.partition(\":\")\n url_partitioned_at_colon[0]\nend",
"def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end",
"def key_for(url)\n url.to_s.downcase.gsub(\"https\",'http').gsub(/\\s+/,' ')\n end",
"def host=(_); end",
"def host\n local_file? ? \"file://\" : split_url[1]\n end",
"def ssh_cli_string(id)\n server = @connection.servers.get(id)\n \"ssh -i #{self.key_path} #{self.login_user}@#{server.public_ip_address}\"\n end",
"def remote?\n %w[http https].include? scheme\n end",
"def negotiate!; end",
"def long_url_with_protocol\n if self.long_url[0..7]=='https://' or self.long_url[0..6]=='http://'\n return self.long_url\n else\n return 'https://'+ self.long_url\n end\n end",
"def tiny_ssh?\n cc.defines.include? 'MRB_SSH_TINY'\n end",
"def initialize(ssh_uri)\n uri = URI(ssh_uri)\n @host = uri.host\n @port = uri.port || 22\n @user = uri.user || ENV['USER']\n if uri.password\n @password = uri.password\n else\n @key = \"#{ENV['HOME']}/.ssh/id_rsa\"\n end\n end",
"def canonical_repository_url\n \"https://#{@settings.host}/scm/#{attributes[:repository_namespace]}/#{attributes[:repository_name]}.git\"\n end",
"def peer\n \"#{ssl ? 'https://' : 'http://' }#{rhost}:#{rport}\"\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 ssh_host_signature(host)\n Config::Core::File.new(@path + \"ssh-host-#{host}\")\n end",
"def scp?\n true\n end",
"def permanent_url\n config = ::Configuration.instance\n host = config.handles[:use_ghr] ?\n \"https://hdl.handle.net\" : config.handles[:base_url].chomp(\"/\")\n [host, self.handle].join(\"/\")\n end",
"def url() \n\t #'http://' << ENV['DOMAIN'] << \n\t '/' << self.author.username.to_s << '/' << self.name.to_s\n end",
"def desc\n \"SSH command shell\"\n end",
"def pathSourceHyper\n\t\"../../HyperOpen/\"\nend"
] |
[
"0.72554946",
"0.70845014",
"0.70845014",
"0.70845014",
"0.696894",
"0.68910515",
"0.6838482",
"0.6838482",
"0.6838482",
"0.6736807",
"0.6676267",
"0.66227716",
"0.6365412",
"0.6365412",
"0.6365412",
"0.6365412",
"0.61838436",
"0.61682683",
"0.58329433",
"0.5824551",
"0.582268",
"0.57742363",
"0.56981856",
"0.5614431",
"0.56033814",
"0.5593959",
"0.5591756",
"0.55746305",
"0.5570075",
"0.5559931",
"0.5537662",
"0.55310875",
"0.55055314",
"0.5502928",
"0.55019325",
"0.5493518",
"0.54744434",
"0.5431826",
"0.5431149",
"0.54232675",
"0.54088",
"0.53866273",
"0.5382848",
"0.5359787",
"0.534435",
"0.5336682",
"0.5334039",
"0.53306246",
"0.53287596",
"0.5311245",
"0.5291062",
"0.52821577",
"0.52744806",
"0.52744806",
"0.526922",
"0.52680564",
"0.5253259",
"0.5226497",
"0.52149683",
"0.5203355",
"0.52022874",
"0.5198127",
"0.5195333",
"0.5191807",
"0.51898086",
"0.51898086",
"0.5188787",
"0.51807",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.517926",
"0.5173178",
"0.5171474",
"0.5168936",
"0.5166219",
"0.5161765",
"0.5161765",
"0.516028",
"0.51581997",
"0.51538455",
"0.5139984",
"0.51384795",
"0.51258117",
"0.5119685",
"0.51170427",
"0.5103851",
"0.5101729",
"0.5099268",
"0.50925756",
"0.5091567",
"0.5088434",
"0.5080109",
"0.5079617",
"0.50687075"
] |
0.5773217
|
22
|
Is this an scp formatted uri? (Yes, always)
|
def scp?
true
end
|
{
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
[
"def absolute_url?(string); end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n unless uri.slice(SCP_REGEXP).nil?\n return true\n end\n\n false\n end",
"def url?(uri)\n /\\w+\\:\\/\\// =~ uri\n end",
"def uriish? str\n (str.include? ':') && (UriSniffRx.match? str)\n end",
"def file_uri?(uri)\n uri =~ %r{\\Afile://}\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 is_url?\n path =~ URL_PATHS\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(SSH_REGEXP).nil?\n return true\n end\n\n unless uri.slice(GIT_REGEXP).nil?\n return true\n end\n\n false\n end",
"def is_url?(path)\n path.to_s =~ %r{\\Ahttps?://}\n end",
"def valid_git_ssh_url?(url)\n url.match(GIT_SSH_URL_REGEX)\n end",
"def is_url?( path )\n path =~ URI::ABS_URI\nend",
"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 mirror?\n source_type == 'url'\n end",
"def absolute_url?\n (self.include?('://') || self.start_with?('/')) ? true : false\n end",
"def is_uri?(source)\n !!(source =~ URI_REGEXP)\n end",
"def trackable?(uri)\n uri && uri.absolute? && %w(http https).include?(uri.scheme)\n end",
"def ok_to_extract?(remote_url)\n true\n end",
"def git_url?(url)\n url.include?('.git') || url.include?('git@') || url.include?('git://')\n end",
"def remote?\n %w[http https].include? scheme\n end",
"def url?(value)\n URI.parse(value.to_s).scheme\n end",
"def absolute_uri?(source)\n source.kind_of?(String) && URI.parse(source).absolute?\n rescue URI::InvalidURIError\n false\n end",
"def valid_uri?\n !self.contentable.blank? || !self.uri_path.blank?\n end",
"def same_host?(uri)\n uri.host == @url.host\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w[http https].include?(uri.scheme)\n rescue URI::BadURIError, URI::InvalidURIError\n false\n end",
"def same_source_host?\n parse(@url).host == parse(@source_url).host\n end",
"def uri?(string)\n\t\turi = URI.parse(string)\n\t\t%w( http https ).include?(uri.scheme)\n\trescue URI::BadURIError\n\t\tfalse\n\trescue URI::InvalidURIError\n\t\tfalse\n\tend",
"def url_ok(url)\n return url =~ URI::ABS_URI\n end",
"def is_file_uri(uri)\n uri =~ %r{\\Afile://}\n end",
"def internal_source?(uri)\n uri = URI.parse(uri.to_s)\n\n internal_host?(uri.host) if uri.host\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"def file_url?(url)\n name = File.basename(url)\n name.include?('.zip') || name.include?('.tar.gz')\n end",
"def uri?(string)\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\nrescue URI::BadURIError\n false\nrescue URI::InvalidURIError\n false\nend",
"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?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\n end",
"def is_a_uri?(value)\n uri = URI.parse(value)\n uri.is_a?(URI::HTTP) && !uri.host.nil? && uri.host.split(\".\").size > 1\n rescue URI::InvalidURIError\n false\n end",
"def uri?\n !!@uri\n end",
"def uri?\n !!@uri\n end",
"def url?(string)\n begin\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end\n end",
"def real_url?\n url && url.present? && url != \"#\"\n end",
"def secure_uri?(uri)\n %w[https wss].include? uri.scheme\n end",
"def local?\n @uri.scheme == 'file'\n end",
"def is_file_source_a_remote_url?\n !self.remote_url.blank?\n end",
"def is_uri?(uri)\n URI::Generic===uri\n end",
"def email_uri?\n @url[0..6] == 'mailto:'\n end",
"def remote_file?\n file? && @remote_file\n end",
"def remote?\n !(url =~ /^https?/).nil?\n end",
"def url_has_a_dot_in?\n (external_resource_url =~ /\\./ )\n end",
"def valid?\n (uri.host =~ LINK_REGEX || uri.host =~ LINK_IP_REGEX) ? true : false\n end",
"def url_provided?\n @url = params[:url]\n @url.present? && @url.strip\n end",
"def here?(uri)\n @exported_uri.include?(uri)\n end",
"def uri?(string)\n URI.parse(string)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"def url?\n !urn?\n end",
"def wp_is_stream( path )\n return false unless path.include?('://') # path isn't a stream\n\n scheme_separator = path.index('://')\n\n stream = path.slice(0, scheme_separator)\n Railspress::PHP.stream_get_wrappers.include? stream\n end",
"def validate_uri(uri)\n unless uri.is_a?(String)\n return false\n end\n\n unless uri.slice(HG_REGEXP).nil?\n return true\n end\n\n false\n end",
"def remote_file_exists?(full_path)\n capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip == 'true'\nend",
"def is_url? string\n uri = URI.parse(string)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"def fake_url?\n url =~ /^\\d\\d\\d\\d-/\n end",
"def remote_file_exists? remote_path\n 'true' == capture(\"if [ -e #{remote_path} ]; then echo 'true'; fi\").strip\nend",
"def valid_url?(url)\n uri = URI.parse(url)\n\n uri.absolute?\n rescue\n false\n end",
"def fully_copied?(item)\n base = File.basename(item.to_s.chomp)\n cmd = \"#{@rsync_cmd} --dry-run #{@origin}/#{base} #{@dst}\"\n SingleLogger.instance.info cmd\n r_output = `#{cmd}`\n lines = r_output.split(\"\\n\")\n lines.size == 4 && lines[1] == \"\"\n end",
"def is_url?\n self =~ /^#{URI::regexp}$/\n end",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend",
"def scheme_relative?\n start_with?('//')\n end",
"def url_has_protocol(url) \n\treturn (url.include? \"http\") || (url.include? \"https\")\nend",
"def good_resource?(url)\n if rx_url\n !(url.to_s !~ rx_url)\n else\n true\n end\n end",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend",
"def remote_file_exists?(full_path)\n 'true' == capture(\"if [ -e #{full_path} ]; then echo 'true'; fi\").strip\nend",
"def validate_target_bosh_host\n URI.parse(target_bosh_host)\n true\n rescue\n false\n end",
"def absolute?\n @uri.absolute?\n end",
"def is?(url)\n return true if url.match('https?://github\\.com/(.+)/(.+)')\n end",
"def is_absolute_part(part)\n part.strip.starts_with?('/') || part.strip.starts_with?('\\\\') ||\n part.strip =~ /^[A-Za-z]:([\\/\\\\])?/\n end",
"def absolute?; !scheme.nil?; end",
"def infer_scm_from_uri\n if @uri\n if (@scm = SCM.infer_from_uri(@uri))\n return true\n end\n end\n\n return false\n end",
"def remote_symlink_exists?(full_path)\n remote_filetest_passes?('-L', full_path)\n end",
"def remote?\n uri = URI.parse url\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n if @type == \"image\"\n @ignored = true\n return true if url.match(/^data:image/)\n end\n\n false\n end",
"def url?\n !url.nil?\n end",
"def ssh?\n true\n end",
"def absolute?(path); end",
"def url?(link)\n true if link =~ /\\Ahttps?:\\/\\//\nend",
"def is_url?(url)\n\t\tputs \"Validate the URL format is valid: #{url}\" if @verbose\n\t\tbegin\n\t\t\tif url =~ /(http|https)\\:\\/\\/((.)+)/i\n\t\t\t\thost=$2.split('/')[0]\n\t\t\t\thost=host.split(':')[0]\n\t\t\t\tif is_ip?(host) or is_fqdn?(host)\n\t\t\t\t\treturn true\n\t\t\t\telse\n\t\t\t\t\treturn false\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tputs \"Unknown URL format: #{url}\" if @verbose\n\t\t\t\treturn false\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\t\treturn false\n\t\tend\n\tend",
"def base_url?( url_path )\n @base_url ||= base_url.gsub(/http\\:\\/\\/[^\\/]+/, '')\n @base_url == url_path\n end",
"def base_url?( url_path )\n @base_url ||= base_url.gsub(/http\\:\\/\\/[^\\/]+/, '')\n @base_url == url_path\n end",
"def has_console_uri?\n !! (bucket && keypath)\n end",
"def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end",
"def valid_url?\n !Sailpoint.config.url.blank?\n end",
"def open?(uri); end",
"def part_of_current_url?(url)\n url = url.is_a?(String) ? url : polymorphic_path(url)\n url == '/' ? request.request_uri == '/' : request.request_uri.starts_with?(url)\n end",
"def isitLink?(message)\n uri = URI.parse(message)\n %w( http https ).include?(uri.scheme)\n rescue URI::BadURIError\n false\n rescue URI::InvalidURIError\n false\n end",
"def valid_url?(url)\n return false if url.nil? || url.strip.empty?\n\n URI(url)\n true\n rescue URI::InvalidURIError\n false\n end",
"def uri?(word)\n return false if config.include_uris\n !(word =~ URI.regexp).nil?\n end",
"def requested_public_url?\n request.env['PATH_INFO'].ends_with?('/desktop_client/version')\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 scm_location?\n false\n end",
"def cltn_path?( path )\n path.split( \"|\" ).size == 4\n end",
"def is_internal_uri?(uri, host_name, host_port)\n return ((uri.scheme == \"http\") && (uri.host == host_name) && (uri.port.to_s == host_port)) \n end"
] |
[
"0.6560364",
"0.6531914",
"0.65225935",
"0.6519746",
"0.6457378",
"0.64513016",
"0.643928",
"0.6393079",
"0.63580143",
"0.62727237",
"0.6253669",
"0.6205099",
"0.61840314",
"0.6169451",
"0.6145825",
"0.6132675",
"0.60920477",
"0.6088567",
"0.60739416",
"0.6042817",
"0.6013927",
"0.60137194",
"0.60068196",
"0.6002733",
"0.59967923",
"0.59660095",
"0.5958813",
"0.59576523",
"0.5957257",
"0.5939719",
"0.59271353",
"0.59271353",
"0.5921771",
"0.5915201",
"0.5912148",
"0.5905335",
"0.5897763",
"0.5877501",
"0.586689",
"0.586689",
"0.5860881",
"0.5858958",
"0.58531386",
"0.5849172",
"0.5844088",
"0.5843396",
"0.5818615",
"0.58173573",
"0.58165896",
"0.5795263",
"0.57903165",
"0.57843703",
"0.5781452",
"0.57633936",
"0.57628995",
"0.5759351",
"0.57530934",
"0.5752688",
"0.5744981",
"0.5744845",
"0.57310873",
"0.5722705",
"0.5719761",
"0.5715556",
"0.57067543",
"0.57047564",
"0.5703681",
"0.5703556",
"0.5702078",
"0.5702078",
"0.5702078",
"0.5702078",
"0.57010925",
"0.569257",
"0.5682318",
"0.5678849",
"0.56740314",
"0.5670786",
"0.56586474",
"0.56407034",
"0.56357014",
"0.5618757",
"0.5616602",
"0.5607815",
"0.55977166",
"0.5591849",
"0.5591849",
"0.55858237",
"0.5585681",
"0.558168",
"0.5580867",
"0.55756336",
"0.5562068",
"0.55511224",
"0.5539017",
"0.5518028",
"0.5513523",
"0.55103517",
"0.550485",
"0.54968154"
] |
0.7442469
|
0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.